@font-face {
  font-family: Onest;
  src: url("/fonts/Onest-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --surface: #fff;
  --surface-sunken: #f4f0e8;
  --surface-field: #f0ece3;
  --surface-quiet: #fdfcf9;
  --line: #e5e0d6;
  --line-soft: #eeeae1;
  --line-control: #ddd8cc;
  --ink: #14161a;
  --ink-2: #3c4149;
  --ink-3: #626976;
  --accent: #2c6de0;
  --accent-strong: #1f5cc4;
  --accent-soft: #eef4ff;
  --accent-ring: #9cc0ff;
  --ok-bg: #e3f6ea;
  --ok-ink: #136b41;
  --bad-bg: #ffecf0;
  --bad-ink: #a32f4a;
  --warn-bg: #fff3d9;
  --warn-ink: #8a5b00;
  --shadow-1: 0 1px 2px rgb(16 24 40 / .05);
  --login-ground: #0e1014;
  --scene-line: rgb(155 187 238 / .22);
  --scene-paper: #222e41;
  --scene-paper-back: #1a2536;
  --scene-ink: #c2d2ed;
  --scene-blue: #83adf2;
  font: 400 14px/1.5 Onest, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface-sunken);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, select, input[type=checkbox], summary { cursor: pointer; }
button, .export { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 550; line-height: 1.25; }
button:disabled { cursor: progress; opacity: .65; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { flex: none; height: 17px; width: 17px; display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; }
h2, h3 { font-size: 17px; font-weight: 650; letter-spacing: -.018em; }
label { display: grid; gap: 5px; align-content: start; font-size: 13px; color: var(--ink-2); font-weight: 550; }
input:not([type=checkbox]), select, textarea { display: block; min-height: 38px; min-width: 0; width: 100%; padding: 7px 10px; border: 1px solid var(--line-control); border-radius: 6px; background: var(--surface); font-weight: 400; }
input::placeholder { color: var(--ink-3); }
input[type=month], input[type=date], input[type=number] { font-variant-numeric: tabular-nums; }
input[readonly], input:disabled, select:disabled { color: var(--ink-3); background-color: var(--surface-field); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-strong); }
textarea { resize: vertical; min-height: 78px; }
label small { color: var(--ink-3); font-size: 12px; font-weight: 400; }
.check { display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 8px; min-height: 36px; font-weight: 450; cursor: pointer; }
.check small { width: 100%; }
.primary { color: var(--surface); background: var(--accent); }
.primary:hover { background: var(--accent-strong); }
.secondary, .export, .icon { color: var(--ink-2); background: var(--surface); border-color: var(--line-control); }
.secondary:hover, .export:hover, .icon:hover { background: var(--surface-field); }
.quiet { color: var(--ink-3); }
.quiet:hover { background: var(--surface-field); color: var(--ink); }
.danger { color: var(--surface); background: var(--bad-ink); }
.icon { width: 36px; padding: 0; font-size: 22px; }
.muted { color: var(--ink-3); }
.error { color: var(--bad-ink); background: var(--bad-bg); border-radius: 6px; padding: 10px 12px; }
.error:empty, .muted:empty { display: none; }
.skip-link { position: fixed; left: 12px; top: -120px; z-index: 9; background: var(--surface); color: var(--accent-strong); padding: 10px; }
.skip-link:focus { top: 12px; }
.brand { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.brand b { font-size: 21px; font-weight: 700; letter-spacing: .14em; }
.brand span { margin-top: 4px; color: var(--ink-3); font-size: 13px; font-weight: 500; }

/* The login scene is an abstract ledger. All artwork is local and contains no account data. */
.auth-shell { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(370px, .9fr) minmax(0, 1.1fr); background: var(--surface); }
.auth-pane { display: flex; flex-direction: column; padding: clamp(30px, 5.2vw, 84px); }
.auth-pane .brand { align-self: flex-start; }
.auth-card { display: grid; gap: 18px; width: min(100%, 350px); margin: auto; padding-block: 50px; }
.auth-card h1 { font-size: clamp(32px, 3.2vw, 46px); letter-spacing: -.045em; }
.auth-intro { color: var(--ink-3); font-size: 15px; max-width: 330px; margin: -7px 0 6px; }
.auth-card input, .auth-card .primary { min-height: 46px; font-size: 16px; }
.auth-card .primary { margin-top: 4px; }
.password-field { display: grid; gap: 5px; grid-template-columns: 1fr auto; align-items: center; }
.password-field input { grid-column: 1/-1; }
.password-field .quiet { padding: 0 3px; min-height: 24px; font-size: 12px; color: var(--accent-strong); }
.login-scene { position: relative; display: grid; place-items: center; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 54% 44%, #2f415b, var(--login-ground) 76%); }
.login-scene::before { content: ""; position: absolute; inset: -50%; background-image: linear-gradient(var(--scene-line) 1px, transparent 1px), linear-gradient(90deg, var(--scene-line) 1px, transparent 1px); background-size: 58px 58px; transform: perspective(650px) rotateX(50deg) rotateZ(-30deg); opacity: .29; mask-image: radial-gradient(ellipse, black 12%, transparent 62%); }
.ledger-illustration { width: min(61%, 420px); aspect-ratio: .85; position: relative; transform: perspective(1000px) rotateX(36deg) rotateZ(-27deg) skewX(5deg); }
.ledger-paper { position: absolute; border: 1px solid var(--scene-line); border-radius: 11px; box-shadow: 0 15px 18px rgb(3 6 12 / .32); }
.back-sheet { inset: 5% 3% -6% -4%; background: var(--scene-paper-back); }
.main-sheet { inset: 0; padding: 11% 9%; background: linear-gradient(132deg, #33455e, var(--scene-paper) 85%); }
.sheet-title, .sheet-subtitle { height: 2%; min-height: 3px; width: 39%; margin-bottom: 4%; background: var(--scene-ink); border-radius: 3px; }
.sheet-subtitle { width: 20%; opacity: .45; margin-bottom: 12%; }
.sheet-rows { display: grid; grid-template-rows: repeat(7, 1fr); height: 65%; }
.sheet-rows i { display: flex; align-items: center; gap: 9%; border-top: 1px solid var(--scene-line); }
.sheet-rows i::before, .sheet-rows i::after { content: ""; display: block; width: 31%; border-radius: 3px; height: 4px; background: var(--scene-ink); opacity: .45; }
.sheet-rows i::after { margin-left: auto; width: 22%; opacity: .65; }
.sheet-rows i:nth-child(2n)::before { width: 42%; }
.chart-sheet { bottom: -4%; right: -14%; width: 69%; height: 44%; padding: 7%; background: #283b56; }
.chart-sheet .sheet-title { width: 51%; }
.bars { display: flex; height: 78%; gap: 6%; align-items: end; border-bottom: 1px solid var(--scene-line); }
.bars i { width: 9%; height: 32%; background: var(--scene-blue); border-radius: 2px 2px 0 0; }
.bars i:nth-child(2) { height: 48%; } .bars i:nth-child(3) { height: 38%; }
.bars i:nth-child(4) { height: 66%; } .bars i:nth-child(5) { height: 54%; }
.bars i:nth-child(6) { height: 79%; } .bars i:nth-child(7) { height: 92%; background: var(--scene-ink); }

.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-head { padding: 26px 21px 19px; border-bottom: 1px solid var(--line-soft); }
#menuToggle { display: none; }
.sidebar-body { display: flex; flex-direction: column; flex: 1; overflow: auto; }
.branch-label { padding: 17px 14px; }
.branch-label select { font-weight: 550; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px 18px; }
#nav button { justify-content: flex-start; gap: 11px; padding: 8px 11px; color: var(--ink-2); text-align: left; }
#nav button:hover { background: var(--surface-field); }
#nav button.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 650; }
.nav-gap { margin: 6px 4px; height: 1px; background: var(--line-soft); }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: auto; padding: 14px; border-top: 1px solid var(--line-soft); }
.user { min-width: 0; display: grid; }
.user strong { font-size: 13px; overflow-wrap: anywhere; }
.user span { font-size: 12px; color: var(--ink-3); }
.sidebar-bottom button { font-size: 12px; padding-inline: 6px; }
#main { min-width: 0; padding: 0 clamp(16px, 2.7vw, 48px) 50px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 28px 0 20px; border-bottom: 1px solid var(--line-control); }
.page-title p { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.period { display: flex; align-items: end; gap: 8px; }
.period label { font-size: 12px; }
.period input, .period button { min-height: 36px; }
.workspace-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 0; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.search-field { position: relative; }
.search-field input { padding-left: 34px; min-height: 36px; }
.search-field svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.sync-state { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.banner { margin-top: 12px; }
#content { display: grid; align-content: start; gap: 16px; }
.card, .kpis { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-1); overflow: hidden; }
.card-head { display: flex; gap: 12px; justify-content: space-between; align-items: start; padding: 16px 18px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head p { margin-top: 4px; font-size: 13px; color: var(--ink-3); max-width: 72ch; }
.card-head button { flex: none; }
.count { min-width: 22px; text-align: center; padding: 2px 6px; border-radius: 4px; background: var(--surface-field); color: var(--ink-2); font-size: 12px; font-weight: 550; }
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: var(--line-control) transparent; }
table { border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 14px; white-space: nowrap; line-height: 1.4; }
th { border-block: 1px solid var(--line); background: var(--surface-quiet); font-size: 12px; font-weight: 550; color: var(--ink-3); }
td { color: var(--ink-2); font-size: 13px; border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-quiet); }
td.wrap { white-space: normal; min-width: 130px; overflow-wrap: anywhere; max-width: 30em; }
td.num, th.num { text-align: right; }
td.num { color: var(--ink); }
tr.deleted td { color: var(--ink-3); background: var(--surface-field); }
.actions { display: flex; align-items: center; gap: 5px; }
.actions button { min-height: 30px; padding: 3px 7px; font-size: 12px; color: var(--accent-strong); }
.actions button:hover { background: var(--accent-soft); }
.actions .remove { color: var(--bad-ink); }
.actions .remove:hover { background: var(--bad-bg); }
.read-only { color: var(--ink-3); font-size: 12px; }
.empty { padding: 24px 18px; border-top: 1px solid var(--line-soft); color: var(--ink-3); background: var(--surface-quiet); display: flex; align-items: center; gap: 9px; }
.empty svg { color: var(--ink-3); }
.badge { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-field); color: var(--ink-2); border-radius: 5px; padding: 2px 7px; font-size: 12px; font-weight: 550; }
.badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.good { background: var(--ok-bg); color: var(--ok-ink); }
.warn { background: var(--warn-bg); color: var(--warn-ink); }
.bad { background: var(--bad-bg); color: var(--bad-ink); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { min-width: 0; padding: 16px; border-inline-end: 1px solid var(--line-soft); }
.kpi:last-child { border: 0; }
.kpi .label, .kpi small { display: block; color: var(--ink-3); font-size: 12px; }
.kpi strong { display: block; margin-top: 5px; font-size: clamp(19px, 2vw, 28px); line-height: 1.3; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; padding: 0 18px 18px; }
.settings-fields label { align-content: space-between; }
.settings-fields button { align-self: end; justify-self: start; }
.settings-fields .error { grid-column: 1/-1; }
summary { font-size: 16px; font-weight: 650; padding: 16px 18px; }
.downloads { display: flex; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
.export { text-decoration: none; }

dialog { padding: 0; border: 1px solid var(--line-control); border-radius: 10px; box-shadow: 0 12px 28px rgb(16 24 40 / .16); background: var(--surface); width: min(620px, calc(100% - 28px)); color: var(--ink); max-height: calc(100dvh - 34px); }
dialog::backdrop { background: rgb(20 22 26 / .36); }
#confirm { width: min(420px, calc(100% - 28px)); }
.dialog-head, .dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 12px 18px; background: var(--surface); position: sticky; z-index: 1; }
.dialog-head { top: 0; border-bottom: 1px solid var(--line-soft); }
.dialog-foot { bottom: 0; border-top: 1px solid var(--line-soft); justify-content: end; }
.dialog-body { padding: 18px; }
.dialog-body > :not(:first-child) { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1/-1; }
#toast { pointer-events: none; position: fixed; z-index: 3; bottom: 22px; left: 50%; transform: translateX(-50%); opacity: 0; background: var(--ink); color: var(--surface); border-radius: 7px; padding: 10px 16px; width: max-content; max-width: calc(100% - 32px); }
#toast.visible { opacity: 1; }

@media(max-width: 62rem) {
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media(max-width: 48rem) {
  .shell { display: block; }
  .sidebar { height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 0; }
  .sidebar-head .brand { flex-direction: row; align-items: baseline; gap: 9px; }
  .sidebar-head .brand span { margin: 0; }
  #menuToggle { display: inline-flex; }
  .sidebar-body { display: none; }
  .sidebar.menu-open .sidebar-body { display: flex; border-top: 1px solid var(--line-soft); }
  #nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
  .nav-gap { display: none; }
  #main { padding: 0 12px 24px; }
  .topbar { padding: 16px 0 12px; align-items: end; flex-wrap: wrap; }
  .period label { min-width: 0; }
  .workspace-bar { gap: 6px; padding: 12px 0; }
  .filters { gap: 4px 12px; }
  .search-field { flex: 1 1 155px; }
  .card-head { padding: 13px 12px; }
  .card-head p { font-size: 12px; }
  th, td { padding: 9px 10px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px; border-bottom: 1px solid var(--line-soft); }
  .kpi:nth-child(even) { border-inline-end: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  button, .period button, .icon, .actions button, .check, .export, input:not([type=checkbox]), .period input, .search-field input, select { min-height: 44px; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; }
  .dialog-body { padding: 14px; }
  .dialog-head, .dialog-foot { padding: 9px 14px; }
  .auth-shell { display: flex; flex-direction: column; background: var(--login-ground); }
  .auth-pane { border-radius: 18px 18px 0 0; background: var(--surface); z-index: 1; margin-top: -18px; padding: 26px max(22px, calc((100% - 380px) / 2)); flex: 1; }
  .auth-pane .brand { flex-direction: row; gap: 7px; align-items: baseline; }
  .auth-card { width: 100%; max-width: 380px; margin: 0 auto; padding: 22px 0 18px; gap: 14px; }
  .login-scene { order: -1; min-height: 160px; height: clamp(150px, 29svh, 245px); }
  .ledger-illustration { width: min(50%, 230px); }
}
@media(max-width: 32rem) {
  h1 { font-size: 22px; }
  .period { width: 100%; }
  .period label { flex: 1; }
  .card-head { flex-wrap: wrap; }
  .card-head > div { flex: 1 1 180px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  dialog { max-height: calc(100dvh - 12px); }
}

.sheet-tabs { display: flex; gap: 2px; align-items: stretch; border-block: 1px solid var(--line); padding: 3px 8px; overflow-x: auto; overscroll-behavior-x: contain; }
.sheet-tabs button { flex: none; color: var(--ink-2); }
.sheet-tabs button[aria-selected=true] { background: var(--accent-soft); color: var(--accent-strong); }
.sheet-tabs button:hover { background: var(--surface-field); }
.sheet-tools { padding: 10px 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.source-range { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sheet-actions, .source-jump, .source-jump label { display: flex; align-items: center; gap: 6px; }
.source-jump input { width: 74px; }
.sheet-actions { margin-inline-start: auto; flex-wrap: wrap; }
.source-scroll { max-height: max(320px, 64vh); overflow: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); }
.source-grid { table-layout: fixed; min-width: 100%; }
.source-grid thead th { position: sticky; top: 0; z-index: 2; }
.source-grid th, .source-grid td { padding: 5px 7px; border-right: 1px solid var(--line-soft); font-size: 12px; vertical-align: top; }
.source-grid td { white-space: pre-wrap; overflow-wrap: anywhere; }
.source-grid th { text-align: center; background: var(--surface-field); border-top: 0; font-weight: 550; color: var(--ink-2); }
.source-grid th:first-child { position: sticky; left: 0; z-index: 1; }
.source-grid thead th:first-child { z-index: 3; }
.source-error { padding: 14px; display: grid; justify-items: start; gap: 8px; }
.print-title { display: none; }
@media(max-width:48rem) { .sheet-actions { margin-inline-start: 0; } .sheet-tools { gap: 8px; } }
@media print {
  body:has(#sourceWorkbook) :is(.sidebar,.topbar,.workspace-bar,.skip-link,#toast,.sheet-tabs,.sheet-actions,.source-jump,.export) { display:none; }
  body:has(#sourceWorkbook) :is(.shell,#main,#content,.card,.source-scroll,.sheet-tools) { display:block; margin:0; padding:0; box-shadow:none; border:none; overflow:visible; max-height:none; }
  #sourceWorkbook .source-grid { width:100% !important; min-width:0; }
  #sourceWorkbook col { width:auto !important; }
  #sourceWorkbook :is(th,td) { position:static; font-size:7pt; padding:2pt; }
  #sourceWorkbook .print-title { display:block; }
}
.annual-summary > h2 { margin: 4px 0 9px; }
