/* OPTIMAL - presentation tier stylesheet
   Ledger design system: ink-navy chrome, cool paper, ledger green, red ink, brass roll-ups. */
:root {
  --ink: #1C2B3A;
  --ink-2: #2A3D50;
  --ink-3: #3B5068;
  --paper: #F3F5F2;
  --surface: #FFFFFF;
  --rule: #DCE2DC;
  --rule-strong: #C3CCC4;
  --text: #1C2B3A;
  --muted: #5E6B72;
  --ledger: #2E6B4F;
  --ledger-dark: #235540;
  --ledger-soft: #E3EFE8;
  --brass: #A7822F;
  --brass-soft: #F6EFDC;
  --red: #A8322A;
  --red-soft: #F8E4E1;
  --amber: #A86A12;
  --amber-soft: #FBF0DC;
  --blue: #2F5E8C;
  --blue-soft: #E4ECF5;
  --radius: 6px;
  --font: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --sidebar: 244px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text);
  background: var(--paper); -webkit-font-smoothing: antialiased;
}
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
a { color: var(--ledger); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ledger); outline-offset: 2px; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- login */
.login {
  min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.1fr) minmax(340px, 1fr);
}
.login-brand {
  background: var(--ink); color: #E8EEF0; padding: 56px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden;
}
.login-brand::after { /* ledger ruling */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background: repeating-linear-gradient(180deg, transparent 0 31px, #9FD1B8 31px 32px),
              linear-gradient(90deg, transparent 0 72%, #E07A6E 72% calc(72% + 1px), transparent 0);
}
.wordmark { font-size: 44px; font-weight: 800; letter-spacing: .06em; color: #fff; }
.wordmark span { color: #8FCBAE; }
.login-brand p { max-width: 42ch; color: #B9C6CE; font-size: 16px; }
.login-ledger { font-variant-numeric: tabular-nums; font-size: 13px; color: #C9D5DB; max-width: 420px; }
.login-ledger div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.login-ledger div:last-child { border-bottom: 2px solid #8FCBAE; font-weight: 700; color: #fff; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; margin-bottom: 6px; }
.login-form .muted { margin-bottom: 26px; }
.login-form .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 8px; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-brand { padding: 32px; min-height: 220px; } .login-ledger { display: none; } }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #C9D5DB; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .wordmark { font-size: 22px; padding: 20px 22px 4px; }
.sidebar .company { padding: 0 22px 16px; font-size: 12px; color: #93A4AE; border-bottom: 1px solid rgba(255,255,255,.08); }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav-group { margin-top: 14px; padding: 0 12px 4px; font-size: 11.5px; color: #7F929E; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 5px; color: #D5DFE4;
  text-decoration: none; font-size: 13.5px;
}
.nav a svg { width: 16px; height: 16px; opacity: .75; flex: none; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 #8FCBAE; }
.nav a.disabled { color: #6D808C; cursor: default; }
.nav a.disabled:hover { background: transparent; }
.nav .soon { margin-left: auto; font-size: 10.5px; border: 1px solid #4D6273; border-radius: 3px; padding: 0 5px; color: #8398A5; }
.sidebar-foot { padding: 14px 22px; font-size: 11.5px; color: #6D808C; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.ws-strip { height: 4px; background: var(--brass); }
.ws-strip.live { background: var(--ledger); }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.segmented button {
  border: 0; background: var(--surface); padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.segmented button + button { border-left: 1px solid var(--rule-strong); }
.segmented button .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.segmented button.on-demo { background: var(--brass-soft); color: #6E5418; font-weight: 600; }
.segmented button.on-demo .dot { background: var(--brass); opacity: 1; }
.segmented button.on-live { background: var(--ledger-soft); color: var(--ledger-dark); font-weight: 600; }
.segmented button.on-live .dot { background: var(--ledger); opacity: 1; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.user-btn:hover { background: var(--paper); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-btn .who { text-align: left; line-height: 1.15; }
.user-btn .who small { display: block; color: var(--muted); font-size: 11.5px; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(28,43,58,.16); min-width: 200px; padding: 6px; z-index: 40;
}
.dropdown button { display: flex; width: 100%; gap: 8px; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; text-align: left; }
.dropdown button:hover { background: var(--paper); }
.content { padding: 24px 28px 48px; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; display: flex; gap: 12px; align-items: center; font-size: 13.5px; }
.banner.warn { background: var(--amber-soft); color: #6D4608; border: 1px solid #EBD3A6; }
.banner.info { background: var(--blue-soft); color: #1F4468; border: 1px solid #C7D7E8; }
.banner .btn { margin-left: auto; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar); z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .content { padding: 18px 16px 40px; }
  .user-btn .who { display: none; }
}

/* -------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--rule-strong); background: var(--surface);
  padding: 7px 13px; border-radius: 5px; cursor: pointer; font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ledger); border-color: var(--ledger); color: #fff; }
.btn-primary:hover { background: var(--ledger-dark); border-color: var(--ledger-dark); }
.btn-danger { color: var(--red); border-color: #E3B7B2; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--paper); border-color: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.icon-btn { border: 0; background: none; padding: 5px; border-radius: 4px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  border: 1px solid var(--rule-strong); border-radius: 5px; padding: 8px 10px; background: var(--surface); width: 100%;
}
.input:focus { outline: none; border-color: var(--ledger); box-shadow: 0 0 0 3px var(--ledger-soft); }
.input[readonly] { background: var(--paper); color: var(--muted); }
textarea.input { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding-top: 22px; }
.check input { width: 16px; height: 16px; accent-color: var(--ledger); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar .input { width: auto; min-width: 150px; padding: 7px 10px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search .input { padding-left: 32px; min-width: 240px; }

/* ----------------------------------------------------------- panels */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--rule); }
.panel-head h3 { font-size: 14.5px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* statement strip (dashboard figures) */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 18px; }
.strip > div { padding: 16px 18px; border-right: 1px solid var(--rule); }
.strip > div:last-child { border-right: 0; }
.strip .label { font-size: 12.5px; color: var(--muted); }
.strip .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.strip .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.strip .value.pos { color: var(--ledger); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--rule-strong);
  background: #F8FAF8; position: sticky; top: 0; white-space: nowrap;
}
.table td { padding: 8px 12px; border-bottom: 1px solid #EBEFEA; vertical-align: middle; }
.table tbody tr:hover td { background: #F7FAF8; }
.table tr.clickable { cursor: pointer; }
.table td.actions { white-space: nowrap; text-align: right; width: 1%; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); background: #FAFBFA; }
.table .code { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---- Chart of Accounts ledger tree (the signature element) ---- */
.coa td { padding-top: 6px; padding-bottom: 6px; }
.coa .acct { display: flex; align-items: center; gap: 8px; }
.coa .rail { display: inline-block; flex: none; align-self: stretch; }
.coa .toggle { width: 20px; height: 20px; border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; flex: none; border-radius: 3px; }
.coa .toggle:hover { background: var(--paper); }
.coa .toggle svg { width: 13px; height: 13px; transition: transform .15s; }
.coa tr.collapsed .toggle svg { transform: rotate(-90deg); }
.coa .toggle.leaf { visibility: hidden; }
.coa tr.l1 td { background: #EEF1EC; font-weight: 800; border-top: 2px solid var(--ink); font-size: 14px; }
.coa tr.l2 td { font-weight: 700; }
.coa tr.l3 td { font-weight: 600; }
.coa tr.l1 td:first-child, .coa tr.l2 td:first-child, .coa tr.l3 td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
.coa tr.l4 td:first-child { box-shadow: inset 3px 0 0 var(--ledger); }
.coa tr.inactive td { color: #9AA6AC; }
.lvl { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.lvl.rollup { background: var(--brass-soft); color: #6E5418; }
.lvl.post { background: var(--ledger-soft); color: var(--ledger-dark); }
.lock { display: inline-flex; color: var(--brass); }
.lock svg { width: 12px; height: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 3px; height: 14px; display: inline-block; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; background: var(--paper); color: var(--muted); border: 1px solid var(--rule); }
.chip.green { background: var(--ledger-soft); color: var(--ledger-dark); border-color: #C5DDCF; }
.chip.red { background: var(--red-soft); color: var(--red); border-color: #EBC4BF; }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: #EBD3A6; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: #C7D7E8; }
.chip.brass { background: var(--brass-soft); color: #6E5418; border-color: #E6D6AE; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* stock gauge */
.gauge { position: relative; height: 8px; background: #EDF0EC; border-radius: 4px; min-width: 110px; overflow: visible; }
.gauge .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ledger); }
.gauge .fill.warn { background: var(--amber); }
.gauge .fill.crit { background: var(--red); }
.gauge .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.gauge .mark.safety { background: var(--red); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ledger); }
.tabs .count { font-size: 11px; background: var(--paper); border-radius: 8px; padding: 0 6px; margin-left: 5px; }

/* alerts list */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: grid; grid-template-columns: 8px 1fr auto; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #EDF0EC; align-items: start; }
.alerts li:last-child { border-bottom: 0; }
.alerts .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.alerts .sev.critical { background: var(--red); }
.alerts .sev.warning { background: var(--amber); }
.alerts .sev.info { background: var(--blue); }
.alerts .t { font-weight: 600; font-size: 13.5px; }
.alerts .d { font-size: 12.5px; color: var(--muted); }

/* bars */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; height: 190px; padding: 10px 4px 0; }
.bars .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; height: 150px; width: 100%; justify-content: center; }
.bars .b { width: 40%; max-width: 24px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .b.rev { background: var(--ledger); }
.bars .b.exp { background: #C8B98E; }
.bars .lab { font-size: 11.5px; color: var(--muted); }

/* statements */
.statement { max-width: 820px; }
.statement table { width: 100%; border-collapse: collapse; }
.statement td { padding: 5px 8px; font-size: 13.5px; }
.statement .sec td { font-weight: 800; font-size: 14px; padding-top: 16px; border-bottom: 1px solid var(--ink); }
.statement .lv2 td { font-weight: 700; }
.statement .lv3 td:first-child { padding-left: 22px; font-weight: 600; }
.statement .lv4 td:first-child { padding-left: 40px; color: var(--ink-2); }
.statement .tot td { font-weight: 800; border-top: 1px solid var(--ink); }
.statement .grand td { font-weight: 800; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); font-size: 14.5px; }
.statement .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.statement .head h2 { font-size: 18px; }
.ok-badge { color: var(--ledger); font-weight: 600; }
.bad-badge { color: var(--red); font-weight: 600; }

/* --------------------------------------------------------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,32,44,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 8px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(20,32,44,.3); display: flex; flex-direction: column; max-height: 90vh; }
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1100px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 8px; background: #FAFBFA; border-radius: 0 0 8px 8px; }
.form-error { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: 5px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid #EBC4BF; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .sec-title { grid-column: 1 / -1; font-weight: 700; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom: 6px; margin: 8px 0 12px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* journal editor */
.je-lines td { padding: 4px 6px; }
.je-lines .input { padding: 6px 8px; }
.je-lines .num .input { text-align: right; font-variant-numeric: tabular-nums; }
.je-total { display: flex; justify-content: flex-end; gap: 24px; padding: 10px 6px; font-variant-numeric: tabular-nums; font-weight: 700; }
.je-total .diff.bad { color: var(--red); }
.je-total .diff.ok { color: var(--ledger); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13.5px; max-width: 420px; animation: toastIn .18s ease-out; }
.toast.error { background: var(--red); }
.toast.success { background: var(--ledger-dark); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.spinner { padding: 40px; text-align: center; color: var(--muted); }
.import-result { margin-top: 12px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

@media print {
  .sidebar, .topbar, .toolbar, .ws-strip, .no-print, .tabs { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .panel { border: 0; }
  body { background: #fff; }
}

.table td.wide { min-width: 250px; }
.coa td:first-child { white-space: nowrap; }
.coa td:nth-child(2) { min-width: 260px; }
.inline { display: inline; }
.table td.nw { white-space: nowrap; }
.table td.flags { min-width: 150px; }
.gauge { max-width: 170px; }

/* ---------------------------------------------------------------- phase 2 */
.prog { display: inline-block; vertical-align: middle; width: 70px; height: 6px; background: #EDF0EC; border-radius: 3px; margin-right: 6px; overflow: hidden; }
.prog > div { height: 100%; background: var(--ledger); }
.doc-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.doc-head h2 { font-size: 20px; }
.doc-head .spacer { flex: 1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
.stack { display: grid; gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.lines td { padding: 5px 6px; vertical-align: top; }
.lines .input { padding: 6px 8px; }
.lines td.num .input { text-align: right; font-variant-numeric: tabular-nums; }
.lines .stockpos { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.lines .stockpos b { color: var(--ink); font-weight: 600; }
.totals { width: 100%; font-variant-numeric: tabular-nums; }
.totals td { padding: 5px 0; }
.totals td:last-child { text-align: right; }
.totals tr.grand td { font-weight: 800; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); font-size: 15px; }
.totals tr.sub td { color: var(--muted); }
.gl-preview { width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.gl-preview td { padding: 3px 6px; border-bottom: 1px dashed var(--rule); }
.gl-preview td.cr { padding-left: 26px; }
.callout { padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.callout.ok { background: var(--ledger-soft); color: var(--ledger-dark); border: 1px solid #C5DDCF; }
.callout.warn { background: var(--amber-soft); color: #6D4608; border: 1px solid #EBD3A6; }
.callout.bad { background: var(--red-soft); color: var(--red); border: 1px solid #EBC4BF; }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.lookup-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.lookup-bar .field { margin: 0; }
.lookup-bar .po-input { font-size: 16px; font-weight: 700; letter-spacing: .02em; width: 200px; }
.var-ok { color: var(--ledger); font-size: 11.5px; }
.var-bad { color: var(--red); font-size: 11.5px; font-weight: 600; }
.recon { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .recon { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 16px; }
.facts > div { padding: 10px 14px; border-right: 1px solid var(--rule); }
.facts > div:last-child { border-right: 0; }
.facts .k { font-size: 12px; color: var(--muted); }
.facts .v { font-weight: 600; margin-top: 2px; }
.flow { display: flex; gap: 0; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.flow a { flex: 1; padding: 11px 14px; text-decoration: none; color: var(--muted); font-size: 13px; border-right: 1px solid var(--rule); position: relative; }
.flow a:last-child { border-right: 0; }
.flow a strong { display: block; color: var(--ink); font-size: 13.5px; }
.flow a.here { background: var(--ledger-soft); }
.flow a.here strong { color: var(--ledger-dark); }
.flow a:hover { background: #F7FAF8; }
