/* Saabsoft ERP — design system.
   One stylesheet, no preprocessor, no build step (ADR-009).
   Dense by intent: finance users compare rows, they do not scroll through cards. */

:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #fbfcfd;
  --border:    #e2e6ec;
  --border-2:  #cfd6e0;
  --text:      #12161d;
  --text-2:    #5b6472;
  --text-3:    #8b95a4;
  --accent:    #1d5fd0;
  --accent-2:  #e8f0fe;
  --accent-fg: #ffffff;
  --danger:    #b3261e;
  --danger-2:  #fdeceb;
  --ok:        #1a7f4b;
  --ok-2:      #e7f5ed;
  --warn:      #8a5a00;
  --warn-2:    #fdf3e0;
  --shadow:    0 1px 2px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.06);
  --radius:    7px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 236px;
  --header-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #161b22; --surface-2: #1b2129;
    --border: #262d38; --border-2: #333c49;
    --text: #e6edf3; --text-2: #9aa5b1; --text-3: #6e7a89;
    --accent: #4d8bf0; --accent-2: #17233a; --accent-fg: #0b1220;
    --danger: #ff7b72; --danger-2: #2a1614;
    --ok: #48c98a; --ok-2: #10241a;
    --warn: #e3b341; --warn-2: #241d0f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #161b22; --surface-2: #1b2129;
  --border: #262d38; --border-2: #333c49;
  --text: #e6edf3; --text-2: #9aa5b1; --text-3: #6e7a89;
  --accent: #4d8bf0; --accent-2: #17233a; --accent-fg: #0b1220;
  --danger: #ff7b72; --danger-2: #2a1614;
  --ok: #48c98a; --ok-2: #10241a;
  --warn: #e3b341; --warn-2: #241d0f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
/* `hidden` is how a screen says "this field does not apply". Any class that
   sets display (label.field is display:block) outranks the browser's own
   [hidden] rule, so conditional fields showed anyway - and their values were
   posted. The attribute has to win over every class. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
/* An inline SVG with only a viewBox fills its container. Size every icon once,
   here, rather than discovering a 300px lock in the sidebar. */
.ico { width: 15px; height: 15px; flex: none; display: inline-block; vertical-align: -2px; }
a:hover { text-decoration: underline; }
h1,h2,h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 19px; } h2 { font-size: 15px; } h3 { font-size: 13px; }

/* ── numbers ──────────────────────────────────────────────────────────── */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .94em; }
.neg { color: var(--danger); }

/* ── layout ───────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  height: var(--header-h); display: flex; align-items: center; gap: 9px;
  padding: 0 14px; border-bottom: 1px solid var(--border); flex: none;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7aa5ee);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px;
}
.brand-name { font-weight: 650; letter-spacing: -.015em; }
.brand-name span { color: var(--text-3); font-weight: 500; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav-section { margin-top: 12px; }
.nav-section:first-child { margin-top: 2px; }
.nav-title {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 6px 8px 4px;
}
.nav a, .nav .nav-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px;
  color: var(--text-2); font-weight: 500; cursor: pointer; line-height: 1.35;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
/* The shell scrolls the current item into view; keep a row of context above
   and below it rather than pinning it to the edge. */
.nav a { scroll-margin-block: 36px; }
.nav .planned { color: var(--text-3); cursor: default; opacity: .75; }
.nav .planned:hover { background: none; color: var(--text-3); }
.nav .planned::after {
  content: "soon"; margin-left: auto; font-size: 9.5px; letter-spacing: .04em;
  color: var(--text-3); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px;
}
.nav .ico { opacity: .8; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 8px; flex: none; }
/* Master admin and Sign out live outside .nav, so they had no padding, no gap
   between icon and text and no hover: two cramped lines under the menu. */
.sidebar-foot .nav-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px;
  color: var(--text-2); font-weight: 500; cursor: pointer; line-height: 1.35;
}
.sidebar-foot .nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.main { display: flex; flex-direction: column; min-width: 0; }
.header {
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 20;
}
.header .spacer { flex: 1; }
/* Only phones have a drawer to open; see the 860px block below. */
#menu-btn { display: none; }
.content { padding: 18px; min-width: 0; }
/* Screens stack their blocks (tiles, cards, banners) with no margin of their
   own, so on 88 of 151 screens consecutive cards touched. A screen's root is
   a plain div, and so is the box it repaints; one rule gives both the same
   rhythm. Anything with a class (a grid, a row, a card) spaces its own
   children, so only unclassed wrappers are touched (h() writes class=""
   for an empty class, hence the second form). The page head's own
   bottom margin collapses with this one. */
.content > div:is(:not([class]), [class=""]) > * + *,
.content > div:is(:not([class]), [class=""]) > div:is(:not([class]), [class=""]) > * + * { margin-top: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head .spacer { flex: 1; }
.subtle { color: var(--text-2); font-size: 12.5px; }

/* ── controls ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--border-2); }
.btn-danger:hover { background: var(--danger-2); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 25px; padding: 0 8px; font-size: 12px; }

.input, .select, textarea.input {
  height: 30px; padding: 0 9px; border: 1px solid var(--border-2); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; width: 100%;
}
textarea.input { height: auto; padding: 7px 9px; resize: vertical; }
.input:focus, .select:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.input::placeholder { color: var(--text-3); }
label.field, div.field { display: block; margin-bottom: 11px; }
/* In a page head a field is a filter beside the buttons, not one of a stack:
   its bottom margin only pushed the head taller and the input below the
   buttons' line. */
.page-head .field { margin-bottom: 0; }
/* A field that holds a combobox or a date picker cannot be a <label> (a label
   forwards clicks to its first control), so screens wrap those in a div with a
   <label> inside. Both spellings get the same caption. `.lbl` is the caption
   on its own, used in modals that lay out their controls by hand. */
label.field > span, div.field > label, .lbl {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px;
}
.lbl:not(:first-child) { margin-top: 10px; }
/* Help under a control, or under a figure. */
.note { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.45; }
.field-error { color: var(--danger); font-size: 11.5px; margin-top: 3px; }

/* ── card, table ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.card-head .spacer { flex: 1; }
.card-body { padding: 14px; }
/* The footnote under a card: what the figures mean and where they come from.
   It was used on 37 screens and never defined, so the text sat flush against
   the card's edge. */
.card-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2);
}
/* A group of buttons: at the end of a table row, or in a page head (the
   impairment screen). In a page head the group must wrap, or on a phone the
   last button sits off the page and the whole screen scrolls sideways. In a
   table cell it stays on one line: the table scrolls inside its .tbl-wrap. */
.row-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
td > .row-actions { flex-wrap: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; }

.tbl-wrap { overflow-x: auto; }
/* `table.table` is the same table under an older name (fx rates). */
table.tbl, table.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.tbl th, table.tbl td,
table.table th, table.table td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--border); }
/* The rule above (0,1,2) outranked a bare .num (0,1,0), so every figure in
   every table was left-aligned and totals did not line up with their column.
   A numeric header is right-aligned too, but in the header face, not mono.
   Figures, codes and dates never wrap: "1,040,000.00" broken over two lines
   reads as two numbers. */
table.tbl th.num, table.tbl td.num,
table.table th.num, table.table td.num,
table.tbl td.right, table.table td.right { text-align: right; }
table.tbl th.num, table.table th.num { font-family: inherit; }
table.tbl td.num, table.tbl td.mono, table.tbl td.date, table.tbl td.nowrap,
table.table td.num, table.table td.mono, table.table td.date { white-space: nowrap; }
table.tbl thead th, table.table thead th {
  background: var(--surface-2); font-size: 11px; font-weight: 650; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tbl thead th.sortable { cursor: pointer; user-select: none; }
table.tbl thead th.sortable:hover { color: var(--text); }
table.tbl thead th .arrow { opacity: .45; margin-left: 3px; font-size: 9px; }
table.tbl thead th.sorted .arrow { opacity: 1; color: var(--accent); }
table.tbl tbody tr:hover, table.table tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr:last-child td, table.table tbody tr:last-child td { border-bottom: none; }
table.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--border-2); }
.tbl-foot {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2);
}
.tbl-foot .spacer { flex: 1; }
.tbl-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl-toolbar .search { flex: 1; max-width: 320px; }
.tbl-toolbar .spacer { flex: 1; }

.empty { padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty h3 { margin-bottom: 5px; }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 4px; height: 11px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge-ok     { background: var(--ok-2);     color: var(--ok);     border-color: transparent; }
.badge-warn   { background: var(--warn-2);   color: var(--warn);   border-color: transparent; }
/* `badge-bad` is what 12 screens call the danger badge; it rendered grey. */
.badge-danger, .badge-bad { background: var(--danger-2); color: var(--danger); border-color: transparent; }
.badge-accent { background: var(--accent-2); color: var(--accent); border-color: transparent; }

/* ── combobox ─────────────────────────────────────────────────────────── */
.combo { position: relative; }
.combo-menu {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 3px);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 7px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; padding: 4px;
}
.combo-opt { padding: 6px 9px; border-radius: 5px; cursor: pointer; }
.combo-opt small { display: block; color: var(--text-3); font-size: 11px; }
.combo-opt.on { background: var(--accent-2); }
.combo-empty { padding: 10px; color: var(--text-3); text-align: center; font-size: 12px; }

/* ── command palette ──────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(11,16,24,.42); z-index: 100;
  display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh;
  backdrop-filter: blur(2px);
}
.palette {
  width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 11px; box-shadow: 0 18px 50px rgba(0,0,0,.28); overflow: hidden;
}
.palette input {
  width: 100%; border: none; border-bottom: 1px solid var(--border); background: transparent;
  color: var(--text); font: inherit; font-size: 15px; padding: 13px 15px; outline: none;
}
.palette-list { max-height: 340px; overflow-y: auto; padding: 5px; }
.palette-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.palette-item.on { background: var(--accent-2); }
.palette-item .where { margin-left: auto; font-size: 11px; color: var(--text-3); }
.palette-hint { padding: 7px 13px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); display: flex; gap: 12px; }
kbd {
  font: 11px var(--mono); background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--text-2);
}

/* ── modal ────────────────────────────────────────────────────────────── */
.modal {
  width: min(560px, 94vw); background: var(--surface); border-radius: 11px;
  border: 1px solid var(--border-2); box-shadow: 0 18px 50px rgba(0,0,0,.28); overflow: hidden;
}
.modal-head { padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 650; }
.modal-body { padding: 16px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── toasts ───────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border-2); border-left: 3px solid var(--accent);
  border-radius: 7px; box-shadow: var(--shadow); padding: 10px 13px; max-width: 380px;
  animation: rise .16s ease-out;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok  { border-left-color: var(--ok); }
.toast b { display: block; margin-bottom: 2px; }
.toast span { color: var(--text-2); font-size: 12.3px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ── login ────────────────────────────────────────────────────────────── */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(370px, 100%); }
.login-card .card-body { padding: 22px; }
.login-brand { display: flex; align-items: center; gap: 9px; justify-content: center; margin-bottom: 18px; }

/* ── misc ─────────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; align-items: baseline; }
.kv dt { color: var(--text-2); font-size: 12px; }
.kv dd { margin: 0; font-weight: 550; }
.stat { padding: 13px 15px; }
.stat .label { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 23px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
/* Headline figures. Twelve screens built them as .tiles/.tile and nothing
   defined either, so the figures ran down the page as loose lines of text.
   A tile is a stat card; the row wraps as the screen narrows.
   The narrowest tile must hold a 17-character figure (-1,161,186,675.74)
   in full: a developer's cash balance runs to nine or ten digits, and a
   clipped "1,161,186,67…" reads as a different amount. 220px leaves about
   188px of text at 18px mono; a figure longer still wraps rather than clip. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 15px; min-width: 0;
}
.tile-label { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .tile-value {
  font-size: 18px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tile-hint { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.banner {
  padding: 9px 13px; border-radius: 7px; font-size: 12.5px; display: flex; gap: 8px; align-items: center;
  background: var(--warn-2); color: var(--warn); border: 1px solid transparent; margin-bottom: 13px;
}
.banner.err { background: var(--danger-2); color: var(--danger); }
/* A banner's DEFAULT is the warning colour, so `banner warn` was already
   right by accident and `banner ok` was a warning: a screen saying everything
   reconciles rendered in amber, which reads as a problem. Both are named now
   so neither depends on the default. */
.banner.warn { background: var(--warn-2);   color: var(--warn); }
.banner.ok   { background: var(--ok-2);     color: var(--ok); }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
pre.code {
  margin: 0; padding: 12px 14px; font: 12px/1.5 var(--mono); overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
}

/* ── phone ────────────────────────────────────────────────────────────────
   Under 860px the sidebar is a drawer. The menu button that opens it was
   hidden by an inline style nothing overrode, so a phone had no navigation
   at all. The scrim behind the open drawer closes it on a tap. */
.nav-scrim { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%);
    transition: transform .18s; width: min(var(--sidebar-w), 86vw);
  }
  .sidebar.open { transform: none; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
  .sidebar.open + .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 85; background: rgba(11,16,24,.42);
  }
  #menu-btn { display: inline-flex; }
  .header { padding: 0 10px; gap: 6px; }
  .header .who { display: none; }
  .content { padding: 13px; }
  /* On a desktop the page head keeps one line (the title block takes the
     room it needs and the actions sit to its right); wrapping it there
     pushed filters and the primary button onto rows of their own. On a
     phone that line is wider than the screen, so the head wraps. */
  .page-head { flex-wrap: wrap; }
  /* The fx-rates table is the old `table.table`, mounted straight in the
     page with no .tbl-wrap around it, so on a phone its wide rows pushed
     the whole page sideways. Here it scrolls inside itself instead. */
  .content table.table { display: block; overflow-x: auto; }
}

/* ── date picker ──────────────────────────────────────────────────────────
   A ledger date is not a birthday: what decides whether it is valid is the
   accounting period, so the grid shows period status directly. */
.dp { position: relative; display: flex; align-items: center; gap: 4px; }
.dp .input { padding-right: 4px; }
.dp-btn {
  height: 30px; width: 30px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface);
  color: var(--text-2); cursor: pointer;
}
.dp-btn:hover { background: var(--surface-2); color: var(--text); }
.dp-status { margin-left: 2px; }

.dp-pop {
  position: absolute; z-index: 70; top: calc(100% + 5px); left: 0;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px;
  box-shadow: var(--shadow); overflow: hidden;
}
.dp-body { display: flex; }
.dp-presets {
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  border-right: 1px solid var(--border); background: var(--surface-2); min-width: 132px;
}
.dp-preset {
  text-align: left; padding: 5px 8px; border: none; background: none; border-radius: 5px;
  color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.dp-preset:hover { background: var(--accent-2); color: var(--accent); }

.dp-cal { padding: 8px; }
.dp-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.dp-title { flex: 1; text-align: center; font-weight: 650; font-size: 12.5px; }
.dp-nav {
  border: none; background: none; color: var(--text-2); cursor: pointer;
  padding: 3px 6px; border-radius: 5px; font: inherit; line-height: 1;
}
.dp-nav:hover { background: var(--surface-2); color: var(--text); }

.dp-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.dp-dow span {
  text-align: center; font-size: 10px; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; padding: 3px 0;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.dp-day {
  height: 28px; width: 30px; border: none; background: none; border-radius: 5px;
  color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dp-day:hover:not(:disabled) { background: var(--surface-2); }
.dp-day.out { color: var(--text-3); }
.dp-day.weekend:not(.sel) { color: var(--text-3); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.dp-day.closed:not(.sel) { background: var(--danger-2); color: var(--danger); }
.dp-day.sel { background: var(--accent); color: #fff; font-weight: 650; }
.dp-day:disabled { opacity: .35; cursor: not-allowed; }

.dp-legend {
  display: flex; gap: 12px; margin-top: 7px; padding-top: 6px;
  border-top: 1px solid var(--border); font-size: 10.5px; color: var(--text-3);
}
.dp-legend span { display: flex; align-items: center; gap: 4px; }
.dp-swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.dp-swatch.closed { background: var(--danger-2); border: 1px solid var(--danger); }
.dp-swatch.today  { box-shadow: inset 0 0 0 1px var(--accent); }

.dp-range { display: flex; flex-direction: column; gap: 7px; }
.dp-quick { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── contracting: the certificate is arithmetic, so it is laid out as one ── */
table.tbl.tbl-calc td:first-child { color: var(--text-2); }
table.tbl.tbl-calc tr.row-total td { border-top: 2px solid var(--border-2); font-size: 14px; }
table.tbl tr.row-bad { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.input.bad { border-color: var(--danger); }
.row-inline { display: flex; gap: 6px; align-items: center; }
.row-inline .input { flex: 1; }
label.field.check { display: flex; align-items: center; gap: 7px; margin-top: 22px; }
label.field.check > span { margin: 0; }
/* Certified against revised contract value - the number a QS looks for first. */
.meter { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); transition: width .25s ease; }

/* ── the manual journal: analysis is asked for per line, per account ────── */
table.tbl.tbl-entry td { vertical-align: top; }
.dim-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dim-row label.field.dim { margin-bottom: 0; min-width: 150px; flex: 1; }

/* ── attachments: the evidence behind a document ────────────────────────── */
.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px; padding: 18px; border: 1px dashed var(--border-2);
  border-radius: 6px; color: var(--text-2); font-size: 12.5px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--surface-2); }

/* ── print ────────────────────────────────────────────────────────────────
   A statement or a certificate is printed to be signed. Print the page, not
   the application around it, and always on white whatever the theme. */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --surface-2: #f6f7f9;
    --border: #d5dae1; --border-2: #b9c1cc;
    --text: #000; --text-2: #3d4450; --text-3: #6b7482;
    --accent: #1d5fd0; --accent-2: #e8f0fe;
    --danger: #b3261e; --danger-2: #fdeceb; --ok: #1a7f4b; --ok-2: #e7f5ed;
    --warn: #8a5a00; --warn-2: #fdf3e0; --shadow: none;
  }
  .sidebar, .header, .nav-scrim, .btn, .toasts, .dropzone { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; }
  .tbl-wrap { overflow: visible; }
  table.tbl thead th { position: static; }
  table.tbl tr { break-inside: avoid; }
}
