@font-face { font-family: "Bodoni Moda"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/BodoniModa-normal-latin.woff2") format("woff2"); }
@font-face { font-family: "Albert Sans"; font-style: normal; font-weight: 300 600; font-display: swap; src: url("fonts/AlbertSans-normal-latin.woff2") format("woff2"); }

:root {
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Albert Sans", "Helvetica Neue", Arial, sans-serif;
  --up-base: #5bd6a0;
  --k-base: #7fa9ff;
  --radius: 10px;
}
:root {
  color-scheme: dark;
  --bg: #0d1626;
  --ink: #ece6d8;
  --muted: #9aa6bb;
  --line: rgba(236, 230, 216, 0.12);
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(236, 230, 216, 0.14);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 4px 14px rgba(0, 0, 0, 0.3);
  --up: #5bd6a0;
  --k: #7fa9ff;
  --accent-strong: #ece6d8;
  --tint-green: rgba(91, 214, 160, 0.12);
  --tint-blue: rgba(127, 169, 255, 0.14);
  --btn-bg: #5bd6a0; --btn-ink: #0d1626;
  --warn: #f2b45a; --warn-base: #f2b45a; --warn-bg: rgba(242, 180, 90, 0.12); --warn-line: rgba(242, 180, 90, 0.5);
  --brass: #c9a45c;          /* site brass, ~7:1 on navy */
  --brass-line: rgba(201, 164, 92, 0.5); --brass-bg: rgba(201, 164, 92, 0.1);
  --edge-idle: rgba(236, 230, 216, 0.14); --node-a: #1b2a44; --node-b: #0f1b30; --node-ring: rgba(127, 169, 255, 0.45);
  --badge-open: rgba(127, 169, 255, 0.16); --badge-open-ink: #a9c4ff;
  --badge-paid: rgba(91, 214, 160, 0.16); --badge-paid-ink: #7fe3b7;
  --badge-warn: rgba(255, 196, 92, 0.16); --badge-warn-ink: #ffd27f;
  --badge-bad: rgba(236, 117, 99, 0.18); --badge-bad-ink: #ff9d8e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 55% 40% at 8% 0%, var(--tint-green), transparent 70%),
    radial-gradient(ellipse 50% 45% at 100% 10%, var(--tint-blue), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, var(--tint-blue), transparent 75%),
    var(--bg);
  background-attachment: fixed;
}
button { font-family: inherit; }
a { color: var(--k); }
:focus-visible { outline: 2px solid var(--k); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ---- Title line (same treatment as worldvest.ai) ---- */
.titlebar {
  display: flex; align-items: center; gap: clamp(14px, 2vw, 24px); flex-wrap: wrap;
  padding: 22px clamp(16px, 4vw, 56px) 18px; border-bottom: 1px solid var(--line);
}
.titlebar .brand { display: flex; flex-direction: column; gap: 6px; }
.titlebar h1 { display: flex; align-items: baseline; gap: clamp(12px, 2vw, 22px); flex-wrap: wrap; margin: 0; }
.wordmark { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6.4vw, 92px); line-height: 0.95; letter-spacing: -0.03em; }
.subtitle { font-family: var(--body); font-weight: 300; font-size: clamp(17px, 1.9vw, 26px); color: var(--up); }
.product { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--k); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag-test { color: var(--brass); border: 1px solid var(--brass-line); background: var(--brass-bg); border-radius: 999px; padding: 1px 9px; font-size: 11px; letter-spacing: .14em; }
.titlebar .links { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.titlebar .links a { color: var(--muted); text-decoration: none; }
.titlebar .links a:hover { color: var(--ink); }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted);
  background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 6px 14px;
}
.ghost-btn:hover { color: var(--ink); }

main { padding: 28px clamp(16px, 4vw, 56px) 56px; max-width: 1320px; margin: 0 auto; }
h2 { font-family: var(--body); font-weight: 600; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 12px; }
h3 { font-family: var(--body); font-weight: 600; font-size: 17px; margin: 0; }
.lede { color: var(--muted); max-width: 68ch; margin: 0 0 18px; }

.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; backdrop-filter: blur(6px); }
.grid { display: grid; gap: 18px; }
.hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: stretch; margin-bottom: 26px; }
.hero .steps { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 8px; cursor: pointer;
  padding: 12px 22px; font-weight: 600; font-size: 15px; background: var(--btn-bg); color: var(--btn-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28); transition: transform .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn[disabled] { opacity: .55; cursor: progress; transform: none; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; border: 1px solid var(--card-border); color: var(--muted); }
.step.done .n { background: var(--up-base); color: #0d1626; border-color: transparent; }
.step.active .n { border-color: var(--k); color: var(--k); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--tint-blue); } }
.step .t { font-weight: 600; }
.step .d { color: var(--muted); font-size: 14px; word-break: break-word; }
.msg { margin-top: 12px; font-size: 14px; color: var(--badge-bad-ink); }

.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 26px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat .label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: var(--body); font-weight: 600; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; color: var(--muted); }

.biz { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 26px; }
@media (max-width: 1000px) { .biz { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .biz, .stats { grid-template-columns: 1fr; } }
.biz .name { font-weight: 600; }
.biz .bal { font-family: var(--body); font-weight: 600; font-size: 24px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.biz .unit { font-family: var(--body); font-size: 13px; color: var(--muted); margin-left: 4px; }
.addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.kind { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--up); }

.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .two { grid-template-columns: minmax(0, 1fr); } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.badge.open { background: var(--badge-open); color: var(--badge-open-ink); }
.badge.paid { background: var(--badge-paid); color: var(--badge-paid-ink); }
.badge.partial, .badge.overpaid { background: var(--badge-warn); color: var(--badge-warn-ink); }
.badge.mismatched { background: var(--badge-bad); color: var(--badge-bad-ink); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.feed li:last-child { border-bottom: 0; }
.feed .ev { font-weight: 600; }
.feed .ev.InvoicePaid { color: var(--up); }
.feed .ev.Minted, .feed .ev.WalletApproved { color: var(--k); }
.feed .meta { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.scroll { overflow-x: auto; }

footer { border-top: 1px solid var(--line); padding: 22px clamp(16px, 4vw, 56px) 36px; color: var(--muted); font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
footer a { color: var(--muted); }

/* ---- Payment flow chart (pure SVG) ---- */
.flow-card { display: flex; flex-direction: column; }
.flow-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flow { width: 100%; height: auto; display: block; margin-top: 6px; flex: 1; min-height: 260px; overflow: visible; }
.flow .stop-a { stop-color: var(--node-a); }
.flow .stop-b { stop-color: var(--node-b); }
.flow .stop-up { stop-color: var(--up-base); }
.flow .stop-k { stop-color: var(--k-base); }
.fc-edge { fill: none; stroke: var(--edge-idle); stroke-linecap: round; transition: stroke-width .6s ease, opacity .3s; }
.fc-edge.idle { stroke-dasharray: 2 7; }
.fc-edge.active { stroke: url(#edge-grad); opacity: .75; }
.fc-edge.hot { opacity: 1; filter: url(#glow); }
.fc-node circle.body { fill: url(#node-fill); stroke: var(--node-ring); stroke-width: 1.5; }
.fc-node.hub circle.body { stroke: var(--brass-line); stroke-width: 2; }
.fc-node circle.ring { fill: none; stroke: var(--up-base); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fc-node.pulse circle.ring { animation: ring 1.2s ease-out 1; }
@keyframes ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.fc-node text { fill: var(--ink); font-family: var(--body); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.fc-node .nm { font-size: 15px; font-weight: 600; }
.fc-node .bl { font-size: 12.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.fc-node .ini { font-size: 15px; font-weight: 600; fill: var(--k); letter-spacing: .04em; }
.fc-node.hub .ini { fill: var(--brass); }
.fc-dot { fill: var(--up-base); filter: url(#glow); }
.fc-amt { font-family: var(--body); font-size: 13px; font-weight: 600; fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.spark { width: 100%; height: 34px; margin-top: 8px; display: block; }
.spark polyline { fill: none; stroke: var(--up); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
@media (max-width: 560px) { .fc-node .bl { display: none; } .flow { min-height: 220px; } }
@media (prefers-reduced-motion: reduce) { .fc-node.pulse circle.ring { opacity: .85; } }

/* ---- Phase 3: scenarios, flags, clearer flow chart ---- */
.scenarios { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.scenarios legend { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--card-border); border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink); background: transparent; transition: border-color .15s, background .15s; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pill:hover { border-color: var(--k); }
.pill:has(input:checked) { border-color: var(--k); background: rgba(127, 169, 255, 0.14); font-weight: 600; }
.pill.warn:has(input:checked) { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.pill:has(input:focus-visible) { outline: 2px solid var(--k); outline-offset: 2px; }
.scenario-desc { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 1.4em; }
.step.is-flag .n { background: var(--warn-base); color: #0d1626; border-color: transparent; }
.flag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); white-space: nowrap; }
tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn-base); }
.section-lede { color: var(--muted); margin: -4px 0 14px; max-width: 70ch; }
.biz .blurb { font-size: 13.5px; color: var(--muted); margin: 6px 0 4px; line-height: 1.45; min-height: 3.9em; }
.biz .card.treasury .kind { color: var(--brass); }

.fsteps { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; font-size: 12px; flex-wrap: wrap; }
.fsteps li { padding: 3px 10px; border-radius: 6px; border: 1px solid var(--card-border); color: var(--muted); position: relative; }
.fsteps li + li::before { content: "→"; position: absolute; left: -11px; color: var(--muted); }
.fsteps li { margin-left: 6px; }
.fsteps li:first-child { margin-left: 0; }
.fsteps li.active { border-color: var(--k); color: var(--k); animation: pulse 1.4s ease-in-out infinite; }
.fsteps li.done { background: rgba(91, 214, 160, 0.16); border-color: var(--up-base); color: var(--up); }
.fsteps li.is-flag { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

.flow-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.flow-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.flow-legend .sw { display: inline-block; }
.flow-legend .sw.line { width: 28px; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--up-base), var(--k-base)); }
.flow-legend .sw.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--up-base); box-shadow: 0 0 6px var(--up-base); }
.flow-legend .sw.flag { width: 10px; height: 10px; border-radius: 50%; background: var(--warn-base); }
.flow-caption { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); min-height: 4.2em; }
.flow-caption.flagged { border-color: var(--warn-line); background: var(--warn-bg); }
.cap-flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cap-kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.cap-text { margin: 4px 0 2px; font-size: 14.5px; line-height: 1.45; }
.cap-links { font-size: 13px; color: var(--muted); }

.flow .arr-fill { fill: var(--k-base); }
.flow .arr-pending { fill: var(--muted); }
.fc-node .rl { font-size: 12px; fill: var(--muted); }
.fc-node:focus { outline: none; }
.fc-node:focus-visible circle.body, .fc-node.focus circle.body { stroke: var(--k); stroke-width: 2.5; }
.fc-node.pulse-flag circle.ring { stroke: var(--warn-base); animation: ring 1.2s ease-out 1; }
.fc-edge.hot-flag { stroke: var(--warn-base); opacity: 1; filter: url(#glow); }
.flagged .fc-dot, .fc-dot.flagged { fill: var(--warn-base); }
.flagged .fc-amt, .fc-amt.flagged { fill: var(--warn); }
.fc-pending { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 6; opacity: .8; }
.fc-pending.inflight { stroke: var(--k-base); stroke-width: 2.5; animation: dash 0.9s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.fc-pending-label { font-family: var(--body); font-size: 12.5px; font-weight: 600; fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { .fc-node.pulse-flag circle.ring { opacity: .85; } }
@media (max-width: 560px) { .fc-node .rl { font-size: 13px; } .fsteps { width: 100%; } }

/* ---- Receipt page ---- */
.wordmark.small { font-size: clamp(34px, 4vw, 52px); }
.receipt-page main { max-width: 980px; }
.receipt { position: relative; overflow: hidden; padding: 28px 30px; }
.receipt.flagged { border-color: var(--warn-line); }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-family: var(--body); font-weight: 700; font-size: clamp(48px, 9vw, 120px); letter-spacing: .12em; text-transform: uppercase; color: var(--brass); opacity: .1; transform: rotate(-18deg); white-space: nowrap; }
.r-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; position: relative; }
.r-head h2 { margin: 4px 0 8px; }
.r-amount { text-align: right; }
.r-amount .label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.r-amount .value { font-weight: 600; font-size: clamp(28px, 3.4vw, 40px); font-variant-numeric: tabular-nums; }
.r-amount .sub { font-size: 13px; color: var(--muted); }
.receipt .cap-text { position: relative; max-width: 75ch; }
.r-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; margin-top: 18px; position: relative; }
@media (max-width: 760px) { .r-grid { grid-template-columns: minmax(0, 1fr); } .r-amount { text-align: left; } }
.r-grid h3 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.r-grid dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 14px; }
.r-grid dt { color: var(--muted); }
.r-grid dd { margin: 0; word-break: break-word; }
.r-note { position: relative; margin-top: 22px; }
@media print {
  .titlebar .links, footer { display: none; }
  body, .receipt-page { background: #fff !important; color: #0d1626; }
  .card { box-shadow: none; backdrop-filter: none; border: 1px solid #ccd; background: #fff; }
  .watermark { opacity: .12; color: #8a6a1f; }
  a { color: #0d1626; }
}
@media print {
  :root { --bg: #ffffff; --ink: #0d1626; --muted: #4a5873; --line: rgba(13, 22, 38, 0.12); --card: #ffffff; --card-border: #ccd3e0; --up: #13845a; --k: #2f5fcc; --brass: #8a6a1f; --warn: #9a5a00; --warn-bg: #fff3df; --warn-line: #e3b36a;
    --badge-open: #eef3ff; --badge-open-ink: #2f5fcc; --badge-paid: #e3f7ee; --badge-paid-ink: #13845a; --badge-warn: #fff1d6; --badge-warn-ink: #8a5300; --badge-bad: #fde8e8; --badge-bad-ink: #a32020; }
}

.subhead { font-size: clamp(16px, 1.5vw, 19px); font-weight: 500; color: var(--up); margin: -6px 0 12px; }
.tag-test { cursor: help; }

/* Phase 3c: no orphan words */
h1, h2, h3, .subhead { text-wrap: balance; }
p, li, .lede, .section-lede, .hint, .step .d, .scenario-desc { text-wrap: pretty; }
.hint p { margin: 0; }
.hint p + p { margin-top: 2px; }
@media (min-width: 1200px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .step .d.one-line { white-space: nowrap; }
}

/* Phase 3d: eyebrow, scenario rows, run row, busy button, settle callout */
.eyebrow { margin: 0 0 14px; }
.pills { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 560px) {
  .pill-row { flex-wrap: nowrap; gap: 6px; }
  .pill { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
}
@media (max-width: 359px) { .pill-row { flex-wrap: wrap; } .pill { flex: 1 1 auto; justify-content: center; } }
.run-row { display: flex; align-items: center; gap: 16px; }
.run-row .btn { flex: none; }
.run-row .scenario-desc { margin: 0; min-height: 0; flex: 1 1 auto; }
@media (max-width: 560px) { .run-row { flex-direction: column; align-items: flex-start; gap: 10px; } }
.btn .spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.btn.busy .spin { display: inline-block; }
.btn.busy { animation: busy-pulse 1.6s ease-in-out infinite; }
.btn.busy[disabled] { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes busy-pulse { 0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28); } 50% { box-shadow: 0 0 0 5px rgba(127, 169, 255, 0.22), 0 2px 8px rgba(0, 0, 0, 0.28); } }
.settle-callout { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 12px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; transition: background .6s ease, border-color .6s ease; }
.settle-callout[hidden] { display: none; }
.settle-callout .sc-big { font-weight: 600; font-size: 17px; color: var(--up); font-variant-numeric: tabular-nums; }
.settle-callout .sc-sub { font-size: 13px; color: var(--muted); }
.settle-callout.hot { background: rgba(84, 214, 160, 0.14); border-color: var(--up); animation: settle-pop .5s ease-out; }
.settle-callout.flagged .sc-big { color: var(--warn); }
.settle-callout.flagged.hot { background: var(--warn-bg); border-color: var(--warn-line); }
@keyframes settle-pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.step.flash { border-radius: 8px; animation: row-flash 1.2s ease-in-out 3; }
@keyframes row-flash { 0%, 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } 50% { background: rgba(84, 214, 160, 0.14); box-shadow: 0 0 0 6px rgba(84, 214, 160, 0.14); } }
@media (prefers-reduced-motion: reduce) { .btn.busy .spin { border-right-color: currentColor; opacity: .6; } }
@media (max-width: 560px) {
  .pill { padding: 5px 9px; font-size: 12px; }
  .eyebrow { font-size: 11.5px; letter-spacing: .08em; gap: 8px; }
  .eyebrow .tag-test { font-size: 10px; letter-spacing: .1em; padding: 1px 7px; }
}
.steps { grid-template-columns: minmax(0, 1fr); }
.step > div { min-width: 0; }

/* Phase 3d: dark-only, slow ambient background (transform/opacity only; static under reduced motion) */
:root { color-scheme: dark; }
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%;
  width: 70vmax; height: 70vmax; will-change: transform; opacity: .32;
}
body::before { top: -30vmax; left: -22vmax; background: radial-gradient(circle at center, rgba(91, 214, 160, 0.55), transparent 62%); animation: drift-a 70s ease-in-out infinite alternate; }
body::after { bottom: -34vmax; right: -24vmax; background: radial-gradient(circle at center, rgba(127, 169, 255, 0.6), transparent 62%); animation: drift-b 90s ease-in-out infinite alternate; }
@keyframes drift-a { 0% { transform: translate3d(0, 0, 0) scale(1); } 100% { transform: translate3d(18vw, 14vh, 0) scale(1.12); } }
@keyframes drift-b { 0% { transform: translate3d(0, 0, 0) scale(1.05); } 100% { transform: translate3d(-20vw, -16vh, 0) scale(.95); } }
@media print { body::before, body::after { display: none; } }

/* Phase 3d: view switch + Sankey */
.flow-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-switch { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--card-border); border-radius: 8px; padding: 2px; }
.vs-btn { width: 26px; height: 26px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer; padding: 0; }
.vs-btn:hover { color: var(--ink); background: rgba(236, 230, 216, 0.07); }
.vs-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vs-name { font-size: 12px; color: var(--muted); min-width: 56px; text-align: center; letter-spacing: .04em; }
.flow-views { display: grid; flex: 1; align-items: center; }
.flow-views > .fview { grid-area: 1 / 1; transition: opacity .35s ease, transform .35s ease, visibility 0s linear 0s; }
.flow-views > .fview.off { opacity: 0; transform: translateX(14px); visibility: hidden; pointer-events: none; transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s; }
.flow-views > #flow.fview.off { transform: translateX(-14px); }
.sankey { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.flow-card:not(.view-sankey) .lg-sk, .flow-card.view-sankey .lg-net { display: none; }
.flow-legend .sw.band { width: 28px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, var(--up-base), var(--k-base)); opacity: .75; }
.sk-band { fill: url(#sk-grad); opacity: .5; transition: opacity .3s ease; }
.sk-band.flag { fill: var(--warn-base); opacity: .62; }
.sk-link:hover .sk-band, .sk-link.hot .sk-band { opacity: .9; }
.sk-link.hot { animation: sk-flash 1.6s ease-out 1; }
@keyframes sk-flash { 0% { opacity: .4; } 30% { opacity: 1; } 100% { opacity: 1; } }
.sk-node.l { fill: var(--up-base); }
.sk-node.r { fill: var(--k-base); }
.sankey text { font-family: var(--body); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.sk-nm { fill: var(--ink); font-size: 14px; font-weight: 600; }
.sk-sub { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sk-amt { fill: var(--ink); font-size: 12.5px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
.sk-amt.flagged { fill: var(--warn); }
.sk-empty { fill: var(--muted); font-size: 14px; text-anchor: middle; }
.sankey.narrow .sk-nm { font-size: 12.5px; }
.sankey.narrow .sk-sub { font-size: 11px; }
.sankey.narrow .sk-amt { font-size: 11.5px; }

/* Phase 3d: shared headline, section lede width, mobile pass */
.headline { font-family: var(--body); font-weight: 600; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.2; letter-spacing: -0.01em; }
.flow-head { align-items: center; }
.flow-head .headline { margin: 0; }
.section-lede { max-width: 84ch; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.addr, .r-grid dd, .cap-links, .step .d { overflow-wrap: anywhere; }
html, body { overflow-x: clip; }
@media (max-width: 560px) {
  main { padding-left: 14px; padding-right: 14px; }
  .card { padding: 18px 16px; }
  .titlebar .links { gap: 4px 2px; margin-left: 0; }
  .titlebar .links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; }
  .titlebar .links a:first-child { padding-left: 0; }
  .ghost-btn { min-height: 44px; }
  .btn { min-height: 48px; }
  .pills { gap: 8px; }
  .pill-row { display: grid; gap: 8px; flex-wrap: nowrap; }
  .pill-row:first-child { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pill-row:last-child { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pill { min-height: 44px; justify-content: center; text-align: center; white-space: normal; line-height: 1.2; padding: 4px 6px; font-size: 12.5px; }
  .vs-btn { width: 44px; height: 44px; }
  .fsteps li { padding: 4px 8px; }
  .flow-legend { gap: 6px 14px; }
  .run-row .scenario-desc { min-height: 2.8em; }
}
.sankey .stop-up { stop-color: var(--up-base); }
.sankey .stop-k { stop-color: var(--k-base); }
td .addr { overflow-wrap: normal; }
@media (max-width: 560px) {
  .scroll { margin: 0 -16px; padding: 0 16px; }
  .scroll table { min-width: 560px; }
}

/* Phase 3e: confirmed-only green arrows, bigger node labels, status label, two-stat callout */
:root { --edge-grey: rgba(236, 230, 216, 0.28); }
.fc-edge { transition: stroke-width .6s ease, opacity .3s, stroke .8s ease; }
.fc-edge.active { stroke: var(--up-base); opacity: .8; }
.fc-edge.active.flagged { stroke: var(--warn-base); }
.fc-edge.active.awaiting, .fc-edge.awaiting { stroke: var(--edge-grey); opacity: .9; animation: await-pulse 1.6s ease-in-out infinite; }
@keyframes await-pulse { 50% { opacity: .5; } }
.flow .arr-fill { fill: var(--up-base); }
.flow .arr-flag-fill { fill: var(--warn-base); }
.flow .arr-grey-fill { fill: var(--edge-grey); }
.fc-pending.inflight { stroke: var(--edge-grey); animation: dash 0.9s linear infinite, await-pulse 1.6s ease-in-out infinite; }
.flow-legend .sw.line { background: var(--up-base); }
.flow-legend .sw.grey { width: 28px; height: 6px; border-radius: 6px; background: var(--edge-grey); }
.fc-node .nm { font-size: 20px; font-weight: 600; }
.fc-node .rl { font-size: 15.5px; fill: var(--muted); }
.fc-node .bl { display: none; }
@media (max-width: 560px) {
  .fc-node .nm { font-size: 30px; }
  .fc-node .rl { font-size: 23px; }
  .fc-node .ini { font-size: 22px; }
  .fc-status text { font-size: 26px; }
}
.fc-measure { fill: none; stroke: none; }
.fc-status text { font-family: var(--body); font-size: 15px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
.fc-status { transition: opacity .6s ease; animation: status-in .35s ease-out; }
.fc-status.pending text { fill: var(--muted); }
.fc-status.confirmed text { fill: var(--k); }
.fc-status.ok text { fill: var(--up); }
.fc-status.flag text { fill: var(--warn); }
.fc-status.out { opacity: 0; }
@keyframes status-in { from { opacity: 0; } to { opacity: 1; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.settle-callout { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 6px 28px; align-items: start; }
.settle-callout[hidden] { display: none; }
.sc-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-stat[hidden] { display: none; }
.settle-callout .sc-big { font-weight: 600; font-size: 17px; color: var(--up); font-variant-numeric: tabular-nums; line-height: 1.3; }
.settle-callout.flagged .sc-big { color: var(--up); }
.sc-flag { color: var(--warn); }
.sc-label { font-size: 12.5px; color: var(--muted); }
@media (max-width: 560px) { .settle-callout { grid-template-columns: minmax(0, 1fr); width: 100%; } }
@media (max-width: 560px) {
  .fc-status text { font-size: 24px; stroke-width: 7px; }
  .fc-amt, .fc-pending-label { font-size: 21px; stroke-width: 6px; }
}

/* Phase 3f: run-scoped arrow colors (grey by default) */
.fc-edge.active { stroke: var(--edge-grey); opacity: .9; }
.fc-edge.active.lit-ok, .fc-edge.lit-ok { stroke: var(--up-base); opacity: 1; }
.fc-edge.active.lit-flag, .fc-edge.lit-flag { stroke: var(--warn-base); opacity: 1; }
.fc-edge.lit-ok.idle, .fc-edge.lit-flag.idle { stroke-dasharray: none; }
.flow-legend .sw.grey.pulse { animation: await-pulse 1.6s ease-in-out infinite; }
.flow-legend .lg-note { opacity: .85; }

/* Phase 3i: Maya's copy */
.fc-status text { font-size: 17px; }
@media (max-width: 560px) { .fc-status text { font-size: 27px; stroke-width: 7px; } }
.settle-callout .sc-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.why { margin-bottom: 26px; }
.why-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.why-cards .kind { font-size: 12px; }
.why-text { margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink); }
.why-close { color: var(--muted); margin: 0; max-width: 84ch; text-wrap: pretty; }
@media (max-width: 900px) { .why-cards { grid-template-columns: minmax(0, 1fr); } }
.settle-callout .sc-flag { white-space: nowrap; }

/* Phase 3j: scenario chips stay on one line on phones (content-sized columns in the second row) */
@media (max-width: 560px) {
  .pill { white-space: nowrap; }
  .pill-row:last-child { grid-template-columns: repeat(3, auto); }
}
@media (max-width: 400px) {
  .pills, .pill-row { gap: 6px; }
  .pill { padding: 4px 5px; font-size: 12px; }
}
@media (max-width: 370px) { .pill { font-size: 11.5px; padding: 4px 4px; } }

/* Phase 3k: hero box only, about 1px larger type and brighter secondary text (#b4bed0, about 8.6:1 on the card; primary is about 13:1) */
#demo > .card:first-child { --muted: #b4bed0; }
#demo > .card:first-child .subhead { font-size: 20px; }
#demo > .card:first-child .lede { font-size: 17px; }
#demo > .card:first-child legend { font-size: 13px; color: var(--muted); }
#demo > .card:first-child .pill { font-size: 14px; }
#demo > .card:first-child #run-label { font-size: 16px; }
#demo > .card:first-child .scenario-desc, #demo > .card:first-child .hint p { font-size: 14px; color: var(--muted); }
#demo > .card:first-child .step .t { font-size: 17px; }
#demo > .card:first-child .step .d { font-size: 15px; color: var(--muted); }
@media (max-width: 560px) {
  #demo > .card:first-child .subhead { font-size: 17px; }
  #demo > .card:first-child .pill { font-size: 12.5px; }
}
@media (max-width: 400px) { #demo > .card:first-child .pill { font-size: 12.5px; } }
@media (max-width: 370px) { #demo > .card:first-child .pill { font-size: 12px; } }
/* Bigger type: keep step 2 on one line only where it fits */
@media (min-width: 1200px) and (max-width: 1379px) { #demo .step .d.one-line { white-space: normal; } }
