:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d8e0eb;
  --text: #121a27;
  --muted: #637083;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --blue: #2563eb;
  --purple: #7c3aed;
  --red: #d94841;
  --amber: #b7791f;
  --warn: #9a6500;
  --ok: #0a7a45;
  --shadow: 0 14px 36px rgba(31, 41, 55, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, .10), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 34rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #101824;
  color: #fff;
  border-bottom: 1px solid #000;
}
.topbar div { display: flex; align-items: baseline; gap: 10px; }
.topbar span { color: #aeb8c5; font-size: 13px; }
.topbar nav { display: flex; gap: 18px; }
.topbar a { color: #dbe4ef; }

.shell { width: min(1500px, calc(100vw - 40px)); margin: 24px auto 48px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: 0 16px 60px rgba(18, 32, 51, .14); }

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.hero.compact { align-items: center; }
.eyebrow { margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: 0; }
h2 { margin: 0 0 14px; font-size: 16px; line-height: 1.25; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin-bottom: 6px; }

.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); margin-bottom: 16px; }
.charts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.card:hover { border-color: #cbd5e1; }
.card.metric { text-decoration: none; color: inherit; }
.accent-card { position: relative; overflow: hidden; }
.accent-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent); }
.accent-card.green::before { background: var(--ok); }
.accent-card.red::before { background: var(--red); }
.accent-card.blue::before { background: var(--blue); }
.accent-card.amber::before { background: var(--amber); }
.accent-card.purple::before { background: var(--purple); }
.metric { min-height: 110px; display: flex; flex-direction: column; justify-content: space-between; }
.compact-metric { min-height: 96px; }
.metric span, .muted { color: var(--muted); }
.metric strong { display: block; font-size: 27px; line-height: 1.1; }
.compact-metric strong { font-size: 23px; }
.metric small { color: var(--muted); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
button, .primary, .secondary {
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); text-decoration: none; }
.secondary { background: #fff; color: var(--text); }
.primary, .secondary { box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.wide { width: 100%; margin-top: 18px; }
button:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid #edf0f5; text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
th a { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--red); }
.click-row { cursor: pointer; }
.click-row:hover { background: #f7fbff; }
.category-row td {
  background: #eef6f5;
  color: #0f2f2c;
  font-weight: 700;
}
.category-row:hover td { background: #e4f0ee; }
.category-row .muted { font-weight: 500; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #364152;
  font-size: 12px;
  white-space: nowrap;
}
.pill.ok { background: #e8f5ec; color: var(--ok); }
.pill.warn { background: #fff5dc; color: var(--warn); }

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}
.doc-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  max-width: 230px;
  padding: 6px 8px;
  border: 1px solid #dbe5ef;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.doc-chip:hover { border-color: var(--accent); text-decoration: none; }
.doc-chip small { color: var(--muted); }
.doc-chip.ok { background: #ecfdf3; border-color: #b7e1c4; }
.doc-chip.warn { background: #fff8e6; border-color: #efd48f; }

.status-list { display: grid; gap: 10px; }
.status-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf0f5; padding-bottom: 10px; }
.status-list span { min-width: 0; }
.status-list small { display: block; color: var(--muted); margin-top: 3px; }
.card-footer { padding-top: 14px; }
.alert { background: #fff2f0; border: 1px solid #ffd0ca; color: #9f2418; padding: 10px 12px; border-radius: 6px; margin: 14px 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; align-items: end; }
.panel-filters {
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.filters label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { min-width: 240px; }
.inline-form input { min-width: 180px; }
.category-editor {
  display: grid;
  gap: 12px;
  max-width: 860px;
}
.category-editor label:not(.check-row) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.category-editor select,
.category-editor input[type="text"],
.category-editor input:not([type]) {
  width: 100%;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  line-height: 1.45;
}
.check-row input {
  min-height: auto;
  margin-top: 3px;
}
.compact-check {
  min-height: 38px;
  align-items: center;
}
.rule-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.ok-alert {
  background: #e8f5ec;
  border-color: #b9e4c9;
  color: var(--ok);
}
.category-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.category-action-card p { margin: 0; }
.drawer-open { overflow: hidden; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, .42);
}
.drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  width: min(620px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 50px rgba(15, 23, 42, .22);
  transform: translateX(100%);
  transition: transform .18s ease;
}
.drawer.open {
  transform: translateX(0);
}
.transaction-detail-drawer {
  width: min(1180px, 96vw);
}
.transaction-detail-drawer-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}
.transaction-detail-drawer-body {
  padding: 18px;
  overflow: auto;
}
.transaction-detail-drawer-body .shell {
  width: 100%;
  margin: 0;
}
.transaction-detail-drawer-body .hero {
  margin-top: 0;
}
.drawer-panel {
  height: 100%;
  max-width: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
}
.drawer-head,
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}
.drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}
.icon-button {
  width: 38px;
  padding: 0;
  font-weight: 700;
}
select, input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  font: inherit;
}
.searchable-select {
  position: relative;
  width: 100%;
}
.searchable-native-select {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.searchable-select-input {
  width: 100%;
  font-weight: 600;
}
.searchable-select-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(31, 41, 55, .16);
}
.searchable-select-option {
  width: 100%;
  min-height: 34px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.searchable-select-option:hover,
.searchable-select-option.active {
  background: #eef7f4;
}
.searchable-select-option.selected {
  font-weight: 700;
  color: var(--accent-dark);
}
.searchable-select-empty {
  padding: 10px;
  color: var(--muted);
}
.search-input { min-width: min(520px, 100%); flex: 1; }
.chart { width: 100%; height: 330px; }
.chart-card { min-height: 390px; }
.data-card { padding: 0; }
.data-card table th { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.coa-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.coa-overview div {
  background: linear-gradient(135deg, #ffffff 0%, #f6fbff 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.coa-overview span,
.coa-summary-stat small,
.coa-account small,
.coa-account em,
.coa-grid-row small {
  color: var(--muted);
}
.coa-overview strong {
  display: block;
  margin-top: 5px;
  font-size: 23px;
  line-height: 1.1;
}
.coa-stack {
  display: grid;
  gap: 14px;
}
.coa-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.coa-group summary {
  display: grid;
  grid-template-columns: 24px minmax(240px, 1fr) repeat(3, minmax(120px, auto));
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  cursor: pointer;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, .08), transparent 56%),
    #fff;
}
.coa-group summary::-webkit-details-marker { display: none; }
.coa-group summary > span:nth-child(2) {
  display: grid;
  gap: 2px;
}
.coa-caret {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #b8c5d4;
  position: relative;
  background: #f8fafc;
}
.coa-caret::before,
.coa-caret::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 8px;
  height: 2px;
  background: #475569;
  transition: transform .14s ease;
}
.coa-caret::after { transform: rotate(90deg); }
.coa-group[open] .coa-caret::after { transform: rotate(0); }
.coa-summary-stat {
  display: grid;
  gap: 2px;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}
.coa-summary-stat strong {
  font-size: 16px;
}
.coa-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) minmax(150px, .75fr) repeat(5, minmax(96px, .55fr));
}
.coa-grid-head,
.coa-grid-row {
  display: contents;
}
.coa-grid-head > span {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid #eef2f6;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.coa-grid-head a {
  color: var(--muted);
}
.coa-grid-head a span {
  color: var(--accent);
  text-transform: lowercase;
  letter-spacing: 0;
}
.coa-grid-row > span {
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid #edf0f5;
  background: #fff;
  color: var(--text);
}
.coa-grid-row:hover > span {
  background: #f4fbfa;
}
.coa-account {
  display: grid;
  gap: 3px;
}
.coa-account a {
  font-weight: 750;
}
.coa-account em {
  font-style: normal;
  font-size: 12px;
}
.coa-tag {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}
.coa-tag.asset { background: #e8f5ec; color: #0a7a45; }
.coa-tag.liability { background: #fff2f0; color: #b42318; }
.coa-tag.income { background: #eaf2ff; color: #1d4ed8; }
.coa-tag.expense { background: #fff5dc; color: #9a6500; }
.coa-tag.equity { background: #f1edff; color: #6d28d9; }
.raw-json {
  margin: 0;
  padding: 14px;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  overflow: auto;
  max-height: 560px;
  font-size: 12px;
  line-height: 1.5;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.detail-grid div {
  border: 1px solid #edf0f5;
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}
.detail-grid span { display: block; margin-bottom: 4px; }
.detail-grid strong { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .metrics, .metrics.three, .metrics.four, .metrics.five, .two, .charts { grid-template-columns: 1fr; }
  .hero { align-items: stretch; flex-direction: column; }
  .topbar { height: auto; padding: 14px 16px; align-items: flex-start; gap: 10px; flex-direction: column; }
  .topbar nav { width: 100%; overflow-x: auto; gap: 14px; padding-bottom: 4px; }
  .shell { width: min(100vw - 24px, 1440px); margin-top: 16px; }
  h1 { font-size: 24px; }
  .chart { height: 300px; }
  .filters label, .filters input, .filters select, .filters button, .filters a { width: 100%; }
  table { min-width: 760px; }
  .data-card, .card { -webkit-overflow-scrolling: touch; }
  .detail-grid { grid-template-columns: 1fr; }
  .coa-overview { grid-template-columns: 1fr 1fr; }
  .coa-overview strong { font-size: 20px; }
  .coa-group summary {
    grid-template-columns: 24px minmax(0, 1fr);
  }
  .coa-summary-stat {
    grid-column: 2;
    justify-items: start;
    display: inline-flex;
    gap: 8px;
    align-items: baseline;
  }
  .coa-grid {
    display: block;
  }
  .coa-grid-head {
    display: none;
  }
  .coa-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding: 12px;
    border-top: 1px solid #edf0f5;
    background: #fff;
  }
  .coa-grid-row:hover {
    background: #f4fbfa;
  }
  .coa-grid-row > span {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
  }
  .coa-grid-row > span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
  }
  .coa-grid-row:hover > span {
    background: transparent;
  }
  .coa-account {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .coa-overview { grid-template-columns: 1fr; }
  .coa-grid-row { grid-template-columns: 1fr; }
}

/* Design handoff alignment for server-rendered dashboard routes. */
:root {
  --bg: #F6F3EC;
  --panel: #FBF9F4;
  --surface: #FFFFFF;
  --surface-2: #F1EDE3;
  --surface-3: #E8E3D6;
  --line: rgba(20,18,12,.09);
  --line-2: rgba(20,18,12,.16);
  --text: #16140E;
  --muted: #7B7468;
  --accent: #0E5B4D;
  --accent-dark: #0A463B;
  --blue: #315E9A;
  --purple: #7055A0;
  --red: #B83A22;
  --amber: #A06A1A;
  --warn: #A06A1A;
  --ok: #2E7D4F;
  --shadow: 0 1px 0 rgba(20,18,12,.04), 0 6px 22px -18px rgba(20,18,12,.22);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter Tight", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); }

.legacy-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg);
}

.legacy-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 12px;
}

.legacy-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 12px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.legacy-brand:hover { text-decoration: none; }
.legacy-brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.legacy-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #FBF9F4;
  font-family: Georgia, ui-serif, serif;
  font-size: 18px;
  line-height: 1;
}

.legacy-nav {
  display: grid;
  gap: 6px;
  flex: 1;
}
.legacy-nav-group h2 {
  margin: 8px 8px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.legacy-nav-group a {
  display: flex;
  align-items: center;
  min-height: 29px;
  padding: 6px 8px;
  border-radius: 5px;
  color: #57534B;
  font-size: 13px;
  text-decoration: none;
}
.legacy-nav-group a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.legacy-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 11px 2px 0;
  font-size: 11.5px;
}
.legacy-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(46,125,79,.12);
}

.legacy-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.legacy-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(246,243,236,.92);
  backdrop-filter: blur(12px);
}
.legacy-topbar p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.legacy-topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.legacy-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  color: #57534B;
  text-decoration: none;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legacy-user:hover { text-decoration: none; color: var(--text); }
.legacy-user span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.shell {
  width: min(1520px, calc(100vw - 288px));
  margin: 18px auto 42px;
}
.hero {
  margin-bottom: 14px;
  gap: 14px;
}
.eyebrow {
  color: var(--muted);
  font-size: 11px;
}
h1 {
  font-size: 24px;
  font-weight: 600;
}
h2 {
  font-size: 14px;
  font-weight: 650;
}

.grid { gap: 12px; }
.metrics { margin-bottom: 12px; }
.card,
.coa-group,
.panel-filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.card {
  padding: 14px;
}
.metric {
  min-height: 88px;
}
.metric strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.compact-metric strong {
  font-size: 20px;
}
.accent-card::before {
  height: 3px;
}

button,
.primary,
.secondary {
  min-height: 32px;
  border-radius: 5px;
  padding: 7px 10px;
}
.secondary {
  background: var(--surface);
}

th,
td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--muted);
  font-size: 10.5px;
}
.click-row:hover,
.tbl tbody tr:hover td,
.coa-grid-row:hover > span {
  background: var(--surface-2);
}
.category-row td,
.coa-grid-head > span {
  background: var(--surface-2);
}
.pill,
.coa-tag {
  min-height: 21px;
  border-radius: 5px;
  font-size: 11.5px;
}
.doc-chip,
.detail-grid div,
input,
select,
textarea {
  border-color: var(--line);
  border-radius: 5px;
}
.doc-chip,
.detail-grid div,
.coa-grid-row > span {
  background: var(--surface);
}
.filters {
  gap: 8px;
}
.panel-filters {
  padding: 10px;
}
.raw-json {
  border-radius: 6px;
}

@media (max-width: 980px) {
  .legacy-app {
    grid-template-columns: 1fr;
  }
  .legacy-sidebar {
    position: static;
    height: auto;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .legacy-nav {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  .legacy-status {
    display: none;
  }
  .legacy-topbar {
    position: static;
    padding: 12px 16px;
    align-items: flex-start;
  }
  .shell {
    width: min(100vw - 24px, 1440px);
    margin-top: 16px;
  }
}

@media (max-width: 620px) {
  .legacy-topbar {
    flex-direction: column;
  }
  .legacy-user {
    max-width: 100%;
  }
}

/* Consistent production design for every server-rendered route. */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F3EC;
  --panel: #FBF9F4;
  --surface: #FFFFFF;
  --surface-2: #F1EDE3;
  --surface-3: #E8E3D6;
  --line: rgba(20,18,12,.07);
  --line-2: rgba(20,18,12,.14);
  --line-3: rgba(20,18,12,.22);
  --text: #16140E;
  --text-2: #57534B;
  --text-3: #8B867B;
  --muted: #8B867B;
  --text-on-accent: #FBF9F4;
  --accent: #0E5B4D;
  --accent-dark: #0A463B;
  --accent-2: rgba(14,91,77,.10);
  --accent-3: rgba(14,91,77,.22);
  --ok: #2E7D4F;
  --ok-2: rgba(46,125,79,.12);
  --warn: #A06A1A;
  --warn-2: rgba(160,106,26,.14);
  --red: #B83A22;
  --err: #B83A22;
  --err-2: rgba(184,58,34,.10);
  --blue: #315E9A;
  --purple: #7055A0;
  --amber: #A06A1A;
  --shadow: 0 1px 0 rgba(20,18,12,.04), 0 1px 3px rgba(20,18,12,.04);
  --shadow-2: 0 6px 22px -10px rgba(20,18,12,.18), 0 2px 6px rgba(20,18,12,.06);
  --row-h: 34px;
  --cell-y: 7px;
  --cell-x: 10px;
  --gap: 12px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A09;
  --panel: #121210;
  --surface: #161613;
  --surface-2: #1C1B17;
  --surface-3: #25231D;
  --line: rgba(245,238,222,.06);
  --line-2: rgba(245,238,222,.13);
  --line-3: rgba(245,238,222,.22);
  --text: #EFE9D8;
  --text-2: #A29D8E;
  --text-3: #6E695E;
  --muted: #6E695E;
  --text-on-accent: #0A0A09;
  --accent: #5BCBA9;
  --accent-dark: #7BD8BB;
  --accent-2: rgba(91,203,169,.10);
  --accent-3: rgba(91,203,169,.22);
  --ok: #6BCB8A;
  --ok-2: rgba(107,203,138,.12);
  --warn: #E0A856;
  --warn-2: rgba(224,168,86,.14);
  --red: #E47B5C;
  --err: #E47B5C;
  --err-2: rgba(228,123,92,.14);
  --blue: #88A9E8;
  --purple: #B39BE8;
  --amber: #E0A856;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.4);
  --shadow-2: 0 12px 32px -12px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.4);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.4;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
  text-decoration: none;
}

.muted {
  color: var(--text-3);
}

.legacy-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--bg);
}

.legacy-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 0;
  z-index: 5;
}

.legacy-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 18px 14px 14px;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.legacy-brand strong {
  display: block;
  font-weight: 600;
  letter-spacing: -.01em;
}

.legacy-brand small {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
}

.legacy-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-size: 18px;
  line-height: 1;
  letter-spacing: -.02em;
}

.legacy-nav {
  flex: 1;
  display: block;
  overflow-y: auto;
  padding: 8px 8px 14px;
}

.legacy-nav-group {
  margin: 0 0 6px;
}

.legacy-nav-group h2 {
  margin: 10px 8px 5px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.legacy-nav-group a {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 8px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 13px;
  text-decoration: none;
}

.legacy-nav-group a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.legacy-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  padding: 12px 2px 14px;
  font-size: 11.5px;
}

.legacy-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-2);
}

.legacy-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.legacy-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.legacy-topbar p {
  margin: 0 0 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.legacy-topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.legacy-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-user span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.shell {
  width: min(1520px, calc(100vw - 288px));
  margin: 18px auto 42px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--gap);
}

.hero.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.grid {
  display: grid;
  gap: var(--gap);
}

.metrics,
.metrics.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--gap);
}

.metrics.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.two,
.charts {
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.card,
.coa-group,
.panel-filters,
.drawer-panel,
.doc-review-preview-pane,
.doc-review-match-pane,
.doc-review-candidate-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.card {
  padding: 14px;
  overflow: auto;
}

.card:hover {
  border-color: var(--line-2);
}

.data-card {
  padding: 0;
}

.metric {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.compact-metric {
  min-height: 82px;
}

.metric span,
.metric small {
  color: var(--text-3);
}

.metric strong {
  display: block;
  color: var(--text);
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.compact-metric strong {
  font-size: 22px;
}

.accent-card::before {
  height: 3px;
  background: var(--accent);
}

.accent-card.green::before { background: var(--ok); }
.accent-card.red::before { background: var(--red); }
.accent-card.blue::before { background: var(--blue); }
.accent-card.amber::before { background: var(--amber); }
.accent-card.purple::before { background: var(--purple); }

.actions,
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

button,
.primary,
.secondary {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

.primary:hover {
  background: var(--accent-dark);
  color: var(--text-on-accent);
}

.secondary:hover,
button:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--text);
}

button:disabled,
.primary[disabled],
.secondary[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

.filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--gap);
}

.panel-filters {
  padding: 10px;
}

.filters label,
.category-editor label:not(.check-row) {
  display: grid;
  gap: 5px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

input,
select,
textarea {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 12.5px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

th,
td {
  padding: var(--cell-y) var(--cell-x);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

th a {
  color: var(--text-3);
}

.data-card table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

tbody tr:hover td,
.click-row:hover td,
.tbl tbody tr:hover td {
  background: var(--surface-2);
}

.num {
  text-align: right;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.pos { color: var(--ok); }
.neg { color: var(--red); }

.category-row td {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.pill,
.coa-tag {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.pill.ok,
.doc-chip.ok,
.coa-tag.asset,
.coa-tag.income {
  background: var(--ok-2);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
}

.pill.warn,
.doc-chip.warn,
.coa-tag.liability,
.coa-tag.expense {
  background: var(--warn-2);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  color: var(--warn);
}

.coa-tag.equity {
  background: var(--accent-2);
  border-color: var(--accent-3);
  color: var(--accent);
}

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}

.doc-chip,
.detail-grid div,
.doc-review-extracted span:not(.muted),
.doc-review-text-snippet,
.doc-review-file-preview,
.coa-grid-row > span {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.doc-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  max-width: 230px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.doc-chip:hover {
  border-color: var(--accent);
}

.doc-chip small {
  color: var(--text-3);
}

.status-list {
  display: grid;
  gap: 8px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.status-list small {
  display: block;
  color: var(--text-3);
  margin-top: 3px;
}

.alert {
  background: var(--err-2);
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
  color: var(--err);
  padding: 10px 12px;
  border-radius: 6px;
  margin: 14px 0;
}

.ok-alert {
  background: var(--ok-2);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-grid div {
  padding: 10px;
}

.detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.detail-grid strong,
.raw-json,
.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.raw-json,
.raw-json code,
pre {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
}

.drawer-backdrop {
  background: rgba(0,0,0,.54);
}

.drawer {
  background: var(--panel);
  border-left: 1px solid var(--line);
  color: var(--text);
}

.drawer-head,
.drawer-actions {
  background: var(--panel);
  border-color: var(--line);
}

.doc-review-queue-card {
  overflow: visible;
}

.doc-review-queue-head,
.doc-review-panel-head,
.doc-review-candidate-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.doc-review-title {
  display: block;
  color: var(--text);
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.doc-review-tags,
.doc-review-extracted,
.doc-review-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.doc-review-path {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.doc-review-drawer {
  width: min(1260px, 96vw);
}

.doc-review-drawer-body {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(340px, .85fr);
  align-content: start;
  gap: var(--gap);
  padding: var(--gap);
  overflow: auto;
}

.doc-review-preview-pane,
.doc-review-match-pane {
  min-width: 0;
  padding: 14px;
}

.doc-review-preview-frame {
  width: 100%;
  height: calc(100vh - 230px);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.doc-review-text-preview {
  height: calc(100vh - 230px);
  min-height: 560px;
  max-height: none;
}

.compact-review-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.doc-review-candidate-list {
  display: grid;
  gap: 10px;
}

.doc-review-candidate-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.doc-review-candidate-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.doc-review-candidate-meta span {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  padding: 8px;
}

.doc-review-candidate-meta small {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.coa-overview div,
.coa-summary-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.coa-group summary,
.coa-grid-head > span {
  background: var(--surface-2);
  color: var(--text);
}

.coa-grid-row:hover > span {
  background: var(--surface-2);
}

.coa-account a {
  color: var(--text);
  font-weight: 650;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow-2);
}

@media (max-width: 980px) {
  .legacy-app {
    grid-template-columns: 1fr;
  }

  .legacy-sidebar {
    position: static;
    height: auto;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .legacy-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .legacy-status {
    display: none;
  }

  .legacy-topbar {
    position: static;
    padding: 12px 16px;
    align-items: flex-start;
  }

  .shell {
    width: min(100vw - 24px, 1440px);
    margin-top: 16px;
  }

  .metrics,
  .metrics.three,
  .metrics.four,
  .metrics.five,
  .two,
  .charts,
  .detail-grid,
  .doc-review-drawer-body {
    grid-template-columns: 1fr;
  }

  .filters label,
  .filters input,
  .filters select,
  .filters button,
  .filters a {
    width: 100%;
  }

  table {
    min-width: 760px;
  }

  .doc-review-preview-frame,
  .doc-review-text-preview {
    height: 24vh;
    min-height: 180px;
  }
}

/* Unified shell navigation: keep server-rendered pages aligned with the SPA sidebar. */
.legacy-sidebar {
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.legacy-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.legacy-brand {
  margin: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 6px;
}

.legacy-brand:hover {
  background: var(--surface-2);
}

.legacy-brand strong,
.legacy-org strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.legacy-brand small,
.legacy-org small {
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.2;
}

.legacy-nav {
  display: block;
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 14px;
}

.legacy-nav-group {
  margin: 0 0 6px;
}

.legacy-nav-group h2 {
  margin: 0;
  padding: 8px 8px 4px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.legacy-nav-group ul {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legacy-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 30px;
  padding: 7px 8px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
}

.legacy-nav-link:hover,
.legacy-nav-link.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.legacy-nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.legacy-nav-link span {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.legacy-icon {
  flex: 0 0 auto;
}

.legacy-icon-chevr {
  color: var(--text-3);
}

.legacy-foot {
  border-top: 1px solid var(--line);
  padding: 10px 10px 12px;
}

.legacy-org {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px;
  border-radius: 6px;
}

.legacy-org-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 12px;
  font-weight: 600;
}

.legacy-status {
  margin: 8px 0 0;
  border: 0;
  padding: 0 7px;
  color: var(--text-3);
  font-size: 11px;
}

.legacy-status span {
  width: 6px;
  height: 6px;
}

@media (max-width: 980px) {
  .legacy-sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .legacy-nav {
    display: block;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .legacy-nav-group ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .legacy-foot {
    display: none;
  }
}

/* Accountant export page */
.accountant-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  align-items: stretch;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.accountant-hero-copy,
.accountant-hero-panel,
.accountant-control-band,
.accountant-workbook,
.accountant-sheet-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.accountant-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 178px;
  padding: 22px;
}

.accountant-hero-copy h1 {
  font-size: 30px;
}

.accountant-hero-copy p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--text-2);
}

.accountant-period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.accountant-hero-panel {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 18px;
}

.accountant-hero-panel > span,
.accountant-hero-panel p {
  margin: 0;
}

.accountant-hero-panel > strong {
  color: var(--text);
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.accountant-control-band {
  margin-bottom: var(--gap);
  padding: 12px;
}

.accountant-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 190px) minmax(150px, 190px) auto;
  align-items: end;
  gap: 10px;
}

.accountant-controls h2,
.accountant-controls .eyebrow {
  margin: 0;
}

.accountant-controls label {
  display: grid;
  gap: 5px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.accountant-controls input {
  width: 100%;
}

.accountant-metrics .metric {
  text-decoration: none;
}

.accountant-workbook {
  margin-bottom: var(--gap);
  padding: 14px;
}

.accountant-section-head,
.accountant-card-head,
.accountant-sheet-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.accountant-section-head {
  margin: 0 0 var(--gap);
}

.accountant-section-head h2,
.accountant-section-head .eyebrow,
.accountant-card-head h2,
.accountant-sheet-group-head h2,
.accountant-sheet-group-head p {
  margin: 0;
}

.accountant-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.accountant-sheet-group {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}

.accountant-sheet-group-head {
  min-height: 74px;
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.accountant-sheet-group-head p {
  margin-top: 5px;
}

.accountant-sheet-list {
  display: grid;
}

.accountant-sheet-row {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.accountant-sheet-row:last-child {
  border-bottom: 0;
}

.accountant-sheet-row strong {
  color: var(--text);
  font-size: 12.5px;
}

.accountant-sheet-row span {
  color: var(--text-3);
  line-height: 1.35;
}

.accountant-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

.accountant-preview-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.accountant-table-scroll {
  overflow: auto;
}

.accountant-preview-card table {
  min-width: 620px;
}

.accountant-preview-card th:first-child,
.accountant-preview-card td:first-child {
  width: 92px;
}

@media (max-width: 1100px) {
  .accountant-hero,
  .accountant-report-grid,
  .accountant-sheet-grid {
    grid-template-columns: 1fr;
  }

  .accountant-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .accountant-hero-copy,
  .accountant-hero-panel,
  .accountant-workbook,
  .accountant-control-band {
    padding: 12px;
  }

  .accountant-hero-copy h1 {
    font-size: 25px;
  }

  .accountant-controls {
    grid-template-columns: 1fr;
  }

  .accountant-controls .actions,
  .accountant-controls .primary,
  .accountant-controls .secondary,
  .accountant-section-head .secondary {
    width: 100%;
  }

  .accountant-section-head,
  .accountant-card-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Chart of accounts ledger grid refresh */
.coa-toggle-filter {
  min-height: 32px;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  padding: 7px 10px;
  color: var(--text);
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
}

.coa-toggle-filter input {
  min-height: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.coa-toggle-filter span {
  white-space: nowrap;
}

.coa-stack {
  display: grid;
  gap: var(--gap);
}

.coa-ledger-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.coa-ledger-group summary {
  display: grid;
  grid-template-columns: 22px minmax(240px, 1fr) repeat(3, minmax(110px, auto));
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
}

.coa-ledger-group summary:hover {
  background: var(--surface-3);
}

.coa-ledger-group summary::-webkit-details-marker {
  display: none;
}

.coa-ledger-group summary > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.coa-ledger-group summary strong {
  font-weight: 650;
}

.coa-ledger-group summary small {
  color: var(--text-3);
}

.coa-ledger-group.is-zero summary {
  color: var(--text-2);
}

.coa-ledger-table-wrap {
  overflow: auto;
}

.coa-ledger-table {
  min-width: 940px;
}

.coa-ledger-table th,
.coa-ledger-table td {
  white-space: nowrap;
}

.coa-ledger-table th:first-child,
.coa-ledger-table td:first-child {
  width: 34%;
  white-space: normal;
}

.coa-ledger-table th:nth-child(2),
.coa-ledger-table td:nth-child(2) {
  width: 170px;
}

.coa-ledger-table td small,
.coa-ledger-table td em {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-style: normal;
  white-space: normal;
}

.coa-ledger-table .is-zero-row td {
  color: var(--text-3);
}

.coa-ledger-table .is-zero-row .coa-account a {
  color: var(--text-2);
}

.coa-summary-stat {
  display: grid;
  gap: 2px;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.coa-summary-stat strong {
  font-size: 14px;
}

@media (max-width: 900px) {
  .coa-ledger-group summary {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .coa-summary-stat {
    grid-column: 2;
    justify-items: start;
    display: inline-flex;
    gap: 8px;
    align-items: baseline;
  }

  .coa-ledger-table {
    min-width: 820px;
  }
}

@media (max-width: 640px) {
  .coa-toggle-filter,
  .coa-toggle-filter span {
    width: 100%;
  }
}
