/* Iphtah colours (memory user-iphtah-colours): Desert Sage #A7AE9E and 5645 C #A3B2A4 for large forms,
   #3E493E for text and small dark forms. Tier colours validated with the dataviz validator (light + dark),
   always shown with their text label (ENGINE / CPU / GPU), never colour alone. */
:root {
  --sage: #A7AE9E; --sage2: #A3B2A4; --ink: #3E493E; --ink2: #5b665b; --bg: #fbfcfa; --card: #ffffff;
  --line: #dfe3db; --engine: #2f8a5a; --cpu: #c0631e; --gpu: #4b5fd0; --warn: #9a3412;
}
:root[data-theme="dark"] {
  --ink: #e6ebe3; --ink2: #b9c2b5; --bg: #1a1d1a; --card: #232823; --line: #3a423a;
  --engine: #3fa06c; --cpu: #d9772f; --gpu: #6f7ff0; --warn: #fdba74;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6ebe3; --ink2: #b9c2b5; --bg: #1a1d1a; --card: #232823; --line: #3a423a;
    --engine: #3fa06c; --cpu: #d9772f; --gpu: #6f7ff0; --warn: #fdba74;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-height: 44px; padding: 0 14px; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gpu); outline-offset: 2px; }
.top { display: flex; justify-content: space-between; gap: 16px; padding: 20px 24px 8px; align-items: flex-start; }
.brand { display: flex; gap: 14px; align-items: flex-start; }
.logo { width: 36px; height: 36px; flex: none; background: var(--sage); clip-path: polygon(50% 0, 100% 100%, 0 100%); margin-top: 4px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
.sub { margin: 0; color: var(--ink2); max-width: 70ch; }
.toggles { display: flex; gap: 8px; flex: none; }
.switcher { padding: 4px 24px 8px; }
.same { margin: 4px 0 8px; font-weight: 600; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 14px; line-height: 1.2; }
.tabs button[aria-selected="true"] { background: var(--sage2); color: #1f261f; border-color: var(--sage); }
.who { font-size: .75rem; opacity: .8; }
.banner { margin: 8px 24px; padding: 10px 14px; border: 2px solid var(--warn); color: var(--warn); border-radius: 8px; font-weight: 700; }
.disclaimer { margin: 4px 24px; color: var(--ink2); font-style: italic; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 24px; }
.controls label { display: flex; gap: 6px; align-items: center; }
#scrub { flex: 1 1 200px; min-width: 160px; height: 44px; accent-color: var(--ink); }
.clock { font-variant-numeric: tabular-nums; min-width: 9ch; }
.grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; padding: 8px 24px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 1rem; margin: 0 0 10px; }
.card h3 { font-size: .9rem; margin: 14px 0 6px; }
.feed-card { grid-row: span 2; }
.engine-card, .how-card { grid-column: span 1; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 640px; overflow: hidden; }
.feed li { border-left: 4px solid var(--line); padding: 4px 8px; overflow-wrap: anywhere; }
.feed li.engine { border-left-color: var(--engine); } .feed li.cpu { border-left-color: var(--cpu); } .feed li.gpu { border-left-color: var(--gpu); }
.feed li.order, .feed li.action { border-left-style: dashed; }
.feed .meta { font-size: .78rem; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.feed .q { margin: 2px 0; }
.feed .a { margin: 2px 0 0; color: var(--ink2); font-size: .9rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; letter-spacing: .02em; }
.badge.engine { background: var(--engine); } .badge.cpu { background: var(--cpu); } .badge.gpu { background: var(--gpu); }
.badge.sim { background: transparent; color: var(--ink); border: 1px solid var(--ink2); }
:root[data-theme="dark"] .badge.engine, :root[data-theme="dark"] .badge.cpu, :root[data-theme="dark"] .badge.gpu { color: #111; }
.lung-wrap { display: flex; gap: 12px; align-items: center; }
.lung { width: 120px; height: 120px; flex: none; }
#orb { fill: var(--sage); transition: r .6s ease, fill .6s ease; }
.s-ACTIVE #orb { fill: var(--gpu); } .s-PROVISIONING #orb { fill: var(--sage2); animation: breathe 1s ease-in-out infinite; }
.s-SLEEPING #orb { animation: breathe 4s ease-in-out infinite; } .s-DRAINING #orb { fill: var(--cpu); }
.s-PREEMPTED #orb { fill: var(--warn); }
@keyframes breathe { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { #orb { animation: none !important; transition: none; } }
.state { font-size: 1.15rem; font-weight: 700; margin: 0; }
.state-why { margin: 2px 0 0; color: var(--ink2); font-size: .85rem; }
.meter { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 10px 0 0; font-size: .82rem; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 4px; }
.trigger { margin: 10px 0 0; font-size: .85rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-width: 0; }
.tile .big { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .small { font-size: .75rem; color: var(--ink2); }
.tile .share { font-size: .8rem; font-variant-numeric: tabular-nums; }
.cost p { margin: 6px 0; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cost b { font-variant-numeric: tabular-nums; }
.price, .receipt { font-size: .8rem; color: var(--ink2); display: block !important; overflow-wrap: anywhere; }
.flow { margin: 0; padding-left: 20px; font-size: .9rem; }
.thr { width: 100%; border-collapse: collapse; font-size: .82rem; }
.thr td { border-top: 1px solid var(--line); padding: 4px 4px; vertical-align: top; overflow-wrap: anywhere; }
.thr td:nth-child(1) { width: 34%; }
.thr td:nth-child(2) { white-space: nowrap; font-weight: 700; }
.how { margin: 0; padding-left: 18px; font-size: .85rem; overflow-wrap: anywhere; }
.how a { color: var(--ink); }
.foot { padding: 0 24px 24px; color: var(--ink2); font-size: .85rem; }
/* The animated layer (flow.js). Asker colours: the dataviz reference categorical slots 1, 2, 3, 5, 7 (then 6, 4), light
   and dark steps validated with its validator; past three slots the all-pairs check cannot pass, so each asker ALSO has
   its own shape and its text label next to it: colour is never the only cue. The routine probe is neutral ink.
   Load colours: the reserved status steps (good / warning / critical), always with their word (calme / chargé / saturé)
   and a fill height, so the load reads without colour too. */
:root { --ak0: #2a78d6; --ak1: #eb6834; --ak2: #1baf7a; --ak3: #e87ba4; --ak4: #6250d6; --ak5: #008300; --ak6: #eda100;
  --ld-calm: #0ca30c; --ld-busy: #fab219; --ld-full: #d03b3b; }
:root[data-theme="dark"] { --ak0: #3987e5; --ak1: #d95926; --ak2: #199e70; --ak3: #d55181; --ak4: #9085e9; --ak5: #008300; --ak6: #c98500; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ak0: #3987e5; --ak1: #d95926; --ak2: #199e70; --ak3: #d55181; --ak4: #9085e9; --ak5: #008300; --ak6: #c98500; }
}
.flow-card { margin: 8px 24px 4px; position: relative; padding: 10px 12px 8px; }
.flow { position: relative; }
.flow-svg { display: block; width: 100%; height: auto; }
.flow-counter { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: flex-end; font-size: .9rem; margin: 0 0 2px; }
.flow-counter b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.flow-counter > span:first-child { text-align: right; }
/* answer-time chart (latency.js): tier colours as the feed badges, a surface ring around each dot, recessive grid */
.latency-card { grid-column: 1 / -1; }
.lt-svg { display: block; max-width: 900px; height: auto; overflow: visible; }
.lt-grid { stroke: var(--line); stroke-width: 1; }
.lt-base { stroke: var(--line); stroke-width: 1; }
.lt-axis { fill: var(--ink2); font-size: 11px; }
.lt-head { fill: var(--ink); font-size: 12px; font-weight: 600; }
.lt-dot { stroke: var(--card); stroke-width: 1.5; }
.lt-dot.engine { fill: var(--engine); } .lt-dot.cpu { fill: var(--cpu); } .lt-dot.gpu { fill: var(--gpu); }
.lt-fb { fill-opacity: 1; stroke: var(--ink); stroke-width: 1; }
.lt-median { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.lt-caption { margin: 6px 0 0; font-size: .8rem; color: var(--ink2); }
.lt-key { vertical-align: -1px; }
.flow-counter .flow-waited { display: block; text-align: right; font-size: .8rem; opacity: .85; }
.flow-legend { font-size: .78rem; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: flex-end; }
.flow-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.sw.calm { background: var(--ld-calm); } .sw.busy { background: var(--ld-busy); } .sw.full { background: var(--ld-full); }
.f-head { font-size: 13px; font-weight: 700; fill: var(--ink2); letter-spacing: .02em; }
.f-label { font-size: 12px; fill: var(--ink); }
.f-name { font-size: 13px; font-weight: 700; fill: var(--ink); }
.f-state { font-size: 11px; fill: var(--ink); }
.f-box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.f-fill { opacity: .32; } .f-fill.calm { fill: var(--ld-calm); } .f-fill.busy { fill: var(--ld-busy); } .f-fill.full { fill: var(--ld-full); }
.l-gpu .f-box { stroke: var(--gpu); stroke-width: 2; transition: width .4s ease; }
.l-gpu.g-SLEEPING .f-box, .l-gpu.g-DELETED .f-box { stroke-dasharray: 5 4; stroke: var(--ink2); }
.l-gpu.g-SLEEPING, .l-gpu.g-DELETED { opacity: .6; }
.l-gpu.g-PROVISIONING .f-box { stroke-dasharray: 8 4; animation: f-breathe 1s ease-in-out infinite; }
.l-gpu.g-PREEMPTED .f-box { stroke: var(--warn); }
@keyframes f-breathe { 50% { stroke-opacity: .35; } }
.f-door line { stroke: var(--ink2); stroke-width: 3; stroke-linecap: round; }
.f-contact path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.glyph { stroke: var(--card); stroke-width: 1.2; }
.glyph.hollow { fill: var(--card) !important; stroke-width: 2; }
.glyph.ring { fill: none; stroke: var(--ink2); stroke-width: 3; }
.ak-0 { fill: var(--ak0); } .ak-1 { fill: var(--ak1); } .ak-2 { fill: var(--ak2); } .ak-3 { fill: var(--ak3); }
.ak-4 { fill: var(--ak4); } .ak-5 { fill: var(--ak5); } .ak-6 { fill: var(--ak6); }
.glyph.hollow.ak-0 { stroke: var(--ak0); } .glyph.hollow.ak-1 { stroke: var(--ak1); } .glyph.hollow.ak-2 { stroke: var(--ak2); }
.glyph.hollow.ak-3 { stroke: var(--ak3); } .glyph.hollow.ak-4 { stroke: var(--ak4); } .glyph.hollow.ak-5 { stroke: var(--ak5); }
.glyph.hollow.ak-6 { stroke: var(--ak6); }
.f-flow { stroke-linecap: round; opacity: .55; } .f-flow.ink { stroke: var(--ink2); }
.f-flow.ak-0 { stroke: var(--ak0); } .f-flow.ak-1 { stroke: var(--ak1); } .f-flow.ak-2 { stroke: var(--ak2); } .f-flow.ak-3 { stroke: var(--ak3); }
.f-flow.ak-4 { stroke: var(--ak4); } .f-flow.ak-5 { stroke: var(--ak5); } .f-flow.ak-6 { stroke: var(--ak6); } .f-flow.ak-n { stroke: var(--ink2); }
.ak-badge { vertical-align: -2px; }
@media (prefers-reduced-motion: reduce) { .l-gpu .f-box { animation: none !important; transition: none !important; } }
body.record { cursor: none; }
body.record .controls, body.record .toggles, body.record .tabs button:not([aria-selected="true"]) { display: none; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr 1fr; } .feed-card { grid-row: auto; grid-column: span 2; } .feed { max-height: 420px; } }
@media (max-width: 700px) {
  .top { flex-direction: column; padding: 14px 14px 4px; } .switcher, .controls { padding-left: 14px; padding-right: 14px; }
  .grid { grid-template-columns: 1fr; padding: 8px 14px 18px; } .feed-card { grid-column: auto; }
  .banner, .disclaimer, .flow-card { margin-left: 14px; margin-right: 14px; } .foot { padding: 0 14px 18px; }
  .tabs button { flex: 1 1 30%; min-width: 0; padding: 6px 8px; font-size: .85rem; overflow-wrap: anywhere; } .tile .big { font-size: 1.4rem; }
  .lung-card { order: 1; } .count-card { order: 2; } .feed-card { order: 3; } .latency-card { order: 3; } .engine-card { order: 4; } .how-card { order: 5; }
  .feed { max-height: 360px; }
}
