:root {
  --ink: #13343b;
  --accent: #1f6f64;
  --accent-dark: #17564e;
  --paper: #fafbf8;
  --white: #ffffff;
  --rule: #d5e2da;
  --band: #f1f6f2;
  --text: #23302f;
  --muted: #637371;
  --tick: #b8312f;
  --warn-bg: #fff6e5;
  --warn: #8a5a00;
  --radius: 6px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--paper); }
a { color: var(--accent); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin-top: 1.75rem; }
h3 { font-size: 1rem; font-weight: 600; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.topbar { display: flex; align-items: center; gap: 2rem; padding: .85rem 1.5rem; background: var(--white); border-bottom: 3px solid var(--ink); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.brand-mark { color: var(--tick); font-size: 1.2rem; }
.topnav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: .25rem 0; border-bottom: 2px solid transparent; }
.topnav a.active, .topnav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.page { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head .meta { color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.btn { font: inherit; font-weight: 600; font-size: .9rem; padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.secondary { background: var(--white); color: var(--accent); }
.btn.secondary:hover { background: var(--band); }
.btn.danger { background: var(--white); color: var(--tick); border-color: #e3b9b8; }
.btn.danger:hover { background: #fbeeee; }
.btn.link { background: none; border: none; color: var(--accent); padding: .25rem .4rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid #8fc2b9; outline-offset: 2px; }

.panel { background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }

.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--white); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { background: var(--band); color: var(--ink); font-weight: 600; position: sticky; top: 0; }
tbody tr:nth-child(even) td { background: #fbfdfb; }
tbody tr:hover td { background: var(--band); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); background: var(--white) !important; }
tr.sub td { font-weight: 600; }
tr.clickable { cursor: pointer; }
.schedule { max-height: 560px; overflow: auto; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); margin-bottom: .25rem; }
input, select, textarea { font: inherit; font-size: .9rem; width: 100%; padding: .45rem .6rem; border: 1px solid #b9cbc1; border-radius: 4px; background: var(--white); color: var(--text); }
input[type=checkbox] { width: auto; }
textarea { min-height: 70px; }
.grid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.inline-table input, .inline-table select { min-width: 110px; }
.inline-table td { padding: .35rem .4rem; }

.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 80px; }

.ledger { display: grid; grid-template-columns: 1fr auto; border-top: 2px solid var(--ink); margin-bottom: 1rem; }
.ledger div { padding: .4rem .2rem; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.ledger div:nth-child(even) { text-align: right; font-weight: 600; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 600; font-size: .9rem; background: none; border: none; border-bottom: 3px solid transparent; padding: .55rem .9rem; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--band); color: var(--ink); border: 1px solid var(--rule); }
.tag.gasb { background: #eef1fa; border-color: #d4dbef; color: #2a3d78; }
.tag.finance { background: #f3eefa; border-color: #ded3ef; color: #4b2a78; }
.tag.short { background: #f4f4f1; color: #555; }
.tag.expired { color: var(--muted); }
.tick { color: var(--tick); font-weight: 700; white-space: nowrap; }
.variance { color: var(--warn); font-weight: 600; white-space: nowrap; }

.notice { padding: .7rem .9rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dcae; margin-bottom: 1rem; font-size: .88rem; }
.notice.error { background: #fbeeee; color: var(--tick); border-color: #ecc8c7; }
.notice ul { margin: .25rem 0 0 1.1rem; padding: 0; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .btn { margin-top: .75rem; }

.steps { display: flex; gap: 1.5rem; margin: 0 0 1.25rem; padding: 0; list-style: none; counter-reset: s; flex-wrap: wrap; }
.steps li { counter-increment: s; color: var(--muted); font-weight: 600; font-size: .9rem; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--rule); margin-right: .4rem; font-size: .8rem; }
.steps li.on { color: var(--ink); }
.steps li.on::before { border-color: var(--accent); background: var(--accent); color: #fff; }
.steps li.done::before { content: "\2713"; border-color: var(--accent); color: var(--accent); }

.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: .65rem 1.1rem; border-radius: var(--radius); font-weight: 500; transition: transform .2s ease; z-index: 50; }
.toast.show { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.rowform { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.rowform .field { min-width: 160px; flex: 1; }
.seg-actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.modbox { border: 1px dashed #b9cbc1; border-radius: var(--radius); padding: .9rem; margin-top: .75rem; background: #fcfdfc; }

@media print {
  .topbar, .actions, .tabs, .noprint { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .page { max-width: none; padding: 0; }
  .panel, .tablewrap { border: none; padding: 0; }
  .schedule { max-height: none; overflow: visible; }
  th { position: static; }
}