/* The stage: the reading top left (two lines, the rest behind "more"), one compact bar, the lens over the side.
   On a phone: the reading, the flow, a handle above the timeline, and a bottom sheet for everything else. */
/* The page is three rows that cannot overlap: the masthead, the stage, the footer. They fill the window exactly unless
   the stage needs more height than the window gives: the compact arrangement (html.st-compact, set by the stage script
   from the window's width and height together) has a floor under the stage, and a wide stage grows when a corporate
   record listed step by step needs the room. Then the page scrolls instead of anything being squeezed or covered. */
body.stage-body { overflow-x: hidden; overflow-y: auto; display: grid; grid-template-rows: var(--mast-h) minmax(var(--st-stage-min, 0px), 1fr) auto; grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100vh; min-height: 100dvh; }
body.stage-body .masthead { position: relative; grid-row: 1; grid-column: 1; }
body.stage-body #stage { position: relative; grid-row: 2; grid-column: 1; inset: auto; padding: 0; min-height: 0; }
body.stage-body .footline { grid-row: 3; grid-column: 1; }
html.st-compact body.stage-body { grid-template-rows: var(--mast-h) minmax(var(--st-stage-min, 560px), 1fr) auto; }
.st { position: absolute; inset: 0; }
.st-canvas { position: absolute; inset: 0; }
.stage-canvas { display: block; }

/* the compact bar, top right on a wide screen; chips under it */
.st-sheet { position: absolute; right: 30px; top: 8px; z-index: 4; display: grid; gap: 6px; justify-items: end; max-width: 54vw; }
.st-sheet-handle { display: none; }
.st-tools { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; align-items: center; }
.st-bar { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; align-items: center; }
.st-sel select { background: rgba(28,24,20,0.9); border: 1px solid var(--rule-strong); color: var(--text-2); border-radius: 999px; padding: 3px 24px 3px 10px; font: 11.5px var(--f-ui); max-width: 210px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.st-sel select:hover, .st-sel select:focus-visible { color: var(--text-1); border-color: var(--money-lo); }
.st-btn { background: rgba(28,24,20,0.9); border: 1px solid var(--rule-strong); color: var(--text-2); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.st-btn:hover, .st-btn[aria-pressed="true"] { color: var(--text-1); border-color: var(--money-lo); }
.st-seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 999px; overflow: hidden; background: rgba(20,17,14,0.9); }
.st-seg button { background: none; border: 0; color: var(--text-3); padding: 3px 10px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.st-seg button[aria-pressed="true"] { color: var(--ink-0); background: var(--text-1); }
.st-kinds { position: relative; font-size: 11.5px; }
.st-kinds summary { list-style: none; cursor: pointer; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 3px 10px; color: var(--text-2); background: rgba(28,24,20,0.9); white-space: nowrap; }
.st-kinds summary::-webkit-details-marker { display: none; }
.st-kinds > div { position: absolute; right: 0; top: calc(100% + 4px); z-index: 6; display: grid; gap: 2px; padding: 6px; background: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 10px; width: 190px; }
.st-kinds > div button { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--text-2); padding: 3px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; text-align: left; }
.st-kinds > div button[aria-pressed="true"] { color: var(--text-1); background: rgba(245,165,36,0.12); }
.st-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; border: 1px solid var(--rule-strong); background: rgba(28,24,20,0.85); font-size: 11.5px; color: var(--text-1); }
.st-chip button { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.st-chip button:hover, .st-chip button:focus-visible { color: var(--text-1); }
.st-chip-base { padding-right: 10px; }
.st-chip .muted { color: var(--text-3); font-size: 11px; }

/* the reading: two lines, then "more" */
.st-head { position: absolute; left: 30px; top: 8px; width: min(600px, 42vw); z-index: 4; pointer-events: none; }
.st-head > * { pointer-events: auto; }
.st-reading { position: relative; }
.st-lead { font-size: clamp(17px, 1.4vw, 21px); line-height: 1.28; margin: 0 0 3px; color: var(--text-1); }   /* never clamped: it holds the figures and what they are */
.st-lead .fig { color: var(--money-hi); }
.st-lead .fig.assoc { color: #d9cdf0; }
.st-apportion { margin: 2px 0; font: italic 400 12.5px/1.3 var(--f-display); color: var(--text-2); border-left: 2px solid #c9b8e6; padding-left: 8px; }
.st-more summary { cursor: pointer; font-size: 11px; color: var(--text-3); list-style: none; }
.st-more summary::-webkit-details-marker { display: none; }
.st-more[open] { background: rgba(20,17,14,0.96); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; max-height: 52vh; overflow: auto; }
.st-sub { margin: 0 0 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.st-gross { margin: 2px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.4; }
.st-link { background: none; border: 0; padding: 0; color: var(--money-hi); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.st-coverage { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.st-gapchip { font-size: 10.5px; color: var(--text-3); border: 1px dashed var(--text-4); border-radius: 4px; padding: 1px 6px; }
.st-gapnote { font-size: 10.5px; color: var(--text-3); align-self: center; }
.st-cmp { margin: 4px 0; font-size: 12px; color: #fff; border-left: 2px solid #fff; padding-left: 8px; }

/* the lens: a layer over the stage, never over the timeline */
.st-lens { position: absolute; top: 0; right: 0; bottom: 132px; width: min(560px, 44vw); z-index: 5; background: rgba(20,17,14,0.97); border-left: 1px solid var(--rule-strong); box-shadow: -24px 0 60px rgba(0,0,0,0.5); overflow-y: auto; padding: 18px 20px 30px; }
.st-lens[data-lens="stack"], .st-lens[data-lens="spikes"] { width: min(980px, 72vw); }
.st-lens-close { position: sticky; top: 0; float: right; z-index: 2; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--ink-2); color: var(--text-1); font-size: 18px; cursor: pointer; }
.st-lens .view { padding: 0; max-width: none; }
.st-lens .dossier, .st-lens .entity, .st-lens .party, .st-lens .trace { max-width: none; margin: 0; padding-top: 0; }
.st-proof { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 13px; }
.st-proof th { text-align: left; font-weight: 400; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--rule); }
.st-proof td { text-align: right; color: var(--money-hi); border-bottom: 1px solid var(--rule); }
.st-method { position: absolute; inset: 0; overflow-y: auto; }
body.stage-body .footline { position: relative; bottom: auto; left: auto; right: auto; }

@media (max-width: 1180px) {
  .st-head { width: 44vw; }
  .st-sheet { max-width: 50vw; }
}

/* the compact arrangement (every phone, and any window too narrow or too short for the wide one): the reading, the
   flow, a handle above the timeline, and a bottom sheet for everything else. The reading is never clamped: it is the
   sentence that says what the figures are, and the flow starts below wherever it ends. */
.st-compact .st-head { left: 12px; right: 12px; width: auto; top: 6px; }
.st-compact .st-lead { font-size: 15.5px; }
.st-compact .st-apportion { font-size: 11.5px; }
.st-compact .st-more[open] { max-height: 44vh; }
.st-compact .st-sheet { position: absolute; left: 0; right: 0; top: auto; bottom: 86px; max-width: none; justify-items: stretch; gap: 0; z-index: 6; }
.st-compact .st-sheet-handle { display: block; margin: 0 12px; padding: 8px 12px; border-radius: 12px 12px 0 0; border: 1px solid var(--rule-strong); border-bottom: 0; background: var(--ink-2); color: var(--text-1); font-size: 13px; text-align: left; cursor: pointer; }
.st-compact .st-sheet-handle::after { content: "  open"; color: var(--text-3); font-size: 11px; }
.st-compact .st-sheet[data-open="true"] .st-sheet-handle::after { content: "  close"; }
.st-compact .st-sheet .st-tools, .st-compact .st-sheet .st-bar { display: none; }
.st-compact .st-sheet[data-open="true"] { background: var(--ink-2); border-top: 1px solid var(--rule-strong); max-height: 58vh; overflow-y: auto; padding-bottom: 10px; }
.st-compact .st-sheet[data-open="true"] .st-sheet-handle { margin: 0; border: 0; border-radius: 0; }
.st-compact .st-sheet[data-open="true"] .st-tools, .st-compact .st-sheet[data-open="true"] .st-bar { display: flex; justify-content: flex-start; padding: 6px 12px; }
.st-compact .st-sel select { max-width: 100%; }
.st-compact .st-lens { top: auto; left: 0; right: 0; bottom: 86px; width: auto; height: 58vh; border-left: 0; border-top: 1px solid var(--rule-strong); border-radius: 16px 16px 0 0; z-index: 7; }
.st-compact .st-lens[data-lens="stack"], .st-compact .st-lens[data-lens="spikes"] { width: auto; }

/* auction-cleared value: a cleared quantity, neither money nor relationship */
.cleared { color: #9fe0d2; border-bottom: 1px dotted rgba(159, 224, 210, 0.6); }
.st-filled { font-size: 10.5px; color: #9fe0d2; border: 1px solid rgba(159, 224, 210, 0.5); border-radius: 4px; padding: 1px 6px; }
.dz-svc-def { font-size: 12.5px; color: var(--text-2); border-left: 2px solid #9fe0d2; padding-left: 8px; }
.dz-svc-table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.dz-svc-table caption { text-align: left; font-size: 11px; color: var(--text-3); padding-bottom: 4px; }
.dz-svc-table th { text-align: left; font-weight: 400; color: var(--text-2); padding: 3px 18px 3px 0; border-bottom: 1px solid var(--rule); }
.dz-svc-table td { text-align: right; border-bottom: 1px solid var(--rule); }
.st-unmapped summary { cursor: pointer; font-size: 11.5px; color: #9fe0d2; margin: 6px 0; }
.st-unmapped-t { width: 100%; border-collapse: collapse; font-size: 11px; }
.st-unmapped-t th { text-align: left; font-weight: 400; color: var(--text-3); border-bottom: 1px solid var(--rule); padding: 3px 6px 3px 0; }
.st-unmapped-t td { border-bottom: 1px solid var(--rule); padding: 3px 6px 3px 0; color: var(--text-2); vertical-align: top; }
.st-unmapped-t .num { text-align: right; }

/* the corporate record as a list of steps, in the compact arrangement only */
.st-chain { display: none; }
.st-compact .st-sheet[data-open="true"] .st-chain { display: block; padding: 6px 12px 10px; font-size: 12.5px; color: var(--text-2); min-width: 0; max-width: 100vw; box-sizing: border-box; overflow-wrap: anywhere; white-space: normal; }
.st-compact .st-chain .eyebrow { white-space: normal; }
.st-compact .st-chain .ch-path { border-left: 2px solid #c9b8e6; padding-left: 8px; margin: 8px 0; }
.st-compact .st-chain .ch-head { color: var(--text-1); margin-bottom: 4px; }
.st-compact .st-chain ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.st-compact .st-chain .ch-name { color: var(--text-1); }
.st-compact .st-chain .ch-how { display: block; color: var(--text-2); }
.st-compact .st-chain .ch-ev { display: block; font: italic 11.5px/1.3 var(--f-display); color: #d9c7a1; }
/* the same list on a wide stage, in the room beside the boundary, when the record is too long to draw whole there */
.st-reclist { position: absolute; z-index: 3; overflow-y: auto; padding: 4px 10px 8px; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; background: rgba(14,12,10,0.6); border-bottom: 1px solid rgba(201,184,230,0.35); scrollbar-width: thin; scrollbar-color: #c9b8e6 transparent; }
.st-reclist[hidden] { display: none; }
.st-reclist .st-reclist-why { margin: 0 0 6px; font: italic 13px/1.35 var(--f-display); color: #cdbfe6; }
.st-reclist .eyebrow { white-space: normal; margin: 0 0 4px; }
.st-reclist .ch-path { border-left: 2px solid #c9b8e6; padding-left: 8px; margin: 8px 0; }
.st-reclist .ch-head { color: var(--text-1); margin-bottom: 4px; }
.st-reclist ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.st-reclist .ch-name { color: var(--text-1); }
.st-reclist .ch-how { display: block; color: var(--text-2); }
.st-reclist .ch-ev { display: block; font: italic 11.5px/1.3 var(--f-display); color: #d9c7a1; }

/* the date selector */
.st-datectl { display: inline-flex; gap: 2px; align-items: center; }
.st-dstep { padding: 3px 8px; }
.st-dstep[disabled] { opacity: 0.35; cursor: default; }
.st-datebtn[aria-expanded="true"] { border-color: var(--money-lo); color: var(--text-1); }
.dp { position: absolute; right: 30px; top: 74px; z-index: 9; width: 396px; background: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,0.55); padding: 12px 14px 10px; color: var(--text-2); font-size: 12px; }
@media (prefers-reduced-motion: no-preference) { .dp:not([data-still]) { animation: dp-in 160ms ease-out; } }
@keyframes dp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dp-years, .dp-months { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; }
.dp-y, .dp-m { background: none; border: 1px solid var(--rule); color: var(--text-2); border-radius: 999px; padding: 2px 7px; font-size: 11px; cursor: pointer; }
.dp-y[aria-pressed="true"], .dp-m[aria-pressed="true"] { background: var(--text-1); color: var(--ink-0); border-color: var(--text-1); }
.dp-m[disabled] { opacity: 0.3; cursor: default; }
.dp-nav { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; }
.dp-nav button { background: none; border: 1px solid var(--rule-strong); color: var(--text-1); border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 15px; line-height: 1; }
.dp-title { flex: 1; margin: 0; font: 400 17px var(--f-display); color: var(--text-1); text-align: center; }
.dp-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.dp-grid th { font-weight: 400; color: var(--text-3); font-size: 10.5px; padding: 2px 0; }
.dp-day { position: relative; height: 34px; text-align: center; cursor: pointer; border-radius: 6px; border: 1px solid transparent; }
.dp-fill { position: absolute; inset: 0; border-radius: 6px; background: rgba(245,165,36, calc(var(--t, 0) * 0.85)); }
.dp-n { position: relative; color: var(--text-1); font-variant-numeric: tabular-nums; }
.dp-off { cursor: not-allowed; }
.dp-off .dp-n { color: var(--text-4, #4d463e); text-decoration: line-through; }
.dp-win { box-shadow: inset 0 -2px 0 #c9b8e6; }
.dp-sel { border-color: #ffffff; }
.dp-latest::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: #9fe0d2; }
.dp-day:focus-visible { outline: 2px solid #9fe0d2; outline-offset: 1px; }
.dp-scale { margin: 6px 0; font-size: 11px; line-height: 1.45; color: var(--text-3); }
.dp-key { white-space: nowrap; margin-left: 6px; padding-left: 12px; position: relative; }
.dp-key::before { content: ""; position: absolute; left: 0; top: 3px; width: 8px; height: 8px; border-radius: 2px; }
.dp-key-win::before { box-shadow: inset 0 -2px 0 #c9b8e6; background: rgba(255,255,255,0.06); }
.dp-key-sel::before { border: 1px solid #fff; }
.dp-key-latest::before { background: #9fe0d2; border-radius: 50%; width: 6px; height: 6px; top: 4px; }
.dp-type { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.dp-type label { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dp-type input { flex: 1; min-width: 0; background: rgba(20,17,14,0.9); border: 1px solid var(--rule-strong); color: var(--text-1); border-radius: 6px; padding: 4px 8px; font: 12px var(--f-ui); }
.dp-type button { background: none; border: 1px solid var(--rule-strong); color: var(--text-1); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 11.5px; }
.dp-msg { min-height: 1.2em; margin: 4px 0 0; font-size: 11.5px; color: #f0b27a; }
.dp[data-sheet] { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 16px 16px 0 0; max-height: 86vh; overflow-y: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.dp[data-sheet] .dp-day { height: 40px; }
.st-compact .st-datectl { flex-wrap: nowrap; }
.st-caveat { margin: 0 0 3px; font-size: clamp(14px, 1.05vw, 16px); line-height: 1.3; color: var(--text-1); }
.st-compact .st-caveat { font-size: 13.5px; }

/* the footer carries both licence statements; on a phone it takes two short lines so they are always shown */
.footline .attr { display: inline-flex; gap: 10px; align-items: center; font-family: var(--f-ui); }
/* the footer is its own row of the page, so it takes the height its statements need and never covers the stage */
body.stage-body .footline { height: auto; min-height: var(--foot-h); }
body.stage-body .footline .attr { flex-wrap: wrap; justify-content: flex-end; row-gap: 3px; padding: 4px 0; }
.st-compact body.stage-body .footline { min-height: 38px; white-space: normal; padding: 3px 12px; gap: 0; }
.st-compact body.stage-body .footline > :not(.attr) { display: none; }
.st-compact body.stage-body .footline .attr { display: flex !important; flex-wrap: wrap; justify-content: flex-start; gap: 0 8px; margin: 0; padding: 0; font-size: 10px; line-height: 15px; }
/* the licence statements never give way: the coverage summary shrinks first, then drops */
body.stage-body .footline .attr { flex: none; margin-left: auto; display: inline-flex !important; }
body.stage-body .footline > :not(.attr) { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1279px) { body.stage-body .footline > .gen, body.stage-body .footline > .sep { display: none; } }
@media (max-width: 1100px) { body.stage-body .footline > :not(.attr) { display: none; } }
.st-compact body.stage-body .footline .attr { display: flex !important; flex: 1 1 100%; margin: 0; flex-wrap: wrap; }
.st-compact body.stage-body .footline > :not(.attr) { display: none; }
body.stage-body .footline > :not(.attr) { flex: none; line-height: 16px; }
@media (max-width: 1700px) { body.stage-body .footline > :nth-child(n+4):not(.attr) { display: none; } }
