/* FL Menu Intel — data-entry first styling.
   Dense enough to see a lot at once, calm enough to stare at for an hour. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #dfe3e8;
  --text: #16191d;
  --muted: #667085;
  --faint: #6b7280;   /* was #98a2b3 (2.6:1 on white). 4.8:1 now — small grey text has to pass. */
  --accent: #1f7a5a;
  --accent-soft: #e6f2ee;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Chart series. Validated against the chart surface for colour-vision
     separation (normal-vision ΔE 20.5, worst CVD ΔE 15.3) — the list price is
     a de-emphasis gray by intent, dashed as secondary encoding. */
  --series-sale: #00875a;
  --series-list: #98a2b3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --surface-2: #23282e;
    --line: #2f353c;
    --text: #e6e8ea;
    --muted: #98a2b3;
    --faint: #8b95a3;   /* was #6b7480 (3.5:1 on the dark surface). 5.4:1 now. */
    --accent: #3ca882;
    --accent-soft: #14312a;
    --warn: #f0a44a;
    --warn-soft: #33261360;
    --danger: #f97066;
    --danger-soft: #3a1e1c;
    /* Re-stepped for the dark surface, not flipped: ΔE 15.6 normal, 11.3 CVD. */
    --series-sale: #3ca882;
    --series-list: #6b7480;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── top bar ───────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  letter-spacing: .5px;
}
.brand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }

.statstrip { display: flex; gap: 22px; flex-wrap: wrap; }
.statstrip .stat { text-align: right; }
.statstrip .n {
  display: block; font-family: var(--mono); font-size: 18px;
  font-weight: 600; line-height: 1.1;
}
.statstrip .k {
  display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--faint);
}

/* ── tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 20px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  /* Adding a fourth tab pushed the export link past the right edge on a phone,
     widening the whole page. Scrolling the bar within itself keeps the tabs on
     one line without the document ever overflowing. */
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab, .exportlink { flex: 0 0 auto; white-space: nowrap; }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 11px 15px; font-size: 13px; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabspacer { flex: 1; }
.exportlink {
  font-size: 12px; color: var(--muted); text-decoration: none;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px;
}
.exportlink:hover { color: var(--text); border-color: var(--muted); }

.panel { display: none; padding: 18px 20px 60px; }
.panel.active { display: block; }

/* ── sticky context bar ────────────────────────────────── */
.contextbar {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px;
}
.ctxfield { display: flex; flex-direction: column; gap: 4px; }
.ctxfield.grow { flex: 1; min-width: 240px; }
/* Two stores can share a city and differ only by street, so the select needs
   room for the address rather than truncating it mid-name. */
.storepick select { min-width: 250px; }
.storepick input[type="search"] { max-width: 150px; }
.ctxfield label { font-size: 11px; font-weight: 600; color: var(--muted); }
.inline { display: flex; gap: 5px; }

/* ── form ──────────────────────────────────────────────── */
.entrylayout {
  display: grid; grid-template-columns: minmax(0,1fr) 320px;
  gap: 18px; align-items: start;
}
@media (max-width: 960px) { .entrylayout { grid-template-columns: 1fr; } }

.entryform fieldset {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px;
}
.entryform legend {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); padding: 0 6px;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 600; color: var(--muted); }
.hint { font-weight: 400; color: var(--faint); text-transform: none; letter-spacing: 0; }
.req { color: var(--danger); }

input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
  min-width: 0; width: 100%;
}
input:focus, select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px; border-color: var(--accent);
}
input::placeholder { color: var(--faint); }
#f-price, #f-thca, #f-thc, #f-cbd, #f-thcmg, #f-totalterpenes,
#f-priceoriginal, #f-quantity { font-family: var(--mono); }

.formactions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
button {
  font: inherit; font-weight: 550; cursor: pointer;
  border-radius: 6px; padding: 8px 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { color: var(--muted); }
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.small { padding: 4px 10px; font-size: 12px; }
.reportlink { margin: 4px 0 0; }
.kbd-hint { font-size: 12px; color: var(--faint); }
kbd {
  font-family: var(--mono); font-size: 11px; background: var(--surface-2);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px;
}

/* ── live readout ──────────────────────────────────────── */
.readout {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; position: sticky; top: 14px;
}
.readout h2 {
  margin: 0 0 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.readout .empty { color: var(--faint); font-size: 13px; margin: 0; }
.ro-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.ro-row:last-child { border-bottom: 0; }
.ro-row .k { color: var(--muted); }
.ro-row .v { font-family: var(--mono); font-weight: 600; text-align: right; }
.ro-big {
  background: var(--accent-soft); border-radius: 6px;
  padding: 9px 11px; margin-bottom: 10px;
}
.ro-big .v { font-size: 17px; }
.ro-section {
  margin-top: 12px; font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint);
}
.flaglist { list-style: none; margin: 8px 0 0; padding: 0; }
.flaglist li {
  font-size: 12px; background: var(--warn-soft); color: var(--warn);
  border-radius: 5px; padding: 5px 8px; margin-bottom: 4px;
  font-family: var(--mono);
}
.dupwarn {
  background: var(--warn-soft); color: var(--warn); border-radius: 6px;
  padding: 8px 10px; font-size: 12px; margin-bottom: 10px;
}
.override {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.override label { font-size: 11px; font-weight: 600; color: var(--muted); }
.override select { margin-top: 4px; }
.override p { margin: 6px 0 0; font-size: 11px; color: var(--faint); }

/* ── recent ────────────────────────────────────────────── */
.recent { margin-top: 22px; }
.recent h2, .explain h2 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin: 0 0 8px;
}
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 7px 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: 5px;
  font-size: 13px;
}
.recent .when { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.recent .what { font-weight: 550; }
.recent .who { color: var(--muted); }
.recent .price { margin-left: auto; font-family: var(--mono); font-weight: 600; }

/* ── browse ────────────────────────────────────────────── */
.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters input[type=search] { flex: 1; min-width: 200px; max-width: 340px; }
.filters select { width: auto; }
.check {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.check input { width: auto; }
.resultcount { margin-left: auto; font-size: 12px; color: var(--faint); }
.pullinfo { margin: -6px 0 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.pullinfo b { color: var(--text, inherit); font-weight: 600; }
.pullinfo .old { color: var(--faint); }

.tablewrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.datatable { width: 100%; border-collapse: collapse; font-size: 13px; }
.datatable th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--faint); font-weight: 700;
  padding: 9px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); white-space: nowrap;
}
.datatable td {
  padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top;
}
.datatable tr:last-child td { border-bottom: 0; }
.datatable tr:hover td { background: var(--surface-2); }
.datatable .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.datatable .prodname { font-weight: 550; }
.datatable .sub { display: block; font-size: 11px; color: var(--faint); }
.comparetable .rowlabel { color: var(--muted); font-weight: 550; white-space: nowrap; }
.comparetable th { min-width: 160px; }
.pill {
  display: inline-block; font-size: 11px; padding: 1px 7px;
  border-radius: 20px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.linkout { color: var(--accent); text-decoration: none; font-size: 12px; }
.linkout:hover { text-decoration: underline; }
.rowdel {
  border: 0; background: none; color: var(--faint); cursor: pointer;
  font-size: 15px; padding: 0 4px; line-height: 1;
}
.rowdel:hover { color: var(--danger); }
.emptystate { padding: 40px 20px; text-align: center; color: var(--faint); }
/* A fetch in flight (NEXT-2 1d): the same quiet row, breathing, so a slow tab is never a blank one. */
.emptystate.loading { animation: loadingpulse 1.2s ease-in-out infinite alternate; }
@keyframes loadingpulse { from { opacity: 0.45; } to { opacity: 1; } }

/* ── corrections ───────────────────────────────────────── */
.explain { max-width: 62ch; margin-bottom: 18px; }
.explain p { color: var(--muted); margin: 0; }
.explain p + p { margin-top: 10px; }
.fieldcounts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.fieldcount {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px;
}
.fieldcount .n { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.fieldcount .k { font-size: 11px; color: var(--muted); }
.corr {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
  font-size: 13px;
}
.corr .head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.corr .field { font-weight: 650; }
.corr .raw {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--surface-2); padding: 4px 7px; border-radius: 4px;
  margin: 4px 0; word-break: break-word;
}
.corr .change { font-family: var(--mono); font-size: 12px; }
.corr .was { color: var(--danger); text-decoration: line-through; }
.corr .now { color: var(--accent); font-weight: 650; }
.reportactions { display: flex; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }

/* ── toast ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 8px; font-size: 13px; font-weight: 550;
  box-shadow: 0 6px 22px rgba(0,0,0,.22); z-index: 50;
  display: flex; gap: 14px; align-items: center;
}
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); color: #fff; }

/* ── compare bar ───────────────────────────────────────── */
.comparebar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  padding: 10px 12px 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 550;
  box-shadow: 0 6px 22px rgba(0,0,0,.22); z-index: 50;
  display: flex; gap: 10px; align-items: center;
}
.comparebar[hidden] { display: none; }
.cmpcell { width: 26px; }
.cmpbox { width: 16px; height: 16px; cursor: pointer; }

/* ── dialog ────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 20px; width: min(460px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 14px; font-size: 15px; }
dialog .field { margin-bottom: 12px; }
dialog menu {
  display: flex; justify-content: flex-end; gap: 8px;
  margin: 18px 0 0; padding: 0;
}

/* ── catalog ───────────────────────────────────────────── */
.pastehint { margin-top: 8px; font-size: 13px; color: var(--muted); }
.pastehint code {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
}

.coverbar { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 6px 0; }
.covstat { font-size: 13px; color: var(--muted); }
.covstat b { font-family: var(--mono); font-size: 15px; color: var(--text); font-weight: 600; }
.covstat.muted { color: var(--faint); margin-left: auto; }

.cataloglayout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px; align-items: start;
}
@media (max-width: 900px) { .cataloglayout { grid-template-columns: 1fr; } }

.catpanel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px 16px;
}
.catpanel h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}

.bulkadd { margin-bottom: 14px; }
.bulkrow {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap;
}
.bulkrow select { width: auto; flex: 1; min-width: 150px; }
.bulkadd textarea {
  width: 100%; font: inherit; font-size: 13px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  resize: vertical; font-family: var(--mono);
}
.bulkadd textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px; border-color: var(--accent);
}
.bulkadd textarea::placeholder { color: var(--faint); font-family: inherit; }

.catgroup { margin-bottom: 16px; }
.catgroup h4 {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.catgroup .count {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--surface-2);
  padding: 1px 7px; border-radius: 20px;
}

.vocabrow {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0; border-bottom: 1px solid var(--line);
}
.vocabrow:last-child { border-bottom: 0; }
.vocabrow.inactive { opacity: .45; }

/* Names read as plain text but are always editable — no edit mode to enter,
   which matters when fixing typos across a long pasted list. */
.inlineedit {
  flex: 1; min-width: 0; border: 1px solid transparent; background: transparent;
  padding: 4px 6px; border-radius: 5px; font-size: 13px;
}
.inlineedit:hover { border-color: var(--line); }
.inlineedit:focus { background: var(--surface); border-color: var(--accent); }

.pill.tiny { font-size: 10px; padding: 0 6px; }
.usecount {
  font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap;
}
.check.tight { font-size: 11px; gap: 4px; }
.vocabrow select { width: auto; font-size: 12px; padding: 3px 6px; max-width: 140px; }

/* Brand relationship. Accessories are dimmed rather than hidden — knowing an
   operator stocks Puffco is useful market intelligence, it just is not the same
   kind of data as a cannabis brand and must not compete for attention with it. */
.vocabrow.rel-accessory { opacity: .55; }
.vocabrow.rel-accessory .inlineedit { font-style: italic; }
.vocabrow.rel-house .inlineedit,
.vocabrow.rel-licensed .inlineedit { font-weight: 600; }
.vocabrow.rel-unclassified { background: var(--warn-soft); border-radius: 5px; }
.vocabrow select.brand-rel { max-width: 110px; font-size: 11px; }
.catgroup .subcount {
  font-size: 11px; font-weight: 400; color: var(--faint); margin-left: auto;
}
.covstat.warnstat { color: var(--warn); font-weight: 600; }

/* ── paste a product page ───────────────────────────────── */

.pastebox {
  margin: 0 0 14px;
}
.pastebox details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 14px 12px;
}
.pastebox summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
}
.pastebox summary::-webkit-details-marker { display: none; }
.pastebox summary::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  color: var(--muted);
}
.pastebox details[open] summary::before { content: '▾'; }
.pastebox summary .hint { font-weight: 400; }
.pastebox textarea {
  width: 100%;
  margin-top: 10px;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
.pasteactions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pastestatus {
  font-size: 0.82rem;
  color: var(--muted);
}
.pastestatus.warn { color: var(--warn); }

.sizepicks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.sizepick {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.sizepick span { color: var(--muted); }
.sizepick.on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sizepick.on span { color: inherit; }
.saveall {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ── product page ────────────────────────────────────────── */
/* The one screen written for a patient: big numbers first, research metrics
   underneath, and a badge that says whether anyone has actually tested it. */

.backlink {
  background: none; border: none; color: var(--accent);
  font: inherit; cursor: pointer; padding: 0 0 12px;
}
.backlink:hover { text-decoration: underline; }

.prodhead { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.prodbrand { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.prodhead h2 { margin: 2px 0 8px; font-size: 24px; }
.prodmeta { display: flex; gap: 6px; flex-wrap: wrap; }
.pill.strong { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.headline { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 26px; }
.headnum .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.headnum .v { font-size: 30px; font-weight: 650; line-height: 1.15; }
.headnum .sub { color: var(--muted); font-size: 13px; display: block; }

.prodsection { margin-bottom: 26px; }
.prodsection h3 { font-size: 15px; margin: 0 0 10px; }
.prodsection .count {
  background: var(--surface-2); color: var(--muted);
  border-radius: 10px; padding: 1px 7px; font-size: 12px; font-weight: 500;
}
.footnote { color: var(--muted); font-size: 13px; margin: 8px 2px 0; max-width: 70ch; }
.when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

.trust {
  display: inline-block; border-radius: 10px; padding: 1px 8px;
  font-size: 12px; white-space: nowrap;
}
.trust-lab     { background: var(--accent-soft); color: var(--accent); }
.trust-file    { background: var(--warn-soft);   color: var(--warn); }
.trust-potency { background: var(--warn-soft);   color: var(--warn); }
.trust-none    { background: var(--surface-2);   color: var(--muted); }
.trust-fail    { background: var(--danger-soft); color: var(--danger); font-weight: 650; }

/* ── certificate PDF panel (tools/parse-coas.js) ──────────── */
.panelgrid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.panelchip {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted);
}
.panelchip.panel-fail { background: var(--danger-soft); color: var(--danger); font-weight: 650; }
.panelchip.panel-pass { color: var(--accent); }

a.prodname, a.prodlink { color: inherit; text-decoration: none; cursor: pointer; }
a.prodname:hover, a.prodlink:hover { color: var(--accent); text-decoration: underline; }

/* ── price chart ─────────────────────────────────────────── */
/* An emphasis chart: the sale price is the story, the list price is context.
   The pair was validated for colour-vision separation against the chart
   surface; the dashed list line and the end labels are the secondary encoding,
   so identity never rests on hue alone. */

.chart { margin: 0; position: relative; }
.chartlegend { display: flex; gap: 16px; margin: 0 0 6px 46px; font-size: 12px; color: var(--muted); }
.chartlegend .key { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.swatch.sale { background: var(--series-sale); }
.swatch.list { background: var(--series-list);
  background-image: linear-gradient(90deg, var(--series-list) 60%, transparent 60%);
  background-size: 5px 2px; }

.pricechart { width: 100%; height: 210px; display: block; }
.pricechart .grid  { stroke: var(--line); stroke-width: 1; }
.pricechart .axis  { fill: var(--faint); font-size: 10px; font-family: var(--mono); }
.pricechart .line  { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pricechart .line.sale { stroke: var(--series-sale); }
.pricechart .line.list { stroke: var(--series-list); stroke-dasharray: 5 4; }
.pricechart .dot.sale  { fill: var(--series-sale); stroke: var(--surface); stroke-width: 2; }
.pricechart .endlabel  { font-size: 11px; font-weight: 600; }
.pricechart .endlabel.sale { fill: var(--series-sale); }
.pricechart .endlabel.list { fill: var(--series-list); font-weight: 500; }
.pricechart .crosshair { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }

.charttip {
  position: absolute; top: 8px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 10px; font-size: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); min-width: 140px;
}
.charttip .tipdate { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.charttip .tipsub  { color: var(--muted); }

/* ── promos ──────────────────────────────────────────────── */

.promolist { display: flex; flex-direction: column; gap: 8px; }
.promo { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; }
.promoname { font-weight: 600; font-size: 14px; }
.promoterms { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.warntext { color: var(--warn); }

.callout.warn {
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  border-radius: var(--radius); padding: 11px 14px; margin: 4px 0 18px;
  font-size: 13.5px; line-height: 1.5; max-width: 80ch;
}
.labrow { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.dealname { font-size: 12.5px; color: var(--muted); max-width: 26ch; }

/* A lookup is not a link — it reads as its own thing, below the lab row. */
.lookups { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.lookup { display: flex; gap: 10px; align-items: center; font-size: 13px; }

/* ── terpenes ──────────────────────────────────────────── */
.datatable td.terps { white-space: normal; min-width: 150px; }
.terpbars { display: grid; gap: 6px; max-width: 460px; }
.terprow { display: grid; grid-template-columns: 150px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.terpname { text-transform: capitalize; }
.terpbar { height: 8px; background: var(--line, #e3e6e4); border-radius: 4px; overflow: hidden; }
.terpbar i { display: block; height: 100%; background: var(--accent, #2f7d5b); border-radius: 4px; }
.terppct { text-align: right; font-family: var(--mono, monospace); font-variant-numeric: tabular-nums; }
.terpmore { margin-top: 10px; font-size: 13px; }
.terpmore summary { cursor: pointer; color: var(--muted, #66706b); }

/* ── which week's prices ──────────────────────────────── */
.weekpicker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.weekbtn {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer;
}
.weekbtn:hover { border-color: var(--muted); }
.weekbtn .wk { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.weekbtn .wk i { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
.weekbtn .wkdates { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.weekbtn.active { background: var(--accent-soft, #e6f2ee); border-color: var(--accent); }
.weekbtn.active .wk { color: var(--accent); }

/* ── operator pages ───────────────────────────────────── */
.opstrip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.optab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
/* The strip is now real links (/dispensary/<slug>), styled exactly as the buttons were. */
a.optab { text-decoration: none; }
.optab:hover { color: var(--text, inherit); border-color: var(--muted); }
.optab.active { background: var(--accent-soft, #e6f2ee); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.optab .n { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.optab.active .n { color: var(--accent); }
.filters .ghost { width: auto; padding: 6px 10px; }
#o-store { min-width: 320px; max-width: 520px; }
.ophead { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin: 2px 0 14px; }
.ophead h2 { margin: 0 0 2px; font-size: 20px; }
.ophead .sub { margin: 0; color: var(--muted); font-size: 13px; }
.opstats { display: flex; gap: 28px; flex-wrap: wrap; }
.opstats .headnum .v.small { font-size: 18px; }
.datatable tr.gone td { opacity: 0.6; }
.datatable tr.gone:hover td { opacity: 1; }
.szlink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--faint); }
.szlink:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════
   Public view — added 21 Sep 2026.
   Everything below layers on top of the rules above; nothing above changed.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── public vs operator mode ──────────────────────────────
   body.ops is set by the "Operator tools" button and remembered per browser.
   Hiding is presentation only: the write endpoints still need closing on the
   server before anything here is public. */
body:not(.ops) .opsonly,
body:not(.ops) .delcell { display: none !important; }
.tabsep {
  flex: 0 0 1px; align-self: stretch; margin: 9px 6px;
  background: var(--line);
}
.opstoggle {
  flex: 0 0 auto; white-space: nowrap; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--faint); background: none;
  border: 1px dashed var(--line); border-radius: 6px; padding: 5px 10px; margin-right: 8px;
}
.opstoggle:hover { color: var(--text); border-color: var(--muted); }
body.ops .opstoggle { color: var(--warn); border-color: var(--warn); border-style: solid; background: var(--warn-soft); }

/* ── freshness: one line, dates one click away ──────────── */
.pullinfo { margin: -4px 0 12px; }
.freshness summary {
  cursor: pointer; list-style: none; font-size: 12.5px; color: var(--muted);
}
.freshness summary::-webkit-details-marker { display: none; }
.freshness summary::before {
  content: "▸"; display: inline-block; width: 1em; color: var(--faint);
  transition: transform .15s;
}
.freshness[open] summary::before { transform: rotate(90deg); }
.freshness summary b { color: var(--text); font-weight: 600; }
.freshness .olderflag { color: var(--warn); }
.freshness .freshhint { color: var(--faint); margin-left: 4px; text-decoration: underline dotted; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.chip {
  font-size: 11.5px; line-height: 1.5; padding: 2px 9px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text);
}
.chip b { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--muted); }
.chip.old { color: var(--faint); border-style: dashed; }
.chip.old b { color: var(--faint); }

/* ── the lab report: the thing the index exists for ─────── */
.coalink {
  display: inline-block; white-space: nowrap; text-decoration: none;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  padding: 3px 9px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
}
.coalink:hover { text-decoration: underline; }
.nocoa { font-size: 11.5px; color: var(--faint); font-style: italic; }
.datatable td.c-lab { white-space: nowrap; }
.datatable td.c-price { font-weight: 600; }
.datatable td.c-price .sub { font-weight: 400; }

/* ── filter toggle: phones only ─────────────────────────── */
.filtertoggle { display: none; }

/* ── phones ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Header: the numbers stay, at a size that leaves room for results. */
  .topbar { padding: 10px 14px; gap: 10px; }
  .statstrip { gap: 6px 14px; width: 100%; }
  .statstrip .stat { text-align: left; }
  .statstrip .n { font-size: 14px; }
  .statstrip .k { font-size: 9px; }
  .tabs { padding: 0 8px; }
  .tab { padding: 10px 11px; }
  .panel { padding: 12px 12px 48px; }

  /* Filters: search stays, the rest fold behind one button. */
  .filtertoggle { display: inline-flex; align-items: center; }
  .filters { gap: 8px; }
  .filters input[type=search] { min-width: 0; max-width: none; flex: 1 1 60%; }
  .filters:not(.open) > :not(input[type=search]):not(.filtertoggle):not(.resultcount):not(.keep) { display: none; }
  .filters.open > select { flex: 1 1 45%; }
  .filters .resultcount { flex: 1 1 100%; margin-left: 0; }

  /* Product tables become cards: name across the top, then price, THC and
     lab report — the three things someone standing in a store is checking —
     then the rest, each field naming itself. */
  #panel-browse .tablewrap,
  #panel-operators .tablewrap { overflow: visible; background: none; border: 0; }
  #browsetable thead, #operatortable thead { display: none; }
  #browsetable, #browsetable tbody,
  #operatortable, #operatortable tbody { display: block; }
  #browsetable tr, #operatortable tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  }
  #browsetable td, #operatortable td {
    display: block; border: 0; padding: 0; text-align: left;
    white-space: normal; font-family: inherit; min-width: 0;
  }
  #browsetable tr:hover td, #operatortable tr:hover td { background: none; }
  #browsetable td[data-label]::before, #operatortable td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--faint); margin-bottom: 1px;
  }
  td.c-product { grid-column: 1 / -1; font-size: 15px; line-height: 1.3; }
  td.c-price { font-size: 16px; font-family: var(--mono); }
  td.c-thc, td.c-cbd { font-family: var(--mono); }
  td.c-lab { white-space: normal; }
  td.c-terps { grid-column: 1 / -1; }
  /* No terpene data: say nothing rather than spend a full row on a dash. */
  #browsetable td.c-terps.is-empty, #operatortable td.c-terps.is-empty { display: none; }
  /* The detail under price, THC and lab report reads a size down. */
  td.c-size, td.c-ppg, td.c-ppmg, td.c-brand, td.c-op, td.c-checked, td.c-cat { font-size: 12.5px; }
  td.c-terps .sub { display: inline; margin-right: 8px; }
  td.delcell { grid-column: 1 / -1; text-align: right; }
  #browsetable td.emptystate, #operatortable td.emptystate { grid-column: 1 / -1; }
}

/* ── about ──────────────────────────────────────────────── */
.about { max-width: 720px; margin: 0 auto; font-size: 15px; line-height: 1.65; }
.about h2 { font-size: 17px; font-weight: 650; margin: 26px 0 8px; letter-spacing: -.01em; }
.about h2:first-child { margin-top: 4px; }
.about p, .about li { margin: 0 0 10px; color: var(--text); }
.about ul { padding-left: 20px; }
.about a { color: var(--accent); }
.about .cite { font-size: 13.5px; color: var(--muted); padding: 10px 14px; border-left: 3px solid var(--line); }
