/* ServiceHub — one stylesheet, no build step. */
:root {
  --ink: #1c2623;
  --ink-2: #4b5853;
  --ink-3: #7a8681;
  --paper: #f3f5f3;
  --surface: #ffffff;
  --line: #dfe4e1;
  --line-2: #eef1ef;
  --petrol: #123c3a;
  --petrol-2: #1b4c49;
  --teal: #0b7a69;
  --teal-ink: #075a4e;
  --teal-wash: #e3f2ee;
  --amber: #b86e0b;
  --amber-wash: #fbf0dd;
  --red: #b3261e;
  --red-wash: #fbe7e5;
  --green: #217a3f;
  --green-wash: #e2f3e7;
  --blue: #2557a7;
  --blue-wash: #e6eefb;
  --grey-wash: #eceeed;
  --radius: 10px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--font);
}
a { color: var(--teal-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--teal); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.98rem; font-weight: 650; }
p { margin: 0 0 0.8em; }
small, .muted { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .v, .money-strip .v, .totals, .items, .agenda .when { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--petrol) 236px, transparent 236px); }
.side {
  background: var(--petrol); color: #d5e3df; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.brand-name { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.mark {
  width: 34px; height: 34px; border-radius: 8px; background: #f2b64a; color: var(--petrol);
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex: none;
}
.mark.big { width: 52px; height: 52px; font-size: 1.15rem; border-radius: 12px; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-group { font-size: 0.75rem; color: #8fb0aa; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px;
  color: #d5e3df; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--petrol-2); color: #fff; }
.nav a.on { background: #f2b64a; color: var(--petrol); font-weight: 650; }
.me { display: flex; align-items: center; gap: 6px; padding: 12px 12px 14px; border-top: 1px solid var(--petrol-2); }
.me-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: 1; min-width: 0; }
.me-link strong { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-link small { display: block; color: #8fb0aa; font-size: 0.78rem; }
.me .icon-btn { color: #d5e3df; }
.me .icon-btn:hover { background: var(--petrol-2); color: #fff; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #2c6a64; color: #fff;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; flex: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 0.65rem; background: var(--teal-wash); color: var(--teal-ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 32px; min-height: 60px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 36px; background: var(--paper); border-color: transparent; }
.search input:focus { background: #fff; border-color: var(--teal); }
.page { padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.crumb { display: inline-block; margin-bottom: 6px; font-size: 0.88rem; text-decoration: none; color: var(--ink-2); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.scrim { display: none; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  text-decoration: none; white-space: nowrap; min-height: 38px;
}
.btn:hover { border-color: #c3ccc8; background: #fafbfa; color: var(--ink); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-ink); border-color: var(--teal-ink); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-wash); border-color: #f0c4bf; }
.btn.wa { color: #13693a; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 0.83rem; }
.btn.block { width: 100%; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--teal-ink); font-weight: 500; text-decoration: underline; }
.icon-btn { border: 0; background: none; padding: 7px; border-radius: 7px; cursor: pointer; color: var(--ink-2); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--grey-wash); }
form.inline { display: inline; margin: 0; }

input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cdd5d1; border-radius: 8px; padding: 8px 11px; min-height: 40px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-wash); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--teal); }
label { display: block; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
label .hint, .hint { font-weight: 400; font-size: 0.82rem; color: var(--ink-3); margin-top: 4px; }
label.check { display: flex; gap: 9px; align-items: center; font-weight: 500; color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { font-weight: 700; font-size: 1rem; color: var(--ink); margin-bottom: 10px; padding: 0; }
.stack { display: grid; gap: 16px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.row-2.row-note { grid-template-columns: 170px 1fr; }
.form-foot { display: flex; gap: 10px; align-items: center; padding-top: 6px; flex-wrap: wrap; }
.star { color: var(--red); text-decoration: none; margin-left: 2px; }
.stack > .panel + .panel, .stack > .grid-side .panel + .panel { margin-top: 0; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.check-list label {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-weight: 500; color: var(--ink); cursor: pointer; background: #fff;
}
.check-list label:has(input:checked) { border-color: var(--teal); background: var(--teal-wash); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.logo img { display: block; width: auto; height: auto; object-fit: contain; }
.logo-mark {
  background: #f2b64a; color: var(--petrol); font-weight: 800; border-radius: 10px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.logo-side img { background: #fff; border-radius: 6px; padding: 3px; max-height: 38px; max-width: 104px; }
.logo-side.logo-mark { width: 36px; height: 36px; font-size: 0.85rem; border-radius: 8px; }
.logo-doc img { max-height: 72px; max-width: 200px; }
.logo-doc.logo-mark { width: 60px; height: 60px; font-size: 1.3rem; background: var(--petrol); color: #fff; }
.logo-hero img { max-height: 56px; max-width: 180px; }
.logo-hero.logo-mark { width: 52px; height: 52px; font-size: 1.15rem; }
.logo-login { margin: 0 auto; }
.logo-login img { max-height: 72px; max-width: 220px; }
.logo-login.logo-mark { width: 60px; height: 60px; font-size: 1.3rem; border-radius: 14px; }

.brand-banner {
  display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid #f2b64a; border-radius: var(--radius); padding: 14px 20px; margin-bottom: 18px;
}
.brand-banner-text { min-width: 0; flex: 1; }
.brand-banner-text strong { display: block; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-banner-text span { display: block; color: var(--ink-2); font-size: 0.88rem; margin-top: 2px; }
.brand-banner-date { text-align: right; color: var(--ink-3); font-size: 0.82rem; line-height: 1.3; }
.brand-banner-date strong { display: block; color: var(--ink); font-size: 0.95rem; }
.logo-field { display: flex; gap: 16px; align-items: center; }
.logo-preview {
  width: 130px; height: 96px; border: 1px dashed #c3ccc8; border-radius: 8px; flex: none;
  display: grid; place-items: center; padding: 10px; background: #fafbfa;
}
.logo-preview .logo-doc img { max-height: 72px; max-width: 108px; }

/* ---------- Panels & layout ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head a { font-size: 0.88rem; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .panel-head { padding: 16px 20px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .panel + .panel, .grid-side > * > .panel + .panel { margin-top: 0; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.col { display: grid; gap: 18px; min-width: 0; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--green-wash); border-color: #bfe0c9; color: #17582d; }
.flash-error { background: var(--red-wash); border-color: #f1c4bf; color: #8a1d16; }
.flash-info { background: var(--blue-wash); border-color: #c8d7f2; color: #1b4180; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px;
  font-size: 0.78rem; font-weight: 600; background: var(--grey-wash); color: var(--ink-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-paid, .b-completed, .b-accepted, .b-active { background: var(--green-wash); color: var(--green); }
.b-partial, .b-in_progress, .b-high, .b-lead { background: var(--amber-wash); color: var(--amber); }
.b-overdue, .b-urgent, .b-declined { background: var(--red-wash); color: var(--red); }
.b-sent, .b-scheduled, .b-converted { background: var(--blue-wash); color: var(--blue); }
.b-cancelled, .b-inactive, .b-draft, .b-on_hold, .b-low, .b-normal { background: var(--grey-wash); color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th {
  text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--ink-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfa;
}
.list td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list th.right, .list td.right, .list .num { text-align: right; }
.list tbody tr:hover { background: #fafcfb; }
.list .main-cell a { font-weight: 600; text-decoration: none; color: var(--ink); }
.list .main-cell a:hover { color: var(--teal); }
.list .main-cell small { display: block; }
.list tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #fafbfa; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { min-width: 220px; }
.filters select, .filters input { width: auto; }
.filters .grow { flex: 1 1 220px; }
.filters .grow input { width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 9px 13px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 0.9rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a.on { color: var(--ink); border-color: var(--teal); }
.tabs a .count { color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.pager { display: flex; gap: 14px; justify-content: center; align-items: center; padding: 14px; color: var(--ink-2); font-size: 0.9rem; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--ink-2); }
.empty h2, .empty h3 { margin-bottom: 6px; color: var(--ink); }
.empty p { max-width: 46ch; margin: 0 auto 14px; }

/* ---------- Dashboard ledger strip ---------- */
.ledger {
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px;
}
.ledger > * { padding: 18px 20px; border-left: 1px solid var(--line); display: block; }
.ledger > *:first-child { border-left: 0; }
.ledger .k { font-size: 0.85rem; color: var(--ink-2); font-weight: 500; }
.ledger .v { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.1; }
.ledger .d { font-size: 0.82rem; color: var(--ink-3); margin-top: 6px; }
.ledger .v.warn { color: var(--amber); }
.ledger .v.bad { color: var(--red); }
.ledger .v.good { color: var(--green); }
.ledger a { color: inherit; text-decoration: none; }
.ledger a:hover .v { text-decoration: underline; text-decoration-thickness: 2px; }

/* Agenda rows (today's jobs, upcoming) */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); align-items: start; }
.agenda li:first-child { border-top: 0; padding-top: 2px; }
.agenda .when { font-weight: 700; font-size: 0.9rem; }
.agenda .when small { display: block; font-weight: 500; }
.agenda .what a { font-weight: 600; color: var(--ink); text-decoration: none; }
.agenda .what a:hover { color: var(--teal); }
.agenda .what small { display: block; }
.crew { display: inline-flex; gap: 3px; margin-top: 4px; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.mini-list li:first-child { border-top: 0; padding-top: 0; }
.mini-list a { font-weight: 600; text-decoration: none; color: var(--ink); }
.mini-list small { display: block; }

/* ---------- Detail views ---------- */
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: 0.88rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.money-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.money-strip > div { background: var(--surface); padding: 14px 16px; }
.money-strip .k { font-size: 0.82rem; color: var(--ink-2); }
.money-strip .v { font-size: 1.3rem; font-weight: 700; margin-top: 2px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0 12px 18px; border-left: 2px solid var(--line); position: relative; margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--teal); }
.timeline .meta { font-size: 0.82rem; color: var(--ink-3); }
.timeline p { margin: 2px 0 0; white-space: pre-line; }

.status-bar { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Document editor (quotes & invoices) ---------- */
.items { width: 100%; border-collapse: collapse; }
.items th { text-align: left; font-size: 0.8rem; color: var(--ink-3); font-weight: 600; padding: 0 6px 8px; }
.items td { padding: 4px 6px; vertical-align: top; }
.items .c-qty { width: 90px; }
.items .c-price { width: 150px; }
.items .c-amt { width: 140px; text-align: right; font-weight: 600; padding-top: 13px; white-space: nowrap; }
.items .c-x { width: 40px; }
.items input { min-height: 38px; }
.totals { margin-left: auto; width: min(360px, 100%); display: grid; gap: 8px; margin-top: 14px; }
.totals .t-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals .t-row input { width: 130px; text-align: right; }
.totals .grand { border-top: 2px solid var(--ink); padding-top: 10px; font-size: 1.2rem; font-weight: 800; }

/* ---------- Printable document ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 44px 48px; max-width: 860px; }
.doc-head { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; margin-bottom: 34px; }
.doc-biz { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.doc-biz-text { min-width: 0; }
.doc.narrow .doc-biz { flex-direction: column; gap: 10px; }
.doc-biz strong { font-size: 1.15rem; display: block; }
.doc-biz .tagline { color: var(--ink-2); font-style: italic; }
.doc-biz div, .doc-to div { color: var(--ink-2); font-size: 0.92rem; white-space: pre-line; }
.doc-title { text-align: right; }
.doc-title h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--petrol); }
.doc-title .no { font-weight: 600; margin-top: 2px; }
.doc-meta { display: grid; grid-template-columns: 1fr auto; gap: 30px; margin-bottom: 28px; }
.doc-meta dl { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin: 0; font-size: 0.92rem; }
.doc-meta dt { color: var(--ink-3); }
.doc-meta dd { margin: 0; text-align: right; font-weight: 600; }
.doc-to .lbl { color: var(--ink-3); font-size: 0.82rem; margin-bottom: 4px; }
.doc-to strong { font-size: 1.02rem; }
.doc table.list th { background: var(--petrol); color: #fff; }
.doc .totals { margin-top: 18px; }
.doc .totals .due { background: var(--amber-wash); padding: 8px 10px; border-radius: 6px; font-weight: 800; }
.doc-foot { margin-top: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px; font-size: 0.88rem; }
.doc-foot h4 { margin: 0 0 4px; font-size: 0.85rem; }
.doc-foot div { white-space: pre-line; color: var(--ink-2); }
.stamp { display: inline-block; border: 3px solid currentColor; padding: 2px 12px; border-radius: 6px; font-weight: 800; font-size: 1.1rem; transform: rotate(-6deg); margin-top: 8px; }
.stamp.paid { color: var(--green); }
.stamp.overdue { color: var(--red); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: #fafbfa; padding: 8px; font-size: 0.8rem; font-weight: 600; color: var(--ink-3); }
.cal .day { background: var(--surface); min-height: 112px; padding: 6px; }
.cal .day.out { background: #f8f9f8; }
.cal .day.out .dn { color: #b4bcb8; }
.cal .day.today .dn { background: var(--teal); color: #fff; }
.cal a.dn { color: inherit; text-decoration: none; }
.cal .dn { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 12px; font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; padding: 0 5px; }
.cal .ev {
  display: block; font-size: 0.78rem; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px;
  text-decoration: none; color: var(--ink); background: var(--blue-wash); border-left: 3px solid var(--blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal .ev.s-completed { background: var(--green-wash); border-color: var(--green); }
.cal .ev.s-in_progress { background: var(--amber-wash); border-color: var(--amber); }
.cal .ev.s-cancelled { background: var(--grey-wash); border-color: #9aa39f; text-decoration: line-through; color: var(--ink-3); }
.cal .ev.s-on_hold { background: var(--grey-wash); border-color: #9aa39f; }
.cal .more { font-size: 0.75rem; color: var(--ink-3); }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { font-size: 1.15rem; min-width: 160px; text-align: center; }
.cal-agenda { display: none; }

/* ---------- Reports ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--font); fill: var(--ink-3); }
.chart .gl { stroke: var(--line-2); }
.chart .axis { stroke: var(--line); }
.chart path:hover { opacity: .78; }
.legend { display: flex; gap: 16px; font-size: 0.85rem; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 7px 0; }
.bar-row .track { grid-column: 1 / -1; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: #00897b; border-radius: 3px; }
.bar-row .fill.exp { background: #c47a0e; }

/* ---------- Login ---------- */
.bare { min-height: 100vh; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--petrol); }
.login-card { background: #fff; border-radius: 14px; padding: 32px; width: min(400px, 100%); }
.login-card.wide { width: min(620px, 100%); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { margin-top: 12px; font-size: 1.4rem; }
.login-brand p { color: var(--ink-2); margin-top: 6px; }
.login .hint { text-align: center; margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-side { grid-template-columns: 1fr; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > *:nth-child(3) { border-left: 0; }
  .ledger > *:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(10, 30, 28, .45); z-index: 20; }
  .menu-btn { display: inline-grid; }
  .top { padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
  .page { padding: 18px 16px 50px; }
  .grid-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .doc { padding: 26px 20px; }
  .doc-head, .doc-meta, .doc-foot { grid-template-columns: 1fr; display: grid; }
  .doc-title { text-align: left; }
  .doc-biz { flex-direction: column; gap: 10px; }
  .cal { display: none; }
  .cal-agenda { display: block; }
  .brand-banner { flex-wrap: wrap; padding: 12px 14px; gap: 12px; }
  .brand-banner-date { display: none; }
  .logo-hero img { max-height: 44px; max-width: 140px; }
  .logo-hero.logo-mark { width: 44px; height: 44px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .row-2, .row-2.row-note { grid-template-columns: 1fr; }
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger .v { font-size: 1.3rem; }
  .ledger > * { padding: 14px; }
  .money-strip { grid-template-columns: 1fr; }
  .page-head .actions { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .filters > *, .filters select, .filters input { width: 100%; flex: 1 1 100%; }
  .filters input[type=search] { min-width: 0; }

  /* Tables turn into stacked rows */
  table.list.stack-sm thead { display: none; }
  table.list.stack-sm, .list.stack-sm tbody, .list.stack-sm tr, .list.stack-sm td { display: block; width: 100%; }
  .list.stack-sm tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .list.stack-sm td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .list.stack-sm td::before { content: attr(data-label); color: var(--ink-3); font-size: 0.85rem; text-align: left; }
  .list.stack-sm td.main-cell { display: block; text-align: left; padding-bottom: 6px; }
  .list.stack-sm td.main-cell::before { content: none; }
  .list.stack-sm td:empty { display: none; }
  .list.stack-sm tfoot td::before { content: none; }

  .items thead { display: none; }
  .items, .items tbody, .items tr { display: block; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .items td { padding: 0; width: auto !important; }
  .items td.c-desc { grid-column: 1 / -1; }
  .items .c-amt { grid-column: 1 / 3; text-align: left; padding-top: 4px; }
  .items .c-x { grid-row: 3; grid-column: 3; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Print ---------- */
@media print {
  body { background: #fff; font-size: 12.5px; }
  .side, .top, .page-head .actions, .no-print, .crumb, .flash, .scrim { display: none !important; }
  .shell, .grid-side, .grid-2 { display: block; }
  .panel { border: 0; padding: 0; margin-bottom: 14px; }
  .page { padding: 0; max-width: none; }
  .page-head { display: none; }
  .doc { border: 0; padding: 0; max-width: none; }
  .doc table.list th { background: #fff !important; color: var(--ink); border-bottom: 2px solid var(--ink); }
  .doc-head, .doc-meta, .doc-foot { display: flex !important; }
  .doc-meta { justify-content: space-between; }
  .doc-foot > * { flex: 1; }
  .doc-title { text-align: right; }
  .doc:not(.narrow) .doc-biz { flex-direction: row; }
  a { color: inherit; text-decoration: none; }
  @page { margin: 14mm; }
}
