/* ==========================================================================
   Hotel Parking System - design system
   One stylesheet for the whole application (print tickets use print.css).
     1. Tokens        4. Buttons         7. Data display (tables, badges, KPI, charts)
     2. Base          5. Forms           8. Feedback (alerts, modal, empty, loading)
     3. App shell     6. Surfaces        9. Pages        10. Responsive
   Rules: light neutral background, white surfaces, charcoal text, ONE accent colour, thin borders,
   very subtle shadows, no gradients, no animation beyond a tiny loading spinner.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #f0f2f5;
  --text: #1c2430;          /* charcoal */
  --text-2: #475161;
  --muted: #687384;         /* 4.7:1 on white */
  --faint: #98a1ae;
  --border: #e4e7ec;
  --border-strong: #d2d7de;
  --row-line: #eef0f3;

  --accent: #24527a;        /* the single accent colour (deep hotel blue) */
  --accent-hover: #1c4466;
  --accent-soft: #ebf1f7;
  --accent-line: #d3e0ec;
  --accent-text: #1d4568;

  --ok: #2d6047;  --ok-soft: #eaf4ee;  --ok-line: #cfe5d8;
  --warn: #7a5a14; --warn-soft: #fbf4e4; --warn-line: #efdfb6;
  --danger: #8e3535; --danger-soft: #f9eded; --danger-line: #ebcdcd;

  --side-bg: #18212c;       /* sidebar: dark charcoal */
  --side-text: #b9c2ce;
  --side-muted: #7d8897;
  --side-hover: #212c39;
  --side-active: #26384b;

  --c-1: #24527a; --c-2: #7ea4c6; --c-3: #6d8f72; --c-4: #c3a26c; --c-5: #a4abb6;  /* chart series */

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 1px rgba(16, 24, 40, .02);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", ui-monospace, Consolas, "Courier New", monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --control-h: 38px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; color: var(--text); }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
small, .small { font-size: 12.5px; }
ul, ol { margin: 0 0 var(--space-3); padding-left: 20px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mono, .mono-id { font-family: var(--mono); font-size: 12.5px; }
.mono-id { color: var(--text-2); letter-spacing: -.01em; }
.inline { display: inline; }
.m-0 { margin: 0; }
.icon { flex-shrink: 0; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: var(--space-3); top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: var(--space-3); color: #fff; }

/* ---------- 3. App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text);
}
.brand { display: flex; align-items: center; gap: var(--space-3); min-height: var(--topbar-h); padding: 0 var(--space-5); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--accent); color: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { color: #fff; font-weight: 700; font-size: 14.5px; letter-spacing: .06em; overflow-wrap: anywhere; }
.brand-sub { color: var(--side-muted); font-size: 11.5px; }
.sidebar { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-4); }
.nav-group { padding: var(--space-4) var(--space-3) 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 7px var(--space-3); margin: 1px 0;
  border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; font-size: 13.5px;
}
.nav-link .icon { color: var(--side-muted); }
.nav-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-link.is-active .icon { color: #fff; }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: #8fb3d6; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: var(--space-3) var(--space-4); border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-user .avatar { background: var(--side-active); color: #fff; }
.sidebar-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user-name { color: #fff; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: var(--side-muted); font-size: 11.5px; }
.sidebar-logout { margin: 0; }
.sidebar-icon-link { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--side-muted); }
.sidebar-icon-link:hover, .sidebar-icon-link.is-active { background: var(--side-hover); color: #fff; }
.sidebar-logout .icon-btn { width: 32px; height: 32px; border-color: transparent; background: transparent; color: var(--side-muted); }
.sidebar-logout .icon-btn:hover { background: var(--side-hover); color: #fff; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4);
  min-height: var(--topbar-h); padding: 0 var(--space-6); background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-strong); }
.topbar-user { display: flex; align-items: center; gap: var(--space-3); }
.user-menu { position: relative; }
.user-menu > summary { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface-2); border-color: var(--border); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 13px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); }
.user-role { font-size: 11px; color: var(--muted); }
.user-menu .menu-pop { width: 220px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head strong { display: block; font-size: 13px; }
.menu-head span { font-size: 12px; color: var(--muted); }
.logout-form { margin: 0; }
.icon-btn.menu-btn { display: none; }  /* shown only when the sidebar collapses (section 10) */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(16, 24, 40, .45); }
.mobile-nav { display: none; }  /* phones only (section 10) */
.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: var(--space-5) var(--space-6) var(--space-6); }
.content:focus { outline: none; }

/* page header: subtitle + page actions, under the top bar */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); margin-bottom: var(--space-4); }
.page-sub { margin: 0; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.stack > * + * { margin-top: var(--space-4); }
.stack-top { margin-top: var(--space-4); }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--control-h); padding: 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-solid-danger:hover { background: #742b2b; color: #fff; }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--control-h); height: var(--control-h); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ---------- 5. Forms ---------- */
label { font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; height: var(--control-h); padding: 6px 11px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { height: auto; min-height: 84px; resize: vertical; }
select { cursor: pointer; padding-right: 30px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #bcc3cd; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }
input[readonly] { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
input.upper { text-transform: uppercase; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.field-error { margin: 0; font-size: 12px; font-weight: 500; color: var(--danger); }
.field-error::before { content: "\26A0\FE0E  "; } /* warning sign: error is never colour-only */
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.inline-form .field { flex: 1 1 200px; }
.inline-form .field.narrow { flex: 0 1 140px; }
.inline-form .check { height: var(--control-h); }
.actions-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.readonly-value { display: flex; align-items: center; min-height: var(--control-h); padding: 0 11px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-weight: 500; }

/* compact controls (toolbars) */
select.select-compact, input.input-compact { width: auto; height: 34px; padding: 4px 10px; font-size: 13px; }
select.select-compact { padding-right: 28px; max-width: 220px; }
input.input-compact[type="search"], input.input-compact[type="text"] { width: 170px; }
.select-icon { position: relative; display: inline-flex; align-items: center; }
.select-icon .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.select-icon select { padding-left: 32px; font-weight: 600; }
.daterange { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.daterange-custom { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* filter toolbar */
.filterbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-bottom: var(--space-4); padding: 10px var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filterbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.filterbar-actions { display: inline-flex; gap: var(--space-2); margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: calc(-1 * var(--space-2)) 0 var(--space-4); font-size: 12px; }
.chips-label { margin-right: 2px; color: var(--muted); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.chip:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.chip-static { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.chip-key { color: var(--muted); }
.chip-x { margin-left: 2px; color: var(--muted); font-size: 14px; line-height: 1; }
.chip-clear { margin-left: 4px; color: var(--muted); text-decoration: underline; }

/* ---------- 6. Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: var(--space-4); }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 14px var(--space-5); border-bottom: 1px solid var(--border); }
.card-header.plain { border-bottom: 0; padding-bottom: var(--space-2); }
.card-title { font-size: 14.5px; font-weight: 600; }
.card-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-link { flex-shrink: 0; font-size: 12.5px; font-weight: 600; }
.card-body { padding: var(--space-5); }
.card-body > :last-child { margin-bottom: 0; }
.card-footer { padding: 10px var(--space-5); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card + .card { margin-top: 0; }
.span-2 { grid-column: span 2; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* sub-navigation (views inside a section) */
.subnav { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-bottom: var(--space-4); padding: 3px; background: var(--surface-3); border-radius: var(--radius-sm); }
.subnav-link { padding: 5px 12px; border-radius: 5px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.subnav-link:hover { color: var(--text); text-decoration: none; }
.subnav-link.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* dropdown menu (export, user) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary.btn { background: var(--surface-2); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 236px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }
.menu-pop a, .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.menu-pop a:hover, .menu-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.menu-ext { display: inline-block; min-width: 40px; padding: 1px 0; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-align: center; color: var(--text-2); }
.menu-note { margin: 4px 0 0; padding: 6px 10px 2px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }

/* ---------- 7. Data display ---------- */
/* Table - one design everywhere: clean header, light separators, hover, right-aligned money.
   position: relative makes the scroll box the containing block for absolutely-positioned children (the .sr-only labels);
   without it they sit far to the right and stretch the whole page sideways on small screens. */
.table-wrap { position: relative; width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--row-line); font-size: 13.5px; }
th:first-child, td:first-child { padding-left: var(--space-5); }
th:last-child, td:last-child { padding-right: var(--space-5); }
th { padding-top: 9px; padding-bottom: 9px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom-color: var(--border); white-space: nowrap; }
th.num, td.num { text-align: right; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
tfoot th, tfoot td { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); font-weight: 600; }
.cell-2 { display: block; font-size: 12px; color: var(--muted); }
.cell-wrap { min-width: 160px; max-width: 300px; }
.plate { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.who { white-space: nowrap; }
.who-none { color: var(--faint); }
.row-actions { white-space: nowrap; text-align: right; }
/* Active Parking: the action column stays pinned to the right edge while the table scrolls, so Check Out is always reachable. */
.table-stack th.col-actions, .table-stack td.row-actions { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--row-line); }
.table-stack th.col-actions { background: var(--surface-2); }
.table-stack tbody tr:hover td.row-actions { background: #fafbfc; }
/* Dense table for narrow cards */
.table-compact th, .table-compact td { padding: 9px 10px; font-size: 13px; }
.table-compact th:first-child, .table-compact td:first-child { padding-left: var(--space-4); }
.table-compact th:last-child, .table-compact td:last-child { padding-right: var(--space-4); }
.row-actions form { display: inline; }
.row-actions .btn + .btn, .row-actions form + .btn, .row-actions .btn + form, .row-actions form + form { margin-left: 4px; }
td input[type="text"], td input[type="number"] { height: 32px; padding: 4px 9px; font-size: 13.5px; }
td input.short { width: 110px; }
.share-col { width: 26%; min-width: 120px; }
.card > .table-wrap > table { margin: 0; }
.ticket-no { white-space: nowrap; }

/* Badge: word + symbol + soft tint (colour is never the only signal) */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge::before { font-size: 10px; line-height: 1; }
.badge.parked { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.badge.parked::before { content: "\25CF"; }          /* ● */
.badge.completed, .badge.active { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge.completed::before, .badge.active::before { content: "\2713"; }   /* ✓ */
.badge.cancelled { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.cancelled::before { content: "\2715"; }       /* ✕ */
.badge.disabled { background: var(--surface-3); color: var(--muted); border-color: var(--border-strong); }
.badge.disabled::before { content: "\2296"; }        /* ⊖ */
.badge.role { background: var(--surface); color: var(--text-2); }
.badge.system { background: var(--surface-3); color: var(--text-2); }
.badge.custom { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }

/* KPI card */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.kpi-row.kpi-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-row.kpi-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-row.kpi-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { padding: 14px var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.kpi-head { display: flex; align-items: center; gap: var(--space-2); }
.kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-value { margin-top: 8px; font-size: 24px; font-weight: 650; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-hint { margin-top: 3px; font-size: 12px; color: var(--muted); }

/* Bars, donut, line chart (server-rendered SVG / native <progress>) */
progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--series, var(--accent)); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--series, var(--accent)); }
.c-1 { --series: var(--c-1); } .c-2 { --series: var(--c-2); } .c-3 { --series: var(--c-3); } .c-4 { --series: var(--c-4); } .c-5 { --series: var(--c-5); }
.dot { display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 2px; background: var(--series, var(--c-1)); }
.bars { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.bars progress { margin-top: 6px; }
.bars-head { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; }
.bars-name { flex: 1; min-width: 0; color: var(--text-2); }
.bars-fig { font-weight: 600; font-variant-numeric: tabular-nums; }
.bars-meta { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; max-height: 230px; }
.chart-grid { stroke: #edf0f3; stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-area { fill: var(--accent-soft); }
.chart-line { fill: none; stroke: var(--c-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--surface); stroke: var(--c-1); stroke-width: 1.5; }
.chart-dot:hover { fill: var(--c-1); }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.donut { width: 132px; height: 132px; flex-shrink: 0; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 4.5; }
.donut-seg { fill: none; stroke: var(--series); stroke-width: 4.5; }
.donut-value { fill: var(--text); font-size: 6.5px; font-weight: 650; font-family: var(--font); }
.donut-label { fill: var(--muted); font-size: 3px; font-family: var(--font); letter-spacing: .05em; text-transform: uppercase; }
.legend { flex: 1; min-width: 160px; display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: var(--space-2); }
.legend-name { flex: 1; color: var(--text-2); }
.legend-fig { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-pct { width: 52px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rank { display: grid; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.rank li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 8px 0; border-bottom: 1px solid var(--row-line); }
.rank li:last-child { border-bottom: 0; }
.rank-fig { font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-title { margin-bottom: var(--space-2); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.table-totals [data-total] { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Pagination: Showing 1-20 of 428   < Previous 1 2 3 ... 22 Next > */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-5); border-top: 1px solid var(--border); }
.pagination-info { font-size: 12.5px; color: var(--muted); }
.pagination-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.page-btn, .page-num { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.page-btn:hover, .page-num:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.page-num.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn.is-off { color: #b5bcc6; }
.page-gap { padding: 0 3px; color: var(--muted); }

/* Tabs (kept for any section switcher) */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.tab { margin-bottom: -1px; padding: 9px var(--space-3); border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- 8. Feedback ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: var(--space-4); padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert-success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.alert ul { margin: 0; padding-left: 18px; }

dialog.modal { width: min(480px, 92vw); padding: 0; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-pop); color: var(--text); }
dialog.modal::backdrop { background: rgba(16, 24, 40, .45); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-2); }
.modal-head h2 { font-size: 16px; }
.modal-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.modal-x { width: 30px; height: 30px; border-color: transparent; color: var(--muted); }
.modal-body { padding: var(--space-3) var(--space-5) var(--space-5); max-height: min(68vh, 640px); overflow-y: auto; }
.modal-body > .form-grid + .perm-picker { margin-top: var(--space-4); }
dialog.modal.modal-lg { width: min(760px, 94vw); }
.perm-picker { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-picker fieldset.perm-group { padding: var(--space-3) var(--space-4); }
.yes { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 600; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.summary-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space-4); margin: 0; font-size: 13.5px; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; font-weight: 500; }

/* Empty state: compact, never a huge blank area */
.empty { display: flex; flex-direction: column; align-items: center; padding: var(--space-5) var(--space-4); text-align: center; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.empty-title { margin: 10px 0 2px; font-weight: 600; font-size: 13.5px; }
.empty-text { margin: 0; color: var(--muted); font-size: 12.5px; }
.empty.compact { flex-direction: row; justify-content: center; gap: 10px; padding: var(--space-4); }
.empty.compact .empty-title { margin: 0; font-weight: 500; color: var(--muted); }

.spinner, .btn.is-loading::before {
  display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading::before { content: ""; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .btn.is-loading::before { animation: none; border-right-color: currentColor; } }

/* ---------- 9. Pages ---------- */
/* Sign in, setup and error pages */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); padding: var(--space-5); }
.auth-card { width: min(400px, 100%); padding: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); }
.auth-brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.auth-brand .brand-name { color: var(--text); }
.auth-brand .brand-sub { color: var(--muted); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card form { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.auth-foot { font-size: 12px; color: var(--muted); }
.error-code { font-size: 40px; font-weight: 700; line-height: 1; color: var(--accent); margin-bottom: var(--space-2); letter-spacing: -.02em; }
.error-title { font-size: 18px; margin-bottom: var(--space-3); }

/* New parking entry */
.entry-form { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-4); align-items: start; max-width: 1080px; }
.entry-main { display: grid; gap: var(--space-4); min-width: 0; }
.entry-main > .card + .card { margin-top: 0; }
.entry-side { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); display: grid; gap: var(--space-4); }
.info-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.info-item { padding: 14px var(--space-5); border-right: 1px solid var(--border); min-width: 0; }
.info-item:last-child { border-right: 0; }
.info-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.info-item input[readonly] { height: auto; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--text); font-size: 15px; font-weight: 600; }
.info-item input[readonly]:focus { outline: none; }
.amount-card { padding: var(--space-5); }
.amount-label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.amount-card input#amount { width: 100%; height: auto; margin: 4px 0 2px; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 32px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.entry-actions { display: grid; gap: var(--space-2); }
.entry-actions .btn { width: 100%; }
.brand-filter { margin-bottom: 6px; }
.cond-card { border-color: var(--accent-line); }
/* conditional remark fields: a quiet accent line so the extra field reads as belonging to the one above it */
.remark-field { padding-left: var(--space-3); border-left: 2px solid var(--accent-line); }
.remark-note { font-style: italic; }
#payment-box { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
#payment-box[hidden] { display: none; }
.amount-block { display: grid; }

/* Active parking */
.count-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13px; color: var(--muted); }
.count-pill strong { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.search-row { display: flex; flex: 1 1 420px; max-width: 560px; gap: var(--space-2); align-items: center; }
.search-row .field { flex: 1 1 auto; }

/* Roles & permissions */
table.perm-table td, table.perm-table th { vertical-align: middle; }
.perm-table .group-row td { background: var(--surface-2); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; color: var(--text-2); }
.perm-yes { color: var(--ok); font-weight: 700; }
.perm-locked { color: var(--muted); }
.perm-locked .lock { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.perm-box input { width: 18px; height: 18px; }
.perm-cell { text-align: center; }
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-5); }
fieldset.perm-group { margin: 0; min-width: 0; padding: var(--space-4) var(--space-5); border: 0; border-bottom: 1px solid var(--border); }
.perm-group legend { float: left; width: 100%; padding: 0; }
.perm-group .perm-list { clear: both; }
.perm-group:last-child { border-bottom: 0; }
.perm-option { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-weight: 400; cursor: pointer; }
.perm-option input { margin-top: 2px; }
.perm-option strong { display: block; font-weight: 600; font-size: 13px; }
.perm-option.is-locked { cursor: default; color: var(--muted); }

/* Dashboard / reports */
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); align-items: start; }
.report-grid.report-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-grid.wide-main { grid-template-columns: minmax(0, 1fr) 320px; }
.report-grid.three-up { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
.report-grid > .card { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-5); }
.remarks { display: grid; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.remarks li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--row-line); }
.remarks li:last-child { border-bottom: 0; }
.remark-text { color: var(--text); overflow-wrap: anywhere; }
.remark-meta { font-size: 12px; color: var(--muted); }
.report-form { margin: 0; }
.disclosure > summary { list-style: none; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-head { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--space-5); color: var(--text-2); }
.disclosure-head:hover { background: var(--surface-2); border-radius: var(--radius); }
.disclosure[open] .disclosure-head .icon { transform: rotate(180deg); }
.disclosure[open] .disclosure-head { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 1279px) {
  .kpi-row.kpi-row-5, .kpi-row.kpi-row-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1199px) {
  .grid-4, .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid, .report-grid.wide-main, .report-grid.three-up { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .entry-form { grid-template-columns: minmax(0, 1fr); }
  .entry-side { position: static; }
}
@media (max-width: 1023px) {
  /* Tablet: the sidebar becomes a slide-over drawer opened from the top bar */
  .app-sidebar { position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; height: 100%; transform: translateX(-100%); }
  .nav-open .app-sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .icon-btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--space-4); }
  .content { padding: var(--space-4); }
  .report-grid.report-grid-2, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .filterbar-actions { margin-left: 0; }
  .perm-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  /* Stacked table (class "table-stack", used on Active Parking): each row becomes a card so the plate, amount and the
     Check Out button are never hidden off-screen on a phone. The header row stays for screen readers. */
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td, .table-stack td:first-child, .table-stack td:last-child { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 5px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); flex-shrink: 0; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table-stack td.row-actions { position: static; box-shadow: none; background: transparent; justify-content: flex-start; flex-wrap: wrap; padding-top: var(--space-3); }
  .table-stack td.row-actions::before { display: none; }
  .table-stack tbody tr:hover { background: transparent; }
  .search-row { flex-wrap: wrap; max-width: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-row, .kpi-row.kpi-row-3, .kpi-row.kpi-row-5, .kpi-row.kpi-row-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .kpi-value { font-size: 20px; }
  .user-meta { display: none; }
  .card-header, .card-body, .card-footer, .pagination { padding-left: var(--space-4); padding-right: var(--space-4); }
  th:first-child, td:first-child { padding-left: var(--space-4); }
  th:last-child, td:last-child { padding-right: var(--space-4); }
  .info-strip { grid-template-columns: minmax(0, 1fr); }
  .info-item { border-right: 0; border-bottom: 1px solid var(--border); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .filterbar-row > select.select-compact, .filterbar-row > input.input-compact { flex: 1 1 140px; max-width: none; width: auto; }
  .page-actions { width: 100%; }
  .subnav { display: flex; overflow-x: auto; flex-wrap: nowrap; }
  .subnav-link { white-space: nowrap; }
}


/* ---------- Phones: touch-friendly layout ----------
   - every list becomes stacked cards (no sideways scrolling, buttons always visible)
   - 16px text in form fields (smaller text makes iPhones zoom in when a field is tapped)
   - 40px+ tap targets, KPI cards two per row, pop-up windows open as a bottom sheet
   - a bottom bar with the everyday parking pages */
@media (max-width: 767px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .mobile-nav {
    display: flex; position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
  }
  .mobile-nav-item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    padding: 4px 2px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
  }
  .mobile-nav-item:hover { text-decoration: none; color: var(--text); }
  .mobile-nav-item.is-active { color: var(--accent); background: var(--accent-soft); }

  .topbar { min-height: 56px; gap: var(--space-2); }
  .topbar-title h1 { font-size: 16px; }
  .breadcrumb { display: none; }
  .content { padding: var(--space-3) var(--space-3) var(--space-5); }
  .page-head { margin-bottom: var(--space-3); }
  .page-actions > .btn, .page-actions > form, .page-actions > .menu { flex: 1 1 auto; }
  .page-actions > .btn, .page-actions > form > .btn { width: 100%; }

  /* touch targets and no zoom-on-focus */
  input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea { font-size: 16px; height: 44px; }
  textarea { height: auto; }
  select.select-compact, input.input-compact { height: 40px; font-size: 16px; }
  .btn { height: 44px; }
  .btn-sm { height: 38px; padding: 0 12px; font-size: 13px; }
  .page-btn, .page-num { min-width: 38px; height: 38px; }
  .pagination { justify-content: center; }
  .pagination-info { width: 100%; text-align: center; }
  input[type="checkbox"] { width: 20px; height: 20px; }

  /* KPI cards: two per row, compact */
  .kpi { padding: var(--space-3); }
  .kpi-head { gap: 6px; }
  .kpi-icon { display: none; }
  .kpi-label { font-size: 10.5px; }
  .kpi-value { margin-top: 4px; font-size: 19px; }
  .kpi-hint { font-size: 11px; }

  /* stacked cards for every list */
  .card > .table-wrap { overflow-x: visible; }
  .table-stack tr { padding: var(--space-3) var(--space-4); }
  .table-stack td:first-child { font-weight: 600; }
  .table-stack td { min-height: 26px; }
  .table-stack td .cell-2 { display: inline; margin-left: 6px; }
  /* label on the left, the whole value (even when it has two parts) together on the right */
  .table-stack td, .table-stack td:first-child, .table-stack td:last-child { justify-content: flex-end; flex-wrap: wrap; column-gap: 6px; }
  .table-stack td::before { margin-right: auto; }
  /* buttons side by side in one row */
  .table-stack td.row-actions { flex-wrap: nowrap; gap: var(--space-2); }
  .table-stack td.row-actions > .btn, .table-stack td.row-actions > form { flex: 1 1 0; min-width: 0; }
  .table-stack td.row-actions > form > .btn { width: 100%; }
  .table-stack td.row-actions > form:has(.btn-primary) { flex: 1.6 1 0; }  /* Check Out is the main action */
  .table-stack td.row-actions .btn { padding: 0 8px; }
  .table-stack td.row-actions form + .btn, .table-stack td.row-actions .btn + form, .table-stack td.row-actions .btn + .btn, .table-stack td.row-actions form + form { margin-left: 0; }
  .filterbar-row > .muted[aria-hidden="true"] { display: none; }
  .table-stack td.cell-wrap { max-width: none; text-align: right; }
  .card-footer { font-size: 11.5px; }

  /* compact empty states stack instead of squeezing into one line */
  .empty.compact { flex-direction: column; gap: 6px; }

  /* charts: readable axis labels on a narrow screen (SVG units scale down with the chart) */
  .chart-axis { font-size: 17px; }
  .chart-dot { r: 2; }
  .donut-wrap { justify-content: center; }

  /* pop-up windows open as a bottom sheet */
  dialog.modal, dialog.modal.modal-lg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  .modal-body { max-height: 62vh; }
  .modal-foot .btn { flex: 1 1 0; }

  /* sidebar drawer above the bottom bar */
  .app-sidebar { z-index: 45; }
  .scrim { z-index: 40; }
}
/* ---------- Live updates (live.js): status dot in the top bar + short notifications ---------- */
.live-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live-indicator[data-state="on"] { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.live-indicator[data-state="on"] .live-dot { background: #2f9e62; }
.live-toasts { position: fixed; z-index: 60; right: var(--space-4); bottom: var(--space-4); display: grid; gap: var(--space-2); max-width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.live-toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--side-bg); color: #fff; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-pop); }
@media (max-width: 767px) {
  .live-indicator { padding: 3px 7px; }
  .live-indicator .live-text { display: none; }
  .live-toasts { left: var(--space-3); right: var(--space-3); bottom: calc(72px + env(safe-area-inset-bottom, 0px)); max-width: none; }
}
