:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f7f7;
  --ink: #17232f;
  --muted: #667584;
  --line: #dce4e9;
  --navy: #0b2942;
  --teal: #167c80;
  --teal-dark: #0e666a;
  --blue: #286da8;
  --green: #23845f;
  --green-soft: #e9f7f1;
  --amber: #a96708;
  --amber-soft: #fff5df;
  --red: #b04444;
  --red-soft: #fff0ef;
  --shadow: 0 10px 28px rgba(18, 39, 57, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #f9fbfc 0, var(--bg) 260px); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 14px; color: white; background: var(--navy); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(220, 228, 233, .9); background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); }
.topbar__inner { width: min(1180px, calc(100% - 40px)); height: 70px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--navy); }
.brand__mark { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--teal), #24a3a6); border-radius: 11px; font-weight: 800; box-shadow: 0 5px 14px rgba(22, 124, 128, .24); }
.brand__mark--large { width: 52px; height: 52px; margin: auto; font-size: 22px; border-radius: 15px; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 15px; letter-spacing: .08em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 20px; }
.topnav > a:not(.button) { color: var(--muted); font-weight: 650; text-decoration: none; }
.topnav > a:not(.button):hover { color: var(--navy); }
.topnav form { margin: 0; }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 72px; }
.page--login { min-height: 100vh; display: grid; place-items: center; padding: 30px 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.page-heading--compact { align-items: center; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: var(--navy); font-size: clamp(30px, 4vw, 42px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 6px; color: var(--navy); font-size: 20px; letter-spacing: -.015em; }
h3 { color: var(--navy); }
.eyebrow { margin-bottom: 7px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { margin-bottom: 0; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--teal-dark); font-size: 14px; font-weight: 700; text-decoration: none; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--teal); border-radius: 11px; color: white; background: var(--teal); font-weight: 750; text-decoration: none; cursor: pointer; box-shadow: 0 5px 14px rgba(22, 124, 128, .16); transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { background: var(--teal-dark); border-color: var(--teal-dark); transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .link-button:focus-visible, a:focus-visible { outline: 3px solid rgba(40, 109, 168, .26); outline-offset: 2px; }
.button--secondary { color: var(--navy); background: white; border-color: var(--line); box-shadow: none; }
.button--secondary:hover { color: var(--navy); background: #f7fafb; border-color: #becbd4; }
.button--small { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.button--wide { width: 100%; }
.link-button { padding: 0; border: 0; color: var(--muted); background: none; font-weight: 650; cursor: pointer; }
.link-button:hover { color: var(--navy); }
.link-button--danger { color: var(--red); }
.text-link { color: var(--teal-dark); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 20px; }
.flash { padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; background: white; font-weight: 650; box-shadow: var(--shadow); }
.flash--success { color: #176646; border-color: #bfe4d3; background: var(--green-soft); }
.flash--error { color: #8e3030; border-color: #efc6c2; background: var(--red-soft); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { min-height: 105px; display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-card strong { color: var(--navy); font-size: 31px; line-height: 1; }
.stat-card--success { border-top: 3px solid var(--green); }
.stat-card--warning { border-top: 3px solid #d79a2b; }
.stat-card--danger { border-top: 3px solid var(--red); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.filters { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.search-field { flex: 1; }
.search-field input, .select-field select { width: 100%; }
.select-field { min-width: 200px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd7df; border-radius: 9px; color: var(--ink); background: white; transition: border .15s ease, box-shadow .15s ease; }
textarea { min-height: 110px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #aebec9; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 109, 168, .12); outline: 0; }

.session-list { display: grid; }
.session-row { min-height: 84px; display: grid; grid-template-columns: minmax(200px, 1.35fr) minmax(190px, 1fr) 90px 140px 18px; align-items: center; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .15s ease; }
.session-row:last-child { border-bottom: 0; }
.session-row:hover { background: #f8fbfb; }
.session-row__main strong, .session-row__main span, .session-row__meta span { display: block; }
.session-row__main strong { margin-bottom: 4px; color: var(--navy); font-size: 16px; }
.session-row__main span, .session-row__meta span, .session-row__files { color: var(--muted); font-size: 13px; }
.session-row__meta span + span { margin-top: 4px; }
.session-row__arrow { color: #9badb8; font-size: 30px; line-height: 1; }
.badge { width: max-content; display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge--passed { color: #176646; background: var(--green-soft); }
.badge--limited { color: #87600e; background: var(--amber-soft); }
.badge--repeat { color: #7a5311; background: #fff0cc; }
.badge--technical_fail { color: #963939; background: var(--red-soft); }

.empty-state { display: grid; justify-items: center; padding: 70px 24px; text-align: center; }
.empty-state--page { min-height: 65vh; align-content: center; }
.empty-state__icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 16px; color: var(--teal); border-radius: 16px; background: var(--surface-soft); font-size: 28px; font-weight: 700; }
.empty-state h1, .empty-state h2 { margin-bottom: 8px; }
.empty-state p { max-width: 480px; margin-bottom: 20px; color: var(--muted); }

.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 22px 60px rgba(18, 39, 57, .11); }
.login-card__brand { margin-bottom: 28px; text-align: center; }
.login-card__brand p { margin: 9px 0 0; color: var(--navy); font-size: 13px; font-weight: 850; letter-spacing: .14em; }
.login-card h1 { font-size: 32px; text-align: center; }
.login-card > .muted { margin-bottom: 28px; text-align: center; }
.stack { display: grid; gap: 12px; }
.stack--large { gap: 18px; }
.field { display: grid; gap: 7px; color: var(--navy); font-size: 13px; font-weight: 720; }

.form-layout { display: grid; gap: 18px; }
.form-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.form-card__heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.form-card__heading > span { flex: 0 0 30px; height: 30px; display: grid; place-items: center; color: white; border-radius: 9px; background: var(--teal); font-size: 13px; font-weight: 850; }
.form-card__heading h2 { margin: 1px 0 3px; }
.form-card__heading p { margin: 0; color: var(--muted); font-size: 13px; }
.field-grid { display: grid; gap: 18px; }
.field-grid--three { grid-template-columns: repeat(3, 1fr); }
.test-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.test-form-card { min-width: 0; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfd; }
.test-form-card legend { width: 100%; padding: 0 0 13px; }
.test-form-card legend strong, .test-form-card legend small { display: block; }
.test-form-card legend small { margin-top: 3px; color: var(--muted); font-weight: 500; }
.test-form-card > .field + .field, .test-form-card .mini-grid + .field { margin-top: 14px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.input-with-unit { position: relative; display: block; }
.input-with-unit input { padding-right: 36px; }
.input-with-unit em { position: absolute; right: 12px; top: 50%; color: var(--muted); font-style: normal; font-weight: 650; transform: translateY(-50%); }
.dropzone { min-height: 154px; display: grid; place-items: center; align-content: center; gap: 5px; margin-top: 18px; padding: 22px; border: 2px dashed #bad1d3; border-radius: 13px; color: var(--navy); background: var(--surface-soft); text-align: center; cursor: pointer; transition: background .15s ease, border .15s ease; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--teal); background: #e6f3f3; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__icon { color: var(--teal); font-size: 26px; font-weight: 800; }
.dropzone small { color: var(--muted); }
.dropzone__selection { margin-top: 6px; color: var(--teal-dark); font-size: 13px; font-weight: 700; }
.inline-note { margin: 0; padding: 12px 14px; color: var(--muted); border-radius: 9px; background: #f6f8fa; }
.form-actions { position: sticky; bottom: 14px; display: flex; justify-content: flex-end; gap: 10px; padding: 12px; border: 1px solid rgba(220, 228, 233, .9); border-radius: 14px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px); box-shadow: var(--shadow); }

.title-with-badge { display: flex; align-items: center; gap: 14px; }
.title-with-badge h1 { margin-bottom: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }
.detail-panel { padding: 22px; }
.detail-panel--wide { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.section-heading span { color: var(--muted); font-size: 13px; }
.definition-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0; }
.definition-grid div { min-width: 0; }
.definition-grid dt { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.definition-grid dd { margin: 0; color: var(--navy); font-weight: 750; overflow-wrap: anywhere; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.result-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.result-card h3 { margin-bottom: 6px; font-size: 16px; }
.result-card__evidence { min-height: 34px; margin-bottom: 14px; color: var(--teal-dark); font-size: 13px; font-weight: 750; }
.result-card dl { display: grid; gap: 8px; margin: 0; }
.result-card dl div { display: flex; justify-content: space-between; gap: 12px; }
.result-card dt { color: var(--muted); font-size: 12px; }
.result-card dd { margin: 0; color: var(--navy); font-size: 13px; font-weight: 750; }
.notes-text { margin-bottom: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-list { display: grid; margin: 0 -4px; }
.file-row { min-height: 64px; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--teal-dark); border-radius: 9px; background: var(--surface-soft); font-size: 9px; font-weight: 850; }
.file-row__name strong, .file-row__name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__name strong { margin-bottom: 3px; font-size: 14px; }
.file-row__name span { color: var(--muted); font-size: 12px; }
.file-row__actions { display: flex; align-items: center; gap: 13px; font-size: 13px; }
.file-row__actions form { margin: 0; }
.add-files { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.compact-file-input { flex: 1; min-height: 44px; display: flex; align-items: center; padding: 10px 12px; border: 1px dashed #b9c9d2; border-radius: 9px; color: var(--muted); cursor: pointer; }
.compact-file-input:hover { border-color: var(--teal); color: var(--teal-dark); }
.compact-file-input input { position: absolute; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .session-row { grid-template-columns: minmax(180px, 1fr) 130px 18px; }
  .session-row__meta, .session-row__files { display: none; }
  .field-grid--three, .test-form-grid { grid-template-columns: 1fr 1fr; }
  .test-form-card:last-child { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-panel--wide { grid-column: auto; }
}

@media (max-width: 650px) {
  .topbar__inner, .page { width: min(100% - 24px, 1180px); }
  .topbar__inner { height: 62px; }
  .topnav { gap: 10px; }
  .topnav > a:not(.button) { display: none; }
  .topnav .link-button { font-size: 13px; }
  .button--small { min-height: 36px; padding: 7px 10px; font-size: 13px; }
  .page { padding-top: 28px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading > .button { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 86px; padding: 15px; }
  .stat-card strong { font-size: 26px; }
  .filters { align-items: stretch; flex-direction: column; }
  .select-field { min-width: 0; }
  .session-row { grid-template-columns: 1fr auto 14px; gap: 9px; padding: 15px; }
  .session-row__main strong { font-size: 14px; }
  .badge { padding: 5px 7px; font-size: 10px; }
  .login-card { padding: 28px 22px; }
  .form-card { padding: 18px 15px; }
  .field-grid--three, .test-form-grid, .mini-grid, .result-grid, .definition-grid { grid-template-columns: 1fr; }
  .test-form-card:last-child { grid-column: auto; }
  .form-actions { justify-content: stretch; }
  .form-actions .button { flex: 1; }
  .title-with-badge { align-items: flex-start; flex-direction: column; gap: 8px; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr); }
  .file-row__actions { grid-column: 2; flex-wrap: wrap; }
  .add-files { align-items: stretch; flex-direction: column; }
}

