:root {
  --ink: #1d2433; --muted: #5d6677; --line: #dfe3ea; --bg: #f6f7f9; --card: #fff;
  --accent: #1f5f8b; --ok: #1e7a4c; --okbg: #e3f4ea; --warn: #9a5b00; --warnbg: #fff3d6;
  --bad: #a3262e; --badbg: #fde8e8; --refbg: #f1f2f5;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
main { max-width: 1240px; margin: 0 auto; padding: 16px 20px 48px; }
footer { max-width: 1240px; margin: 0 auto; padding: 16px 20px 32px; color: var(--muted); font-size: 13px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--ink); color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 650; letter-spacing: .2px; }
.keystate { font-size: 13px; padding: 2px 10px; border-radius: 99px; }
.keystate.ok { background: #2c6e4a; } .keystate.off { background: #8a3b12; }
h1 { font-size: 26px; margin: 8px 0; } h2 { font-size: 20px; margin: 0 0 8px; } h3 { font-size: 16px; margin: 18px 0 6px; }
.lede, .hint { color: var(--muted); max-width: 80ch; }
.hint { font-size: 13.5px; margin: 0 0 10px; }
.flashes p { background: var(--warnbg); border: 1px solid #f0d28a; padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.notice { background: var(--warnbg); padding: 10px 14px; border-radius: 8px; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 16px 0; }
section.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; background: none; border: 0; padding: 0; }
.summary div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.summary span { display: block; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.summary b { font-size: 21px; font-variant-numeric: tabular-nums; }
.summary .owe b { color: var(--bad); } .summary .refund b { color: var(--ok); }
.crumbs { margin: 4px 0 12px; } .yr { margin-left: 8px; padding: 2px 8px; border-radius: 6px; text-decoration: none; }
.yr.on { background: var(--accent); color: #fff; }
.tabs { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0; background: var(--bg); }
.tabs a { padding: 6px 12px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--line); }
thead th { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); text-align: center; padding: 18px; }
.grid td { padding: 0; } .grid th { padding: 12px; }
.cell { display: block; padding: 12px; text-decoration: none; color: var(--ink); min-height: 72px; }
.cell:hover { background: #eef3f8; } .cell .big { font-size: 20px; font-weight: 600; }
.cell .bal { display: block; font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--refbg); color: var(--muted); margin: 1px 4px 1px 0; }
.pill.confirmed, .pill.extracted { background: var(--okbg); color: var(--ok); }
.pill.proposed, .pill.warn, .pill.extracting, .pill.new { background: var(--warnbg); color: var(--warn); }
.pill.rejected, .pill.error { background: var(--badbg); color: var(--bad); }
tr.rejected td { opacity: .5; text-decoration: line-through; } tr.rejected td.actions { text-decoration: none; opacity: 1; }
tr.ref td { background: var(--refbg); }
.src q { display: block; font-size: 12.5px; color: var(--muted); font-style: italic; max-width: 34ch; }
.summ { max-width: 46ch; font-size: 14px; }
.warnline { color: var(--warn); font-size: 13px; } .err { color: var(--bad); font-size: 13px; }
.working { color: var(--warn); font-weight: 600; }
.actions { white-space: nowrap; } .actions form { display: inline; }
button { font: inherit; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.small { padding: 2px 9px; font-size: 13px; }
button.secondary { background: #fff; color: var(--accent); }
button.danger { border-color: var(--bad); background: #fff; color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; border: 2px dashed var(--line); border-radius: 10px; margin-bottom: 12px; }
details.edit summary, details.addfact summary { cursor: pointer; color: var(--accent); display: inline; font-size: 13px; }
details.addfact { margin-top: 12px; } details.addfact summary { font-size: 15px; }
.factform { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; padding: 12px; margin-top: 8px; background: var(--bg); border-radius: 8px; white-space: normal; min-width: 560px; }
.factform label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); }
.factform .wide { grid-column: 1 / -1; }
.factform button { justify-self: start; }
td.actions details[open] { position: relative; }
.actions details.edit form.factform { display: grid; }
details.edit .factform { position: absolute; right: 0; top: 24px; z-index: 5; width: min(880px, 92vw); background: #fff;
  border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(20, 30, 50, .18); }
.bulk { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 24px; }
.profile label { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.profile label span { flex: 1; } .profile em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.profile .wide { grid-column: 1 / -1; } .profile textarea { flex: 2; }
.profile button { justify-self: start; }
.questions { background: var(--warnbg); border-radius: 8px; padding: 4px 16px 8px; }
.questions li { margin: 4px 0; }
.trace tr.sec th, .boxes tr.sec th { background: var(--bg); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.trace tr.total td { font-weight: 600; }
.boxno { width: 110px; font-weight: 600; font-variant-numeric: tabular-nums; }
.askform { display: grid; gap: 8px; }
.askform textarea { width: 100%; }
.askform .check { font-size: 14px; color: var(--muted); }
.askform button { justify-self: start; margin-right: 8px; display: inline-block; }
.qa { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.qa h3 { margin: 0; } .answer { max-width: 90ch; } .answer h4 { margin: 12px 0 4px; }
.cite { text-decoration: none; font-size: 12px; vertical-align: super; }
.sources li { font-size: 13.5px; margin: 3px 0; }
.inline { margin-top: 16px; }
@media (max-width: 760px) {
  main { padding: 12px; } .facts thead { display: none; } .facts td { display: block; border: 0; padding: 3px 6px; }
  .facts tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; } .factform { min-width: 0; }
}
tr.parked td { opacity: .6; } tr.parked td.actions { opacity: 1; }
.profile fieldset.splityear { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px 24px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; margin: 0; }
.profile fieldset.splityear legend { font-weight: 600; padding: 0 6px; }

/* sign-in (online copy only) */
.top .signout { margin-left: auto; }
.top .signout button { font: inherit; padding: .25rem .7rem; cursor: pointer; }
.login { max-width: 24rem; margin: 3rem auto; }
.login label { display: block; margin: .8rem 0; }
.login input { display: block; width: 100%; padding: .45rem; font: inherit; margin-top: .25rem; box-sizing: border-box; }
.login button { padding: .5rem 1.2rem; font: inherit; cursor: pointer; }
