/* Exquisite Finishing — Bookkeeping
   Visual system: warm calm financial.
   - Background: warm paper
   - Mono numerals via Geist Mono
   - Sidebar nav (desktop), top bar (mobile)
   - Accent: settable via --accent (3 curated)
   - Density: comfortable / compact
*/

:root {
  --bg: #F6F3EC;
  --paper: #FBFAF6;
  --surface: #FFFFFF;
  --surface-2: #F2EFE7;
  --border: #E4DFD2;
  --border-strong: #D6CFBE;
  --ink: #1B1915;
  --ink-2: #5A554A;
  --ink-3: #8C8676;
  --ink-4: #B4AE9F;

  --accent: #2E6A4F;          /* default: pine */
  --accent-soft: #E4EFE8;
  --accent-ink: #1F4A38;

  --positive: #2E6A4F;
  --positive-soft: #E4EFE8;
  --negative: #B23A2A;
  --negative-soft: #F7E4DE;
  --warning: #B8772A;
  --warning-soft: #F6E9D2;
  --info: #2C4A7F;
  --info-soft: #E1E7F2;

  --shadow-sm: 0 1px 0 rgba(27,25,21,.04), 0 1px 2px rgba(27,25,21,.04);
  --shadow-md: 0 1px 0 rgba(27,25,21,.04), 0 6px 24px rgba(27,25,21,.06);
  --shadow-pop: 0 12px 40px rgba(27,25,21,.18);

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;

  /* density: comfortable (default) */
  --row-h: 44px;
  --cell-y: 10px;
  --cell-x: 14px;
  --gap-sec: 28px;
  --gap-card: 18px;
}

[data-density="compact"] {
  --row-h: 32px;
  --cell-y: 6px;
  --cell-x: 10px;
  --gap-sec: 20px;
  --gap-card: 12px;
}

[data-accent="pine"]     { --accent:#2E6A4F; --accent-soft:#E4EFE8; --accent-ink:#1F4A38; }
[data-accent="workshop"] { --accent:#B5651D; --accent-soft:#F6E5D0; --accent-ink:#7B4413; }
[data-accent="indigo"]   { --accent:#2C4A7F; --accent-soft:#E1E7F2; --accent-ink:#1B335A; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

.mono { font-family: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace; font-variant-numeric: tabular-nums; }
.num  { font-family: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ───── App shell ───── */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand .logo {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
}
.brand .name { font-weight: 600; font-size: 13.5px; letter-spacing: -.005em; }
.brand .sub  { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: default;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.nav-item .ic { width: 16px; height: 16px; color: var(--ink-3); flex-shrink: 0; }
.nav-item.active .ic { color: var(--accent); }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); display: inline-block; margin-right: 6px; vertical-align: middle; }

.main {
  background: var(--bg);
  padding: 28px 32px 60px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0 0 4px;
}
.page-head .crumbs {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-head .crumbs a { cursor: default; }
.page-head .crumbs a:hover { color: var(--ink); }
.page-head .actions { display: flex; gap: 8px; align-items: center; }

/* ───── Buttons ───── */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn.primary:hover { background: #2a2722; }
.btn.accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ───── Cards ───── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card .card-hd {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card .card-hd h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.card .card-hd .meta { font-size: 11.5px; color: var(--ink-3); }
.card .card-bd { padding: 16px; }
.card.flush .card-bd { padding: 0; }

/* ───── Pills / badges ───── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.muted    { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.pill.paired   { background: var(--positive-soft); color: var(--positive); }
.pill.unpaired { background: var(--negative-soft); color: var(--negative); }
.pill.review   { background: var(--warning-soft); color: var(--warning); }
.pill.info     { background: var(--info-soft); color: var(--info); }
.pill.accent   { background: var(--accent-soft); color: var(--accent-ink); }
.pill.warn     { background: var(--warning-soft); color: var(--warning); }
.pill.neg      { background: var(--negative-soft); color: var(--negative); }

/* ───── Tables ───── */
.table-wrap { overflow-x: auto; }
table.t {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.t th, table.t td {
  padding: var(--cell-y) var(--cell-x);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: var(--row-h);
}
table.t thead th {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: default;
  user-select: none;
}
table.t thead th.sortable:hover { color: var(--ink); }
table.t thead th .sort-ic { opacity: .4; margin-left: 4px; font-size: 9px; }
table.t thead th.sorted .sort-ic { opacity: 1; color: var(--accent); }

table.t tbody tr { cursor: default; }
table.t tbody tr:hover td { background: var(--paper); }
table.t tbody tr.selected td { background: var(--accent-soft); }
table.t tbody tr.zebra td { background: rgba(0,0,0,0.012); }
table.t tbody tr:last-child td { border-bottom: none; }

.right { text-align: right !important; }
.center { text-align: center !important; }
.nowrap { white-space: nowrap; }

.amt { font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.amt.neg { color: var(--negative); }
.amt.pos { color: var(--positive); }
.amt.muted { color: var(--ink-3); }

/* ───── Inputs / selects ───── */
.input, .select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.select { padding-right: 26px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%238C8676' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; }
.input.inline-edit {
  background: transparent;
  border: 1px solid transparent;
  height: 26px;
  padding: 0 6px;
}
.input.inline-edit:hover { border-color: var(--border); background: var(--paper); }
.input.inline-edit:focus { border-color: var(--accent); background: var(--surface); }

/* ───── Filter bar ───── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  align-items: center;
}
.filters .grow { flex: 1; min-width: 180px; }
.filters .label { font-size: 11.5px; color: var(--ink-3); margin-right: 2px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: 9px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 30px; width: 100%; height: 30px; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 2px;
  gap: 1px;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 0 10px;
  height: 24px;
  font-size: 12px;
  color: var(--ink-2);
  border-radius: 3px;
  cursor: default;
}
.seg button.on { background: var(--ink); color: var(--paper); }
.seg button:not(.on):hover { background: var(--surface-2); color: var(--ink); }

/* ───── Layout helpers ───── */
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: var(--gap-card); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-card); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-card); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-card); }
.muted { color: var(--ink-3); }
.tiny  { font-size: 11.5px; }
.small { font-size: 12.5px; }
.big   { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.huge  { font-size: 28px; font-weight: 600; letter-spacing: -.015em; }
.label-up { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
hr.div { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ───── KPI ───── */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi .k-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.kpi .k-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.kpi .k-sub   { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

/* ───── Forecast specific ───── */
.fcst-wrap { display: flex; flex-direction: column; gap: var(--gap-card); }
.fcst-chart {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 8px;
}
.fcst-chart svg { display: block; width: 100%; height: 220px; }
.fcst-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table.fcst {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.fcst th, table.fcst td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.fcst th:first-child, table.fcst td:first-child {
  text-align: left;
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 220px;
  border-right: 1px solid var(--border);
}
table.fcst thead th {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--paper);
}
table.fcst thead th:first-child { background: var(--paper); }
table.fcst tbody tr.section-hd td {
  background: var(--paper);
  color: var(--ink-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 10px;
}
table.fcst tbody tr.section-hd td:first-child { background: var(--paper); }
table.fcst tbody tr.total td {
  font-weight: 600;
  background: var(--surface-2);
}
table.fcst tbody tr.total td:first-child { background: var(--surface-2); }
table.fcst td.col-week.warn { background: var(--warning-soft); color: var(--warning); }
table.fcst td.col-week.crit { background: var(--negative-soft); color: var(--negative); }
table.fcst thead th.col-week { cursor: default; }
table.fcst thead th.col-week.warn { background: var(--warning-soft); color: var(--warning); }
table.fcst thead th.col-week.crit { background: var(--negative-soft); color: var(--negative); }
table.fcst thead th.col-week.active,
table.fcst tbody td.col-week.active { background: var(--accent-soft) !important; color: var(--accent-ink); }
.conf-known { color: var(--ink); }
.conf-est   { color: var(--ink-2); font-style: italic; }
.conf-est::before { content: '~'; opacity: .55; margin-right: 1px; }

/* ───── Faux receipt ───── */
.receipt {
  width: 320px;
  max-width: 100%;
  background: #FBFAEF;
  background-image:
    repeating-linear-gradient(transparent 0 21px, rgba(0,0,0,.025) 21px 22px);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 20px 22px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: #2A271E;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 14px 30px -10px rgba(0,0,0,.18);
  position: relative;
}
.receipt::after, .receipt::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 10px;
  background: radial-gradient(circle at 5px 0, transparent 4.5px, #FBFAEF 5px) repeat-x;
  background-size: 10px 10px;
}
.receipt::before { top: -8px; transform: rotate(180deg); }
.receipt::after { bottom: -8px; }
.receipt .r-vendor { font-size: 14px; font-weight: 700; text-align: center; letter-spacing: .04em; text-transform: uppercase; }
.receipt .r-sub { font-size: 10.5px; text-align: center; color: #6A6555; margin-top: 2px; }
.receipt .r-divider { border-top: 1px dashed #B6AE94; margin: 12px 0; }
.receipt .r-line { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.receipt .r-line.charge { color: #6A6555; font-style: italic; }
.receipt .r-line.total { font-weight: 700; font-size: 12.5px; padding-top: 4px; }
.receipt .r-foot { text-align: center; margin-top: 14px; font-size: 10px; color: #6A6555; letter-spacing: .04em; }
.receipt .r-meta { font-size: 10.5px; color: #6A6555; margin-top: 2px; display: flex; justify-content: space-between; }

.pdf-tile {
  width: 320px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.pdf-tile .pdf-ic {
  width: 36px; height: 44px; border-radius: 3px;
  background: var(--negative-soft); color: var(--negative);
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  border: 1px solid color-mix(in srgb, var(--negative) 25%, transparent);
}

/* ───── Diagnostics two-up ───── */
.diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-card);
}
.diag-list { display: flex; flex-direction: column; }
.diag-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.diag-row:hover { background: var(--paper); }
.diag-row.selected { background: var(--accent-soft); }
.diag-row:last-child { border-bottom: none; }
.diag-row .d-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.diag-row .d-main .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-row .d-main .sub { font-size: 11.5px; color: var(--ink-3); }
.diag-row .d-amt { text-align: right; font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ───── Schedule C ───── */
.sched-cat-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}
.sched-cat-bar > div {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

/* ───── Detail layout ───── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: var(--gap-card);
  align-items: start;
}
.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 12px;
  font-size: 13px;
}
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* ───── Modal / drawer ───── */
.scrim {
  position: fixed; inset: 0;
  background: rgba(20,18,14,.42);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rise .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .m-hd { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal .m-hd h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal .m-bd { padding: 18px; overflow-y: auto; }
.modal .m-ft { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--paper); }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--ink-3);
  cursor: default;
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ───── App-load guard (Phase 4 wiring) ───── */
.app-load {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.app-load .load-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 40px;
  text-align: center;
  max-width: 460px;
}
.app-load .load-card .logo {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  margin: 0 auto 14px;
}
.app-load .load-card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.app-load .load-card p { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.app-load .load-card .err-msg {
  margin-top: 10px;
  font-size: 12px;
  color: var(--negative);
  background: var(--negative-soft);
  border: 1px solid color-mix(in srgb, var(--negative) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  word-break: break-word;
}
.app-load .spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.app-load .btn { margin-top: 14px; }

/* ───── Editable transaction note (Phase 4 wiring) ───── */
.note-edit {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}
.note-edit:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.note-edit-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* ───── Manual-entry form (Phase 4 wiring) ───── */
.manual-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.manual-form .field { display: flex; flex-direction: column; gap: 4px; }
.manual-form .field label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
}
.manual-form .field .input,
.manual-form .field .select { height: 34px; }
.manual-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.manual-form .form-err {
  font-size: 12px;
  color: var(--negative);
  background: var(--negative-soft);
  border: 1px solid color-mix(in srgb, var(--negative) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

/* ───── Mobile reflow ───── */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    overflow-x: auto;
  }
  .sidebar .brand { border-bottom: 0; padding: 0 6px 0 0; margin: 0; border-right: 1px solid var(--border); }
  .nav { flex-direction: row; }
  .nav-item { padding: 6px 10px; }
  .nav-item .count { display: none; }
  .sidebar-foot { display: none; }
  .main { padding: 18px 16px 60px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .diag-grid { grid-template-columns: 1fr; }
  .manual-form .field-row { grid-template-columns: 1fr; }
}
