/* PumpBook — horizontal admin layout.
   Colours: diesel-ink navy + meter amber. Light and dark themes.

   Sizing rules (keep to these when editing):
   - Lengths are in rem, so the whole interface scales with the root font size.
     The root steps up on large screens (see "large screens" below) for 2K/4K.
   - Grids use minmax(min(100%, X), 1fr) so a column can never be wider than
     the screen: at 320px everything stacks to one column instead of overflowing.
   - Touch targets: --tap is 2.5rem on desktop and 2.75rem (44px) on touch
     screens and anything 64em (1024px) wide or less.
   - Media queries use em, which always means 16px there, whatever the root size. */

@font-face {
  font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
}

:root {
  --ink: #13233a;          /* brand navy */
  --ink-2: #1d3150;
  --ink-3: #2a4366;
  --amber: #f2a900;        /* brand accent */
  --amber-600: #d39300;
  --amber-50: #fff7e0;
  --amber-100: #ffeec0;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --text: #1b2430;
  --muted: #667085;
  --head-bg: #ffffff;

  --green: #1f9254; --green-50: #e7f6ee;
  --red: #d63b30;   --red-50: #fdecea;
  --blue: #2f6fdb;  --blue-50: #e8f0fd;
  --violet: #7a5af8; --violet-50: #f0ecff;
  --olive: #5f8a3e; /* diesel tank */

  --lcd: #0f1a14; --lcd-text: #ffc53d;

  --r: .5rem; --r-sm: .375rem; --r-lg: .75rem;
  --shadow: 0 .625rem .9375rem -.1875rem rgba(19,35,58,.05), 0 .25rem .375rem -.25rem rgba(19,35,58,.05);
  --shadow-lg: 0 1.125rem 2.5rem -.75rem rgba(19,35,58,.22);
  --font: "Inter", "Nirmala UI", "Noto Sans Malayalam", "Noto Sans Devanagari", "Noto Sans Tamil", "Noto Sans Kannada", "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --meter: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);

  /* layout tokens */
  --content: 92.5rem;                                    /* widest the page gets */
  --gutter: clamp(.875rem, .55rem + 1.6vw, 1.5rem);      /* page side padding */
  --gap: clamp(.75rem, .5rem + 1vw, 1.25rem);            /* space between cards */
  --pad: clamp(.875rem, .7rem + .6vw, 1.25rem);          /* inside a card */
  --topbar-h: 4rem;
  --menubar-h: 3.375rem;
  --tap: 2.5rem;                                         /* control height */
  --icon: 1.125rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1726; --surface: #13233a; --surface-2: #172a45; --line: #22385a; --line-2: #2d4670;
  --text: #e6ebf2; --muted: #93a3ba; --head-bg: #172a45;
  --amber-50: #3a2e0a; --amber-100: #4a3a0a;
  --green-50: #12352a; --red-50: #3d1b1b; --blue-50: #172d52; --violet-50: #2a2250;
  --shadow: 0 .625rem .9375rem -.1875rem rgba(0,0,0,.25); --shadow-lg: 0 1.125rem 2.5rem -.75rem rgba(0,0,0,.6);
  color-scheme: dark;
}
/* Touch screens, phones and tablets: every control at least 44 × 44 px. */
@media (pointer: coarse), (max-width: 64em) {
  :root { --tap: 2.75rem; }
}
/* Large screens: scale the whole interface up so text stays readable on 2K/4K. */
@media (min-width: 120em) { html { font-size: 112.5%; } :root { --content: 100rem; } }   /* 1920px+ */
@media (min-width: 160em) { html { font-size: 125%; } }     /* 2560px+ */
@media (min-width: 200em) { html { font-size: 150%; } }     /* 3200px+ (4K) */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-width: 0; font-family: var(--font); font-size: .90625rem; line-height: 1.5; color: var(--text);
  background: var(--bg); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
img, svg, video, canvas { max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; overflow-wrap: break-word; }
h1 { font-size: clamp(1.15rem, 1rem + .6vw, 1.35rem); font-weight: 650; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; overflow-wrap: break-word; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
:focus-visible { outline: .125rem solid var(--amber); outline-offset: .125rem; }
.ic { width: var(--icon); height: var(--icon); flex: none; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* small helpers used by templates instead of inline pixel sizes */
.mw-sm { max-width: 26rem; } .mw-md { max-width: 33rem; } .mw-lg { max-width: 40rem; } .mw-xl { max-width: 47.5rem; }
.w-num-xs { width: 5rem; } .w-num { width: 5.75rem; } .w-num-lg { width: 7.5rem; } .minw-sel { min-width: 5.75rem; }
.mt-s { margin-top: .5rem; } .mt { margin-top: .875rem; } .mt-l { margin-top: 1.125rem; }
.flex-row { display: flex; gap: .375rem; align-items: center; flex-wrap: wrap; }

/* ===== top progress bar (navigation effect) ===== */
.nprogress { position: fixed; top: 0; left: 0; height: .1875rem; width: 0; z-index: 100;
  background: linear-gradient(90deg, var(--amber), #ffd666); box-shadow: 0 0 .5rem var(--amber);
  opacity: 0; transition: width .4s var(--ease), opacity .3s; }
.nprogress.go { opacity: 1; width: 75%; transition: width 6s cubic-bezier(.1,.6,.1,1), opacity .2s; }

/* ===== top bar ===== */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--ink); color: #fff;
  padding-top: env(safe-area-inset-top); transition: box-shadow .25s; }
.topbar.scrolled { box-shadow: 0 .375rem 1.25rem -.5rem rgba(0,0,0,.45); }
.topbar-in { min-height: var(--topbar-h); display: flex; align-items: center; gap: clamp(.5rem, .2rem + 1vw, 1.125rem);
  padding: 0 var(--gutter); max-width: var(--content); margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: .625rem; min-height: var(--tap); min-width: 0; color: #fff;
  font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-name { white-space: nowrap; }
.brand-mark { width: 2.125rem; height: 2.125rem; border-radius: .5625rem; display: grid; place-items: center; flex: none;
  background: var(--amber); color: var(--ink); box-shadow: 0 .25rem .875rem -.25rem rgba(242,169,0,.7);
  transition: transform .3s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-mark .ic { width: 1.1875rem; height: 1.1875rem; stroke-width: 2.2; }

.search { position: relative; flex: 1 1 12rem; max-width: 26.25rem; min-width: 0; margin-left: .75rem; }
.search-ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #8ea0b9; width: 1rem; height: 1rem; }
.search input { width: 100%; height: var(--tap); border-radius: 99rem; border: 1px solid #2b4266;
  background: var(--ink-2); color: #fff; padding: 0 2.75rem 0 2.25rem; font: inherit; transition: all .2s; }
.search input::placeholder { color: #8ea0b9; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search input:focus { outline: none; background: #20375a; border-color: var(--amber);
  box-shadow: 0 0 0 .25rem rgba(242,169,0,.18); }
.search kbd { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font: 600 .6875rem var(--font);
  color: #8ea0b9; border: 1px solid #36507a; border-radius: .3125rem; padding: .0625rem .375rem; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + .5rem); list-style: none; margin: 0;
  padding: .375rem; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: min(22.5rem, 70dvh); overflow: auto;
  opacity: 0; transform: translateY(-.375rem); pointer-events: none; transition: all .18s var(--ease); }
.search-results.open { opacity: 1; transform: none; pointer-events: auto; }
.search-results li a { display: flex; align-items: center; gap: .625rem; min-height: var(--tap); padding: .375rem .625rem;
  border-radius: .375rem; color: var(--text); }
.search-results li a .ic { color: var(--muted); }
.search-results li a small { margin-left: auto; color: var(--muted); }
.search-results li.active a, .search-results li a:hover { background: var(--amber-50); text-decoration: none; }
.search-results li.none { padding: .625rem; color: var(--muted); }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: .375rem; flex: none; }
.tb-btn { width: var(--tap); height: var(--tap); border-radius: .625rem; border: 0; background: transparent; color: #c9d3e0;
  display: grid; place-items: center; flex: none; cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.tb-btn:hover { background: var(--ink-2); color: #fff; }
.tb-btn:active { transform: scale(.94); }
.when-full, .when-dark { display: none; }
:root.is-full .when-full, :root[data-theme="dark"] .when-dark { display: block; }
:root.is-full .when-normal, :root[data-theme="dark"] .when-light { display: none; }
.menu-toggle { display: none; }

.station-chip, .station-switch { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.25rem; padding: 0 .75rem;
  border-radius: 99rem; background: var(--ink-2); color: #fff; font-weight: 500; font-size: .9rem; margin-right: .25rem;
  min-width: 0; max-width: 16rem; }
.station-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-chip .ic, .station-switch .ic { width: 1rem; height: 1rem; color: var(--amber); }
.station-switch select { background: transparent; border: 0; color: #fff; font: inherit; cursor: pointer; min-height: 2.25rem;
  min-width: 0; max-width: 12rem; }
.station-switch option { color: #000; }

.user-btn { display: flex; align-items: center; gap: .625rem; min-height: var(--tap); background: transparent; border: 0; color: #fff;
  padding: .25rem .5rem .25rem .25rem; border-radius: 99rem; cursor: pointer; font: inherit; transition: background .2s; }
.user-btn:hover, .user-dd.open .user-btn { background: var(--ink-2); }
.avatar { width: 2.125rem; height: 2.125rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none;
  background: linear-gradient(135deg, var(--amber), #ffcf4d); color: var(--ink); }
.avatar.lg { width: 2.625rem; height: 2.625rem; font-size: 1.1rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; }
.user-meta strong { font-size: .88rem; font-weight: 600; white-space: nowrap; }
.user-meta small { font-size: .75rem; color: #9fb0c6; }
.user-btn .chev { width: 1rem; height: 1rem; color: #9fb0c6; }

/* ===== dropdowns (shared by menu and user menu) =====
   The list is as wide as its longest item (width: max-content) so items are never
   cut off or scrolled sideways; it only scrolls vertically, on very short screens. */
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + .375rem); left: 0; width: max-content; min-width: 14.375rem;
  max-width: calc(100vw - 2 * var(--gutter)); max-height: calc(100dvh - var(--topbar-h) - var(--menubar-h) - 1rem);
  overflow-x: hidden; overflow-y: auto; background: var(--surface);
  color: var(--text); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: .375rem; z-index: 50; opacity: 0; visibility: hidden; transform: translateY(.5rem) scale(.98);
  transform-origin: top left; transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s; }
/* hover bridge over the gap between a menu button and its list (desktop only) */
@media (min-width: 60.01em) {
  .dd.open::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .5rem; z-index: 49; }
}
.dd.open > .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd-right, .dd-right-sm { left: auto; right: 0; transform-origin: top right; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: .625rem; width: 100%; min-height: 2.25rem;
  padding: .375rem .625rem; border-radius: .375rem; color: var(--text); background: none; border: 0; font: inherit;
  text-align: left; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, padding .15s; }
.dd-menu a .ic, .dd-menu button .ic { width: 1rem; height: 1rem; color: var(--muted); transition: color .15s; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--amber-50); text-decoration: none; padding-left: .875rem; }
.dd-menu a:hover .ic, .dd-menu a.on .ic { color: var(--amber-600); }
.dd-menu a.on { color: var(--amber-600); font-weight: 600; background: var(--amber-50); }
.dd-menu form { margin: 0; }
.dd-head { display: flex; align-items: center; gap: .625rem; padding: .5rem .625rem .75rem; margin-bottom: .375rem;
  border-bottom: 1px solid var(--line); }
.dd-head small { display: block; color: var(--muted); }
.dd-title { font-size: .74rem; font-weight: 600; color: var(--muted); padding: .375rem .625rem .25rem; }
.mega { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(12rem, max-content); gap: 0 .375rem; }
.mega-col + .mega-col { border-left: 1px solid var(--line); padding-left: .375rem; }

/* ===== horizontal menu bar ===== */
.menubar { position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 35; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.menubar-in { max-width: var(--content); margin: 0 auto; padding: 0 calc(var(--gutter) - .5rem); }
.drawer-head { display: none; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .125rem; min-height: var(--menubar-h); }
.m-link { position: relative; display: inline-flex; align-items: center; gap: .5rem; min-height: var(--menubar-h);
  padding: 0 clamp(.5rem, .2rem + .6vw, .875rem); color: var(--muted); font: 500 .92rem var(--font); background: none;
  border: 0; cursor: pointer; white-space: nowrap; transition: color .2s; }
.m-link:hover { color: var(--text); text-decoration: none; }
.m-link .ic { width: 1.0625rem; height: 1.0625rem; }
.m-link .chev { width: .9375rem; height: .9375rem; transition: transform .2s var(--ease); }
.dd.open > .m-link .chev { transform: rotate(180deg); }
.m-link::after { content: ""; position: absolute; left: .875rem; right: .875rem; bottom: -1px; height: .125rem;
  background: var(--amber); border-radius: .125rem .125rem 0 0; transform: scaleX(0); transition: transform .25s var(--ease); }
.m-link:hover::after, .dd.open > .m-link::after { transform: scaleX(.5); }
.m-link.on { color: var(--text); font-weight: 600; }
.m-link.on .ic:first-child { color: var(--amber-600); }
.m-link.on::after { transform: scaleX(1); }
/* small laptops: drop the menu icons so long labels (Malayalam, Tamil) still fit on one line */
@media (min-width: 60.01em) and (max-width: 75em) {
  .m-link { gap: .3rem; }
  .m-link > .ic:first-child { display: none; }
}
.scrim { display: none; }

/* ===== page ===== */
.main { min-height: calc(100vh - var(--topbar-h) - var(--menubar-h));
  min-height: calc(100dvh - var(--topbar-h) - var(--menubar-h)); display: flex; flex-direction: column; min-width: 0; }
.container { max-width: var(--content); width: 100%; min-width: 0; margin: 0 auto;
  padding: clamp(1rem, .7rem + 1vw, 1.375rem) var(--gutter) 2.5rem; flex: 1;
  animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(.625rem); } to { opacity: 1; transform: none; } }
.footer { max-width: var(--content); width: 100%; margin: 0 auto; padding: .875rem var(--gutter)
  calc(.875rem + env(safe-area-inset-bottom)); color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap;
  margin-bottom: 1.125rem; }
.page-head > div:first-child { min-width: 0; flex: 1 1 18rem; }
.page-head h1 { margin-bottom: .125rem; overflow-wrap: anywhere; }
.page-head p { margin: 0; max-width: 75ch; }
.datebar { display: flex; align-items: center; gap: .375rem; margin: 0; flex-wrap: wrap; max-width: 100%; }
.datebar input[type=date], .datebar input[type=month] { height: var(--tap); padding: 0 .625rem; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); font: inherit; background: var(--surface); color: var(--text); min-width: 0; max-width: 100%; }
.lock-flag { display: inline-flex; align-items: center; gap: .375rem; background: var(--ink); color: #fff;
  padding: .25rem .625rem; border-radius: 99rem; font-size: .78rem; font-weight: 600; }

/* ===== cards ===== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--pad);
  margin-bottom: var(--gap); box-shadow: var(--shadow); min-width: 0;
  transition: box-shadow .25s, transform .25s, border-color .25s; }
.panel:hover { box-shadow: 0 1rem 1.875rem -.75rem rgba(19,35,58,.14); }
.panel > h2:first-child { margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 1rem; padding: 1rem var(--pad);
  border-bottom: 1px solid var(--line); font-size: .98rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* two/three columns that fall back to one when there is no room */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--gap); }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 23.75rem) minmax(0, 1fr); gap: var(--gap); align-items: start; }

.split-wide { grid-template-columns: minmax(0, 36rem) minmax(0, 1fr); }
@media (max-width: 75em) { .split-wide { grid-template-columns: minmax(0, 1fr); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; }

/* tax invoice form */
.radio-row { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.radio-row legend { font-size: .86rem; font-weight: 600; margin-bottom: .375rem; padding: 0; }
.radio { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--tap); cursor: pointer; }
.radio input { width: 1.125rem; height: 1.125rem; accent-color: var(--ink); }
.inv-lines { display: grid; gap: .5rem; margin: .5rem 0 1rem; }
.inv-line { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(5.5rem, 1fr);
  gap: .5rem; align-items: center; }
.inv-line[hidden] { display: none; }
.inv-line .input { width: 100%; min-width: 0; }
.inv-line .err { grid-column: 1 / -1; }
.inv-line-head { font-size: .78rem; color: var(--muted); font-weight: 600; }
.inv-line .line-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-line-head .n { text-align: right; }
@media (max-width: 30em) {
  .inv-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .inv-line select { grid-column: 1 / -1; }
  .inv-line .line-amt { grid-column: 1 / -1; }
  .inv-line-head { display: none; }
}
.inv-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .75rem; padding: .25rem 0 .75rem; }
.inv-total strong { font-size: 1.35rem; }
tr.subtotal td { background: var(--head-bg); }
.tap-check { display: inline-grid; place-items: center; min-width: var(--tap); min-height: var(--tap); margin: -.5rem; cursor: pointer; }
.tap-check input { width: 1.125rem; height: 1.125rem; accent-color: var(--ink); }
.inline-select { margin: 0; } .inline-select select { min-width: 9rem; max-width: 14rem; }
.sub-h { margin: .25rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* tank dips, tanker check, dip chart */
.dip-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: var(--gap); }
.dip-cards > .panel { margin-bottom: 0; }
.dip-cards + p { margin-top: var(--gap); }
.dip-card h2 a { margin-left: auto; font-weight: 500; }
.dip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: 0 .75rem; }
.dip-out { display: flex; align-items: center; min-height: var(--tap); font-size: 1.25rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.dip-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 1fr)); gap: .5rem .75rem;
  margin: .25rem 0 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.dip-facts > div { min-width: 0; }
.dip-facts dt { font-size: .78rem; color: var(--muted); }
.dip-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chip-ok { font-size: .78rem; padding: .1875rem .5625rem; border-radius: 99rem; background: var(--green-50, #e8f6ee);
  color: var(--green); font-weight: 600; white-space: nowrap; }
.msg-inline { margin: .75rem 0 0; padding: .625rem .75rem; border-radius: var(--r-sm); font-size: .9rem; }
.msg-inline.warning { background: var(--amber-50); border: 1px solid var(--amber); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.chart-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 0 1rem; align-items: start; }
.chart-table th, .chart-table td { padding: .25rem .5rem; font-size: .85rem; font-variant-numeric: tabular-nums; }
.chart-table th { position: static; }
.chart-table tr.odd-row td { background: var(--amber-50); }

/* books of accounts */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: var(--gap); }
.tile { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .75rem; row-gap: .125rem; align-items: center;
  margin: 0; color: var(--text); text-decoration: none; min-height: 5rem; }
.tile:hover { text-decoration: none; border-color: var(--amber); }
.tile .ic { grid-row: span 2; width: 1.5rem; height: 1.5rem; color: var(--amber-600); }
.tile span { grid-column: 2; }
.books-table td.indent { padding-left: 1.75rem; }
.books-table tbody.voucher + tbody.voucher tr:first-child td { border-top: 2px solid var(--line-2); }
.books-table td[rowspan] { vertical-align: top; }
.vtype { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ledger-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); gap: var(--gap); align-items: start; }
.ledger-groups > .panel { margin-bottom: 0; }
.jv-lines { display: grid; gap: .5rem; margin: .75rem 0 1rem; }
.jv-line { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; align-items: center; }
.jv-head { font-size: .78rem; color: var(--muted); font-weight: 600; }
.jv-line .n, .jv-line input.n { text-align: right; }
.jv-total { padding-top: .5rem; border-top: 1px solid var(--line); }
@media (max-width: 30em) {
  .jv-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .jv-line select { grid-column: 1 / -1; }
  .jv-head { display: none; }
  .jv-total span { grid-column: 1 / -1; }
}
.input.w-date { min-width: 9.5rem; }

/* dashboard alerts, stock */
.alerts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .375rem; }
.alerts li a { display: flex; align-items: center; gap: .625rem; min-height: var(--tap); padding: .5rem .75rem;
  border-radius: var(--r-sm); color: var(--text); text-decoration: none; border-left: .25rem solid var(--amber); background: var(--amber-50); }
.alerts li.al-bad a { border-left-color: var(--red); background: var(--red-50); }
.alerts li a:hover { text-decoration: none; filter: brightness(.98); }
.alerts li a span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alerts li a .ic { flex: none; width: 1.125rem; height: 1.125rem; }
.tankbar { height: .625rem; border-radius: 99rem; background: var(--line); overflow: hidden; margin-bottom: .75rem; }
.tankbar span { display: block; height: 100%; background: var(--amber); border-radius: inherit; }
tr.row-low td { background: var(--red-50); }

/* KPI cards (ledger) */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); gap: var(--gap);
  margin-bottom: var(--gap); }
.ledger > div { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .875rem;
  align-items: center; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: clamp(.875rem, .7rem + .5vw, 1.125rem); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s; }
.ledger > div:hover { transform: translateY(-.1875rem); box-shadow: 0 1.125rem 1.875rem -.875rem rgba(19,35,58,.2); }
.ledger .ring { grid-row: span 3; width: 2.875rem; height: 2.875rem; border-radius: 50%; display: grid; place-items: center;
  border: .125rem solid currentColor; color: var(--blue); position: relative; }
.ledger .ring::after { content: ""; position: absolute; inset: .25rem; border-radius: 50%; background: currentColor; opacity: .12; }
.ledger .ring .ic { width: 1.25rem; height: 1.25rem; }
.ledger .k { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
/* big numbers shrink a little on narrow cards instead of being cut off */
.ledger .v { font-size: clamp(1.1rem, .95rem + .5vw, 1.32rem); font-weight: 700; letter-spacing: -.02em;
  white-space: nowrap; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ledger .v[data-count] { container-type: inline-size; }
.ledger .hero .v { white-space: nowrap; }
.ledger .small { grid-column: 2; }
.ledger .hero { background: linear-gradient(135deg, var(--ink), var(--ink-3)); border-color: var(--ink); color: #fff; }
.ledger .hero .k { color: #a9b8cc; }
.ledger .hero .v { color: var(--amber); font-size: clamp(1.1rem, .9rem + .6vw, 1.35rem); }
.ledger .hero .ring { color: var(--amber); }
.ledger .hero::before { content: ""; position: absolute; right: -2.5rem; top: -2.5rem; width: 8.75rem; height: 8.75rem;
  border-radius: 50%; background: radial-gradient(circle, rgba(242,169,0,.25), transparent 70%); }
.c-green { color: var(--green) !important; } .c-red { color: var(--red) !important; }
.c-blue { color: var(--blue) !important; } .c-violet { color: var(--violet) !important; }
.c-amber { color: var(--amber-600) !important; } .c-olive { color: var(--olive) !important; }

/* ===== tables ===== */
/* Wide tables scroll inside their card, never the whole page. */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: .625rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; background: var(--head-bg); white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; z-index: 1; }
thead th:first-child { border-top-left-radius: .375rem; } thead th:last-child { border-top-right-radius: .375rem; }
td.n, th.n { text-align: right; white-space: nowrap; }
/* short codes and names in the first columns never break mid-word ("S-1" stays on one line);
   the table scrolls inside its card instead */
.table-wrap tbody td:first-child, .table-wrap tbody td:nth-child(2) { white-space: nowrap; }
tfoot td { font-weight: 700; border-top: .125rem solid var(--text); border-bottom: 0; background: var(--surface); }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--amber-50); }
.empty { text-align: center; color: var(--muted); padding: 2.125rem .625rem !important; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.zero { color: var(--muted); }

/* ===== forms ===== */
/* plain Django form widgets (no .input class) look and size the same as .input */
.input, select.input, textarea.input,
.field :is(input:not([type=checkbox], [type=radio], [type=hidden], [type=file]), select, textarea) { width: 100%; min-width: 0; height: var(--tap); padding: 0 .75rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); font: inherit; background: var(--surface); color: var(--text);
  transition: border-color .2s, box-shadow .2s; }
/* number boxes inside tables keep their size when the table is squeezed */
.input.w-num-xs { min-width: 5rem; } .input.w-num { min-width: 5.75rem; } .input.w-num-lg { min-width: 7.5rem; }
.input.minw-sel { min-width: 5.75rem; }
.w-num-xs.input { width: 5rem; } .w-num.input { width: 5.75rem; } .w-num-lg.input { width: 7.5rem; }
.field textarea, textarea.input { height: auto; min-height: calc(var(--tap) * 1.6); padding: .5625rem .75rem; }
.input:hover { border-color: #9ca3af; }
.field :is(input, select, textarea):focus, .input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 .25rem rgba(242,169,0,.18); }
.field { margin-bottom: .875rem; min-width: 0; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .3125rem; }
.field .help { font-size: .79rem; color: var(--muted); margin-top: .25rem; }
.field .err, .errorlist { color: var(--red); font-size: .83rem; margin: .25rem 0 0; padding: 0; list-style: none; }
.field.check { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.field.check label { margin: 0; font-weight: 500; }
input[type=checkbox] { width: 1.0625rem; height: 1.0625rem; accent-color: var(--amber-600); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.125rem), 1fr)); gap: 0 1rem; }
.field-pick { margin: 0; flex: 1 1 13.75rem; max-width: 100%; }

/* ===== buttons ===== */
/* Labels wrap rather than being cut off; the height grows if they do. */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .4375rem 1.125rem; border: 1px solid transparent; border-radius: var(--r-sm);
  font: 600 .9rem/1.2 var(--font); text-align: center; max-width: 100%;
  cursor: pointer; transition: background .2s, box-shadow .2s, transform .12s, color .2s, border-color .2s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-sm { min-height: 2rem; padding: .25rem .75rem; }
.btn-primary { background: var(--amber); color: var(--ink); box-shadow: 0 .375rem 1rem -.5rem rgba(242,169,0,.9); }
.btn-primary:hover { background: #ffb81a; box-shadow: 0 .625rem 1.25rem -.5rem rgba(242,169,0,.9); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber-600); background: var(--amber-50); }
.btn-danger { background: none; color: var(--red); border: 0; min-height: 2rem; padding: .25rem .5rem; font-weight: 500; }
.btn-danger:hover { background: var(--red-50); }
.btn-wa { background: #1f8f4e; color: #fff; }
.btn-wa:hover { background: #18773f; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.55);
  animation: ripple .6s linear; pointer-events: none; }
.btn-ghost .ripple { background: rgba(242,169,0,.3); }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; min-width: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* ===== toasts ===== */
.toasts { position: fixed; top: calc(var(--topbar-h) + var(--menubar-h) + .875rem + env(safe-area-inset-top));
  right: var(--gutter); z-index: 60; display: flex; flex-direction: column; gap: .625rem;
  width: min(23.75rem, calc(100vw - 2 * var(--gutter))); }
.toast { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: .625rem; padding: .75rem .875rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: .25rem solid var(--ink);
  border-radius: var(--r); box-shadow: var(--shadow-lg); animation: toast-in .35s var(--ease) both; }
.toast.out { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(1.875rem); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(1.875rem); height: 0; padding: 0; margin: 0; } }
.t-ic { display: grid; place-items: center; width: 1.625rem; height: 1.625rem; border-radius: 50%; flex: none; }
.t-ic .ic { width: .9375rem; height: .9375rem; }
.t-msg { flex: 1; min-width: 0; font-size: .9rem; padding-top: .125rem; overflow-wrap: anywhere; }
.t-x { background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: .25rem; flex: none;
  width: 2rem; height: 2rem; margin: -.375rem -.375rem 0 0; display: grid; place-items: center; }
.t-x:hover { color: var(--text); background: var(--surface-2); }
.t-x .ic { width: .9375rem; height: .9375rem; }
.t-bar { position: absolute; left: 0; bottom: 0; height: .1875rem; width: 100%; background: currentColor; opacity: .35;
  transform-origin: left; animation: t-bar 6s linear forwards; }
.toast:hover .t-bar { animation-play-state: paused; }
@keyframes t-bar { to { transform: scaleX(0); } }
.t-success { border-left-color: var(--green); color: var(--green); } .t-success .t-ic { background: var(--green-50); }
.t-error { border-left-color: var(--red); color: var(--red); } .t-error .t-ic { background: var(--red-50); }
.t-warning { border-left-color: var(--amber); color: var(--amber-600); } .t-warning .t-ic { background: var(--amber-50); }
.t-info { border-left-color: var(--blue); color: var(--blue); } .t-info .t-ic { background: var(--blue-50); }
.toast .t-msg { color: var(--text); }
.msgs { list-style: none; padding: 0; margin: 0 0 1rem; }
.msgs li { padding: .6875rem .875rem; border-radius: var(--r); margin-bottom: .375rem; border-left: .25rem solid var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-left-width: .25rem; overflow-wrap: break-word; }
.msgs .success { border-left-color: var(--green); background: var(--green-50); }
.msgs .error { border-left-color: var(--red); background: var(--red-50); }
.msgs .warning { border-left-color: var(--amber); background: var(--amber-50); }

/* ===== back to top ===== */
.to-top { position: fixed; right: calc(var(--gutter) + env(safe-area-inset-right));
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0;
  background: var(--amber); color: var(--ink); display: grid; place-items: center; cursor: pointer; z-index: 30;
  box-shadow: 0 .625rem 1.375rem -.5rem rgba(242,169,0,.9); opacity: 0; transform: translateY(1rem) scale(.9);
  pointer-events: none; transition: all .25s var(--ease); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-.1875rem); }

/* ===== meter readings (totaliser cards) ===== */
.shift-tabs { display: inline-flex; gap: .25rem; flex-wrap: wrap; max-width: 100%; margin-bottom: 1rem; padding: .25rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 1.5rem; }
.shift-tabs a { display: inline-flex; align-items: center; min-height: 2.25rem; padding: .375rem 1rem; border-radius: 99rem;
  color: var(--muted); font-weight: 500; font-size: .9rem; transition: background .2s, color .2s; }
.shift-tabs a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.shift-tabs a.on { background: var(--ink); color: #fff; box-shadow: 0 .375rem .875rem -.5rem rgba(19,35,58,.8); }
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.625rem), 1fr)); gap: var(--gap); }
.meter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(.75rem, .6rem + .5vw, 1rem);
  box-shadow: var(--shadow); min-width: 0; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.meter:hover { transform: translateY(-.125rem); box-shadow: 0 1rem 1.75rem -.875rem rgba(19,35,58,.22); }
.meter:focus-within { border-color: var(--amber); box-shadow: 0 0 0 .25rem rgba(242,169,0,.15), var(--shadow); }
.meter.has-error { border-color: var(--red); box-shadow: 0 0 0 .1875rem var(--red-50); }
.meter.saved { border-top: .1875rem solid var(--green); }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; margin-bottom: .75rem; gap: .25rem .5rem; }
.meter-head .nz { font-weight: 700; font-size: 1.05rem; }
.meter-head .prod { color: var(--muted); font-size: .84rem; text-align: right; margin-left: auto; }
.lcd-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
.lcd { min-width: 0; }
.lcd label { display: block; font-size: .76rem; color: var(--muted); margin-bottom: .1875rem; }
.lcd input { width: 100%; min-width: 0; min-height: var(--tap); background: var(--lcd); color: var(--lcd-text);
  border: .125rem solid #26342c; border-radius: .4375rem; padding: .5rem .625rem;
  font-family: var(--meter); font-size: clamp(.95rem, .85rem + .4vw, 1.1rem); letter-spacing: .04em; text-align: right;
  text-shadow: 0 0 .5rem rgba(255,197,61,.45); transition: border-color .2s, box-shadow .2s; }
.lcd input:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 .25rem rgba(242,169,0,.2); }
.lcd input[readonly] { color: #b9a46a; text-shadow: none; }
.meter-foot { display: grid; grid-template-columns: minmax(4.5rem, 6rem) minmax(0, 1fr); gap: .625rem; margin-top: .625rem; }
.meter-out { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .75rem;
  padding-top: .75rem; border-top: 1px dashed var(--line-2); }
.meter-out .l { font-family: var(--meter); font-size: 1.02rem; }
.meter-out .a { font-weight: 700; }
.meter .err { color: var(--red); font-size: .84rem; margin-top: .375rem; }
.meter-total { position: sticky; bottom: calc(.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(135deg, var(--ink), var(--ink-3)); color: #fff;
  border-radius: var(--r-lg); padding: .875rem 1.125rem; margin-top: 1.125rem; display: flex; justify-content: space-between;
  align-items: center; gap: .75rem; flex-wrap: wrap; box-shadow: var(--shadow-lg); }
.meter-total > * { min-width: 0; }
.meter-total .big { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); font-weight: 700; color: var(--amber); }

/* ===== day checklist ===== */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { position: relative; display: grid; grid-template-columns: 2.375rem minmax(0, 1fr) auto; gap: .5rem .75rem;
  align-items: center; padding: .75rem 0; counter-increment: step; }
.steps li > :last-child { justify-self: end; }
.steps li + li { border-top: 1px solid var(--line); }
.steps li::before { content: counter(step); width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; background: var(--surface-2); color: var(--muted); border: .125rem solid var(--line-2);
  transition: all .3s var(--ease); }
.steps li.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.steps li.part::before { background: var(--amber-50); border-color: var(--amber); color: var(--amber-600); }
.steps .what { font-weight: 600; }
.steps .state { font-size: .84rem; color: var(--muted); }

/* ===== tank gauges ===== */
.tanks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.375rem), 1fr)); gap: 1rem; }
.tank { text-align: center; min-width: 0; }
.tank-body { height: 8.25rem; width: 5.75rem; margin: 0 auto .625rem; border: .1875rem solid var(--ink);
  border-radius: .75rem .75rem 1.125rem 1.125rem; position: relative; overflow: hidden; background: var(--surface-2); }
:root[data-theme="dark"] .tank-body { border-color: #6d84a6; }
.tank-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--amber);
  transition: height 1.4s var(--ease); }
.tank-fill::before { content: ""; position: absolute; left: -50%; top: -.5rem; width: 200%; height: 1rem;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.28) 0 40%, transparent 41%) 0 0/1.75rem 1rem repeat-x;
  animation: wave 3s linear infinite; }
@keyframes wave { to { transform: translateX(1.75rem); } }
.tank-pct { position: absolute; inset: 0; display: grid; place-items: center; }
.tank-pct span { font-weight: 800; font-size: .85rem; color: var(--ink); background: rgba(255,255,255,.88);
  padding: .125rem .5rem; border-radius: 99rem; box-shadow: 0 .125rem .375rem rgba(0,0,0,.15); }

/* ===== chart (SVG line) ===== */
.chart { position: relative; }
.chart svg { width: 100%; height: 12.5rem; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart .area { fill: url(#chart-fill); opacity: 0; animation: fade-in .8s .5s forwards; }
.chart .line { fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; }
.chart .dot { fill: var(--surface); stroke: var(--amber-600); stroke-width: 2; transition: r .15s; cursor: pointer; }
.chart .dot:hover, .chart .dot.today { r: 6; fill: var(--amber); }
.chart .lbl { font-size: .6875rem; fill: var(--muted); }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .78rem; padding: .3125rem .5625rem;
  border-radius: .375rem; transform: translate(-50%, -130%); white-space: nowrap; opacity: 0; transition: opacity .15s;
  box-shadow: var(--shadow-lg); }
.chart-tip.show { opacity: 1; }
@keyframes fade-in { to { opacity: 1; } }
.bars { display: none; } .bar-labels { display: none; }

/* ===== settlement ===== */
.calc { width: 100%; }
.calc td { border: 0; padding: .375rem 0; }
.calc td:first-child { padding-right: .75rem; }
.calc tbody tr:hover, .calc tr:hover { background: transparent; }
.calc td.n { font-weight: 600; }
.calc tr.sub td { border-top: 1px solid var(--line); padding-top: .625rem; }
.calc tr.result td { border-top: .125rem solid var(--text); font-size: 1.1rem; font-weight: 700; padding-top: .75rem; }
.denoms td { padding: .375rem .5rem; }
.denoms th { white-space: normal; }
.denoms input { width: 6rem; max-width: 100%; height: var(--tap); text-align: right; padding: 0 .625rem; border: 1px solid var(--line-2);
  border-radius: .375rem; font: inherit; background: var(--surface); color: var(--text); }
.denoms input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 .1875rem rgba(242,169,0,.18); }
.verdict { padding: var(--pad); border-radius: var(--r); margin-bottom: var(--gap); border: 1px solid var(--line);
  animation: rise .5s var(--ease) both; overflow-wrap: break-word; }
.verdict.short { background: var(--red-50); border-left: .3125rem solid var(--red); }
.verdict.excess { background: var(--green-50); border-left: .3125rem solid var(--green); }
.verdict.exact { background: var(--blue-50); border-left: .3125rem solid var(--ink); }
.verdict .big { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); font-weight: 800; letter-spacing: -.02em; }
.wa-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; background: var(--surface-2);
  padding: .75rem; border-radius: .375rem; margin: 0 0 .75rem; }

/* ===== staff ===== */
.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: inline-flex; align-items: center; justify-content: center; min-height: 2rem; min-width: 2rem;
  padding: .25rem .6875rem; border: 1px solid var(--line-2); border-radius: 99rem; cursor: pointer; font-size: .82rem;
  background: var(--surface); user-select: none; transition: all .15s; }
.seg label:hover { border-color: var(--amber); }
.seg input:focus-visible + label { outline: .125rem solid var(--amber); outline-offset: 1px; }
.seg input:checked + label { transform: scale(1.04); }
.seg input:checked + label.st-P { background: var(--green); border-color: var(--green); color: #fff; }
.seg input:checked + label.st-H { background: #a07a00; border-color: #a07a00; color: #fff; }
.seg input:checked + label.st-O { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.seg input:checked + label.st-L { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg input:checked + label.st-A { background: var(--red); border-color: var(--red); color: #fff; }
.seg input:checked + label.st-x { background: var(--surface-2); }
.register th.d, .register td.d { padding: .4375rem .125rem; text-align: center; min-width: 1.625rem; }
.register th.sun { color: var(--red); }
.mk { display: inline-block; width: 1.375rem; height: 1.375rem; line-height: 1.375rem; border-radius: .3125rem; font-size: .74rem;
  font-weight: 700; text-align: center; }
.mk-P { background: var(--green-50); color: var(--green); } .mk-H { background: var(--amber-100); color: #8a6d00; }
.mk-O { background: #e3e8f0; color: var(--ink-2); } .mk-L { background: var(--blue-50); color: var(--blue); }
.mk-A { background: var(--red-50); color: var(--red); } .mk-x { color: var(--line-2); }
.slip-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding-bottom: .75rem; margin-bottom: .75rem;
  border-bottom: .125rem solid var(--ink); }
.slip-sign { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem 1rem; margin-top: 3.25rem;
  font-size: .84rem; color: var(--muted); }
.slip-sign span { border-top: 1px solid var(--muted); padding-top: .25rem; min-width: min(9.375rem, 100%); }

/* ===== login ===== */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: linear-gradient(150deg, var(--ink) 30%, var(--ink-3));
  color: #fff; padding: clamp(1.25rem, .5rem + 3vw, 3rem); display: flex; flex-direction: column; justify-content: space-between;
  gap: 1.5rem; min-width: 0; }
.login-art::after { content: ""; position: absolute; right: -7.5rem; bottom: -7.5rem; width: 26.25rem; height: 26.25rem;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(242,169,0,.28), transparent 65%); animation: glow 6s ease-in-out infinite alternate; }
@keyframes glow { to { transform: translate(-2.5rem, -1.875rem) scale(1.1); } }
.login-art h1 { font-size: clamp(1.5rem, 1rem + 2vw, 2.2rem); max-width: 15ch; font-weight: 700; letter-spacing: -.03em;
  position: relative; z-index: 1; }
.login-art p, .login-art > div { position: relative; z-index: 1; }
.login-art .lead { color: #9fb0c6; max-width: 42ch; }
.login-art .lcd-demo { font-family: var(--meter); background: var(--lcd); color: var(--lcd-text); padding: .875rem 1.125rem;
  border-radius: .625rem; font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem); letter-spacing: .06em; display: inline-block;
  max-width: 100%; border: .1875rem solid #26342c; text-shadow: 0 0 .75rem rgba(255,197,61,.6); }
.login-form { position: relative; display: grid; place-items: center; align-content: center; gap: 1.25rem;
  padding: clamp(1.25rem, .8rem + 2vw, 2rem); min-width: 0; }
.login-form > form { width: 100%; max-width: 22.5rem; animation: rise .5s var(--ease) both; }
.login-form .btn { width: 100%; min-height: 2.75rem; }

/* ===== dashboard charts ===== */
:root {
  --c-petrol: #eda100; --c-diesel: #2a78d6; --c-aqua: #1baf7a; --c-violet: #6250d6; --c-orange: #eb6834;
  --c-excess: #2a78d6; --c-short: #e34948;
}
:root[data-theme="dark"] {
  --c-petrol: #c98500; --c-diesel: #3987e5; --c-aqua: #199e70; --c-violet: #9085e9; --c-orange: #d95926;
  --c-excess: #3987e5; --c-short: #e66767;
}
.c-orange { color: var(--c-orange) !important; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.dash > .panel { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.g-8 { grid-column: span 8; } .g-4 { grid-column: span 4; }
.panel-h { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 1rem;
  padding: .75rem var(--pad); border-bottom: 1px solid var(--line); min-height: 3.5rem; }
.panel-h h2 { margin: 0 auto 0 0; font-size: .98rem; display: flex; align-items: center; gap: .5rem; min-width: 0; }
.seg-tabs { display: inline-flex; flex-wrap: wrap; padding: .1875rem; gap: .125rem; background: var(--surface-2); border-radius: 1.25rem; }
.seg-tabs button, .seg-tabs a { text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; border: 0; background: none; font: 500 .8rem var(--font); color: var(--muted); min-height: 1.875rem;
  padding: .3125rem .75rem; border-radius: 99rem; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.seg-tabs button:hover, .seg-tabs a:hover { color: var(--text); }
.seg-tabs button.on, .seg-tabs a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px .1875rem rgba(19,35,58,.15); }
:root[data-theme="dark"] .seg-tabs button.on, :root[data-theme="dark"] .seg-tabs a.on { background: var(--ink-3); }

.cbox { position: relative; width: 100%; min-height: 12.5rem; }
.cbox svg { display: block; width: 100%; height: auto; overflow: visible; }
/* SVG text sizes are in chart units (the chart scales as a whole), not CSS pixels */
.cbox .axis text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.cbox .axis .gl { stroke: var(--line); stroke-dasharray: 3 4; }
.cbox .axis .base { stroke: var(--line-2); }
.cbox .nodata { fill: var(--muted); font-size: 13px; }
.cbox .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity .15s; }
.cbox .cross.on { opacity: .7; }
.cbox .hdot { opacity: 0; transition: opacity .15s; pointer-events: none; }
.cbox .hdot.on { opacity: 1; }
.cbox .bar { transform-box: fill-box; transform-origin: bottom; transition: opacity .15s, filter .15s; cursor: pointer; outline: none; }
.cbox .bar:hover, .cbox .bar:focus { filter: brightness(1.12) saturate(1.1); }
.cbox:hover .bar:not(:hover) { opacity: .75; }
.cbox .vlabel { font-size: 11px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.cbox .unsettled { fill: var(--line-2); }
.cbox rect[tabindex]:focus { outline: none; }
.ctip { position: absolute; z-index: 5; pointer-events: none; min-width: 7.5rem; max-width: min(18rem, 90vw); background: var(--ink);
  color: #fff; border-radius: .5rem; padding: .5rem .625rem; font-size: .8rem; box-shadow: var(--shadow-lg); opacity: 0;
  transform: translateY(.25rem); transition: opacity .12s, transform .12s; }
.ctip.show { opacity: 1; transform: none; }
.ctip-h { color: #a9b8cc; font-size: .74rem; margin-bottom: .25rem; }
.ctip-r { display: flex; align-items: center; gap: .4375rem; white-space: nowrap; }
.ctip-r i { width: .75rem; height: .1875rem; border-radius: .125rem; }
.ctip-r span { color: #c9d3e0; }
.legend { display: flex; flex-wrap: wrap; gap: .375rem 1.125rem; margin-top: .625rem; font-size: .84rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4375rem; }
.legend i { width: .625rem; height: .625rem; border-radius: .1875rem; flex: none; }
.legend i.line { width: 1rem; height: .1875rem; border-radius: .125rem; }
.legend b { color: var(--text); font-weight: 600; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr)); gap: .75rem;
  margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--line); }
.mini-stats div { display: flex; flex-direction: column; min-width: 0; }
.mini-stats span { font-size: .78rem; color: var(--muted); }
.mini-stats b { font-size: 1.05rem; overflow-wrap: anywhere; }
.mini-stats small { font-size: .76rem; color: var(--muted); }

.stk-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .5rem; margin-bottom: .875rem; }
.stk-total b { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem); letter-spacing: -.02em; }
.stk-total span { color: var(--muted); font-size: .85rem; }
.stk-bar { display: flex; gap: .125rem; height: 2.5rem; border-radius: .5rem; overflow: hidden; background: var(--surface-2); }
.stk-seg { flex: 0 0 0; display: grid; place-items: center; min-width: 0; transition: flex-basis .9s var(--ease), filter .15s; }
.stk-seg:hover { filter: brightness(1.1); }
.stk-seg span { color: #fff; font-size: .78rem; font-weight: 700; text-shadow: 0 1px .125rem rgba(0,0,0,.35); }
.stk-list { margin-top: 1rem; display: flex; flex-direction: column; }
.stk-li { display: grid; grid-template-columns: .75rem minmax(0, 1fr) auto 3.25rem; align-items: center; gap: .625rem;
  padding: .625rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.stk-li:last-child { border-bottom: 0; }
.stk-li i { width: .75rem; height: .75rem; border-radius: .25rem; }
.stk-li small { color: var(--muted); text-align: right; }

.hbars { display: flex; flex-direction: column; gap: .75rem; }
.hb-row { outline: none; border-radius: .375rem; }
.hb-row:focus-visible { outline: .125rem solid var(--amber); outline-offset: .25rem; }
/* long product names wrap instead of being cut off */
.hb-top { display: flex; justify-content: space-between; align-items: baseline; gap: .625rem; font-size: .88rem; margin-bottom: .3125rem; }
.hb-top span { min-width: 0; overflow-wrap: anywhere; }
.hb-top b { flex: none; white-space: nowrap; }
.hb-track { height: .5rem; border-radius: 99rem; background: var(--surface-2); overflow: hidden; }
.hb-fill { height: 100%; width: 0; border-radius: 99rem; transition: width 1s var(--ease), filter .15s; }
.hb-row:hover .hb-fill { filter: brightness(1.12); }
.hb-row small { font-size: .76rem; color: var(--muted); }
.nodata-p { color: var(--muted); text-align: center; padding: 1.875rem 0; margin: 0; }
.low-stock { margin-top: 1rem; padding-top: .75rem; border-top: 1px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: .375rem; }
.low-stock > div { width: 100%; display: flex; align-items: center; gap: .375rem; }
.low-stock .ic { width: .9375rem; height: .9375rem; }
.chip { font-size: .78rem; padding: .1875rem .5625rem; border-radius: 99rem; background: var(--surface-2); color: var(--muted); }
.chip-low { font-size: .78rem; padding: .1875rem .5625rem; border-radius: 99rem; background: var(--red-50); color: var(--text); }
.chip-low b { color: var(--red); }
.tank-fill.diesel { background: var(--c-diesel); }
.stk-2 { margin-top: 1.125rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.stk-2 .stk-total b { font-size: 1rem; } .stk-2 .stk-total { margin-bottom: .625rem; }
.stk-2 .stk-bar { height: 1.75rem; }

/* ===== language switch ===== */
.lang-btn { width: auto; padding: 0 .625rem; gap: .375rem; display: inline-flex; align-items: center; }
.lang-code { font: 700 .72rem var(--font); letter-spacing: .03em; }
.lang-menu { min-width: 12.5rem; }
.lang-menu button { justify-content: flex-start; }
.lang-tag { display: inline-grid; place-items: center; width: 1.625rem; height: 1.25rem; border-radius: .25rem; font: 700 .66rem var(--font);
  background: var(--surface-2); color: var(--muted); flex: none; }
.lang-menu button.on .lang-tag { background: var(--amber); color: var(--ink); }
.lang-check { margin-left: auto; color: var(--green) !important; }
.login-lang { position: absolute; top: 1.25rem; right: 1.5rem; left: 1.5rem; display: flex; flex-wrap: wrap; gap: .25rem;
  justify-content: flex-end; }
.login-lang form { margin: 0; width: auto; max-width: none; animation: none; }
.login-lang button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99rem;
  min-height: 2rem; padding: .25rem .6875rem; font: 500 .82rem var(--font); cursor: pointer; transition: all .15s; }
.login-lang button:hover { border-color: var(--amber); color: var(--text); }
.login-lang button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
:lang(ml), :lang(ta), :lang(kn), :lang(te), :lang(hi) { line-height: 1.6; }

/* meter reading: second attendant on the same nozzle */
.meter .part { font-weight: 500; color: var(--muted); font-size: .85em; }
.split-btn { margin-top: .625rem; width: 100%; min-height: 2.25rem; display: inline-flex; align-items: center; justify-content: center;
  gap: .375rem; background: none; border: 1px dashed var(--line-2); border-radius: .5rem; padding: .4375rem .625rem;
  color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; }
.split-btn:hover { color: var(--ink); border-color: var(--ink-3, var(--muted)); }
.split-btn svg { width: .875rem; height: .875rem; }

/* ======================================================================
   Responsive
   ====================================================================== */

/* Touch: 44px targets everywhere a finger lands. */
@media (pointer: coarse), (max-width: 64em) {
  .dd-menu a, .dd-menu button, .shift-tabs a, .split-btn, .station-chip, .station-switch,
  .station-switch select, .seg-tabs button, .login-lang button, .btn-sm, .btn-danger { min-height: var(--tap); }
  .seg label, .seg-tabs button, .seg-tabs a { min-height: var(--tap); min-width: var(--tap); }
  .brand { min-width: var(--tap); }
  summary { display: flex; align-items: center; min-height: var(--tap); min-width: var(--tap); cursor: pointer; overflow-wrap: anywhere; }
  .t-x { width: var(--tap); height: var(--tap); }
  /* links inside text and table cells get a full-height hit area */
  td a:not(.btn), p a:not(.btn), .page-head a:not(.btn) { display: inline-flex; align-items: center;
    min-height: var(--tap); min-width: var(--tap); }
  .field.check label, label.flex-row { min-height: var(--tap); min-width: var(--tap); display: inline-flex; align-items: center; }
  input[type=checkbox] { width: 1.375rem; height: 1.375rem; }
}

/* Large tablets / small laptops: let the menu breathe. */
@media (max-width: 75em) {
  .user-meta, .station-chip span { display: none; }
}
@media (max-width: 75em) { .g-4 { grid-column: span 6; } .g-8 { grid-column: span 12; } }

/* Below 960px the menu becomes a slide-out drawer. */
@media (max-width: 60em) {
  .menu-toggle { display: grid; }
  .search { display: none; }
  .station-chip, .station-switch { display: none; }
  .lang-code { display: none; }
  .lang-btn { padding: 0; width: var(--tap); justify-content: center; }
  .menubar { position: fixed; top: 0; bottom: 0; left: 0; width: min(19.375rem, 86vw); z-index: 70; border: 0;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    transform: translateX(-102%); transition: transform .3s var(--ease), visibility 0s linear .3s;
    overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow-lg); visibility: hidden; }
  .menubar.open { transform: none; visibility: visible; transition: transform .3s var(--ease), visibility 0s; }
  .menubar-in { padding: 0 .75rem 1rem; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(8,15,26,.5); z-index: 65; opacity: 0;
    pointer-events: none; transition: opacity .3s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: var(--topbar-h); padding: 0 .25rem;
    border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
  .drawer-head .brand { color: var(--text); } .drawer-head .tb-btn { color: var(--muted); }
  .drawer-head .tb-btn:hover { background: var(--surface-2); color: var(--text); }
  .menu { flex-direction: column; align-items: stretch; min-height: 0; gap: 0; }
  .m-link { width: 100%; min-height: 2.875rem; border-radius: .5rem; padding: 0 .75rem; white-space: normal; text-align: left; }
  .m-link::after { display: none; }
  .m-link.on { background: var(--amber-50); }
  .m-link .chev { margin-left: auto; }
  .dd-menu { position: static; box-shadow: none; border: 0; padding: 0 0 .375rem 1.125rem; opacity: 1; visibility: visible;
    transform: none; display: none; min-width: 0; max-width: none; max-height: none; overflow: visible; background: transparent; }
  .dd.open > .dd-menu { display: block; animation: rise .25s var(--ease); }
  .dd-menu a, .dd-menu button { white-space: normal; }
  .mega { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); grid-auto-columns: auto; }
  .mega-col + .mega-col { border: 0; padding: 0; }
  .user-dd .dd-menu { position: absolute; display: block; opacity: 0; visibility: hidden; background: var(--surface);
    border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: .375rem; transform: translateY(.5rem);
    max-width: calc(100vw - 2 * var(--gutter)); }
  .user-dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; animation: none; }
  /* language list opens as a normal dropdown from the top bar */
  .tb-right .dd:not(.user-dd) .dd-menu { position: absolute; display: block; opacity: 0; visibility: hidden;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: .375rem;
    transform: translateY(.5rem); max-width: calc(100vw - 2 * var(--gutter)); }
  .tb-right .dd:not(.user-dd).open .dd-menu { opacity: 1; visibility: visible; transform: none; animation: none; }
  .main { min-height: calc(100vh - var(--topbar-h)); min-height: calc(100dvh - var(--topbar-h)); }
  .toasts { top: calc(var(--topbar-h) + .75rem + env(safe-area-inset-top)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: minmax(0, 1fr); }
  .login-lang { position: static; justify-content: center; }
}

/* Tablets and phones */
@media (max-width: 47.99em) {
  .dash { grid-template-columns: minmax(0, 1fr); } .g-4, .g-8 { grid-column: auto; }
  .ledger { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.25rem), 1fr)); }
  .ledger .hero { grid-column: 1 / -1; }
  .ledger > div { grid-template-columns: minmax(0, 1fr); }
  .ledger .ring { display: none; }
  .ledger .small { grid-column: 1; }
  .fullscreen-btn, #fullscreen { display: none; }   /* phones manage full screen themselves */
  .page-head { align-items: stretch; }
  .page-head > .actions, .page-head > .datebar { width: 100%; }
  .datebar input[type=date], .datebar input[type=month] { flex: 1 1 9rem; }
  .report-filter > .btn, .report-filter .field-pick { flex: 1 1 100%; }
}

/* Phones */
@media (max-width: 30em) {
  /* shift tabs: one row that scrolls sideways inside itself */
  .shift-tabs { display: flex; flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none;
    border-radius: var(--r-lg); }
  .shift-tabs::-webkit-scrollbar { display: none; }
  .shift-tabs a { flex: 1 0 auto; justify-content: center; white-space: nowrap; border-radius: var(--r); }
  /* day navigation: ‹ date › on one line */
  .daynav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .daynav .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .daynav .btn { padding-inline: .625rem; min-width: var(--tap); }
  .daynav .datebar { flex-wrap: nowrap; }
  .meter-total { padding: .625rem .875rem; gap: .5rem; }
  .steps li { grid-template-columns: 2.375rem minmax(0, 1fr); }
  .steps li > :nth-child(2) { grid-column: 2; justify-self: start; }
  .meter-total { flex-direction: column; align-items: stretch; text-align: center; }
  .meter-total .btn { width: 100%; }
  .denoms input { width: 100%; }
  .stk-li { grid-template-columns: .75rem minmax(0, 1fr) auto; }
  .stk-li small { grid-column: 2 / -1; text-align: left; }
}
/* Phones up to 415px: the top bar has room for the logo and its buttons, not the name */
@media (max-width: 25.99em) {
  .topbar-in > .brand .brand-name { display: none; }
}
@media (max-width: 22.49em) {
  .drawer-head .brand-name { display: none; }
  .topbar-in { gap: .375rem; }
  .tb-right { gap: .125rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .topbar, .menubar, .no-print, .datebar, .msgs, .toasts, .to-top, .footer, .nprogress { display: none !important; }
  html { font-size: 100%; }
  body { background: #fff; } .container { animation: none; padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; box-shadow: none; } .panel > h2:first-child { margin: 0 0 .625rem; padding: 0; }
  .grid-2 { display: block; } .register td.d, .register th.d { min-width: 0; }
  .table-wrap { overflow: visible; }
}

/* dashboard: "View all" links and the dues list */
.panel-h .more { margin-left: auto; display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--accent-ink, var(--text));
  background: var(--surface-2); border-radius: 99rem; padding: .3125rem .75rem; text-decoration: none; white-space: nowrap; min-height: 1.875rem; transition: background .2s; }
.panel-h .more:hover { background: var(--amber-50, var(--surface-2)); }
.panel-h .more svg { width: .9rem; height: .9rem; }
.panel-h h2 + .muted + .more, .panel-h h2 + .more { margin-left: auto; }
.dues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.dues li a { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; align-items: center; gap: .625rem; padding: .5rem .5rem; border-radius: .625rem; text-decoration: none; color: inherit; }
.dues li a:hover { background: var(--surface-2); }
.dues .rank { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--surface-2); color: var(--muted); font: 700 .75rem var(--font); display: grid; place-items: center; }
.dues li:first-child .rank { background: var(--c-orange); color: #fff; }
.dues .who { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.dues .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dues .who small { color: var(--muted); font-size: .72rem; }
.dues .bar { display: block; height: .25rem; border-radius: 99rem; background: var(--surface-2); overflow: hidden; }
.dues .bar i { display: block; height: 100%; background: var(--c-orange); border-radius: 99rem; }
.dues .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.dues .empty { padding: 1rem .5rem; }
.dues-total { display: flex; justify-content: space-between; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); font-weight: 600; }

/* ---------------------------------------------------------------- help chat */
.assist-fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: inline-flex; align-items: center; gap: .4rem;
  border: 0; border-radius: 99rem; padding: .7rem 1rem; background: var(--ink); color: #fff; font: 600 .9rem var(--font);
  box-shadow: 0 .75rem 1.5rem -.5rem rgba(19,35,58,.45); cursor: pointer; min-height: var(--tap, 2.75rem); }
.assist-fab .ic { width: 1.2rem; height: 1.2rem; color: var(--amber); }
.assist-panel { position: fixed; right: 1rem; bottom: 4.75rem; z-index: 61; width: min(24rem, calc(100vw - 2rem));
  height: min(34rem, calc(100vh - 7rem)); display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 1.5rem 3rem -1rem rgba(19,35,58,.35); overflow: hidden; }
.assist-panel[hidden] { display: none; }
.assist-panel header { display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; background: var(--ink); color: #fff; }
.assist-panel header small { display: block; color: #a9b8cc; font-size: .75rem; }
.assist-panel header div { flex: 1; min-width: 0; }
.assist-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--amber); color: var(--ink); display: grid; place-items: center; }
.assist-close { background: none; border: 0; color: #fff; cursor: pointer; min-width: 2.5rem; min-height: 2.5rem; }
.assist-thread { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .55rem; background: var(--surface-2); }
.assist-msg { max-width: 85%; padding: .55rem .75rem; border-radius: .9rem; line-height: 1.45; white-space: pre-wrap; font-size: .92rem; }
.assist-msg.assistant { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: .25rem; }
.assist-msg.user { background: var(--amber); color: var(--ink); align-self: flex-end; border-bottom-right-radius: .25rem; }
.assist-msg.typing { color: var(--muted); font-style: italic; }
.assist-msg.error { border-color: var(--red); color: var(--red); }
.assist-msg.focus { outline: 2px solid var(--amber); }
.assist-rate { display: flex; gap: .25rem; margin-top: .35rem; }
.assist-rate button { border: 1px solid var(--line); background: var(--surface); border-radius: 99rem; padding: .1rem .5rem; cursor: pointer; }
.assist-rate button.on { background: var(--amber-50); border-color: var(--amber); }
.assist-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); background: var(--surface); }
.assist-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: .7rem; padding: .55rem .7rem;
  font: .95rem var(--font); background: var(--surface); color: var(--text); max-height: 7rem; }
.assist-form .btn { min-width: 2.75rem; }
.assist-test-out { margin-top: .75rem; padding: .75rem; border: 1px dashed var(--line); border-radius: .6rem; white-space: pre-wrap; }
.console-nav { margin-top: .25rem; }
.danger-zone { border-color: var(--red); }
@media print { .assist-fab, .assist-panel { display: none !important; } }
/* the help bubble takes the bottom-right corner; back-to-top sits just above it */
body:has(.assist-fab) .to-top { bottom: calc(var(--gutter) + 3.75rem + env(safe-area-inset-bottom)); }
.assist-fab { right: calc(var(--gutter) + env(safe-area-inset-right)); bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); }
.assist-panel { right: calc(var(--gutter) + env(safe-area-inset-right)); }
