/* Calculators under /resources/tools/. Colours and type come from the brand tokens set in templates/base.html:
   white page, navy text, one typeface, one accent, tables with a 2 pixel navy rule, no shadows or gradients. */
.tl { max-width: 1080px; margin: 0 auto; padding: 2.5rem 18px 4.5rem; color: var(--ink); }
.tl h1, .tl h2, .tl h3 { font-family: var(--font-sans); letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.tl h1 { font-size: clamp(1.9rem, 3.5vw, 2.4rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.16; }
.tl h2 { font-size: 1.625rem; font-weight: 800; line-height: 1.25; margin-bottom: 0.9rem; }
.tl h3 { font-size: 1.18rem; font-weight: 700; line-height: 1.3; margin: 1.3rem 0 0.4rem; }
.tl p { margin: 0 0 1rem; font-size: 1.125rem; line-height: 1.67; }
.tl a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.tl a:hover { color: var(--ink); }
.tl-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tl-crumbs { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; font-size: 0.94rem; color: var(--muted); }
.tl-crumbs a { color: var(--ink-2); text-decoration: none; }
.tl-crumbs a:hover { color: var(--accent-ink); }
.tl-head { border-bottom: 6px solid var(--ink); padding-bottom: 1.4rem; margin-bottom: 2rem; }
.tl-lead { color: var(--ink-2); max-width: 820px; margin: 0.8rem 0 0 !important; }

.tl-work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2rem; align-items: start; }
.tl-work.is-wide { grid-template-columns: minmax(0, 1fr); }

.tl-form { display: grid; gap: 1.4rem; }
.tl-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.tl-group legend { font-size: 1.18rem; font-weight: 700; padding: 0 0 0.5rem; border-bottom: 2px solid var(--ink); width: 100%; margin-bottom: 0.9rem; }
.tl-fields { display: grid; gap: 0.9rem; }
.tl-work.is-wide .tl-fields { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.9rem 1.2rem; }
.tl-field { display: grid; gap: 0.3rem; align-content: start; }
.tl-field label { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.tl-field label span, .tl-grid th span { font-weight: 400; color: var(--muted); }
.tl-field small, .tl-grid-help { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.tl-grid-help { display: block; margin-top: 0.5rem; }
.tl input[type="number"], .tl select, .tl textarea {
    width: 100%; font: 400 1.06rem var(--font-sans); color: var(--ink); background: var(--paper);
    border: 1px solid var(--muted); border-radius: var(--radius-sm); padding: 0.5rem 0.65rem; }
.tl textarea { font-size: 1rem; line-height: 1.55; font-variant-numeric: tabular-nums; resize: vertical; }
.tl input:focus, .tl select:focus, .tl textarea:focus, .tl-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--ink); }

.tl-scroll { overflow-x: auto; }
.tl-grid { border-collapse: collapse; width: 100%; min-width: 560px; }
.tl-grid thead th { text-align: left; font-weight: 700; font-size: 1rem; padding: 0 0.5rem 0.5rem; }
.tl-grid tbody th { text-align: left; font-weight: 600; font-size: 1rem; padding: 0.35rem 0.8rem 0.35rem 0; line-height: 1.35; width: 38%; }
.tl-grid td { padding: 0.25rem 0.5rem; }
.tl-grid input[type="number"] { min-width: 110px; }

.tl-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.tl-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.65rem 1.3rem; font: 600 1rem/1.25 var(--font-sans);
    background: var(--accent); color: var(--on-accent) !important; border: 1.5px solid var(--accent); border-radius: var(--radius-pill);
    text-decoration: none !important; cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.tl-button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper) !important; }
.tl-button.is-quiet { background: var(--paper); color: var(--ink) !important; border-color: var(--ink); }
.tl-button.is-quiet:hover { background: var(--accent-tint); color: var(--ink) !important; }
.tl-button:disabled { opacity: 0.5; cursor: default; }

.tl-result { background: var(--paper-2); border-radius: var(--radius-md); padding: 1.5rem; position: sticky; top: 84px; min-width: 0; }
.tl-work.is-wide .tl-result { position: static; }
.tl-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.4rem; margin-bottom: 1.2rem; }
.tl-number { display: grid; gap: 0.15rem; align-content: start; border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.tl-number-label { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.tl-number strong { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.tl-number small { color: var(--ink-2); font-size: 0.92rem; line-height: 1.4; }
.tl-note { font-size: 1.02rem !important; line-height: 1.55 !important; color: var(--ink); }
.tl-error { font-size: 1.02rem !important; font-weight: 600; color: var(--ink); background: var(--accent-tint); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; }
.tl-save { margin-top: 1.2rem; }
.tl-save p { font-size: 1rem; line-height: 1.5; margin: 0; }

.tl-table-wrap { overflow-x: auto; margin-top: 1.2rem; }
.tl-table-wrap h3 { margin: 0 0 0.5rem; font-size: 1.06rem; }
.tl-table { border-collapse: collapse; width: 100%; font-size: 1rem; line-height: 1.45; background: transparent; }
.tl-table th, .tl-table td { text-align: left; vertical-align: top; padding: 0.5rem 0.9rem 0.5rem 0; border-bottom: 1px solid var(--line); }
.tl-table thead th { font-weight: 700; font-size: 0.94rem; border-bottom: 2px solid var(--ink); }
.tl-table tbody th { font-weight: 600; }
.tl-table td { font-variant-numeric: tabular-nums; }
.tl-table tr.is-strong th, .tl-table tr.is-strong td { font-weight: 800; border-bottom: 2px solid var(--ink); }
.tl-index { font-size: 1.06rem; }
.tl-index tbody th { width: 30%; font-weight: 700; padding-right: 1.4rem; }
.tl-index td { color: var(--ink-2); }

.tl-chart { margin-top: 1.2rem; background: var(--paper); border-radius: var(--radius-sm); padding: 0.6rem; }
.tl-chart svg { display: block; width: 100%; height: auto; font-family: var(--font-sans); }
.tl-axis { stroke: var(--ink); stroke-width: 1.5; }
.tl-frame { fill: none; stroke: var(--line); stroke-width: 1; }
.tl-line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.tl-line.is-dashed { stroke-dasharray: 6 5; }
.tl-line.is-strong { stroke: var(--accent); stroke-width: 3.5; }
.tl-mark { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; }
.tl-mark.is-other { stroke: var(--muted); }
.tl-dot { fill: var(--accent); stroke: var(--ink); stroke-width: 1.5; }
.tl-tick { font-size: 14px; fill: var(--ink-2); }
.tl-tick.is-strong { font-weight: 700; fill: var(--ink); }
.tl-label { font-size: 14px; fill: var(--ink); }
.tl-chart-note { font-size: 0.92rem !important; line-height: 1.45 !important; color: var(--ink-2); margin: 0.4rem 0.2rem 0.2rem !important; }
.tl-quadrant { font-size: 15px; font-weight: 700; fill: var(--ink); }

.tl-section { margin-top: 2.6rem; }
.tl-steps { margin: 0; padding-left: 1.5rem; display: grid; gap: 0.5rem; font-size: 1.06rem; line-height: 1.6; font-variant-numeric: tabular-nums; }
.tl-formula { font-weight: 600; font-size: 1.02rem !important; background: var(--paper-2); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; white-space: pre-wrap; margin-bottom: 0.6rem !important; }
.tl-links { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.4rem; font-size: 1.06rem; line-height: 1.5; }
.tl-practice { margin-top: 2.6rem; background: var(--accent-tint); border-radius: var(--radius-md); padding: 1.5rem; }
.tl-practice h2 { font-size: 1.4rem; margin-bottom: 0.55rem; }
.tl-practice p { font-size: 1.06rem; line-height: 1.6; }
.tl-practice-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 0 !important; }
.tl-practice-actions a:not(.tl-button) { color: var(--ink); font-weight: 600; }

@media (max-width: 900px) {
    .tl-work { grid-template-columns: minmax(0, 1fr); }
    .tl-result { position: static; }
}
@media (max-width: 600px) {
    .tl { padding-top: 1.6rem; }
    .tl-number strong { font-size: 1.7rem; }
    .tl-result, .tl-practice { padding: 1.1rem; }
    .tl-index tbody th { width: 42%; }
}
