:root {
    --ink: #17332f;
    --ink-soft: #526662;
    --brand: #1e665d;
    --brand-dark: #174e48;
    --brand-pale: #e8f3ef;
    --accent: #dd8e58;
    --accent-pale: #fff1e7;
    --paper: #fffefb;
    --canvas: #f3f5f1;
    --line: #dce4df;
    --white: #fff;
    --danger: #b54747;
    --danger-pale: #fff0ef;
    --success: #287c61;
    --shadow-sm: 0 1px 2px rgba(20, 51, 47, .05), 0 5px 16px rgba(20, 51, 47, .05);
    --shadow-lg: 0 18px 55px rgba(20, 51, 47, .11);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; }
svg { display: block; }
.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px;
    color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: "Newsreader", Georgia, serif; letter-spacing: -.025em; line-height: 1.08; }
h1 { margin-bottom: 16px; font-size: clamp(36px, 5vw, 64px); }
h2 { margin-bottom: 12px; font-size: clamp(28px, 3vw, 40px); }
h3 { margin-bottom: 6px; font-size: 17px; line-height: 1.35; }
.muted { color: var(--ink-soft); }

.site-header {
    position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(220,228,223,.85);
    background: rgba(255,254,251,.92); backdrop-filter: blur(14px);
}
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; line-height: 1.05; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--white); background: var(--brand); border-radius: 13px; }
.brand-mark svg { width: 27px; height: 27px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .03em; }
.brand small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 11px; letter-spacing: .04em; }
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav > a:not(.btn) { padding: 9px 12px; color: var(--ink-soft); font-size: 14px; font-weight: 600; text-decoration: none; border-radius: 9px; }
.main-nav > a:not(.btn):hover, .main-nav > a.active { color: var(--brand); background: var(--brand-pale); }

.btn {
    min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 18px;
    border: 1px solid transparent; border-radius: 11px; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
    transition: transform .18s, box-shadow .18s, background .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: var(--white); background: var(--brand); box-shadow: 0 7px 18px rgba(30,102,93,.18); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { color: var(--ink); background: var(--white); border-color: var(--line); }
.btn-secondary:hover { border-color: #b9cbc5; box-shadow: var(--shadow-sm); }
.btn-sm { min-height: 40px; padding: 9px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 9px; }
.btn-danger { color: var(--white); background: var(--danger); }
.btn-danger:hover { background: #963838; }

.hero { position: relative; overflow: hidden; padding: 74px 0 64px; background: var(--paper); }
.hero::after { content: ""; position: absolute; right: -160px; top: -230px; width: 560px; height: 560px; border: 90px solid var(--brand-pale); border-radius: 50%; opacity: .8; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 70px; }
.hero-copy > p:not(.eyebrow) { max-width: 620px; margin-bottom: 28px; color: var(--ink-soft); font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; }
.hero-panel { position: relative; padding: 30px; color: var(--white); background: var(--ink); border-radius: 26px; box-shadow: var(--shadow-lg); }
.hero-panel::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(255,255,255,.09); border-radius: 19px; pointer-events: none; }
.hero-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.hero-panel-head span { color: #bcd2cc; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.status-dot { width: 9px; height: 9px; background: #77c8a9; border-radius: 50%; box-shadow: 0 0 0 5px rgba(119,200,169,.12); }
.scale-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scale-preview div { padding: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
.scale-preview strong { display: block; color: #fff; font-family: "Newsreader", Georgia, serif; font-size: 23px; }
.scale-preview small { display: block; color: #aec4be; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-panel-foot { display: flex; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); color: #bcd2cc; font-size: 12px; }

.section { padding: 68px 0; }
.section-heading { max-width: 650px; margin-bottom: 30px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step-card { padding: 25px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.step-no { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 35px; color: var(--brand); background: var(--brand-pale); border-radius: 10px; font-weight: 800; }
.step-card p { margin-bottom: 0; color: var(--ink-soft); font-size: 14px; }

.page-head { padding: 48px 0 28px; }
.page-head h1 { margin-bottom: 8px; font-size: clamp(34px, 4vw, 48px); }
.page-head-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--ink-soft); font-size: 13px; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs span { color: #9baba6; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 28px; }
.form-shell { max-width: 720px; margin: 0 auto 70px; }
.form-intro { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-intro-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-pale); border-radius: 12px; }
.form-intro-icon svg { width: 21px; }
.form-intro p { margin: 3px 0 0; color: var(--ink-soft); font-size: 13px; }
.field { margin-bottom: 22px; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.required { color: var(--danger); }
.input, .select {
    width: 100%; min-height: 49px; padding: 11px 13px; color: var(--ink); background: var(--paper);
    border: 1px solid #cbd7d2; border-radius: 10px; outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(30,102,93,.1); }
.input::placeholder { color: #94a39f; }
.field-hint { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; }
.field-error { margin: 7px 0 0; color: var(--danger); font-size: 12px; font-weight: 600; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { display: flex; align-items: center; gap: 13px; min-height: 70px; padding: 14px; margin: 0; border: 1px solid #cbd7d2; border-radius: 12px; cursor: pointer; }
.choice-dot { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink-soft); background: var(--canvas); border-radius: 10px; }
.choice label strong { display: block; font-size: 14px; }
.choice label small { display: block; color: var(--ink-soft); font-weight: 400; }
.choice input:checked + label { border-color: var(--brand); background: var(--brand-pale); box-shadow: 0 0 0 1px var(--brand); }
.choice input:checked + label .choice-dot { color: var(--white); background: var(--brand); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }

.alert { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 20px; padding: 13px 15px; border-radius: 11px; font-size: 13px; }
.alert svg { width: 19px; flex: 0 0 auto; margin-top: 1px; }
.alert-success { color: #1e684f; background: #e7f5ef; border: 1px solid #c3e4d5; }
.alert-error { color: #923e3e; background: var(--danger-pale); border: 1px solid #f0ceca; }
.alert ul { margin: 0; padding-left: 18px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.search-wrap { position: relative; width: min(100%, 380px); }
.search-wrap svg { position: absolute; left: 14px; top: 50%; width: 18px; color: #7c908a; transform: translateY(-50%); }
.search-wrap .input { padding-left: 42px; background: var(--white); }
.participant-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 70px; }
.participant-card { display: flex; align-items: center; gap: 10px; padding: 10px; transition: transform .16s, border .16s, box-shadow .16s; }
.participant-card:hover { transform: translateY(-2px); border-color: #b9cbc5; box-shadow: 0 10px 25px rgba(20,51,47,.08); }
.participant-main { min-width: 0; display: flex; align-items: center; gap: 15px; flex: 1; padding: 7px; text-decoration: none; }
.avatar { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; color: var(--brand); background: var(--brand-pale); border-radius: 13px; font-size: 15px; font-weight: 800; }
.participant-info { min-width: 0; flex: 1; }
.participant-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant-info span { color: var(--ink-soft); font-size: 12px; }
.chevron { width: 20px; color: #91a19d; }
.card-actions, .row-actions { display: flex; align-items: center; gap: 5px; }
.card-actions form, .row-actions form { margin: 0; }
.icon-btn { width: 35px; height: 35px; display: inline-grid; place-items: center; padding: 0; color: var(--ink-soft); background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--brand); background: var(--brand-pale); border-color: #d5e7e1; }
.icon-btn-danger:hover { color: var(--danger); background: var(--danger-pale); border-color: #f0ceca; }
.js-pdf-download { position: relative; }
.js-pdf-download.is-loading { pointer-events: none; cursor: wait; opacity: .78; }
.js-pdf-download.is-loading svg { visibility: hidden; }
.js-pdf-download.is-loading::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
    margin: -9px 0 0 -9px; border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: pdf-spin .7s linear infinite;
}
.btn.js-pdf-download.is-loading::after { display: none; }
.ajax-spinner { width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pdf-spin .7s linear infinite; }
.download-toast {
    position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100% - 28px));
    padding: 12px 16px; color: #fff; background: var(--brand-dark); border-radius: 11px;
    box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; opacity: 0;
    transform: translateY(14px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.download-toast.show { opacity: 1; transform: translateY(0); }
.download-toast.error { background: var(--danger); }
@keyframes pdf-spin { to { transform: rotate(360deg); } }
.empty-state { grid-column: 1 / -1; padding: 55px 25px; text-align: center; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 16px; color: var(--brand); background: var(--brand-pale); border-radius: 16px; }
.empty-icon svg { width: 25px; }
.empty-state p { color: var(--ink-soft); }

.directory-card { overflow: hidden; margin-bottom: 70px; }
.directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.directory-search { min-width: 0; display: flex; align-items: center; gap: 9px; flex: 1; }
.directory-search .search-wrap { width: min(100%, 410px); }
.text-link { color: var(--brand); font-size: 13px; font-weight: 700; text-decoration: none; }
.directory-meta { display: flex; align-items: center; gap: 15px; color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.sort-button { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 11px; color: var(--ink); background: var(--canvas); border: 1px solid var(--line); border-radius: 9px; font-weight: 700; text-decoration: none; }
.sort-button:hover { color: var(--brand); border-color: #b9cbc5; }
.sort-button svg { width: 17px; height: 17px; }
.directory-table-wrap { border: 0; border-radius: 0; }
.participant-table { min-width: 850px; }
.participant-table .action-column { width: 160px; }
.participant-table th:first-child, .participant-table td:first-child { width: 58px; text-align: center; }
.participant-table tbody tr:hover { background: #fbfcfa; }
.participant-table td { height: 76px; }
.row-number { color: var(--ink-soft); font-weight: 700; }
.table-person { min-width: 220px; display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 700; text-decoration: none; }
.table-person:hover { color: var(--brand); }
.table-person .avatar { width: 40px; height: 40px; border-radius: 11px; }
.gender-badge { display: inline-flex; padding: 5px 9px; color: var(--ink-soft); background: var(--canvas); border-radius: 99px; font-size: 11px; font-weight: 700; }
.gender-badge.male { color: #245f72; background: #e8f3f6; }
.gender-badge.female { color: #8a5365; background: #f8ebf0; }
.participant-table .row-actions { opacity: .35; transition: opacity .15s; }
.participant-table .row-actions { flex-wrap: nowrap; }
.participant-table tr:hover .row-actions, .participant-table tr:focus-within .row-actions { opacity: 1; }
.table-empty { padding-block: 42px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; color: var(--ink-soft); border-top: 1px solid var(--line); font-size: 12px; }
.pagination-links { display: flex; align-items: center; gap: 5px; }
.page-button { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; font-weight: 600; text-decoration: none; }
.page-button:hover { color: var(--brand); border-color: #b9cbc5; }
.page-button.active { color: var(--white); background: var(--brand); border-color: var(--brand); }
.page-button.disabled { color: #9caaa6; background: #f4f6f3; cursor: not-allowed; }

.workspace { display: grid; grid-template-columns: 340px 1fr; align-items: start; gap: 20px; margin-bottom: 70px; }
.sticky-card { position: sticky; top: 94px; }
.subject-card { overflow: hidden; }
.subject-top { padding: 23px; color: var(--white); background: var(--ink); }
.subject-label { color: #b9cbc5; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.subject-name { margin: 8px 0 4px; font-family: "Newsreader", Georgia, serif; font-size: 27px; line-height: 1.1; }
.subject-meta { color: #c7d6d2; font-size: 12px; }
.subject-body { padding: 22px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.progress-head span:last-child { color: var(--brand); }
.progress-track { height: 7px; overflow: hidden; background: var(--brand-pale); border-radius: 99px; }
.progress-track span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.subject-note { margin: 16px 0 0; color: var(--ink-soft); font-size: 12px; }
.scoring-card .card-body { padding: 30px; }
.scoring-head { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.scoring-head h2 { margin-bottom: 5px; font-size: 31px; }
.scoring-head p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.score-fields { display: grid; grid-template-columns: 1.5fr .75fr; gap: 16px; }
.select-detail { margin-top: 8px; min-height: 20px; color: var(--brand); font-size: 12px; font-weight: 600; }
.results-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.results-head h3 { margin: 0; font-size: 16px; }
.result-count { color: var(--ink-soft); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: var(--ink-soft); background: #f6f8f5; font-size: 11px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: 13px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.scale-cell { display: flex; align-items: center; gap: 10px; }
.scale-code { width: 29px; height: 29px; display: grid; place-items: center; color: var(--brand); background: var(--brand-pale); border-radius: 8px; font-weight: 800; }
.percentile { font-size: 16px; font-weight: 800; }
.action-column { width: 90px; }
.empty-results { padding: 34px 20px; text-align: center; color: var(--ink-soft); background: #fafbf9; border: 1px dashed #cbd7d2; border-radius: 12px; }
.empty-results strong { display: block; margin-bottom: 3px; color: var(--ink); }
.scale-key { margin-top: 18px; padding: 17px; background: #f7f9f6; border-radius: 12px; }
.scale-key strong { display: block; margin-bottom: 11px; font-size: 12px; }
.scale-key-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
.scale-key span { color: var(--ink-soft); font-size: 11px; }
.scale-key b { color: var(--brand); }

.site-footer { padding: 30px 0; color: var(--ink-soft); background: var(--paper); border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.footer-inner strong { color: var(--ink); font-size: 13px; }
.footer-inner p { margin: 3px 0 0; font-size: 11px; }
.footer-note { max-width: 420px; text-align: right; }

@media (max-width: 800px) {
    .shell { width: min(100% - 28px, 1160px); }
    .main-nav > a:not(.btn) { display: none; }
    .brand small { display: none; }
    .hero { padding: 52px 0; }
    .hero-grid, .workspace { grid-template-columns: 1fr; gap: 24px; }
    .hero-panel { max-width: 520px; }
    .steps { grid-template-columns: 1fr; }
    .step-no { margin-bottom: 20px; }
    .participant-list { grid-template-columns: 1fr; }
    .sticky-card { position: static; }
    .score-fields { grid-template-columns: 1fr; gap: 0; }
    .scale-key-grid { grid-template-columns: repeat(2, 1fr); }
    .directory-toolbar { align-items: stretch; flex-direction: column; }
    .directory-meta { justify-content: space-between; }
    .participant-table .row-actions { opacity: 1; }
}

@media (max-width: 540px) {
    body { font-size: 14px; }
    .header-inner { min-height: 66px; }
    .brand-mark { width: 38px; height: 38px; }
    .main-nav .btn { width: 40px; padding: 0; font-size: 0; }
    .hero::after { display: none; }
    .hero-actions { display: grid; }
    .scale-preview { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 48px 0; }
    .page-head { padding: 32px 0 20px; }
    .page-head-row, .toolbar, .footer-inner { align-items: stretch; flex-direction: column; }
    .page-head-row .btn { width: 100%; }
    .card-body, .scoring-card .card-body { padding: 20px; }
    .choice-grid { grid-template-columns: 1fr; }
    .participant-card { align-items: stretch; flex-direction: column; }
    .card-actions { justify-content: flex-end; padding: 0 6px 4px; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .scale-key-grid { grid-template-columns: 1fr; }
    .footer-note { text-align: left; }
    .directory-search { align-items: stretch; flex-wrap: wrap; }
    .directory-search .search-wrap { width: 100%; max-width: none; flex-basis: 100%; }
    .pagination { align-items: stretch; flex-direction: column; }
    .pagination-links { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
