/* BIR FILEER — "filing ledger": navy ink on cool paper, a teal seal accent and a stamp-red for deadlines.
   Tokens and rules are documented in DESIGN.md; change them there first. */
:root {
  /* Space: 4px base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* Motion: feedback must start inside 100ms */
  --fast: 90ms; --ease: cubic-bezier(.2, .7, .2, 1);
  --tap: 44px;
  --paper: #f4f6f9;
  --surface: #ffffff;
  --ink: #14213d;
  --ink-2: #4a5568;
  --line: #d9e0e8;
  --accent: #0b6e69;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ef;
  --navy: #0b3d5c;
  --stamp: #b4362a;
  --stamp-soft: #fbe9e6;
  --amber: #9a6100;
  --amber-soft: #fdf1dc;
  --ok: #1f7a3d;
  --ok-soft: #e3f3e7;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);
  --display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --radius: 8px;
  --radius-sm: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1622; --surface: #172131; --ink: #e6ebf2; --ink-2: #a3afc0; --line: #2a3648;
    --accent: #3fb8ae; --accent-ink: #062523; --accent-soft: #143633; --navy: #8cc4e8;
    --stamp: #f07a6c; --stamp-soft: #3a1d1a; --amber: #f0b45a; --amber-soft: #3a2c14; --ok: #6fd38f; --ok-soft: #173322;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1622; --surface: #172131; --ink: #e6ebf2; --ink-2: #a3afc0; --line: #2a3648;
  --accent: #3fb8ae; --accent-ink: #062523; --accent-soft: #143633; --navy: #8cc4e8;
  --stamp: #f07a6c; --stamp-soft: #3a1d1a; --amber: #f0b45a; --amber-soft: #3a2c14; --ok: #6fd38f; --ok-soft: #173322;
  --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--body); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
code, .code { font-family: var(--mono); font-size: .88em; }
.code { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-x: auto; white-space: pre; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s4); top: -60px; z-index: 50; background: var(--ink); color: var(--surface); padding: var(--s2) var(--s4); border-radius: var(--radius); font-weight: 600; }
.skip-link:focus { top: var(--s2); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.error-text { color: var(--stamp); }
.eyebrow { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 4px; font-weight: 600; }
.eyebrow a { color: inherit; }

/* Brand */
.brand { font-family: var(--display); font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 6px; }
.brand small { font-weight: 500; color: var(--ink-2); font-size: .8rem; }
.brand-mark { background: var(--navy); color: var(--surface); font-family: var(--mono); font-size: .8rem; padding: 2px 6px; border-radius: 3px; letter-spacing: .05em; }
.brand-lg { font-size: 1.3rem; margin-bottom: 18px; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.mainnav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); font-weight: 600; font-size: .92rem; }
.mainnav a:hover { background: var(--paper); color: var(--ink); }
.mainnav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius); padding: 6px 12px; font: inherit; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .mainnav { display: none; width: 100%; flex-direction: column; }
  .mainnav.open { display: flex; }
}

/* Page */
.page { max-width: 1200px; margin: 0 auto; padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { margin-top: 0; }
.panel-alert { border-color: var(--stamp); }
.panel-alert > h2 { color: var(--stamp); }
.danger-zone { border-style: dashed; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
@media (max-width: 400px) { .split { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 40px 20px; }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--display); font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-2); font-size: .85rem; }
.stat-alert { border-color: var(--stamp); background: var(--stamp-soft); }
.stat-alert .stat-num { color: var(--stamp); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compare th { text-transform: none; letter-spacing: 0; font-size: .94rem; color: var(--ink); font-weight: 400; }
.table.compare td { text-align: right; }
.form-chip { font-family: var(--mono); font-size: .8rem; background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
.form-name { color: var(--ink-2); }

/* Pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill-late { background: var(--stamp-soft); color: var(--stamp); border-color: transparent; }
.pill-today, .pill-soon { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill-filed, .pill-paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .95rem var(--body); padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn { transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease), filter var(--fast) var(--ease); min-height: 40px; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); border-color: var(--stamp); }
.btn-sm { padding: 4px 12px; font-size: .85rem; min-height: 32px; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
label.check, .checks label { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
input, select, textarea { font: 400 1rem var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%; min-width: 0; }
input[type="checkbox"] { width: auto; margin-top: 4px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; flex: 1 1 180px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form select { width: auto; }
.otp-input { font-family: var(--mono); font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
[data-show].is-hidden { display: none; }

/* Flash */
.flash { padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); border-left: 4px solid var(--accent); }
.flash-error { background: var(--stamp-soft); border-left-color: var(--stamp); }
.flash-info { background: var(--amber-soft); border-left-color: var(--amber); }
.flash-success { background: var(--ok-soft); border-left-color: var(--ok); }
.callout { background: var(--accent-soft); padding: 12px; border-radius: var(--radius); }

/* Auth */
.auth-wrap { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; width: 100%; max-width: 420px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-card-wide { max-width: 860px; }
.auth-links { font-size: .9rem; color: var(--ink-2); margin: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); }
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice span { color: var(--ink-2); font-size: .9rem; }
.setup-steps { display: flex; flex-direction: column; gap: 18px; padding-left: 20px; }
.qr { background: #fff; padding: 12px; display: inline-block; margin: 10px 0; border-radius: var(--radius); min-height: 40px; }
.secret { font-size: 1rem; letter-spacing: .08em; word-break: break-all; }

/* Detail */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.facts dt { color: var(--ink-2); font-size: .9rem; }
.facts dd { margin: 0; }
.steps li { margin-bottom: 6px; }

/* Admin charts */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bar { width: 100%; max-width: 36px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-val { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-label { font-size: .72rem; color: var(--ink-2); white-space: nowrap; }
.meter-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.meter-list li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; }
.meter { height: 8px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--navy); }
.activity { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
.holiday-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex-wrap: wrap; }
.seg a { padding: 6px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.seg a.active { background: var(--accent); color: var(--accent-ink); }

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan-card h2, .plan-card h3 { margin: 0; }
.plan-featured { border: 2px solid var(--accent); }
.plan-current { border: 2px solid var(--navy); }
.plan-badge { position: absolute; top: -11px; left: 20px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.plan-price { font-family: var(--display); font-size: 2rem; font-weight: 800; margin: 0; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: .9rem; font-weight: 500; color: var(--ink-2); }
.ticks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; flex: 1; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: .45em; width: 9px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.sitefoot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 1200px; margin: 0 auto; padding-block: 20px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); color: var(--ink-2); font-size: .82rem; }

/* Landing */
.landing { background: var(--surface); }
.lp-inner { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.lp-nav { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.lp-nav .lp-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; flex-wrap: wrap; }
.lp-nav nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.lp-nav nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; }
.lp-hero { background: linear-gradient(180deg, var(--paper), var(--surface)); padding-block: 56px 48px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.lp-hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.hero-card-head { background: var(--navy); color: var(--surface); padding: 10px 16px; font-size: .85rem; font-weight: 600; }
.hero-card-foot { padding: 10px 16px; font-size: .82rem; color: var(--ink-2); background: var(--paper); }
.deadline { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.deadline-date { border: 2px solid var(--stamp); color: var(--stamp); border-radius: 6px; text-align: center; line-height: 1.1; padding: 4px 0; transform: rotate(-3deg); }
.deadline-date span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.deadline-date b { font-family: var(--display); font-size: 1.4rem; }
.deadline-name { font-weight: 600; font-size: .95rem; }
.lp-band { background: var(--navy); color: var(--surface); padding-block: 28px; }
.pains { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.pains b { display: block; font-family: var(--display); font-size: 1.9rem; }
.pains span { font-size: .92rem; opacity: .9; }
.lp-section { padding-block: 64px; }
.lp-section > .lp-inner > h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.lp-alt { background: var(--paper); }
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.problem-grid article { border-top: 3px solid var(--stamp); padding-top: 12px; }
.problem-grid p { color: var(--ink-2); margin: 0 0 8px; }
.problem-grid .fix { color: var(--ink); font-weight: 600; }
.lp-finder { background: var(--accent-soft); }
.finder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.finder-result { background: var(--surface); border-radius: 12px; padding: 24px; border: 1px solid var(--line); position: sticky; top: 80px; }
.finder-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.finder-list li { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: baseline; }
.finder-list .when { font-size: .85rem; color: var(--ink-2); }
.how { counter-reset: how; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.how li { counter-increment: how; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.how li::before { content: counter(how); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--surface); font-weight: 700; margin-bottom: 10px; }
.how b { display: block; margin-bottom: 4px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.feature-grid p { color: var(--ink-2); margin: 0; }
.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); padding-block: 14px; }
.faq summary { font-weight: 700; cursor: pointer; }
.lp-cta { background: var(--navy); color: var(--surface); text-align: center; padding-block: 56px; }
.lp-cta h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
@media (max-width: 900px) {
  .hero-grid, .finder-grid { grid-template-columns: 1fr; }
  .pains, .how { grid-template-columns: repeat(2, 1fr); }
  .problem-grid, .feature-grid { grid-template-columns: 1fr 1fr; }
  .finder-result { position: static; }
}
@media (max-width: 560px) {
  .pains, .how, .problem-grid, .feature-grid { grid-template-columns: 1fr; }
  .lp-nav nav a:not(.btn) { display: none; }
  .lp-nav nav a[href$="login.php"] { display: inline; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.landing .plan-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Panels: heading row with a count or helper text */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 0; }
.count { font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.panel-fold { padding: 0; }
.panel-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); min-height: var(--tap); }
.panel-fold > summary::-webkit-details-marker { display: none; }
.panel-fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform var(--fast) var(--ease); margin-left: var(--s2); }
.panel-fold[open] > summary::after { transform: rotate(-135deg); }
.panel-fold > summary:hover { background: var(--paper); }
.panel-fold .fold-title { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.panel-fold > .table-wrap { padding: 0 var(--s5) var(--s4); }
.stat-row-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Next deadline: the one thing a client should act on */
.next-up { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s5); align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--stamp); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--shadow); }
.next-up h2 { font-size: 1.3rem; margin: 0 0 var(--s1); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.next-up p { margin: 0; }
.stamp-date { border: 2px solid var(--stamp); color: var(--stamp); border-radius: var(--radius); text-align: center; line-height: 1.05; padding: var(--s2) var(--s3); min-width: 72px; transform: rotate(-3deg); }
.stamp-date span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.stamp-date b { font-family: var(--display); font-size: 2rem; }

/* Rows that need action this week */
.row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.table td.cell-action { text-align: right; white-space: nowrap; }

/* Worksheets: inputs left, computation right */
.ws-intro { margin: 0; max-width: 80ch; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--s5); align-items: start; }
.ws-fields { margin-bottom: var(--s4); }
.ws-help { font-weight: 400; }
.ws-actions { margin-top: var(--s4); gap: var(--s3); }
.ws-result { position: sticky; top: 72px; }
.ws-lines { width: 100%; border-collapse: collapse; font-size: .94rem; margin-bottom: var(--s3); }
.ws-lines td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ws-lines td.num { text-align: right; padding-left: var(--s3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ws-lines .ws-sub td { font-weight: 700; }
.ws-lines .ws-total td { font-family: var(--display); font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--ink); border-bottom: 0; padding-top: 10px; }
.ws-table td { padding: 6px 4px; }
.ws-table input, .ws-table select { min-width: 110px; padding: 6px 8px; }
.ws-table td:first-child select { min-width: 220px; }
.callout { margin: 0 0 var(--s2); }
.ws-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: var(--s4) 0; }
.ws-cta .btn { margin-left: auto; }
.ws-grid-wide { grid-template-columns: 1fr; }
.ws-grid-wide .ws-result { position: static; max-width: 640px; }
@media (max-width: 900px) { .ws-grid { grid-template-columns: 1fr; } .ws-result { position: static; } }

/* Phones: tables become stacked cards, controls reach 44px */
@media (max-width: 640px) {
  .page { gap: var(--s4); padding-block: var(--s4) var(--s7); }
  .panel { padding: var(--s4); }
  .next-up { grid-template-columns: auto 1fr; gap: var(--s4); padding: var(--s4); align-items: start; }
  .next-up h2 { font-size: 1.1rem; }
  .stamp-date { min-width: 60px; padding: var(--s1) var(--s2); }
  .stamp-date b { font-size: 1.6rem; }
  .next-up-actions { grid-column: 1 / -1; }
  .next-up-actions .btn { width: 100%; }
  .stat-row, .stat-row-3 { grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
  .stat { padding: var(--s3); }
  .stat-num { font-size: 1.35rem; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "form form" "due status" "period action" "client client"; gap: var(--s1) var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { padding: 0; border: 0; }
  .table-stack td.cell-form { grid-area: form; }
  .table-stack td.cell-form .form-name { display: block; font-size: .9rem; margin-top: 2px; }
  .table-stack td.cell-due { grid-area: due; font-weight: 600; }
  .table-stack td.cell-status { grid-area: status; text-align: right; }
  .table-stack td[data-label="Period"] { grid-area: period; color: var(--ink-2); font-size: .88rem; }
  .table-stack td[data-label="Client"] { grid-area: client; font-size: .88rem; }
  .table-stack td.cell-action { grid-area: action; text-align: right; }
  .table-stack tr.row-urgent { grid-template-areas: "form form" "due status" "period period" "client client" "action action"; box-shadow: inset 3px 0 0 var(--amber); padding-left: var(--s3); }
  .table-stack tr.row-urgent td:first-child { box-shadow: none; }
  .table-stack tr.row-urgent td.cell-action { margin-top: var(--s2); }
  .table-stack tr.row-urgent td.cell-action .btn { width: 100%; min-height: var(--tap); }
  .panel-fold > summary { padding: var(--s3) var(--s4); }
  .panel-fold > .table-wrap { padding: 0 var(--s4) var(--s3); }
  .btn, input, select, textarea { min-height: var(--tap); }
  .btn-sm { min-height: 36px; }
  .mainnav a { padding: var(--s3); }
}
