:root {
    --app-blue: #0b4f87;
    --app-cyan: #12dfe5;
    --app-bg: #f4f7fb;
}

body {
    background: var(--app-bg);
    color: #172033;
}

.app-navbar {
    background: linear-gradient(135deg, #004282, #004282);
}

.app-container {
    max-width: 1800px;
    margin: 28px auto;
}

.card {
    border-radius: 16px;
}

.meta-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    font-weight: 700;
}

.meta-value {
    background: #e8fbfc;
    border-left: 4px solid var(--app-cyan);
    padding: .65rem .8rem;
    border-radius: .5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.matrix-wrap {
    max-height: 68vh;
}

.exam-matrix {
    font-size: .86rem;
    min-width: 1400px;
}

.exam-matrix th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 4;
}

.exam-matrix thead tr:nth-child(2) th {
    top: 41px;
}

.exam-matrix .sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
}

.exam-matrix thead .sticky-col {
    z-index: 6;
    background: #212529;
}

.exam-matrix .person-col {
    left: 44px;
    min-width: 260px;
}

.exam-matrix .row-no {
    width: 44px;
    min-width: 44px;
}

.question-head {
    background: #fff200 !important;
    color: #111 !important;
    text-align: center;
    cursor: pointer;
    min-width: 72px;
}

.question-head small {
    display: block;
    font-weight: 400;
    font-size: .68rem;
}

.section-head {
    font-size: 1rem;
}

.section-a {
    background: #0dcaf0 !important;
}

.section-b {
    background: #6fdd9b !important;
}

.section-c {
    background: #f6b85f !important;
}

.answer-cell {
    padding: 2px !important;
    min-width: 72px;
}

.answer-cell input {
    background: #dffafa;
    border-radius: 0;
}

.answer-cell input:focus {
    background: #fff;
}

.key-table {
    min-width: 1200px;
}

.key-table th {
    white-space: nowrap;
}

.code-field {
    width: 72px;
}

.section-field,
.order-field,
.points-field {
    width: 75px;
}

.key-input {
    min-width: 90px;
    background: #e1fbfc;
}

.report-sheet {
    background: #fff;
    max-width: 1320px;
    margin: auto;
    padding: 42px 54px;
    border: 1px solid #d7dde5;
    box-shadow: 0 10px 35px rgba(24, 49, 83, .08);
}

.report-title {
    font-size: 1.55rem;
    font-weight: 500;
    margin-bottom: 36px;
}

.report-title span {
    margin-left: 28px;
}

.report-meta {
    display: flex;
    justify-content: space-around;
    font-size: 1.35rem;
    margin-bottom: 28px;
}

.report-meta b {
    font-size: 1.55rem;
    margin-left: 8px;
}

.report-answer-table th,
.report-answer-table td {
    text-align: center;
    font-size: 1.1rem;
    padding: .55rem;
}

.report-answer-table td {
    font-size: 1.5rem;
    font-weight: 700;
}

.answer-ok {
    background: #e5f8eb !important;
}

.answer-bad {
    background: #fde9e9 !important;
}

.answer-empty {
    background: #fff6d7 !important;
}

.summary-table {
    font-size: 1.25rem;
    width: 100%;
}

.summary-table td {
    padding: .3rem .6rem;
}

.summary-table td:last-child {
    text-align: center;
    width: 80px;
}

.score-summary {
    font-size: 1.45rem;
    line-height: 1.8;
}

.score-summary b {
    margin-left: 16px;
}

.signature-line {
    margin-top: 42px;
    font-size: 1.2rem;
}

.signature-line span {
    display: inline-block;
    border-bottom: 2px solid #222;
    width: 330px;
    margin-left: 12px;
}

.login-box {
    max-width: 520px;
    margin: 8vh auto;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.stat {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #dce4ef;
}

.stat b {
    font-size: 34px;
    display: block;
}

@media (max-width: 800px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .report-sheet {
        padding: 22px;
    }

    .report-meta {
        flex-direction: column;
        gap: 10px;
    }

    .report-title span {
        display: block;
        margin: 8px 0 0;
    }
}

@media print {
    body {
        background: #fff;
    }

    .app-navbar,
    .no-print,
    .alert,
    .card-footer {
        display: none !important;
    }

    .app-container {
        margin: 0;
        padding: 0 !important;
    }

    .report-sheet {
        border: 0;
        box-shadow: none;
        max-width: none;
        padding: 20px;
    }

    .report-answer-table {
        font-size: 10pt;
    }

    .report-title {
        font-size: 16pt;
    }
}

/* Быстрый матричный ввод ответов */

.exam-meta-card {
    background: linear-gradient(135deg, #fff, #f8fbff);
}

.candidate-stack {
    padding-bottom: 86px;
}

.candidate-card {
    overflow: hidden;
}

.candidate-card:hover {
    box-shadow: 0 16px 42px rgba(24, 49, 83, .12) !important;
}

.candidate-number {
    display: flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #172033;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
}

.candidate-score {
    font-size: .9rem;
    color: #475569;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0 12px;
    font-weight: 800;
}

.section-title span {
    display: inline-flex;
    padding: 7px 16px;
    border-radius: 10px;
    color: #172033;
}

.section-title small {
    color: #64748b;
    font-weight: 500;
}

.section-title-a span {
    background: #27d3ec;
}

.section-title-b span {
    background: #81e6a8;
}

.section-title-c span {
    background: #ffc66d;
}

.answer-choice-table {
    min-width: 1320px;
    border-collapse: separate;
    border-spacing: 5px;
}

.answer-choice-table th {
    background: #fff200;
    color: #111;
    text-align: center;
    border: 0;
    border-radius: 9px;
    padding: 8px 5px;
    min-width: 78px;
    cursor: pointer;
}

.answer-choice-table th small {
    display: block;
    font-size: .66rem;
    font-weight: 500;
}

.answer-choice-table td {
    border: 0;
    padding: 0;
}

.answer-choice-table-b {
    min-width: 520px;
    max-width: 760px;
}

.choice-group {
    display: grid;
    grid-auto-flow: row;
    gap: 3px;
    background: #e8fbfc;
    padding: 5px;
    border: 1px solid #b8e8eb;
    border-radius: 10px;
}

.choice-group[data-options="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.choice-box {
    position: relative;
    height: 36px;
    min-width: 0;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #475569;
    font-weight: 700;
    cursor: default;
    user-select: none;
    transition: .12s ease;
}

.choice-box:hover {
    border-color: #0d6efd;
    background: #f3f8ff;
}

.choice-box b {
    display: none;
    position: absolute;
    top: -5px !important;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    color: #dc2626;
}

.choice-box.selected {
    background: #fff3f3;
    border-color: #ef4444;
    box-shadow: inset 0 0 0 1px #ef4444;
}

.choice-box.selected span {
    visibility: hidden;
}

.choice-box.selected b {
    display: flex;
}

.c-score-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 230px));
    gap: 14px;
}

.c-score-item {
    background: #fff8e8;
    border: 1px solid #f3d498;
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: auto 90px;
    gap: 8px 12px;
    align-items: center;
}

.c-score-item > span {
    font-size: 1.05rem;
    font-weight: 800;
}

.c-score-item small {
    grid-column: 1 / -1;
    color: #7c6a45;
}

.sticky-save-bar {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(1500px, calc(100% - 36px));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    padding: 12px 16px;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, .18);
}

@media (max-width: 900px) {
    .c-score-grid {
        grid-template-columns: 1fr;
    }

    .sticky-save-bar {
        align-items: stretch !important;
        flex-direction: column;
    }

    .sticky-save-bar .btn {
        width: 100%;
    }

    .candidate-stack {
        padding-bottom: 140px;
    }
}

.b-answer-input {
    min-width: 150px;
    background: #e8fbfc;
    border: 1px solid #b8e8eb;
    font-weight: 700;
}

.b-answer-input:focus {
    background: #fff;
}