/* The Tools pages (inc/tools*.php): loaded on those pages only, after guides.css. Light and dark from the theme's tokens.
   Chart colours: the eight-slot categorical set, validated for colour-blind separation on this site's light card (#fff)
   and dark card (#0a272d); the three light slots under 3:1 contrast always carry a direct label or a table. */

.tl-page {
	--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
	--pos: #2a78d6; --neg: #e34948; --mid: #f0efec;
	--grid: #e1e7e6; --axis: #6e8584;
}
:root[data-theme="dark"] .tl-page {
	--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
	--pos: #3987e5; --neg: #e66767; --mid: #1d3c42;
	--grid: #183c42; --axis: #8eaeaa;
}
.tl-c-eur { --c: var(--s1); } .tl-c-gbp { --c: var(--s2); } .tl-c-aud { --c: var(--s3); } .tl-c-nzd { --c: var(--s4); }
.tl-c-usd { --c: var(--s5); } .tl-c-cad { --c: var(--s6); } .tl-c-chf { --c: var(--s7); } .tl-c-jpy { --c: var(--s8); }
.tl-s1 { --c: var(--s1); } .tl-s2 { --c: var(--s2); } .tl-s3 { --c: var(--s3); } .tl-s4 { --c: var(--s4); }
.tl-s7 { --c: var(--s7); } .tl-s8 { --c: var(--s8); }

/* ---- hero */
.tl-hero { padding: 40px 0 28px; }
.tl-hero h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); }
.tl-crumbs { font-size: .86rem; color: #b9d3d0; margin-bottom: 14px; }
.tl-crumbs a { color: #dcebe9; }
.tl-crumbs span { color: #fff; }
.tl-facts { margin-top: 22px; }
.tl-facts b { font-size: 1.35rem; }

/* ---- the tool: inputs on the left, results on the right */
.tl-tool { padding-top: 34px; }
.tl-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 22px; align-items: start; }
.tl-panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.tl-panel-out { position: sticky; top: 92px; }
.tl-form { display: grid; gap: 14px; }
.tl-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tl-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
/* fields side by side line up: their labels share one track, their boxes the next, their help and errors the last two
   (a label that wraps lifts its neighbours' labels, never their boxes) */
.tl-row { row-gap: 0; }
.tl-row > .tl-field:not(.tl-switch) { grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; padding-bottom: 10px; }
.tl-row > .tl-field:not(.tl-switch) > label { align-self: end; margin-bottom: 5px; }
.tl-row > .tl-switch { grid-row: span 4; align-self: start; }
.tl-row > .tl-field:not(.tl-switch) > :nth-child(n+3) { align-self: start; margin-top: 5px; }
.tl-field > label, .tl-switch legend { font-weight: 700; font-size: .9rem; color: var(--ink); }
.tl-field input, .tl-field select, .tl-field textarea {
	font: 16px/1.3 var(--font); color: var(--ink); background: var(--field); border: 1.5px solid var(--field-line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.tl-field textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; resize: vertical; }
.tl-field input:focus, .tl-field select:focus, .tl-field textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand-bright) 40%, transparent); border-color: var(--brand-bright); }
.tl-field input[data-num] { font-variant-numeric: tabular-nums; }
.tl-field [aria-invalid="true"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--field)); }
.tl-help { color: var(--mute); font-size: .8rem; line-height: 1.4; }
.tl-err { color: var(--bad); font-size: .82rem; font-weight: 600; }
.tl-alert { margin: 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); color: var(--ink); font-weight: 600; }
.tl-switch { border: 0; margin: 0; padding: 0; }
.tl-switch div { display: flex; flex-wrap: wrap; gap: 6px; background: var(--soft); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tl-switch label { flex: 1 1 auto; position: relative; cursor: pointer; }
.tl-switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tl-switch span { display: block; text-align: center; padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.tl-switch input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px -3px #00000040; outline: 2px solid var(--brand-bright); }
.tl-switch input:focus-visible + span { outline: 3px solid var(--accent); }
.tl-more { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--paper); }
.tl-more > summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.tl-more[open] { padding-bottom: 14px; }
.tl-more .tl-row + .tl-row, .tl-more .tl-row + .tl-field { margin-top: 2px; }
.tl-more .tl-field + .tl-field { margin-top: 12px; }
.ps-group { margin: 6px 0 8px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.ps-group ~ .ps-group { margin-top: 16px; }
.ps-note { margin: 2px 0 0; }
.tl-rate-box[hidden] { display: none; }
.tl-check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .92rem; }
.tl-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.tl-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tl-progress { height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.tl-progress i { display: block; height: 100%; width: 0; background: var(--meter); transition: width .15s; }

/* what shows when */
.tl-if-amount, .tl-if-history, .tl-if-block, .tl-if-fixed, .tl-if-custom { display: none; }
.is-amount .tl-if-amount, .is-history .tl-if-history, .is-block .tl-if-block, .is-fixed .tl-if-fixed, .is-custom .tl-if-custom { display: grid; }
.is-history .tl-if-history { display: block; }
.is-amount .tl-if-percent, .is-history .tl-if-parametric, .is-fixed .tl-if-fractional, .is-profitwd .tl-if-amountwd { display: none; }
.tl-page:not(.is-r) .tl-if-r { display: none; }
.tl-if-pips { display: none; }
.is-pips .tl-if-pips { display: grid; }
.is-pips .tl-if-price, .is-pips:not(.needs-price) .ps-entry, .tl-page:not(.is-fx) .ps-if-fx { display: none; }
.ps-spec { margin-top: 2px; }
/* the instrument search (position.js) */
.ps-pick { position: relative; }
.ps-q { padding-left: 38px !important; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236e8584' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M12.5 12.5 17 17'/%3E%3C/svg%3E") no-repeat 12px 50% !important; font-weight: 700; }
.ps-options { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.ps-options li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ps-options li[aria-selected="true"], .ps-options li:hover { background: var(--soft); }
.ps-options li span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-options li small { color: var(--mute); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.ps-options .ps-none { display: block; color: var(--mute); cursor: default; }
.ps-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ps-quick button { font: 700 .8rem var(--font); padding: 5px 11px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; }
.ps-quick button:hover { border-color: var(--accent); }
.ps-quick button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.tl-linkbtn { font: inherit; font-weight: 700; color: var(--accent-deep, var(--brand)); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---- results */
.tl-out { display: grid; gap: 14px; }
.tl-hero-num { display: grid; gap: 2px; padding: 16px 18px; border-radius: 14px; color: #fff; background: radial-gradient(400px 200px at 90% 0, #f0b42933, transparent 60%), linear-gradient(150deg, #0b4a52, var(--brand-deep)); }
.tl-hero-num .tl-k { color: #b9d3d0; font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tl-hero-num b { font-size: clamp(2.2rem, 5vw, 3.1rem); line-height: 1.05; color: var(--accent-2); letter-spacing: -.02em; overflow-wrap: anywhere; }
.tl-hero-num span:last-child { color: #dcebe9; font-size: .92rem; }
.tl-flag { margin: 0; display: grid; gap: 6px; }
.tl-flag span { display: block; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--note-line); color: var(--note-ink); font-size: .9rem; }
.tl-kv { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tl-kv li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--soft); min-width: 0; }
.tl-kv span { color: var(--mute); font-size: .78rem; }
.tl-kv b { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tl-kv-small li { padding: 8px 10px; }
.tl-risk { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.tl-risk-h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl-risk-h span { font-weight: 700; }
.tl-meter { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.tl-meter i { display: block; height: 100%; width: 0; background: var(--meter); transition: width .4s; border-radius: inherit; }
.tl-meter i.is-full { background: var(--meter-full); }
.tl-meter i.is-over { background: var(--bad); }
.tl-workings { font-size: .9rem; }
.tl-workings summary { cursor: pointer; font-weight: 700; }
.tl-workings ol { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 4px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-method { margin: 0; font-size: .86rem; color: var(--ink-2); background: var(--soft); border-left: 4px solid var(--brand-bright); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.tl-sub { font-size: 1rem; margin: 4px 0 0; }
.tl-gauges { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tl-gauges li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .9rem; }
.tl-gauges b { font-variant-numeric: tabular-nums; }
.tl-g { grid-column: 1 / -1; display: block; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.tl-g i { display: block; height: 100%; width: 0; background: var(--meter); border-radius: inherit; transition: width .5s; }
.tl-note { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); font-size: .9rem; color: var(--ink-2); }
.tl-warn { color: var(--bad); }
.tl-muted { color: var(--mute); }
.is-busy .tl-out { opacity: .55; transition: opacity .2s; }

/* ---- charts */
.tl-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.tl-fig { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-width: 0; }
.tl-fig-wide { grid-column: 1 / -1; }
.tl-fig figcaption { font-size: .9rem; color: var(--mute); margin-bottom: 10px; }
.tl-fig figcaption b { color: var(--ink); font-size: 1rem; }
.tl-chart { position: relative; }
.tl-chart svg { overflow: visible; }
.tl-gridlines line { stroke: var(--grid); stroke-width: 1; }
.tl-gridlines line.tl-base { stroke: var(--axis); }
.tl-axis { fill: var(--axis); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.tl-line { fill: none; stroke: var(--c, var(--s1)); stroke-linejoin: round; stroke-linecap: round; }
.tl-line.tl-thin { stroke: var(--axis); opacity: .28; }
.tl-band { fill: var(--s1); opacity: .12; }
.tl-dot { fill: var(--c, var(--s1)); stroke: var(--card); stroke-width: 2; }
.tl-endlabel { fill: var(--ink-2); font: 700 11px var(--font); }
.tl-cross { stroke: var(--axis); stroke-dasharray: 3 3; }
.tl-bar { fill: var(--s1); }
.tl-bar-2 { fill: var(--s8); }
.tl-bar.is-hot { opacity: .75; }
.tl-marker { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tl-marker.is-median { stroke: var(--accent-deep); }
.tl-mlabel { fill: var(--ink-2); font: 700 11px var(--font); }
.tl-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 150px; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .82rem; font-variant-numeric: tabular-nums; }
.tl-tip-h { font-weight: 700; margin-bottom: 4px; }
.tl-tip div { display: flex; align-items: center; gap: 6px; }
.tl-tip b { margin-left: auto; }
.tl-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--s1)); margin-right: 6px; vertical-align: middle; flex: none; }
.tl-key.is-dash { height: 3px; background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; margin-bottom: 8px; color: var(--ink-2); }

/* ---- tables */
.tl-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--line); }
.tl-scroll { max-height: 520px; overflow-y: auto; }
.tl-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; background: var(--card); }
.tl-table th, .tl-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tl-table thead th { background: var(--soft); font-size: .8rem; color: var(--ink-2); position: sticky; top: 0; }
.tl-table .num { text-align: right; }
.tl-table tbody th { background: none; font-weight: 700; color: var(--ink); }
.tl-table small { color: var(--mute); font-weight: 400; }
.tl-table tbody tr:last-child td, .tl-table tbody tr:last-child th { border-bottom: 0; }

/* ---- content sections */
.tl-flow { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.tl-flow li { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.tl-flow li > b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 900; margin-bottom: 10px; }
.tl-flow h3 { margin: 0 0 6px; }
.tl-flow p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.tl-formula { background: var(--brand-deep); color: #fff; border-radius: 14px; padding: 16px 18px; margin: 0 0 14px; overflow-x: auto; }
.tl-formula code { font: 600 1rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--accent-2); white-space: pre-wrap; background: none; padding: 0; border: 0; }
.tl-examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tl-examples article { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; }
.tl-examples ul { padding-left: 1.1em; color: var(--ink-2); font-size: .92rem; }
.tl-ans { margin: auto 0 0; font-size: 1.5rem; font-weight: 800; color: var(--link); }
.tl-ans small { display: block; font-size: .85rem; color: var(--mute); font-weight: 600; }
.tl-hbars { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.tl-hbars li { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; }
.tl-hbars i { display: block; height: 16px; width: var(--w); border-radius: 0 6px 6px 0; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); }
.tl-hbars b { text-align: right; font-variant-numeric: tabular-nums; }
.tl-versus .vg-side ul li { text-decoration: none; }
.tl-mistakes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-mistakes h3 { margin: 0 0 4px; font-size: 1rem; }
.tl-mistakes p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.tl-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.tl-ol { padding-left: 1.3em; display: grid; gap: 8px; }
.tl-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.tl-list li { padding: 8px 10px; border-radius: 10px; background: var(--soft); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tl-list em { font-style: normal; font-weight: 700; margin-left: auto; font-variant-numeric: tabular-nums; }
.tl-list small { color: var(--mute); }
.tl-why { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tl-why li { display: grid; gap: 6px; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.tl-why .vi { color: var(--brand-bright); width: 28px; height: 28px; }
.tl-why span { color: var(--ink-2); font-size: .92rem; }
.tl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tl-card { display: grid; gap: 6px; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .15s, border-color .15s; }
.tl-card:hover { transform: translateY(-2px); border-color: var(--brand-bright); color: var(--ink); }
.tl-card .vi { color: var(--accent-deep); }
.tl-card span { color: var(--mute); font-size: .9rem; }

/* ---- the hub */
.tl-hubgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tl-hubcard { display: grid; gap: 8px; padding: 24px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tl-hubcard:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--ink); }
.tl-hubcard h2 { margin: 6px 0 0; font-size: 1.4rem; }
.tl-hubcard p { margin: 0; color: var(--ink-2); }
.tl-go { color: var(--link); font-weight: 700; }
.tl-hubart { display: block; border-radius: 14px; overflow: hidden; background: #020d10; aspect-ratio: 16 / 9; }
.tl-hubart .tl-cover { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.tl-hubcard:hover .tl-cover { transform: scale(1.04); }
.tl-hero .vg-hero-art { position: relative; }
.tl-hero .vg-hero-art .tl-cover { display: block; width: 100%; height: auto; border-radius: 20px; border: 1px solid #ffffff26; box-shadow: 0 30px 60px -30px #000, 0 0 0 6px #ffffff0d; }

/* ---- tabs */
.tl-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; align-items: center; }
.tl-tabs [role="tab"] { font: 700 .9rem var(--font); padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tl-tabs [role="tab"][aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.tl-tabs [role="tab"][data-off] { color: var(--mute); border-style: dashed; }
.tl-tabs [role="tab"]:disabled { opacity: .45; cursor: not-allowed; }
.tl-lock .vi { width: 14px; height: 14px; }
.tl-tabs .cp-csv { margin-left: auto; }

/* ---- the strength meter: Strong in green with an up arrow, Weak in red with a down arrow, Neutral grey.
   The fills carry their own ink (--up-ink, --down-ink) at 4.5:1 or better; arrows and words mean colour is never alone. */
.tl-page { --up: #0e7a3d; --up-soft: #dff3e6; --up-ink: #fff; --down: #c62f2e; --down-soft: #fbe3e2; --down-ink: #fff; --flat: #6e8584; --flat-soft: #eef2f1; }
:root[data-theme="dark"] .tl-page { --up: #2fc472; --up-soft: #12392a; --up-ink: #04191d; --down: #ff6b6b; --down-soft: #3d1b1f; --down-ink: #04191d; --flat: #8eaeaa; --flat-soft: #15343a; }
.tl-page .is-strong { --c: var(--up); --c-soft: var(--up-soft); --c-ink: var(--up-ink); }
.tl-page .is-weak { --c: var(--down); --c-soft: var(--down-soft); --c-ink: var(--down-ink); }
.tl-page .is-neutral { --c: var(--flat); --c-soft: var(--flat-soft); --c-ink: #fff; }
.cs-tool { --pos: var(--up); --neg: var(--down); }
.cs-status { margin-bottom: 18px; }
.cs-off { margin-bottom: 14px; border-color: var(--note-line); background: var(--accent-soft); color: var(--note-ink); }
.is-empty .cs-main { display: none; }
.is-busy .cs-main { opacity: .55; transition: opacity .2s; }
.cs-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.cs-main > *, .cs-spot > *, .cs-spot-col ol > * { min-width: 0; }
.cs-main .tl-sub { margin: 0 0 12px; }

/* the badge: arrow and word */
.cs-tool .cs-badge, .cs-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--c); color: var(--c-ink); font-weight: 800; font-size: .78rem; letter-spacing: .02em; white-space: nowrap; }
.cs-badge i { font-style: normal; font-size: .7rem; }
.cs-tool .cs-badge.is-neutral, .cs-badge.is-neutral { background: var(--c-soft); color: var(--ink-2); }

/* strongest now / weakest now */
.cs-spot { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: stretch; }
.cs-spot-col { padding: 18px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.cs-spot-col.is-up { background: linear-gradient(160deg, var(--up-soft), var(--card) 70%); border-top: 5px solid var(--up); }
.cs-spot-col.is-down { background: linear-gradient(160deg, var(--down-soft), var(--card) 70%); border-top: 5px solid var(--down); }
.cs-spot-col h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; }
.cs-spot-col.is-up h3 i { color: var(--up); font-style: normal; }
.cs-spot-col.is-down h3 i { color: var(--down); font-style: normal; }
.cs-spot-col ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.cs-card { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 14px 8px 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--c); min-width: 0; }
.cs-card:first-child { box-shadow: 0 10px 26px -14px var(--c); }
.cs-card b { font-size: 1.45rem; line-height: 1.1; }
.cs-card > span:not(.cs-badge) { font-size: .74rem; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cs-card em { font-style: normal; font-weight: 900; font-size: 2.1rem; line-height: 1.05; color: var(--c); font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.cs-card.is-neutral em { color: var(--ink-2); }
.cs-spot-mid { display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 16px 18px; border-radius: 20px; color: #fff; background: radial-gradient(160px 120px at 50% 0%, #f0b42955, transparent 70%), linear-gradient(160deg, #0b4a52, var(--brand-deep)); min-width: 150px; }
.cs-spot-mid span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #b9d3d0; max-width: 130px; }
.cs-spot-mid b { font-size: 1.7rem; color: var(--accent); }
.cs-spot-mid small { color: #dcebe9; }

/* every market on one board */
.cs-board-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; margin-bottom: 8px; }
.cs-board-head .tl-sub { margin: 0; }
.cs-scale { display: flex; gap: 3px; font-size: .8rem; min-width: min(100%, 420px); }
.cs-scale span { flex: var(--w) 1 0; min-width: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; padding: 5px 9px; border-radius: 8px; color: var(--ink); background: var(--c-soft); border-top: 3px solid var(--c); }
.cs-scale small { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cs-board ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cs-row, .cs-axis { display: grid; grid-template-columns: 26px 190px minmax(0, 1fr) 96px; gap: 12px; align-items: center; }
.cs-row { padding: 6px 8px; border-radius: 12px; }
.cs-row:nth-child(-n+3).is-strong, .cs-row:nth-last-child(-n+3).is-weak { background: var(--c-soft); }
.cs-rank { font-weight: 800; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.cs-who { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cs-who b { font-size: 1.05rem; }
.cs-who small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-meter { position: relative; height: 28px; border-radius: 8px; background: linear-gradient(90deg, var(--down-soft) 0 40%, var(--flat-soft) 40% 60%, var(--up-soft) 60% 100%); }
.cs-meter::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--axis); border-radius: 2px; }
.cs-meter i { position: absolute; top: 6px; bottom: 6px; background: var(--c); border-radius: 4px; transition: left .5s, width .5s; }
.cs-meter s { position: absolute; top: 50%; z-index: 1; transform: translate(-50%, -50%); text-decoration: none; min-width: 34px; padding: 2px 6px; border-radius: 99px; background: var(--card); border: 2px solid var(--c); font-weight: 900; font-size: .82rem; text-align: center; font-variant-numeric: tabular-nums; transition: left .5s; }
.cs-axis { font-size: .72rem; color: var(--mute); padding: 0 8px 2px; }
.cs-ticks { position: relative; height: 14px; }
.cs-ticks i { position: absolute; transform: translateX(-50%); font-style: normal; font-variant-numeric: tabular-nums; }
.cs-row .cs-badge { justify-self: start; }

/* every timeframe: solid cells */
.cs-overview th, .cs-overview td { white-space: nowrap; }
.cs-cell { font-variant-numeric: tabular-nums; font-weight: 800; }
.cs-cell.is-strong, .cs-cell.is-weak { background: var(--c); color: var(--c-ink); }
.cs-overall { min-width: 130px; }
.cs-overall.is-strong, .cs-overall.is-weak { background: var(--c-soft); color: var(--ink); }
.cs-overall b { font-size: 1.1rem; margin-right: 4px; }

/* one timeframe: the widest gaps, the history, each against each */
.cs-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.cs-pairs li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); }
.cs-pairs li > b { width: 100%; font-size: 1.05rem; }
.cs-pairs em { margin-left: auto; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.cs-chip { padding: 2px 9px; border-radius: 99px; background: var(--c); color: var(--c-ink); font-weight: 800; font-size: .8rem; }
.cs-chip.is-neutral { background: var(--c-soft); color: var(--ink-2); }
.cs-vs-dash { font-size: .75rem; color: var(--mute); }
.cs-heatmap td, .cs-heatmap th { text-align: center; padding: 8px 6px; }
.cs-heatmap td { background: color-mix(in oklab, var(--pos) var(--a), var(--mid)); color: var(--ink); font-size: .82rem; font-variant-numeric: tabular-nums; }
.cs-heatmap td.is-neg { background: color-mix(in oklab, var(--neg) var(--a), var(--mid)); }
.cs-heatmap td.is-self, .cs-heatmap td.is-none { background: var(--soft); color: var(--mute); }
.tl-gridlines line.tl-ref { stroke-dasharray: 5 4; stroke-width: 1.5; stroke: var(--c); }
.tl-gridlines line.tl-ref.is-mid { stroke: var(--axis); stroke-width: 1; }

/* ---- the simulator: one run, month by month */
.mc-one-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; align-items: flex-start; margin-bottom: 14px; }
.mc-one-head .tl-sub { margin: 0; font-size: 1.15rem; }
.mc-one-head p { margin: 4px 0 0; font-size: .88rem; }
.mc-one-head .tl-tabs { margin: 0; }
.mc-one-kv { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.mc-one-kv b { font-size: 1.15rem; }
.mo-years { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; align-items: start; }
.mo-year caption { caption-side: top; text-align: left; font-weight: 800; font-size: 1.05rem; padding: 10px 12px 4px; color: var(--ink); }
.mo-year td, .mo-year th { padding: 6px 12px; }
.mo-year tfoot th { background: var(--soft); border-top: 2px solid var(--line); }
.tl-table .is-up { color: var(--ok); }
.tl-table .is-down { color: var(--bad); }
.tl-total { margin-top: -6px; }

/* ---- the compounding calculator */
.cp-split { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--soft); gap: 2px; }
.cp-split i { display: block; height: 100%; transition: width .4s; }
.cp-cap { background: var(--s1); }
.cp-prof { background: var(--s4); }

/* ---- smaller screens */
@media (max-width: 980px) {
	.tl-grid, .tl-charts, .tl-split, .tl-hubgrid { grid-template-columns: minmax(0, 1fr); }
	.tl-panel-out { position: static; }
	.tl-flow, .tl-why { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tl-examples, .tl-mistakes { grid-template-columns: minmax(0, 1fr); }
	.cs-spot { grid-template-columns: minmax(0, 1fr); }
	.cs-spot-mid { grid-auto-flow: column; gap: 10px; align-items: baseline; padding: 12px; }
	.cs-spot-mid span { max-width: none; }
}
@media (max-width: 560px) {
	.tl-panel, .tl-fig { padding: 14px; border-radius: 14px; }
	.tl-row, .tl-row-3, .tl-kv { grid-template-columns: minmax(0, 1fr); }
	.tl-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mc-one-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tl-flow, .tl-why { grid-template-columns: minmax(0, 1fr); }
	.tl-hbars li { grid-template-columns: 90px 1fr 70px; }
	.cs-row, .cs-axis { grid-template-columns: 18px 58px minmax(0, 1fr) 30px; gap: 8px; }
	.cs-who small, .cs-badge-word { display: none; }
	.cs-row .cs-badge { padding: 3px 7px; font-size: 0; }
	.cs-row .cs-badge i { font-size: .72rem; }
	.cs-spot-col ol { gap: 6px; }
	.cs-card { padding: 10px 4px; }
	.cs-card b { font-size: 1.15rem; }
	.cs-card em { font-size: 1.6rem; }
	.cs-card .cs-badge { font-size: .68rem; padding: 2px 7px; }
	.cs-scale { min-width: 100%; }
	.tl-hero .vg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (forced-colors: active) {
	.cs-meter i, .cs-badge, .cs-cell, .tl-bar, .tl-meter i, .tl-g i { forced-color-adjust: none; }
}
