/* SO-Check research mock · static stylesheet (no build step). Operate UI; amber is caution-only. */

:root {
  --page: #FAFAF8;
  --card: #fff;
  --ink: #1A1A2E;
  --secondary: #52514E;
  --muted: #65656d;
  --line: rgba(26, 26, 46, .10);
  --line-strong: rgba(26, 26, 46, .22);
  --control-line: #B4B4BA; /* softer control boundary, ~2:1 on --card (below WCAG 1.4.11 3:1; labels/placeholders identify fields, hover darkens) */
  --grid: rgba(26, 26, 46, .06);
  --hover: rgba(26, 26, 46, .045);
  --fill: #D9D9D5; /* light gray for former black components */
  --fill-hover: #CBCBC6;
  --amber: #E0A12E;
  --amber-ink: #634713;
  --amber-tint: #FCF4E1;
  --amber-line: #EBD6A4;
  --r-ctl: 4px;
  --r-card: 6px;
  --r-chip: 6px;
  --r-pill: 6px; /* was full pill; keep soft rect for clinical Operate UI */
  --shadow-sheet: 0 -8px 28px rgba(26, 26, 46, .14);
  --shadow-pop: 0 10px 28px -10px rgba(26, 26, 46, .28), 0 1px 2px rgba(26, 26, 46, .06);
  --font: "IBM Plex Sans", "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  accent-color: var(--ink);
  caret-color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
::selection { background: rgba(26, 26, 46, .16); color: var(--ink); }
#people-list, .table-scroll, #analyte-chips, .suggestions, .roster.sheet-open {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* Controls */
button, input, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button {
  border: 1px solid var(--control-line);
  background: var(--card);
  border-radius: var(--r-ctl);
  padding: 8px 12px;
  min-height: 44px;
}
button:hover { background-color: #f0f0ee; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select {
  border: 1px solid var(--control-line);
  border-radius: var(--r-ctl);
  background: var(--card);
  padding: 8px 11px;
  min-width: 0;
  min-height: 44px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75 6 6.25 10.5 1.75' stroke='%2352514E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
  padding-right: 30px;
  cursor: pointer;
  line-height: 1.3;
}
select:disabled {
  opacity: .45;
  cursor: not-allowed;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75 6 6.25 10.5 1.75' stroke='%23aaaab1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
input:hover, select:hover:not(:disabled) { border-color: var(--secondary); }
input:focus-visible, select:focus-visible, button:focus-visible, .wordmark:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
input::placeholder { color: var(--muted); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 12px; color: var(--secondary); line-height: 1.2; }
.field-inline { display: inline-flex; flex-direction: row; align-items: center; }
.field-inline select { min-width: 7.5rem; }
.sort-field { margin: 0 16px 14px; }
.sort-field select { width: 100%; font-size: 13px; }
.menu-toggle {
  border: 1px solid var(--control-line);
  background: var(--card);
  border-radius: var(--r-ctl);
  padding: 8px 30px 8px 11px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75 6 6.25 10.5 1.75' stroke='%2352514E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}
.menu-toggle:hover { background-color: #f0f0ee; }
.menu-toggle[aria-expanded="true"] { background-color: var(--hover); border-color: var(--secondary); }
.text-button {
  border: 0;
  background: transparent;
  padding: 4px 0;
  min-height: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.text-button:hover { background: transparent; text-decoration: underline; }
/* Desktop: 44px hit area on standalone text buttons; negative margins keep layout and text position unchanged. */
@media (min-width: 768px) {
  .text-button { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 8px; margin: -9px -8px; }
}

/* Type */
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 14px; font-weight: 600; }
.helper { font-size: 12px; color: var(--secondary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  background: var(--fill);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r-ctl);
  transform: translateY(-200%); /* hidden until focused; no transition */
}
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--card); }
#main:focus { outline: none; } /* programmatic skip-link target only */

/* Caution bar */
.caution {
  background: var(--amber-tint);
  color: var(--amber-ink);
  border-bottom: 1px solid var(--amber-line);
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  flex-wrap: wrap;
  font-size: 12px;
}
.caution strong { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.caution svg { width: 14px; height: 14px; flex-shrink: 0; }
.caution .text-button { display: inline-block; color: inherit; font-size: 12px; text-decoration: underline; min-height: 0; padding: 14px 8px; margin: -14px -8px; } /* inline link: 44px hit area, layout unchanged */

/* Masthead */
.page { max-width: 1600px; margin: auto; padding: 0 32px; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 26px 0; }
.brand { display: flex; align-items: baseline; gap: 0; }
.wordmark {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--r-ctl);
  line-height: 1.2;
  padding: 10px 0;
  margin: -10px 0; /* 44px hit area, layout unchanged */
}
.wordmark:hover { text-decoration: underline; text-underline-offset: 3px; }
.product-sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--secondary);
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
}
.preview, .badge {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
  padding: 4px 8px;
  white-space: nowrap;
  color: var(--secondary);
}
.badge { margin-left: 8px; padding: 1px 5px; vertical-align: 2px; }

.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Ask */
.ask-section { border-block: 1px solid var(--line); padding: 20px 0 24px; }
.ask-section h2 { font-size: 14px; }
#ask-form { display: flex; gap: 8px; margin: 12px 0 8px; }
#question { flex: 1; height: 44px; background: var(--card); }
.primary { background: var(--fill); color: var(--ink); border-color: var(--control-line); min-width: 96px; font-weight: 500; }
.primary:hover { background: var(--fill-hover); }
.suggestions { display: flex; gap: 8px; margin-top: 12px; }
.suggestions button {
  font-size: 12px;
  color: var(--secondary);
  background: transparent;
  border-color: var(--control-line);
  border-radius: var(--r-chip);
  padding: 6px 12px;
  white-space: nowrap;
}
.suggestions button:hover { color: var(--ink); background: var(--hover); }

/* Workspace */
.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; margin-top: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; }

/* Roster */
.roster { align-self: start; position: sticky; top: 16px; padding: 16px 0 0; overflow: hidden; }
/* roster field margins set with .roster > .filters / .sort-field */
.roster > input { width: calc(100% - 32px); margin: 0 16px 12px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters select, .relation-selects select { display: block; width: 100%; font-size: 13px; }
.roster > .filters, .roster > .sort-field { margin: 0 16px 14px; }
.roster > .section-heading { margin: 0 16px 14px; }
.roster-caption {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  border-block: 1px solid var(--line);
  background: #f6f6f4;
  color: var(--secondary);
  font-size: 11px;
}
#people-list { max-height: 570px; overflow: auto; }
.person { display: flex; gap: 10px; min-height: 44px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.person:hover { background: var(--hover); }
.person.selected { background: var(--hover); }
.person input { align-self: flex-start; margin: 1px 0; width: 20px; height: 20px; min-height: 0; padding: 0; }
.person-info { flex: 1; min-width: 0; }
.person-name { display: flex; justify-content: space-between; font-weight: 600; }
.person-token { display: block; font-size: 12px; margin: 2px 0; color: var(--secondary); }
.person-dates { font-size: 11px; color: var(--secondary); white-space: nowrap; }
.visit-count { font-weight: 400; margin-left: 8px; color: var(--secondary); }
.roster-footer { padding: 14px 16px 16px; font-size: 12px; color: var(--secondary); }
.roster-footer p { margin-top: 8px; }

/* Scope */
.scope { padding: 0 0 18px; }
.scope h2 { font-size: 18px; }
.scope p { color: var(--secondary); font-size: 13px; margin-top: 4px; }
#scope-extra { font-size: 12px; display: flex; gap: 14px; margin-top: 6px; }
#scope-extra:empty { display: none; }
#scope-extra .text-button { display: inline-block; min-height: 0; padding: 13px 8px; margin: -13px -8px; } /* inline Undo / Reset zoom: 44px hit area, layout unchanged */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; font-size: 12px; }
.legend:empty { display: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--series); flex-shrink: 0; }
.legend .dot { margin-right: 6px; }

/* Analyte chips */
.analyte-controls { border-block: 1px solid var(--line); padding: 14px 0; }
.analyte-controls, #analyte-chips, .chip-group, .secondary-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip-group { gap: 6px; }
.group-label { font-size: 12px; color: var(--secondary); margin-right: 2px; }
.chip { border-radius: var(--r-chip); font-size: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
.chip:hover:not(:disabled) { background-color: var(--card); border-color: var(--secondary); } /* hover never looks selected */
.chip[aria-pressed=true] { background: var(--fill); color: var(--ink); border-color: var(--secondary); font-weight: 500; }
.chip[aria-pressed=true]::before { content: "\2713" / ""; font-size: 12px; line-height: 1; } /* non-colour cue; aria-pressed carries the state */
.chip[aria-pressed=true]:hover { background-color: var(--fill-hover); }
.chip[aria-disabled=true] { cursor: not-allowed; opacity: .75; }
.secondary-controls { margin-left: auto; font-size: 12px; gap: 8px; }
.secondary-controls .field-inline select { font-size: 13px; min-height: 44px; }

/* Panels */
.chart-caption { display: flex; justify-content: space-between; gap: 12px; color: var(--secondary); font-size: 11px; margin: 18px 0 10px; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { height: 238px; padding: 14px 16px 8px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-heading h3 { display: flex; align-items: center; gap: 8px; }
.panel-heading span.helper { font-size: 11px; }
.panel svg { width: 100%; height: 187px; overflow: visible; touch-action: pan-y; }
.chart-text { fill: var(--secondary); font-family: var(--font); font-size: 10px; }
.chart-grid { stroke: var(--grid); }
.zero { stroke: var(--control-line); }
.data-dot { cursor: pointer; fill-opacity: .7; stroke: #fff; stroke-width: 2; }
.data-dot:hover, .data-dot:focus { fill-opacity: 1; stroke: var(--ink); outline: none; }
.data-dot:focus-visible { stroke-width: 3; }
.series-line { fill: none; stroke-width: 2; }
.median { stroke: var(--secondary); stroke-width: 1; stroke-dasharray: 4 4; }
#median-note { margin: 12px 0 20px; font-size: 11px; }

/* Companion table */
.companion { margin-top: 18px; }
.companion summary, .quarantine summary { font-size: 13px; font-weight: 600; padding: 13px 0; margin: -13px 0; } /* 44px hit area, layout unchanged */
.companion summary span { font-weight: 400; color: var(--secondary); margin-left: 8px; }
.table-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--secondary); padding: 14px 0; }
.table-scroll { max-height: 390px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; text-align: left; }
th { position: sticky; top: 0; background: #f6f6f4; font-weight: 500; color: var(--secondary); font-size: 11px; }
th, td { height: 36px; border-bottom: 1px solid var(--line); padding: 7px 10px; }
td.numeric, th.numeric { text-align: right; }
.relate-row { display: flex; justify-content: space-between; margin: 18px 0 24px; }

/* Quarantine: amber as a surface tint, not a border costume */
.quarantine { background: var(--amber-tint); border-color: var(--amber-line); }
.quarantine summary { color: var(--amber-ink); }
.quarantine p { font-size: 12px; color: var(--amber-ink); margin: 14px 0; }
.quarantine th { background: #f6ecd2; }
.quarantine th, .quarantine td { border-bottom-color: var(--amber-line); }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--secondary);
}

/* Ask result */
.result { margin-top: 24px; }
.ask-error { margin-top: 8px; font-size: 13px; color: var(--amber-ink); }
.answer-lead { font-size: 15px; margin: 4px 0 2px; }
.result h2 { margin-bottom: 10px; }
.query {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f5f5f3;
  padding: 10px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.notice {
  background: var(--amber-tint);
  border: 1px solid var(--amber-line);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 12px;
  color: var(--amber-ink);
}
.result > .text-button { margin-top: 12px; }
@media (min-width: 768px) { .result > .text-button { margin-top: 3px; } } /* offsets the desktop hit-area margin */
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 16px; margin: 16px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; }
.bar-track { height: 5px; background: #ebebe9; margin-top: 7px; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ink); }

/* Overlays */
.mobile-only { display: none; }
dialog {
  width: min(760px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px;
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgba(26, 26, 46, .32); }
.relation-selects { display: flex; gap: 16px; margin: 20px 0; }
.relation-selects .field { flex: 1; }
#scatter svg { width: 100%; height: auto; }
.tooltip {
  position: fixed;
  z-index: 10;
  max-width: 290px;
  pointer-events: none;
  background: var(--fill);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  font-size: 12px;
  white-space: pre-line;
  box-shadow: 0 6px 18px -6px rgba(26, 26, 46, .4);
}
.empty { padding: 30px; color: var(--secondary); }

@media (max-width: 1279px) {
  .panels { grid-template-columns: 1fr; }
  .page { padding: 0 24px; }
  .workspace { gap: 20px; }
  .panel { height: 240px; }
}

@media (max-width: 767px) {
  .page { padding: 0 16px; }
  .caution { padding: 10px 16px; font-size: 11px; }
  .masthead { padding: 18px 0; align-items: flex-start; flex-direction: column; gap: 10px; }
  .product-sub { font-size: 12px; margin-left: 10px; padding-left: 10px; }
  .wordmark { font-size: 18px; }
  .workspace { display: block; }
  .mobile-only { display: inline-block; }
  .roster { display: none; }
  .roster.sheet-open {
    display: block;
    position: fixed;
    z-index: 8;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    max-height: 85dvh;
    overflow: auto;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -60px 0 100vh rgba(26, 26, 46, .32), var(--shadow-sheet);
  }
  .roster.sheet-open #people-list { max-height: 42dvh; }
  .person-dates { font-size: 12px; }
  .person { min-height: 70px; }
  #ask-form { flex-direction: column; }
  .primary { height: 44px; }
  .suggestions { overflow-x: auto; padding: 4px 0; }
  .suggestions button { min-height: 44px; }
  .analyte-controls { display: block; }
  #analyte-chips { flex-wrap: nowrap; overflow: auto; padding-bottom: 6px; }
  .chip-group { flex-wrap: nowrap; }
  .chip { white-space: nowrap; min-height: 44px; }
  .secondary-controls { justify-content: flex-end; margin-top: 6px; }
  .scope .section-heading { flex-wrap: wrap; }
  .scope h2 { font-size: 16px; }
  #scope-pill { border-radius: var(--r-ctl); }
  .panel { height: 218px; padding: 12px; }
  .panel svg { height: 168px; }
  .chart-caption { font-size: 10px; }
  .relate-row { align-items: center; gap: 12px; }
  .relate-row .helper { font-size: 10px; }
  .text-button { min-height: 44px; }
  .panel-heading span.helper { font-size: 10px; }
  .table-scroll { max-height: 360px; }
  .query { font-size: 11px; }
  footer { align-items: flex-start; gap: 12px; }
  .preview { font-size: 10px; }
  .bars { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .caution { position: static; print-color-adjust: exact; }
  .page { padding: 0; }
  .skip-link, .ask-section, .analyte-controls, .suggestions, .relate-row, button, .filters, .sort-field, .roster input, .roster-caption, .roster-footer, dialog { display: none !important; }
  .workspace { display: block; }
  .roster { position: static; border: 0; margin-bottom: 16px; padding: 0; }
  #people-list { max-height: none; display: flex; flex-wrap: wrap; }
  .person { display: none; }
  .person.selected { display: block; padding: 5px; border: 0; }
  .roster > .section-heading { margin: 0; }
  .panels { grid-template-columns: 1fr; }
  .panel { break-inside: avoid; print-color-adjust: exact; }
  .table-scroll { max-height: none; overflow: visible; }
  .card { break-inside: avoid; }
  .companion, .quarantine { break-inside: auto; }
  .chart-grid { stroke: #ddd; }
  .data-dot { fill-opacity: 1; }
  footer { display: block; }
}
