/* GenoOPT web app. Self-contained: no external fonts, images or scripts (CSP default-src 'self').
   Light and dark follow the system (prefers-color-scheme) unless the viewer picks one (html[data-theme]).
   Design system (2026-11-27): tokens first (colour, type scale, spacing, radius, shadow, motion), then base, the app
   shell (header, navigation, footer), components (cards, forms, buttons, notices, badges, verdicts, skeletons, empty
   states), data display (tiles, charts, tables), pages, motion, and the tablet / phone layouts (max-width: 640px).
   Colour pairs used for text are WCAG AA (4.5:1) in both themes; status is never shown by colour alone (icon or word). */

/* ------------------------------------------------------------------ tokens */
:root {
  /* neutrals (cool slate) */
  --bg: #f5f7f9; --bg-tint: #eef3f1; --surface: #ffffff; --surface-2: #f2f5f7; --surface-3: #e5eaee; --zebra: #f8fafb;
  --text: #121a21; --muted: #4a5662; --faint: #5f6b76; --line: #e1e6eb; --line-strong: #c3ccd5;
  /* brand */
  --accent: #0f6b4b; --accent-hover: #0b5a3e; --accent-text: #ffffff; --accent-soft: #e3f3ec; --accent-soft-text: #0b5a3e;
  --accent-ring: rgba(15, 107, 75, .18);
  --link: #0f5fa8; --focus: #2563eb;
  /* status: text colour, background, border */
  --ok: #17663f; --ok-bg: #e6f5ec; --ok-line: #9fd3b4; --ok-solid: #1f8a52;
  --warn: #7a4a00; --warn-bg: #fff5dc; --warn-line: #e3b048; --warn-solid: #c98a0b;
  --err: #b0261b; --err-bg: #fdeceb; --err-line: #f0a39b; --err-solid: #cf3a2c;
  --info: #1d4f86; --info-bg: #e8f1fb; --info-line: #a8c7ea; --info-solid: #3b74b8;
  --prov: #3b4a5c; --prov-bg: #ebf0f6; --prov-line: #b4c2d3; --prov-solid: #5b6e86;
  --badge: #e3f3ec; --badge-text: #0b5a3e; --on-solid: #ffffff;
  /* charts (Okabe-Ito based, colour-blind safe) */
  --chart-1: #0f7a55; --chart-2: #2f7fc1; --chart-3: #9aa5b0; --chart-4: #c27013; --chart-5: #8a4fb8; --chart-6: #b3416a;
  --chart-grid: #e7ebef; --chart-alt: #7aa8d6;
  /* explorer charts (charts.js): categorical slots in fixed order (checked for colour-blind separation), one-hue blue ramp */
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-5: #e87ba4; --viz-6: #008300; --viz-7: #6250d6; --viz-8: #e34948;
  --viz-seq-1: #cde2fb; --viz-seq-2: #9ec5f4; --viz-seq-3: #6da7ec; --viz-seq-4: #3987e5; --viz-seq-5: #256abf; --viz-seq-6: #184f95; --viz-seq-7: #0d366b;
  --viz-alt: #86b6ef; --viz-missing: #eef1f4; --viz-ring: #ffffff;
  /* crop accent (decorative only: header stripe, crop picker edge) */
  --crop: var(--accent);
  /* elevation */
  --shadow-xs: 0 1px 1px rgba(15, 23, 32, .04);
  --shadow: 0 1px 2px rgba(15, 23, 32, .05), 0 1px 3px rgba(15, 23, 32, .04);
  --shadow-md: 0 2px 4px rgba(15, 23, 32, .05), 0 6px 16px rgba(15, 23, 32, .07);
  --shadow-lg: 0 10px 32px rgba(15, 23, 32, .14);
  --header-bg: rgba(255, 255, 255, .86);
  /* shape, space, type */
  --r-xs: 4px; --r-sm: 7px; --r: 11px; --r-lg: 16px; --r-full: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --fs-xs: .86rem; --fs-sm: .94rem; --fs-md: 1rem; --fs-lg: 1.15rem; --fs-xl: 1.45rem; --fs-2xl: 1.85rem; --fs-3xl: 2.5rem;   /* owner 2026-11-30: text was too small */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1); --t-fast: .12s; --t: .2s;
  --page: 1240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1015; --bg-tint: #0e1714; --surface: #121920; --surface-2: #18212a; --surface-3: #222d38; --zebra: #141c24;
    --text: #e6ecf1; --muted: #a5b0bb; --faint: #8f9ba7; --line: #253140; --line-strong: #3a4859;
    --accent: #4cc895; --accent-hover: #6ed6aa; --accent-text: #06140e; --accent-soft: #15302a; --accent-soft-text: #b8ebd3;
    --accent-ring: rgba(76, 200, 149, .25);
    --link: #8cc4ff; --focus: #7cb4ff;
    --ok: #7fd9a4; --ok-bg: #12291f; --ok-line: #2f6b4a; --ok-solid: #4cc27f;
    --warn: #ffd27a; --warn-bg: #2a2212; --warn-line: #8a6a22; --warn-solid: #e0a52a;
    --err: #ff9a90; --err-bg: #331a19; --err-line: #8a3a33; --err-solid: #f0675a;
    --info: #9ccaff; --info-bg: #13233a; --info-line: #2c4d73; --info-solid: #5f9de0;
    --prov: #c2cedb; --prov-bg: #1b2430; --prov-line: #44556a; --prov-solid: #8496ad;
    --badge: #15302a; --badge-text: #b8ebd3; --on-solid: #0b1015;
    --chart-1: #4cc895; --chart-2: #6cb2f0; --chart-3: #5d6a76; --chart-4: #e69f45; --chart-5: #b48ae0; --chart-6: #e07aa0;
    --chart-grid: #222c37; --chart-alt: #3f6f9c;
    --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-6: #0ca30c; --viz-7: #9085e9; --viz-8: #e66767;
    --viz-seq-1: #0d366b; --viz-seq-2: #184f95; --viz-seq-3: #256abf; --viz-seq-4: #3987e5; --viz-seq-5: #6da7ec; --viz-seq-6: #9ec5f4; --viz-seq-7: #cde2fb;
    --viz-alt: #1c5cab; --viz-missing: #1b242e; --viz-ring: #121920;
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 8px 20px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, .55);
    --header-bg: rgba(18, 25, 32, .86);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1015; --bg-tint: #0e1714; --surface: #121920; --surface-2: #18212a; --surface-3: #222d38; --zebra: #141c24;
  --text: #e6ecf1; --muted: #a5b0bb; --faint: #8f9ba7; --line: #253140; --line-strong: #3a4859;
  --accent: #4cc895; --accent-hover: #6ed6aa; --accent-text: #06140e; --accent-soft: #15302a; --accent-soft-text: #b8ebd3;
  --accent-ring: rgba(76, 200, 149, .25);
  --link: #8cc4ff; --focus: #7cb4ff;
  --ok: #7fd9a4; --ok-bg: #12291f; --ok-line: #2f6b4a; --ok-solid: #4cc27f;
  --warn: #ffd27a; --warn-bg: #2a2212; --warn-line: #8a6a22; --warn-solid: #e0a52a;
  --err: #ff9a90; --err-bg: #331a19; --err-line: #8a3a33; --err-solid: #f0675a;
  --info: #9ccaff; --info-bg: #13233a; --info-line: #2c4d73; --info-solid: #5f9de0;
  --prov: #c2cedb; --prov-bg: #1b2430; --prov-line: #44556a; --prov-solid: #8496ad;
  --badge: #15302a; --badge-text: #b8ebd3; --on-solid: #0b1015;
  --chart-1: #4cc895; --chart-2: #6cb2f0; --chart-3: #5d6a76; --chart-4: #e69f45; --chart-5: #b48ae0; --chart-6: #e07aa0;
  --chart-grid: #222c37; --chart-alt: #3f6f9c;
  --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-6: #0ca30c; --viz-7: #9085e9; --viz-8: #e66767;
  --viz-seq-1: #0d366b; --viz-seq-2: #184f95; --viz-seq-3: #256abf; --viz-seq-4: #3987e5; --viz-seq-5: #6da7ec; --viz-seq-6: #9ec5f4; --viz-seq-7: #cde2fb;
  --viz-alt: #1c5cab; --viz-missing: #1b242e; --viz-ring: #121920;
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 8px 20px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, .55);
  --header-bg: rgba(18, 25, 32, .86);
  color-scheme: dark;
}

/* crop identity: a subtle accent stripe per crop (html[data-crop], set by app.js; decorative, never carries meaning) */
:root[data-crop="soybean"] { --crop: #6a9a1f; }
:root[data-crop="wheat"] { --crop: #c8961a; }
:root[data-crop="rice"] { --crop: #3f9f6a; }
:root[data-crop="maize"] { --crop: #e0a800; }
:root[data-crop="cotton"] { --crop: #8aa0b8; }
:root[data-crop="pulses"] { --crop: #a0662a; }
:root[data-crop="sugarcane"] { --crop: #3aa38f; }
:root[data-crop="oilcrops"] { --crop: #d4b21c; }
:root[data-crop="forages"] { --crop: #5e9e3a; }
:root[data-crop="fruits"] { --crop: #d0503c; }
:root[data-crop="tropical"] { --crop: #e07b26; }
:root[data-crop="veg"] { --crop: #3c9a4e; }
:root[data-crop="leafy"] { --crop: #2f8f5b; }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 84px; font-size: 106.25%; }   /* 17 px base (owner 2026-11-30); still follows the browser's own text-size setting */
body {
  margin: 0; background: var(--bg); color: var(--text); font: var(--fs-md)/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overflow-x: hidden;
}
::selection { background: var(--accent-ring); }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: 10px 14px; z-index: 50; border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-weight: 600; }
.skip:focus { left: 12px; top: 12px; }
.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; }
h1, h2, h3 { color: var(--text); font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); line-height: 1.2; margin: .5em 0 .35em; letter-spacing: -.02em; }
h1:focus { outline: none; }
h2 { font-size: var(--fs-xl); line-height: 1.25; margin: 1.5em 0 .5em; letter-spacing: -.012em; }
h3 { font-size: var(--fs-lg); line-height: 1.3; margin: 1em 0 .4em; letter-spacing: -.005em; }
p { margin: .5em 0; }
strong, b { font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ------------------------------------------------------------------ app shell: header and navigation */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--header-bg); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.6) blur(10px); backdrop-filter: saturate(1.6) blur(10px);
}
.top::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--crop)); opacity: .9; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .top { background: var(--surface); } }
.bar { max-width: var(--page); margin: 0 auto; padding: 9px 24px 8px; display: flex; gap: 10px 18px; align-items: center; min-height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; border-radius: var(--r-sm); }
.brand-mark { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 1px 1px rgba(15, 23, 32, .15)); }
.brand-mark .m-bg { fill: var(--accent); }
.brand-mark .m-fg { fill: none; stroke: var(--accent-text); stroke-width: 2.2; stroke-linecap: round; }
.brand-text b { color: var(--accent); font-weight: 800; }
.crop-slot { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.crop-slot label { font-weight: 600; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.crop-slot select { width: auto; min-width: 8.5rem; padding: 5px 30px 5px 10px; min-height: 36px; font-weight: 600; border-left: 3px solid var(--crop); }
.crop-slot a { white-space: nowrap; font-weight: 500; }
#nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; align-items: center; }
#nav a, #nav .nav-btn {
  color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 560; white-space: nowrap;
  min-height: 0; border: 0; background: none; box-shadow: none; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
#nav a:hover, #nav .nav-btn:hover { background: var(--surface-2); color: var(--text); }
#nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 650; }
#nav .nav-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.menu-btn { display: none; margin-left: auto; align-items: center; gap: 6px; }
.menu-btn svg { width: 18px; height: 18px; }
.menu-btn svg path { stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; transition: transform var(--t) var(--ease); }
.menu-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line-strong); }
.theme-btn { padding: 6px 8px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.theme-icon { flex: none; }
/* desktop: the theme button shows only its icon (the words stay for screen readers); the open phone menu shows the words */
@media (min-width: 1280px) {
  .theme-btn .theme-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* one line at >= 1280 px: tighter gaps, no wrapping; the "Crop" word stays for screen readers (the select keeps its label) */
  .bar { gap: 10px 12px; }
  #nav { flex-wrap: nowrap; gap: 0; min-width: 0; }
  #nav a, #nav .nav-btn { padding: 7px 8px; }
  #nav .nav-sep { margin: 0 4px; }
  .crop-slot label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.loadbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity var(--t); }
.loadbar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1.1s ease-in-out infinite; }
body.busy .loadbar { opacity: 1; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
.status { max-width: var(--page); margin: 0 auto; }

/* ------------------------------------------------------------------ page layout */
main { flex: 1; width: 100%; max-width: var(--page); margin: 0 auto; padding: 12px 24px 64px; min-width: 0; }
main:focus { outline: none; }
.foot { width: 100%; border-top: 1px solid var(--line); background: var(--surface); }
.foot p { max-width: var(--page); margin: 0 auto; padding: 20px 24px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.foot strong { color: var(--text); }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin: 22px 0 10px; }
.page-head h1 { margin: 0; }
.page-head .eyebrow { margin: 0 0 4px; }
.eyebrow { color: var(--accent-soft-text); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.concept, .lede { color: var(--muted); margin-top: 0; max-width: 72ch; }
.lede { font-size: 1.05rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin: 36px 0 12px; }
.section-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack > * + * { margin-top: 16px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin: 14px 0; box-shadow: var(--shadow); min-width: 0; }
.card > :first-child, .card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2 { font-size: var(--fs-lg); }
.card-title { font-size: var(--fs-lg); margin: 0 0 6px; }
.narrow { max-width: 460px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.cards .card { margin: 0; }
/* cards that fill every row: a card left alone on the last row stretches instead of leaving a gap (guided workflows) */
.cards.cards-fill { display: flex; flex-wrap: wrap; }
.cards.cards-fill > .card { flex: 1 1 300px; min-width: 0; }
.cards ol { padding-left: 1.2em; margin: 0; }
.cards li { margin: .35em 0; }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 48px; align-items: center; margin-top: 40px; }
.auth-wrap .card { margin: 0; padding: 28px 30px; box-shadow: var(--shadow-md); }
.auth-pitch h2 { font-size: var(--fs-3xl); margin: 0 0 14px; line-height: 1.12; letter-spacing: -.025em; }
.auth-pitch ul { padding: 0; list-style: none; color: var(--muted); }
.auth-pitch li { margin: 10px 0; padding-left: 28px; position: relative; }
.auth-pitch li::before {
  content: "\2713"; content: "\2713" / ""; position: absolute; left: 0; top: .1em; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-soft-text); font-size: 11px; font-weight: 800; display: grid; place-items: center;
}

/* ------------------------------------------------------------------ forms and buttons */
.field { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-weight: 600; font-size: var(--fs-sm); }
label.check { font-weight: 400; font-size: var(--fs-md); display: flex; align-items: center; gap: 9px; margin: 6px 0; cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); margin: 14px 0; padding: 10px 16px 12px; min-width: 0; }
legend { font-weight: 650; padding: 0 6px; font-size: var(--fs-sm); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="url"], select, textarea {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 11px; width: 100%; max-width: 100%; min-height: 40px;
  box-shadow: var(--shadow-xs); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: 0 0 0 4px var(--accent-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select[multiple], select[size] { background-image: none; padding-right: 11px; }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; cursor: pointer; }
input[type="file"] { max-width: 100%; font-size: var(--fs-sm); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
textarea { min-height: 7rem; font-family: var(--mono); font-size: .9rem; resize: vertical; line-height: 1.5; }
.help { color: var(--muted); font-size: var(--fs-sm); margin: 0; overflow-wrap: anywhere; }   /* bughunt 2026-11-28: a long unbroken help line widened tool pages on phones */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm);
  padding: 8px 15px; cursor: pointer; text-decoration: none; color: var(--text); min-height: 40px; font-weight: 600; font-size: var(--fs-sm); line-height: 1.2;
  box-shadow: var(--shadow-xs); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
button:hover, .button:hover { background: var(--surface-2); border-color: var(--faint); }
button:active:not(:disabled), .button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.primary, .button, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 650; box-shadow: 0 1px 2px rgba(15, 23, 32, .12); }
button.primary:hover:not(:disabled), .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.button.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); font-weight: 600; box-shadow: var(--shadow-xs); }
.button.ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--faint); }
/* danger (delete, revoke, cancel): soft red surface, red text (AA in both themes), solid red on hover / focus.
   Also wins over .button (green primary) when both classes are set, e.g. "button small danger". */
button.danger, .button.danger { background: var(--err-bg); color: var(--err); border-color: var(--err-line); font-weight: 650; box-shadow: var(--shadow-xs); }
button.danger:hover:not(:disabled), .button.danger:hover { background: var(--err-solid); color: var(--on-solid); border-color: var(--err-solid); }
button.danger:focus-visible, .button.danger:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 4px var(--err-bg); }
button.danger:disabled, .button.danger:disabled { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
button.small, .button.small { padding: 3px 10px; min-height: 30px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
button.linkish { background: none; border: 0; box-shadow: none; color: var(--link); text-decoration: underline; text-underline-offset: 3px; padding: 4px; min-height: 0; font-weight: 400; font-size: inherit; text-align: left; }
button.linkish:hover { background: none; text-decoration-thickness: 2px; }
.actions, .pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.pageinfo { color: var(--muted); font-size: var(--fs-sm); margin-right: auto; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }

/* search */
.search { margin: 10px 0 6px; }
.search label { font-size: var(--fs-md); }
.search-row { display: flex; gap: 8px; margin-top: 8px; }
.search-row input { font-size: 1.08rem; padding: 12px 16px; min-height: 52px; border-radius: var(--r); box-shadow: var(--shadow); }
.search-row button { min-width: 7.5rem; min-height: 52px; border-radius: var(--r); font-size: var(--fs-md); }
.hero {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 30px; margin: 18px 0; box-shadow: var(--shadow);
  background: radial-gradient(120% 140% at 100% 0%, var(--accent-soft) 0%, transparent 55%), linear-gradient(180deg, var(--surface), var(--surface));
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; pointer-events: none;
  border: 28px solid var(--accent-ring); opacity: .55;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 6px; font-size: var(--fs-3xl); letter-spacing: -.025em; }
.hero .lede { margin-bottom: 14px; }
.crop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.crop-btn { font-size: var(--fs-md); padding: 16px 18px; min-width: 0; min-height: 56px; justify-content: flex-start; border-radius: var(--r); font-weight: 650; box-shadow: var(--shadow); }
.crop-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow-md); }
.crop-btn.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); background: var(--accent-soft); color: var(--accent-soft-text); }

/* ------------------------------------------------------------------ notices (alerts), badges, status language */
.notice, .error, .ok-msg { position: relative; border: 1px solid; border-radius: var(--r-sm); padding: 11px 14px 11px 42px; margin: 12px 0; }
.notice::before, .error::before, .ok-msg::before {
  position: absolute; left: 13px; top: 11px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; line-height: 1; color: var(--surface);
}
.notice { background: var(--warn-bg); border-color: var(--warn-line); color: var(--text); }
.notice::before { content: "!"; content: "!" / ""; background: var(--warn-solid); color: #1a1200; }
.notice.info { background: var(--info-bg); border-color: var(--info-line); }
.notice.info::before { content: "i"; content: "i" / ""; background: var(--info-solid); color: var(--on-solid); font-family: Georgia, serif; font-style: italic; }
.notice-title { font-weight: 700; margin: 0 0 4px; }
.notice > :last-child { margin-bottom: 0; }
.error { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }
.error::before { content: "\2715"; content: "\2715" / ""; background: var(--err-solid); color: var(--on-solid); font-size: 10px; }
.ok-msg { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.ok-msg::before { content: "\2713"; content: "\2713" / ""; background: var(--ok-solid); color: var(--on-solid); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; background: var(--badge); color: var(--badge-text); border: 1px solid transparent; border-radius: var(--r-full);
  padding: 1px 10px; font-weight: 650; font-size: var(--fs-xs); line-height: 1.6; white-space: nowrap; letter-spacing: .01em;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.bad { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.badge.muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge.ok::before { content: "\2713"; content: "\2713" / ""; font-weight: 800; }
.badge.warn::before { content: "!"; content: "!" / ""; font-weight: 800; }
.badge.bad::before { content: "\2715"; content: "\2715" / ""; font-weight: 800; font-size: .9em; }
.badge-row { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.badge-row > .badge { flex: none; }
.tag { color: var(--muted); font-size: var(--fs-sm); }
.crumb { color: var(--muted); font-size: var(--fs-sm); margin: 18px 0 0; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); text-decoration: underline; }
.lead { font-weight: 600; }

/* skeletons (loading placeholders) */
.skeleton { display: grid; gap: 12px; margin: 16px 0; }
.skeleton span {
  display: block; height: 14px; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 45%, var(--surface-2) 65%);
  background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton span:nth-child(3n+1) { width: 92%; } .skeleton span:nth-child(3n+2) { width: 74%; } .skeleton span:nth-child(3n) { width: 58%; }
.skeleton.tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.skeleton.tiles span { height: 88px; width: auto !important; border-radius: var(--r); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); margin: 14px 0; }
.empty::before {
  content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0 7px, transparent 8px), var(--accent-soft);
  box-shadow: inset 0 0 0 7px var(--accent-soft), inset 0 0 0 9px var(--accent-ring);
}
.empty .empty-title { font-weight: 650; color: var(--text); margin: 0 0 4px; font-size: var(--fs-lg); }
.empty p { max-width: 56ch; margin-left: auto; margin-right: auto; }

/* ------------------------------------------------------------------ dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.tile-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .07em; margin: 0; }
.tile-value { font-size: 1.85rem; font-weight: 750; line-height: 1.12; margin: 8px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.025em; overflow-wrap: anywhere; }
.tile-note { color: var(--muted); font-size: var(--fs-xs); margin: 0; }
.tile.accent { border-top: 3px solid var(--accent); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick a {
  display: block; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 36px 14px 16px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.quick a::after { content: "\2192"; content: "\2192" / ""; position: absolute; right: 14px; top: 14px; color: var(--faint); transition: transform var(--t-fast) var(--ease), color var(--t-fast); }
.quick a:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick a:hover::after { color: var(--accent); transform: translateX(2px); }
.quick a strong { display: block; color: var(--accent-soft-text); margin-bottom: 2px; }
:root:not([data-theme="dark"]) .quick a strong { color: var(--accent); }
.quick a span { color: var(--muted); font-size: var(--fs-sm); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 12px var(--font); }
.chart .lbl { fill: var(--text); font-weight: 600; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .b-open { fill: var(--chart-1); }
.chart .b-partly { fill: var(--chart-2); }
.chart .b-hidden { fill: var(--chart-3); }
.chart .pt { fill: var(--chart-1); }
.chart .pt.alt { fill: var(--chart-2); }
.chart .band { fill: var(--surface-2); }
.chart .feat { fill: var(--chart-1); }
.chart .feat.t1 { fill: var(--chart-2); } .chart .feat.t2 { fill: var(--chart-4); } .chart .feat.t3 { fill: var(--chart-5); } .chart .feat.t4 { fill: var(--chart-6); }
.chart .focus { stroke: var(--focus); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .flbl { fill: var(--text); font-size: 10.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-sm); color: var(--muted); margin: 8px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .k-open { background: var(--chart-1); } .legend .k-partly { background: var(--chart-2); } .legend .k-hidden { background: var(--chart-3); }
.figure { margin: 14px 0; }
.figure figcaption { color: var(--muted); font-size: var(--fs-sm); margin-top: 8px; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.recent a {
  display: inline-block; padding: 5px 13px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); text-decoration: none;
  font-size: var(--fs-sm); font-weight: 550; box-shadow: var(--shadow-xs); transition: border-color var(--t-fast);
}
.recent a:hover { border-color: var(--accent); }

/* ------------------------------------------------------------------ tools browser */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 14px 0; box-shadow: var(--shadow); }
.toolbar .field { margin: 0; flex: 1 1 260px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.chip { border-radius: var(--r-full); padding: 4px 13px; min-height: 32px; font-size: var(--fs-sm); font-weight: 560; background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip[aria-pressed="true"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.chip .n { opacity: .75; font-variant-numeric: tabular-nums; margin-left: 4px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 14px 0; }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tool-card:focus-within { border-color: var(--accent); }
.tool-card h3 { font-size: var(--fs-md); margin: 0; font-weight: 650; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.tool-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); }
.tool-card h3 a:focus-visible { outline: none; }
.tool-card h3 a:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.tool-card p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.tool-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tool-card.off { background: var(--surface-2); box-shadow: none; }
.tool-card.off:hover { transform: none; }

/* ------------------------------------------------------------------ results and tables */
.result-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 22px 0 8px; }
.result-head h2 { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 10px 0; }
.facts dt { font-weight: 600; color: var(--muted); font-size: var(--fs-sm); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; padding: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 13px; min-width: 0; max-width: 100%; box-shadow: var(--shadow-xs); }
.stat dt { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.stat dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.glossary dt { font-weight: 700; margin-top: .9em; }
.glossary dd { margin: .2em 0 0 0; color: var(--text); }
.tablebox { margin: 10px 0 20px; }
.table-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin: 20px 0 8px; }
.table-head h3 { margin: 0; }
.table-wrap {
  overflow: auto; max-height: 70vh; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-sm); }
caption { text-align: left; padding: 9px 14px; color: var(--muted); font-size: var(--fs-xs); caption-side: top; }
th, td { padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr:hover td { background: var(--surface-2); }
td { overflow-wrap: break-word; max-width: 28rem; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-wrap: normal; }
th.n .sort { text-align: right; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); white-space: nowrap; font-weight: 650; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line-strong); }
th .sort { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; font-weight: 650; text-align: left; color: inherit; font-size: inherit; letter-spacing: inherit; text-transform: inherit; display: inline; }
th .sort:hover { text-decoration: underline; background: none; color: var(--text); }
th[aria-sort] { color: var(--text); }
th[aria-sort="ascending"] .sort::after { content: " \25B2"; font-size: .75em; }
th[aria-sort="descending"] .sort::after { content: " \25BC"; font-size: .75em; }
/* sensible minimum widths so prose columns (rule, reason) do not wrap one word per line; the wrap scrolls sideways instead */
.tablebox td:not(.n):not(.nested-cell) { min-width: 8rem; }
.tablebox td.nested-cell { min-width: 6.5rem; }
.nested-none { color: var(--faint); }
details.nested > summary { font-weight: 600; color: var(--link); white-space: nowrap; padding: 0; }
details.nested[open] { min-width: min(34rem, 80vw); }
.nested-wrap { overflow: auto; max-height: 20rem; max-width: 46rem; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); }
table.mini { font-size: var(--fs-xs); width: auto; }
table.mini th, table.mini td { padding: 4px 8px; min-width: 0; max-width: 16rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.mini thead th { position: static; }
details.nested .facts { font-size: var(--fs-xs); gap: 2px 12px; }
.src { font-style: italic; color: var(--muted); }
details.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; padding: 6px 16px; box-shadow: var(--shadow-xs); }
details summary { cursor: pointer; font-weight: 600; padding: 7px 0; border-radius: var(--r-xs); }
details summary:hover { color: var(--accent-soft-text); }
details[open] > summary { margin-bottom: 4px; }
details.raw { margin: 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 16px; }
details.raw pre, .example pre { overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font-size: .82rem; max-height: 28rem; font-family: var(--mono); line-height: 1.5; }
.sha { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; font-size: var(--fs-sm); }
.sha code, .sha .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--r-xs); font-size: .8rem; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.files .card { margin: 0; display: flex; flex-direction: column; }
.files .card h3 { font-size: var(--fs-md); margin: 0 0 6px; overflow-wrap: anywhere; }
.files .facts { grid-template-columns: max-content minmax(0, 1fr); font-size: var(--fs-sm); gap: 3px 12px; }
.files .file-act { margin-top: auto; }
.once input { margin: 6px 0; }
.howto ol { padding-left: 1.2em; }
.howto li { margin-bottom: 8px; }
.howto li::marker { color: var(--accent); font-weight: 700; }
.howto h3 { font-size: var(--fs-md); margin-bottom: 2px; }
.howto p { margin: 2px 0; }

/* ------------------------------------------------------------------ Ask AI */
.ai-box { font-family: inherit; font-size: var(--fs-md); }
.ai-turn { border-left: 3px solid var(--accent); }
.ai-turn .ai-q-title { font-size: var(--fs-xs); color: var(--muted); margin: 0 0 .25em; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.ai-q { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; margin: 0 0 .7em; }
.ai-answer { line-height: 1.65; }
.ai-answer p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 .7em; }
.ai-tools { list-style: none; padding: 8px 12px; margin: 6px 0 10px; color: var(--muted); font-size: var(--fs-sm); background: var(--surface-2); border-radius: var(--r-sm); }
.ai-tools:empty { display: none; }
.ai-tools li { margin: 2px 0; }
.ai-tools li.ok .ai-tool-st { color: var(--ok); }
.ai-tools li.failed .ai-tool-st { color: var(--err); }

/* ------------------------------------------------------------------ Analyse my data: verdict language
   Verdicts carry a word and an icon as well as a colour (colour-blind safe). PROVISIONAL is slate blue-grey, set from
   data-verdict (app.js); without it the verdict class decides (ok / warn / bad). */
.verdict {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid; border-radius: var(--r-sm); padding: 5px 13px 5px 9px;
  font-weight: 750; font-size: var(--fs-md); letter-spacing: .015em; line-height: 1.35;
}
.verdict::before {
  flex: none; width: 1.3em; height: 1.3em; border-radius: 50%; display: grid; place-items: center; font-size: .78em; font-weight: 900; line-height: 1; color: var(--on-solid);
}
.verdict.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.verdict.ok::before { content: "\2713"; content: "\2713" / ""; background: var(--ok-solid); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.verdict.warn::before { content: "!"; content: "!" / ""; background: var(--warn-solid); color: #1a1200; }
.verdict.bad { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.verdict.bad::before { content: "\2715"; content: "\2715" / ""; background: var(--err-solid); }
.verdict[data-verdict="PROVISIONAL"] { background: var(--prov-bg); color: var(--prov); border-color: var(--prov-line); }
.verdict[data-verdict="PROVISIONAL"]::before { content: "?"; content: "?" / ""; background: var(--prov-solid); }
.verdict-row { margin: 10px 0; }
.verdict-card .verdict { font-size: 1.2rem; padding: 7px 16px 7px 11px; }
.verdict-banner { border-left-width: 6px; }
.verdict-banner.v-ok { border-color: var(--ok-line); border-left-color: var(--ok-solid); background: var(--ok-bg); }
.verdict-banner.v-warn { border-color: var(--warn-line); border-left-color: var(--warn-solid); background: var(--warn-bg); }
.verdict-banner.v-bad { border-color: var(--err-line); border-left-color: var(--err-solid); background: var(--err-bg); }
.verdict-banner[data-verdict="PROVISIONAL"] { border-color: var(--prov-line); border-left-color: var(--prov-solid); background: var(--prov-bg); }
.verdict-banner .verdict { background: var(--surface); }
.verdict-scale { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: var(--fs-xs); }
.verdict-scale li { padding: 3px 10px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; }
.verdict-scale li.on { border-color: currentColor; color: var(--text); font-weight: 800; box-shadow: 0 0 0 1px currentColor; }
.verdict-scale li.on[data-verdict="USE"] { color: var(--ok); }
.verdict-scale li.on[data-verdict="USE_WITH_CARE"] { color: var(--warn); }
.verdict-scale li.on[data-verdict="PROVISIONAL"] { color: var(--prov); }
.verdict-scale li.on[data-verdict="DO_NOT_USE"] { color: var(--err); }
.verdict-scale li.on::before { content: "\25B8 "; content: "\25B8 " / ""; }
details.not-verified { border-color: var(--err-line); border-left: 4px solid var(--err-solid); }
ul.why { margin: 6px 0 8px; color: var(--muted); font-size: var(--fs-sm); padding-left: 1.3em; }
ul.why li { margin: 2px 0; }
.checklist { list-style: none; padding: 0; margin: 6px 0; }
.checklist li { padding: 5px 0 5px 1.9em; position: relative; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { position: absolute; left: 0; top: 6px; width: 1.3em; text-align: center; font-weight: 800; content: "\2022"; color: var(--muted); }
.checklist li.c-ok::before { content: "\2713"; color: var(--ok); }
.checklist li.c-warn::before { content: "!"; color: var(--warn); }
.checklist li.c-bad::before { content: "\2717"; color: var(--err); }
.an-filelist { list-style: none; padding: 0; display: grid; gap: 10px; }
.an-file { margin: 0; }
.an-files { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.an-files a {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 6px 12px; text-decoration: none;
  background: var(--surface); font-size: var(--fs-sm); font-weight: 550; box-shadow: var(--shadow-xs); transition: border-color var(--t-fast);
}
.an-files a:hover { border-color: var(--accent); }
.an-files a::before { content: "\2193"; font-weight: 800; color: var(--accent); }
.an-layers { padding-left: 0; list-style: none; display: grid; gap: 2px; }
.an-layer { padding: 6px 0 6px 1.9em; position: relative; }
.an-layer::before { position: absolute; left: 0; width: 1.3em; text-align: center; content: "\25CB"; color: var(--muted); }
.an-layer.running::before { content: "\25D4"; color: var(--info-solid); animation: spin 1.2s linear infinite; }
.an-layer.passed::before { content: "\2713"; color: var(--ok); font-weight: 800; }
.an-layer.warn::before { content: "!"; color: var(--warn); font-weight: 800; }
.an-layer.failed::before { content: "\2717"; color: var(--err); font-weight: 800; }
.an-layer.skipped::before { content: "\2013"; }
@keyframes spin { to { transform: rotate(360deg); } }
.an-fig { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.an-result h3 { margin-top: 1.4em; }

/* ------------------------------------------------------------------ My data sheets */
.sheet-tools input[type="text"] { width: auto; min-width: 12rem; flex: 1 1 14rem; }
.sheet-wrap { max-height: 70vh; overflow: auto; }
.sheet-grid { font-size: var(--fs-sm); width: auto; min-width: 100%; }
.sheet-grid th, .sheet-grid td { padding: 3px 4px; }
.sheet-grid td { max-width: none; }
.sheet-grid thead th { text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); color: var(--text); }
.sheet-grid tbody tr:nth-child(even) td, .sheet-grid tbody tr:hover td { background: none; }
.sheet-grid th[scope="row"] { white-space: nowrap; background: var(--surface-2); font-weight: 600; position: sticky; left: 0; z-index: 1; }
.sheet-grid thead th:first-child { left: 0; z-index: 2; }
.sheet-grid th[scope="row"] button { margin-left: 4px; min-height: 26px; padding: 1px 6px; }
.sheet-grid input.cell { width: 9rem; min-width: 5rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--surface); min-height: 32px; box-shadow: none; }
.sheet-grid input.cell:focus { border-color: var(--accent); }
.sheet-grid input.cell[readonly] { background: var(--surface-2); }
.sheet-grid input.cell-bad { border: 2px solid var(--err); background: var(--err-bg); }
.sheet-grid th.row-bad { color: var(--err); outline: 2px solid var(--err); }
.sheet-grid .req { color: var(--err); }
.sheet-errlist { max-height: 16rem; overflow: auto; }
.shared-row td:first-child { font-style: italic; }
.colbuilder { padding-left: 1.4em; }
.cb-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.cb-row input[type="text"], .cb-row select { width: auto; flex: 1 1 7rem; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 6px 0 12px; padding: 0; }
.meta-chips div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full); padding: 3px 12px; font-size: var(--fs-sm); display: flex; gap: 6px; box-shadow: var(--shadow-xs); }
.meta-chips dt { color: var(--muted); }
.meta-chips dd { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------------ 404 */
.notfound { text-align: center; padding: 64px 16px; }
.notfound .actions { justify-content: center; }
.notfound .code {
  font-size: 5rem; font-weight: 850; margin: 0; line-height: 1; letter-spacing: -.04em; color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--chart-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
@media (forced-colors: active) { .notfound .code { -webkit-text-fill-color: currentColor; background: none; } }


/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .loadbar::before { left: 0; width: 100%; opacity: .6; }
  .tool-card:hover, .quick a:hover { transform: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .top, .foot, .skip, .actions, .pager, .menu-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .tile, .table-wrap, .tool-card { box-shadow: none; }
  .table-wrap { max-height: none; overflow: visible; }
}

/* ------------------------------------------------------------------ tablet and phone */
@media (max-width: 1120px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 16px; }
  .auth-pitch h2 { font-size: var(--fs-2xl); }
}
/* the full menu needs ~1190 px of bar, so below 1280 px the header uses the menu button (the bar never wraps a lone item) */
@media (max-width: 1279px) {
  .menu-btn { display: inline-flex; }
  .bar { flex-wrap: wrap; }
  #nav {
    display: none; order: 10; width: 100%; flex-direction: column; align-items: stretch; margin: 0; padding: 8px 0 12px; border-top: 1px solid var(--line);
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
  #nav.open { display: flex; }
  #nav a, #nav .nav-btn { padding: 11px 12px; font-size: var(--fs-md); text-align: left; justify-content: flex-start; color: var(--text); }
  #nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  #nav .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .crop-slot { order: 2; }
}
/* bughunt 2026-11-28: the site owner's menu (Downloads and Admin too) needs ~1370 px; between 1280 and 1459 px it pushed
   "Sign out" off the screen, so the owner's bar uses the menu button up to 1459 px (app.js sets data-nav="long") */
@media (min-width: 1280px) and (max-width: 1459px) {
  html[data-nav="long"] .menu-btn { display: inline-flex; }
  html[data-nav="long"] .bar { flex-wrap: wrap; }
  html[data-nav="long"] #nav {
    display: none; order: 10; width: 100%; flex-direction: column; align-items: stretch; margin: 0; padding: 8px 0 12px; border-top: 1px solid var(--line);
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
  html[data-nav="long"] #nav.open { display: flex; }
  html[data-nav="long"] #nav a, html[data-nav="long"] #nav .nav-btn { padding: 11px 12px; font-size: var(--fs-md); text-align: left; justify-content: flex-start; color: var(--text); }
  html[data-nav="long"] #nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  html[data-nav="long"] #nav .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  html[data-nav="long"] .theme-btn .theme-word { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
@media (max-width: 640px) {
  html { scroll-padding-top: 120px; }
  .bar { padding: 8px 16px; gap: 8px 10px; min-height: 56px; }
  main { padding: 6px 16px 44px; }
  .foot p { padding: 16px; }
  h1 { font-size: var(--fs-xl); }
  h2 { font-size: var(--fs-lg); }
  .brand-text { font-size: 1.05rem; }
  .crop-slot { order: 11; width: 100%; }
  .crop-slot select { flex: 1; min-width: 0; }
  .search-row { flex-direction: column; }
  .search-row button { width: 100%; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .card { padding: 16px; border-radius: var(--r); }
  .hero { padding: 20px 18px; }
  .hero h1 { font-size: var(--fs-2xl); }
  .hero::after { width: 140px; height: 140px; border-width: 18px; right: -40px; top: -40px; }
  .crop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px 13px; }
  .tile-value { font-size: 1.4rem; }
  .files { grid-template-columns: minmax(0, 1fr); }
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .toolbar { padding: 12px; }
  .toolbar .field { flex-basis: 100%; }
  th, td { padding: 7px 10px; }
  td { max-width: 18rem; }
  .auth-wrap .card { padding: 20px 18px; }
  .auth-pitch h2 { font-size: var(--fs-xl); }
  .verdict-card .verdict { font-size: 1.05rem; }
  .notfound .code { font-size: 3.75rem; }
}

/* ---- Admin approval (2026-11-27): menu badge, waiting screen, accounts table. Tokens only, so light and dark both work. */
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35em; height: 1.35em; padding: 0 .4em; border-radius: var(--r-full);
  background: var(--warn-solid); color: var(--on-solid); font-size: var(--fs-xs); font-weight: 750; line-height: 1; }
.pending-card h1 { margin-top: 4px; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.admin-bar input[type="search"] { flex: 1 1 16rem; max-width: 26rem; }
.admin-table td { vertical-align: middle; }
.admin-table tr.row-pending td { background: var(--warn-bg); }
.admin-email { overflow-wrap: break-word; word-break: normal; font-weight: 600; }   /* breaks only at the <wbr> after "@" and dots */
.admin-table td.admin-email-cell { min-width: 12rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin-approve { display: inline-flex; gap: 4px; align-items: center; }
.admin-approve select { min-height: 30px; padding: 2px 26px 2px 8px; font-size: var(--fs-xs); width: auto; min-width: 7.5em; }
.admin-table td.admin-date { white-space: nowrap; }
/* "Delete permanently" confirm dialog (2026-11-28) */
.admin-dialog { width: min(34rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--err-line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 20px 22px; }
.admin-dialog::backdrop { background: rgba(10, 15, 20, .55); }
.admin-dialog h2 { margin: 0 0 8px; font-size: var(--fs-lg); }
.admin-dialog ul { margin: 4px 0 0; padding-left: 1.2em; }
.admin-dialog label { display: block; font-weight: 650; margin: 12px 0 4px; }
.admin-dialog input { width: 100%; }
.admin-dialog .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
/* phone: each account is a stacked card (label: value), so nothing scrolls sideways and no column is cut off */
@media (max-width: 640px) {
  .admin-table { max-height: none; overflow: visible; border: 0; background: none; box-shadow: none; }
  .admin-table table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .admin-table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin: 0 0 12px; padding: 6px 0; }
  .admin-table tr.row-pending { border-left: 3px solid var(--warn-solid); }
  .admin-table tbody tr td, .admin-table tbody tr:nth-child(even) td, .admin-table tbody tr:hover td, .admin-table tr.row-pending td { background: none; }
  .admin-table td { max-width: none; min-width: 0; border-bottom: 0; padding: 5px 14px; display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 10px; align-items: center; }
  .admin-table td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
  .admin-table td > .badge { justify-self: start; }
  .admin-table td.admin-email-cell { min-width: 0; display: block; padding-top: 8px; font-size: var(--fs-md); }
  .admin-table td.admin-email-cell::before { display: none; }
  .admin-table td.admin-actions-cell { grid-template-columns: minmax(0, 1fr); padding-bottom: 10px; }
  .admin-actions { min-width: 0; }
}

/* ---- "Ask me anything" (home-ask 2026-11-30): centre of the landing page and of the signed-in Home page */
.ask-hero { max-width: 780px; margin: 0 auto; padding: var(--s6) 0 var(--s3); text-align: center; }
.ask-title { font-size: clamp(2rem, 6vw, var(--fs-3xl)); margin: var(--s1) 0 var(--s2); letter-spacing: -.01em; }
.ask-lede { margin: 0 auto var(--s4); max-width: 620px; }
.ask-hero form, .ask-hero .ai-log, .ask-hero .notice, .ask-hero .actions { text-align: left; }
.ask-hero textarea { width: 100%; font-size: var(--fs-lg); }
.ask-more { margin-top: var(--s3); }
.ask-qs { max-width: var(--page); margin: var(--s2) auto var(--s6); }
.ask-qs > h2, .ask-qs > .help { text-align: center; }
.ask-groups { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ask-group h3 { font-size: var(--fs-md); margin: 0 0 var(--s2); }
.ask-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.ask-q { display: block; width: 100%; text-align: left; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); line-height: 1.4; }
button.ask-q { cursor: pointer; }
button.ask-q:hover, button.ask-q:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-text); }
@media (max-width: 640px) { .ask-hero { padding-top: var(--s4); } }
.ask-examples { max-width: var(--page); margin: var(--s4) auto var(--s5); }
.ask-examples > h2, .ask-examples > .help { text-align: center; }
.ask-ex-list { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.ask-ex { min-width: 0; }
.ask-ex .eyebrow { margin: 0 0 var(--s1); }
.ask-ex-q { font-size: var(--fs-md); margin: 0 0 var(--s2); }
.ask-ex table { font-size: var(--fs-sm); }
.ask-ex td.mono { font-family: var(--mono); white-space: nowrap; }
.home-tools .ask-group h3 a { color: var(--text); text-decoration: none; }
.home-tools .ask-group h3 a:hover { color: var(--accent); text-decoration: underline; }
.home-tool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-sm); }
.home-tool-list li.off a { color: var(--faint); }
.home-tools > p:last-child { text-align: center; margin-top: var(--s4); }

/* ---- "CropGPT at a glance" band (owner 2026-11-30): tools and records, under the Ask box */
.glance { max-width: 900px; margin: var(--s4) auto var(--s5); text-align: center; }
.glance-tiles { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.glance-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) var(--s3); box-shadow: var(--shadow-xs); }
.glance-value { margin: 0; font-size: var(--fs-2xl); font-weight: 800; color: var(--accent); letter-spacing: -.01em; line-height: 1.1; }
.glance-label { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.glance-crops { list-style: none; padding: 0; margin: var(--s3) 0 var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.glance-crops li { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-full); padding: 4px 12px; font-size: var(--fs-sm); display: inline-flex; gap: 6px; align-items: center; }
.glance-note { margin: 0; }
