/* Tokens copied from the Star dashboard (web/static/style.css, 2026-11-15): clinical, white surfaces on a
   neutral canvas, hairlines, near-black actions. Six type sizes, no others. Dark follows the system. */

@font-face { font-family: "Geist"; font-weight: 100 900; font-display: swap; src: url("/static/fonts/Geist-Variable.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-display: swap; src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #f6f6f7; --panel: #ffffff; --panel-2: #f3f3f5; --border: #e6e6ea; --border-strong: #d4d4da; --grid: #ebebed;
  --text: #16161a; --muted: #6b6b73; --input-bg: #ffffff; --accent: #26272b; --accent-text: #ffffff; --link: #4f46e5;
  --flag: #fdf2d9; --flag-text: #8f5b00; --ok: #0c7a4a; --ok-soft: #e4f5ec; --error: #bf2a2a; --error-soft: #fcecec;
  --focus: #6366f1; --ring: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
  --r: 10px; --r-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, .04), 0 0 0 1px rgba(16, 16, 24, .02);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --t-hover: 150ms ease;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px; --fs-lg: 18px; --fs-xl: 22px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e11; --panel: #16161a; --panel-2: #1c1c21; --border: #26262c; --border-strong: #35353d; --grid: #26272b;
    --text: #ededf0; --muted: #9a9aa4; --input-bg: #1f2024; --accent: #e8e8ea; --accent-text: #141517; --link: #a5b4fc;
    --flag: #2c2412; --flag-text: #eebb57; --ok: #4fd69a; --ok-soft: #12291f; --error: #f58a8a; --error-soft: #2e1717;
    --focus: #818cf8; --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh;
       font: var(--fs-base)/1.5 Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); letter-spacing: -.003em;
       -webkit-font-smoothing: antialiased; }
body.bare { display: flex; align-items: center; justify-content: center; padding: 24px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: var(--fs-sm)/1.5 var(--mono); }
small, .meta { font-size: var(--fs-sm); color: var(--muted); }
h1 { font-size: var(--fs-xl); line-height: 1.25; font-weight: 600; letter-spacing: -.022em; margin: 0 0 .25rem; }
h2 { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }

/* Side menu */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 14px 8px;
        background: var(--panel-2); border-right: 1px solid var(--border); }
.wordmark { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.03em; color: var(--text); padding: 2px 8px; }
.wordmark:hover { text-decoration: none; }
.side nav { display: grid; gap: 1px; }
.side nav a { padding: 5px 8px; border-radius: var(--r-sm); color: var(--text); }
.side nav a:hover { background: var(--grid); text-decoration: none; }
.side nav a.on { background: var(--panel); font-weight: 500; box-shadow: 0 0 0 1px var(--border); }
.side .foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; font-size: var(--fs-sm); color: var(--muted); }
.side .foot form { display: block; }
.side select { width: 100%; }

/* Page */
.page { min-width: 0; max-width: 1100px; padding: 32px 36px 48px; }
.page > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; }
.card.narrow { width: 100%; max-width: 380px; padding: 1.5rem; }
.card > :last-child { margin-bottom: 0; }      /* a closing p, dl or table never adds space under the card's own padding */
body.bare > .card { margin-bottom: 0; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Forms */
form { margin: 0; }
form.stack { display: grid; gap: .75rem; }
form.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
form.inline { display: inline; }
td form.row { flex-wrap: nowrap; }
.field { display: grid; gap: .3rem; }
label { font-weight: 500; font-size: var(--fs-sm); color: var(--muted); }
label.check { display: block; font-weight: 400; color: var(--text); }   /* block, not flex: a label with a link in it stays one line of text */
label.check > input[type="checkbox"] { margin: 0 .5rem 0 0; vertical-align: -2px; }
input, select, button { font: inherit; padding: .35rem .6rem; min-height: 32px; border: 1px solid var(--border-strong);
                        border-radius: var(--r-sm); background: var(--input-bg); color: var(--text);
                        transition: border-color var(--t-hover), box-shadow var(--t-hover); }
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: var(--ring); }
input[type="checkbox"] { min-height: 0; accent-color: var(--text); }
button { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 500; cursor: pointer;
         box-shadow: 0 1px 2px rgba(16, 16, 24, .12); transition: background-color var(--t-hover), transform 140ms var(--ease-out); }
button:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
button:active { transform: scale(.97); }
button.ghost, a.button.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
button.ghost:hover, a.button.ghost:hover { background: var(--panel-2); }
button.danger { background: var(--error); border-color: var(--error); color: var(--accent-text); }
button.link { background: none; border: 0; box-shadow: none; color: var(--muted); padding: 0; min-height: 0; }
button.link:hover { color: var(--text); text-decoration: underline; }
/* Solid, so a keyboard user can find it: the soft ring alone was about 1.3:1 against white. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Tables and badges */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 500; font-size: var(--fs-sm); color: var(--muted); border-bottom-color: var(--border-strong); }
td.num, th.num { text-align: right; }
tr:hover td { background: var(--panel-2); }
.badge { font-size: var(--fs-xs); font-weight: 500; padding: 1px 7px; border-radius: 6px; background: var(--panel-2);
         color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--ok-soft); color: var(--ok); }
.badge.look { background: var(--flag); color: var(--flag-text); }
.badge.fix { background: var(--error-soft); color: var(--error); }
.notice { padding: .6rem .8rem; border-radius: var(--r-sm); margin-bottom: 1rem; background: var(--panel-2); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.error { background: var(--error-soft); color: var(--error); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 1rem; }
dt { color: var(--muted); }
dd { margin: 0; }

/* --- M1 shell ----------------------------------------------------------------------------------------- */

/* Icons: Lucide symbols in /static/icons.svg; stroke comes from here and inherits into <use>. */
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }
.side nav a { display: flex; align-items: center; gap: 9px; }
.side nav a .ic { color: var(--muted); }
.side nav a[aria-current="page"] { background: var(--panel); font-weight: 500; box-shadow: 0 0 0 1px var(--border); }
.side nav a[aria-current="page"] .ic { color: var(--c, var(--text)); }

.skip { position: absolute; left: 8px; top: -40px; z-index: 10; padding: 6px 10px; border-radius: var(--r-sm);
        background: var(--accent); color: var(--accent-text); }
.skip:focus { top: 8px; }

/* The 8 colours a workspace or shop can take. Same names in both themes, lighter in dark. */
.c-indigo { --c: #4f46e5; } .c-blue { --c: #2563eb; } .c-teal { --c: #0f766e; } .c-green { --c: #15803d; }
.c-amber { --c: #b45309; } .c-orange { --c: #c2410c; } .c-rose { --c: #be123c; } .c-slate { --c: #475569; }
@media (prefers-color-scheme: dark) {
  .c-indigo { --c: #818cf8; } .c-blue { --c: #60a5fa; } .c-teal { --c: #2dd4bf; } .c-green { --c: #4ade80; }
  .c-amber { --c: #fbbf24; } .c-orange { --c: #fb923c; } .c-rose { --c: #fb7185; } .c-slate { --c: #94a3b8; }
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted));
       vertical-align: 1px; margin-right: 6px; flex: none; }

.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px; color: var(--text); font-weight: 600;
         letter-spacing: -.01em; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center;
        background: var(--c); color: #fff; font-size: var(--fs-md); font-weight: 600; }
img.logo { object-fit: contain; background: var(--panel); box-shadow: 0 0 0 1px var(--border); }
/* The dark theme's colours are light: a white initial on them is 1.7–3.0:1, dark ink is 6.1–10.9:1. */
@media (prefers-color-scheme: dark) { .logo { color: #141517; } }
.made-by { font-size: var(--fs-xs); color: var(--muted); }

/* Colour picker: radio buttons drawn as swatches, still keyboard- and screen-reader-usable. */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.swatches label { display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 6px; border: 1px solid var(--border-strong);
                  border-radius: 99px; color: var(--text); font-weight: 400; cursor: pointer; }
.swatches input { margin: 0; accent-color: var(--c); }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--c); border-color: transparent; }
.card { overflow-x: auto; }

/* Phones: the menu becomes a bar along the top that scrolls sideways. */
@media (max-width: 760px) {
  body { display: block; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 8px;
          padding: 8px; overflow-x: auto; }
  .side .brand, .side nav { flex: none; }          /* the bar scrolls sideways; nothing in it may shrink under the next */
  .side .brand { padding: 2px 0; }
  .side nav { display: flex; gap: 2px; }
  .side nav a { white-space: nowrap; }
  .side .brand span:not(.logo), .side .foot span, .side .foot .made-by, .side .foot form.stack { display: none; }
  .side .foot { margin: 0 0 0 auto; padding: 0; display: flex; }
  .page { padding: 20px 16px 40px; }
  .page > header { flex-wrap: wrap; align-items: flex-start; }
}
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 500; font-size: var(--fs-sm); color: var(--muted); padding: 0; margin-bottom: .3rem; }

/* --- Health and Home ----------------------------------------------------------------------------------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scroll { overflow-x: auto; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-between h2 { margin: 0; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 1rem; }
.tabs .dot { margin-right: 0; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-sm); color: var(--text);
          border: 1px solid var(--border); background: var(--panel); }
.tabs a:hover { text-decoration: none; background: var(--panel-2); }
.tabs a[aria-current="page"] { border-color: var(--border-strong); box-shadow: var(--shadow-sm); font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: .8rem .9rem; min-width: 0; }
.kpi.alert { border-color: color-mix(in srgb, var(--error) 45%, var(--border)); }
.kpi .label { font-size: var(--fs-sm); color: var(--muted); }
.kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi .value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.02em; }
.kpi .sub { font-size: var(--fs-sm); color: var(--muted); min-height: 1.2em; }
.deltas { margin-top: 4px; }
.delta { font-size: var(--fs-xs); font-weight: 500; }
.delta small { color: var(--muted); font-weight: 400; }
.delta.good { color: var(--ok); } .delta.bad { color: var(--error); } .delta.flat, .delta.none { color: var(--muted); }
.spark { flex: none; overflow: visible; }
.spark-line { fill: none; stroke: var(--c, var(--muted)); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-area { fill: color-mix(in srgb, var(--c, var(--muted)) 12%, transparent); stroke: none; }

.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.rail { position: sticky; top: 16px; }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.attention li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 6px 0;
                border-bottom: 1px solid var(--border); }
.attention li:last-child { border-bottom: 0; }
.attention a { display: flex; gap: 6px; align-items: baseline; color: var(--text); min-width: 0; }
.attention a span:last-child { overflow: hidden; text-overflow: ellipsis; }
.attention .delta { grid-column: 2; text-align: right; }
@media (max-width: 1100px) { .with-rail { grid-template-columns: minmax(0, 1fr); } .rail { position: static; order: -1; } }

details.check { padding: 0; }
details.check > summary { padding: .8rem 1rem; cursor: pointer; display: flex; gap: 8px; align-items: baseline; list-style: none; }
details.check > summary::-webkit-details-marker { display: none; }
details.check > summary::before { content: "▸"; color: var(--muted); transition: transform var(--t-hover); }
details.check[open] > summary::before { transform: rotate(90deg); }
details.check > p, details.check > .scroll { margin: 0 1rem .75rem; }
details.check td { font-size: var(--fs-sm); }

.shop-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.shop-card { margin: 0; display: grid; gap: .5rem; }
.shop-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-card h2 { margin: 0; display: flex; align-items: center; }
.shop-card h2 a { color: var(--text); }
.shop-card p { margin: 0; }
.stats { display: flex; gap: 18px; align-items: flex-end; }
.stats div { display: grid; }
.stats b { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.02em; }
.stats small { color: var(--muted); font-size: var(--fs-xs); }
.stats .spark { margin-left: auto; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
a.badge:hover { text-decoration: none; filter: brightness(.96); }

.checklist ol { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done .ic { color: var(--ok); }
.todo-dot { width: 14px; height: 14px; border: 1.5px solid var(--border-strong); border-radius: 50%; flex: none; margin: 1px; }
td code { white-space: pre-wrap; }

/* --- Connecting and public pages ------------------------------------------------------------------------ */
a.button { display: inline-flex; align-items: center; gap: 6px; padding: .45rem .8rem; border-radius: var(--r-sm);
           background: var(--accent); color: var(--accent-text); font-weight: 500; box-shadow: 0 1px 2px rgba(16, 16, 24, .12); }
a.button:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
a.button .ic { width: 14px; height: 14px; }
.narrow-text { max-width: 640px; }
.steps { padding-left: 1.2rem; display: grid; gap: .4rem; margin: 0 0 1rem; }
details.card > summary { cursor: pointer; }
.card.doc { width: 100%; max-width: 720px; padding: 2rem; line-height: 1.6; }
.doc h2 { margin-top: 1.5rem; }
.doc ul { padding-left: 1.2rem; }
body.bare.doc-page { align-items: flex-start; }

/* --- Catalog ------------------------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filters .field { min-width: 0; flex: 1 1 140px; }
.filters .field.grow { flex: 3 1 240px; }
.filters select, .filters input:not([type="checkbox"]) { width: 100%; min-width: 0; }   /* a select is as wide as its longest option */
.filters .actions { display: flex; gap: 12px; align-items: center; }
.list-head { margin-bottom: .5rem; }
.list-head p { margin: 0; }
.list-head .tabs { margin: 0; }

.cat-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
            grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cat-card { display: flex; flex-direction: column; height: 100%; background: var(--panel); border: 1px solid var(--border);
            border-radius: var(--r); overflow: hidden; color: var(--text); }
.cat-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.ph, .main-photo { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--panel-2); }
.ph.none, .main-photo.none, .thumb.none { display: grid; place-items: center; color: var(--muted); font-size: var(--fs-xs); }
.cat-body { padding: .6rem .7rem .7rem; display: grid; gap: 3px; align-content: start; }
.cat-brand { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cat-name { font-weight: 500; line-height: 1.3; }
.cat-sku { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.cat-shops { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-xs); }
.cat-shops li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 6px; align-items: center; }
.cat-shop { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.cat-price { grid-column: 2 / -1; color: var(--muted); }
.cat-price b { font-weight: 600; color: var(--text); }
.cat-body .pills { margin-top: 4px; }
.thumb { display: block; width: 40px; height: 53px; object-fit: contain; background: var(--panel-2); border-radius: 4px; }
.cat-table td { vertical-align: middle; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0; }

.product { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.gallery { position: sticky; top: 16px; display: grid; gap: 8px; }
.main-photo { border-radius: var(--r); border: 1px solid var(--border); }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--panel-2); border-radius: 4px;
              border: 1px solid var(--border); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; margin: .75rem 0; }
.facts dt { font-size: var(--fs-xs); color: var(--muted); }
.facts dd { margin: 0; }
.findings { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: 4px; }
.main-photo.none { aspect-ratio: auto; padding: 2rem 1rem; }
@media (max-width: 1000px) { .product { grid-template-columns: minmax(0, 1fr); } .gallery { position: static; max-width: 320px; } }
@media (max-width: 760px) { .cat-grid, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
                            .kpi .value { font-size: var(--fs-lg); } }
/* Product photos are made for light pages: a transparent cut-out of a dark coat vanishes on the dark theme's grey. */
img.ph, img.main-photo, img.thumb, .thumbs img { background: #f7f7f7; }

/* --- Drafts and Movements ------------------------------------------------------------------------------ */
.actions-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: .5rem; }
.actions-row a:not(.button) { display: inline-flex; gap: 6px; align-items: center; }
.filters.inline { display: flex; background: none; border: 0; padding: 0; margin: 0 0 1rem; }
.filters.inline .field { flex: 0 1 260px; }
.bulk .field { flex: 0 1 200px; }
.bulk .field.pct { flex: 0 0 6.5rem; }
.filters .check { display: flex; gap: 6px; align-items: center; padding-bottom: .45rem; }
details.check > .dr-body { padding: 0 1rem .75rem; }
details.check > .dr-body td { font-size: var(--fs-sm); vertical-align: middle; }

/* Plan page: the workspace's own plan stands out in the comparison. */
tr.current th, tr.current td { background: var(--panel-2); }

/* Rules: which shops a rule covers. */
.shop-boxes { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.shop-boxes legend { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; padding: 0; }

/* Writing from a page: the product's edit form and Health's "Fix these" */
.edit-form h3 { margin: 1rem 0 .25rem; font-size: var(--fs-md); }
.edit-form input:not([type]) { width: 7rem; }
.end-sale { white-space: nowrap; font-size: var(--fs-sm); }
.fix { margin: 0 0 .75rem; }
.fix ul { margin: .25rem 0 0; }
