:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --surface: #ffffff;
    --ink: #17201b;
    --muted: #68736f;
    --line: #dfe6df;
    --primary: #126b5b;
    --primary-strong: #0a4f45;
    --accent: #b44d28;
    --soft: #e9f3ef;
    --danger: #a93434;
    --success: #157347;
    --shadow: 0 18px 45px rgba(20, 35, 31, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    align-items: center;
    min-height: 68px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand,
.nav,
.session,
.actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 800;
    color: var(--ink);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
}

.nav a {
    color: var(--muted);
    font-weight: 650;
}

.session {
    justify-content: end;
}

.role {
    min-width: 76px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 30px auto 64px;
}

.page-head,
.section-title {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.page-head h1,
.section-title h1,
.section-title h2 {
    margin: 0;
}

.page-head h1 {
    max-width: 820px;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.lead {
    max-width: 860px;
    color: var(--muted);
    font-size: 17px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover,
button:hover {
    background: var(--primary-strong);
    text-decoration: none;
}

.button.secondary,
.button.ghost {
    background: #fff;
    color: var(--primary-strong);
}

.button.secondary:hover,
.button.ghost:hover {
    background: var(--soft);
}

.icon-button {
    width: 42px;
    padding: 0;
}

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

.metric,
.panel,
.item,
.candidate,
.form-card,
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric {
    padding: 20px;
}

.metric span {
    display: block;
    color: var(--primary-strong);
    font-size: 34px;
    font-weight: 850;
}

.metric p,
.muted {
    margin: 0;
    color: var(--muted);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
    gap: 22px;
    align-items: start;
}

.stack,
.ranking {
    display: grid;
    gap: 14px;
}

.item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 18px;
}

.item h2,
.item h3 {
    margin: 4px 0 10px;
}

.item-main {
    min-width: 0;
}

.score-ring {
    display: grid;
    flex: 0 0 76px;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--primary-strong);
    font-weight: 850;
}

.panel {
    padding: 22px;
}

.panel.full {
    margin-top: 22px;
}

.panel h2 {
    margin-top: 0;
}

.timeline {
    display: grid;
    gap: 14px;
    padding-left: 20px;
}

.timeline li span {
    display: block;
    color: var(--muted);
}

.service-status {
    display: flex;
    gap: 9px;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.dot.online {
    background: var(--success);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chips span {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 750;
}

.chips.matched span {
    border-color: rgba(18, 107, 91, 0.2);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td span {
    display: block;
    color: var(--muted);
}

.form-shell {
    width: min(760px, 100%);
    margin: 0 auto;
}

.form-shell.wide {
    width: min(980px, 100%);
}

.form-card {
    display: grid;
    gap: 16px;
    padding: 22px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
}

.candidate {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 18px;
    padding: 18px;
}

.rank {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--primary-strong);
    font-weight: 850;
}

.candidate-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.candidate-head h3,
.candidate-head p {
    margin: 0;
}

.candidate-head strong {
    color: var(--primary-strong);
    font-size: 28px;
}

.bar {
    height: 10px;
    margin: 14px 0;
    border-radius: 999px;
    background: #edf0ec;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #d8833d);
}

.missing {
    margin-bottom: 0;
    color: var(--accent);
    font-weight: 700;
}

.definition {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
}

.definition dt {
    color: var(--muted);
    font-weight: 800;
}

.definition dd {
    margin: 0;
}

.cv-text {
    color: var(--muted);
    white-space: pre-wrap;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert.success {
    border-color: rgba(21, 115, 71, 0.22);
    color: var(--success);
}

.alert.danger {
    border-color: rgba(169, 52, 52, 0.22);
    color: var(--danger);
}

@media (max-width: 860px) {
    .topbar,
    .page-head,
    .section-title,
    .item,
    .candidate-head {
        align-items: stretch;
    }

    .topbar {
        grid-template-columns: 1fr;
        padding: 14px 16px;
    }

    .nav,
    .session,
    .actions,
    .page-head,
    .section-title,
    .item,
    .candidate-head {
        flex-wrap: wrap;
    }

    .stats-grid,
    .split,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .candidate {
        grid-template-columns: 1fr;
    }

    .page-head h1 {
        font-size: 36px;
    }
}
