/* ─────────────────────────────────────────────────────────────────────────
   Leaf design system — shared warm-neutral layer.
   The canonical home for the tokens + primitives first established by the
   Billing Ledger. New views (Day Matrix, …) consume this; the ledger migrates
   onto it in a later pass. Scoped to .leaf-ds so it never bleeds into the
   Material/MudBlazor chrome. Fonts (Manrope, JetBrains Mono) load in _Layout.
   ───────────────────────────────────────────────────────────────────────── */

.leaf-ds {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --ink-1: #1b1a17;
    --ink-2: #5b5953;
    --ink-3: #8a8881;
    --ink-4: #c8c5be;
    --line: #e9e6df;
    --line-2: #efece5;
    --accent: #2f7a3a;
    --accent-soft: #e6f0e3;
    --accent-ink: #1f4e2a;
    --c-warn-bg: #fbeed0;
    --c-warn-fg: #7a4a06;
    --c-warn-bd: #efd58a;
    --c-conf-bg: #f9dfde;
    --c-conf-fg: #8a1b1a;
    --c-conf-bd: #ebbab8;
    --rv-deliv: #6f6c65;
    --rv-font-ui: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --rv-font-mono: "JetBrains Mono", ui-monospace, monospace;

    font-family: var(--rv-font-ui);
    color: var(--ink-1);
}

/* Per-status token bundles. dot = flag/marker; bar = single-bar fill; ink = text;
   tint = wash/cell bg; line = border. (Cell bars override the fill — see ds-cellbar-fill.) */
.leaf-ds .ds-st-ok     { --st-dot: var(--line);      --st-bar: var(--rv-deliv);  --st-ink: var(--ink-2);     --st-tint: var(--surface-2); --st-line: var(--line); }
.leaf-ds .ds-st-under  { --st-dot: var(--ink-1);     --st-bar: var(--c-warn-fg); --st-ink: var(--c-warn-fg); --st-tint: var(--c-warn-bg); --st-line: var(--c-warn-bd); }
.leaf-ds .ds-st-missed { --st-dot: var(--c-warn-fg); --st-bar: var(--c-warn-fg); --st-ink: var(--c-warn-fg); --st-tint: var(--c-warn-bg); --st-line: var(--c-warn-bd); }
.leaf-ds .ds-st-over   { --st-dot: var(--c-conf-fg); --st-bar: var(--c-conf-fg); --st-ink: var(--c-conf-fg); --st-tint: var(--c-conf-bg); --st-line: var(--c-conf-bd); }
.leaf-ds .ds-st-none   { --st-dot: var(--line);      --st-bar: var(--ink-4);     --st-ink: var(--ink-3);     --st-tint: transparent;      --st-line: var(--line); }

/* ── Text primitives ──────────────────────────────────────────────────────── */
.leaf-ds .ds-eyebrow { font-size: 10.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.leaf-ds .ds-title { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.leaf-ds .ds-subtitle { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.leaf-ds .ds-num { font-family: var(--rv-font-mono); font-variant-numeric: tabular-nums; }

/* ── Status chip ──────────────────────────────────────────────────────────── */
.leaf-ds .ds-chip {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    background: var(--st-tint); color: var(--st-ink); border: 1px solid var(--st-line);
    padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ── Legend ───────────────────────────────────────────────────────────────── */
.leaf-ds .ds-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.leaf-ds .ds-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); }
.leaf-ds .ds-legend-pill { width: 16px; height: 8px; border-radius: 999px; }
.leaf-ds .ds-legend-sq { width: 10px; height: 10px; border-radius: 3px; }
.leaf-ds .ds-legend-div { width: 1px; height: 14px; background: var(--line); }

/* ── Cell bar (6px chain bar for the day matrix) ──────────────────────────────
   Layer widths are set inline as percentages: clamp(v/max,0,1)*100%.
   The delivered fill is the neutral gray by default; rose only when over auth —
   the amber wash (not the fill) carries the under/missed shortfall. */
.leaf-ds .ds-cellbar { position: relative; height: 6px; width: 100%; }
.leaf-ds .ds-cellbar-track { position: absolute; left: 0; top: 0; height: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; box-sizing: border-box; }
.leaf-ds .ds-cellbar-wash { position: absolute; top: 0; height: 100%; background: var(--c-warn-bg); border: 1px solid var(--c-warn-bd); border-left: 0; border-radius: 0 999px 999px 0; box-sizing: border-box; }
.leaf-ds .ds-cellbar-wash--missed { background-image: repeating-linear-gradient(45deg, var(--c-warn-bg) 0 3px, rgba(198,122,6,0.20) 3px 6px); }
.leaf-ds .ds-cellbar-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--rv-deliv); border-radius: 999px; transition: width .3s; }
.leaf-ds .ds-cellbar-fill--over { background: var(--c-conf-fg); }
.leaf-ds .ds-cellbar-tick { position: absolute; top: -2px; height: 10px; width: 0; border-left: 1.5px dashed var(--ink-3); }
