/* Layout: one working column — inputs card, then results ledger — with three colour-coded levies that never merge. */
.tg-gst {
  --bg: #f3f5f7; --surface: #ffffff; --sunk: #eef1f4; --ink: #142230; --muted: #566573; --line: #d6dde3; --line-strong: #b5c0ca;
  --accent: #16466e; --accent-ink: #ffffff; --accent-soft: #e3edf6;
  --interest: #1d6aa8; --interest-soft: #e4f0fa;
  --fee: #6a46bd; --fee-soft: #efe9fb;
  --penalty: #a3243b; --penalty-soft: #fbe8eb;
  --ok: #1b7046; --ok-soft: #e2f3ea; --warn: #93600a; --warn-soft: #fbf0d9; --bad: #b3261e; --bad-soft: #fbe6e4;
  --f-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 8px;
}


.tg-gst { font-family: var(--f-body); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 48px; }
.tg-gst *, .tg-gst *::before, .tg-gst *::after { box-sizing: border-box; }
.tg-wrap { max-width: 1080px; margin: 0 auto; display: grid; gap: 20px; }
.tg-gst h1, .tg-gst h2, .tg-gst h3 { font-family: var(--f-display); font-weight: 600; text-wrap: balance; margin: 0; color: var(--ink); line-height: 1.2; }
.tg-gst h1 { font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: -0.01em; }
.tg-gst h2 { font-size: 1.35rem; }
.tg-gst h3 { font-size: 1.08rem; }
.tg-gst p { margin: 0; }
.tg-gst a { color: var(--accent); text-underline-offset: 2px; }
.tg-num, .tg-gst .num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.tg-muted { color: var(--muted); }
.tg-small { font-size: 0.85rem; }
.tg-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); }

/* Header */
.tg-crumbs { font-size: 0.82rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.tg-crumbs a { color: var(--muted); }
.tg-head { display: grid; gap: 10px; }
.tg-lede { max-width: 68ch; color: var(--muted); }
.tg-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--muted); padding-top: 4px; border-top: 1px solid var(--line); }
.tg-meta b { color: var(--ink); font-weight: 600; }

/* Levy summary */
.tg-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tg-levy { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.tg-levy::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.tg-levy .amt { font-family: var(--f-num); font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 500; color: var(--c); }
.tg-levy .sub { font-size: 0.8rem; color: var(--muted); }
.lv-int { --c: var(--interest); } .lv-fee { --c: var(--fee); } .lv-pen { --c: var(--penalty); }
.tg-sumnote { font-size: 0.8rem; color: var(--muted); }

/* Toolbar */
.tg-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tg-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; background: var(--surface); }
.tg-seg button { border: 0; background: transparent; color: var(--muted); font: 600 0.85rem var(--f-body); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.tg-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tg-tabs button { border: 0; background: none; font: 600 0.92rem var(--f-body); color: var(--muted); padding: 10px 14px 9px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tg-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tg-gst button:focus-visible, .tg-gst input:focus-visible, .tg-gst select:focus-visible, .tg-gst summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cards & forms */
.tg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 16px; min-width: 0; }
.tg-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; }
.tg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.tg-f { display: grid; gap: 4px; min-width: 0; align-content: start; }
.tg-f > span { font-size: 0.8rem; font-weight: 600; color: var(--ink); }
.tg-f small { font-size: 0.75rem; color: var(--muted); min-height: 1em; }
.tg-gst input[type=text], .tg-gst input[type=date], .tg-gst input[type=month], .tg-gst select {
  width: 100%; font: 0.95rem var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; min-height: 40px; }
.tg-gst input.amt { font-family: var(--f-num); text-align: right; }
.tg-gst input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
.tg-check { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; cursor: pointer; }
.tg-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.tg-radio { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tg-btn { font: 600 0.86rem var(--f-body); border-radius: 6px; padding: 8px 14px; min-height: 38px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.tg-btn:hover { border-color: var(--accent); }
.tg-btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tg-btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 6px; }
.tg-btn.danger { color: var(--bad); }
.tg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg-example { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; background: var(--warn-soft); color: var(--ink); border-radius: var(--r); padding: 10px 14px; font-size: 0.88rem; }

/* Return rows */
.tg-rows { display: grid; gap: 10px; }
.tg-row { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; background: var(--sunk); }
.tg-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tg-row .tg-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tg-heads { overflow-x: auto; }
.tg-heads table { border-collapse: collapse; min-width: 480px; width: 100%; }
.tg-heads th, .tg-heads td { padding: 4px; text-align: left; font-size: 0.78rem; }
.tg-heads input { min-height: 34px !important; padding: 5px 8px !important; }
.tg-gst details > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* Results ledger */
.tg-res { display: grid; gap: 14px; min-width: 0; }
.tg-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tg-gst table.led { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 0.86rem; }
.led th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); background: var(--sunk); white-space: nowrap; }
.led td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.led td.n, .led th.n { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.led tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--sunk); }
.led .c-fee { color: var(--fee); } .led .c-int { color: var(--interest); } .led .c-pen { color: var(--penalty); }
.led tr.cur td { background: var(--accent-soft); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--accent-soft); color: var(--accent); }
.tg-work { display: grid; gap: 8px; }
.tg-work details { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 10px 12px; }
.tg-work details[open] summary { margin-bottom: 8px; }
.tg-work ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.86rem; }
.tg-work .w { font-family: var(--f-num); font-size: 0.82rem; background: var(--sunk); padding: 6px 8px; border-radius: 4px; overflow-x: auto; white-space: nowrap; }
.tg-msg { border-radius: 6px; padding: 8px 12px; font-size: 0.86rem; display: grid; gap: 4px; }
.tg-msg.warn { background: var(--warn-soft); } .tg-msg.bad { background: var(--bad-soft); } .tg-msg.info { background: var(--accent-soft); }
.tg-msg ul { margin: 0; padding-left: 18px; }
.tg-src { font-size: 0.78rem; color: var(--muted); }
.tg-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.tg-cmp { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 2px; background: var(--surface); }
.tg-cmp .big { font-family: var(--f-num); font-size: 1.15rem; }

/* Scenarios */
.tg-scen-list { display: grid; gap: 6px; }
.tg-scen { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.tg-scen-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* Explainer content */
.tg-prose { display: grid; gap: 12px; max-width: 72ch; }
.tg-prose ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.tg-faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.tg-faq summary { font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.tg-faq p { margin-top: 8px; color: var(--muted); }
.tg-disc { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.tg-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 0.85rem; z-index: 50; }

[data-mode="basic"] .adv { display: none !important; }
.tg-gst [hidden] { display: none !important; }
[data-build="wp"] .wp-only { display: none !important; }
@media (max-width: 720px) { .tg-sum { grid-template-columns: 1fr; } .tg-levy { grid-template-columns: 1fr auto; align-items: baseline; } .tg-levy .sub { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) { .tg-gst * { transition: none !important; } }
@media print {
  .tg-gst { background: #fff; color: #000; padding: 0; }
  .tg-noprint, .tg-inputs, .tg-tabs, .tg-bar, .tg-example, .tg-scenarios { display: none !important; }
  .tg-gst .tg-panel[hidden] { display: grid !important; }
  .tg-gst details { break-inside: avoid; } .tg-gst details > *:not(summary) { display: block; }
  .tg-tablewrap { overflow: visible; border: 0; } .tg-gst table.led { min-width: 0; }
}
