/* JRT Studio - Free Income Tax Estimator.
   Tokens extend the studio palette (paper / ink / blue) with a dark theme.
   Fonts are the site's self-hosted files under /fonts. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-mono-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: 'Source Serif 4'; font-weight: 600; font-display: swap; src: url(/fonts/source-serif-4-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  color-scheme: light;
  --bg: #faf7f1; --bg-2: #f2ede2;
  --surface: #fffdf9; --surface-2: #f7f3ea; --surface-glass: rgba(255, 253, 249, .78);
  --line: #e7dfcc; --line-strong: #cfc0a0;
  --ink: #171f33; --ink-2: #4d566d; --ink-3: #8991a5;
  --accent: #2952d8; --accent-ink: #1e3fae; --accent-soft: #e2e9fb;
  --good: #2f7a53; --good-soft: #dff3e6;
  --bad: #c1502e; --bad-soft: #f6e3d8;
  --warn: #8a5a00; --warn-soft: #fbefd5;
  --flow-a: #2952d8; --flow-b: #7c5cf0;
  --glow-1: rgba(41, 82, 216, .10); --glow-2: rgba(193, 80, 46, .07);
  --shadow: 0 1px 2px rgba(23, 31, 51, .05), 0 8px 24px -12px rgba(23, 31, 51, .14);
  --shadow-lift: 0 2px 4px rgba(23, 31, 51, .06), 0 18px 40px -16px rgba(23, 31, 51, .24);
  --radius: 18px; --radius-sm: 10px;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d111d; --bg-2: #121829;
    --surface: #151b2c; --surface-2: #1b2236; --surface-glass: rgba(21, 27, 44, .78);
    --line: #252e46; --line-strong: #36415f;
    --ink: #eef0f6; --ink-2: #b3bad0; --ink-3: #7c86a3;
    --accent: #8aa4ff; --accent-ink: #b8c8ff; --accent-soft: #1c2752;
    --good: #5fcb98; --good-soft: #143026; --bad: #f2906a; --bad-soft: #3a2119;
    --warn: #f0c060; --warn-soft: #3a2e12;
    --flow-a: #6f8cff; --flow-b: #a68bff;
    --glow-1: rgba(111, 140, 255, .16); --glow-2: rgba(242, 144, 106, .08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d111d; --bg-2: #121829;
  --surface: #151b2c; --surface-2: #1b2236; --surface-glass: rgba(21, 27, 44, .78);
  --line: #252e46; --line-strong: #36415f;
  --ink: #eef0f6; --ink-2: #b3bad0; --ink-3: #7c86a3;
  --accent: #8aa4ff; --accent-ink: #b8c8ff; --accent-soft: #1c2752;
  --good: #5fcb98; --good-soft: #143026; --bad: #f2906a; --bad-soft: #3a2119;
  --warn: #f0c060; --warn-soft: #3a2e12;
  --flow-a: #6f8cff; --flow-b: #a68bff;
  --glow-1: rgba(111, 140, 255, .16); --glow-2: rgba(242, 144, 106, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 400 16px/1.55 var(--sans); color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
kbd { font: 500 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--ink-3); }

/* ------------------------------------------------------------ header */

.tx-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: var(--surface-glass); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  view-transition-name: tx-top;
}
.tx-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.01em; min-width: 0; }
.tx-brand img { height: 26px; width: auto; border-radius: 6px; }
/* The studio logo is dark ink on transparent; flip it for the dark theme. */
:root[data-theme="dark"] .tx-brand img { filter: invert(1) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tx-brand img { filter: invert(1) hue-rotate(180deg); } }
.tx-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-brand small { color: var(--ink-3); font-weight: 400; }
.tx-actions { display: flex; align-items: center; gap: 6px; }
.tx-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); margin-right: 6px; white-space: nowrap; }
.tx-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.tx-status.is-off { color: var(--warn); }
.tx-status.is-off::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: tx-blink 1.6s infinite; }

/* ------------------------------------------------------------ buttons */

.tx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--sans); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s;
}
.tx-btn:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tx-btn:active { transform: scale(.97); }
.tx-btn:disabled { opacity: .45; pointer-events: none; }
.tx-btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .tx-btn-primary { color: #0d111d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tx-btn-primary { color: #0d111d; } }
.tx-btn-primary:hover { background: var(--accent-ink); }
.tx-btn-ghost { border-color: transparent; background: transparent; font-weight: 500; padding: 8px 12px; }
.tx-btn-ghost:hover { background: var(--surface-2); box-shadow: none; border-color: transparent; }
.tx-btn-danger { color: var(--bad); border-color: var(--bad); }
.tx-btn-danger.is-armed { background: var(--bad); color: #fff; animation: tx-shake .35s; }
.tx-tool {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.tx-tool:hover { background: var(--surface-2); color: var(--ink); }
.tx-tool[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.tx-tool-danger:hover, .tx-tool-danger.is-armed { color: var(--bad); background: var(--bad-soft); }
.tx-tool-danger.is-armed { animation: tx-shake .35s; }
.tx-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tx-theme-dot { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 2px solid var(--ink); transition: transform .5s var(--ease); }
:root[data-theme="dark"] .tx-theme-dot { transform: rotate(180deg); }
.tx-link-btn { display: inline-flex; gap: 5px; align-items: center; border: 0; background: none; color: var(--accent); font: 500 13px var(--sans); cursor: pointer; padding: 0; }
.tx-link-btn .tx-icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------ page */

.tx-main { max-width: 1180px; margin: 0 auto; padding: 0 16px 140px; }
.tx-pagehead { padding: 44px 0 28px; max-width: 760px; view-transition-name: tx-pagehead; }
.tx-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-3); margin: 0 0 14px; padding: 0; list-style: none; }
.tx-crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line-strong); }
.tx-crumbs a { color: var(--ink-2); text-decoration: none; }
.tx-eyebrow { display: inline-block; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 999px; margin-bottom: 14px; }
.tx-pagehead h1 { font: 600 clamp(32px, 5vw, 52px)/1.06 var(--serif); letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.tx-lede { font-size: 18px; color: var(--ink-2); margin: 0; text-wrap: pretty; }
.tx-promise { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.tx-promise li { display: inline-flex; align-items: center; gap: 8px; }
.tx-promise li::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--good-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f7a53' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
.tx-noscript { padding: 20px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------------------ cards */

.tx-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px;
  animation: tx-rise .6s var(--ease) both;
}
#tx-root > .tx-card:nth-child(2), .tx-hub-main > :nth-child(2) { animation-delay: .06s; }
#tx-root > .tx-card:nth-child(3), .tx-hub-main > :nth-child(3) { animation-delay: .12s; }
#tx-root > .tx-card:nth-child(4), .tx-hub-main > :nth-child(4) { animation-delay: .18s; }
#tx-root > .tx-card:nth-child(n+5) { animation-delay: .22s; }
.tx-card-head { margin-bottom: 10px; }
.tx-card-head h2 { font: 600 20px/1.25 var(--sans); letter-spacing: -.01em; margin: 0; }
.tx-card-intro { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; max-width: 68ch; }
.tx-muted { color: var(--ink-3); }
.tx-error { color: var(--bad); }
.tx-note { color: var(--ink-2); font-size: 14px; }

/* ------------------------------------------------------------ form lines */

.tx-lines { display: flex; flex-direction: column; }
.tx-line {
  display: grid; grid-template-rows: 1fr; border-top: 1px solid var(--line);
  transition: grid-template-rows .38s var(--ease), opacity .3s, border-color .3s, background-color .6s;
  border-radius: 0;
}
.tx-line:first-child { border-top-color: transparent; }
.tx-line.is-collapsed { grid-template-rows: 0fr; opacity: 0; border-top-color: transparent; }
.tx-line-body { min-height: 0; overflow: hidden; }
.tx-line-inner {
  display: grid; align-items: center; gap: 4px 14px; padding: 10px 0;
  grid-template-columns: 2.75rem minmax(0, 1fr) minmax(9.5rem, 13rem) 4.5rem;
}
.tx-ln { font: 500 13px var(--mono); color: var(--ink-3); text-align: right; padding-right: 4px; }
.tx-label { font-size: 15px; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.tx-label a { color: inherit; text-decoration-color: var(--line-strong); }
.tx-label a:hover { color: var(--accent); text-decoration-color: currentColor; }
.tx-hint, .tx-to { font-size: 12.5px; color: var(--ink-3); }
.tx-to { display: inline-flex; align-items: center; gap: 5px; }
.tx-to .tx-icon { width: 12px; height: 12px; }
.tx-tools { display: flex; justify-content: flex-end; gap: 2px; }
.tx-tool-edit { opacity: 0; }
.tx-line:hover .tx-tool-edit, .tx-tool-edit:focus-visible, .tx-line.is-overridden .tx-tool-edit { opacity: 1; }
@media (hover: none) { .tx-tool-edit { opacity: .6; } }

.tx-val { display: flex; justify-content: flex-end; }
.tx-input {
  width: 100%; font: 400 15px/1.3 var(--sans); color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.tx-input::placeholder { color: var(--ink-3); opacity: .7; }
.tx-input:hover { border-color: var(--line-strong); }
.tx-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.tx-input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.tx-money { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.tx-money-wrap, .tx-num-wrap { position: relative; width: 100%; }
.tx-money-wrap::before { content: '$'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font: 400 15px var(--mono); pointer-events: none; }
.tx-select-wrap { position: relative; width: 100%; display: block; }
.tx-select { appearance: none; padding-right: 34px; cursor: pointer; }
.tx-select-wrap .tx-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }

.tx-out { font: 500 16px var(--mono); font-variant-numeric: tabular-nums; padding: 9px 2px; color: var(--ink); white-space: nowrap; }
.tx-line.is-zero .tx-out { color: var(--ink-3); }
.tx-line.is-calc .tx-label { color: var(--ink-2); }
.tx-line.is-emph { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: var(--radius-sm); border-top-color: transparent; margin: 4px 0; }
.tx-line.is-emph + .tx-line { border-top-color: transparent; }
.tx-line.is-emph .tx-label { color: var(--ink); font-weight: 600; }
.tx-line.is-emph .tx-out { font-size: 19px; font-weight: 600; }
.tx-line.is-emph[data-tone="good"]:not(.is-zero) { background: linear-gradient(90deg, var(--good-soft), transparent 70%); }
.tx-line.is-emph[data-tone="good"]:not(.is-zero) .tx-out { color: var(--good); }
.tx-line.is-emph[data-tone="bad"]:not(.is-zero) { background: linear-gradient(90deg, var(--bad-soft), transparent 70%); }
.tx-line.is-emph[data-tone="bad"]:not(.is-zero) .tx-out { color: var(--bad); }
.tx-line.tx-pulse .tx-out { animation: tx-flash .9s var(--ease); }

.tx-line.is-check .tx-val { justify-content: flex-end; }
.tx-switch {
  appearance: none; -webkit-appearance: none; margin: 0; cursor: pointer;
  width: 44px; height: 26px; border-radius: 999px; position: relative;
  background: var(--line-strong); transition: background-color .25s var(--ease);
}
.tx-switch::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s var(--ease);
}
.tx-switch:checked { background: var(--accent); }
.tx-switch:checked::before { transform: translateX(18px); }

.tx-help { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.tx-help > div { min-height: 0; overflow: hidden; }
.tx-help p { margin: 0 0 12px calc(2.75rem + 14px); padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.tx-line.help-open .tx-help { grid-template-rows: 1fr; }

.tx-override-badge { display: none; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -4px 0 10px calc(2.75rem + 14px); font-size: 13px; color: var(--ink-3); }
.tx-line.is-overridden .tx-override-badge { display: flex; }
.tx-line.is-overridden .tx-out { color: var(--warn); }
.tx-chip { display: inline-block; font: 500 11.5px/1 var(--sans); padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tx-chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ------------------------------------------------------------ repeat groups */

.tx-repeat { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.tx-repeat-list { display: flex; flex-direction: column; gap: 12px; }
.tx-empty { text-align: center; padding: 26px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); }
.tx-empty p { margin: 0 0 4px; }
.tx-repeat-actions { display: flex; }
.tx-item {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  display: grid; grid-template-rows: auto 1fr;
  transition: opacity .3s, transform .35s var(--ease), box-shadow .3s, border-color .3s;
}
.tx-item:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tx-item.is-entering { opacity: 0; transform: translateY(8px) scale(.98); }
.tx-item.is-leaving { opacity: 0; transform: translateX(24px) scale(.97); }
.tx-item.is-excluded { opacity: .6; }
.tx-item-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 4px; }
.tx-item-toggle { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; text-align: left; padding: 8px; font: 600 15px var(--sans); color: var(--ink); cursor: pointer; border-radius: var(--radius-sm); }
.tx-item-toggle .tx-icon { transition: transform .3s var(--ease); color: var(--ink-3); }
.tx-item-toggle[aria-expanded="false"] .tx-icon { transform: rotate(-90deg); }
.tx-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-item-sub { margin-left: auto; font: 500 14px var(--mono); color: var(--ink-2); }
.tx-item-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .38s var(--ease); }
.tx-item.is-entering .tx-item-body, .tx-item.is-folded .tx-item-body, .tx-item.is-leaving .tx-item-body { grid-template-rows: 0fr; }
.tx-item-grid { min-height: 0; overflow: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; padding: 0 16px; }
.tx-item:not(.is-folded):not(.is-entering) .tx-item-grid { padding-bottom: 16px; }
.tx-field { display: flex; flex-direction: column; gap: 6px; }
.tx-field label { font-size: 13px; color: var(--ink-2); display: flex; gap: 7px; align-items: baseline; }
.tx-box { font: 500 11px/1 var(--mono); color: var(--accent); background: var(--accent-soft); padding: 3px 6px; border-radius: 5px; }
.tx-field .tx-input { background: var(--surface); }
.tx-field.is-check { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.tx-field.is-check label { flex: 1; }
.tx-field[hidden] { display: none; }

/* ------------------------------------------------------------ hub */

.tx-hub { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.tx-hub-side { position: sticky; top: 76px; }
.tx-hub-side .tx-card { margin: 0; }
.tx-roadmap { display: flex; flex-wrap: wrap; gap: 6px; }
.tx-roadmap .tx-chip { font-family: var(--mono); }

.tx-result {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: calc(var(--radius) + 6px); padding: 34px 32px 30px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift);
  animation: tx-rise .6s var(--ease) both;
  view-transition-name: tx-result;
}
.tx-result::before {
  content: ''; position: absolute; inset: -40% -10% auto auto; width: 70%; aspect-ratio: 1; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  transition: background .8s var(--ease); animation: tx-drift 14s ease-in-out infinite alternate;
}
.tx-result[data-tone="good"]::before { background: radial-gradient(circle, var(--good-soft), transparent 70%); }
.tx-result[data-tone="bad"]::before { background: radial-gradient(circle, var(--bad-soft), transparent 70%); }
.tx-hero-label { display: block; font: 500 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.tx-hero-num {
  display: block; font: 600 clamp(48px, 9vw, 88px)/1.05 var(--serif); letter-spacing: -.03em; margin: 8px 0 6px;
  font-variant-numeric: tabular-nums; color: var(--ink); transition: color .6s var(--ease);
}
.tx-result[data-tone="good"] .tx-hero-num { color: var(--good); }
.tx-result[data-tone="bad"] .tx-hero-num { color: var(--bad); }
.tx-hero-sub { margin: 0; color: var(--ink-2); }

.tx-flow-card { position: relative; }
.tx-flow { width: 100%; height: auto; display: block; overflow: visible; }
.tx-flow-bar { fill: url(#tx-flow-g); }
.tx-flow-tax { fill: var(--bad); }
.tx-flow-ribbon { fill: var(--flow-a); opacity: .13; }
.tx-flow-val { font: 600 15px var(--mono); fill: var(--ink); }
.tx-flow-label { font: 500 13px var(--sans); fill: var(--ink-2); }
.tx-flow-drop { font: 500 12px var(--mono); fill: var(--ink-3); }
.tx-flow-empty { position: absolute; inset: 50% 0 auto; transform: translateY(-50%); text-align: center; margin: 0; color: var(--ink-2); font-weight: 500; opacity: 0; transition: opacity .4s; pointer-events: none; }
.tx-flow-card.is-empty .tx-flow { opacity: .25; filter: saturate(.3); }
.tx-flow-card.is-empty .tx-flow-empty { opacity: 1; }
.tx-flow { transition: opacity .5s, filter .5s; }

.tx-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tx-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-height: 150px;
  animation: tx-rise .6s var(--ease) both; animation-delay: .14s;
}
.tx-stat-big { font: 600 26px/1.1 var(--serif); font-variant-numeric: tabular-nums; margin-bottom: auto; padding-top: 6px; }
.tx-stat-label { font-weight: 600; font-size: 14px; }
.tx-stat-note { font-size: 12.5px; color: var(--ink-3); }
.tx-gauge { width: 100%; max-width: 170px; margin: 0 auto auto; display: block; }
.tx-gauge path { fill: none; stroke-width: 14; stroke-linecap: round; }
.tx-gauge-track { stroke: var(--surface-2); }
.tx-gauge-fill { stroke: var(--accent); stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .9s var(--ease); }
.tx-gauge-text { font: 600 26px var(--serif); fill: var(--ink); }
.tx-ladder { display: flex; flex-direction: column-reverse; gap: 3px; margin-bottom: auto; }
.tx-rung { font: 500 11px/1 var(--mono); padding: 3px 8px; border-radius: 6px; color: var(--ink-3); background: var(--surface-2); transition: all .45s var(--ease); width: 46%; }
.tx-rung.is-below { background: var(--accent-soft); color: var(--accent); }
.tx-rung.is-on { background: var(--accent); color: var(--surface); width: 100%; font-weight: 600; transform: translateX(0); }

.tx-groups { display: flex; flex-direction: column; gap: 18px; }
.tx-group h3 { font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.tx-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tx-tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: center;
  padding: 14px 40px 14px 14px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
a.tx-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--accent); color: var(--ink); }
.tx-tile > .tx-icon { position: absolute; right: 14px; top: 50%; transform: translate(-4px, -50%); opacity: 0; color: var(--accent); transition: all .25s var(--ease); }
a.tx-tile:hover > .tx-icon { opacity: 1; transform: translate(0, -50%); }
.tx-tile-short { grid-row: span 2; font: 600 12px/1 var(--mono); min-width: 52px; text-align: center; padding: 10px 6px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.tx-tile.is-used .tx-tile-short { background: var(--accent); color: var(--surface); border-color: transparent; }
.tx-tile-title { font-weight: 600; font-size: 14.5px; }
.tx-tile-meta { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-tile.is-used .tx-tile-meta { color: var(--ink-2); }
.tx-tile.is-planned { background: transparent; border-style: dashed; }
.tx-tile.is-planned .tx-tile-short { background: transparent; border-style: dashed; }

/* ------------------------------------------------------------ summary bar */

.tx-bar { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 15; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
.tx-bar-inner {
  pointer-events: auto; display: flex; align-items: stretch; gap: 4px; padding: 6px;
  background: var(--surface-glass); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lift);
  view-transition-name: tx-result; animation: tx-up .6s var(--ease) both .2s;
}
.tx-bar-cell { display: flex; flex-direction: column; justify-content: center; padding: 6px 16px; border-radius: 999px; min-width: 0; }
.tx-bar-cell span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.tx-bar-v { font: 600 16px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-bar-result { background: var(--surface-2); transition: background-color .5s; }
.tx-bar-result[data-tone="good"] { background: var(--good-soft); }
.tx-bar-result[data-tone="good"] .tx-bar-v { color: var(--good); }
.tx-bar-result[data-tone="bad"] { background: var(--bad-soft); }
.tx-bar-result[data-tone="bad"] .tx-bar-v { color: var(--bad); }
.tx-bar-link { display: inline-flex; align-items: center; gap: 6px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14px; text-decoration: none; background: var(--accent); color: var(--surface); }
.tx-bar-link:hover { color: var(--surface); background: var(--accent-ink); }

/* ------------------------------------------------------------ prev / next */

.tx-next { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; margin-top: 26px; }
.tx-next-link { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; transition: transform .25s var(--ease), border-color .25s; }
.tx-next-link span { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.tx-next-link:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-2px); }
.tx-next-link.is-prev { grid-column: 1; }
.tx-next-link.is-hub { grid-column: 2; text-align: center; }
.tx-next-link.is-next { grid-column: 3; text-align: right; }

/* ------------------------------------------------------------ prose (how it works) */

.tx-prose { max-width: 720px; }
.tx-prose .tx-card { padding: 26px 30px; }
.tx-prose h2 { font: 600 24px/1.25 var(--serif); margin: 0 0 10px; }
.tx-prose p, .tx-prose li { color: var(--ink-2); }
.tx-prose code { font: 13px var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

/* ------------------------------------------------------------ dialogs, palette, toast, drop */

.tx-dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift);
}
.tx-dialog[open] { animation: tx-pop .3s var(--ease); }
.tx-dialog::backdrop { background: rgba(13, 17, 29, .45); backdrop-filter: blur(3px); animation: tx-fade .3s; }
.tx-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0 24px; }
.tx-dialog-head h2 { font: 600 19px var(--sans); margin: 0; }
.tx-dialog-x { font-size: 22px; }
.tx-dialog-body { padding: 12px 24px 24px; display: flex; flex-direction: column; gap: 10px; }
.tx-dialog-body p { margin: 0; color: var(--ink-2); }
.tx-dialog-body label { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.tx-dialog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 6px; }
.tx-dialog-grid .tx-btn { white-space: nowrap; padding: 10px 12px; font-size: 13.5px; }
.tx-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.tx-facts { margin: 0; padding-left: 18px; color: var(--ink-2); }
.tx-palette { width: min(620px, calc(100vw - 32px)); align-self: start; margin-top: 12vh; }
.tx-palette-input { font-size: 16px; padding: 12px 14px; }
.tx-palette-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
.tx-palette-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.tx-palette-item.is-active, .tx-palette-item:hover { background: var(--accent-soft); }
.tx-palette-item.is-planned { opacity: .45; cursor: default; }
.tx-palette-short { font: 600 12px var(--mono); color: var(--accent); }
.tx-palette-title { font-weight: 500; }
.tx-palette-group { font-size: 12px; color: var(--ink-3); }
.tx-toast {
  position: fixed; left: 50%; top: 76px; z-index: 40; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lift);
  transition: opacity .3s, transform .4s var(--ease);
}
.tx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.tx-drop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(41, 82, 216, .14); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.tx-drop > div { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 34px 44px; border-radius: var(--radius); border: 2px dashed var(--accent); background: var(--surface); transform: scale(.95); transition: transform .3s var(--ease); }
.tx-drop strong { font: 600 22px var(--serif); }
.tx-drop span { color: var(--ink-2); font-size: 14px; }
.tx-drop.is-on { opacity: 1; }
.tx-drop.is-on > div { transform: scale(1); }

.tx-foot { max-width: 1180px; margin: 0 auto; padding: 30px 16px 120px; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--line); }
.tx-foot p { margin: 0 0 6px; max-width: 80ch; }
.tx-foot a { color: var(--ink-2); }

/* ------------------------------------------------------------ motion */

@keyframes tx-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tx-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes tx-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes tx-fade { from { opacity: 0; } }
@keyframes tx-flash { 0% { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); border-radius: 6px; } 100% { background: transparent; box-shadow: 0 0 0 0 transparent; } }
@keyframes tx-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes tx-blink { 50% { opacity: .35; } }
@keyframes tx-drift { to { transform: translate(-18%, 22%) scale(1.15); } }

/* Cross-document view transitions between estimator pages. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .22s var(--ease) both tx-vt-out; }
::view-transition-new(root) { animation: .38s var(--ease) both tx-vt-in; }
::view-transition-group(tx-result) { animation-duration: .5s; animation-timing-function: var(--ease); }
@keyframes tx-vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes tx-vt-in { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  @view-transition { navigation: none; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 960px) {
  .tx-hub { grid-template-columns: minmax(0, 1fr); }
  .tx-hub-side { position: static; order: -1; }
  .tx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tx-top { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .tx-brand small, .tx-btn kbd { display: none; }
  .tx-status { font-size: 0; margin-right: 2px; }
  .tx-btn-ghost { padding: 8px; font-size: 13.5px; }
  .tx-pagehead { padding: 28px 0 20px; }
  .tx-lede { font-size: 16.5px; }
  .tx-card { padding: 18px 16px; border-radius: 16px; }
  .tx-result { padding: 26px 20px 22px; }
  .tx-line-inner { grid-template-columns: 2rem minmax(0, 1fr) auto; }
  .tx-line-inner .tx-val { grid-column: 2 / -1; grid-row: 2; }
  .tx-line.is-check .tx-line-inner .tx-val, .tx-line.is-calc .tx-line-inner .tx-val { grid-column: auto; grid-row: auto; }
  .tx-line.is-calc .tx-line-inner { grid-template-columns: 2rem minmax(0, 1fr) auto auto; }
  .tx-line.is-check .tx-line-inner { grid-template-columns: 2rem minmax(0, 1fr) auto auto; }
  .tx-help p, .tx-override-badge { margin-left: 0; }
  .tx-item-grid { grid-template-columns: 1fr; }
  .tx-stats { gap: 10px; }
  .tx-stat { min-height: 128px; padding: 14px; }
  .tx-flow-val { font-size: 22px; }
  .tx-flow-label { font-size: 21px; }
  .tx-flow-drop { display: none; }
  .tx-bar { bottom: 10px; }
  .tx-bar-inner { width: 100%; justify-content: space-between; }
  .tx-bar-cell { padding: 4px 10px; }
  .tx-bar-cell:first-child { display: none; }
  .tx-bar-v { font-size: 14px; }
  .tx-bar-link { padding: 0 12px; font-size: 0; }
  .tx-bar-link .tx-icon { width: 20px; height: 20px; }
  .tx-next { grid-template-columns: 1fr 1fr; }
  .tx-next-link.is-hub { grid-column: 1 / -1; grid-row: 2; }
  .tx-next-link.is-next { grid-column: 2; }
}

/* ------------------------------------------------------------ hub sidebar
   Last in the file on purpose: these must beat the mobile line-grid rules
   above at equal specificity. The sidebar has no room for a line-number
   gutter, so it is label | control | tools at every width. */

.tx-hub-side .tx-line .tx-line-inner { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 10px; }
.tx-hub-side .tx-line .tx-line-inner .tx-val { grid-column: auto; grid-row: auto; }
.tx-hub-side .tx-line .tx-line-inner:has(.tx-select) .tx-val { grid-column: 1 / -1; grid-row: 2; }
.tx-hub-side .tx-ln, .tx-hub-side .tx-tools:empty { display: none; }
.tx-hub-side .tx-help p, .tx-hub-side .tx-override-badge { margin-left: 0; }
