:root {
  --ink: #1d2433; --muted: #5d6576; --line: #dfe3ea; --bg: #f6f7f9; --card: #fff;
  --accent: #1f5fbf; --accent-soft: #e8f0fc; --good: #1e7b45; --good-soft: #e5f4ea;
  --warn: #9a6400; --warn-soft: #fdf3dc; --bad: #b42318; --bad-soft: #fde8e6;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: #102341; color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar a { color: #fff; }
.brand { font-weight: 700; font-size: 16px; }
.tag { font-size: 11px; font-weight: 500; background: #ffffff26; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
#topnav { display: flex; gap: 16px; flex: 1; }
#userbox { display: flex; gap: 10px; align-items: center; font-size: 13px; }
#userbox select { font-size: 12px; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 20px 0 8px; } h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
textarea.prose { font-family: inherit; font-size: 13px; min-height: 360px; }
button, .btn { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; display: inline-block; }
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button.danger { background: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #f0f2f6; font-weight: 600; font-size: 12px; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.subtotal td { font-weight: 600; }
tr.section td { font-weight: 700; background: #fafbfc; }
tr.flag td { background: var(--warn-soft); }
.scroll { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 12px 0 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill.good { background: var(--good-soft); color: var(--good); } .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); }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 150px; }
.kpi b { display: block; font-size: 18px; } .kpi span { font-size: 12px; color: var(--muted); }
.banner { padding: 8px 20px; font-size: 13px; }
.banner.demo { background: var(--warn-soft); color: var(--warn); }
details { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
details summary { padding: 8px 12px; cursor: pointer; font-weight: 600; }
details > div { padding: 0 12px 12px; }
#toast { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
#toast div { background: #102341; color: #fff; padding: 10px 14px; border-radius: 6px; max-width: 420px; box-shadow: 0 4px 16px #0003; }
#toast div.err { background: var(--bad); }
.bar { height: 10px; background: var(--accent); border-radius: 2px; }
.bar.exp { background: #9aa4b5; }
.login { max-width: 380px; margin: 60px auto; }
.statement { max-width: 820px; }
.statement td:first-child { padding-left: 20px; }
.statement tr.section td:first-child, .statement tr.total td:first-child { padding-left: 8px; }
.signoff { font-size: 12px; }
/* notes: on-screen working aids (never printed or exported) */
.brk { background: #fde68a; padding: 0 2px; border-radius: 3px; }
.need { background: #fecaca; padding: 0 2px; border-radius: 3px; }
.fig { border-bottom: 1px dotted #2563eb; cursor: help; }
.note-block.nb-tpl { border-left: 4px solid #fcd34d; padding-left: 10px; }
.note-block.nb-open { border-left: 4px solid #f59e0b; padding-left: 10px; }
#printDoc { display: none; }
@media print {
  .topbar, .tabs, #banner, .noprint, button, textarea, select, .pill { display: none !important; }
  .brk, .need { background: none !important; padding: 0 !important; }
  .fig { border: none !important; }
  .note-block { border-left: none !important; padding-left: 0 !important; background: none !important; }
  input { border: none !important; background: none !important; appearance: none; }
  body.printing > :not(#printDoc) { display: none !important; }
  body.printing #printDoc { display: block !important; }
  .fs-page { page-break-after: always; }
  .fs-page:last-child { page-break-after: auto; }
  #printDoc br[style] { display: none; }
  main { padding: 0; max-width: none; }
  .card { border: none; padding: 0; }
  .scroll { max-height: none; overflow: visible; border: none; }
}
