@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/montserrat-cyr-400.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/montserrat-cyr-600.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/montserrat-cyr-700.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/montserrat-lat-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/montserrat-lat-600.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/montserrat-lat-700.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --navy: #173f78;
    --blue: #1f59b0;
    --blue-dark: #18498f;
    --gold: #1f59b0;
    --ink: #263544;
    --muted: #516272;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --line: #e6e6e6;
    --line-strong: #d4d4d4;
    --soft: #e8f1fb;
    --danger: #b42318;
    --bs-body-font-family: Montserrat, "Segoe UI", Arial, sans-serif;
    --bs-font-sans-serif: Montserrat, "Segoe UI", Arial, sans-serif;
    --bs-body-bg: #f5f5f5;
    --bs-body-line-height: 1.5;
    --bs-body-color: #263544;
    --bs-border-color: #e5e7eb;
    --bs-primary: #1f59b0;
    --bs-link-color: #1f59b0;
    --bs-link-hover-color: #18498f;
    --bs-border-radius: 8px;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-size: 1.125rem;
}

.admin-body {
    font-size: 1rem;
    background: var(--bg);
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 12px;
}

.survey-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    text-wrap: balance;
    max-width: 18em;
    margin-bottom: 20px;
}

html[lang="kk"] {
    --bs-body-font-family: "Segoe UI", Montserrat, Arial, sans-serif;
    --bs-font-sans-serif: "Segoe UI", Montserrat, Arial, sans-serif;
}

.lang-switch {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
}

.lang-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.lang-switch a.is-active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.lang-lead {
    color: var(--muted);
    margin-bottom: 16px;
}

.lang-panel {
    padding-bottom: 24px;
}

.lang-pick {
    display: grid;
    gap: 12px;
}

.lang-pick .btn {
    min-height: 64px;
    font-size: 1.25rem;
}

h2 {
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 700;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
}

a {
    color: var(--blue);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--blue-dark);
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.likert label:focus-within,
.choice label:focus-within {
    outline: none;
    border-color: var(--blue);
}

.likert input:focus,
.choice input:focus {
    outline: none;
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    z-index: 20;
    background: #fff;
    color: var(--navy);
    font-weight: 700;
    padding: 8px 12px;
}

.skip-link:focus {
    top: 8px;
}

.wrap {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.header-bar {
    color: var(--ink);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 12px 0;
}

.header-inner-wide {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.header-rule {
    display: none;
}

.brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover,
.brand:hover .brand-name {
    color: var(--ink);
}

.brand-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: cover;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    border: 1px solid #eadfcb;
}

.brand-logo-emblem {
    object-fit: contain;
    padding: 4px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-org {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
    max-width: 18rem;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--ink);
}

.header-user {
    color: var(--muted);
}

.header-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.header-link:hover {
    color: var(--blue-dark);
}

.header-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
}

.header-btn:hover {
    background: var(--soft);
    color: var(--blue-dark);
    border-color: #c9d6f5;
}

.page {
    padding: 32px 0 56px;
}

.lead {
    font-size: 1.15rem;
    max-width: 65ch;
    margin-bottom: 8px;
}

.meta,
.page-note,
.section-note,
.hint,
.muted {
    color: var(--muted);
}

.meta,
.page-note {
    margin-bottom: 20px;
}

.section-note,
.hint {
    margin-bottom: 12px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.06);
    padding: 24px 24px 8px;
    margin-bottom: 16px;
}

.field {
    margin-bottom: 16px;
}

.field label,
.check {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin: 0;
}

.optional {
    font-weight: 400;
    color: var(--muted);
}

.req {
    color: var(--danger);
    margin-left: 4px;
}

.field-error {
    color: var(--danger);
    font-weight: 700;
    margin: 6px 0 0;
}

.form-control,
.form-select {
    background: #fff;
    border: 1px solid #c9d2e0;
    border-radius: 8px;
    min-height: 2.75rem;
    font-size: 1.05rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(31, 89, 176, 0.16);
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary {
    --bs-btn-bg: #1f59b0;
    --bs-btn-border-color: #1f59b0;
    --bs-btn-hover-bg: #18498f;
    --bs-btn-hover-border-color: #18498f;
    --bs-btn-active-bg: #153f78;
    --bs-btn-active-border-color: #153f78;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-focus-shadow-rgb: 31, 89, 176;
}

.btn-outline-secondary {
    --bs-btn-color: #1f59b0;
    --bs-btn-border-color: #d6e2f2;
    --bs-btn-hover-bg: #e8f1fb;
    --bs-btn-hover-color: #18498f;
    --bs-btn-hover-border-color: #1f59b0;
    --bs-btn-active-bg: #dbe8f8;
    --bs-btn-active-color: #153f78;
    --bs-btn-bg: #fff;
    font-weight: 600;
}

.btn:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
    box-shadow: none;
}

.question {
    border: 0;
    border-bottom: 1px solid var(--line);
    margin: 0 0 8px;
    padding: 8px 0 20px;
    min-width: 0;
}

.question:last-child {
    border-bottom: 0;
    margin-bottom: 4px;
}

.question legend {
    float: none;
    width: auto;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    padding: 0;
    margin-bottom: 12px;
}

.question.is-invalid {
    border-left: 6px solid var(--danger);
    padding-left: 14px;
    background: #fdf6f6;
}

.likert {
    display: grid;
    grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
    gap: 8px;
}

.likert label {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    margin: 0;
    padding: 10px 6px;
    border: 1px solid #c9d2e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
}

.likert label:hover {
    border-color: var(--blue);
}

.likert input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.likert-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 2px solid #8b97ab;
    border-radius: 50%;
    font-weight: 700;
}

.likert-caption {
    color: var(--ink);
    font-size: 0.85rem;
    line-height: 1.2;
    font-weight: 600;
}

.likert label:has(input:checked) {
    border-color: var(--blue);
    background: var(--soft);
}

.likert label:has(input:checked) .likert-mark {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.likert-legend {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.choice {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #c9d2e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 400;
}

.choice label:hover {
    border-color: var(--blue);
}

.choice label:has(input:checked) {
    border-color: var(--blue);
    background: var(--soft);
    font-weight: 600;
}

.choice input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 2px;
    flex: 0 0 auto;
    accent-color: var(--blue);
}

.submit-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 8px 0 0;
    padding: 16px 0;
    background: var(--bg);
    border-top: 1px solid var(--line-strong);
}

.submit-bar p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    background: #fff;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding: 24px 0 32px;
    text-align: center;
}

.heart {
    color: #c23b4a;
}

.site-footer p {
    margin-bottom: 8px;
}

.footer-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
}

.site-footer a {
    color: var(--blue);
    font-weight: 600;
}

.site-footer a:hover {
    color: var(--blue-dark);
}

.confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
}

.actions {
    margin: 18px 0 8px;
}

.auth-card {
    max-width: 28rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.06);
    padding: 24px 24px 20px;
}

.error-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.error-links a {
    font-weight: 700;
}

.alert {
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 10px;
    color: var(--ink);
}

.alert-success {
    background: #e7f4e4;
    border-left-color: #00a91c;
}

.alert-danger {
    background: #f8dfe2;
    border-left-color: #d54309;
    color: var(--ink);
}

.alert-warning {
    background: #faf3d1;
    border-left-color: #e5a000;
    color: var(--ink);
}

.alert a {
    font-weight: 700;
}

.mono {
    font-family: ui-monospace, Consolas, monospace;
}

.admin-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 90px);
    background: var(--bg);
}

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 16px 0;
}

.side-nav a {
    display: block;
    margin: 2px 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.side-nav a:hover {
    background: #eef1f6;
    color: var(--ink);
}

.side-nav a.is-active {
    background: var(--soft);
    color: var(--blue-dark);
    font-weight: 700;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 28px 28px 48px;
}

.admin-content {
    width: auto;
    max-width: none;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.page-head .page-note {
    margin-bottom: 0;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
}

.metric-label {
    margin: 6px 0 0;
    color: var(--muted);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 16px;
}

.sections-layout {
    align-items: start;
}

.summary-total {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-list {
    max-width: 760px;
}

.summary-section {
    margin: 22px 0 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted);
}

.summary-card {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--blue);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
    padding: 20px 24px 22px;
    margin-bottom: 12px;
}

.summary-card h3 {
    font-size: 1.05rem;
    line-height: 1.35;
    margin-bottom: 4px;
}

.summary-meta,
.summary-note {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.92rem;
}

.summary-note {
    margin-top: -8px;
    font-size: 0.85rem;
}

.summary-option + .summary-option {
    margin-top: 14px;
}

.summary-option-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 6px;
}

.summary-option-label {
    min-width: 0;
}

.summary-option-stat {
    flex: none;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.summary-option-stat span {
    font-weight: 600;
    color: var(--muted);
}

.summary-track {
    height: 12px;
    border-radius: 999px;
    background: #e8eaed;
    overflow: hidden;
}

.summary-fill {
    height: 100%;
    width: var(--w, 0%);
    border-radius: 999px;
    background: var(--blue);
}

.summary-texts {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.summary-texts li {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.summary-texts li:last-child {
    border-bottom: 0;
}

.plain-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plain-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.plain-list li:last-child {
    border-bottom: 0;
}

.subhead {
    margin-top: 18px;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    font-weight: 700;
    color: var(--ink);
    padding: 8px 12px 8px 0;
    border-bottom: 2px solid var(--ink);
}

.data-table td {
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th:first-child,
.data-table td:first-child {
    width: 100%;
}

.data-table th:not(:first-child),
.data-table td:not(:first-child) {
    width: auto;
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tr.is-muted td {
    color: var(--muted);
}

.row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    width: auto;
}

.row-actions form {
    margin: 0;
}

.text-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--blue);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-btn:hover {
    color: var(--blue-dark);
}

.text-btn.danger {
    color: var(--danger);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-end;
    margin-bottom: 8px;
}

.field-row .field {
    min-width: 220px;
    margin-bottom: 8px;
}

.options-box {
    margin-top: 8px;
}

.option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.option-row input[type="hidden"] {
    display: none;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 12px;
}

.narrow {
    max-width: 28rem;
}

.filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.filter label {
    margin: 0;
    font-weight: 700;
}

.filter .form-select {
    width: auto;
    min-width: 220px;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.pager a,
.pager span {
    min-width: 36px;
    text-align: center;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
}

.pager span {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.answer {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.answer:last-child {
    border-bottom: 0;
    margin-bottom: 4px;
}

.answer p {
    margin: 0 0 6px;
}

@media (max-width: 900px) {
    .admin-shell {
        display: block;
    }

    .sidebar {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 8px 0;
    }

    .side-nav {
        display: flex;
        flex-wrap: wrap;
    }

    .admin-main {
        padding: 20px 16px 40px;
    }

    .metrics,
    .split {
        grid-template-columns: 1fr;
    }

    .header-inner,
    .header-inner-wide {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 1.6rem;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .brand-name {
        font-size: 0.82rem;
        max-width: 11rem;
    }

    .likert-caption {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .likert label {
        min-height: 0;
        padding: 10px 4px;
    }

    .page-head,
    .submit-bar,
    .option-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .summary-card {
        padding: 16px;
    }

    .submit-bar .btn,
    .page-head .btn {
        width: 100%;
    }

    .row-actions {
        justify-content: flex-start;
    }
}
