:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #8a1538;
    --warning: #b7791f;
    --danger: #b42318;
    --success: #087443;
    --blue: #265c9d;
    --shadow: 0 10px 25px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand {
    color: var(--accent);
    font-size: 18px;
    font-weight: 800;
}

.app-title {
    color: var(--muted);
    font-size: 13px;
}

.nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.nav a,
.nav-user {
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    font-size: 14px;
    padding: 8px 11px;
}

.nav a.active {
    background: #e7f6f4;
    color: var(--primary-dark);
    font-weight: 700;
}

.nav-user {
    color: var(--muted);
}

.page {
    margin: 0 auto;
    max-width: 1240px;
    padding: 26px;
}

.panel,
.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    padding: 22px;
}

.panel-title-row {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.panel-title-row.compact {
    align-items: flex-start;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
    margin-bottom: 6px;
}

h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

p,
small {
    color: var(--muted);
}

.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions.end {
    justify-content: flex-end;
    margin-top: 18px;
}

.button {
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
}

.button.primary {
    background: var(--primary);
    color: #ffffff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #ffffff;
    border-color: var(--line);
    color: var(--ink);
}

.button.full {
    width: 100%;
}

.login-shell {
    display: grid;
    min-height: calc(100vh - 124px);
    place-items: center;
}

.login-card {
    max-width: 420px;
    width: 100%;
}

.login-heading {
    margin-bottom: 20px;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    color: var(--ink);
    display: grid;
    font-weight: 700;
    gap: 6px;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    min-height: 40px;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
    outline: none;
}

.form-stack {
    display: block;
}

.score-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.score-row {
    align-items: center;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) 90px 130px;
    min-height: 52px;
    padding: 8px 12px;
}

.score-row:first-child {
    border-top: 0;
}

.score-row.header {
    background: #eef2f7;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.question-stack {
    display: grid;
    gap: 16px;
}

.badge {
    align-items: center;
    background: #eef2f7;
    border-radius: 999px;
    color: var(--ink);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    white-space: nowrap;
}

.badge.info,
.level-pending {
    background: #eaf1fb;
    color: var(--blue);
}

.level-basic {
    background: #fdecec;
    color: var(--danger);
}

.level-mid {
    background: #fff3d7;
    color: var(--warning);
}

.level-advance {
    background: #e7f6f4;
    color: var(--primary-dark);
}

.level-expert {
    background: #e9f8ef;
    color: var(--success);
}

.metric-grid,
.summary-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.metric-card,
.summary-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.metric-card span,
.summary-card span,
.detail-grid span,
.insight-grid span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 5px;
}

.metric-card strong,
.summary-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.2;
}

.summary-card small {
    display: block;
    margin-top: 8px;
}

.top-candidate {
    align-items: center;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.top-candidate strong,
.top-candidate span {
    display: block;
}

.score-pill {
    background: #172033;
    border-radius: 8px;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    min-width: 120px;
    padding: 12px;
    text-align: center;
}

.score-pill span {
    color: #dbeafe;
    font-size: 12px;
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 820px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #eef2f7;
    color: #475467;
    font-size: 13px;
    text-transform: uppercase;
}

td small {
    display: block;
}

.total-row td {
    background: #f8fafc;
    font-weight: 800;
}

.row-actions {
    white-space: nowrap;
}

.row-actions a + a {
    margin-left: 10px;
}

.detail-grid,
.insight-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid div,
.insight-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.detail-grid strong,
.insight-grid strong {
    overflow-wrap: anywhere;
}

.notes-text {
    background: #fffdf6;
    border: 1px solid #f4d99f;
    border-radius: 8px;
    margin: 16px 0 0;
    padding: 14px;
}

.answer-list {
    display: grid;
    gap: 12px;
}

.answer-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.answer-heading {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.answer-card p {
    color: var(--ink);
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.flash {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.flash.success {
    background: #e9f8ef;
    color: var(--success);
}

.flash.danger {
    background: #fdecec;
    color: var(--danger);
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #b8c2d1;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.compare-picker {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compare-picker .actions {
    grid-column: 1 / -1;
}

.check-card {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    padding: 12px;
}

.check-card input {
    flex: 0 0 auto;
    min-height: auto;
    width: auto;
}

.check-card span,
.check-card small {
    display: block;
}

@media (max-width: 900px) {
    .topbar,
    .panel-title-row,
    .top-candidate {
        align-items: flex-start;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .grid.two,
    .metric-grid,
    .summary-grid,
    .detail-grid,
    .insight-grid,
    .compare-picker {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 16px;
    }

    .score-row {
        grid-template-columns: minmax(150px, 1fr) 64px 110px;
    }
}

@media (max-width: 560px) {
    .topbar {
        padding: 12px 16px;
    }

    .nav {
        justify-content: flex-start;
    }

    .score-row {
        grid-template-columns: 1fr;
    }

    .score-row.header {
        display: none;
    }
}

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

    .topbar,
    .no-print,
    .actions {
        display: none !important;
    }

    .page {
        max-width: none;
        padding: 0;
    }

    .panel,
    .summary-card,
    .metric-card {
        box-shadow: none;
        break-inside: avoid;
    }
}

