/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --navy:        #0f172a;
  --navy-mid:    #1e293b;
  --blue:        #2563eb;
  --blue-light:  #dbeafe;
  --blue-mid:    #3b82f6;
  --teal:        #0891b2;
  --green:       #059669;
  --green-light: #d1fae5;
  --green-dark:  #047857;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --bg:          #f1f5f9;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --border-dark: #cbd5e1;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-light:  #94a3b8;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Dark mode overrides ────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f172a;
  --card:        #1e293b;
  --border:      #334155;
  --border-dark: #475569;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --text-light:  #64748b;
  --blue-light:  #1e3a5f;
  --green-light: #064e3b;
  --red-light:   #450a0a;
  --amber-light: #4a3a18;
}
[data-theme="dark"] code {
  background: #1e293b;
  color: #93c5fd;
  border-color: #334155;
}
[data-theme="dark"] .metrics-table th,
[data-theme="dark"] .data-table thead tr:first-child th { background: #0f172a; }
[data-theme="dark"] .data-table tbody tr:nth-child(even) td { background: #243044; }
[data-theme="dark"] .data-table tbody tr:hover td,
[data-theme="dark"] .metrics-table tr:hover td { background: #1e3a5f; }
[data-theme="dark"] .example-block { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .upload-zone { background: #1a2840; border-color: #475569; }
[data-theme="dark"] .upload-zone.has-files { background: #064e3b; }
[data-theme="dark"] .detection-table thead th { background: #0f172a; }
[data-theme="dark"] .detection-table tr:hover td { background: #1e3a5f; }
[data-theme="dark"] .det-row-gt td { background: #1e2d4a; }
[data-theme="dark"] .collapsible-trigger:hover { background: #243044; }
[data-theme="dark"] .gt-select-panel,
[data-theme="dark"] .exp-filter-panel,
[data-theme="dark"] .exp-info-popover { background: #1e293b; border-color: #475569; }
[data-theme="dark"] .gt-exp-option:hover { background: #0f172a; }
[data-theme="dark"] .model-option--soon { background: #0f172a; }
/* GT-highlight + warn table rows */
[data-theme="dark"] .row-gt td { background: #1e2d4a !important; }
[data-theme="dark"] .det-row-warn td { background: #422006; }
/* Feature/section group-header rows (data-format feature table) */
[data-theme="dark"] .feature-section-row th { background: #0f172a; }
/* Amber elements - lift text + border contrast on dark amber backgrounds */
[data-theme="dark"] .info-banner--amber,
[data-theme="dark"] .badge-amber,
[data-theme="dark"] .det-badge--amber,
[data-theme="dark"] .gt-tag--override,
[data-theme="dark"] .lib-status--warn,
[data-theme="dark"] .role-warn { color: #fcd34d; border-color: #6b551f; }
/* Blue text + chip contrast */
[data-theme="dark"] .info-banner--blue,
[data-theme="dark"] .badge-blue,
[data-theme="dark"] .det-type-toc { color: #93c5fd; }
[data-theme="dark"] .role-gt { background: #1e3a5f; color: #93c5fd; }
/* Green text contrast */
[data-theme="dark"] .badge-green,
[data-theme="dark"] .role-predict { color: #6ee7b7; }
/* Crossline (purple) chip */
[data-theme="dark"] .det-type-crossline { background: #2e1065; color: #e9d5ff; border-color: #6d28d9; }
/* Base style for feature-section rows (was inline in data_format.html) */
.feature-section-row th { background: #f8f9fa; font-weight: 600; font-size: .8rem; letter-spacing: .05em; color: var(--text-muted); text-align: left; }

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .85em;
  background: #f0f4ff;
  padding: .1em .35em;
  border-radius: 4px;
  color: #1d4ed8;
}

/* ── Navigation ────────────────────────────────────────────────────────── */
.nav {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}
.nav-logo-wrap { display: flex; align-items: center; background: #fff; border-radius: 8px; padding: 4px 8px; flex-shrink: 0; }
.nav-logo { height: 48px; width: auto; display: block; }
.nav-brand-text { display: flex; flex-direction: column; gap: .05rem; }
.nav-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.nav-tagline {
  font-size: .7rem;
  color: #94a3b8;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: 1;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: .25rem;
}
.nav-link {
  display: block;
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: #94a3b8;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.nav-link.active { color: #fff; background: rgba(59,130,246,.25); }
/* Right-aligned signed-in user + logout group */
.nav-auth { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.nav-user { font-size: .8rem; color: #94a3b8; white-space: nowrap; }

/* ── Page header ───────────────────────────────────────────────────────── */
.page-header {
  background: var(--navy-mid);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.page-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}
.page-subtitle {
  font-size: .9375rem;
  color: #94a3b8;
  max-width: 720px;
  line-height: 1.65;
}

/* ── Main & container ──────────────────────────────────────────────────── */
.main { flex: 1; padding: 2rem 0 3rem; }
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 1.0625rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: .4rem;
  letter-spacing: -.01em;
}
.card-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.card-text {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: .75rem;
}
.section-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.col-count {
  font-size: .8rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg);
  padding: .15em .5em;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Mode selector ─────────────────────────────────────────────────────── */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: .75rem;
}
.mode-option {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.mode-option input[type="radio"] { display: none; }
.mode-option.selected,
.mode-option:has(input:checked) {
  border-color: var(--blue);
  background: #f0f7ff;
}
.mode-body {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
}
.mode-icon {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--blue);
  flex-shrink: 0;
}
.mode-text { flex: 1; }
.mode-text strong { display: block; font-size: .9375rem; margin-bottom: .25rem; color: var(--text); }
.mode-text span { font-size: .84rem; color: var(--text-muted); line-height: 1.5; }
.mode-check {
  font-size: 1rem;
  color: var(--blue);
  font-weight: 700;
  opacity: 0;
  transition: opacity .15s;
}
.mode-option.selected .mode-check,
.mode-option:has(input:checked) .mode-check { opacity: 1; }

/* ── Training-dataset checkbox cards ───────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: .75rem;
}
.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, opacity .15s;
}
.checkbox-card.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  background: #fafafa;
}
.checkbox-card.is-enabled:has(input:checked) {
  border-color: var(--blue);
  background: #f0f7ff;
}
.checkbox-card input[type="checkbox"] { margin-top: .2rem; flex-shrink: 0; }
.checkbox-body { flex: 1; }
.checkbox-body strong { display: block; font-size: .9375rem; margin-bottom: .25rem; color: var(--text); }
.checkbox-body span { font-size: .82rem; color: var(--text-muted); line-height: 1.45; }

@media (max-width: 720px) {
  .checkbox-grid { grid-template-columns: 1fr; }
}

/* ── Form ──────────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-row.two-col > * { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-label { font-size: .875rem; font-weight: 600; color: var(--text); }
.form-hint { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.form-select {
  padding: .55rem .8rem;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--card);
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
  transition: border-color .15s;
}
.form-select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }

/* ── Upload zone ───────────────────────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fafbfc;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--blue); background: #f0f7ff; }
.upload-zone.has-files { border-color: var(--green); background: #f0fdf8; border-style: solid; }
.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-body { pointer-events: none; }
.upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.upload-text { font-size: .9375rem; color: var(--text); margin-bottom: .3rem; }
.upload-hint { font-size: .82rem; color: var(--text-muted); }
.file-count {
  font-size: .84rem;
  color: var(--green-dark);
  font-weight: 500;
  margin-top: .4rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-outline {
  background: transparent;
  border: 1.5px solid #ffffff55;
  color: #fff;
  font-size: .875rem;
  padding: .5rem 1.1rem;
}
.btn-outline:hover { background: rgba(255,255,255,.1); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: .5rem;
}
.form-actions-hint { font-size: .82rem; color: var(--text-light); }

/* ── Spinner ───────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Info banners ──────────────────────────────────────────────────────── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  line-height: 1.55;
  margin-bottom: .5rem;
}
.info-banner--blue { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }
.info-banner--amber { background: var(--amber-light); color: #92400e; border: 1px solid #fcd34d; }
.info-icon { font-style: normal; font-weight: 700; flex-shrink: 0; }

.error-banner {
  background: var(--red-light);
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-top: 1rem;
}

/* ── Result banner ─────────────────────────────────────────────────────── */
.result-banner {
  background: var(--navy-mid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.result-banner-left { display: flex; align-items: center; gap: 1rem; }
.result-check {
  width: 36px; height: 36px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.result-banner-title { font-size: 1rem; font-weight: 700; color: #ffffff; }
.result-banner-sub   { font-size: .82rem; color: #94a3b8; margin-top: .15rem; }

/* ── Model info row ────────────────────────────────────────────────────── */
.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.info-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  box-shadow: var(--shadow);
}
.info-chip-label { font-size: .73rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.info-chip-value { font-size: .9rem; font-weight: 600; color: var(--text); }

/* ── Metrics comparison ────────────────────────────────────────────────── */
.metrics-comparison { display: flex; flex-direction: column; gap: 1.5rem; }
.metrics-table-wrap { overflow-x: auto; }
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.metrics-table th {
  padding: .6rem .75rem;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metrics-table th:first-child { text-align: left; }
.metrics-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
}
.metrics-table td.metric-label { text-align: left; color: var(--text-muted); font-size: .875rem; }
.metrics-table tr:last-child td { border-bottom: none; }
.metrics-table tr:hover td { background: #f8fafc; }

/* ── Improvement cards ─────────────────────────────────────────────────── */
.improvement-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.improvement-card {
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.improvement-card--good { background: var(--green-light); border-color: #a7f3d0; }
.improvement-card--bad  { background: var(--red-light);   border-color: #fca5a5; }
.imp-label    { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; }
.imp-values   { display: flex; align-items: center; gap: .4rem; font-size: .9rem; font-variant-numeric: tabular-nums; margin-bottom: .5rem; }
.imp-baseline { color: var(--text-muted); text-decoration: line-through; }
.imp-arrow    { color: var(--text-light); }
.imp-model    { font-weight: 700; color: var(--text); }
.imp-pct      { font-size: .9rem; font-weight: 700; }
.pct-good { color: var(--green-dark); }
.pct-bad  { color: var(--red); }

/* ── Per-experiment table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .855rem;
}
.data-table thead tr:first-child th {
  background: var(--navy);
  color: #cbd5e1;
  padding: .6rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
}
.data-table thead tr:first-child th:first-child,
.data-table thead tr:first-child th:nth-child(2) { text-align: left; }
.data-table thead tr.subheader th {
  background: #1e293b;
  color: #64748b;
  padding: .4rem .75rem;
  font-size: .75rem;
  font-weight: 500;
  text-align: center;
}
.data-table tbody tr:nth-child(even) td { background: #f8fafc; }
.data-table tbody tr:hover td { background: #f0f7ff; }
.data-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
}
.data-table td:first-child, .data-table td:nth-child(2) { text-align: left; }
.data-table thead th { border-bottom: 2px solid var(--border); }

/* Cell states */
.cell-good  { color: var(--green-dark); font-weight: 600; }
.cell-bad   { color: var(--red); }
.cell-muted { color: var(--text-muted); }
.cell-note  { color: var(--text-muted); font-style: italic; font-size: .82rem; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2em .6em;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  vertical-align: middle;
}
.badge-green { background: var(--green-light); color: var(--green-dark); border: 1px solid #a7f3d0; }
.badge-blue  { background: var(--blue-light);  color: #1d4ed8;           border: 1px solid #bfdbfe; }
.badge-amber { background: var(--amber-light); color: #92400e;           border: 1px solid #fcd34d; }

/* ── Site overview chips (data-format page) ────────────────────────────── */
.site-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.site-chip {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.site-chip--active { border-color: #a7f3d0; background: var(--green-light); }
.site-chip--soon   { background: var(--bg); }
.site-chip-name   { font-weight: 700; font-size: .9375rem; color: var(--text); margin-bottom: .3rem; }
.site-chip-folder { font-size: .8rem; margin-bottom: .3rem; }
.site-chip-detail { font-size: .8rem; color: var(--text-muted); margin-bottom: .4rem; }
.site-chip-status { font-size: .78rem; font-weight: 600; color: var(--green-dark); }
.site-chip--soon .site-chip-status { color: var(--amber); }

/* ── Example blocks ────────────────────────────────────────────────────── */
.example-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  font-size: .875rem;
  line-height: 2;
  margin-top: .75rem;
}
.example-title { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .4rem; }

/* ── Table rows (GT highlight) ─────────────────────────────────────────── */
.row-gt td { background: #eff6ff !important; }

/* ── FAQ ────────────────────────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; margin-top: .75rem; }
.faq-item { border-top: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-q {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  padding: 1rem 2rem 1rem 0;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.faq-q::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform .2s;
}
.faq-item.open .faq-q::after { content: '+'; transform: translateY(-50%) rotate(45deg); }
.faq-a {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  padding-bottom: 0;
}
.faq-item.open .faq-a { max-height: 400px; padding-bottom: 1rem; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 1rem 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  color: #475569;
}
.footer-left { display: flex; flex-direction: column; gap: .15rem; }
.footer-right { display: flex; align-items: center; gap: .6rem; }
.footer-partner-label { font-size: .75rem; color: #475569; }
.footer-logo-wrap { display: flex; align-items: center; background: #fff; border-radius: 6px; padding: 3px 7px; }
.footer-logo { height: 22px; width: auto; display: block; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .improvement-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .mode-grid { grid-template-columns: 1fr; }
  .site-overview-grid { grid-template-columns: 1fr; }
  .form-row.two-col { flex-direction: column; }
  .footer-inner { flex-direction: column; gap: .25rem; }
}
@media (max-width: 500px) {
  .improvement-cards { grid-template-columns: 1fr; }
  .nav-tagline { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   NEW COMPONENTS - redesigned pipeline
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Step cards ─────────────────────────────────────────────────────────── */
.step-card { padding: 1.5rem 1.75rem; }

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.step-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .1rem;
  box-shadow: 0 0 0 4px var(--blue-light);
}

.run-card .step-header { margin-bottom: 0; }

.btn-run { padding: .7rem 2rem; font-size: 1rem; }

/* ── Detection preview table ────────────────────────────────────────────── */
.detection-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.det-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3em .75em;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.det-badge--green { background: var(--green-light); color: var(--green-dark); border: 1px solid #a7f3d0; }
.det-badge--blue  { background: var(--blue-light);  color: #1d4ed8;           border: 1px solid #bfdbfe; }
.det-badge--amber { background: var(--amber-light); color: #92400e;           border: 1px solid #fcd34d; }

.detection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .855rem;
}
.detection-table thead th {
  padding: .5rem .75rem;
  background: var(--bg);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.detection-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.detection-table tr:last-child td { border-bottom: none; }
.detection-table tr:hover td { background: #f8fafc; }

.det-row-gt   td { background: #eff6ff; }
.det-row-warn td { background: #fffbeb; }

.det-check { color: var(--green);  font-weight: 700; font-size: .95rem; }
.det-cross { color: var(--red);    font-weight: 700; font-size: .95rem; }

.role-tag {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 600;
}
.role-gt      { background: #dbeafe; color: #1d4ed8; }
.role-predict { background: var(--green-light); color: var(--green-dark); }
.role-warn    { background: var(--amber-light); color: #92400e; }

/* ── GT mode segmented selector ─────────────────────────────────────────── */
.gt-mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: .75rem;
}

.gt-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.gt-mode-btn input[type="radio"] { display: none; }
.gt-mode-btn:hover { border-color: var(--blue-mid); background: #f8faff; }
.gt-mode-btn--active {
  border-color: var(--blue);
  background: #f0f7ff;
}
.gt-mode-btn--active::after {
  content: '✓';
  position: absolute;
  top: .6rem;
  right: .8rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--blue);
}

.gt-mode-icon  { font-size: 1.25rem; line-height: 1; margin-bottom: .1rem; }
.gt-mode-label { font-size: .9375rem; font-weight: 650; color: var(--text); }
.gt-mode-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.45; }

@media (max-width: 640px) {
  .gt-mode-selector { grid-template-columns: 1fr; }
}

/* ── Model info bar ─────────────────────────────────────────────────────── */
.model-info-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
}
.mib-item  { display: flex; flex-direction: column; gap: .1rem; }
.mib-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.mib-value { font-weight: 600; color: var(--text); }
.mib-sep   { width: 1px; height: 2rem; background: var(--border-dark); flex-shrink: 0; }
.mib-link  { margin-left: auto; font-size: .84rem; color: var(--blue); font-weight: 500; white-space: nowrap; }
.mib-link:hover { text-decoration: underline; }

/* ── Summary card (big result banner) ──────────────────────────────────── */
.summary-card {
  background: var(--navy-mid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* ── Results meta row (GT status + model chips, side by side) ───────────── */
.results-meta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .1rem 0;
}
.results-meta-row .gt-status-row {
  padding: 0;
  flex: 1;
  min-width: 0;
}
.results-meta-row .info-row {
  flex-shrink: 0;
}

/* ── Download results card ──────────────────────────────────────────────── */
.download-results-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.4rem 1.75rem;
}
.download-results-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}
.download-results-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.download-results-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.btn-dl-primary,
.btn-dl-secondary {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: left;
  white-space: nowrap;
}
.btn-dl-primary {
  background: var(--blue);
  border: none;
  color: #fff;
}
.btn-dl-primary:hover { background: #1d4ed8; }
.btn-dl-secondary {
  background: var(--card);
  border: 1.5px solid var(--border-dark);
  color: var(--text);
}
.btn-dl-secondary:hover { border-color: var(--blue); color: var(--blue); }
.btn-dl-icon {
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.btn-dl-sub {
  display: block;
  font-size: .72rem;
  font-weight: 400;
  opacity: .75;
  margin-top: .05rem;
}
.btn-action-download {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .9rem;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.btn-action-download:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }

.summary-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.summary-check {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.summary-title { font-size: 1.05rem; font-weight: 700; color: #ffffff; line-height: 1.3; }
.summary-sub   { font-size: .82rem;  color: #94a3b8;   margin-top: .2rem; }

.summary-stats {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  align-items: center;
}

.stat-sep {
  width: 1px;
  height: 2.5rem;
  background: rgba(255,255,255,.1);
  margin: 0 2rem;
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .75rem;
}
.stat-label { font-size: .72rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.stat-from  { display: flex; align-items: center; gap: .35rem; }
.stat-baseline { font-size: .84rem; color: #64748b; text-decoration: line-through; font-variant-numeric: tabular-nums; }
.stat-arrow    { font-size: .8rem; color: #475569; }
.stat-value    { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-good     { color: #34d399; }
.stat-bad      { color: #f87171; }

/* ── Chart card ─────────────────────────────────────────────────────────── */
.chart-card { padding: 1.5rem 1.75rem; }

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.chart-container {
  max-width: 640px;
  margin: 0 auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  align-items: center;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: .25rem;
}
.legend-label {
  font-size: .82rem;
  color: var(--text-muted);
  vertical-align: middle;
}
.legend-cross {
  font-size: .85rem;
  font-weight: 700;
  color: #059669;
  vertical-align: middle;
  margin-right: .25rem;
  line-height: 1;
}
.legend-convention {
  font-size: .78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Collapsible cards ──────────────────────────────────────────────────── */
.collapsible-card { padding: 0; overflow: hidden; }

.collapsible-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.4rem 1.75rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  gap: 1rem;
  transition: background .15s;
}
.collapsible-trigger:hover { background: #f8fafc; }

.collapsible-icon {
  font-size: .75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s;
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease, padding .35s ease;
  padding: 0 1.75rem;
}

.collapsible-card.open .collapsible-body {
  max-height: 2000px;
  padding: 0 1.75rem 1.5rem;
}

.collapsible-card.open .collapsible-trigger {
  border-bottom: 1px solid var(--border);
}

/* ── GT override input (Step 2) ─────────────────────────────────────────── */
.gt-override-row {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: .75rem;
}

.gt-override-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.gt-override-input {
  padding: .55rem .85rem;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--card);
  max-width: 420px;
  transition: border-color .15s, box-shadow .15s;
}
.gt-override-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}
.gt-override-input::placeholder { color: var(--text-light); }

.gt-override-hint {
  font-size: .8rem;
  line-height: 1.45;
}
.gt-hint-found { color: var(--green-dark); }
.gt-hint-none  { color: var(--amber); }

.gt-faq-note { margin: 0; }
.faq-anchor-link {
  font-size: .84rem;
  color: var(--blue);
  font-weight: 500;
}
.faq-anchor-link:hover { text-decoration: underline; }

/* ── GT status row (post-run) ───────────────────────────────────────────── */
.gt-status-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-size: .875rem;
  color: var(--text-muted);
  padding: .5rem .25rem;
}

.gt-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.gt-status-found { background: var(--green-light); color: var(--green-dark); }
.gt-status-none  { background: var(--amber-light); color: #92400e; }

.gt-tag {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.gt-tag--auto     { background: var(--blue-light); color: #1d4ed8; border: 1px solid #bfdbfe; }
.gt-tag--override { background: var(--amber-light); color: #92400e; border: 1px solid #fcd34d; }

.gt-faq-link {
  font-size: .8rem;
  color: var(--blue);
  margin-left: auto;
}
.gt-faq-link:hover { text-decoration: underline; }

/* ── Zoom buttons (+/-/reset) ───────────────────────────────────────────── */
.btn-zoom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
  user-select: none;
}
.btn-zoom:hover { background: var(--card); border-color: var(--blue); color: var(--blue); }

.btn-zoom-reset {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .8rem;
  background: var(--bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-zoom-reset:hover { background: var(--card); border-color: var(--blue); color: var(--blue); }

/* ── GT format hint (below override input) ──────────────────────────────── */
.gt-format-note {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .35rem;
  line-height: 1.5;
}
.gt-format-note code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 .3em;
  font-size: .78rem;
}

/* ── Vectors toggle button ──────────────────────────────────────────────── */
.btn-vectors {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .85rem;
  background: var(--bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-vectors:hover { background: var(--card); border-color: var(--blue); color: var(--blue); }
.btn-vectors--on   { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }

/* ── Shared dropdown (GT select + chart exp filter) ─────────────────────── */
.gt-select-wrap,
.exp-filter-wrap {
  position: relative;
}
.gt-select-toggle,
.exp-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .9rem;
  background: var(--card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: border-color .15s;
}
.gt-select-toggle:disabled { opacity: .5; cursor: default; }
.gt-select-toggle:not(:disabled):hover,
.exp-filter-toggle:hover   { border-color: var(--blue); }
.gt-select-toggle.gt-select-open,
.exp-filter-toggle.gt-select-open { border-color: var(--blue); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.gt-chevron { margin-left: auto; font-size: .7rem; color: var(--text-muted); flex-shrink: 0; }

.gt-select-panel,
.exp-filter-panel {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  background: var(--card);
  border: 1.5px solid var(--blue);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: .4rem 0;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  max-height: 260px;
  overflow-y: auto;
}
.exp-filter-panel { right: 0; left: auto; min-width: 160px; }

.gt-exp-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .9rem;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  transition: background .1s;
  user-select: none;
}
.gt-exp-option:hover { background: var(--bg); }
.gt-exp-option input[type="checkbox"] { accent-color: var(--blue); flex-shrink: 0; width: 1rem; height: 1rem; }
.gt-exp-text { flex: 1; }
.toc-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: .05em .35em;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 3px;
  margin-left: .3rem;
}
.gt-clear-row {
  padding: .35rem .9rem .1rem;
  margin-top: .15rem;
  border-top: 1px solid var(--border);
}
.gt-clear-btn {
  background: none; border: none; padding: 0; font-size: .78rem;
  color: var(--text-muted); cursor: pointer; font-family: var(--font);
}
.gt-clear-btn:hover { color: var(--blue); text-decoration: underline; }

/* ── Chart toolbar (legend + vectors + zoom above canvas) ───────────────── */
.chart-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .6rem 0 .5rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

/* ── Experiment filter (chart header) ───────────────────────────────────── */
.exp-filter-wrap { margin-left: auto; }

/* ── chip-dot (used inline in dropdown labels) ──────────────────────────── */
.chip-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Per-experiment card header ─────────────────────────────────────────── */
.perexp-header {
  display: flex;
  align-items: center;
  padding-right: 1.25rem;
}
.perexp-header .collapsible-trigger {
  flex: 1;
  width: auto;
  border-bottom: none !important;
}
.collapsible-card.open .perexp-header {
  border-bottom: 1px solid var(--border);
}
.btn-perexp-download {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  background: var(--bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.btn-perexp-download:hover { border-color: var(--blue); color: var(--blue); }

/* ── Per-experiment row highlight ───────────────────────────────────────── */
#per-exp-table tbody tr.row-highlight {
  background: var(--blue-light);
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
#per-exp-table tbody tr[data-expid]:not(.row-highlight):hover {
  background: var(--bg);
}

/* ── Detection table include checkbox column ────────────────────────────── */
.det-th-include,
.det-td-include {
  text-align: center !important;
  white-space: nowrap;
}
.det-th-include input[type="checkbox"],
.det-td-include input[type="checkbox"] {
  accent-color: var(--blue);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  vertical-align: middle;
  margin-right: .35rem;
}

/* ── Detection table type tags ──────────────────────────────────────────── */
.det-type-tag {
  display: inline-block;
  padding: .18em .6em;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.det-type-parallel  { background: var(--bg);          color: var(--text-muted);  border: 1px solid var(--border); }
.det-type-crossline { background: #fdf4ff;             color: #7e22ce;            border: 1px solid #e9d5ff; }
.det-type-toc       { background: var(--blue-light);   color: #1d4ed8;            border: 1px solid #bfdbfe; }

/* ── Experiment info button & popover ───────────────────────────────────── */
.exp-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  font-size: .82rem;
  color: var(--text-light);
  cursor: pointer;
  transition: color .15s;
  font-family: var(--font);
  line-height: 1;
}
.exp-info-btn:hover { color: var(--blue); }

.exp-info-popover {
  position: fixed;
  z-index: 500;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: .9rem 1rem 1rem;
  font-size: .85rem;
}
.eip-title {
  font-weight: 700;
  font-size: .875rem;
  color: var(--text);
  margin-bottom: .6rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.eip-rows {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .65rem;
}
.eip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.eip-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.eip-value {
  font-size: .855rem;
  color: var(--text);
  font-weight: 500;
  text-align: right;
}
.eip-files {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding-top: .6rem;
  border-top: 1px solid var(--border);
}
.eip-file {
  display: flex;
  align-items: baseline;
  gap: .45rem;
}
.eip-file-tag {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-light);
  flex-shrink: 0;
  width: 2.2rem;
}
.eip-file-name {
  font-size: .72rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.4;
}

/* ── No-metrics note (per-exp card) ─────────────────────────────────────── */
.no-metrics-note {
  font-size: .875rem;
  color: var(--text-muted);
  padding: .75rem 1rem;
  background: var(--amber-light);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  line-height: 1.55;
}

/* ── Dataset Library page ───────────────────────────────────────────────── */

.lib-upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  position: relative;
}
.lib-upload-zone:hover,
.lib-upload-zone.drag-over { border-color: var(--blue); background: var(--blue-light); }
.lib-upload-zone.has-files  { border-color: var(--green); background: var(--green-light); }

.lib-upload-body {
  text-align: center;
  padding: 1.5rem;
  pointer-events: none;
}

/* Library table */
.lib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .865rem;
}
.lib-table thead th {
  padding: .45rem .75rem;
  background: var(--bg);
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.lib-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.lib-table tr:last-child td { border-bottom: none; }
.lib-table tr:hover td { background: var(--bg); }

.lib-td-name { max-width: 360px; }
.lib-td-meta { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }
.lib-td-actions { text-align: right; white-space: nowrap; }

/* Inline rename input */
.lib-name-display {
  cursor: pointer;
  font-weight: 500;
}
.lib-name-display:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.lib-name-input {
  font-family: var(--font);
  font-size: .865rem;
  font-weight: 500;
  padding: .15rem .4rem;
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--card);
  width: 100%;
  max-width: 320px;
}

/* Type badges */
.lib-type-tag {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.lib-type-vcog  { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.lib-type-ccog  { background: var(--blue-light); color: #1d4ed8; border: 1px solid #bfdbfe; }
.lib-type-other { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* Action buttons */
.lib-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  padding: .2rem .35rem;
  border-radius: var(--radius-sm);
  opacity: .55;
  transition: opacity .15s, background .15s;
}
.lib-btn:hover { opacity: 1; background: var(--bg); }
.lib-btn.lib-btn-expand {
  opacity: 1;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: .2rem .45rem;
}
.lib-btn.lib-btn-expand:hover { color: var(--blue); background: var(--blue-light); }


/* Count badge (top right of card header) */
.lib-count-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .2em .65em;
  border-radius: 20px;
}

/* Empty state */
.lib-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.lib-empty-icon { font-size: 2rem; margin-bottom: .75rem; }
.lib-empty-text { font-size: .9rem; }

/* Upload status message */
.lib-status {
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
}
.lib-status--info    { background: var(--blue-light);  color: #1d4ed8;  border: 1px solid #bfdbfe; }
.lib-status--success { background: var(--green-light); color: var(--green-dark); border: 1px solid #a7f3d0; }
.lib-status--warn    { background: var(--amber-light); color: #92400e; border: 1px solid #fcd34d; }
.lib-status--error   { background: var(--red-light);   color: var(--red); border: 1px solid #fca5a5; }

/* ── Site selector (Step 1 of prediction tool) ──────────────────────────── */
.site-cards {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}
.site-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.site-card:hover { border-color: var(--blue); background: var(--blue-light); }
.site-card--selected {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.site-card-icon { font-size: 1.25rem; flex-shrink: 0; }
.site-card-body { flex: 1; min-width: 0; }
.site-card-name {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .1rem;
}
.site-card-meta { font-size: .8rem; color: var(--text-muted); }
.site-card-check {
  font-size: .95rem;
  font-weight: 700;
  color: var(--blue);
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
}
.site-card--selected .site-card-check { opacity: 1; }

/* Dark mode adjustments */
[data-theme="dark"] .lib-upload-zone { background: #1a2840; border-color: #475569; }
[data-theme="dark"] .lib-upload-zone.has-files { background: #064e3b; }
[data-theme="dark"] .lib-table thead th { background: #0f172a; }
[data-theme="dark"] .lib-table tr:hover td { background: #1e3a5f; }
[data-theme="dark"] .lib-name-input { background: #0f172a; border-color: var(--blue); }
[data-theme="dark"] .lib-picker-header { background: #0f172a; }
[data-theme="dark"] .lib-picker-header:hover { background: #1e3a5f; }

/* ── Settings page ──────────────────────────────────────────────────────── */

/* Settings list (rows of setting controls) */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }

.setting-info { flex: 1; min-width: 0; }
.setting-label {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .15rem;
}
.setting-desc {
  font-size: .84rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-dark);
  border-radius: 24px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Segmented control (CSV delimiter) */
.seg-control {
  display: inline-flex;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.seg-btn {
  padding: .4rem .9rem;
  background: var(--card);
  border: none;
  border-right: 1.5px solid var(--border-dark);
  font-family: var(--font);
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--bg); color: var(--text); }
.seg-btn--active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.seg-btn--active:hover { background: var(--blue); color: #fff; }

/* Model option grid */
.model-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: .25rem;
}

.model-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: border-color .15s;
}
.model-option--active {
  border-color: var(--blue);
  background: var(--blue-light);
}
.model-option--soon {
  background: var(--bg);
  opacity: .75;
}

.model-option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.model-option-name {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
}
.model-option-desc {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.model-option-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .15rem;
}
.model-meta-chip {
  font-size: .72rem;
  font-weight: 600;
  padding: .15em .5em;
  background: rgba(37,99,235,.12);
  color: var(--blue);
  border-radius: 20px;
}

/* ── Library saved-sites header ──────────────────────────────────────────── */
.lib-saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

/* Select-all row */
.lib-select-all-row {
  padding: .4rem 0 .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .5rem;
}
.lib-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.lib-select-all-label input[type="checkbox"] {
  accent-color: var(--blue);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* Bulk action bar */
.lib-bulk-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--red-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: .35rem .75rem;
}
.lib-bulk-label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--red);
}
.btn-danger-sm {
  padding: .3rem .75rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn-danger-sm:hover { opacity: .85; }

/* ── Library site cards (library page) ──────────────────────────────────── */
.lib-sites { display: flex; flex-direction: column; gap: .5rem; }

.lib-site-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.lib-site-card:has(.lib-site-cb:checked) { border-color: var(--blue); background: var(--blue-light); }

/* Checkbox wrapper inside card header */
.lib-site-checkbox-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: .1rem;
}
.lib-site-checkbox-wrap input[type="checkbox"] {
  accent-color: var(--blue);
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}

.lib-site-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
}
.lib-site-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}
.lib-site-icon { font-size: 1.2rem; flex-shrink: 0; }
.lib-site-name {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .1rem;
}
.lib-site-name-text {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.lib-site-name-text:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.lib-site-name-input-inline {
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--card);
  min-width: 220px;
}
.lib-site-meta { font-size: .8rem; color: var(--text-muted); }
.lib-site-actions { display: flex; gap: .25rem; flex-shrink: 0; }

.lib-site-files {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: .6rem 1rem;
}
.lib-files-list { display: flex; flex-direction: column; gap: .3rem; }
.lib-file-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
}
.lib-file-name { flex: 1; color: var(--text-muted); font-family: 'JetBrains Mono','Fira Code',monospace; }
.lib-file-size { color: var(--text-light); white-space: nowrap; }

/* Site name input row (add site form) */
.lib-name-row {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
}
.lib-site-name-input {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s;
}
.lib-site-name-input:focus { outline: none; border-color: var(--blue); }
.lib-file-count-hint {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .4rem;
}

/* Dark mode adjustments for settings */
[data-theme="dark"] .seg-btn { background: var(--card); }
[data-theme="dark"] .seg-btn:hover { background: var(--navy); }
[data-theme="dark"] .seg-btn--active { background: var(--blue); }
[data-theme="dark"] .model-option--active { background: rgba(37,99,235,.15); }
[data-theme="dark"] .model-meta-chip { background: rgba(59,130,246,.2); color: #93c5fd; }

/* ── Responsive top nav (mobile/tablet) ─────────────────────────────────────
   The fixed-height nav row did not wrap, so the nav links overflowed narrow
   viewports (horizontal scroll on phones/tablets). Let the nav wrap and shrink
   below ~860px so every page fits the viewport width. */
@media (max-width: 860px) {
  .nav-inner { flex-wrap: wrap; height: auto; padding: .6rem 1rem; gap: .4rem .6rem; }
  .nav-links { flex-wrap: wrap; gap: .15rem .25rem; width: 100%; }
  .nav-link { padding: .4rem .6rem; font-size: .8rem; }
  .nav-logo { height: 36px; }
}
@media (max-width: 420px) {
  .nav-link { padding: .35rem .5rem; font-size: .76rem; }
}
