/* Yard 7 Stores dashboard.
   Palette: concrete greys, graphite ink, steel blue, with safety yellow kept for
   bands and markers (never text). Type: Barlow (road-sign lineage) for text,
   Barlow Condensed for headings and figures. Every text colour pair is measured
   at 4.5:1 or better in both themes (see the PR for the numbers). */

/* Fonts are served from this site (public/fonts, SIL Open Font License): no
   third-party requests, so the Content-Security-Policy can allow 'self' only. */
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #e9ecea;            /* shed concrete */
  --panel: #ffffff;
  --ink: #1d2327;           /* graphite */
  --ink-2: #47525a;
  --ink-3: #5c666d;
  --rule: #cfd5d4;
  --grid: #e3e7e6;
  --steel: #1d5c8a;         /* links, focus */
  --safety: #f2b705;        /* bands and markers only */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --crit-ink: #a52a1f;
  --crit-bg: #fbe9e6;
  --warn-ink: #7a4f00;
  --warn-bg: #fdf1d6;
  --good-ink: #1d6b35;
  --good-bg: #e5f3e8;
  --neutral-bg: #eceeed;
  --row-alert: #fff6f4;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #12171a; --panel: #1c2328; --ink: #e8ecee; --ink-2: #b4bec4; --ink-3: #9aa5ab;
    --rule: #34404a; --grid: #28323a; --steel: #7fb8e0; --series-1: #3987e5; --series-2: #d95926;
    --crit-ink: #ff9b8f; --crit-bg: #3a1e1b; --warn-ink: #f5c45e; --warn-bg: #352a12;
    --good-ink: #8fd6a2; --good-bg: #17301f; --neutral-bg: #262f36; --row-alert: #2a1f1f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12171a; --panel: #1c2328; --ink: #e8ecee; --ink-2: #b4bec4; --ink-3: #9aa5ab;
  --rule: #34404a; --grid: #28323a; --steel: #7fb8e0; --series-1: #3987e5; --series-2: #d95926;
  --crit-ink: #ff9b8f; --crit-bg: #3a1e1b; --warn-ink: #f5c45e; --warn-bg: #352a12;
  --good-ink: #8fd6a2; --good-bg: #17301f; --neutral-bg: #262f36; --row-alert: #2a1f1f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: "Barlow Condensed", "Barlow", system-ui, sans-serif; font-weight: 700; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--steel); }
:focus-visible { outline: 3px solid var(--steel); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--panel); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

/* --- the sign ---------------------------------------------------------- */
.sign { background: var(--panel); border-bottom: 6px solid var(--safety); }
.sign-inner {
  max-width: 1200px; margin: 0 auto; padding: 1.5rem 16px 1.25rem;
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; justify-content: space-between;
}
.sign-name { font-size: clamp(2.6rem, 1.8rem + 4vw, 4.5rem); letter-spacing: .01em; }
.sign-tagline { color: var(--ink-2); font-size: 1.1rem; max-width: 34ch; margin-top: .35rem; }
.sign-meta { display: grid; gap: .4rem; justify-items: start; }
.sim-badge {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 600;
  background: var(--neutral-bg); padding: .3rem .7rem .3rem .45rem; border-radius: 4px;
}
.sim-badge-mark {
  width: 1.1rem; height: 1.1rem; border-radius: 2px; flex: none;
  background: repeating-linear-gradient(135deg, var(--safety) 0 4px, var(--ink) 4px 8px);
}
.asof { color: var(--ink-2); }
.asof time { color: var(--ink); font-weight: 600; }
.theme-toggle {
  font: inherit; font-size: .9rem; color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 4px; padding: .2rem .6rem; cursor: pointer;
}

/* --- layout ------------------------------------------------------------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 3rem; }
main > section { padding-top: 2.75rem; }
.section-head { display: grid; gap: .4rem; margin-bottom: 1rem; }
.lede { color: var(--ink-2); max-width: 70ch; }
.footnote { color: var(--ink-2); font-size: .9rem; max-width: 80ch; margin-top: .5rem; }

/* --- critical spares ---------------------------------------------------- */
.critical { padding-top: 2rem; }
/* Fixed column counts that divide the tile count evenly, so no empty cell shows the rule colour. */
.counters { display: grid; grid-template-columns: 1fr; gap: 2px; background: var(--rule); border: 2px solid var(--rule); margin-bottom: 1rem; }
@media (min-width: 520px) { .counters { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .counters { grid-template-columns: repeat(4, 1fr); } }
.counter { background: var(--panel); padding: 1rem 1.1rem; display: grid; gap: .15rem; align-content: start; }
.counter-value { font: 700 2.4rem/1 "Barlow Condensed", "Barlow", sans-serif; }
.counter-label { color: var(--ink-2); }
.counter.is-alert { box-shadow: inset 6px 0 0 var(--crit-ink); }
.history-note { max-width: 75ch; margin: 0 0 1rem; padding-left: .9rem; border-left: 4px solid var(--safety); font-size: 1.05rem; }
.history-note:empty { display: none; }
.waiting { margin-bottom: 1rem; }
.waiting-card { background: var(--panel); border: 1px solid var(--rule); border-left: 6px solid var(--crit-ink); padding: .8rem 1rem; }
.waiting-card h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.waiting-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .25rem; }
.board-controls { margin: .25rem 0 .6rem; }
.check { display: inline-flex; gap: .5rem; align-items: center; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--steel); }

/* --- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--grid); vertical-align: top; }
thead th { color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--rule); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.part { display: grid; gap: .1rem; min-width: 12rem; }
.part-no { font-weight: 600; letter-spacing: .02em; }
.part-desc { color: var(--ink-2); }
.board tr.is-urgent td { background: var(--row-alert); }
.empty { color: var(--ink-2); padding: 1rem; }

/* status chips: colour plus a shape plus the words, never colour alone */
.status { display: inline-flex; align-items: center; gap: .4rem; padding: .1rem .5rem; border-radius: 4px; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.status::before { content: ""; width: .6rem; height: .6rem; flex: none; }
.status-critical { color: var(--crit-ink); background: var(--crit-bg); }
.status-critical::before { background: currentColor; transform: rotate(45deg); }
.status-warning { color: var(--warn-ink); background: var(--warn-bg); }
.status-warning::before { border: 2px solid currentColor; border-radius: 50%; }
.status-good { color: var(--good-ink); background: var(--good-bg); }
.status-good::before { background: currentColor; border-radius: 50%; }
.status-neutral { color: var(--ink-2); background: var(--neutral-bg); }
.status-neutral::before { border: 2px solid currentColor; }

/* --- charts ------------------------------------------------------------- */
.chart { margin: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: .75rem .5rem .5rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ink-2); font: 400 12px "Barlow", system-ui, sans-serif; }
.chart .tick-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--rule); stroke-width: 1; }
.chart .label-strong { fill: var(--ink); font-weight: 600; }
.chart .hold { fill: var(--panel); stroke: var(--series-1); stroke-width: 2.5; }
.chart .expect { fill: var(--series-2); stroke: var(--panel); stroke-width: 2; }
.chart .connector { stroke: var(--ink-3); stroke-width: 1.5; }
.chart .line-1 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-1 { fill: var(--series-1); opacity: .1; }
.chart .dot-1 { fill: var(--series-1); stroke: var(--panel); stroke-width: 2; }
.chart .dot-2 { fill: var(--series-2); stroke: var(--panel); stroke-width: 2; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .row-hit { fill: transparent; }
.chart .row-hit:hover, .chart .row-hit:focus { fill: var(--grid); outline: none; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0 0 .5rem; color: var(--ink-2); font-size: .95rem; }
.legend-item { display: inline-flex; align-items: center; gap: .45rem; }
.swatch { display: inline-block; flex: none; }
.swatch-hold { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--series-1); }
.swatch-expect { width: 12px; height: 12px; border-radius: 50%; background: var(--series-2); }
.swatch-line1 { width: 18px; height: 3px; background: var(--series-1); border-radius: 2px; }
.swatch-line2 { width: 18px; height: 3px; background: var(--series-2); border-radius: 2px; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.25rem; }
.trend { display: grid; gap: .5rem; align-content: start; }
.table-view { margin-top: .75rem; }
.table-view summary { cursor: pointer; color: var(--steel); font-weight: 600; margin-bottom: .5rem; }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 280px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px;
  padding: .5rem .65rem; font-size: .9rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.tooltip strong { display: block; }
.tooltip span { color: var(--ink-2); }

/* --- whole-store figures ------------------------------------------------ */
.figures { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: var(--rule); border: 2px solid var(--rule); }
@media (min-width: 760px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figure { background: var(--panel); padding: .9rem 1rem; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: .2rem; }
.figure dt { color: var(--ink-2); }
.figure dd { margin: 0; font: 700 1.9rem/1.05 "Barlow Condensed", "Barlow", sans-serif; }
.figure .figure-note { color: var(--ink-2); font: 400 .85rem/1.3 "Barlow", sans-serif; }

/* --- exceptions tabs ----------------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.tab {
  font: 600 1rem "Barlow", sans-serif; color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 4px; padding: .4rem .8rem; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.tab-count { font-weight: 400; margin-left: .3rem; }
.tab-panel[hidden] { display: none; }
.panel-note { color: var(--ink-2); margin-bottom: .5rem; max-width: 75ch; }

/* --- item lookup -------------------------------------------------------- */
.search { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; max-width: 560px; margin-bottom: 1rem; }
.search label { font-weight: 600; }
.search-row { display: flex; gap: .5rem; }
.search input {
  flex: 1; min-width: 0; width: 100%; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--ink-3); border-radius: 4px; padding: .5rem .65rem;
}
.search input::placeholder { color: var(--ink-3); }
.search button, .result-btn {
  font: 600 1rem "Barlow", sans-serif; color: var(--panel); background: var(--steel);
  border: 0; border-radius: 4px; padding: .5rem 1rem; cursor: pointer;
}
.lookup-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 900px) { .lookup-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.results { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; max-height: 460px; overflow-y: auto; }
.results:empty { display: none; }
.results li + li { border-top: 1px solid var(--grid); }
.result-link {
  display: flex; justify-content: space-between; gap: .75rem; width: 100%; text-align: left;
  font: inherit; color: var(--ink); background: transparent; border: 0; padding: .55rem .75rem; cursor: pointer;
}
.result-link:hover { background: var(--grid); }
.result-link .part-desc { display: block; }
.item-detail:empty { display: none; }
.item-detail { background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: 1rem; display: grid; gap: .9rem; align-content: start; }
.item-detail h3 { font-size: 1.5rem; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem 1rem; }
.facts dt { color: var(--ink-2); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 600; }

/* --- footer ------------------------------------------------------------- */
.foot { border-top: 6px solid var(--safety); background: var(--panel); padding: 1.25rem 0 2rem; }
.foot p { max-width: 1200px; margin: 0 auto; padding: 0 16px; color: var(--ink-2); }
.foot p + p { margin-top: .6rem; }
.maker-link { color: var(--ink); font-weight: 600; text-decoration-color: var(--safety); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.maker-link:hover { color: var(--steel); }

/* --- 404 page ----------------------------------------------------------- */
.not-found-page { min-height: 100vh; display: flex; flex-direction: column; }
.not-found-page .not-found { flex: 1; width: 100%; }
.home-link { color: inherit; text-decoration: none; }
.not-found-name { font-family: "Barlow Condensed", "Barlow", system-ui, sans-serif; font-weight: 700; line-height: 1.1; }
.not-found { max-width: 1200px; margin: 0 auto; padding: 3rem 16px 4rem; display: grid; gap: 1rem; justify-items: start; align-content: start; }
.not-found h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); }
.not-found-button { display: inline-block; font-weight: 600; color: var(--panel); background: var(--steel); border-radius: 4px; padding: .55rem 1.1rem; text-decoration: none; }

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