/* Token Ledger demo: a month's AI spend set like a financial statement, every dollar drawn through. */
.tl {--tl-sans:'Hanken Grotesk','Hanken Fallback',Arial,sans-serif;--tl-serif:'Fraunces','Fraunces Fallback',Georgia,serif;font-variant-numeric:tabular-nums}
.tl button {font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;text-align:inherit}
.tl button:focus-visible {outline:1px solid var(--oxide);outline-offset:4px}

/* Head: the total on the left, the session log on the right. */
.tl-head {display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:clamp(2.5rem,6vw,7rem);align-items:start}
.tl-big {margin:0;font:300 clamp(3.4rem,7.4vw,7.6rem)/.9 var(--tl-serif);letter-spacing:-.035em;font-variant-numeric:lining-nums tabular-nums;color:var(--ink);white-space:nowrap}
.tl-cap {margin:.9rem 0 0;font-size:.9375rem;line-height:1.5;color:var(--ink-2)}
.tl-figs {display:grid;grid-template-columns:repeat(4,auto);justify-content:start;gap:.4rem clamp(1.4rem,2.6vw,2.6rem);margin:clamp(1.8rem,3vw,2.6rem) 0 0;padding-top:1rem;border-top:1px solid var(--rule)}
.tl-figs div {display:flex;flex-direction:column-reverse;gap:.15rem}
.tl-figs dt {font-size:.8125rem;line-height:1.35;color:var(--ink-2);white-space:nowrap}
.tl-figs dd {margin:0;font:400 1.55rem/1.1 var(--tl-sans);letter-spacing:-.02em;color:var(--ink)}
.tl-fig-leak dd {color:var(--oxide)}

.tl-log-head,.tl-row button {display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr) minmax(0,1.05fr) 5rem;column-gap:1rem;align-items:baseline}
.tl-log-head {margin:0;padding-bottom:.55rem;font-size:.75rem;color:var(--ink-2)}
.tl-log-head span:last-child,.tl-amt {text-align:right}
.tl-feed {list-style:none;margin:0;padding:0;min-height:calc(5 * 3.2rem)}
.tl-row {border-top:1px solid var(--rule);animation:tl-in .5s var(--ease) both;transition:opacity .35s}
.tl-row button {width:100%;padding:.62rem 0;font-size:.875rem;line-height:1.3;color:var(--ink)}
.tl-row button:hover .tl-who {color:var(--oxide)}
.tl-who {font-weight:500;min-width:0;transition:color .25s}
.tl-who small {display:block;margin-top:.12rem;font-size:.75rem;font-weight:400;color:var(--ink-2)}
.tl-model,.tl-wf {color:var(--ink-2);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tl-amt {font-weight:500}
.tl-row.is-alert .tl-who,.tl-row.is-alert .tl-amt {color:var(--oxide)}
.tl-row.is-alert.is-live .tl-amt::after {content:'';display:inline-block;width:5px;height:5px;margin-left:.45rem;vertical-align:.12em;border-radius:50%;background:var(--oxide);animation:tl-pulse .9s ease-in-out infinite}
.tl-row.is-dim {opacity:.3}
@keyframes tl-in {from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
@keyframes tl-pulse {50%{opacity:.2}}
.tl-note {margin:.9rem 0 0;padding-left:1rem;border-left:1px solid var(--oxide);max-width:34rem;font-size:.875rem;line-height:1.55;color:var(--ink-2);opacity:0;transform:translateY(6px);transition:opacity .5s var(--ease),transform .6s var(--ease)}
.tl-note.is-on {opacity:1;transform:none}
.tl-note b {font-weight:500;color:var(--oxide)}

/* Switches: colored words, no pills. */
.tl-bar {display:flex;flex-wrap:wrap;justify-content:space-between;gap:.8rem 2rem;margin-top:clamp(2.6rem,4vw,3.6rem);padding-top:1.1rem;border-top:1px solid var(--rule)}
.tl-switch {display:flex;flex-wrap:wrap;gap:.3rem 1.4rem;align-items:baseline}
.tl-switch button {padding:.3rem 0;font-size:.9375rem;color:var(--ink-2);text-decoration:underline;text-decoration-color:transparent;text-underline-offset:.4em;transition:color .25s,text-decoration-color .25s}
.tl-switch button:hover {color:var(--ink);text-decoration-color:var(--rule)}
.tl-switch button[aria-pressed="true"] {color:var(--ink);text-decoration-color:var(--oxide)}
.tl-switch .tl-clear {color:var(--oxide)}

/* The flow: three columns of labels, hairlines between them. */
.tl-flow {position:relative;display:grid;grid-template-columns:minmax(8.5rem,11rem) minmax(3rem,1fr) minmax(7.5rem,9rem) minmax(3rem,1fr) minmax(12rem,16rem);margin-top:clamp(1.8rem,3vw,2.6rem)}
.tl-col {list-style:none;margin:0;padding:0;display:grid;gap:.9rem;align-content:start}
.tl-col[data-col="a"] {grid-column:1}
.tl-col[data-col="m"] {grid-column:3}
.tl-col[data-col="b"] {grid-column:5}
.tl-node button {display:flex;flex-direction:column;gap:.1rem;width:100%;transition:opacity .35s}
.tl-node b {font-weight:500;font-size:.9375rem;line-height:1.2;color:var(--ink);transition:color .25s}
.tl-node span {font-size:.8125rem;line-height:1.3;color:var(--ink-2)}
.tl-col[data-col="a"] .tl-node button {text-align:right;align-items:flex-end}
.tl-col[data-col="m"] .tl-node button {align-items:center;text-align:center}
.tl-node button:hover b {color:var(--oxide)}
.tl-node button[aria-pressed="true"] b {color:var(--oxide)}
.tl-node.is-leak b,.tl-node.is-leak span {color:var(--ink-2)}
.tl[data-flag] .tl-node.is-runaway b {color:var(--oxide)}
.tl-node.is-dim button {opacity:.28}

/* Laid out by script: nodes placed at their slice of the column. */
.tl-flow[data-laid] .tl-col {position:relative;display:block}
.tl-flow[data-laid] .tl-node {position:absolute;left:0;right:0;top:0;height:var(--h);transform:translateY(var(--y));transition:transform .8s var(--ease),opacity .5s}
.tl-flow[data-laid] .tl-node button {height:100%;justify-content:flex-start}
.tl-flow[data-laid] .tl-col[data-col="m"] .tl-node button {justify-content:center}
.tl-flow[data-laid] .tl-node.is-gone {opacity:0;pointer-events:none}
.tl[data-phase="stream"] .tl-node {opacity:0}
.tl[data-phase="flow"] .tl-node {animation:tl-fade .6s var(--ease) both}
.tl[data-phase="flow"] .tl-col[data-col="m"] .tl-node {animation-delay:.35s}
.tl[data-phase="flow"] .tl-col[data-col="b"] .tl-node {animation-delay:.7s}
@keyframes tl-fade {from{opacity:0}to{opacity:1}}

.tl-wires {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.tl-line {fill:none;stroke:var(--ink);stroke-width:.75;opacity:.42;stroke-dasharray:1;stroke-dashoffset:0;transition:stroke-dashoffset 1.3s var(--ease),opacity .35s,stroke .35s}
.tl-line.is-leak {stroke:var(--ink-2);opacity:.26;stroke-dasharray:.006 .006}
.tl-line.is-alert {stroke:var(--oxide);stroke-width:1;opacity:1;stroke-dasharray:1}
.tl-line.is-dim {opacity:.06}
.tl-bar-l {stroke:var(--ink);stroke-width:1.25;opacity:.85}
.tl-bar-l.is-leak {stroke:var(--ink-2);opacity:.6}

/* Static fallback before the script runs. */
.tl:not([data-state]) .tl-note {opacity:1;transform:none}

@media(max-width:980px){
 .tl-head {grid-template-columns:1fr;gap:2.4rem}
}
@media(max-width:760px){
 .tl-wires {display:none}
 .tl-flow {grid-template-columns:1fr;gap:2rem}
 .tl-col[data-col] {grid-column:1}
 .tl-flow[data-laid] .tl-col {display:grid;height:auto!important;gap:.75rem}
 .tl-flow[data-laid] .tl-node {position:relative;height:auto;transform:none}
 .tl-flow[data-laid] .tl-node.is-gone {display:none}
 .tl-col .tl-node button,.tl-col[data-col="a"] .tl-node button,.tl-col[data-col="m"] .tl-node button {align-items:flex-start;text-align:left}
 .tl-node button::after {content:'';display:block;height:1px;margin-top:.4rem;width:calc(var(--w,0) * 100%);background:var(--ink);opacity:.55;transform-origin:left;animation:tl-grow .9s var(--ease) both}
 .tl-node.is-leak button::after {background:var(--ink-2)}
 .tl-figs {grid-template-columns:repeat(2,auto);row-gap:1rem}
 .tl-log-head,.tl-row button {grid-template-columns:minmax(0,1fr) minmax(0,.9fr) 4.6rem}
 .tl-log-head span:nth-child(3),.tl-wf {display:none}
 .tl-big {font-size:clamp(3rem,15vw,4.4rem)}
}
@keyframes tl-grow {from{transform:scaleX(0)}to{transform:none}}
