@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("../fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 500; font-display: swap; src: url("../fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("../fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-display: swap; src: url("../fonts/public-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #1D2733;
  --ink-soft: #4A5562;
  --paper: #F6F7F5;
  --surface: #FFFFFF;
  --rule: #D8DDD6;
  --rule-soft: #E9ECE7;
  --pine: #2F6B57;
  --pine-tint: #E3EFEA;
  --amber: #8A5A0F;
  --amber-tint: #FBF1DF;
  --brick: #A23B3B;
  --brick-tint: #F8E6E4;
  --bs-body-font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-link-color: #2F6B57;
  --bs-link-hover-color: #1D2733;
  --bs-link-color-rgb: 47, 107, 87;
  --bs-link-hover-color-rgb: 29, 39, 51;
  --bs-border-color: var(--rule);
  --bs-primary-rgb: 47, 107, 87;
}

body { font-size: 0.9375rem; line-height: 1.5; font-feature-settings: "tnum" 1; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.125rem; margin: 1.75rem 0 0.75rem; }
h3 { font-size: 1rem; }
.lede { color: var(--ink-soft); max-width: 68ch; margin-bottom: 1.5rem; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #C9D1D9; padding: 1.25rem 0.75rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 0 0.75rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 0.75rem; }
.brand strong { display: block; color: #fff; font-size: 1.0625rem; font-weight: 600; }
.brand span { font-size: 0.8125rem; color: #8E99A6; }
.nav-toggle { color: #D5DBE1; border: 1px solid rgba(255,255,255,0.2); }
.nav-toggle:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
@media (min-width: 861px) {
  .nav-toggle { display: none; }
  .sidenav.collapse { display: flex !important; flex-direction: column; flex: 1; }
}
.nav-group { margin: 0.75rem 0 0.25rem; padding: 0 0.75rem; font-size: 0.75rem; color: #7D8895; font-weight: 500; }
.sidebar a.nav-link { color: #D5DBE1; padding: 0.375rem 0.75rem; border-radius: 4px; font-size: 0.875rem; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar a.nav-link.active { background: rgba(255,255,255,0.1); color: #fff; box-shadow: inset 3px 0 0 #7FC3A9; }
.sidebar .nav-later { padding: 0.25rem 0.75rem; font-size: 0.8125rem; color: #6B7684; }
.sidebar .me { margin-top: auto; padding: 0.75rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.8125rem; }
.sidebar .me a, .sidebar .me button { color: #D5DBE1; }
.main { padding: 1.75rem 2.25rem 3rem; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding-bottom: 0.5rem; }
  .brand { border-bottom: 0; margin-bottom: 0; padding-bottom: 0.5rem; }
  .main { padding: 1.25rem 1rem 2rem; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.figure-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.figure { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.25rem; }
.figure .label { color: var(--ink-soft); font-size: 0.8125rem; }
.figure .value { font-size: 1.375rem; font-weight: 600; margin-top: 0.125rem; }
.figure .note { color: var(--ink-soft); font-size: 0.8125rem; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; font-size: 0.875rem; margin-bottom: 0; }
.table > thead th { font-weight: 600; color: var(--ink-soft); font-size: 0.8125rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table > tbody td { border-color: var(--rule-soft); vertical-align: middle; }
.table > tfoot td { font-weight: 600; border-top: 2px solid var(--ink); border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.code { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; }
tr.is-header td { font-weight: 600; background: #F0F2EF; }
.depth-1 { padding-left: 1.5rem !important; }
.depth-2 { padding-left: 2.75rem !important; }
.depth-3 { padding-left: 4rem !important; }
tr.is-inactive td { color: #9AA3AD; }

/* ---------- status ---------- */
.status { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 999px; border: 1px solid transparent; }
.status-draft { background: #EEF0F2; color: var(--ink-soft); }
.status-submitted { background: var(--amber-tint); color: var(--amber); }
.status-approved { background: #E6EEF7; color: #2D5482; }
.status-posted { background: var(--pine-tint); color: var(--pine); }
.status-reversed { background: var(--brick-tint); color: var(--brick); }
.status-open { background: var(--pine-tint); color: var(--pine); }
.status-locked, .status-closed { background: #EEF0F2; color: var(--ink-soft); }

.notice { border-left: 3px solid var(--amber); background: var(--amber-tint); padding: 0.625rem 0.875rem; border-radius: 0 4px 4px 0; margin-bottom: 0.5rem; font-size: 0.875rem; }
.notice a { color: var(--amber); font-weight: 600; }
.alert { font-size: 0.875rem; border-radius: 4px; }
.alert-success { background: var(--pine-tint); border-color: #C3DDD2; color: #1F4D3E; }
.alert-danger { background: var(--brick-tint); border-color: #EBC9C5; color: #7A2A2A; }
.alert-warning { background: var(--amber-tint); border-color: #EBD7B1; color: #6B460C; }

/* ---------- forms ---------- */
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 0.25rem; }
.form-control, .form-select { font-size: 0.875rem; border-color: #C9D0C6; border-radius: 4px; background-color: var(--surface); }
.form-control:disabled, .form-select:disabled { background-color: #EEF0EC; color: var(--ink-soft); }
.btn-link { --bs-btn-color: var(--pine); --bs-btn-hover-color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--pine); box-shadow: 0 0 0 0.2rem rgba(47,107,87,0.15); }
.form-text { font-size: 0.8125rem; }
.btn { font-size: 0.875rem; font-weight: 500; border-radius: 4px; }
.btn-primary { --bs-btn-bg: var(--pine); --bs-btn-border-color: var(--pine); --bs-btn-hover-bg: #255647; --bs-btn-hover-border-color: #255647; --bs-btn-active-bg: #1F4A3D; --bs-btn-disabled-bg: var(--pine); --bs-btn-disabled-border-color: var(--pine); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--rule); --bs-btn-hover-bg: #ECEFEA; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #C5CCC3; }
.btn-outline-danger { --bs-btn-color: var(--brick); --bs-btn-border-color: #DDB3AE; --bs-btn-hover-bg: var(--brick); --bs-btn-hover-border-color: var(--brick); }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------- journal entry lines ---------- */
.lines td { padding: 0.375rem 0.375rem; }
.lines .form-control, .lines .form-select { font-size: 0.8125rem; padding: 0.3rem 0.5rem; }
.lines input.amount { text-align: right; font-variant-numeric: tabular-nums; min-width: 7rem; }
.lines .col-account { min-width: 16rem; }
.lines .remove-line { color: var(--ink-soft); border: 0; background: none; font-size: 1.125rem; line-height: 1; padding: 0.25rem 0.5rem; }
.lines .remove-line:hover { color: var(--brick); }

/* The balance bar: the one place the interface raises its voice. */
.balance-bar { display: grid; grid-template-columns: 1fr auto auto auto; gap: 1.5rem; align-items: center; margin-top: 0.75rem;
  padding: 0.75rem 1rem; border-radius: 6px; border: 1px solid var(--brick); background: var(--brick-tint); transition: background-color .2s, border-color .2s; }
.balance-bar .state { font-weight: 600; color: var(--brick); }
.balance-bar.is-balanced { border-color: var(--pine); background: var(--pine-tint); }
.balance-bar.is-balanced .state { color: var(--pine); }
.balance-bar.is-empty { border-color: var(--rule); background: var(--surface); }
.balance-bar.is-empty .state { color: var(--ink-soft); }
.balance-bar .tot { text-align: right; }
.balance-bar .tot small { display: block; color: var(--ink-soft); font-size: 0.75rem; }
.balance-bar .tot b { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .balance-bar { transition: none; } }
@media (max-width: 640px) { .balance-bar { grid-template-columns: 1fr 1fr; } }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.375rem 1.5rem; font-size: 0.875rem; margin: 0; }
.kv dt { color: var(--ink-soft); font-weight: 500; }
.kv dd { margin: 0; }

.guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.guest-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 2rem; }
.guest-card .brand-line { color: var(--ink-soft); font-size: 0.875rem; margin-bottom: 1.5rem; }
.bar-track { height: 6px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--pine); }
.bar-fill.expense { background: #9AA3AD; }
.w-0{width:0}.w-10{width:10%}.w-20{width:20%}.w-30{width:30%}.w-40{width:40%}.w-50{width:50%}.w-60{width:60%}.w-70{width:70%}.w-80{width:80%}.w-90{width:90%}.w-100{width:100%}
.otp-secret { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: 0.08em; word-break: break-all; background: var(--paper); padding: 0.5rem 0.75rem; border-radius: 4px; }
.install-card { max-width: 520px; }
.brand-preview { max-height: 70px; max-width: 220px; border: 1px solid var(--rule); padding: 6px; background: #fff; border-radius: 4px; }
.lines .form-control-sm, .lines .form-select-sm { font-size: 0.75rem; }
td.line-net { padding-top: 0.75rem !important; font-weight: 500; }
