/* Sanoe back office — one stylesheet, no build step. */
:root {
  --petrol: #0e3a4a;
  --petrol-2: #15505f;
  --petrol-ink: #cfe0e6;
  --ink: #16242c;
  --ink-2: #44555e;
  --muted: #6b7b84;
  --bg: #edf1f3;
  --surface: #ffffff;
  --sunk: #f5f7f8;
  --line: #d8dfe3;
  --line-2: #e7ecef;
  --gasoline: #b57a00;
  --diesel: #00759e;
  --other: #7a8a93;
  --paid: #2f7d4f;
  --due: #b3261e;
  --partial: #6b4fa0;
  --focus: #f2b300;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar: 236px;
  --map-empty: #eef1f3;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
a { color: var(--diesel); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-stretch: 112%; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 0.75em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--petrol);
  color: var(--petrol-ink);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; padding: 0 6px; }
.brand img { width: 38px; height: 38px; border-radius: 6px; background: #fff; object-fit: contain; }
.brand strong { font-stretch: 112%; font-size: 15px; line-height: 1.15; display: block; }
.brand span { font-size: 12px; color: var(--petrol-ink); opacity: .8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 12px; color: #8fb0bc; padding: 12px 10px 4px; }
.nav a {
  color: #e4eef2; padding: 8px 10px; border-radius: var(--radius-s);
  display: flex; align-items: center; gap: 10px; font-size: 14.5px;
}
.nav a:hover { background: var(--petrol-2); text-decoration: none; }
.nav a[aria-current="page"] { background: #fff; color: var(--petrol); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .me { margin-top: auto; border-top: 1px solid var(--petrol-2); padding: 12px 6px 0; font-size: 13px; }
.sidebar .me a, .sidebar .me button { color: #e4eef2; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 32px 18px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 32px 48px; max-width: 1320px; }
.btn.menu-toggle { display: none; }

/* ---------- Building blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid { margin-top: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-body { padding: 18px; }
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.stack > * + * { margin-top: 12px; }
.grid > .panel, .grid > .stack > .panel:first-child { margin-top: 0; }
.stack > .panel + .panel { margin-top: 20px; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.figure { padding: 16px 18px; border-left: 1px solid var(--line-2); }
.figure:first-child { border-left: 0; }
.figure .label { font-size: 13px; color: var(--ink-2); }
.figure .value { font-size: 22px; font-weight: 650; font-stretch: 108%; margin-top: 2px; }
.figure .sub { font-size: 12.5px; color: var(--muted); }
.figure.warn .value { color: var(--due); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 38px;
}
.btn:hover { background: var(--sunk); text-decoration: none; }
.btn-primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--petrol-2); }
.btn-danger { color: var(--due); border-color: #e6b8b4; }
.btn-danger:hover { background: #fbefee; }
.btn-small { padding: 5px 10px; min-height: 30px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

label { display: block; font-size: 13.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 5px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid #c6d0d5; border-radius: var(--radius-s); padding: 8px 10px; background: #fff; min-height: 40px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--diesel); box-shadow: 0 0 0 3px rgba(0, 117, 158, .18); }
input[readonly] { background: var(--sunk); }
.field { margin-bottom: 16px; }
.fields { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 450; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--petrol); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filters .f { min-width: 140px; }
.filters .f-grow { flex: 1 1 220px; }
.filters label { font-size: 12.5px; margin-bottom: 3px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg a { padding: 6px 12px; font-size: 13.5px; color: var(--ink-2); border-left: 1px solid var(--line); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current="true"] { background: var(--petrol); color: #fff; }
.seg a:hover { text-decoration: none; background: var(--sunk); }
.seg a[aria-current="true"]:hover { background: var(--petrol); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--sunk); white-space: nowrap; }
tbody tr:hover td { background: #f8fafb; }
tfoot td { font-weight: 650; background: var(--sunk); border-bottom: 0; }
td.strong, .strong { font-weight: 600; }
tr.is-canceled td { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-2); }
.empty p { margin-bottom: 12px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span.cur { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.pager span.cur { background: var(--petrol); color: #fff; border-color: var(--petrol); }

/* ---------- Status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-paid { color: var(--paid); background: #eef6f1; }
.badge-due, .badge-overdue { color: var(--due); background: #fbefee; }
.badge-partial { color: var(--partial); background: #f3f0f8; }
.badge-canceled, .badge-pending { color: var(--muted); background: var(--sunk); }
.badge-canceled i { background: transparent; border: 1.5px solid currentColor; }

.fuel { display: inline-flex; align-items: center; gap: 7px; }
.fuel::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--other); }
.fuel-gasoline::before { background: var(--gasoline); }
.fuel-diesel::before { background: var(--diesel); }

.alert { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 18px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: #eef6f1; border-color: #b7d8c3; color: #1f5a37; }
.alert-error { background: #fbefee; border-color: #e6b8b4; color: #8a1d17; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- Dashboard ---------- */
.pump {
  background: var(--petrol); color: #fff; border-radius: var(--radius-m);
  padding: 22px 24px; display: grid; gap: 24px;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
  align-items: end;
}
.pump h2 { color: #fff; font-size: 15px; font-weight: 500; font-stretch: 100%; color: var(--petrol-ink); }
.pump .date { font-size: 30px; font-weight: 700; font-stretch: 118%; line-height: 1.05; margin-top: 4px; }
.pump .total { margin-top: 10px; color: var(--petrol-ink); font-size: 14px; }
.pump .total b { color: #fff; font-size: 18px; }
.pump-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.pump-product { border-left: 6px solid var(--other); padding: 2px 0 2px 14px; }
.pump-product.gasoline { border-color: #e0a325; }
.pump-product.diesel { border-color: #2e9bc4; }
.pump-product .name { font-size: 14px; color: var(--petrol-ink); }
.pump-product .qty { font-size: 40px; font-weight: 750; font-stretch: 125%; line-height: 1; letter-spacing: -0.02em; }
.pump-product .qty small { font-size: 15px; font-weight: 500; font-stretch: 100%; color: var(--petrol-ink); margin-left: 4px; letter-spacing: 0; }
.pump-product .amt { font-size: 14px; color: var(--petrol-ink); margin-top: 6px; }
.pump-empty { color: var(--petrol-ink); font-size: 15px; }
.pump-empty a { color: #fff; text-decoration: underline; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar-g { fill: var(--gasoline); }
.chart .bar-d { fill: var(--diesel); }
.chart .bar-o { fill: var(--other); }
.chart .hit { fill: transparent; cursor: default; }
.chart .col:hover .hit { fill: rgba(14, 58, 74, .06); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-tip {
  position: fixed; pointer-events: none; z-index: 50; background: var(--ink); color: #fff;
  padding: 8px 10px; border-radius: var(--radius-s); font-size: 12.5px; line-height: 1.45; display: none; max-width: 240px;
}
.chart-tip b { font-weight: 650; }


/* ---------- County map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); gap: 0; }
.map-layout-compact { grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); }
.map-col { padding: 18px; border-right: 1px solid var(--line-2); min-width: 0; }
.map-wrap { max-width: 560px; margin: 0 auto; }
.county-map { width: 100%; height: auto; display: block; }
.county-map .county { stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; cursor: pointer; transition: opacity .12s; }
.county-map .county:hover, .county-map .county:focus-visible { stroke: var(--ink); stroke-width: 2; outline: none; }
.county-map .county.is-selected { stroke: var(--ink); stroke-width: 2.6; }
.county-map .counties:hover .county:not(:hover):not(.is-selected) { opacity: .82; }
.county-labels text {
  font: 600 10.5px var(--font); fill: var(--ink); text-anchor: middle; dominant-baseline: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; stroke-linejoin: round;
}
.county-labels .lbl-short { display: none; }
.county-labels text.on-dark { fill: #fff; stroke: rgba(14,58,74,.75); }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; justify-content: center; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.map-panel { padding: 18px 20px; }
.map-panel h2 { font-size: 22px; margin-bottom: 12px; }
.map-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.map-stats dt { font-size: 12.5px; color: var(--muted); }
.map-stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 650; font-stretch: 106%; }
.map-stats .wide dd { color: var(--due); }
.map-top { list-style: none; margin: 0 0 14px; padding: 0; }
.map-top li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.map-top li span:last-child { text-align: right; white-space: nowrap; }
.map-top .owed { display: block; font-size: 12px; color: var(--due); }
.map-note { padding: 12px 18px; border-top: 1px solid var(--line-2); background: #fff8e8; font-size: 14px; }
.map-note a { font-weight: 600; margin-left: 4px; }

/* ---------- Document view ---------- */
.doc-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.doc-head dt { font-size: 12.5px; color: var(--muted); }
.doc-head dd { margin: 2px 0 0; font-weight: 550; }
.totals { width: 100%; max-width: 340px; margin-left: auto; }
.totals td { border: 0; padding: 4px 0; }
.totals tr.grand td { border-top: 2px solid var(--ink); padding-top: 8px; font-size: 18px; font-weight: 700; }
.totals tr.owed td { color: var(--due); font-weight: 650; }

/* Line-item editor */
.lines th, .lines td { padding: 8px 6px; vertical-align: middle; }
.lines td input, .lines td select { min-height: 38px; }
.lines .c-name { min-width: 220px; }
.lines .c-qty, .lines .c-price { width: 130px; }
.lines .c-unit { width: 70px; }
.lines .c-tax { width: 80px; }
.lines .c-total { width: 140px; }
.lines .c-x { width: 44px; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: var(--radius-s); width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.icon-btn:hover { border-color: var(--line); color: var(--due); }
.doc-foot { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }

/* ---------- Guest (login) ---------- */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.guest-side { background: var(--petrol); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.guest-side .co { font-size: 38px; font-weight: 750; font-stretch: 122%; line-height: 1.02; max-width: 12ch; }
.guest-side .where { color: var(--petrol-ink); margin-top: 14px; }
.guest-side .bars { display: flex; gap: 6px; }
.guest-side .bars i { display: block; height: 6px; border-radius: 3px; }
.guest-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.guest-form form { width: 100%; max-width: 360px; }
.guest-form h1 { margin-bottom: 6px; }


/* ---------- Public website ---------- */
body.site { background: var(--surface); }
.site-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-bar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.site-bar-inner { display: flex; align-items: center; gap: 20px; min-height: 66px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-stretch: 112%; font-size: 16px; }
.site-brand:hover { text-decoration: none; }
.site-brand img { width: 40px; height: 40px; object-fit: contain; }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--ink-2); font-size: 15px; }
.site-signin { margin-left: 8px; }

.site-hero { background: var(--petrol); color: #fff; }
.site-hero-inner { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 48px; align-items: end; padding-top: 72px; padding-bottom: 64px; }
.hero-bars { display: flex; gap: 8px; margin-bottom: 26px; }
.hero-bars i { display: block; height: 8px; border-radius: 4px; }
.hero-bars .g { width: 150px; background: #e0a325; }
.hero-bars .d { width: 80px; background: #2e9bc4; }
.site-hero h1 { font-size: clamp(38px, 6.4vw, 76px); font-weight: 800; font-stretch: 125%; line-height: .98; letter-spacing: -0.025em; max-width: 13ch; }
.hero-lead { font-size: clamp(18px, 2vw, 22px); color: var(--petrol-ink); margin: 22px 0 30px; max-width: 34ch; line-height: 1.4; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-amber { background: #f2b300; border-color: #f2b300; color: #1c1600; font-weight: 650; min-height: 46px; padding: 11px 20px; font-size: 15.5px; }
.btn-amber:hover { background: #ffc21a; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); min-height: 46px; padding: 11px 20px; font-size: 15.5px; }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.hero-facts { margin: 0; display: grid; gap: 18px; border-left: 1px solid rgba(255,255,255,.2); padding-left: 28px; }
.hero-facts dt { font-size: 13px; color: #8fb0bc; }
.hero-facts dd { margin: 3px 0 0; font-size: 17px; font-weight: 550; }

.site-section { padding: 72px 0; }
.site-section-alt { background: var(--bg); }
.site-section h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 750; font-stretch: 118%; margin-bottom: 26px; }
.supply-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.supply-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px 22px 18px; border-top: 6px solid var(--other); }
.supply-card h3 { font-size: 20px; margin-bottom: 10px; }
.supply-card p { color: var(--ink-2); }
.supply-gasoline { border-top-color: var(--gasoline); }
.supply-diesel { border-top-color: var(--diesel); }
.supply-how { border-top-color: var(--petrol); background: var(--sunk); }
.supply-how ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.supply-how li + li { margin-top: 6px; }
.supply-unit { font-size: 14px; color: var(--ink) !important; font-weight: 550; margin: 0; }

.deliver-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 48px; align-items: center; }
.county-chips { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.county-chips button { font: inherit; font-size: 14.5px; border: 1px solid var(--petrol); color: var(--petrol); background: #fff; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.county-chips button:hover, .county-chips button[aria-pressed="true"] { background: var(--petrol); color: #fff; }
.site-county-status { min-height: 1.5em; font-weight: 600; }
.site-map { margin: 0; }
.site-county-map .site-county { fill: #fff; stroke: #c9d3d8; }
.site-county-map .site-county.is-served { fill: var(--petrol); stroke: #fff; }
.site-county-map .site-county.is-served:hover { fill: var(--petrol-2); }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.contact-list { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; }
.contact-list dt { font-size: 13px; color: var(--muted); }
.contact-list dd { margin: 4px 0 0; font-size: 18px; font-weight: 550; }
.site-foot { background: var(--petrol); color: var(--petrol-ink); font-size: 14px; padding: 28px 0; }
.site-foot strong { color: #fff; }
.site-foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.site-foot-links { display: flex; gap: 18px; }
.site-foot a { color: #fff; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .site-signin { margin-left: auto; }
  .site-inner { padding: 0 16px; }
  .site-brand span { font-size: 14px; line-height: 1.15; }
  .site-hero-inner { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; padding-bottom: 40px; }
  .hero-facts { border-left: 0; padding-left: 0; border-top: 1px solid rgba(255,255,255,.2); padding-top: 22px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .site-section { padding: 48px 0; }
  .deliver-grid, .contact-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pump { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 14px 16px; }
  .content { padding: 16px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .doc-foot { grid-template-columns: 1fr; }
  .guest { grid-template-columns: 1fr; }
  .guest-side { padding: 28px 20px; }
  .guest-side .co { font-size: 28px; }
  .figure { border-left: 0; border-top: 1px solid var(--line-2); }
  .figure:first-child { border-top: 0; }
  .pump-product .qty { font-size: 32px; }
  h1 { font-size: 22px; }
}

/* ---------- Phones: tables become stacked cards ---------- */
@media (max-width: 700px) {
  .table-wrap { overflow: visible; }
  table.stack-table thead { display: none; }
  table.stack-table, table.stack-table tbody, table.stack-table tfoot, table.stack-table tr { display: block; width: 100%; }
  table.stack-table tr { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  table.stack-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    border: 0; padding: 3px 0; text-align: right; min-height: 0;
  }
  table.stack-table td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; flex: none; }
  table.stack-table td[data-label=""]::before, table.stack-table td.cell-title::before { content: none; }
  table.stack-table td.cell-title { display: block; text-align: left; font-size: 15.5px; padding-bottom: 6px; }
  table.stack-table td.cell-title > * { text-align: left; }
  table.stack-table td:empty { display: none; }
  table.stack-table tbody tr:hover td { background: none; }
  table.stack-table tfoot tr { background: var(--sunk); }
  table.stack-table tfoot td { background: none; }
  table.stack-table td .small, table.stack-table td .hint { text-align: inherit; }
  /* Line editor: one card per line, inputs full width */
  table.lines.stack-table td { display: grid; grid-template-columns: 96px 1fr; align-items: center; text-align: left; }
  table.lines.stack-table td::before { align-self: center; }
  table.lines.stack-table .c-name, table.lines.stack-table .c-qty, table.lines.stack-table .c-price,
  table.lines.stack-table .c-unit, table.lines.stack-table .c-tax, table.lines.stack-table .c-total { width: auto; min-width: 0; }
  table.lines.stack-table td.c-x { display: flex; justify-content: flex-end; }
  table.lines.stack-table td.c-total { font-size: 16px; }
  table.lines.stack-table tr { border-bottom: 6px solid var(--bg); }

  .filters { flex-direction: column; align-items: stretch; }
  .filters .f, .filters .f-grow { min-width: 0; flex: none; width: 100%; }
  .filters .seg { margin-left: 0 !important; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg a { white-space: nowrap; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 14px; }
  .topbar .actions { width: 100%; }
  .topbar .actions .btn { flex: 1 1 auto; }
  .chart-scroll { overflow-x: auto; }
  .chart-scroll .chart { min-width: 560px; }
  .map-layout, .map-layout-compact { grid-template-columns: minmax(0, 1fr); }
  .map-col { border-right: 0; border-bottom: 1px solid var(--line-2); padding: 10px; }
  .county-labels text { font-size: 18px; stroke-width: 4px; }
  .county-labels .lbl-full { display: none; }
  .county-labels .lbl-short { display: inline; }
  .fields { grid-template-columns: 1fr; }
  .fields > .field { grid-column: auto !important; }
  input, select, textarea { max-width: 100%; }
  table.lines.stack-table td.c-x::before { content: none; }
  .doc-head { grid-template-columns: 1fr 1fr; }
  .totals { max-width: none; }
  .print-page { padding: 18px; }
  .print-head { flex-direction: column; gap: 12px; }
  .print-meta { text-align: left; }
  .print-parties, .print-foot { grid-template-columns: 1fr; gap: 12px; }
  .print-parties > div[style] { text-align: left !important; }
  .print-tools { padding: 0 18px; }
  .guest-side { min-height: 0; gap: 18px; }
  .pump { padding: 18px; }
}
@media print {
  table.stack-table thead { display: table-header-group !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Print ---------- */
.print-page { background: #fff; color: #000; max-width: 820px; margin: 0 auto; padding: 32px; font-size: 13.5px; }
.print-page h1 { font-size: 24px; }
.print-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 3px solid var(--petrol); padding-bottom: 16px; margin-bottom: 20px; }
.print-head img { width: 64px; height: 64px; object-fit: contain; }
.print-head .co { display: flex; gap: 14px; }
.print-head .co strong { font-size: 17px; font-stretch: 112%; display: block; }
.print-meta { text-align: right; }
.print-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.print-page th { background: #eef2f4; color: #000; }
.print-page td, .print-page th { padding: 7px 10px; }
.print-foot { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; font-size: 12.5px; }
.sign { border-top: 1px solid #000; padding-top: 6px; margin-top: 46px; }
.print-tools { max-width: 820px; margin: 16px auto 0; display: flex; gap: 10px; padding: 0 32px; }
.stamp { display: inline-block; border: 2px solid; padding: 2px 10px; font-weight: 700; font-stretch: 112%; transform: rotate(-4deg); margin-top: 6px; }
.stamp.paid { color: var(--paid); } .stamp.due { color: var(--due); } .stamp.partial { color: var(--partial); } .stamp.canceled { color: var(--muted); }
@media print {
  .print-tools, .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { padding: 0; max-width: none; }
  @page { margin: 14mm; }
}
