/* Read the mechanism on the left and follow its four-day example on the right. */
.cns-fifo-book-story .cns-fifo-book-step.is-mechanism {
 grid-template-columns:minmax(0,1.08fr) minmax(0,1fr); align-items:start; gap:32px clamp(32px,3vw,44px);
}
.cns-fifo-book-story .is-mechanism > .cns-fifo-book-step-copy { grid-column:1; grid-row:1; max-width:none; }
.cns-fifo-book-story .is-mechanism .cns-fifo-book-lead { display:block; }
.cns-fifo-book-story .is-mechanism .cns-fifo-book-lead > p { max-width:none; margin:0; }
.cns-fifo-book-story .is-mechanism .cns-fifo-book-lead > p + p { margin-top:16px; }
.cns-fifo-book-story .is-mechanism > .cns-fifo-book-figure.is-queue { grid-column:2; grid-row:1; width:100%; align-self:start; }

/* A single vertical sequence keeps all five queue entries readable in the right column. */
@media (min-width:1101px) {
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-fifo-book-drawing { padding:16px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-figure-head { margin-bottom:16px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-figure-head h3 { font-size:24px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-figure-head > p { margin-top:9px; font-size:12px; line-height:1.65; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-day-grid { grid-template-columns:minmax(0,1fr); gap:10px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-day { padding:12px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-day > h4 { margin-bottom:7px; font-size:13px; line-height:1.3; }
 .cns-fifo-book-story .is-mechanism > .is-queue :is(.cns-redrawn-day-flow,.cns-redrawn-queue-line) { grid-template-columns:48px minmax(0,1fr); column-gap:10px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-new-entry { grid-template-columns:auto 28px; grid-template-rows:28px 12px; gap:2px 7px; margin:0 8px 3px 0; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-flow-label { font-size:9px; }
 .cns-fifo-book-story .is-mechanism > .is-queue :is(.cns-redrawn-new-entry,.cns-redrawn-outflow) > .cns-redrawn-token { width:28px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-outflow { grid-template-columns:12px 28px; grid-template-rows:auto 28px; gap:6px 5px; margin-bottom:7px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-waiting { padding:8px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-queue-labels { margin-bottom:6px; font-size:9px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-queue { gap:5px; }
 .cns-fifo-book-story .is-mechanism > .is-queue .cns-redrawn-token { height:28px; font-size:12px; }
 .cns-fifo-book-story .is-mechanism > .is-queue :is(.cns-redrawn-entry-arrow,.cns-redrawn-exit-arrow) { font-size:15px; }
}
@media (max-width:1100px) {
 .cns-fifo-book-story .cns-fifo-book-step.is-mechanism { grid-template-columns:minmax(0,1fr); gap:24px; }
 .cns-fifo-book-story .is-mechanism > :is(.cns-fifo-book-step-copy,.cns-fifo-book-figure.is-queue) { grid-column:1; grid-row:auto; }
}

/* Compact live FIFO: the active balance, age queue and deliveries share one workspace. */
.cns-fifo-flow { position:relative; --fifo-teal:#7ce5c1; --fifo-peach:#efb26f; --fifo-plum:#c1acf5; box-sizing:border-box; width:100%; max-width:none; min-width:0; margin:0; padding:16px; border:1px solid #b6a1e342; border-radius:13px; background:radial-gradient(ellipse at 50% 0%,#c1acf50d,transparent 57%),linear-gradient(145deg,#181722,#0e171d); color:#e6dfef; }
.cns-fifo-flow *, .cns-fifo-flow *::before, .cns-fifo-flow *::after { box-sizing:border-box; }
.cns-fifo-flow .cns-fifo-flow-workspace { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; min-width:0; }
/* Keep the trade animation and its age history together above the full-width delivery pool. */
.cns-fifo-flow .cns-fifo-flow-trade-analysis { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr); align-items:stretch; gap:16px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-trade-panel { display:grid; grid-template-rows:auto auto minmax(0,1fr); align-items:start; gap:8px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-trade-panel > .cns-fifo-flow-exchange { align-self:stretch; min-height:160px; }
.cns-fifo-flow .cns-fifo-flow-heading { display:flex; align-items:center; justify-content:space-between; gap:10px 18px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-heading > div:first-child { min-width:0; }
.cns-fifo-flow .cns-kicker { margin:0 0 3px; color:#b9a8d9; font:9px/1.3 'IBM Plex Mono',monospace; letter-spacing:.07em; }
.cns-fifo-flow .cns-fifo-flow-heading h4 { margin:0; color:#f1e9f8; font-size:25px; font-weight:500; line-height:1.12; letter-spacing:-.035em; }
.cns-fifo-flow .cns-fifo-flow-controls { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)) minmax(90px,.9fr); align-items:stretch; gap:8px; width:100%; min-width:0; margin:0; }
.cns-fifo-flow .cns-fifo-flow-controls :is(button,select) { width:100%; min-width:0; min-height:44px; margin:0; padding:8px; border:1px solid #bda8e745; border-radius:6px; background:#c1acf50b; color:#d7c9e7; font:600 13px/1.3 'IBM Plex Sans',sans-serif; cursor:pointer; }
.cns-fifo-flow .cns-fifo-flow-controls button[data-flow-toggle] { border-color:#7ce5c16b; background:#7ce5c111; color:#b4f0d9; }
.cns-fifo-flow .cns-fifo-flow-controls button:hover { background:#c1acf51a; }
.cns-fifo-flow :is(button,select,[tabindex],summary):focus-visible { outline:2px solid var(--fifo-teal); outline-offset:3px; }
.cns-fifo-flow .flow-speed { display:flex; align-items:center; justify-content:center; gap:5px; min-width:0; color:#a99abf; font-size:10px; }
.cns-fifo-flow .flow-speed select { min-width:0; padding:8px 5px; color-scheme:dark; }
/* Balanced daily inputs frame the fixed total; the restart explanation has its own footer. */
.cns-fifo-flow .cns-fifo-flow-trade-settings {
 display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; gap:4px 8px;
 min-width:0; padding:6px 10px; border:1px solid #c1acf538; border-radius:7px; background:#c1acf507;
}
.cns-fifo-flow .cns-fifo-flow-setting {
 display:grid; align-content:start; justify-items:center; gap:5px; min-width:0;
 color:#cdb8ed; font:500 12px/1.2 'IBM Plex Sans',sans-serif; text-align:center;
}
.cns-fifo-flow .cns-fifo-flow-setting.is-purchases { color:#a1dfbd; }
.cns-fifo-flow .cns-fifo-flow-setting input {
 display:block; width:72px; max-width:100%; min-width:0; height:44px; min-height:44px; margin:0; padding:5px;
 border:1px solid #c1acf56b; border-radius:5px; background:#12121c; color:#e1cef9;
 font:500 18px/1 'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; text-align:center; color-scheme:dark;
}
.cns-fifo-flow .cns-fifo-flow-setting.is-purchases input { border-color:#70d69a61; color:#a7e8c5; }
.cns-fifo-flow .cns-fifo-flow-setting input:focus-visible { outline:2px solid var(--fifo-teal); outline-offset:2px; }
.cns-fifo-flow .cns-fifo-flow-trade-total {
 display:flex; flex-direction:column; align-self:stretch; align-items:center; justify-content:center; gap:3px;
 min-width:0; padding:4px 10px; border-inline:1px solid #c1acf52b; text-align:center;
}
.cns-fifo-flow .cns-fifo-flow-trade-total strong { min-width:0; color:#e2d2ef; font:600 12px/1.3 'IBM Plex Sans',sans-serif; white-space:normal; }
.cns-fifo-flow .cns-fifo-flow-trade-total small { color:#ab9abb; font:10px/1.3 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow p.cns-fifo-flow-settings-note {
 grid-column:1/-1; max-width:none; margin:0; padding-top:4px; border-top:1px solid #c1acf523;
 color:#a99ab9; font:9.5px/1.4 'IBM Plex Sans',sans-serif; text-align:center!important; text-align-last:center!important;
}

/* Customer sellers and buyers trade separately with the market maker. */
.cns-fifo-flow .cns-fifo-flow-exchange {
 display:grid; grid-template-columns:minmax(0,.9fr) 32px minmax(0,1.55fr) 32px minmax(0,.9fr);
 align-items:stretch; gap:5px; min-width:0;
}
.cns-fifo-flow .cns-fifo-flow-customer {
 display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px;
 min-width:0; min-height:160px; margin:0; padding:10px 6px; border:1px solid #70d69a42;
 border-radius:9px; background:linear-gradient(155deg,#70d69a0b,#70d69a02); text-align:center;
}
.cns-fifo-flow .cns-fifo-flow-customer.is-buyer { border-color:#c1acf54d; background:linear-gradient(205deg,#c1acf512,#c1acf503); }
.cns-fifo-flow :is(.cns-fifo-flow-customer,.cns-fifo-flow-dealer-heading) :is(.actor-icon,.cns-fifo-flow-actor-icon) {
 display:grid; flex:none; place-items:center; width:24px; height:24px; color:#9fe3bf;
}
.cns-fifo-flow :is(.actor-icon,.cns-fifo-flow-actor-icon) > svg { display:block; width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.cns-fifo-flow .is-buyer :is(.actor-icon,.cns-fifo-flow-actor-icon),
.cns-fifo-flow .cns-fifo-flow-dealer-heading :is(.actor-icon,.cns-fifo-flow-actor-icon) { color:#cbb8f1; }
.cns-fifo-flow .cns-fifo-flow-customer h5 { margin:0; color:#e4dced; font:500 12px/1.25 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-customer > b { color:#a1e6bf; font:500 14px/1.25 'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; }
.cns-fifo-flow .cns-fifo-flow-customer.is-buyer > b { color:#d0bafa; }
.cns-fifo-flow .cns-fifo-flow-customer > small { color:#a99bb9; font:9px/1.3 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-certificates { display:grid; grid-template-columns:repeat(var(--flow-certificate-columns,4),13px); justify-content:center; gap:3px; min-width:0; min-height:22px; padding-block:2px; }
.cns-fifo-flow .cns-fifo-flow-certificate {
 display:block; flex:none; width:13px; height:18px; padding:1px; border:1px solid #70d69a5c;
 border-radius:2px; background:#70d69a0a; color:#a1e6bf; opacity:.32;
}
.cns-fifo-flow .cns-fifo-flow-certificate > svg { display:block; width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.cns-fifo-flow .is-buyer .cns-fifo-flow-certificate { border-color:#c1acf56b; background:#c1acf50e; color:#d0bafa; }
.cns-fifo-flow .cns-fifo-flow-certificate.is-active { opacity:1; box-shadow:0 0 8px #70d69a18; }
.cns-fifo-flow .is-buyer .cns-fifo-flow-certificate.is-active { box-shadow:0 0 8px #c1acf522; }
.cns-fifo-flow .is-buyer .cns-fifo-flow-certificate.is-confirmed { opacity:1; border-color:#c1acf5b3; background:#c1acf522; }

.cns-fifo-flow .cns-fifo-flow-dealer {
 display:flex; flex-direction:column; justify-content:center; gap:5px; min-width:0; min-height:160px; margin:0;
 padding:8px; border:1px solid #c1acf585; border-radius:10px;
 background:radial-gradient(ellipse at 50% 0%,#c1acf516,transparent 75%),#171722;
 box-shadow:0 3px 18px #03061026,inset 0 1px #e4d2ff0d;
}
.cns-fifo-flow .cns-fifo-flow-dealer-heading { display:flex; align-items:center; gap:7px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-dealer-heading h5 { flex:1; min-width:0; margin:0; color:#f0e5fd; font:500 14px/1.2 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow [data-flow-net-status] { max-width:100px; color:#af9bc9; font:8px/1.25 'IBM Plex Mono',monospace; text-align:right; }
.cns-fifo-flow .cns-fifo-flow-dealer-books { display:grid; gap:5px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-dealer-books > div {
 display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:2px 8px;
 padding:4px 7px; border:1px solid #c1acf52b; border-left:2px solid #c1acf580; border-radius:4px; background:#0b10173d;
}
.cns-fifo-flow .cns-fifo-flow-dealer-books > .is-bought { border-left-color:#70d69a99; }
.cns-fifo-flow .cns-fifo-flow-dealer-books > div > span { color:#bfaed4; font:10.5px/1.25 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-dealer-books b { display:inline-flex; flex:none; align-items:center; gap:4px; color:#ff6876; font:500 18px/1.1 'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; }
.cns-fifo-flow .cns-fifo-flow-dealer-books b::before { content:"+"; color:#ff6876; font-weight:600; }
.cns-fifo-flow .cns-fifo-flow-dealer-books .is-bought b::before { content:"\2212"; color:#ff6876; }
.cns-fifo-flow .cns-fifo-flow-dealer-books small { grid-column:1/-1; color:#a99abc; font:9px/1.3 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-dealer-books small > span { color:inherit; font:inherit; font-variant-numeric:tabular-nums; }
.cns-fifo-flow p.cns-fifo-flow-independent-note { max-width:none; margin:0; color:#ab99bd; font:9px/1.4 'IBM Plex Sans',sans-serif; text-align:center!important; }

/* Packets remain hidden at rest; the simulation animates their trades once per event. */
.cns-fifo-flow .cns-fifo-flow-exchange-lane { display:flex; flex-direction:column; justify-content:center; align-items:stretch; gap:4px; min-width:0; color:#8cdeb1; }
.cns-fifo-flow .cns-fifo-flow-exchange-lane.is-demand { color:#c1acf5; }
.cns-fifo-flow .cns-fifo-flow-exchange-lane > small { color:currentColor; font:7px/1.3 'IBM Plex Sans',sans-serif; text-align:center; white-space:normal; }
.cns-fifo-flow .cns-fifo-flow-trade-track { position:relative; width:100%; height:30px; min-width:0; }
.cns-fifo-flow .cns-fifo-flow-trade-track::before { content:""; position:absolute; top:50%; left:0; right:0; height:1px; background:currentColor; opacity:.35; }
.cns-fifo-flow .cns-fifo-flow-trade-track::after { content:""; position:absolute; top:calc(50% - 3px); right:1px; width:6px; height:6px; border-top:1px solid currentColor; border-right:1px solid currentColor; transform:rotate(45deg); opacity:.7; }
.cns-fifo-flow .is-demand .cns-fifo-flow-trade-track::after { right:auto; left:1px; transform:rotate(-135deg); }
.cns-fifo-flow .cns-fifo-flow-trade-packet { position:absolute; top:50%; left:0; width:11px; height:15px; margin:0; border:1px solid currentColor; border-radius:2px; background:#153126; color:#a1e6bf; opacity:0; pointer-events:none; }
.cns-fifo-flow .cns-fifo-flow-trade-packet > svg { display:block; width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.cns-fifo-flow .cns-fifo-flow-trade-packet.is-cash { display:grid; place-items:center; width:11px; height:11px; border-radius:50%; background:#30291c; color:#e3cd8c; font:7px/1 'IBM Plex Mono',monospace; }
.cns-fifo-flow .cns-fifo-flow-trade-packet.is-order { background:#2b233b; color:#d0bafa; }
.cns-fifo-flow .cns-fifo-flow-trade-packet.is-position { background:#202e41; color:#b3d2fb; }
/* Only the market maker and its delivery pool share the lavender ownership frame. */
.cns-fifo-flow .cns-fifo-flow-pool-area { position:relative; min-width:0; padding-top:10px; }
.cns-fifo-flow .cns-fifo-flow-pool-area::before { content:""; position:absolute; top:-7px; left:calc(27.5% - 4.4px); width:1px; height:17px; background:#c1acf580; }
.cns-fifo-flow .cns-fifo-flow-motion-layer { position:absolute; inset:0; z-index:6; overflow:visible; pointer-events:none; }
.cns-fifo-flow .cns-fifo-flow-flight-token { position:absolute; top:0; left:0; display:grid; place-items:center; width:14px; height:14px; padding:1px; border:1px solid currentColor; border-radius:2px; background:#2d253c; color:#d0bafa; font-style:normal; pointer-events:none; }
.cns-fifo-flow .cns-fifo-flow-flight-token.is-supply { background:#163626; color:#9fe3bf; }
.cns-fifo-flow .cns-fifo-flow-flight-token.is-sale { background:#2d253c; color:#d0bafa; }
.cns-fifo-flow .cns-fifo-flow-flight-token svg { display:block; width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.cns-fifo-flow .cns-fifo-flow-waiting { min-width:0; padding:6px 8px; border:1px solid #c1acf585; border-radius:8px; background:radial-gradient(ellipse at 50% 0%,#c1acf50c,transparent 70%),#171722; }
/* Start with six rows; add room for occupied entries up to the 200-share window. */
.cns-fifo-flow :is(.cns-fifo-flow-queue-items,[data-flow-queue]) {
 display:grid; grid-template-columns:repeat(20,minmax(0,1fr)); grid-template-rows:repeat(var(--flow-grid-rows,6),14px); grid-auto-rows:14px;
 align-items:center; justify-items:center; gap:4px clamp(2px,.6vw,8px);
 width:100%; min-width:0; margin:5px 0 0; padding:28px 2px 6px; overflow:hidden; list-style:none;
 border-block:1px solid #c1acf518; background:#c1acf503;
}
.cns-fifo-flow :is(.cns-fifo-flow-token,.cns-fifo-flow-slot) {
 position:relative; display:block; width:min(14px,100%); height:auto; aspect-ratio:1;
 min-width:0; min-height:0; margin:0; padding:0; border:1px solid #b7a3d52b; border-radius:2px;
 background:#c1acf509; color:transparent; font-size:0; line-height:0; list-style:none;
}
.cns-fifo-flow .cns-fifo-flow-token {
 border-color:color-mix(in srgb,var(--flow-age-color,#70d69a) 75%,#fff 25%);
 background:var(--flow-age-color,#70d69a);
}
.cns-fifo-flow .cns-fifo-flow-token.is-head {
 outline:1px solid #f1e5ff; outline-offset:2px; box-shadow:0 0 0 3px #c1acf51a;
}
.cns-fifo-flow .cns-fifo-flow-token.is-new { border-color:#fff2; box-shadow:0 0 5px #70d69a2b; }
/* Additions and resolutions are marked directly on their own pool squares. */
.cns-fifo-flow :is(.cns-fifo-flow-token.is-added,.cns-fifo-flow-flight-token.is-sale)::after,
.cns-fifo-flow .cns-fifo-flow-token.is-resolving::after {
 content:"+"; position:absolute; top:50%; left:50%; translate:-50% -50%;
 display:grid; place-items:center; width:12px; height:12px; border-radius:3px;
 background:#0b211be8; color:#74ed9b; font:700 12px/1 'IBM Plex Mono',monospace;
 pointer-events:none;
}
.cns-fifo-flow .cns-fifo-flow-token.is-resolving { z-index:5; border-color:#ff6876; outline-color:#ff6876; box-shadow:0 0 0 1px #ff68763b; }
.cns-fifo-flow .cns-fifo-flow-token.is-resolving::after { content:"\00d7"; background:#30121beF; color:#ff6876; font-size:14px; }
.cns-fifo-flow [data-flow-queue].is-resolving-batch { position:relative; z-index:3; overflow:visible; }
.cns-fifo-flow .cns-fifo-flow-resolution-label {
 position:absolute; bottom:calc(100% + 7px); left:50%; translate:-50% 0; z-index:8;
 width:max-content; padding:2px 4px; border:1px solid #ff68766b; border-radius:4px;
 background:#29151ff5; color:#ffb4be; font:500 9px/1.2 'IBM Plex Sans',sans-serif;
 white-space:nowrap; pointer-events:none;
}
.cns-fifo-flow .cns-fifo-flow-grid-caption {
 display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:3px 8px;
 max-width:none; margin:5px 0 0; color:#a99abf; font:600 16px/1.4 'IBM Plex Sans',sans-serif;
}
.cns-fifo-flow .cns-fifo-flow-grid-caption h5 { margin:0; color:#e6d9f5; font:inherit; }
.cns-fifo-flow p.cns-fifo-flow-grid-note { max-width:none; margin:5px 0 0; color:#a99abf; font:10px/1.4 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-grid-metrics { display:flex; flex-wrap:wrap; justify-content:flex-start; align-items:baseline; gap:8px 20px; min-width:0; font:inherit; }
.cns-fifo-flow .cns-fifo-flow-grid-metrics > span { font:inherit; }
.cns-fifo-flow .cns-fifo-flow-trading-days { color:#c1b0d6; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
.cns-fifo-flow .cns-fifo-flow-grid-metrics > .cns-fifo-flow-oldest-age {
 display:inline-flex; align-items:center; max-width:100%; padding:7px 10px;
 border:1px solid color-mix(in srgb,var(--flow-age-color,#70d69a) 40%,transparent);
 border-left:3px solid var(--flow-age-color,#70d69a); border-radius:7px;
 background:color-mix(in srgb,var(--flow-age-color,#70d69a) 10%,#0b111a);
 box-shadow:0 0 14px color-mix(in srgb,var(--flow-age-color,#70d69a) 8%,transparent);
 color:var(--flow-age-color,#70d69a); font-weight:700; line-height:1.35;
 font-variant-numeric:tabular-nums; white-space:nowrap;
}
.cns-fifo-flow [data-flow-grid-count] { color:#e1d2f3; font-weight:600; font-variant-numeric:tabular-nums; }
.cns-fifo-flow .cns-fifo-flow-age-legend { display:grid; gap:4px; min-width:0; margin-top:8px; }
.cns-fifo-flow p.cns-fifo-flow-age-title { max-width:none; margin:0; color:#c1b0d6; font:500 9px/1.4 'IBM Plex Sans',sans-serif; }
.cns-fifo-flow .cns-fifo-flow-age-ramp {
 display:block; width:100%; height:6px; border-radius:3px;
 background:linear-gradient(90deg,#70d69a 0%,#f0dc68 32.353%,#ef9b51 67.647%,#e76572 100%);
}
.cns-fifo-flow .cns-fifo-flow-age-ticks {
 display:flex; justify-content:space-between; gap:8px; color:#b5a6c8;
 font:9px/1.3 'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums;
}
.cns-fifo-flow .cns-fifo-flow-age-ticks > :last-child { text-align:right; }
.cns-fifo-flow .cns-fifo-flow-progress { height:3px; overflow:hidden; border-radius:3px; background:#c1acf51c; }
.cns-fifo-flow .cns-fifo-flow-progress > i { display:block; width:100%; height:100%; background:linear-gradient(90deg,#7ce5c1,#c1acf5); transform:scaleX(0); transform-origin:left center; }
.cns-fifo-flow .cns-fifo-flow-notes { margin-top:10px; border-top:1px solid #c1acf52b; }
.cns-fifo-flow .cns-fifo-flow-notes > summary { padding:10px 1px 0; color:#b9a8cc; font:11px/1.5 'IBM Plex Sans',sans-serif; cursor:pointer; }
.cns-fifo-flow .cns-fifo-flow-notes-content { padding-top:10px; }
.cns-fifo-flow .cns-fifo-flow-notes-content > p { max-width:none; margin:10px 0; color:#aea0bc; font-size:12px; line-height:1.7; }
.cns-fifo-flow .cns-fifo-flow-notes-content strong { color:#d4c2e6; font-weight:500; }
.cns-fifo-flow .cns-fifo-flow-eventstrip { display:flex; flex-wrap:wrap; gap:6px 20px; margin-top:12px; padding:10px 0; border-top:1px solid #c1acf521; color:#ac9dba; font:11px/1.6 'IBM Plex Mono',monospace; overflow-wrap:anywhere; }
.cns-fifo-flow [data-flow-last-out] { color:#a2e3ca; }
.cns-fifo-flow [data-flow-last-in] { color:#ebbc8d; }
.cns-fifo-flow .cns-fifo-flow-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-top:10px; }
.cns-fifo-flow .cns-fifo-flow-stats > div { min-width:0; padding:9px; border:1px solid #c1acf527; border-radius:7px; background:#c1acf508; }
.cns-fifo-flow .cns-fifo-flow-stats span { display:block; color:#a79bb8; font-size:10px; line-height:1.5; }
.cns-fifo-flow .cns-fifo-flow-stats strong { display:block; margin-top:4px; color:#e0d2f8; font:500 23px/1.2 'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; }
.cns-fifo-flow .cns-fifo-flow-stats [data-flow-stat="in"] { color:var(--fifo-peach); }
.cns-fifo-flow .cns-fifo-flow-stats [data-flow-stat="out"] { color:var(--fifo-teal); }
.cns-fifo-flow.is-paused * { animation-play-state:paused!important; }
.cns-fifo-flow .cns-fifo-flow-sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.cns-fifo-flow .cns-fifo-flow-reset-note { margin:15px 0 0; padding:13px 15px; border-left:2px solid #efb26f99; border-radius:0 7px 7px 0; background:#efb26f07; }
.cns-fifo-flow .cns-fifo-flow-reset-note p { max-width:none; margin:0; color:#bdb0c9; font-size:12px; line-height:1.75; }
.cns-fifo-flow .cns-fifo-flow-reset-note p + p { margin-top:9px; }
.cns-fifo-flow .cns-fifo-flow-reset-note .cns-fifo-flow-reset-title { margin-bottom:9px; color:#edc194; font:500 10px/1.5 'IBM Plex Mono',monospace; letter-spacing:.04em; text-transform:uppercase; }
.cns-fifo-flow .cns-fifo-flow-reset-note strong { color:#e7d5cb; }
.cns-fifo-flow .cns-fifo-flow-reset-note a { color:#dfbe9b; text-decoration:underline; text-underline-offset:3px; }
@media (min-width:1000px) {
 .cns-fifo-flow .cns-fifo-flow-setting { display:flex; align-items:center; justify-content:center; gap:6px; }
}
@media (max-width:999px) {
 .cns-fifo-flow .cns-fifo-flow-trade-analysis { grid-template-columns:minmax(0,1fr); gap:8px; }
 .cns-fifo-flow .cns-fifo-flow-trade-panel { grid-template-rows:auto auto auto; }
 .cns-fifo-flow .cns-fifo-flow-trade-panel > .cns-fifo-flow-exchange { align-self:auto; align-items:center; min-height:0; }
 .cns-fifo-flow .cns-fifo-flow-customer { min-height:132px; }
 .cns-fifo-flow .cns-fifo-flow-dealer { min-height:156px; }
 .cns-fifo-flow .cns-fifo-flow-pool-area::before { content:none; }
}
@media (max-width:760px) {
 .cns-fifo-flow { padding:13px 12px; }
 .cns-fifo-flow .cns-fifo-flow-heading { display:block; }
 .cns-fifo-flow .cns-fifo-flow-controls { display:grid; grid-template-columns:1fr .75fr 1.15fr 1.15fr 56px; gap:5px; width:100%; margin:0; }
 .cns-fifo-flow .cns-fifo-flow-controls :is(button,select) { width:100%; min-width:0; padding:8px 5px; font-size:11px; }
 .cns-fifo-flow .flow-speed { display:block; font-size:0; }
 .cns-fifo-flow .flow-speed select { width:100%; min-width:0; font-size:11px; }
}
@media (max-width:760px) {
 .cns-fifo-flow .cns-fifo-flow-trade-settings { gap:4px 5px; padding:6px 8px; }
 .cns-fifo-flow .cns-fifo-flow-setting { font-size:10px; }
 .cns-fifo-flow .cns-fifo-flow-setting input { width:60px; font-size:17px; }
 .cns-fifo-flow .cns-fifo-flow-trade-total { padding-inline:6px; }
 .cns-fifo-flow .cns-fifo-flow-trade-total strong { font-size:11px; }
 .cns-fifo-flow .cns-fifo-flow-trade-total small { font-size:9px; }
 .cns-fifo-flow p.cns-fifo-flow-settings-note { font-size:9px; }
 .cns-fifo-flow .cns-fifo-flow-exchange { grid-template-columns:minmax(0,.8fr) 14px minmax(0,1.55fr) 14px minmax(0,.8fr); gap:4px; }
 .cns-fifo-flow .cns-fifo-flow-customer { gap:4px; min-height:116px; padding:6px 4px; border-radius:7px; }
 .cns-fifo-flow .cns-fifo-flow-customer h5 { font-size:10px; line-height:1.3; }
 .cns-fifo-flow .cns-fifo-flow-customer > b { font-size:10px; }
 .cns-fifo-flow .cns-fifo-flow-customer > small { font-size:8px; }
 .cns-fifo-flow .cns-fifo-flow-customer :is(.actor-icon,.cns-fifo-flow-actor-icon) { width:22px; height:22px; }
 .cns-fifo-flow .cns-fifo-flow-certificates { grid-template-columns:repeat(var(--flow-certificate-columns,4),8px); gap:3px 1px; min-height:16px; }
 .cns-fifo-flow .cns-fifo-flow-certificate { width:8px; height:12px; padding:0; }
 .cns-fifo-flow .cns-fifo-flow-dealer { gap:4px; min-height:156px; padding:6px; border-radius:8px; }
 .cns-fifo-flow .cns-fifo-flow-dealer-heading { flex-wrap:wrap; justify-content:center; gap:4px; text-align:center; }
 .cns-fifo-flow .cns-fifo-flow-dealer-heading :is(.actor-icon,.cns-fifo-flow-actor-icon) { width:18px; height:18px; }
 .cns-fifo-flow .cns-fifo-flow-dealer-heading h5 { flex:initial; font-size:12px; }
 .cns-fifo-flow [data-flow-net-status] { width:100%; max-width:none; text-align:center; font-size:7px; }
 .cns-fifo-flow .cns-fifo-flow-dealer-books > div { gap:3px 4px; padding:4px; }
 .cns-fifo-flow .cns-fifo-flow-dealer-books > div > span { font-size:8px; line-height:1.2; }
 .cns-fifo-flow .cns-fifo-flow-dealer-books b { font-size:15px; }
 .cns-fifo-flow .cns-fifo-flow-dealer-books small { font-size:7.5px; }
 .cns-fifo-flow p.cns-fifo-flow-independent-note { font-size:8px; }
 .cns-fifo-flow .cns-fifo-flow-exchange-lane > small { display:none; }
 .cns-fifo-flow .cns-fifo-flow-trade-track { height:28px; }
 .cns-fifo-flow .cns-fifo-flow-trade-packet { width:8px; height:11px; }
 .cns-fifo-flow .cns-fifo-flow-trade-packet.is-cash { width:8px; height:8px; font-size:6px; }
}
@media (max-width:600px) {
 .cns-fifo-flow :is(.cns-fifo-flow-queue-items,[data-flow-queue]) {
  grid-template-columns:repeat(20,minmax(0,1fr)); grid-template-rows:repeat(var(--flow-grid-rows,6),8px); grid-auto-rows:8px;
  gap:3px 2px; padding:64px 2px 4px;
 }
 .cns-fifo-flow :is(.cns-fifo-flow-token,.cns-fifo-flow-slot) { width:min(8px,100%); border-radius:1.5px; }
 .cns-fifo-flow .cns-fifo-flow-token.is-head { outline-offset:1px; box-shadow:none; }
 .cns-fifo-flow :is(.cns-fifo-flow-token.is-added,.cns-fifo-flow-flight-token.is-sale)::after,
 .cns-fifo-flow .cns-fifo-flow-token.is-resolving::after { width:9px; height:9px; border-radius:2px; font-size:10px; }
 .cns-fifo-flow .cns-fifo-flow-token.is-resolving::after { font-size:11px; }
 .cns-fifo-flow .cns-fifo-flow-resolution-label { bottom:calc(100% + 6px + var(--flow-resolve-order,0) * 14px); padding:1px 3px; font-size:7px; }
 .cns-fifo-flow .cns-fifo-flow-age-ticks { font-size:8px; }
}
@media (max-width:440px) {
 .cns-fifo-flow { padding:12px 10px; }
 .cns-fifo-flow .cns-fifo-flow-workspace { gap:6px; }
 .cns-fifo-flow .cns-fifo-flow-heading h4 { font-size:24px; }
 .cns-fifo-flow .cns-fifo-flow-controls { grid-template-columns:1fr .75fr 1.15fr 1.15fr 52px; gap:4px; }
 .cns-fifo-flow .cns-fifo-flow-controls :is(button,select) { font-size:10.5px; padding:8px 3px; }
 .cns-fifo-flow .cns-fifo-flow-queue-head h5 { font-size:12px; }
 .cns-fifo-flow .cns-fifo-flow-queue-head > p { max-width:150px; font-size:9px; }
 .cns-fifo-flow .cns-fifo-flow-waiting { padding:6px; }
 .cns-fifo-flow .cns-fifo-flow-stats { grid-template-columns:repeat(6,minmax(0,1fr)); gap:6px; }
 .cns-fifo-flow .cns-fifo-flow-stats > div { grid-column:span 2; padding:8px; }
 .cns-fifo-flow .cns-fifo-flow-stats > div:nth-last-child(-n+2) { grid-column:span 3; }
 .cns-fifo-flow .cns-fifo-flow-reset-note { padding:12px; }
}
@media (prefers-reduced-motion:reduce) {
 .cns-fifo-flow *, .cns-fifo-flow *::before, .cns-fifo-flow *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}

/* Give the simulation controls a clear hierarchy and a brief invitation to interact. */
.cns-fifo-flow .cns-fifo-flow-controls button { position:relative; display:flex; align-items:center; justify-content:center; gap:5px; min-height:44px; border-color:#c1acf56b; background:linear-gradient(145deg,#30263d,#201f2d); color:#e2d4f5; box-shadow:0 2px 8px #0003,inset 0 1px #ffffff08; transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease; }
.cns-fifo-flow .cns-fifo-flow-controls button::before { flex:none; color:inherit; font:500 15px/1 'IBM Plex Mono',monospace; opacity:.9; transition:transform .16s ease; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-reset]::before { content:'\21bb' / ''; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-toggle]::before { content:'\25b6' / ''; font-size:12px; }
.cns-fifo-flow[data-flow-playing="true"] .cns-fifo-flow-controls [data-flow-toggle]::before { content:'\2161' / ''; font-size:17px; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-next-step]::before { content:'\2192' / ''; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-step]::before { content:'\21e5' / ''; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-reset] { border-color:#b5a5cb55; background:linear-gradient(145deg,#252431,#1b1f29); color:#c5bfd4; }
.cns-fifo-flow .cns-fifo-flow-controls button[data-flow-toggle] { --flow-control-halo:#7ce5c12b; border-color:#acf2d8; background:linear-gradient(135deg,#a4eacc,#79d0b4); color:#122d27; }
.cns-fifo-flow[data-flow-playing="true"] .cns-fifo-flow-controls button[data-flow-toggle] { --flow-control-halo:#ecc18e33; border-color:#ecc18eb3; background:linear-gradient(135deg,#473424,#30271e); color:#f5d3a9; }
.cns-fifo-flow .cns-fifo-flow-controls [data-flow-step] { border-color:#ecc18e6b; background:linear-gradient(145deg,#352b2d,#24232c); color:#efc798; }
.cns-fifo-flow .cns-fifo-flow-controls :is(button,select):focus-visible { border-color:#d9c5ff; outline:2px solid #d9c5ff; outline-offset:3px; box-shadow:0 0 0 4px #c1acf51a; }
.cns-fifo-flow .cns-fifo-flow-controls button:active { transform:translateY(1px) scale(.98); box-shadow:inset 0 2px 6px #0005; }
.cns-fifo-flow[data-flow-controls-used="false"] .cns-fifo-flow-controls [data-flow-toggle] { animation:flow-control-invite 3.4s ease-in-out 3; animation-play-state:paused!important; }
.cns-fifo-flow[data-flow-controls-used="false"][data-flow-controls-visible="true"] .cns-fifo-flow-controls [data-flow-toggle] { animation-play-state:running!important; }
.cns-fifo-flow .cns-fifo-flow-controls:focus-within [data-flow-toggle] { animation:none; }
@keyframes flow-control-invite { 0%,70%,100% { box-shadow:0 2px 8px #0003,0 0 0 0 transparent; } 35% { box-shadow:0 3px 12px #0004,0 0 0 4px var(--flow-control-halo),0 0 20px var(--flow-control-halo); } }
@media(hover:hover) {
 .cns-fifo-flow .cns-fifo-flow-controls button:hover { transform:translateY(-2px); border-color:#d4b9ff; background:linear-gradient(145deg,#42334f,#282432); box-shadow:0 5px 14px #0005; }
 .cns-fifo-flow .cns-fifo-flow-controls button[data-flow-toggle]:hover { border-color:#d5ffec; background:linear-gradient(135deg,#baf5de,#8adfc3); color:#112d26; }
 .cns-fifo-flow[data-flow-playing="true"] .cns-fifo-flow-controls button[data-flow-toggle]:hover { border-color:#ffdeb3; background:linear-gradient(135deg,#5a412a,#3d2e20); color:#ffe0ba; }
 .cns-fifo-flow .cns-fifo-flow-controls :is([data-flow-next-step],[data-flow-step]):hover::before { transform:translateX(2px); }
 .cns-fifo-flow .cns-fifo-flow-controls:hover [data-flow-toggle] { animation:none; }
 .cns-fifo-flow .cns-fifo-flow-controls button:hover:active { transform:translateY(1px) scale(.98); }
}
@media(max-width:760px) {
 .cns-fifo-flow .cns-fifo-flow-controls button { flex-direction:column; gap:2px; min-height:44px; padding-block:4px; }
 .cns-fifo-flow .flow-speed select { min-height:44px; }
}
@media(prefers-reduced-motion:reduce) {
 .cns-fifo-flow .cns-fifo-flow-controls button,.cns-fifo-flow .cns-fifo-flow-controls button::before { animation:none!important; transition:none!important; transform:none!important; }
}



/* Apply transparency only to the simulation's outer surface. */
#app .cns-page .cns-fifo-flow {
 background:radial-gradient(ellipse at 50% 0%,#c1acf502,transparent 57%),linear-gradient(145deg,#18172208,#0e171d08);
}

#app .cns-page .cns-fifo-flow .cns-fifo-flow-waiting { background:radial-gradient(ellipse at 50% 0%,#c1acf502,transparent 70%),#17172208; }

/* Separate the simulation's areas with space instead of nested box borders. */
#app .cns-page .cns-fifo-flow { border:0;border-radius:0;padding:12px 0; }
#app .cns-page .cns-fifo-flow :is(.cns-fifo-flow-trade-settings,.cns-fifo-flow-customer,.cns-fifo-flow-dealer,.cns-fifo-flow-waiting,.cns-fifo-flow-age-chart) {
 border:0;box-shadow:none;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-dealer-books>div { border:0;border-radius:0; }
#app .cns-page .cns-fifo-flow :is(.cns-fifo-flow-queue-items,.cns-fifo-flow-setting-help) { border:0; }
#app .cns-page .cns-fifo-flow .cns-fifo-flow-age-svg { border:0; }
#app .cns-page .cns-fifo-flow .cns-fifo-flow-pool-area { padding-top:0; }
#app .cns-page .cns-fifo-flow .cns-fifo-flow-stats>div { border:0; }

/* Keep the restart symbol; other playback controls use text only. */
#app .cns-page .cns-fifo-flow .cns-fifo-flow-controls button:not([data-flow-reset])::before { content:none;display:none; }

#app .cns-page .cns-fifo-flow .cns-fifo-flow-pool-area::before { content:none;display:none; }

/* Consistent playback controls matching the guide palette. */
#app .cns-page .cns-fifo-flow .cns-fifo-flow-controls button {
 color:#d7c6eb;background:#19151f;border:1px solid #c1acf545;
 box-shadow:none;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-controls button:hover {
 color:#f0edf7;background:#241c30;border-color:#c1acf580;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-controls button:focus-visible {
 outline:2px solid #c1acf5;outline-offset:3px;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-controls button:disabled {
 color:#8b8196;background:#141119;border-color:#c1acf520;cursor:default;
}

/* Directional customer colors: buying is green, selling is red. */
#app .cns-page .cns-fifo-flow .cns-fifo-flow-customer.is-buyer {
 background:linear-gradient(145deg,#39f58a14,#39f58a05);color:#8eeab4;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-customer.is-seller {
 background:linear-gradient(145deg,#ff5c6814,#ff5c6805);color:#ff9aa2;
}
#app .cns-page .cns-fifo-flow .cns-fifo-flow-customer.is-buyer :is(h5,b,small,.cns-fifo-flow-actor-icon) { color:#8eeab4; }
#app .cns-page .cns-fifo-flow .cns-fifo-flow-customer.is-seller :is(h5,b,small,.cns-fifo-flow-actor-icon) { color:#ff9aa2; }
#app .cns-page .cns-fifo-flow .is-buyer .cns-fifo-flow-certificate { color:#8eeab4;border-color:#39f58a66;background:#39f58a10; }
#app .cns-page .cns-fifo-flow .is-seller .cns-fifo-flow-certificate { color:#ff9aa2;border-color:#ff5c6866;background:#ff5c6810; }

#app .cns-page .cns-fifo-flow .cns-fifo-flow-setting.is-sales { color:#ff5c68; }

#app .cns-page .cns-fifo-flow .cns-fifo-flow-setting.is-purchases input { border-color:#c1acf56b;color:#e1cef9;background:#12121c; }
#app .cns-page .cns-fifo-flow .cns-fifo-flow-setting input:focus-visible { outline-color:#c1acf5; }

#app .cns-page .cns-fifo-flow .cns-fifo-flow-setting:is(.is-sales,.is-purchases) { color:#cdb8ed; }
