:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  --ink: light-dark(#202923, #edf6f0);
  --muted: light-dark(#57675d, #b2c5b9);
  --line: light-dark(#d9e1d8, #3b4f46);
  --paper: light-dark(#fff, #1b2a25);
  --canvas: light-dark(#f6f7f2, #131e1a);
  --green: light-dark(#235e4c, #9adfc5);
  --dark: #172d29;
  --pale: light-dark(#e7f0e7, #253c32);
  --error: light-dark(#a23029, #ffb7af);
  --surface-header: light-dark(#fbfcf8, #172621);
  --surface-soft: light-dark(#edf3ec, #22362e);
  --surface-hover: light-dark(#f0f5ef, #2a3e36);
  --control-border: light-dark(#b9c9bd, #536b60);
  --primary-label: light-dark(#fff, #142a22);
  --primary-hover: light-dark(#194b3c, #b1ecd5);
  --focus: light-dark(#4a8a6f, #a6e7cd);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
a { color: var(--green); text-underline-offset: .16em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.loading { margin: 3rem; color: var(--muted); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 0; overflow: auto; background: var(--dark); color: #f2f6f1; padding: 25px 16px 20px; display: flex; flex-direction: column; gap: 25px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; font-size: 21px; letter-spacing: -.045em; }
.sidebar .brand { padding-inline: 9px; font-size: 18px; line-height: 1.15; }
.logo { width: 35px; height: 35px; border-radius: 10px; background: #cfe9c9; color: #203d32; display: grid; place-items: center; flex: none; }
.logo::before { content: ""; display: block; width: 15px; height: 14px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; background: repeating-linear-gradient(to top, transparent 0 3px, currentColor 3px 5px); }
.side-group { min-width: 0; display: grid; gap: 7px; }
.side-label { color: #abc1b8; font-size: 12px; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; padding-inline: 9px; }
.select-side { width: 100%; background: #213b34; color: #f3f8f3; border: 1px solid #4f695e; border-radius: 8px; padding: 9px; }
.nav { display: grid; gap: 3px; }
.nav button { width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere; padding: 9px; display: flex; align-items: center; gap: 9px; color: #dcebe4; background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: 14px; }
.nav button:hover, .nav button[aria-current="page"] { background: #2c4a3e; color: #fff; }
.nav button[aria-current="page"] { border-color: #4a695b; font-weight: 650; }
.nav .glyph { width: 21px; text-align: center; color: #b8dac9; flex: none; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; }
.sidebar-bottom button { color: #e4efe8; padding: 8px; text-align: left; background: transparent; border: 1px solid #49655a; border-radius: 8px; }
.main { min-width: 0; }
.top { min-height: 64px; padding: 12px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--surface-header); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crumb { font-size: 14px; color: var(--muted); }
.crumb strong { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-tag { background: light-dark(#f0ead5, #42381f); color: light-dark(#665524, #f1d896); padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.content { padding: 31px clamp(16px, 4vw, 48px) 48px; max-width: 1600px; margin-inline: auto; }
.hero, .panel-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px 20px; }
.hero { margin-bottom: 22px; }
.kicker { color: var(--green); font-size: 13px; font-weight: 700; letter-spacing: .075em; text-transform: uppercase; margin-block-end: 6px; }
h1 { font: 500 clamp(33px, 4.2vw, 53px)/1.04 Georgia, serif; letter-spacing: -.055em; overflow-wrap: anywhere; }
.hero p { margin-top: 7px; color: var(--muted); }
h2 { font-size: 21px; letter-spacing: -.035em; overflow-wrap: anywhere; }
h3 { font-size: 16px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.secondary, .muted { color: var(--muted); }
.secondary { font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block: 0 22px; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; color: var(--muted); display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px; }
.metric strong { font: 500 29px/1 Georgia, serif; color: var(--ink); }
.metric[aria-pressed="true"] { background: var(--pale); border-color: #8aaf9c; }
.metric .dot { margin-left: auto; inline-size: 8px; block-size: 8px; border-radius: 50%; background: #8d7237; flex: none; }
.metric[data-filter="review"] .dot { background: #5c7fa3; }
.metric[data-filter="complete"] .dot { background: #398260; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.panel-head { align-items: center; padding: 17px 18px; }
.panel-head p { margin-top: 3px; }
.toolbar, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button { padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--control-border); border-radius: 8px; font-size: 14px; font-weight: 620; min-height: 37px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.button:hover { background: var(--surface-hover); }
.button.primary { color: var(--primary-label); background: var(--green); border-color: var(--green); }
.button.primary:hover { background: var(--primary-hover); }
.button[data-action="theme"][aria-pressed="true"] { color: var(--green); background: var(--pale); }
.button.danger, .error { color: var(--error); }
.button.quiet { padding: 5px 8px; min-height: 31px; }
.table-wrap { overflow-x: auto; border-radius: 0 0 13px 13px; }
.ledger-workspace { display:grid; gap:14px; }
.ledger-heading { padding:0; }
.ledger-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.ledger-summary > div { display:grid; gap:5px; padding:13px 16px; border-radius:10px; border:1px solid var(--line); background:var(--pale); }
.ledger-summary span { color:var(--muted); font-size:14px; }
.ledger-summary strong { font:500 clamp(24px,4vw,34px)/1.1 Georgia,serif; font-variant-numeric:tabular-nums; }
.ledger-source-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
.ledger-files { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.combined-title { font-weight:650; }
@media (min-width: 561px) {
  .combined-ledger-table { table-layout: fixed; min-width: 850px; }
  .combined-ledger-table col:nth-child(1) { width: 18%; }
  .combined-ledger-table col:nth-child(2) { width: 15%; }
  .combined-ledger-table col:nth-child(3) { width: 11%; }
  .combined-ledger-table col:nth-child(4) { width: 18%; }
  .combined-ledger-table col:nth-child(5) { width: 12%; }
  .combined-ledger-table col:nth-child(6) { width: 14%; }
  .combined-ledger-table col:nth-child(7) { width: 12%; }
  .combined-ledger-table :is(th, td):nth-child(3) { text-align: right; }
  .combined-ledger-table :is(th, .badge) { white-space: normal; }
}
.button.source-link { display:inline; min-height:0; padding:3px 0; color:var(--green); background:transparent; border-color:transparent; text-align:left; overflow-wrap:anywhere; text-decoration:underline; text-underline-offset:3px; }
.inline-value { min-width:32px; min-height:31px; padding:3px 6px; font:inherit; color:var(--green); border-color:transparent; text-align:left; overflow-wrap:anywhere; }
.inline-value:hover { border-color:var(--control-border); }
.ledger-table input[form="ledger-inline-form"] { width:100%; min-width:92px; padding:5px 7px; font:inherit; color:var(--ink); background:var(--paper); border:1px solid var(--control-border); border-radius:6px; }
.ledger-table .inline-form { margin-top:6px; }
.ledger-table .status-button { min-height:32px; padding:2px; border-color:transparent; }
.ledger-subtotal { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; padding:10px 18px; background:var(--surface-soft); border-radius:0 0 13px 13px; font-variant-numeric:tabular-nums; }
[data-ledger-calculation] { display:grid; gap:9px; }
@media(max-width:450px) { .ledger-summary { grid-template-columns:1fr; gap:6px; } }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
th, td { padding: 11px 13px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
thead th { color: var(--muted); font-weight: 650; font-size: 12px; background: var(--surface-header); white-space: nowrap; }
tbody tr:hover:not(.group-row) { background: var(--surface-header); }
.group-row th { background: var(--surface-soft); color: var(--green); font-weight: 650; padding-block: 7px; font-size: 12px; letter-spacing: .025em; }
.row-link { text-align: left; border: 0; background: transparent; padding: 4px 0; color: var(--ink); font-weight: 650; min-width: 135px; }
.row-link:hover { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }
.file-cell { min-width: 118px; }
.note-cell { min-width: 135px; max-width: 220px; color: var(--muted); }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 5px; font-size: 12px; font-weight: 650; white-space: nowrap; background: light-dark(#edf0ed, #30433a); color: light-dark(#435549, #d2e3d8); }
.badge.wait { background: light-dark(#faf0d9, #443521); color: light-dark(#704f1d, #f8d893); }
.badge.review { background: light-dark(#e7eff8, #263c51); color: light-dark(#2f526d, #b8d9f3); }
.badge.follow { background: light-dark(#f9eae3, #492f27); color: light-dark(#85472f, #ffc6ae); }
.badge.done { background: light-dark(#e5f2e8, #29443a); color: light-dark(#326346, #afe6c5); }
.empty { padding: 20px; color: var(--muted); border-top: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--line); }
.list li p { overflow-wrap: anywhere; }
.list .row-link { min-width: 0; }
.entry-form, .dialog-body { display: grid; gap: 14px; }
.entry-form { padding: 18px; border-top: 1px solid var(--line); max-width: 680px; }
.field { display: grid; gap: 5px; min-width: 0; font-size: 14px; font-weight: 620; }
.field input:not([type=checkbox]), .field select, .field textarea, .picker { min-width: 0; width: 100%; border: 1px solid var(--control-border); border-radius: 8px; padding: 8px 10px; background: var(--paper); color: var(--ink); }
.field input[type=file] { padding-inline: 7px; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:read-only { background: var(--surface-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { accent-color: var(--green); width: 16px; height: 16px; }
.picker { width: auto; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dialog { margin: auto; }
dialog { padding: 0; border: 1px solid var(--line); border-radius: 15px; width: min(630px, calc(100% - 24px)); max-height: calc(100% - 28px); color: var(--ink); background:var(--paper); box-shadow: 0 16px 60px #10261d55; }
dialog::backdrop { background: #162d2980; }
.dialog-head { position: sticky; top: 0; z-index: 1; background: var(--paper); padding: 15px 18px; border-bottom: 1px solid var(--line); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-notice:not(:empty) { margin-top: 9px; padding: 7px 10px; border-radius: 6px; color: var(--green); background: var(--pale); font-size: 14px; font-weight: 650; }
.dialog-notice[data-kind="error"]:not(:empty) { color: var(--error); background: var(--surface-soft); }
.dialog-body { padding: 18px; }
.dialog-body-form > .dialog-body { padding: 0; }
.dialog-body section, .dialog-body details { display: grid; gap: 9px; border-top: 1px solid var(--line); padding-top: 13px; }
.dialog-body details[open] > summary { margin-bottom: 10px; }
.dialog-body summary { cursor: pointer; font-weight: 650; }
.documents-list { margin: 0; padding-left: 19px; }
.documents-list li { padding-block: 3px; }
.note { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.credential { padding: 12px; border-radius: 8px; background: var(--pale); display: grid; gap: 6px; overflow-wrap: anywhere; }
#toast:not(:empty) { position: fixed; bottom: 16px; right: 16px; z-index: 2; max-width: min(360px, calc(100% - 32px)); color: #fff; background: #203b2e; padding: 11px 14px; border-radius: 9px; box-shadow: 0 4px 18px #203b2e33; }
#toast[data-kind="error"]:not(:empty) { background: #832b25; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-brand { padding: clamp(25px, 6vw, 70px); background: var(--dark); color: #eff7ec; display: grid; align-content: center; gap: 18px; }
.login-brand .brand { font-size: 24px; }
.login-brand h1 { font-size: clamp(40px, 6vw, 82px); max-width: 10ch; }
.login-brand p { color: #bad0c5; line-height: 1.55; max-width: 35ch; }
.login-side { padding: clamp(22px, 5vw, 62px); display: grid; place-items: center; }
.login-box { width: min(100%, 420px); display: grid; gap: 16px; }
.login-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.login-box form { display: grid; gap: 13px; }
.login-box .demo-actions { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .content { padding-top: 23px; }
  .metric { padding: 10px; gap: 7px; }
  .metric .dot { display: none; }
}
@media (max-width: 700px) {
  .shell, .login { display: block; }
  .sidebar { position: relative; height: auto; gap: 12px; padding: 13px; }
  .sidebar .brand { padding-inline: 0; }
  .sidebar .side-label { padding-inline: 0; }
  .sidebar .nav { display: flex; flex-wrap: wrap; }
  .sidebar .nav button { width: auto; }
  .sidebar-bottom { display: flex; flex-wrap: wrap; }
  .top { padding-inline: 13px; min-height: 52px; }
  .content { padding-inline: 13px; }
  .metrics { grid-template-columns: 1fr; gap: 5px; }
  .metric strong { width: 34px; }
  .login-brand h1 { max-width: none; }
}
@media (max-width: 560px) {
  .table-wrap { overflow: visible; }
  .combined-ledger-table colgroup { display: none; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody tr:not(.group-row) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); padding: 9px 13px; gap: 7px; }
  tbody tr.group-row { display: block; }
  tbody tr.group-row th { display: block; padding: 7px 13px; }
  tbody tr:not(.group-row) td { padding: 0; border: 0; min-width: 0; max-width: none; white-space: normal; }
  tbody td:first-child { grid-column: 1 / -1; }
  tbody td[data-label]::before { display: block; content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 650; }
  .badge { white-space: normal; }
  .form-grid { grid-template-columns: 1fr; }
  .panel-head { padding-inline: 13px; }
}
