:root {
  --background-primary: #07090d;
  --background-secondary: #0b0f14;
  --surface-primary: rgba(255, 255, 255, 0.06);
  --surface-secondary: rgba(255, 255, 255, 0.08);
  --surface-hover: rgba(255, 255, 255, 0.12);
  --surface-active: rgba(255, 255, 255, 0.16);

  --text-primary: rgba(214, 222, 230, 0.88);
  --text-secondary: rgba(176, 188, 200, 0.52);
  --text-tertiary: rgba(164, 176, 188, 0.38);

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(120, 210, 160, 0.45);

  --accent-primary: #f3f5f7;
  --accent-soft: rgba(255, 255, 255, 0.10);

  --status-success: #7dcea0;
  --status-warning: #e0b15a;
  --status-danger: #e08b84;

  --chrome: rgba(8, 10, 14, 0.55);
  --sidebar: rgba(10, 12, 16, 0.72);
  --sidebar-elevated: rgba(255, 255, 255, 0.06);
  --sidebar-text: #eceef1;
  --sidebar-muted: rgba(255, 255, 255, 0.48);
  --sidebar-line: rgba(255, 255, 255, 0.10);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(255, 255, 255, 0.12);

  --glass-tint: rgba(3, 6, 10, 0.76);
  --glass: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 16%, rgba(4, 7, 11, 0.28) 48%, rgba(3, 6, 10, 0.46) 100%);
  --glass-on: linear-gradient(165deg, rgba(70, 200, 130, 0.16) 0%, rgba(28, 120, 72, 0.08) 46%, rgba(14, 64, 40, 0.10) 100%);
  --glass-blur: blur(80px) saturate(220%);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --motion-fast: 120ms;
  --motion-normal: 220ms;
  --motion-slow: 420ms;
  --ease-standard: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.7, 0, 0.84, 0);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  --pad: clamp(20px, 5vw, 48px);
  --survey-w: 720px;
  --admin-max: 1560px;
  --sidebar-w: 248px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

html { color-scheme: dark; }

body {
  font-family: var(--font);
  background: #07090d;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90% 55% at 12% -8%, rgba(140, 180, 220, 0.46), transparent 52%),
    radial-gradient(70% 45% at 92% 0%, rgba(70, 120, 180, 0.34), transparent 48%),
    radial-gradient(55% 38% at 78% 72%, rgba(40, 150, 110, 0.16), transparent 52%),
    radial-gradient(60% 40% at 50% 110%, rgba(60, 90, 150, 0.28), transparent 50%),
    #07090d;
}

button, input, select { font-family: inherit; color: inherit; }
a { color: inherit; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
button { -webkit-tap-highlight-color: transparent; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.glass {
  position: relative;
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 10%, transparent 32%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 1px 0 0 rgba(255, 255, 255, 0.04),
    inset -1px 0 0 rgba(255, 255, 255, 0.02),
    inset 0 -32px 48px rgba(0, 0, 0, 0.38),
    0 20px 56px rgba(0, 0, 0, 0.52);
}
.glass.is-on,
.card.is-on,
.option.is-on,
.choice.is-on {
  background-color: rgba(32, 120, 72, 0.12);
  background-image:
    linear-gradient(180deg, rgba(160, 255, 200, 0.14) 0%, rgba(70, 190, 120, 0.04) 20%, transparent 46%),
    var(--glass-on);
  border-color: rgba(96, 210, 150, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(190, 255, 220, 0.22),
    inset 0 -24px 40px rgba(10, 56, 34, 0.14),
    0 14px 40px rgba(10, 56, 34, 0.18);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  width: max-content;
  flex: 0 0 auto;
}
.logo {
  height: 36px;
  width: auto;
  max-width: none;
  animation: logoReveal 740ms var(--ease-enter) both;
}
.page-survey .logo {
  height: 56px;
}
.logo-lg {
  height: 56px;
}

@keyframes logoReveal {
  from { opacity: 0; transform: translateY(6px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

@keyframes drawerIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ——— Survey chrome ——— */
.page-survey { background: transparent; }

.masthead {
  background: var(--chrome);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--pad);
  min-height: 80px;
  border-bottom: 1px solid var(--border-subtle);
}

.top-link {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: var(--space-2) 0;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: color var(--motion-fast) var(--ease-standard);
}
.top-link:hover { color: #fff; }

.hero {
  padding: var(--space-16) var(--pad) var(--space-12);
}
.hero-inner {
  width: min(var(--survey-w), 100%);
  margin: 0 auto;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
}
.hero-inner > * {
  animation: enter 640ms var(--ease-enter) both;
}
.hero-inner > *:nth-child(1) { animation-delay: 80ms; }
.hero-inner > *:nth-child(2) { animation-delay: 140ms; }
.hero-inner > *:nth-child(3) { animation-delay: 200ms; }
.hero-inner > *:nth-child(4) { animation-delay: 250ms; }
.hero-inner > *:nth-child(5) { animation-delay: 300ms; }

.eyebrow {
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: var(--space-4);
}
.masthead .top-link,
.login-brand .eyebrow { color: rgba(255, 255, 255, 0.45); }

.hero h1,
.result-hero h1 {
  font-size: clamp(32px, 5.4vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.038em;
  font-weight: 550;
  margin-bottom: var(--space-4);
}

.lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 38rem;
  font-weight: 400;
}

.time-note {
  margin: var(--space-5) 0 var(--space-8);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.start-form label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  font-weight: 500;
}
.start-row {
  display: flex;
  gap: var(--space-2);
  max-width: 480px;
  align-items: stretch;
}
.start-row input { flex: 1; width: auto; min-width: 0; }
.start-row .btn-primary { flex: 0 0 auto; }

input[type="text"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 16px;
  outline: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
input::placeholder { color: var(--text-tertiary); }
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none;
  -webkit-appearance: none;
}

.btn-primary,
.btn-ghost,
.btn-danger {
  border: 0;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  transition:
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
}
.btn-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #0b0d10;
  white-space: nowrap;
}
.btn-primary:hover { background: #fff; }
.btn-primary:active,
.btn-ghost:active,
.btn-danger:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: transparent;
  color: var(--status-danger);
  border: 1px solid rgba(163, 61, 61, 0.28);
}
.btn-danger:hover { background: rgba(163, 61, 61, 0.06); }

.btn-compact {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  width: auto;
}
.btn-large { width: 100%; }
.btn-menu { display: none; }

.field-error {
  color: var(--status-danger);
  font-size: 13px;
  margin-top: var(--space-2);
}

/* ——— Progress ——— */
.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  padding: var(--space-3) var(--pad) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
#progress-index { color: var(--text-primary); }
.progress-bar {
  height: 1px;
  background: var(--border-default);
  overflow: hidden;
}
#progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.85);
  transition: width var(--motion-normal) var(--ease-standard);
}

/* ——— Survey accordion ——— */
.survey {
  padding: var(--space-6) var(--pad) var(--space-16);
  width: min(var(--survey-w), 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.section {
  padding: var(--space-6);
  scroll-margin-top: 84px;
  border-radius: var(--radius-lg);
}
.section.glass {
  background-color: rgba(3, 6, 10, 0.58);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 22%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.02), rgba(3, 6, 10, 0.24));
  backdrop-filter: blur(40px) saturate(170%);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -28px 40px rgba(0, 0, 0, 0.28),
    0 22px 56px rgba(0, 0, 0, 0.40);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.section-head h2,
.section-toggle-name {
  font-size: 22px;
  font-weight: 550;
  letter-spacing: -0.03em;
  color: rgba(214, 222, 230, 0.88);
}
.section-toggle-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 500;
}
.section-lead {
  color: var(--text-secondary);
  margin: 0 0 var(--space-5);
  line-height: 1.5;
  font-size: 14px;
}
.section-nav {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  justify-content: flex-start;
}

.card-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.card {
  min-width: 0;
  border-radius: var(--radius-md);
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}
.card.is-on {
  background-color: rgba(32, 120, 72, 0.12);
  background-image:
    linear-gradient(180deg, rgba(160, 255, 200, 0.14) 0%, rgba(70, 190, 120, 0.04) 20%, transparent 46%),
    var(--glass-on);
  border-color: rgba(96, 210, 150, 0.36);
}
.card-main {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: var(--space-4);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
}
.card h3 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: rgba(214, 222, 230, 0.90);
}
.card p {
  margin-top: 6px;
  color: rgba(164, 176, 188, 0.48);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
}
.card-meta {
  font-size: 12px;
  color: rgba(200, 210, 220, 0.38);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 500;
  padding-top: 2px;
}
.card.is-on h3 { color: rgba(188, 228, 204, 0.88); }
.card.is-on .card-meta { color: rgba(164, 210, 184, 0.68); }

.card-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 240ms var(--ease-standard),
    opacity 240ms var(--ease-standard);
}
.card.is-open .card-panel {
  grid-template-rows: 1fr;
  opacity: 1;
}
.card-panel-inner { overflow: hidden; padding: 0 var(--space-4) var(--space-4); }

.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--space-2);
}
.option,
.choice {
  appearance: none;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  min-height: 48px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}
.option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.option:hover, .choice:hover { border-color: var(--border-strong); }
.card .option.glass,
.card .choice.glass {
  background-color: rgba(3, 6, 10, 0.52);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 42%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.option.is-on,
.choice.is-on,
.card .option.glass.is-on,
.card .choice.glass.is-on {
  background-color: rgba(48, 168, 104, 0.14);
  background-image:
    linear-gradient(180deg, rgba(180, 255, 210, 0.10) 0%, transparent 52%),
    var(--glass-on);
  border-color: rgba(96, 210, 150, 0.36);
  color: rgba(198, 232, 210, 0.90);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(190, 255, 220, 0.18),
    inset 0 -12px 22px rgba(12, 64, 38, 0.10);
}
.option-note {
  font-size: 12px;
  font-weight: 400;
  color: rgba(164, 176, 188, 0.46);
  line-height: 1.35;
}
.option.is-on .option-note { color: rgba(190, 235, 210, 0.7); }

.choice-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { padding: 10px 16px; }

.finish-card { padding: 0 0 var(--space-6); }
.muted { color: var(--text-secondary); }
.finish-card .muted { margin: var(--space-3) 0 var(--space-6); line-height: 1.5; font-size: 14px; }
.finish-card .section-nav { margin-top: 0; justify-content: flex-start; }

/* ——— Result ——— */
.result-page {
  padding: var(--space-12) var(--pad) 0;
  width: min(720px, 100%);
  margin: 0 auto;
}
.result-hero { padding: 0 0 var(--space-4); animation: enter 640ms var(--ease-enter) both; }
.result-block { padding: var(--space-6) 0; border-top: 1px solid var(--border-subtle); }
.result-block h2 {
  font-size: 18px;
  letter-spacing: -0.03em;
  font-weight: 550;
  margin-bottom: var(--space-4);
}
.chip-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: var(--space-2);
}
.result-chip, .result-job {
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 28%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}
.result-chip { display: flex; flex-direction: column; gap: 4px; }
.result-chip span, .result-job p { color: var(--text-secondary); font-size: 13px; }
.result-chip strong, .result-job h3 { font-weight: 500; font-size: 15px; letter-spacing: -0.02em; }
.result-job { margin-bottom: var(--space-2); }
.result-job.is-step ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; }
.disclaimer {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.5;
  padding: var(--space-4) 0 var(--space-8);
  max-width: 760px;
}
.back-line { padding: 0 0 calc(var(--space-12) + env(safe-area-inset-bottom)); }
.back-line a { color: var(--text-secondary); text-decoration: none; font-size: 14px; }
.back-line a:hover { color: var(--text-primary); }

/* ——— Login ——— */
.login-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
}
.login-gate[hidden] { display: none !important; }

.login-brand {
  background-color: var(--chrome);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  color: #fff;
  padding: var(--space-12) var(--space-12) var(--space-16);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 100vh;
}
.login-brand .logo { margin-bottom: auto; animation-delay: 40ms; }
.login-brand h1 {
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -0.04em;
  font-weight: 500;
  line-height: 1.12;
  max-width: 16ch;
  overflow-wrap: break-word;
  margin: var(--space-3) 0 var(--space-5);
  animation: enter 700ms var(--ease-enter) 160ms both;
}
.login-ambient {
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  line-height: 1.5;
  max-width: 28rem;
  animation: enter 700ms var(--ease-enter) 220ms both;
}
.login-brand .eyebrow { animation: enter 700ms var(--ease-enter) 120ms both; }

.login-pane {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
}
.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  animation: enter 640ms var(--ease-enter) 80ms both;
}
.login-card h2 {
  font-size: 28px;
  letter-spacing: -0.04em;
  font-weight: 550;
}
.login-lead {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: var(--space-2);
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.login-back {
  text-align: center;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 13px;
  margin-top: var(--space-2);
}
.login-back:hover { color: var(--text-primary); }

/* ——— Admin shell ——— */
.page-admin.is-login { background: transparent; }
.page-admin.is-app { background: transparent; }

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.admin-shell[hidden] { display: none !important; }

.sidenav {
  background: var(--sidebar);
  backdrop-filter: blur(36px) saturate(170%);
  -webkit-backdrop-filter: blur(36px) saturate(170%);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  padding: var(--space-6) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
}
.logo-sidebar {
  margin: 0 var(--space-2) var(--space-8);
  padding: 0;
}
.logo-sidebar .logo { height: 32px; }
.sidebar-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  font-weight: 500;
  padding: 0 var(--space-3);
  margin-bottom: var(--space-3);
}
.sidenav nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  text-align: left;
  background: transparent;
  color: var(--sidebar-muted);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  min-height: 38px;
  font-weight: 400;
  border-left: 2px solid transparent;
  transition:
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
}
.nav-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
.nav-btn.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  font-weight: 500;
  border-left-color: #fff;
}
.sidenav-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-1) var(--space-2);
  border-top: 1px solid var(--sidebar-line);
}
.sidenav-foot a,
.sidenav-foot button {
  text-align: left;
  background: none;
  border: 0;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 9px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.sidenav-foot a:hover,
.sidenav-foot button:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }

.nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 17, 0.4);
  z-index: 20;
  animation: fadeIn var(--motion-normal) var(--ease-exit);
}

.admin-main {
  padding: var(--space-6) var(--space-8) var(--space-16);
  min-width: 0;
  max-width: var(--admin-max);
}
.admin-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-end;
  margin-bottom: var(--space-5);
}
.admin-title { display: flex; align-items: flex-end; gap: var(--space-3); }
.admin-top h1 {
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.04em;
  font-weight: 550;
  margin-top: 4px;
}
.admin-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 0;
  margin-bottom: var(--space-4);
}
.chip {
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  transition: border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.chip:hover { color: var(--text-primary); border-color: var(--border-strong); }

.admin-disclaimer { padding: 0 0 var(--space-5); max-width: none; }

.view { display: none; }
.view.is-active {
  display: block;
  animation: viewIn var(--motion-normal) var(--ease-enter);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 28%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  overflow: hidden;
}
.kpi-strip.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: var(--space-5) 0;
}
.kpi-cell {
  padding: var(--space-5) var(--space-4);
  border-right: 1px solid var(--border-subtle);
  min-width: 0;
  animation: enter 520ms var(--ease-enter) both;
}
.kpi-cell:nth-child(1) { animation-delay: 20ms; }
.kpi-cell:nth-child(2) { animation-delay: 55ms; }
.kpi-cell:nth-child(3) { animation-delay: 90ms; }
.kpi-cell:nth-child(4) { animation-delay: 125ms; }
.kpi-cell:nth-child(5) { animation-delay: 160ms; }
.kpi-cell:nth-child(6) { animation-delay: 195ms; }
.kpi-cell:nth-child(7) { animation-delay: 230ms; }
.kpi-cell:nth-child(8) { animation-delay: 265ms; }
.kpi-cell:last-child { border-right: 0; }
.kpi-cell .value {
  font-size: clamp(28px, 2.4vw, 40px);
  letter-spacing: -0.045em;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  color: var(--text-primary);
}
.kpi-cell .label {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: var(--space-2);
  line-height: 1.35;
  overflow-wrap: anywhere;
  font-weight: 400;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 28%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel {
  padding: var(--space-5) var(--space-5) var(--space-6);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  animation: enter 560ms var(--ease-enter) both;
}
.panel-wide { grid-column: 1 / -1; }
@media (min-width: 1025px) {
  .chart-grid .panel:nth-last-child(-n + 2) { border-bottom: 0; }
}
.panel-solo {
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 28%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.panel h2 {
  font-size: 13px;
  font-weight: 550;
  margin-bottom: var(--space-4);
  line-height: 1.35;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.panel-head input { max-width: 280px; }
.chart { min-height: 0; overflow: visible; }

.hbar { display: flex; flex-direction: column; gap: var(--space-3); }
.hbar-row { display: grid; gap: 6px; min-width: 0; }
.hbar-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: baseline;
}
.hbar-meta .name {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}
.hbar-meta .val {
  font-size: 12px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  flex: none;
  color: var(--text-primary);
}
.hbar-track {
  height: 6px;
  border-radius: 99px;
  background: var(--border-subtle);
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.82);
  transform-origin: left;
  animation: barIn 700ms var(--ease-enter) both;
}
@keyframes barIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.hbar-stack {
  display: flex;
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--border-subtle);
}
.hbar-stack span { display: block; height: 100%; }
.hbar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 99px;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.match, .seg-match { background: var(--status-success); }
.dot.step, .seg-step { background: var(--status-warning); }
.dot.train, .seg-train { background: #8a929c; }

.table-scroll {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  background: rgba(12, 14, 18, 0.92);
  z-index: 2;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
}
tbody tr { transition: background var(--motion-fast) var(--ease-standard); }
tbody tr:hover td,
tbody tr:hover th { background: var(--surface-hover); }
.sticky-col {
  position: sticky;
  left: 0;
  background: rgba(12, 14, 18, 0.92);
  z-index: 1;
  font-weight: 500;
}
th.sticky-col { z-index: 3; background: rgba(12, 14, 18, 0.92); }
td.yes { color: var(--status-success); }
.status-ok { color: var(--status-success); font-weight: 500; }
.status-step { color: var(--status-warning); font-weight: 500; }
.status-train { color: var(--text-tertiary); }

.gap-card {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.gap-card:last-child { border-bottom: 0; }
.gap-card strong { display: block; font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; font-weight: 500; }
.gap-card span { color: var(--text-primary); font-size: 13px; font-variant-numeric: tabular-nums; }

.report-actions { display: flex; gap: var(--space-2); margin: var(--space-5) 0; flex-wrap: wrap; }

/* ——— Drawer ——— */
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 17, 0.36);
  animation: fadeIn 280ms var(--ease-exit);
}
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(400px, 100%);
  background-color: var(--glass-tint);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 22%),
    var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--border-default);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.35);
  padding: var(--space-6);
  overflow: auto;
  animation: drawerIn 300ms var(--ease-enter);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.drawer-head h2 {
  font-size: 20px;
  letter-spacing: -0.03em;
  font-weight: 550;
}
.filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.drawer-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.drawer-actions .btn-primary,
.drawer-actions .btn-ghost { flex: 1; }

/* ——— Responsive ——— */
@media (max-width: 1280px) {
  .kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-cell:nth-child(4) { border-right: 0; }
  .kpi-cell:nth-child(n + 5) { border-top: 1px solid var(--border-subtle); }
}

@media (max-width: 1024px) {
  .chart-grid { grid-template-columns: 1fr; }
  .panel { border-right: 0; }
  .admin-main { padding: var(--space-5) var(--space-5) var(--space-12); }
}

@media (max-width: 900px) {
  .login-gate { grid-template-columns: 1fr; }
  .login-brand {
    min-height: auto;
    padding: var(--space-8) var(--space-6);
  }
  .login-brand h1 { font-size: 28px; max-width: none; }
  .hero { padding: var(--space-10) var(--pad) var(--space-8); }
  .start-row, .admin-top, .admin-actions, .report-actions, .panel-head, .section-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-title { align-items: center; }
  .btn-menu { display: inline-flex; align-items: center; justify-content: center; flex: none; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidenav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 88vw);
    transform: translateX(-100%);
    transition: transform 280ms var(--ease-standard);
    z-index: 30;
    height: 100%;
  }
  .sidenav.is-open { transform: none; }
  .nav-scrim { display: block; }
  .nav-scrim[hidden] { display: none !important; }
  .kpi-strip.compact { grid-template-columns: 1fr; }
  .kpi-strip.compact .kpi-cell { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
}

@media (max-width: 700px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-cell { border-right: 1px solid var(--border-subtle); }
  .kpi-cell:nth-child(even) { border-right: 0; }
  .kpi-cell:nth-child(n + 3) { border-top: 1px solid var(--border-subtle); }
  .masthead { padding: var(--space-4) 16px; min-height: 68px; }
  .logo { height: 32px; }
  .page-survey .logo { height: 44px; }
  .top-link { font-size: 12px; }
  .options { grid-template-columns: 1fr; }
  .start-row .btn-primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .logo, .hero-inner > *, .login-brand h1, .login-ambient, .login-card, .kpi-cell, .panel, .hbar-fill, .view.is-active {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
