/* THE STOCK FLOW EXPLORER'S LOOK IS THE SITE'S. The colours, the type, the figure frame and
   the animation bar are carried over from make_site.py's TEMPLATE so the explorer reads as
   the same diagram with switches beside it, not a different tool. Written by hand, copied
   as it is by site/make_explorer.py. */
:root { --ink:#1b1b1f; --muted:#5f6470; --line:#e3e5ea; --brand:#e35205; --bg:#fcfcfd;
        --red:#c5221f; --cascade:#8e1b1b; --unmet:#e8710a; --short:#e0a106; --floor:#f2b632;
        --outbreak:#7b3fbf; --wo:#9aa0a6; --soft:#f6f7f9; --session:#b5651d; }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink);
       font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }
/* BUILT FOR A LAPTOP, like the site: the diagram takes what is left of about 1300px after
   a 410px side panel, and below 1100px the panel goes under it. */
.wrap { max-width:1340px; margin:0 auto; padding:12px 28px 40px; }
/* THE HEADER IS ONE LINE (the page review, 6 Oct): a title, an intro and a four-sentence
   caveat took 210 px, which put the Play button and the timeline below the fold on a
   1440x900 laptop. The caveat's first sentence stays in view; the rest opens in place. */
header { display:flex; align-items:baseline; gap:14px; flex-wrap:wrap; }
h1 { font-size:1.35rem; line-height:1.15; margin:0; letter-spacing:-0.015em;
     white-space:nowrap; }
h1 .qm { font-size:.8rem; font-weight:650; color:#fff; background:var(--brand);
         border-radius:999px; padding:3px 10px; vertical-align:middle; letter-spacing:0; }
/* THE CAVEAT IS ALWAYS VISIBLE. Every picture on this page is a model's prediction, and a
   reader who only looks at the diagram must still be told so. */
.caveat { flex:1 1 420px; border:1px solid #f0c9a8; background:#fff7f0; border-radius:10px;
          padding:4px 12px; font-size:.84rem; color:#5a3a1e; }
.caveat b { color:#8a3a00; }
.caveat a { color:#8a3a00; }
.caveat details summary { cursor:pointer; list-style:none; }
.caveat details summary::-webkit-details-marker { display:none; }
.caveat details summary .more { color:#8a3a00; text-decoration:underline; margin-left:6px;
                                white-space:nowrap; }
.caveat details[open] summary .more { display:none; }
.caveat ul { margin:4px 0 4px 18px; padding:0; }
.main { display:grid; grid-template-columns:minmax(0, 1fr) 410px; gap:18px; margin-top:10px;
        align-items:start; }
@media (max-width:1100px) { .main { grid-template-columns:1fr; } }
.anim { position:relative; margin:0; text-align:left; border:1px solid var(--line);
        border-radius:12px; background:#fff; padding:8px 14px 10px; }
/* THE TIMELINE SITS ABOVE THE DIAGRAM AND THE DIAGRAM FITS THE WINDOW: on a laptop the
   680-wide drawing scaled to the column's width is taller than the screen, and a Play
   button under it was below the fold (y=918 at 1440x900). explorer.js sets the svg's
   max-height to what is left of the window under the bar; this is the fallback. */
.svgbox { position:relative; }
.svgbox > svg { width:100%; height:auto; display:block; max-height:calc(100vh - 130px);
                min-height:380px; }
.anim.stale .svgbox > svg, .anim.stale .strip { opacity:.35; filter:grayscale(.8); }
.animbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.animbtn { font:inherit; font-size:.86rem; font-weight:650; padding:4px 13px;
           border-radius:8px; background:#fff; color:var(--brand);
           border:1.5px solid var(--brand); cursor:pointer;
           transition:background .15s, color .15s; }
.animbtn:hover, .animbtn.on { background:var(--brand); color:#fff; }
.speeds { display:inline-flex; gap:2px; }
.speeds button { font:inherit; font-size:.76rem; padding:2px 6px; border-radius:6px;
                 border:1px solid var(--line); background:#fff; color:var(--muted);
                 cursor:pointer; }
.speeds button.on { border-color:var(--ink); color:var(--ink); font-weight:650; }
.animmonth { font-size:.92rem; font-variant-numeric:tabular-nums; min-width:4.6em;
             font-weight:650; }
.animvol { font-size:.8rem; color:var(--muted); font-variant-numeric:tabular-nums;
           min-width:14em; text-align:right; }
.animbar input[type=range] { flex:1; min-width:140px; accent-color:var(--brand); }
text.animlab { font-size:8px; fill:var(--ink); }
text.animlvl { font-size:7.5px; fill:var(--muted); }
text.mk { font-size:7px; font-weight:700; paint-order:stroke; stroke:#fff; stroke-width:2.2px;
          stroke-linejoin:round; }
text.mkw { font-size:6.6px; font-weight:700; fill:#fff; }
g.node { cursor:pointer; }
g.node:hover circle.ring { stroke-width:2.6; }
/* THE OUTBREAK PULSES, gently: the one flag that is a cause rather than a symptom */
.halo { animation:pulse 1.6s ease-in-out infinite; transform-box:fill-box;
        transform-origin:center; }
@keyframes pulse { 0%,100% { opacity:.25; transform:scale(.9); }
                   50% { opacity:.6; transform:scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .halo { animation:none; opacity:.45; } }
/* THE FLAG STRIP: one cell per month under the scrub, coloured by that month's most
   serious WAREHOUSE flag (a cascade, a doses short, a short at a national, regional or
   district store, a floor), with the rough Facility and Unit flags as a thin band at the
   foot and the outbreak's months underlined in purple. Coloured by every flag it was red
   or amber in 32 of today's 36 months, which said nothing (the page review). */
.strip { display:grid; grid-template-columns:repeat(36, 1fr); gap:1px; margin-top:6px;
         height:16px; }
.strip div { background:#eef0f3; border-radius:2px; cursor:pointer; position:relative;
             overflow:visible; }
.strip div i { position:absolute; left:0; right:0; bottom:0; height:4px;
               border-radius:0 0 2px 2px; }
.stripnote { font-size:.7rem; color:var(--muted); margin:5px 0 0; display:flex;
             justify-content:space-between; gap:8px; }
.strip div.cur { outline:2px solid var(--ink); outline-offset:0; }
.strip div.ob::after { content:""; position:absolute; left:0; right:0; bottom:-4px; height:3px;
                       background:var(--outbreak); border-radius:2px; }
.legend { display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:12px; font-size:.76rem;
          color:var(--muted); }
.legend span { display:inline-flex; align-items:center; gap:5px; }
.legend i { display:inline-block; width:10px; height:10px; border-radius:2px; }
.notrun { position:absolute; left:0; right:0; top:4px; z-index:2; background:#fff;
          border:1.5px solid var(--red); border-radius:10px; padding:10px 12px;
          box-shadow:0 6px 18px rgba(0,0,0,.08); font-size:.88rem; }
.notrun b { color:var(--red); }
.card code, .how code { font-size:.78rem; background:var(--soft);
          border:1px solid var(--line); border-radius:5px; padding:1px 5px;
          overflow-wrap:anywhere; }
/* THE COMMAND IS ONE LINE THAT SCROLLS, with a Copy button: break-all split it mid-word
   ("pyt / hon3") and a command broken across lines is easy to copy wrong */
.notrun .cmd { display:flex; gap:6px; align-items:center; margin-top:4px; }
.notrun .cmd code { flex:1; min-width:0; font-size:.76rem; background:var(--soft);
          border:1px solid var(--line); border-radius:5px; padding:3px 6px;
          white-space:nowrap; overflow-x:auto; display:block; }
.notrun .near { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
/* THE B - A SENTENCE SITS ABOVE THE DIAGRAM, NOT ON IT: laid over the top it hid the
   national stores' labels; explorer.js refits the diagram when it comes and goes */
.diffpill { font-size:.8rem; background:#fff; border:1px solid var(--ink); border-radius:10px;
            padding:4px 10px; margin:6px 0 2px; }
.diffpill .muted { font-size:.74rem; }
.chip { font:inherit; font-size:.8rem; border:1px solid var(--line); border-radius:999px;
        padding:2px 10px; background:#fff; cursor:pointer; color:var(--ink); }
.chip:hover { border-color:var(--brand); color:var(--brand); }
/* THE SIDE PANEL IS A COLUMN THAT FITS THE WINDOW: the status and the card stay put while
   the tab's own list scrolls, so a flag's card and the list it came from are both in view */
.side { border:1px solid var(--line); border-radius:12px; background:#fff; padding:10px 12px;
        position:sticky; top:10px; max-height:calc(100vh - 20px); display:flex;
        flex-direction:column; }
.side .pane { overflow:auto; flex:1 1 auto; min-height:140px; }
@media (max-width:1100px) { .side { position:static; max-height:none; } }
.status { font-size:.86rem; margin-bottom:8px; }
.status .now { font-weight:650; }
.status .id { color:var(--muted); font-size:.78rem; }
.status .delta { color:var(--muted); font-size:.8rem; margin-top:3px; }
.status .delta b.up { color:var(--red); } .status .delta b.down { color:#137333; }
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:8px; }
.tabs button { font:inherit; font-size:.88rem; background:none; border:none;
               border-bottom:2.5px solid transparent; padding:5px 10px; cursor:pointer;
               color:var(--muted); }
.tabs button.on { color:var(--ink); border-bottom-color:var(--brand); font-weight:650; }
.pane h3 { font-size:.8rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted);
           margin:12px 0 4px; display:flex; align-items:center; gap:6px; }
.pane h3 .sp { flex:1; }
.presets { display:grid; grid-template-columns:1fr 1fr; gap:5px; }
.presets button { font:inherit; font-size:.84rem; padding:5px 6px; border-radius:8px;
                  border:1px solid var(--line); background:#fff; cursor:pointer; }
.presets button.on { border-color:var(--brand); color:var(--brand); font-weight:650;
                     background:#fff7f0; }
.mini { font:inherit; font-size:.72rem; padding:1px 7px; border-radius:6px;
        border:1px solid var(--line); background:#fff; cursor:pointer; color:var(--muted);
        text-transform:none; letter-spacing:0; }
.mini:hover { color:var(--ink); border-color:var(--ink); }
.rule { display:flex; gap:8px; align-items:flex-start; padding:3px 0; font-size:.86rem; }
.rule input { margin-top:3px; accent-color:var(--brand); }
.rule label { cursor:pointer; }
.rule.off { color:#9aa0a6; }
.rule.off label { cursor:default; }
.rule .why { display:block; font-size:.74rem; color:#9aa0a6; line-height:1.35; }
.rule .note { display:block; font-size:.74rem; color:var(--muted); line-height:1.35; }
/* THE RULES QUICK MODE CANNOT SHOW ARE ONE LINE UNTIL OPENED (the page review): eight
   greyed rules with two or three lines of reasons each pushed the Disruption layer 854 px
   and the Outbreak 1,284 px down a 682 px panel */
.inert { margin-top:10px; font-size:.84rem; }
.inert summary { cursor:pointer; color:var(--muted); }
.inert .rule { padding-left:4px; }
.tag { display:inline-block; font-size:.68rem; border-radius:5px; padding:0 5px;
       background:#eef0f3; color:var(--muted); margin-left:4px; white-space:nowrap; }
.tag.yet { background:#fdf0e3; color:#8a4a00; }
.tag.reach { background:#e8f0fe; color:#1a4fa0; }
.tag.rough { background:#fff3d6; color:#7a5800; }
.tag.open { background:#e8f0fe; color:#1a4fa0; }
.pick { width:100%; font:inherit; font-size:.85rem; padding:4px; border-radius:7px;
        border:1px solid var(--line); background:#fff; }
.opt { font-size:.84rem; display:flex; gap:6px; align-items:center; margin-top:6px; }
/* THE FILTERS STAY AT THE TOP OF THE LIST (the page review): the list follows the
   timeline by scrolling its pane, which scrolled the filters 4,199 px out of sight */
.fhead { position:sticky; top:0; z-index:2; background:#fff; padding-bottom:2px;
         border-bottom:1px solid var(--line); margin-bottom:4px; }
.filters { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:6px; }
.filters label { font-size:.76rem; border:1px solid var(--line); border-radius:999px;
                 padding:1px 8px 1px 4px; display:inline-flex; gap:4px; align-items:center;
                 cursor:pointer; }
.filters input { margin:0; }
.fmonth { font-size:.74rem; color:var(--muted); font-weight:650; margin:8px 0 2px;
          border-bottom:1px solid var(--line); cursor:pointer; }
.fmonth.cur { color:var(--brand); border-bottom-color:var(--brand); }
.frow { display:flex; gap:6px; align-items:flex-start; font-size:.8rem; padding:3px 4px;
        border-radius:6px; cursor:pointer; line-height:1.35; }
.frow:hover { background:var(--soft); }
.frow.sel { background:#fff1e6; }
.frow .dot { flex:none; width:9px; height:9px; border-radius:50%; margin-top:4px; }
.frow details summary { cursor:pointer; }
.frow .sub { font-size:.74rem; color:var(--muted); margin:2px 0 0 4px; }
.k-cascade { background:var(--cascade); } .k-stockout, .k-doses { background:var(--red); }
.k-unmet { background:var(--unmet); } .k-short { background:var(--short); }
.k-floor { background:var(--floor); } .k-outbreak { background:var(--outbreak); }
.k-writeoff { background:var(--wo); } .k-session { background:var(--session); }
.card { margin:0 0 8px; border:1px solid var(--line); border-radius:10px; background:#fffdfa;
        padding:10px 12px; font-size:.84rem; position:relative; flex:none; max-height:52vh;
        overflow:auto; }
.card h4 { margin:0 0 4px; font-size:1rem; padding-right:20px; }
.card .x { position:absolute; right:10px; top:6px; border:none; background:none;
           font-size:1.2rem; color:var(--muted); cursor:pointer; }
.card table, .cmp table { border-collapse:collapse; font-size:.8rem; margin-top:6px;
                          font-variant-numeric:tabular-nums; }
.card td, .card th, .cmp td, .cmp th { padding:2px 8px 2px 0; text-align:right;
                                       border-bottom:1px solid var(--line); }
/* A MONTH NEVER WRAPS ("2025-/11" in the review); a store name in the first column may */
.card td, .card th { white-space:nowrap; }
.card td:first-child { white-space:normal; }
.card th, .cmp th { color:var(--muted); font-weight:600; }
.card td:first-child, .card th:first-child, .cmp td:first-child, .cmp th:first-child
  { text-align:left; }
.card .gone { margin:6px 0 4px; font-size:.84rem; }
.card .gone button { margin:2px 4px 2px 0; }
.muted { color:var(--muted); }
.cmp .pickrow { display:grid; grid-template-columns:22px 1fr; gap:4px 6px;
                align-items:center; font-size:.84rem; }
.cmp td.up { color:var(--red); } .cmp td.down { color:#137333; }
.cmp .scope { display:flex; gap:10px; font-size:.8rem; margin-top:6px; }
.how { margin-top:16px; border:1px solid var(--line); border-radius:12px; background:#fff;
       padding:10px 14px; font-size:.86rem; }
.how summary { cursor:pointer; font-weight:650; }
.how dt { font-weight:650; margin-top:6px; }
.how dd { margin:0 0 0 0; color:var(--muted); }
footer { margin-top:14px; font-size:.76rem; color:var(--muted); }
.diffpill b.up { color:var(--red); } .diffpill b.down { color:#137333; }
.notrunnote { font-size:.8rem; border:1px solid var(--red); border-radius:8px; padding:4px 8px;
              margin:4px 0; }
.notrunnote b { color:var(--red); }
