/* Deleon Ops — mobile-first UI, light/dark. No external fonts or libraries. */
:root {
  --bg: #f5f4f0; --surface: #ffffff; --surface-2: #f0eee8; --ink: #18212b; --muted: #5a6470; --line: #dedad1;
  --brand: #16324f; --brand-2: #234c75; --brand-ink: #ffffff; --accent: #b7410e; --focus: #2563eb;
  --go: #15803d; --go-ink: #ffffff; --stop: #b42318; --stop-ink: #ffffff; --warn: #a15c07; --warn-bg: #fff4e0;
  --ok-bg: #e7f6ec; --bad: #b42318; --bad-bg: #fdecea; --info-bg: #e8f0fb;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 2px 8px rgba(20, 24, 31, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --nav-w: 232px; --top-h: 56px; --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1319; --surface: #161d25; --surface-2: #1d2630; --ink: #e7ebef; --muted: #9ba6b2; --line: #2b3541;
    --brand: #8fbbe6; --brand-2: #a9cbee; --brand-ink: #0e1319; --accent: #f08a4b; --focus: #7aa7ff;
    --go: #22a356; --go-ink: #04130a; --stop: #e5484d; --stop-ink: #ffffff; --warn: #f0b04a; --warn-bg: #2d2412;
    --ok-bg: #12291b; --bad: #ff7a73; --bad-bg: #331a1a; --info-bg: #15243a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1319; --surface: #161d25; --surface-2: #1d2630; --ink: #e7ebef; --muted: #9ba6b2; --line: #2b3541;
  --brand: #8fbbe6; --brand-2: #a9cbee; --brand-ink: #0e1319; --accent: #f08a4b; --focus: #7aa7ff;
  --go: #22a356; --go-ink: #04130a; --stop: #e5484d; --stop-ink: #ffffff; --warn: #f0b04a; --warn-bg: #2d2412;
  --ok-bg: #12291b; --bad: #ff7a73; --bad-bg: #331a1a; --info-bg: #15243a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--brand-2); text-underline-offset: 2px; }
:root[data-theme="dark"] a, :root:not([data-theme="light"]) a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } .h2 { font-size: 1.35rem; } .h3, h2.h3 { font-size: 1.08rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.wrap { overflow-wrap: anywhere; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; }
.warn { color: var(--warn); } .bad { color: var(--bad); } .big { font-size: 1.25rem; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.printonly { display: none; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
  background: var(--brand); color: var(--brand-ink); padding-top: env(safe-area-inset-top); }
:root[data-theme="dark"] .top { background: #111a24; color: var(--ink); border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #111a24; color: var(--ink); border-bottom: 1px solid var(--line); } }
.brand { display: flex; align-items: center; gap: .55rem; color: inherit !important; text-decoration: none; font-size: 1.05rem; letter-spacing: .01em; }
.brand__mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.05rem; }
.brand__name b { font-weight: 800; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.top__user { display: flex; align-items: center; gap: .45rem; color: inherit !important; text-decoration: none; }
.top__username { display: none; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .18); font-weight: 700; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font-size: 1.3rem; }
.iconbtn:hover { background: rgba(127, 127, 127, .15); }

.sidenav { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); background: var(--surface); border-right: 1px solid var(--line);
  transform: translateX(-102%); transition: transform .2s ease; overflow-y: auto; padding: calc(var(--top-h) + .5rem) .5rem 1rem; display: flex; flex-direction: column; }
.sidenav.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a, .sidenav .linkbtn { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 8px; color: var(--ink) !important; text-decoration: none; width: 100%; font: inherit; }
.sidenav a:hover, .sidenav .linkbtn:hover { background: var(--surface-2); }
.sidenav a[aria-current="page"] { background: var(--info-bg); color: var(--brand-2) !important; font-weight: 650; }
.sidenav__foot { margin-top: auto !important; border-top: 1px solid var(--line); padding-top: .5rem !important; }
.count { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 22px; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-2); cursor: pointer; font: inherit; text-align: left; }
.main { padding: 1rem 1rem calc(var(--tab-h) + 1.5rem + env(safe-area-inset-bottom)); max-width: 1240px; }
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .72rem/1.1 var(--font);
  color: var(--muted) !important; text-decoration: none; background: none; border: 0; position: relative; min-width: 0; }
.tabbar a[aria-current="page"] { color: var(--brand-2) !important; }
:root[data-theme="dark"] .tabbar a[aria-current="page"] { color: var(--brand) !important; }
.tabbar .ic { width: 24px; height: 24px; }
.tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; }
@media (min-width: 960px) {
  .top__menu, .tabbar, .scrim { display: none !important; }
  .top__username { display: inline; }
  .sidenav { transform: none; top: var(--top-h); width: var(--nav-w); padding-top: .75rem; box-shadow: none !important; }
  .main { margin-left: var(--nav-w); padding: 1.5rem 2rem 3rem; }
}

/* ---------- building blocks ---------- */
.pagehead { margin-bottom: 1rem; }
.pagehead h1 { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); min-width: 0; }
.card--ok { border-color: var(--go); }
.grid2, .grid3 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } .field--span2 { grid-column: span 2; } }
@media (min-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr 1fr; } }
.grid2 > .card, .grid3 > .card { margin-bottom: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink) !important; font: 600 .95rem/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink) !important; }
.btn--primary:hover { background: var(--brand-2); }
.btn--go { background: var(--go); border-color: var(--go); color: var(--go-ink) !important; }
.btn--stop, .btn--danger { background: var(--stop); border-color: var(--stop); color: var(--stop-ink) !important; }
.btn--go:hover, .btn--stop:hover, .btn--danger:hover { filter: brightness(1.08); background-color: inherit; }
.btn--go:hover { background: var(--go); } .btn--stop:hover, .btn--danger:hover { background: var(--stop); }
.btn--ghost { background: transparent; }
.btn--small { min-height: 34px; padding: .3rem .7rem; font-size: .86rem; }
.btn--xl { min-height: 64px; font-size: 1.25rem; border-radius: 14px; }
.btn--xl .ic { width: 26px; height: 26px; }
.btn--block { width: 100%; }
.btngroup, .quick { display: flex; flex-wrap: wrap; gap: .5rem; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert--ok { background: var(--ok-bg); border-color: var(--go); }
.alert--error { background: var(--bad-bg); border-color: var(--bad); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.badge--approved, .badge--accepted, .badge--paid, .badge--completed { background: var(--ok-bg); color: var(--go); border-color: transparent; }
.badge--pending, .badge--sent, .badge--partial, .badge--estimating, .badge--lead { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge--rejected, .badge--declined, .badge--overdue, .badge--void { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge--running, .badge--in_progress, .badge--scheduled { background: var(--info-bg); color: var(--brand-2); border-color: transparent; }
:root[data-theme="dark"] .badge--running, :root[data-theme="dark"] .badge--in_progress, :root[data-theme="dark"] .badge--scheduled { color: var(--brand); }
.badge--overtime { background: var(--accent); color: #fff; border-color: transparent; }

/* forms */
.form { margin: 0; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #b9b4a8; border-radius: 8px; padding: .55rem .7rem; min-height: 44px; width: 100%; max-width: 100%; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { border-color: #3c4855; background: #10161d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) select, :root:not([data-theme="light"]) textarea { border-color: #3c4855; background: #10161d; } }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand-2); flex: none; }
textarea { min-height: 44px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; cursor: pointer; }
.formactions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.formactions--sticky { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: .75rem 0; z-index: 5; }
.formactions--sticky input { width: auto; flex: 1 1 180px; }
@media (min-width: 960px) { .formactions--sticky { bottom: 0; } }
@media (max-width: 959px) { .formactions--sticky { position: static; } }
.form--narrow { max-width: 560px; }
.form--row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.form--row .field { margin-bottom: 0; }
.field--inline { flex-direction: row; align-items: center; gap: .5rem; margin: 0; }
.field--inline > span { white-space: nowrap; font-size: .86rem; }
.field--inline input, .field--inline select { width: auto; min-width: 0; }
.field--grow { flex: 1 1 200px; } .field--grow input { width: 100%; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; }
.filters--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; align-items: end; }
.seg { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.seg legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.seg label { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.seg--stack { flex-direction: column; }
.danger-zone { border-color: var(--bad-bg); }
.copyfield { font-family: var(--mono); font-size: .8rem; }
.details { margin-top: .75rem; }
.details summary { cursor: pointer; font-weight: 600; color: var(--brand-2); padding: .25rem 0; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 1rem; margin: .5rem 0; }
.steps li { margin-bottom: .5rem; }
.key { display: inline-block; font-size: 1.05rem; letter-spacing: .08em; margin-top: .25rem; }
progress { width: 160px; vertical-align: middle; accent-color: var(--accent); }

/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: .55rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot th, .table tfoot td { font-weight: 700; background: var(--surface-2); }
.table--compact th, .table--compact td { padding: .4rem .3rem; }
.table--grid td, .table--grid th { white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.table .note { max-width: 280px; }
tr.is-off { opacity: .6; }
@media (max-width: 719px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; padding: .35rem .25rem; background: var(--surface); }
  .table--cards td { border: 0; padding: .25rem .6rem; text-align: left !important; display: flex; gap: .75rem; justify-content: space-between; }
  .table--cards td[data-label]::before { content: attr(data-label); font-size: .78rem; font-weight: 600; color: var(--muted); flex: none; }
  .table--cards td.actions { justify-content: flex-end; }
  .table--cards .note { max-width: none; }
  .tablewrap:has(.table--cards) { overflow: visible; }
}

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; text-decoration: none; color: var(--ink) !important; box-shadow: var(--shadow); }
.stat__label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 1.45rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: .8rem; color: var(--muted); }
.stat--warn { border-left: 4px solid var(--warn); } .stat--bad { border-left: 4px solid var(--bad); } .stat--good { border-left: 4px solid var(--go); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 .75rem; }
.dl dt { color: var(--muted); font-size: .88rem; } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose { white-space: normal; border-top: 1px solid var(--line); padding-top: .75rem; }
.pills { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.pills a { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink) !important; text-decoration: none; font-size: .88rem; }
.pills a[aria-current="page"] { background: var(--brand); color: var(--brand-ink) !important; border-color: var(--brand); }
.weeknav { display: flex; align-items: center; gap: .5rem; }
.dayhead { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.empty { text-align: center; padding: 2rem 1rem; }
.empty__code { font-size: 3rem; font-weight: 800; color: var(--accent); margin: 0; }
.empty__icon .ic { width: 40px; height: 40px; color: var(--go); }

/* entries list */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry__right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.entry__note { flex-basis: 100%; margin: 0; font-size: .86rem; }
.entry--warn { background: var(--warn-bg); padding-left: .5rem; padding-right: .5rem; border-radius: 8px; }

/* clock */
.clock { text-align: center; padding: 1.25rem 1rem; border-width: 2px; }
.clock--on { border-color: var(--go); }
.clock__state { font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: .5rem; }
.clock--on .clock__state { color: var(--go); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--go); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } .sidenav { transition: none; } }
.clock__timer { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: .25rem 0; letter-spacing: -.02em; }
.clock__meta { color: var(--muted); }
.clock .form { text-align: left; max-width: 460px; margin: 1rem auto 0; }
.clock__geo { display: flex; align-items: center; justify-content: center; gap: .35rem; margin: .75rem 0 0; }
.clock__geo .ic { width: 16px; height: 16px; }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.pcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: var(--ink) !important; box-shadow: var(--shadow); }
.pcard:hover { border-color: var(--brand-2); }
.pcard__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.pcard__title { font-size: 1.05rem; margin: 0 0 .25rem; }
.pcard__meta { margin: 0; font-size: .9rem; display: flex; align-items: center; gap: .3rem; }
.pcard__meta .ic { width: 15px; height: 15px; }

/* estimate / invoice lines editor */
.lines { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.lines__head { display: none; }
.line { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); position: relative; }
.line label { margin: 0; min-width: 0; }
.line label:nth-child(2) { grid-column: 1 / -1; }
.line__tax { display: flex; align-items: center; gap: .4rem; }
.line__tax::after { content: "Taxable"; font-size: .85rem; }
.line label > .sr { position: static !important; width: auto; height: auto; clip: auto; overflow: visible; display: block; font-size: .74rem; font-weight: 600; color: var(--muted); }
.line output { align-self: center; font-weight: 700; text-align: right; }
.line [data-remove-line] { position: absolute; top: -10px; right: -8px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-size: 1.1rem; }
@media (min-width: 900px) {
  .lines__head, .line { display: grid; grid-template-columns: 140px minmax(200px, 1fr) 90px 80px 110px 50px 110px 34px; gap: .5rem; align-items: center; }
  .lines__head { font-size: .76rem; color: var(--muted); text-transform: uppercase; font-weight: 700; padding: 0 .6rem; }
  .line { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .3rem .6rem; }
  .line label:nth-child(2) { grid-column: auto; }
  .line__tax::after { content: none; }
  .line label > .sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .line [data-remove-line] { position: static; }
}
.totals { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.totals__sum { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1.5rem; max-width: 360px; margin-left: auto; font-variant-numeric: tabular-nums; }
.totals__sum { column-gap: 0; } .totals__sum dd { margin: 0; text-align: right; padding-left: 1.5rem; }
.totals__grand { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--ink); padding-top: .3rem; }

/* printable documents (estimate, invoice, statement) */
body.printpage { background: var(--surface-2); }
.doc { max-width: 860px; margin: 1rem auto; background: var(--surface); padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--line); }
@media (min-width: 720px) { .doc { padding: 2.5rem 3rem; margin: 2rem auto; } }
.doc__bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.doc__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 3px solid var(--brand); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.doc__wordmark { display: block; font: 800 1.6rem/1.1 Georgia, "Times New Roman", serif; color: var(--brand); letter-spacing: .01em; }
.doc__tag { display: block; color: var(--accent); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; margin-top: .25rem; }
.doc__co { text-align: right; }
.doc__titlerow { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.doc__title { font-size: 1.6rem; margin: 0 0 1rem; }
.doc__title span { color: var(--muted); font-weight: 500; }
.doc__subject { font-size: 1.1rem; margin: 0 0 1rem; }
.doc__parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.doc__label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-top: .25rem; }
.doc__table { margin-bottom: 1rem; }
.doc .tablewrap { margin-bottom: 1rem; }
@media (max-width: 600px) { .doc { padding: 1rem .75rem; } .doc__table th, .doc__table td { padding: .45rem .35rem; font-size: .88rem; } .doc__co { text-align: left; } }
.doc__totals { display: grid; grid-template-columns: 1fr auto; gap: .3rem 2rem; max-width: 400px; margin: 0 0 1.5rem auto; font-variant-numeric: tabular-nums; }
.doc__totals { column-gap: 0; } .doc__totals dd { margin: 0; text-align: right; padding-left: 2rem; }
.doc__grand { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--ink); padding-top: .35rem; }
.doc__notes { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.doc__notes h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.doc__sign { border: 1px dashed var(--line); border-radius: 8px; padding: .75rem 1rem; margin: 1rem 0; }
.doc__signame { display: block; font: italic 1.6rem Georgia, serif; }
.doc__foot { text-align: center; margin-top: 2rem; }
.stamp { display: inline-block; border: 3px solid var(--bad); color: var(--bad); padding: .1rem .7rem; border-radius: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; transform: rotate(-4deg); margin-bottom: 1rem; }
.stamp--ok { border-color: var(--go); color: var(--go); }
.answer { background: var(--info-bg); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; }

/* auth */
body.plain { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--brand) 0 38%, var(--bg) 38%); }
.auth { width: 100%; max-width: 420px; padding: 1.5rem 1rem; }
.auth__brand { display: flex; align-items: center; gap: .75rem; color: #fff; margin-bottom: 1rem; }
.auth__brand strong { display: block; font-size: 1.15rem; } .auth__brand span { opacity: .85; font-size: .9rem; }
.auth__brand .brand__mark { width: 44px; height: 44px; font-size: 1.4rem; border-radius: 12px; }
.auth__card { padding: 1.5rem; }
.auth__theme { display: block; margin: 1rem auto 0; color: var(--muted); }
:root[data-theme="dark"] body.plain { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.plain { background: var(--bg); } }

/* print */
@media print {
  @page { margin: 14mm; }
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #000; --muted: #444; --line: #ccc; --brand: #16324f; --accent: #b7410e; color-scheme: light; }
  body, body.printpage { background: #fff !important; color: #000; font-size: 11pt; }
  .top, .sidenav, .tabbar, .noprint, .alert, .filters, .btn, .scrim, .pagehead .btngroup { display: none !important; }
  .main { margin: 0; padding: 0; }
  .printonly { display: block; }
  .doc { border: 0; margin: 0; padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .table--cards thead { display: table-header-group; }
  a { color: #000; text-decoration: none; }
  tr { break-inside: avoid; }
}
