/* ==========================================================================
   LedgerPro – interface styles
   Palette: ink navy, ledger green, cool paper. Figures use tabular numerals.
   Totals use the accounting double rule. Edit the tokens below to rebrand.
   ========================================================================== */
:root {
  --ink: #14213d;
  --ink-2: #2b3a58;
  --ink-soft: #5b6782;
  --paper: #f5f7f6;
  --sheet: #ffffff;
  --rule: #dce3e0;
  --rule-strong: #b9c6c1;
  --green: #1f6f5c;
  --green-dark: #17594a;
  --green-tint: #e5f1ed;
  --red: #b0413e;
  --red-tint: #f8e9e8;
  --amber: #a86d0e;
  --amber-tint: #fbf1de;
  --blue: #2c5d9c;
  --blue-tint: #e6eef8;
  --focus: #2c8a73;
  --radius: 6px;
  --radius-sm: 4px;
  --sidebar: 236px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper);
  line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.55rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #cfd6e4; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .9rem; color: #fff; font-weight: 600; font-size: 1.05rem; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 5px; background: var(--green); display: grid; place-items: center;
  color: #fff; font-size: .8rem; font-weight: 700; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.nav { padding: .25rem .5rem 1.5rem; }
.nav-group { margin-top: .9rem; }
.nav-group > span { display: block; padding: 0 .6rem .3rem; font-size: .78rem; color: #8b97b0; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: .55rem; padding: .38rem .6rem; border-radius: var(--radius-sm);
  color: #d7deea; font-size: .93rem;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(31,111,92,.35); color: #fff; box-shadow: inset 3px 0 0 #4fb397; }
.nav kbd { margin-left: auto; font-size: .7rem; opacity: .55; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; background: var(--sheet);
  border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 30;
}
.menu-toggle { display: none; }
.company-switch { position: relative; }
.company-btn {
  display: flex; align-items: center; gap: .5rem; border: 1px solid var(--rule); background: var(--paper);
  padding: .35rem .7rem; border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--ink); max-width: 340px;
}
.company-btn strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-btn .code { font-size: .75rem; color: var(--ink-soft); }
.dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 300px; background: var(--sheet); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20,33,61,.14); padding: .35rem; z-index: 50;
}
.dropdown.right { left: auto; right: 0; min-width: 220px; }
.dropdown button, .dropdown a {
  display: flex; width: 100%; text-align: left; gap: .5rem; align-items: center; justify-content: space-between;
  background: none; border: 0; padding: .5rem .6rem; border-radius: var(--radius-sm); font: inherit; color: var(--ink); cursor: pointer;
}
.dropdown button:hover, .dropdown a:hover { background: var(--paper); text-decoration: none; }
.dropdown .current { background: var(--green-tint); }
.dropdown hr { border: 0; border-top: 1px solid var(--rule); margin: .3rem 0; }
.search { flex: 1; max-width: 460px; position: relative; }
.search input[type=search] { width: 100%; padding-left: 2rem; background: var(--paper); }
.search::before { content: "⌕"; position: absolute; left: .65rem; top: 50%; transform: translateY(-52%); color: var(--ink-soft); font-size: 1.1rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; position: relative; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ink-2); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: .85rem; border: 0; cursor: pointer;
}
.content { padding: 1.25rem 1.5rem 3rem; max-width: 1480px; width: 100%; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head p { margin: .2rem 0 0; color: var(--ink-soft); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .85rem; color: var(--ink-soft); margin-bottom: .25rem; }
.breadcrumb a { color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .48rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--paper); text-decoration: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { color: var(--red); border-color: #e2bcbb; }
.btn-danger:hover { background: var(--red-tint); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .28rem .6rem; font-size: .88rem; }
.btn kbd { font-size: .7rem; opacity: .7; font-family: var(--mono); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green); cursor: pointer; font: inherit; }

/* ---------- panels ---------- */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); gap: .75rem; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-body { padding: 1rem; }
.panel-body.flush { padding: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-size: .86rem; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: .8rem; }
.field.check label { display: flex; align-items: center; gap: .45rem; font-weight: 400; color: var(--ink); padding-top: 1.55rem; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: .45rem .6rem; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(44,138,115,.18); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[readonly] { background: var(--paper); }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding: .9rem 1rem; border-top: 1px solid var(--rule); background: #fafbfb; border-radius: 0 0 var(--radius) var(--radius); align-items: center; flex-wrap: wrap; }
.form-actions .hint { margin-right: auto; font-size: .82rem; color: var(--ink-soft); }
fieldset { border: 0; padding: 0; margin: 0; }

/* lookup / combobox */
.lookup { position: relative; }
.lookup-menu {
  position: absolute; left: 0; top: calc(100% + 2px); z-index: 60; background: var(--sheet); border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm); box-shadow: 0 10px 24px rgba(20,33,61,.15); max-height: 290px; overflow-y: auto; min-width: 100%; width: max-content; max-width: 480px;
}
.lookup-menu div { padding: .42rem .6rem; cursor: pointer; display: flex; gap: .6rem; justify-content: space-between; }
.lookup-menu div small { color: var(--ink-soft); }
.lookup-menu div.active, .lookup-menu div:hover { background: var(--green-tint); }
.lookup-menu .empty { color: var(--ink-soft); cursor: default; }
.lookup-text.invalid { border-color: var(--red); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.table th, .table td { padding: .5rem .7rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.table thead th { font-size: .82rem; font-weight: 600; color: var(--ink-soft); background: #fafbfb; position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover { background: #f8fbfa; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.table.compact th, .table.compact td { padding: .32rem .55rem; }
.table tr.clickable { cursor: pointer; }
.table td.actions-cell { text-align: right; white-space: nowrap; }
.table .sub td { color: var(--ink-soft); font-size: .9rem; }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--ink-soft); }
.empty-state p { margin-bottom: 1rem; }

.table th.num, .sheet thead th.num, .print-table th.num, .fs th.amt { text-align: right; }

/* status pills */
.pill { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid transparent; }
.pill-draft { background: var(--amber-tint); color: var(--amber); border-color: #efd9ad; }
.pill-approved { background: var(--blue-tint); color: var(--blue); border-color: #c7d8ef; }
.pill-posted, .pill-completed, .pill-active, .pill-open { background: var(--green-tint); color: var(--green); border-color: #c4e0d7; }
.pill-void, .pill-reversed, .pill-disposed, .pill-closed, .pill-inactive { background: #eef0f3; color: #6b7385; border-color: #dfe2e8; }
.pill-overdue { background: var(--red-tint); color: var(--red); border-color: #ebc9c8; }
.pill-in_progress { background: var(--blue-tint); color: var(--blue); }
.pill-fully_depreciated { background: #eef0f3; color: var(--ink-2); }

/* filters */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); }
.filters .field { min-width: 140px; }
.filters .field.grow { flex: 1; min-width: 200px; }

/* ---------- flash ---------- */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; display: flex; justify-content: space-between; gap: 1rem; }
.flash-success { background: var(--green-tint); border-color: #bcdcd1; color: #154f41; }
.flash-error { background: var(--red-tint); border-color: #e6c3c2; color: #7d2a28; }
.flash-warning { background: var(--amber-tint); border-color: #ecd6a6; color: #6f4806; }
.flash-info { background: var(--blue-tint); border-color: #c8d8ee; color: #1f4473; }
.flash button { background: none; border: 0; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi span { font-size: .85rem; color: var(--ink-soft); }
.kpi strong { display: block; font-size: 1.45rem; font-variant-numeric: tabular-nums; margin-top: .2rem; font-weight: 600; }
.kpi small { display: block; margin-top: .15rem; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.quick a {
  display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink);
}
.quick a:hover { border-color: var(--green); text-decoration: none; background: #fbfdfc; }
.quick a small { color: var(--ink-soft); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .bar div { display: flex; gap: 2px; align-items: flex-end; height: calc(100% - 20px); width: 100%; justify-content: center; }
.bars .bar i { display: block; width: 42%; border-radius: 2px 2px 0 0; min-height: 1px; }
.bars .bar i.in { background: var(--green); }
.bars .bar i.out { background: #c9a35a; }
.bars .bar span { font-size: .72rem; color: var(--ink-soft); }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* ---------- document entry: the ledger sheet ---------- */
.doc-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem 1rem; padding: 1rem; }
.sheet { width: 100%; border-collapse: collapse; }
.sheet thead th {
  font-size: .8rem; color: var(--ink-soft); font-weight: 600; text-align: left; padding: .45rem .4rem;
  border-top: 1px solid var(--rule); border-bottom: 2px solid var(--ink); background: #fafbfb;
}
.sheet td { padding: .2rem .3rem; border-bottom: 1px solid #e7edea; vertical-align: middle; }
.sheet tbody tr:nth-child(even) td { background: #fbfcfc; }
.sheet tbody tr:focus-within td { background: #f1f8f5; }
.sheet input, .sheet select { border-color: transparent; background: transparent; padding: .38rem .4rem; }
.sheet input:hover, .sheet select:hover { border-color: var(--rule); }
.sheet input:focus, .sheet select:focus { background: #fff; border-color: var(--focus); }
.sheet .ln { width: 34px; text-align: center; color: var(--ink-soft); font-size: .8rem; }
.sheet .amount { width: 130px; }
.sheet .qty { width: 90px; }
.sheet .pct { width: 70px; }
.sheet .tax { width: 150px; }
.sheet .del { width: 34px; text-align: center; }
.sheet .del button { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 1.1rem; border-radius: 4px; width: 26px; height: 26px; }
.sheet .del button:hover { background: var(--red-tint); color: var(--red); }
.sheet td.calc { text-align: right; font-variant-numeric: tabular-nums; padding-right: .7rem; color: var(--ink-2); }
.sheet-foot { display: flex; justify-content: space-between; gap: 1.5rem; padding: .8rem 1rem; align-items: flex-start; flex-wrap: wrap; }
.totals { min-width: 300px; }
.totals div { display: flex; justify-content: space-between; gap: 2rem; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.totals div.grand { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); padding: .35rem 0; margin-top: .2rem; }
.totals .diff { color: var(--red); }
.totals .ok { color: var(--green); }
.add-line { display: flex; gap: .5rem; align-items: center; }
.keys { font-size: .8rem; color: var(--ink-soft); }
kbd { font-family: var(--mono); font-size: .75rem; background: var(--paper); border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px; padding: 0 .3rem; }

/* document view */
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem 1.2rem; padding: 1rem; }
.doc-meta div span { display: block; font-size: .8rem; color: var(--ink-soft); }
.doc-meta div strong { font-weight: 500; }
.journal-box { font-size: .9rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--rule); padding: 0 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .8rem; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--green); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- reports ---------- */
.report-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.report-list section h3 { font-size: .95rem; margin-bottom: .5rem; }
.report-list a { display: block; padding: .32rem 0; }
.report { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.6rem 2rem 2rem; }
.report-title { text-align: center; margin-bottom: 1.4rem; }
.report-title h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.report-title h1 { font-size: 1.35rem; margin: .2rem 0; }
.report-title p { margin: 0; color: var(--ink-soft); }
.fs { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fs td, .fs th { padding: .3rem .5rem; }
.fs th { font-size: .82rem; color: var(--ink-soft); font-weight: 600; text-align: right; border-bottom: 1px solid var(--ink); }
.fs th:first-child { text-align: left; }
.fs .note { width: 60px; text-align: center; color: var(--ink-soft); }
.fs td.amt { text-align: right; width: 160px; white-space: nowrap; }
.fs tr.section td { font-weight: 700; padding-top: 1rem; }
.fs tr.group td { font-weight: 600; padding-top: .55rem; }
.fs tr.line td:first-child { padding-left: 1.4rem; }
.fs tr.line.deep td:first-child { padding-left: 2.6rem; color: var(--ink-2); }
.fs tr.subtotal td.amt { border-top: 1px solid var(--ink); font-weight: 600; }
.fs tr.total td { font-weight: 700; }
.fs tr.total td.amt { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.fs tr.spacer td { height: .6rem; }
.fs tr.check td { color: var(--ink-soft); font-size: .85rem; }
.report-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-bottom: .75rem; flex-wrap: wrap; }
.report-filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.report-filters .field { min-width: 150px; }
.signatures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-top: 3rem; }
.signatures div { border-top: 1px solid var(--ink); padding-top: .3rem; font-size: .85rem; color: var(--ink-soft); }
.balance-ok { color: var(--green); font-weight: 600; }
.balance-bad { color: var(--red); font-weight: 600; }

/* accounting cycle */
.cycle { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; counter-reset: step; }
.cycle a { position: relative; display: block; padding: .9rem 1rem .9rem 3rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink); }
.cycle a::before {
  counter-increment: step; content: counter(step); position: absolute; left: .9rem; top: .9rem; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: var(--green-tint); color: var(--green); display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.cycle a:hover { border-color: var(--green); text-decoration: none; }
.cycle strong { display: block; }
.cycle small { display: block; margin-top: .15rem; }
.cycle .state { margin-top: .4rem; font-size: .8rem; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(380px, 460px); }
.auth-side {
  background: var(--ink); color: #dfe6f1; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(255,255,255,.05) 31px 32px);
}
.auth-side h1 { color: #fff; font-size: 2rem; max-width: 18ch; font-weight: 600; }
.auth-side p { max-width: 46ch; color: #b5c0d4; }
.auth-side ul { padding-left: 1.1rem; color: #b5c0d4; }
.auth-form { background: var(--sheet); padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.auth-form .field { margin-bottom: .2rem; }
.auth-form .btn { justify-content: center; padding: .65rem; }
.qr { width: 200px; height: 200px; border: 1px solid var(--rule); padding: 8px; background: #fff; }
.secret { font-family: var(--mono); background: var(--paper); padding: .4rem .6rem; border-radius: var(--radius-sm); letter-spacing: .08em; word-break: break-all; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,33,61,.45); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: var(--sheet); border-radius: var(--radius); width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .panel-body { max-height: 70vh; overflow-y: auto; }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; }

/* ---------- print ---------- */
.print-page { max-width: 820px; margin: 0 auto; background: #fff; padding: 2rem 2.2rem; }
.print-toolbar { display: flex; justify-content: center; gap: .5rem; padding: .75rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
.letterhead { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .9rem; margin-bottom: 1.1rem; }
.letterhead img { max-height: 70px; max-width: 200px; }
.letterhead .co h2 { margin: 0 0 .2rem; font-size: 1.25rem; }
.letterhead .co div, .letterhead .doc div { font-size: .85rem; color: var(--ink-2); }
.letterhead .doc { text-align: right; }
.letterhead .doc h1 { font-size: 1.5rem; margin: 0 0 .3rem; letter-spacing: .02em; }
.to-box { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; font-size: .9rem; }
.to-box h4 { font-size: .8rem; color: var(--ink-soft); margin-bottom: .2rem; font-weight: 600; }
.print-table th { background: var(--ink); color: #fff; font-weight: 600; font-size: .82rem; padding: .4rem .5rem; text-align: left; }
.print-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--rule); font-size: .9rem; }
.words { margin-top: .75rem; padding: .5rem .7rem; background: var(--paper); border-left: 3px solid var(--green); font-size: .88rem; }
.stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); padding: .2rem .8rem; font-weight: 700; transform: rotate(-4deg); }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .print-toolbar, .report-actions, .report-filters, .actions, .flash { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .report, .panel { border: 0; padding: 0; }
  .print-page { padding: 0; max-width: none; }
  .print-table th { background: #e9edf2 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
  .table thead th { position: static; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .doc-head, .doc-meta, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .grid-2, .grid-3, .grid-4, .report-list, .kpis { grid-template-columns: 1fr; }
  .doc-head, .doc-meta, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  .search { display: none; }
  .report { padding: 1rem; }
  .signatures { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
