/* =====================================================================
   KindStock design system
   Layout concept: a calm, labeled "stockroom". Indigo ink on cool paper,
   marigold for highlights, and the shelf meter (stock filling toward a
   target line) as the signature element.
   ===================================================================== */

/* ---------- Tokens: light theme (default) ---------- */
:root {
  --bg:        #f5f6fb;   /* page */
  --surface:   #ffffff;   /* cards, panels */
  --surface-2: #eceef8;   /* subtle fills, table headers */
  --fg:        #1b1f3b;   /* main text (indigo ink) */
  --muted:     #575d78;   /* secondary text */
  --line:      #d9dcec;   /* borders */
  --primary:   #3443a6;   /* buttons, links */
  --primary-2: #26328a;   /* hover */
  --on-primary:#ffffff;
  --accent:    #f2ad3a;   /* marigold highlight (never used for body text) */
  --accent-soft:#fdf0d8;
  --focus:     #f2ad3a;
  --ink-bg:    #1b1f3b;   /* sidebar and impact band: dark in both themes */
  --ink-fg:    #f5f6fb;

  /* Status colors: always paired with a word or icon, never color alone */
  --urgent:  #b7352b;  --urgent-soft:  #fbe5e2;
  --needed:  #a95207;  --needed-soft:  #fcebd9;
  --low:     #7a6300;  --low-soft:     #f7f0cf;
  --stocked: #2b7448;  --stocked-soft: #dff2e6;

  /* Type */
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --text-scale: 1;        /* changed by the text size control */

  /* Shape and depth */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(27 31 59 / .06), 0 4px 16px rgb(27 31 59 / .06);
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}

/* ---------- Dark theme (follows the device, or the toggle) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11132a; --surface: #1a1d3a; --surface-2: #23274a; --fg: #e9ebf8; --muted: #a6abc9;
    --line: #2f3360; --primary: #9aa8ff; --primary-2: #b8c2ff; --on-primary: #11132a;
    --accent: #f5b850; --accent-soft: #3a3020; --focus: #f5b850; --ink-bg: #0b0d1f; --ink-fg: #e9ebf8;
    --urgent: #ff8f80; --urgent-soft: #3d1f22; --needed: #f5ab63; --needed-soft: #3b2a1a;
    --low: #e6cb62; --low-soft: #353018; --stocked: #74d69d; --stocked-soft: #1b3428;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11132a; --surface: #1a1d3a; --surface-2: #23274a; --fg: #e9ebf8; --muted: #a6abc9;
  --line: #2f3360; --primary: #9aa8ff; --primary-2: #b8c2ff; --on-primary: #11132a;
  --accent: #f5b850; --accent-soft: #3a3020; --focus: #f5b850; --ink-bg: #0b0d1f; --ink-fg: #e9ebf8;
  --urgent: #ff8f80; --urgent-soft: #3d1f22; --needed: #f5ab63; --needed-soft: #3b2a1a;
  --low: #e6cb62; --low-soft: #353018; --stocked: #74d69d; --stocked-soft: #1b3428;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must always win over display: flex/grid rules */
[hidden] { display: none !important; }

html { font-size: calc(100% * var(--text-scale)); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 .5rem;
  text-wrap: balance;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p  { margin: 0 0 1rem; }
.h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 700; letter-spacing: -.01em; }
.h3 { font-size: 1.12rem; font-weight: 700; font-family: var(--font-display); line-height: 1.2; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-2); }

img, svg { max-width: 100%; }

/* One visible focus style for everything (keyboard users) */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--fg); padding: 10px 14px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 700;
}
.skip-link:focus { top: 12px; }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }

.eyebrow {
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .4rem;
}

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

main { flex: 1; }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-tight { padding-block: 2rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.min-0 { min-width: 0; }

/* ---------- Public header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font: 800 1.2rem var(--font-display); letter-spacing: -.02em;
  color: var(--fg); text-decoration: none;
}
.brand img { width: 34px; height: 34px; }
.brand-copy { display: grid; line-height: 1.1; }
.brand-tagline {
  margin-top: .2rem; font: 500 .62rem/1.2 var(--font-body);
  letter-spacing: 0; color: var(--muted); white-space: nowrap;
}
.brand:hover { color: var(--fg); }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--fg); text-decoration: none; font-weight: 600;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
}
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav a.btn { color: var(--on-primary); background: var(--primary); }
.site-nav a.btn:hover { background: var(--primary-2); color: var(--on-primary); }
.site-nav .btn-ghost { color: var(--fg); }

.site-header .menu-toggle { display: none; margin-left: auto; }

@media (max-width: 760px) {
  .site-header .menu-toggle { display: inline-flex; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
  .site-nav.open { display: flex; }
  .site-nav .btn { justify-content: center; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .9rem;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
}
.site-footer .container { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer h2 { font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.site-footer a { color: var(--muted); }
.site-footer .brand { color: var(--fg); }
.footer-blurb { margin-top: .75rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.05rem;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font: 700 .95rem var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--primary-2); color: var(--on-primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--primary-2); }
.btn-danger { background: var(--urgent); color: #fff; }
.btn-danger:hover { background: var(--urgent); filter: brightness(.92); color: #fff; }
.btn-accent { background: var(--accent); color: #1b1f3b; }
.btn-accent:hover { background: var(--accent); filter: brightness(.95); color: #1b1f3b; }
.btn-sm { min-height: 36px; padding: .35rem .75rem; font-size: .88rem; }
.btn-icon { min-width: 44px; padding: .5rem; }

/* ---------- Cards and panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-width: 0;
}
.card-raised { box-shadow: var(--shadow); border-color: transparent; }
.card h3 { margin-bottom: .35rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { margin: 0; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  padding: .2rem .6rem; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.pill-urgent  { background: var(--urgent-soft);  color: var(--urgent); }
.pill-needed  { background: var(--needed-soft);  color: var(--needed); }
.pill-low     { background: var(--low-soft);     color: var(--low); }
.pill-stocked { background: var(--stocked-soft); color: var(--stocked); }
.pill-none    { background: var(--surface-2);    color: var(--muted); }

/* ---------- The shelf meter (signature element) ----------
   Fill = stock on hand. The dashed line = target. Width is capped at
   the target, so a full shelf reads as "full", not overflowing. */
.meter {
  position: relative; height: 12px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--surface-2) 0 calc(10% - 2px), var(--line) calc(10% - 2px) 10%);
  overflow: hidden;
}
.meter > span {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 3px;
  background: var(--stocked);
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.meter[data-level="urgent"] > span { background: var(--urgent); }
.meter[data-level="needed"] > span { background: var(--needed); }
.meter[data-level="low"]    > span { background: var(--low); }

.need {
  display: grid; grid-template-columns: 2.6rem 1fr auto; gap: .35rem .85rem; align-items: center;
  padding: .85rem 0; border-bottom: 1px solid var(--line);
}
.need:last-child { border-bottom: 0; }
.need .cat-icon { grid-row: span 2; }
.need-name { font-weight: 700; min-width: 0; }
.need-count { font-size: .85rem; color: var(--muted); grid-column: 2 / -1; display: flex; gap: .75rem; align-items: center; }
.need-count .meter { flex: 1; }
.need-count span.num { white-space: nowrap; }

.cat-icon {
  width: 2.6rem; height: 2.6rem; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--fg);
}
.cat-icon .icon { width: 1.5rem; height: 1.5rem; }

/* ---------- Stats ---------- */
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font: 800 clamp(1.6rem, 3vw, 2.1rem)/1.1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .88rem; }
.stat-flag { color: var(--muted); font-weight: 700; font-size: .85rem; }
.stat-flag-alert { color: var(--urgent); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label, .field .label { font-weight: 700; font-size: .92rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
.req { color: var(--urgent); }

input, select, textarea {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: .6rem .75rem; min-height: 44px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; accent-color: var(--primary); }
label.row { font-weight: 500; gap: .5rem; cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); outline-offset: 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--urgent); }

.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.form-error {
  display: none; padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--urgent-soft); color: var(--urgent); font-weight: 600;
}
.form-error:not(:empty) { display: block; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .5rem; }
legend.label { font-weight: 700; font-size: .92rem; }

/* Segmented control (radio buttons styled as a toggle group) */
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label {
  padding: .5rem .85rem; min-height: 42px; display: inline-flex; align-items: center; cursor: pointer;
  font-weight: 600; font-size: .9rem; border-right: 1px solid var(--line); background: var(--surface);
  flex: 1 1 auto; justify-content: center;
}
.segmented label:last-of-type { border-right: 0; }
.segmented input:checked + label { background: var(--primary); color: var(--on-primary); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }

/* Number stepper */
.stepper { display: flex; align-items: stretch; }
.stepper input { text-align: center; border-radius: 0; min-width: 0; width: 5rem; flex: 1; font-variant-numeric: tabular-nums; }
.stepper button { min-width: 44px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--fg); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.stepper button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: 0; }
.stepper button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { font-size: .78rem; padding: .1rem .45rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }

/* ---------- Toasts (announced to screen readers) ---------- */
.toast-region {
  position: fixed; z-index: 90; right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--fg); color: var(--bg); padding: .8rem 1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-weight: 600; display: flex; gap: .6rem; align-items: center;
}
.toast-error { background: var(--urgent); color: #fff; }

/* ---------- Dialog ---------- */
dialog {
  border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(17 19 42 / .55); }
.dialog-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* ---------- Empty and loading states ---------- */
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.loading { color: var(--muted); padding: 1rem 0; }

/* =====================================================================
   Public pages
   ===================================================================== */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem); }
.hero-grid { display: grid; gap: clamp(2rem, 5vw, 3.5rem); grid-template-columns: 1.1fr .9fr; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { max-width: 15ch; }
.hero h1 mark { background: linear-gradient(transparent 62%, var(--accent) 62% 92%, transparent 92%); color: inherit; padding: 0 .1em; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.hero .row { margin-top: 1.5rem; }

/* The live "board" illustration in the hero, built from real data */
.board { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 1.25rem 1.25rem .5rem; position: relative; }
.board::before {
  content: "LIVE NEEDS"; position: absolute; top: -12px; left: 1.25rem;
  font: 800 .7rem var(--font-body); letter-spacing: .12em;
  background: var(--accent); color: #1b1f3b; padding: .25rem .6rem; border-radius: 4px;
}
.board-org { font-weight: 700; margin: .5rem 0 .25rem; }

.impact-band { background: var(--ink-bg); color: var(--ink-fg); }
.impact-band .container { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); padding-block: 2rem; }
.impact-band .stat-label { color: color-mix(in srgb, var(--ink-fg) 75%, transparent); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 3.4rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -.1rem;
  width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center;
  font: 800 1.05rem var(--font-display); background: var(--accent-soft); color: var(--fg); border: 2px solid var(--accent);
}

.problem { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .problem { grid-template-columns: 1fr; } }
.problem .card { border-top: 4px solid var(--urgent); }
.problem .card.solution { border-top-color: var(--stocked); }
.problem ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }

.org-card { display: flex; flex-direction: column; gap: .75rem; }
.org-card .org-type { align-self: flex-start; }
.org-card .needs-mini { display: flex; flex-wrap: wrap; gap: .35rem; }
.org-card .btn { margin-top: auto; align-self: flex-start; }

.page-head { padding-block: clamp(2rem, 5vw, 3rem) 1rem; }
.page-head .lede { color: var(--muted); max-width: 60ch; font-size: 1.08rem; }

.org-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .org-layout { grid-template-columns: 1fr; } }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 0; }
.info-list dt { color: var(--muted); font-weight: 600; }
.info-list dd { margin: 0; }

.slot-list { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.slot input { position: absolute; opacity: 0; }
.slot label {
  display: flex; flex-direction: column; gap: .1rem; padding: .7rem .8rem; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.slot label strong { font-size: .95rem; }
.slot label span { font-size: .8rem; color: var(--muted); }
.slot input:checked + label { border-color: var(--primary); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--primary); }
.slot input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.slot input:disabled + label { opacity: .45; cursor: not-allowed; }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 2.25rem; }
.prose ul, .prose ol { padding-left: 1.3rem; display: grid; gap: .4rem; }
.sources li { overflow-wrap: anywhere; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.auth-wrap { display: grid; place-items: center; padding-block: clamp(2rem, 8vw, 5rem); }
.auth-card { width: 100%; max-width: 440px; }
.demo-accounts { font-size: .88rem; }
.demo-accounts button { font: inherit; background: none; border: 0; color: var(--primary); cursor: pointer; text-decoration: underline; padding: 0; }

/* =====================================================================
   Staff app shell
   ===================================================================== */
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--ink-bg) 250px, transparent 250px); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink-bg); color: var(--ink-fg);
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem 1.25rem max(1rem, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 1.25rem;
}
.sidebar .brand { color: var(--ink-fg); }
.sidebar .brand:hover { color: var(--ink-fg); }
.org-switch label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; display: block; margin-bottom: .3rem; }
.org-switch select { background: color-mix(in srgb, var(--ink-fg) 10%, transparent); color: var(--ink-fg); border-color: color-mix(in srgb, var(--ink-fg) 25%, transparent); }
.org-switch select option { color: #1b1f3b; background: #fff; }
.app-nav { display: flex; flex-direction: column; gap: .1rem; }
.nav-group { margin: .7rem 0 .2rem .75rem; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: color-mix(in srgb, var(--ink-fg) 55%, transparent); }
.nav-group:first-child { margin-top: 0; }
.app-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--ink-fg) 82%, transparent); text-decoration: none; font-weight: 600;
}
.app-nav a:hover { background: color-mix(in srgb, var(--ink-fg) 10%, transparent); color: var(--ink-fg); }
.app-nav a[aria-current="page"] { background: color-mix(in srgb, var(--ink-fg) 14%, transparent); color: var(--ink-fg); box-shadow: inset 3px 0 0 var(--accent); }
.app-nav .badge { margin-left: auto; background: var(--accent); color: #1b1f3b; font-size: .72rem; font-weight: 800; padding: .05rem .45rem; border-radius: 999px; }
.sidebar-foot { margin-top: auto; font-size: .88rem; display: flex; flex-direction: column; gap: .6rem; }
.sidebar-foot .who strong { display: block; color: var(--ink-fg); }
.sidebar-foot .who span { opacity: .7; text-transform: capitalize; }
.sidebar-foot .btn { color: var(--ink-fg); border-color: color-mix(in srgb, var(--ink-fg) 30%, transparent); background: transparent; }
.sidebar-foot .btn.is-current { background: color-mix(in srgb, var(--ink-fg) 14%, transparent); }
.sidebar-foot .btn:hover { background: color-mix(in srgb, var(--ink-fg) 10%, transparent); color: var(--ink-fg); }

.app-content { min-width: 0; }
.app-main { min-width: 0; padding: 1.5rem max(16px, env(safe-area-inset-right, 0px)) 3rem max(16px, 1.5rem); }
.app-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.app-top h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0; }
.app-top p { margin: .25rem 0 0; color: var(--muted); }

.mobile-bar { display: none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 85vw); z-index: 50; transform: translateX(-105%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .mobile-bar {
    display: flex; align-items: center; gap: .75rem; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .5rem max(16px, env(safe-area-inset-right, 0px)) .5rem max(16px, env(safe-area-inset-left, 0px));
  }
  .mobile-bar .brand { font-size: 1.05rem; }
  .scrim { position: fixed; inset: 0; background: rgb(17 19 42 / .5); z-index: 40; }
  .app-main { padding-top: 1rem; }
}

.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); margin-bottom: 1.5rem; }
.dash-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: .6rem; height: .6rem; margin-top: .45rem; border-radius: 50%; background: var(--primary); }
.activity .dot[data-kind="distribution"] { background: var(--accent); }
.activity .dot[data-kind="stock"] { background: var(--urgent); }
.activity time { grid-column: 2; font-size: .8rem; color: var(--muted); }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.mini-list li { display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* Intake lines */
.line-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem; display: grid; gap: 1rem; }
.line-item[data-rejected="true"] { border-color: var(--urgent); background: color-mix(in srgb, var(--urgent-soft) 45%, var(--surface)); }
.line-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.line-head h3 { margin: 0; font-size: 1rem; }
.category-picker { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
.category-picker input { position: absolute; opacity: 0; }
.category-picker label {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  padding: .7rem .5rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; font-size: .85rem; background: var(--surface); min-height: 84px; justify-content: center;
}
.category-picker label .icon { width: 1.6rem; height: 1.6rem; }
.category-picker input:checked + label { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface-2); }
.category-picker input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.sticky-actions {
  position: sticky; bottom: env(safe-area-inset-bottom, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line); padding-block: .85rem; margin-top: 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}

/* Filters bar */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { flex: 1 1 180px; }

/* Chart (SVG drawn by reports.js) */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis text, .chart .label { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid-line { stroke: var(--line); }
.chart .bar-in { fill: var(--primary); }
.chart .bar-out { fill: var(--accent); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }

/* Receipt */
.receipt { max-width: 760px; margin: 0 auto; }
.receipt .card { padding: clamp(1.25rem, 4vw, 2.5rem); }
.receipt-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--fg); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.receipt .statement { font-size: .92rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.25rem; }

@media print {
  .sidebar, .mobile-bar, .no-print, .toast-region { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Small additions for reports, settings and tables */
.bar-in-swatch  { background: var(--primary); }
.bar-out-swatch { background: var(--accent); }
td input[type="number"] { max-width: 7rem; min-height: 40px; padding: .4rem .5rem; }
.target-input { max-width: 6.5rem; }
tfoot th, tfoot td { background: var(--surface-2); border-bottom: 0; }
.app-main .callout { margin-bottom: 1.25rem; }

/* =====================================================================
   Pages added in step 3
   ===================================================================== */

/* Register */
.register-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .register-layout { grid-template-columns: minmax(0, 1fr); } }
.preset-preview { position: sticky; top: calc(80px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: .75rem; }
.preset-preview ul { list-style: none; margin: 0; padding: 0; }
.type-picker { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
fieldset.card > legend { float: left; width: 100%; margin-bottom: .25rem; }
fieldset.card > legend + * { clear: both; }
.pw-rules { list-style: none; margin: .1rem 0 0; padding: 0; font-size: .82rem; color: var(--muted); display: grid; gap: .15rem; }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--stocked); }
.pw-rules li.ok::before { content: "✓ "; }

/* Donation guidelines on the public page */
.guidelines { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.guidelines h3 { display: flex; align-items: center; gap: .4rem; font-size: 1rem; }
.guidelines ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.guidelines .yes h3 { color: var(--stocked); }
.guidelines .no h3 { color: var(--urgent); }

/* Request form lines */
.request-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 7rem) minmax(0, 2fr) auto; gap: .75rem; align-items: end; }
@media (max-width: 700px) { .request-line { grid-template-columns: minmax(0, 1fr) minmax(0, 6rem); } .request-line .btn-icon { justify-self: end; } }
.request-line + .request-line { border-top: 1px solid var(--line); padding-top: 1rem; }
.request-line .btn-icon { min-height: 44px; }

/* Status tabs (requests) */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tabs button {
  font: 600 .92rem var(--font-body); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: .6rem .9rem; border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; gap: .4rem; align-items: center; min-height: 44px;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-2); color: var(--fg); border-radius: 999px; padding: 0 .45rem; font-size: .78rem; font-variant-numeric: tabular-nums; }

.request-card { display: grid; gap: .9rem; }
.request-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; color: var(--muted); font-size: .88rem; }
.request-meta strong { color: var(--fg); }
.req-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.req-lines li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); }
.req-lines .cat-icon { width: 2.2rem; height: 2.2rem; }
.req-lines .cat-icon .icon { width: 1.2rem; height: 1.2rem; }
.req-lines input[type="number"] { width: 5.5rem; min-height: 40px; padding: .35rem .5rem; }
.stock-note { font-size: .82rem; }
.stock-note.short { color: var(--urgent); font-weight: 700; }
.pill-pending   { background: var(--accent-soft); color: var(--needed); }
.pill-approved  { background: var(--surface-2); color: var(--primary); }
.pill-fulfilled { background: var(--stocked-soft); color: var(--stocked); }
.pill-declined  { background: var(--urgent-soft); color: var(--urgent); }
.decision { font-size: .9rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); }

/* Drop-off schedule */
.slot-day { display: grid; gap: .75rem; }
.slot-day h2 { font-size: 1rem; margin: 1rem 0 0; color: var(--muted); }
.slot-card { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
@media (max-width: 760px) { .slot-card { grid-template-columns: minmax(0, 1fr); } }
.slot-card .time { font: 700 1.05rem var(--font-display); }
.slot-card.past { opacity: .65; }
.booking-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.booking-list li { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; }
.capacity { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.capacity .meter { width: 6rem; }

/* Team */
.temp-password { font: 700 1.2rem var(--font-mono); letter-spacing: .05em; background: var(--surface-2); padding: .6rem .8rem; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.role-select { max-width: 11rem; min-height: 40px; padding: .35rem .5rem; }

/* Activity */
.activity-table td:first-child { white-space: nowrap; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

/* Banners */
.banner { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent); margin-bottom: 1.25rem; }
.banner .icon { margin-top: .15rem; }
.banner p { margin: 0; }

/* Receipt code box */
.code-box { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .9rem; }
.code-box code { font-size: 1.05rem; font-weight: 700; letter-spacing: .06em; }
.lookup-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.lookup-form .field { flex: 1 1 220px; }

.footer-subhead { margin-top: 1.25rem; }
.cta-row { margin-top: 1.5rem; }
.auth-card { display: flex; flex-direction: column; gap: 1rem; }
