/* VOCView — Leeder Analytical tokens, GC-SQ Processor design language
   (2026-10-13 retheme at Philip's request: "make the whole website look
   cleaner and modern, similar to GC-SQ Processor").
   GC-SQ reference: gcsq/web/static/base.css + _nav.html — navy gradient
   top bar #0a3d62→#07263d (white text, green accent line), Calibri 14px,
   headings #0a3d62, #0969da primary, bordered white buttons, soft-bordered
   sticky-header tables, tinted pills. Leeder identity kept as a subdued
   azure accent. Single shared stylesheet — no inline font-family/colors
   in templates (Westrac lesson). */

:root {
  /* GC-SQ core tokens (same names as before, new values) */
  --ink: #0a3d62;            /* heading navy (wasLeeder logo navy) */
  --accent: #4E97D2;         /* Leeder azure KEPT — fills only */
  --accent-dark: #3D7FB8;    /* accent-as-text on white */
  --accent-deep: #114986;    /* site's own link blue */
  --accent-tint: #eaf2f9;
  --accent-glow: rgba(78, 151, 210, 0.35); /* focus ring: accent @ 35% */
  --hover-ink: #1d5b8f;      /* navy button hover (gcsq .btn-primary:hover) */
  --bg: #ffffff;
  --surface: #f5f7fa;        /* gcsq --color-bg-soft */
  --surface-tint: #f0f4f8;   /* gcsq --color-bg-table */
  --text: #1f2328;           /* gcsq --color-text (was #606060) */
  --text-muted: #57606a;     /* gcsq --color-muted (was #8a8a8a) */
  --border: #d0d7de;         /* gcsq --color-border (was #d7d7d7) */
  --surface-gray: #f1f1f1;
  --ok: #1e7e34;
  --ok-bg: rgba(30, 126, 52, 0.12);
  --warn: #7a5d00;           /* gcsq --color-warn-fg */
  --warn-bg: rgba(224, 166, 60, 0.18);
  --bad: #842029;            /* gcsq --color-err-fg */
  --bad-bg: rgba(196, 85, 77, 0.14);
  --heading-font: Calibri, "Calibri Light", "Segoe UI", Arial, sans-serif;
  --body-font: Calibri, "Calibri Light", "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --nav-accent: #2b8a3e;     /* gcsq nav green accent line */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 14px;           /* gcsq body 14px (was 15px) */
  line-height: 1.5;
}

/* ---------- top nav (GC-SQ dark gradient bar) ---------- */
.site-header {
  background: linear-gradient(180deg, #0a3d62 0%, #07263d 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(7, 38, 61, 0.18);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  position: relative;
  padding: 0.65em 1.4em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--body-font);
}
/* green accent line under the nav (gcsq .gcsq-nav-accent) */
.site-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--nav-accent);
}
.brand { display: flex; align-items: center; gap: 0.7em; flex-direction: row; }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px; padding: 2px; flex: 0 0 auto;
}
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: #ffffff;
}
.brand-accent { color: #9cc4e4; }
.brand-sub {
  color: #c8d8e8;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}
.steps-nav { display: flex; gap: 0.25em; flex-wrap: wrap; }
.step-chip {
  font-size: 14px;
  font-weight: 600;
  padding: 0.5em 0.95em;
  border: none;
  border-radius: 6px;
  color: #c8d8e8;                 /* muted-on-navy hover target */
  letter-spacing: 0.01em;
  background: transparent;
  text-transform: none;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.step-chip:hover { background: rgba(255, 255, 255, 0.10); color: #ffffff; text-decoration: none; }
a.step-chip { color: #c8d8e8; }
a.step-chip:hover { color: #ffffff; text-decoration: none; }
.step-chip.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-weight: 600;
}
/* inert chips (no batch yet): keep them but dim, gcsq-style disabled */
.step-chip.inert { opacity: 0.45; cursor: not-allowed; background: transparent; }
.step-chip.inert:hover { background: transparent; color: #c8d8e8; cursor: not-allowed; }

/* ---------- layout ---------- */
.content { max-width: 1200px; margin: 0 auto; padding: 24px 32px 64px; }
.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
/* index folder-scan preview card */
.scan-preview {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  padding: 12px 16px;
}
/* index row action balance: two equal buttons side by side */
.row-actions-cell { display: flex; gap: 8px; align-items: flex-start; }
.row-actions-cell .btn { flex: 0 0 auto; min-width: 96px; text-align: center; }
.row-danger { position: relative; }
.row-danger summary.btn-danger {
  color: var(--bad);
  border-color: var(--bad-bg);
  list-style: none;
  cursor: pointer;
}
.row-danger summary.btn-danger::-webkit-details-marker { display: none; }
.row-danger summary.btn-danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.danger-confirm {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: var(--bg);
  border: 1px solid var(--bad);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 280px;
  font-size: 0.82rem;
  color: var(--text);
}
.btn-danger-confirm {
  background: var(--bad);
  border-color: var(--bad);
  color: #ffffff;
  align-self: flex-end;
}
.btn-danger-confirm:hover { background: #8a2a32; border-color: #8a2a32; color: #ffffff; }
/* folder picker (browse.html) */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-bottom: 12px; }
.crumb { color: var(--accent-deep); font-size: 0.85rem; }
.crumb:hover { color: var(--accent-dark); text-decoration: underline; }
.crumb-here { color: var(--ink); font-weight: 700; text-decoration: none; }
.crumb-sep { color: var(--text-muted); }
.scan-live { color: var(--ok); font-weight: 600; }
/* Step 2 Sequence — gcsq-style toolbar + editable class selects */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
}
.toolbar input[type="text"] {
  flex: 1 1 240px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}
.toolbar select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
  font-size: 0.9rem;
}
.seq-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pill-info { background: var(--surface-tint); color: var(--accent-dark); }
tr.seq-dirty td { background: var(--warn-bg); }
.type-select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  background: #ffffff;
  color: var(--text);
  min-width: 118px;
}
.type-select:focus { outline: none; border-color: var(--accent-dark); box-shadow: 0 0 0 2px var(--accent-glow); }
.head-meta { display: flex; gap: 12px; align-items: baseline; }
.section-heading {
  font-family: var(--heading-font);
  font-weight: 600;                 /* gcsq headings: 600, sentence case */
  color: var(--ink);
  font-size: 1.15em;
  letter-spacing: 0;
  text-transform: none;
  margin: 0 0 14px;
}
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; }
h1.section-heading { font-size: 1.7em; }   /* gcsq h1 1.7em */
.empty-note { color: var(--text-muted); font-style: italic; }
.cell-strong { color: var(--ink); font-weight: 600; }
.cell-path { font-size: 0.82rem; color: var(--text-muted); word-break: break-all; }

a { color: var(--ink); text-decoration: none; }   /* gcsq: link = heading navy */
a:hover { text-decoration: underline; }

/* ---------- flash (gcsq: soft tinted box, full border) ---------- */
.flash-stack { margin-bottom: 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  font-size: 13px;
}
.flash-ok { background: var(--ok-bg); border-color: rgba(30,126,52,.3); color: var(--ok); }
.flash-warn { background: var(--warn-bg); border-color: rgba(224,166,60,.4); color: var(--warn); }
.flash-error { background: var(--bad-bg); border-color: rgba(196,85,77,.4); color: var(--bad); }

/* ---------- tables (gcsq: soft borders, tinted sticky headers) ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  font-family: var(--body-font);    /* gcsq: same body font, not a display face */
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  font-size: 13px;
  letter-spacing: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-tint);
  position: sticky; top: 0; z-index: 2;
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e6ed;   /* gcsq --color-border-soft */
  vertical-align: top;
}
.data-table tbody tr:hover td { background: #fafbfc; }   /* gcsq tr:hover */
.row-mismatch td { background: var(--warn-bg); }

/* Table containment (Philip 2026-10-13: "check that all tables are within
   the page"): wide listing tables scroll INSIDE their panel instead of
   pushing the page wider (fixed 1308px batch table on home). Charts'
   data tables (step3 curve cards) keep their own dedicated wrappers. */
.panel { overflow-x: auto; }
.panel > .data-table { min-width: 640px; }
.panel > .data-table th { z-index: 2; }   /* sticky header inside the scroll box */
.cell-path { word-break: break-all; max-width: 420px; }  /* long source paths wrap, not shove */

/* ---------- pills ---------- */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill-solvent_blank, .pill-instrument_blank { background: var(--surface-gray); color: var(--ink); }
/* (qual-chip removed 2026-10-10 — Step 2 qualifier ions became direct-edit
   inputs (.qual-row/.qual-in); no template renders .qual-chip any more.) */
.pill-cal_std { background: var(--surface-tint); color: var(--accent-deep); }
.pill-cal_verify { background: var(--surface-tint); color: var(--accent-dark); }
.pill-lcs { background: var(--ok-bg); color: var(--ok); }
/* gcsq pill-sample is a soft green tint with dark-green text (2026-10-13
   retheme: azure-on-white sample pills read as links; navy fills too heavy
   for long sample columns) */
.pill-sample { background: var(--ok-bg); color: var(--ok); }
.pill-unknown { background: var(--bad-bg); color: var(--bad); }
.pill-mismatch { background: var(--bad-bg); color: var(--bad); }
.pill-okname { background: var(--ok-bg); color: var(--ok); font-weight: 400; }
.pill-status-ok { background: var(--ok-bg); color: var(--ok); }
.pill-status-unreadable, .pill-status-no_data_ms, .pill-status-download_incomplete {
  background: var(--bad-bg);
  color: var(--bad);
}
.pill-status-unknown { background: var(--surface-gray); color: var(--text); }

/* Step 2 stored-curve-fit pills (thresholds mirror vocview.qc: r2 >= 0.99
   ok, 0..0.99 poor/warn, negative (or none) failed). */
.pill-fit-ok { background: var(--ok-bg); color: var(--ok); }
.pill-fit-poor { background: var(--warn-bg); color: var(--warn); }
.pill-fit-failed { background: var(--bad-bg); color: var(--bad); }

/* Step 2 direct-edit targets table (user request 2026-10-10): the table IS
   the editor — inputs/selects sit in the cells; dirty rows highlight and
   enable the batched "Save changes" button. */
.num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tgt-in {
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 4px;
  background: transparent;
  font-family: var(--body-font);
  font-size: 0.8rem;
  color: var(--ink);
  width: 100%;
  min-width: 52px;
}
.tgt-in:hover { border-color: var(--border); }
.tgt-in:focus {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: var(--bg);
}
.tgt-sel {
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 2px;
  background: transparent;
  font-family: var(--body-font);
  font-size: 0.74rem;
  color: var(--ink);
}
.tgt-sel:hover { border-color: var(--border); }
.tgt-sel:focus {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.qual-row { display: flex; align-items: center; gap: 4px; margin: 1px 0; }
.qual-row .qual-in { min-width: 60px; }
.qual-row .qual-range {
  color: var(--text-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}
.tgt-dirty > .tgt-in, .tgt-dirty > .tgt-sel { border-color: var(--warn); }
tr.tgt-dirty { background: var(--warn-bg); }
#tgt-save[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- forms ---------- */
.stack-form .form-row { margin-bottom: 14px; display: flex; flex-direction: column; }
.stack-form label,
.inline-form label {
  font-family: var(--heading-font);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}
.label-note { color: var(--text); font-weight: 400; text-transform: none; letter-spacing: 0; }
.stack-form input[type="text"],
.inline-form input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  font-family: var(--body-font);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--bg);
  width: 100%;
  max-width: 640px;
}
.stack-form input[type="text"]:focus,
.inline-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.form-actions { margin-top: 16px; }
.row-actions { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input[type="text"] { max-width: 320px; }

/* ---------- buttons (gcsq: bordered white, navy primary) ---------- */
.btn {
  display: inline-block;
  border-radius: 4px;
  padding: 6px 12px;
  font-family: var(--body-font);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-decoration: none;
}
.btn:hover { background: #f3f5f8; text-decoration: none; color: var(--text); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #ffffff; border-color: var(--ink); font-weight: 600; }
.btn-primary:hover { background: var(--hover-ink); border-color: var(--hover-ink); text-decoration: none; color: #ffffff; }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #f3f5f8;
  color: var(--text);
  text-decoration: none;
}

/* ---------- Step 3 calibration cards ---------- */
.cal-refitall-form { margin: 0 0 16px; }
/* ---------- gcsq curve cards (wizard_calibration_v2 parity) ---------- */
.curve-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 1em; }
.curve-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px; display: block;
  box-shadow: 0 1px 3px rgba(31,35,40,0.04); }
.curve-card-header { display: flex; gap: 12px; align-items: baseline;
  margin-bottom: 10px; flex-wrap: wrap; }
.curve-title { font-size: 1em; font-weight: 700; color: var(--ink); }
.curve-units { font-size: 0.9em; color: var(--text); }
.curve-rsq { font-size: 0.9em; font-weight: 700; font-family: var(--mono);
  font-variant-numeric: tabular-nums; }
.curve-rsq.good { color: #155724; }
.curve-rsq.mid  { color: #856404; }
.curve-rsq.bad  { color: #721c24; }
/* ion-ratio spec pill (2026-10-11): green = within method range,
   red = out of spec, amber = analyst override active */
.ion-ratio-pill { font-size: 0.82em; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; cursor: pointer; user-select: none;
  font-family: inherit; white-space: nowrap; }
.ion-ratio-pill.ok { color: #155724; background: #d4edda;
  border: 1px solid #c3e6cb; }
.ion-ratio-pill.out { color: #721c24; background: #f8d7da;
  border: 1px solid #f5c6cb; }
.ion-ratio-pill.overridden { color: #856404; background: #fff3cd;
  border: 1px solid #ffeeba; }
.curve-lod { font-size: 0.9em; font-weight: 700; font-family: var(--mono);
  color: #0969da; font-variant-numeric: tabular-nums; }
.curve-equation { font-size: 0.9em; color: var(--text); margin-left: auto;
  font-family: var(--mono); }
.curve-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }
.curve-chart-wrap, .xic-viewer {
  flex: 1 1 45%; min-width: 320px;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; background: var(--surface);
  min-height: 260px; display: flex; flex-direction: column;
}
.chart-title, .xic-title {
  font-size: 0.9em; font-weight: 600; color: var(--text);
  margin: 0 0 6px 0; height: 32px; flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  overflow: hidden; font-family: var(--body-font);
}
.xic-title .xic-name { color: var(--text); font-weight: 400; }
.curve-svg-mini { width: 100%; height: 260px; flex: 0 0 auto; display: block; }
/* one 32px top row on BOTH sides (chart-title / xic-levels+legend) so the
   two plot areas share a y-origin; both svg hosts are 260px tall */
.xic-levels { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: nowrap;
  min-height: 32px; height: 32px; align-items: center; overflow: hidden;
  justify-content: flex-start; }
.xic-levels .xic-levels-legend { margin-left: auto; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-size: 0.85em; }
.xic-svg-host { position: relative; }
.xic-levels button { font-size: 0.9em; padding: 3px 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); border-radius: 12px;
  cursor: pointer; font-family: var(--body-font); }
.xic-levels button.active { background: var(--accent); color: #fff;
  border-color: var(--accent); font-weight: 600; }
.xic-card { min-height: 260px; display: flex; flex-direction: column; }
.xic-card .xic-title { height: 20px; min-height: 20px; margin-bottom: 0; }
.xic-card .xic-svg-host { flex: 0 0 auto; height: 260px; }
.xic-loading { color: var(--text); padding: 8px; font-size: 0.9em; }

/* shared compact data tables below charts (gcsq .data-table) */
.data-table { width: 100%; font-size: 13px !important;
  border-collapse: collapse; font-family: var(--mono) !important;
  table-layout: auto; }
.data-table th, .data-table td { padding: 4px 6px; white-space: nowrap;
  border: 1px solid #d0d7de; text-align: left; font-size: 13px !important;
  font-family: var(--mono) !important; }
.data-table tbody tr:hover td { background: #eef4f9; }
.data-table tfoot td { border-top: 2px solid #bbb; background: #f8f9fa; }
.data-table th { background: #f0f4f8; font-weight: 600; }
.data-table tr:nth-child(even) td { background: #fafbfc; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table td.quant-area { color: #0969da; }
.data-table td.qual-area { color: var(--text); }
.data-table td.excluded { color: #d32f2f; text-decoration: line-through; }
.data-table .ci-label { color: var(--text); font-weight: 600; }

.response-table-wrap, .xic-detail-wrap { margin-top: 6px;
  border-top: 1px solid var(--border); padding-top: 4px; width: 100%; }
/* Wide numeric columns (Q areas ~3.1e7 with grouping) legitimately exceed a
   504px panel — keep the xic table scrollable instead of clipped, and
   shrink grouping so it fits whenever the digits allow. */
.xic-detail-wrap { overflow-x: auto; }
.xic-detail-wrap .xic-level-table { min-width: fit-content; }
.response-table th:nth-child(1), .response-table td:nth-child(1) {
  text-align: left; width: 15%; }
.response-table th:nth-child(n+2), .response-table td:nth-child(n+2) {
  text-align: right; }
/* Card tables fit the panel width and share identical outer edges so the
   response table (under the curve) and the per-level table (under the XIC)
   align: headers wrap instead of pushing columns past the panel (nowrap +
   table-layout:auto wanted 703px in a 504px panel → clipped columns). */
.response-table, .xic-level-table { width: 100%; table-layout: auto;
  font-size: 13px !important; font-family: var(--mono) !important; }
.response-table th, .response-table td,
.xic-level-table th, .xic-level-table td {
  white-space: normal; line-height: 1.2; overflow: visible;
  text-overflow: clip; font-size: 12.5px !important;
  font-family: var(--mono) !important; padding: 3px 4px; }
.response-table th, .xic-level-table th { padding-top: 5px; padding-bottom: 5px; }
.xic-level-table th:nth-child(1), .xic-level-table td:nth-child(1) {
  text-align: left; }
.xic-level-table th:nth-child(n+2), .xic-level-table td:nth-child(n+2) {
  text-align: right; }

.state-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.state-dot.used { background: #1565c0; }
.state-dot.excluded { background: #d32f2f; }

.curve-summary { margin-top: 10px; padding: 8px 10px; background: #f6f8fa;
  border-radius: 6px; font-size: 13px; color: var(--text); display: flex;
  gap: 16px; flex-wrap: wrap; }
.cal-refit fieldset.cal-levels { border: 1px solid var(--border); border-radius: 3px; padding: 6px 8px; margin: 0 0 8px; }
.cal-refit legend {
  font-family: var(--heading-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0 4px;
}
.cal-refit label.lv-off { color: var(--text); opacity: 0.65; }
.cal-refit select {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 6px;
  font-family: var(--body-font);
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--bg);
  width: 100%;
}
.cal-refit select:focus {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ---------- misc ---------- */
.mismatch-banner {
  background: var(--surface-tint);
  border-left: 4px solid var(--accent);
  color: var(--ink);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.86rem;
}
.mismatch-banner code { font-size: 0.82rem; }
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  padding: 14px 32px;
  text-align: center;
  letter-spacing: 0.04em;
}
/* ---- Step 4: sample results (tcard grid, EIC svgs, flag pills) ---- */
.tcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.tcard {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  padding: 10px 12px;
}
.tcard-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.tcard-stats { margin: 8px 0 6px; }
.tcard-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 12.5px;
}
.tcard-form { display: flex; gap: 6px; align-items: center; }
.eic-svg { width: 100%; height: auto; display: block; }
.eic-svg .svg-base { fill: var(--surface-tint); }
.eic-svg .svg-axis { stroke: var(--hairline); stroke-width: 1; }
.eic-svg .eic-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
}
.eic-svg .eic-marker {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}
.eic-svg .svg-label {
  font-size: 9px;
  fill: var(--text-muted);
}
.eic-svg .svg-label-center { text-anchor: middle; }
.eic-svg-empty .eic-line { stroke: none; }
.eic-absent {
  height: 80px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}
.pill-flag-ok { background: var(--ok-bg); color: var(--ok); }
.pill-flag-not_found { background: var(--surface-gray); color: var(--text); }
.pill-flag-below_lod { background: var(--accent-tint); color: var(--accent-dark); }
.pill-flag-above_range { background: var(--warn-bg); color: var(--warn); }
.pill-flag-qual_fail, .pill-flag-rt_fail, .pill-flag-no_curve {
  background: var(--bad-bg); color: var(--bad);
}
.pill-status-idle { background: var(--surface-gray); color: var(--text); }
.pill-status-running { background: var(--accent-tint); color: var(--accent-dark); }
.pill-status-done { background: var(--ok-bg); color: var(--ok); }
.pill-status-error { background: var(--bad-bg); color: var(--bad); }
.input-compact, .btn-compact {
  font-size: 12px;
  padding: 2px 6px;
}
.input-compact { width: auto; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); font-family: inherit; }
.file-row td { padding: 6px 8px; }
.results-table td { padding: 6px 8px; }

/* Step 4: per-file failure list under the analyze button */
.step4-failures { margin-top: 8px; }
.step4-failures-empty { display: none; }
.step4-failure {
  font-size: 12px;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid var(--bad);
  border-radius: 3px;
  padding: 2px 8px;
  margin-bottom: 4px;
}


/* ---- step 3: calibration build job ---- */
.cal-build-bar { display: flex; align-items: center; gap: 12px; margin: 10px 0 18px; }
.cal-build-status { font-size: 13px; color: var(--fg-soft, #555); }
.cal-build-status[data-state="running"]::after { content: "…"; }

/* ---- auto-optimise grid + progress + top-5 (gcsq calibration-v2 port) -- */
.cal-opt-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 2px; }
.cal-grid-label { font-size: 13px; color: var(--ink); }
.cal-baseline-opt {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: 13px; color: var(--text);
}
.cal-baseline-opt input { width: 15px; height: 15px; }
.cal-grid-pattern {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; font-size: 13px;
}
.cal-grid-pattern label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cal-grid-pattern input {
  width: 58px; font-size: 13px; padding: 3px 5px;
  border: 1px solid var(--border); border-radius: 3px;
  font-family: inherit; color: var(--text);
}
#grid-size-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.cal-progress-area { margin: 8px 0 14px 0; }
.cal-progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cal-progress-pct {
  font-size: 16px; font-weight: 700; color: var(--accent-dark);
  min-width: 48px; text-align: right; font-family: var(--mono);
}
.cal-progress-track {
  flex: 1; height: 12px; background: var(--surface-gray);
  border-radius: 6px; overflow: hidden;
}
.cal-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--ink), var(--accent));
  border-radius: 6px; transition: width 0.3s ease;
}
.cal-progress-message { font-size: 12px; color: var(--text-muted); }

.xic-level-table td.q-rejected {
  color: var(--text-muted); text-decoration: line-through;
}
.q-rejected-note { font-size: 11px; color: var(--text-muted); }

/* undetected in-batch levels (user rule 2026-10-12): the analyst decides
 * whether the peak is there — red Not-detected state, click-to-place */
.state-dot.not-detected { background: #d32f2f; }
tr.not-detected td { color: #8a8f98; }
.nd-flag { color: #d32f2f; font-weight: 600; font-size: 10px; }
button.not-detected { border-color: #d32f2f; }
.state-dot.best-guess { background: #f59e0b; }
tr.best-guess td { color: #8a8f98; }
.bg-flag { font-size: 10px; font-weight: 600; color: #b45309;
  background: #fef3c7; border-radius: 3px; padding: 0 4px;
  margin-left: 4px; }
button.best-guess { border-color: #f59e0b; }
.xic-nd-hint { font-size: 11px; color: var(--text-muted); padding: 2px 0 6px; }

/* expected-RT pill (apex-drag persistence, 2026-10-12) */
.rt-pill {
  font-size: 0.9em; font-weight: 700; font-family: var(--mono);
  color: var(--text-muted); white-space: nowrap;
}
.rt-pill.moved {
  color: var(--warn); cursor: pointer;
  border-bottom: 1px dotted var(--warn);
}
.rt-pill.moved:hover { background: var(--warn-bg); }

.cal-top5-area { margin: 10px 0 18px 0; }
.cal-top5-title { font-weight: 600; margin-bottom: 5px; color: var(--ink); font-size: 14px; }
.cal-top5-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.cal-top5-table th, .cal-top5-table td {
  border: 1px solid var(--border); padding: 3px 6px; text-align: left;
}
.cal-top5-table th {
  background: var(--surface); color: var(--ink);
  font-family: var(--heading-font); font-weight: 600;
}
.cal-top5-table td.num, .cal-top5-table th.num {
  font-family: var(--mono); text-align: right; white-space: nowrap;
}
.cal-top5-table .btn { padding: 2px 10px; font-size: 12px; }
.cal-build-summary { font-size: 13px; color: var(--fg-soft, #555); }
.cal-build-table .num-cell { text-align: right; }

/* ---- step 3: TIC / mass spectrum + card-embedded XICs (gcsq port) ---- */
/* TIC + mass-spectrum viewer (gcsq batch-tic anatomy) */
.cal-tic-card { border: 1px solid var(--border, #d0d7de); border-radius: 8px;
  padding: 14px; margin: 12px 0 18px; background: #fff;
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.04); }
.cal-tic-header { display: flex; gap: 12px; align-items: center;
  margin-bottom: 10px; flex-wrap: wrap; }
.cal-tic-title { font-size: 1em; font-weight: 600; color: var(--ink); }
.cal-tic-hint { font-size: 0.85em; }
.cal-tic-levels { display: flex; gap: 4px; flex-wrap: nowrap;
  min-height: 28px; height: 28px; align-items: center; overflow: hidden; }
.cal-tic-levels button { font-size: 0.9em; padding: 3px 8px;
  border: 1px solid var(--border, #d0d7de); background: #fff;
  border-radius: 12px; cursor: pointer; font-family: inherit; }
.cal-tic-levels button.active { background: #2ea44f; color: #fff;
  border-color: #2ea44f; font-weight: 600; }
.cal-tic-body { display: flex; gap: 18px; flex-wrap: wrap; align-items: stretch; }
.cal-tic-chart-wrap, .cal-ms-chart-wrap { flex: 1 1 45%; min-width: 320px;
  border: 1px solid var(--border, #d0d7de); border-radius: 6px;
  padding: 8px 8px 14px 8px; background: #fff; min-height: 260px;
  display: flex; flex-direction: column; }
.cal-tic-chart-wrap { position: relative; }
.chart-title, .xic-title { font-size: 0.9em; font-weight: 600;
  color: #57606a; margin: 0 0 6px 0; height: 32px; flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  overflow: hidden; font-family: inherit; }
.chart-title-text { flex: 1 1 auto; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cal-reset-zoom { font-size: 0.85em; color: #0969da; text-decoration: none;
  margin-left: 8px; flex: 0 0 auto; white-space: nowrap; }
.cal-reset-zoom:hover { text-decoration: underline; }
.cal-reset-zoom[hidden] { display: none; }
.cal-tic-chart-wrap .tic-svg-host, .cal-ms-chart-wrap .ms-svg-host {
  flex: 0 0 auto; height: 260px; position: relative; }
.ms-zoom-marquee { position: absolute; top: 14px; height: 212px;
  background: rgba(9, 105, 218, 0.15); border: 1px dashed #0969da;
  pointer-events: none; display: none; z-index: 10; }
.cal-tic-tooltip { position: absolute; z-index: 20; background: #fff;
  border: 1px solid var(--border, #d0d7de); border-radius: 4px;
  padding: 2px 6px; font-size: 0.75em; color: #24292f;
  pointer-events: none; white-space: nowrap; font-family: var(--mono, monospace); }
@media (max-width: 1100px) { .cal-tic-body { flex-direction: column; } }
/* per-card XIC viewer */

.cal-level-excluded { opacity: 0.55; }
@media (max-width: 1100px) { .cal-tic-body { grid-template-columns: 1fr; } }

/* boundary-drag guard toast (cards) */
.curve-card-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: #24292f;
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 40;
}
