/* ==== Theme ====
   Navy chrome (navbar, sign-in pages) on a cool light-grey page, white cards, one blue accent.
   Chart and status colours are defined further down, separately from these UI tokens. */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --text: #1b2433;
  --muted: #5b6678;
  --border: #d6dce7;
  --primary: #1f63c0;
  --primary-hover: #184f9b;
  --navy: #0f2a43;
  --navy-hover: #1a4263;
  --navy-text: #c9d7e6;
  --nav-accent: #5aa0f0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --success: #1e7b4a;
  --success-bg: #e6f6ed;
  --radius: 8px;
  --gutter: 1.5rem;
  --page-max: 1760px;
  --navbar-height: 60px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); line-height: 1.5; }
img { max-width: 100%; }
h1, h2 { margin: 0 0 0.5rem; line-height: 1.25; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---- Forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.9rem; }
.field .label { display: block; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.9rem; }
.code-readonly { padding: 0.6rem 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.code-readonly code { padding: 0; background: none; font-size: 0.95rem; user-select: all; }
.hint { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8rem; }
.field-hint { margin: -0.4rem 0 1rem; }
input, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  color: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--primary-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

/* ---- Alerts ---- */
.alert { padding: 0.65rem 0.85rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---- Auth pages ---- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem max(1rem, env(safe-area-inset-right)) 1.5rem max(1rem, env(safe-area-inset-left));
  background: linear-gradient(160deg, var(--navy) 0%, #14395a 100%);
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}
.auth-brand img { width: 40px; height: 40px; display: block; }
.auth-card {
  width: 100%;
  padding: 2rem;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 25%);
}
.auth-card h1 { font-size: 1.5rem; }
.auth-card .subtitle { margin: 0 0 1.5rem; color: var(--muted); }
.auth-links { margin-top: 1rem; text-align: center; font-size: 0.9rem; }

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 8px rgb(15 42 67 / 28%);
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--page-max);
  height: var(--navbar-height);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { width: 32px; height: 32px; display: block; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; align-self: stretch; gap: 0.15rem; margin-left: 1.25rem; }
.tab {
  padding: 0 1rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--navy-text);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { background: rgb(255 255 255 / 7%); color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--nav-accent); }
.navbar-spacer { flex: 1; }
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: #fff;
  cursor: pointer;
}
.nav-toggle:hover { background: rgb(255 255 255 / 10%); }
.bars, .bars::before, .bars::after { display: block; width: 20px; height: 2px; background: currentcolor; border-radius: 1px; }
.bars { position: relative; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; }
.bars::after { top: 6px; }
.navbar button:focus-visible, .navbar a:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: var(--radius); }

.user-menu { position: relative; }
.user-button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.user-button:hover, .user-button[aria-expanded="true"] { background: rgb(255 255 255 / 10%); }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2a78d6;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.user-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-name { font-size: 0.9rem; font-weight: 600; }
.user-role { color: var(--navy-text); font-size: 0.75rem; }
.chevron { flex: none; opacity: 0.8; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 220px;
  padding: 0.35rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgb(15 42 67 / 20%);
}
.menu-header { display: flex; flex-direction: column; padding: 0.5rem 0.75rem 0.6rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.menu-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg); }
.menu .menu-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---- App shell ---- */
.container { max-width: var(--page-max); margin: 0 auto; padding: 1.5rem max(var(--gutter), env(safe-area-inset-right)) 3rem max(var(--gutter), env(safe-area-inset-left)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

.toolbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input { flex: 1 1 200px; width: auto; }
.toolbar select { flex: 0 0 auto; width: auto; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.6rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
td select { width: auto; padding: 0.25rem 0.4rem; }
.badge { padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 1rem; font-size: 0.9rem; color: var(--muted); }

/* ---- Dialog ---- */
dialog { width: min(600px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.5rem; border: 0; border-radius: 12px; box-shadow: 0 12px 48px rgb(16 24 40 / 25%); color: var(--text); }
dialog::backdrop { background: rgb(15 42 67 / 55%); }
dialog.narrow { width: min(440px, calc(100% - 2rem)); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ---- Misc components ---- */
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: #fff4db; color: #8a5a00; }
.badge-neutral { background: #e8ebf3; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
code { padding: 0.05rem 0.35rem; border-radius: 4px; background: #eef1f8; font-size: 0.85em; }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #a02f23; }
.row-actions { display: flex; gap: 0.35rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.9rem; }
.check input { width: auto; margin-top: 0.2rem; }
.check-list { max-height: 160px; overflow-y: auto; }
fieldset.access { margin: 1rem 0 0; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
fieldset.access .hint { margin-bottom: 0.6rem; }
fieldset.access legend { padding: 0 0.4rem; font-weight: 600; font-size: 0.85rem; }
.key-box { display: block; margin: 1rem 0; padding: 0.9rem; text-align: center; font-size: 1.15rem; letter-spacing: 0.04em; user-select: all; word-break: break-all; }
dialog.wide { width: min(900px, calc(100% - 2rem)); }
.welcome-card { text-align: center; }

/* ---- Overview: filters and tiles ---- */
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.filter span { display: block; margin-bottom: 0.2rem; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.filter { flex: 1 1 180px; min-width: 0; }
.filter select, .filter input { width: 100%; min-width: 0; height: 2.75rem; }
.is-loading { opacity: 0.6; transition: opacity 0.15s; }
.section-title { margin: 1.5rem 0 0.75rem; font-size: 0.95rem; color: var(--muted); font-weight: 600; text-transform: none; }
.section-title:first-child { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 0.75rem; }
.tile { margin: 0; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tile p { margin: 0; }
.tile-label { color: var(--muted); font-size: 0.85rem; }
.tile-value { margin-top: 0.15rem; font-size: 1.9rem; font-weight: 600; line-height: 1.2; }
.tile-note { margin-top: 0.15rem; color: var(--muted); font-size: 0.8rem; }

/* ---- Charts ----
   Series colours and chart ink are the validated reference palette (blue, orange; status
   good / warning / critical). Colour sits on marks only; text uses ink tokens. */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-muted: #898781;
  --viz-secondary: #52514e;
  --viz-track: #cde2fb;
}
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1.5rem; }
.chart-card { min-width: 0; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.chart-head h3 { margin: 0; font-size: 1rem; }
.chart-head p { margin: 0.1rem 0 0; }
.chart-body { position: relative; }
.chart-card .empty { padding: 2rem 1rem; }
.chart-card .table-view { max-height: 320px; overflow: auto; }

.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.5rem; color: var(--viz-secondary); font-size: 0.85rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-key, .tip-key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend-key.s1, .tip-key.s1 { background: var(--series-1); }
.legend-key.s2, .tip-key.s2 { background: var(--series-2); }
.tip-key.status-active { background: var(--status-good); }
.tip-key.status-paused { background: var(--status-warning); }
.tip-key.status-expired { background: var(--status-critical); }

.chart-svg { display: block; max-width: 100%; overflow: visible; }
.chart-svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }
.grid-line { stroke: var(--viz-grid); stroke-width: 1; }
.axis-line { stroke: var(--viz-axis); stroke-width: 1; }
.axis-text { fill: var(--viz-muted); font-size: 11px; }
.value-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.crosshair { stroke: var(--viz-axis); stroke-width: 1; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s1 { stroke: var(--series-1); }
.line.s2 { stroke: var(--series-2); }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot.s1 { fill: var(--series-1); }
.dot.s2 { fill: var(--series-2); }
.bar.s1 { fill: var(--series-1); }
.bar.hover { opacity: 0.75; }

.chart-tooltip {
  position: absolute; z-index: 5; padding: 0.5rem 0.65rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgb(16 24 40 / 12%);
  font-size: 0.8rem; white-space: nowrap; pointer-events: none;
}
.tip-heading { margin-bottom: 0.25rem; color: var(--viz-secondary); }
.tip-row { display: flex; align-items: center; gap: 0.45rem; }
.tip-label { color: var(--viz-secondary); }

/* License status: one stacked bar (2px gaps), legend rows carry icon + label + count */
.stack { display: flex; gap: 2px; height: 28px; margin-bottom: 1rem; }
.seg { min-width: 3px; border-radius: 4px; }
.seg:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg.status-active, .badge-icon.status-active { background: var(--status-good); }
.seg.status-paused, .badge-icon.status-paused { background: var(--status-warning); }
.seg.status-expired, .badge-icon.status-expired { background: var(--status-critical); }
.status-list { margin: 0; padding: 0; list-style: none; }
.status-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; border-top: 1px solid var(--viz-grid); }
.status-list li:first-child { border-top: 0; }
.status-list .grow { flex: 1; }
.status-list .percent { min-width: 3ch; text-align: right; }
.badge-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; }
.badge-icon.status-paused { color: #0b0b0b; }

/* Horizontal bars and seat meters */
.hbar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; align-items: center; gap: 0.75rem; margin-bottom: 0.55rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--viz-secondary); font-size: 0.85rem; }
.hbar-track { height: 20px; }
.hbar { height: 20px; min-width: 2px; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar:hover, .hbar:focus-visible { opacity: 0.75; outline: 0; }
.hbar-value { min-width: 2.5ch; text-align: right; font-size: 0.85rem; }
.meter { height: 12px; background: var(--viz-track); border-radius: 4px; overflow: hidden; }
.meter:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.meter-fill { height: 100%; border-radius: 4px 0 0 4px; background: var(--series-1); }
.meter-fill.warn { background: var(--status-warning); }
.meter-fill.full { background: var(--status-critical); border-radius: 4px; }
.meter-value { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }

@media (max-width: 800px) {
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .hbar-row { grid-template-columns: minmax(70px, 110px) 1fr auto; }
}

/* ==== Responsive ====
   ≤ 900px  tablets and below: the navbar sections collapse into a menu button.
   ≤ 600px  phones: single-column layouts, full-width controls, stacked dialog buttons.
   Touch devices get larger tap targets whatever their width. */
@media (max-width: 900px) {
  :root { --gutter: 1rem; }
  .nav-toggle { display: grid; }
  .navbar-inner { gap: 0.5rem; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0.5rem max(var(--gutter), env(safe-area-inset-right)) 0.75rem max(var(--gutter), env(safe-area-inset-left));
    background: var(--navy);
    border-top: 1px solid rgb(255 255 255 / 12%);
    box-shadow: 0 10px 20px rgb(15 42 67 / 30%);
  }
  .nav-links.open { display: flex; }
  .tab { min-height: 48px; padding: 0 0.75rem; border-bottom: 0; border-left: 3px solid transparent; text-align: left; }
  .tab.active { border-left-color: var(--nav-accent); background: rgb(255 255 255 / 8%); }
  #tiles-now { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .user-text, .chevron { display: none; }
  .brand { font-size: 1rem; }
  .container { padding-top: 1rem; }
  .card, .chart-card { padding: 1rem; }
  .card-header { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { flex: 1 1 100%; width: 100%; }
  .filter { flex: 1 1 calc(50% - 0.5rem); max-width: none; }
  .filter:last-child { flex-basis: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .auth-card { padding: 1.5rem 1.25rem; }
  .tile-value { font-size: 1.6rem; }
  #tiles-now { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .chart-head { flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; justify-content: space-between; }
  dialog { width: calc(100% - 1rem); padding: 1.1rem; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-small { min-height: 40px; padding: 0.4rem 0.85rem; }
  input, select { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 20px; height: 20px; }
  .menu-item { display: flex; align-items: center; min-height: 44px; }
  .user-button { min-height: 44px; }
}

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

/* Footer */
body.has-footer { display: flex; flex-direction: column; }
body.has-footer > main { flex: 1 0 auto; width: 100%; }
.site-footer { flex-shrink: 0; margin-top: 2rem; background: var(--navy); color: var(--navy-text); border-top: 3px solid var(--nav-accent); font-size: 0.875rem; }
.footer-inner, .footer-bottom { max-width: var(--page-max); margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem; padding-top: 1.75rem; padding-bottom: 1.5rem; }
.footer-brand { display: flex; align-items: center; gap: 0.75rem; }
.footer-brand img { flex: none; display: block; }
.footer-brand strong { display: block; color: #fff; font-size: 1rem; }
.footer-brand span { color: var(--navy-text); opacity: 0.8; font-size: 0.8125rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.footer-links a { color: var(--navy-text); text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.footer-links a:hover, .footer-links a:focus-visible { color: #fff; border-bottom-color: var(--nav-accent); outline: none; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding-top: 1rem; padding-bottom: 1rem; border-top: 1px solid rgb(255 255 255 / 12%); font-size: 0.8125rem; color: var(--navy-text); opacity: 0.9; }
.footer-status { display: inline-flex; align-items: center; gap: 0.5rem; }
.footer-status i { width: 8px; height: 8px; border-radius: 50%; background: #3ecf8e; box-shadow: 0 0 0 3px rgb(62 207 142 / 25%); }
@media (max-width: 640px) { .footer-inner, .footer-bottom { flex-direction: column; align-items: flex-start; text-align: left; } }

/* ---- Dashboard look: white cards, one blue accent, colour only for status ---- */
.filter-row { padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgb(15 42 67 / 5%); }
.filter span { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
.filter select:focus-visible, .filter input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.section-title { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-size: 1rem; font-weight: 600; }
.section-title::before { content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--primary); }
.tile { position: relative; display: grid; grid-template-columns: 1fr auto; column-gap: 0.75rem; align-content: start; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgb(15 42 67 / 5%); transition: box-shadow 0.15s, border-color 0.15s; }
.tile:hover { border-color: #b9c6da; box-shadow: 0 4px 12px rgb(15 42 67 / 8%); }
.tile-label { grid-column: 1; font-weight: 500; }
.tile-value { grid-column: 1; margin-top: 0.35rem; color: var(--text); font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; }
.tile-note { grid-column: 1 / -1; margin-top: 0.4rem; padding-top: 0.5rem; border-top: 1px solid #edf0f5; }
.tile-icon { grid-column: 2; grid-row: 1 / span 2; align-self: start; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--tone-bg, #e8f0fb); color: var(--tone, var(--primary)); }
.tile-icon::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.tile[data-tone="good"] { --tone: var(--success); --tone-bg: var(--success-bg); }
.tile[data-tone="warn"] { --tone: #b7791f; --tone-bg: #fff4d6; }
.tile[data-tone="bad"] { --tone: var(--danger); --tone-bg: var(--danger-bg); }
.tile[data-tone="info"] { --tone: #12808a; --tone-bg: #e2f4f5; }
.chart-card { padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgb(15 42 67 / 5%); overflow: hidden; }
.chart-head { margin: 0; padding: 1rem 1.25rem; border-bottom: 1px solid #edf0f5; align-items: center; }
.chart-card > :not(.chart-head) { margin-left: 1.25rem; margin-right: 1.25rem; }
.chart-card > :last-child { margin-bottom: 1.25rem; }
.chart-card > .chart-head + * { margin-top: 1rem; }
.tile-icon[data-icon="apps"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="key"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M10.8 12.2 20 3M16 7l3 3'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="pause"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='5' width='4' height='14' rx='1'/%3E%3Crect x='14' y='5' width='4' height='14' rx='1'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="expired"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m15 9-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="clock"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="seats"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 2.9-6 6.5-6s6.5 2.4 6.5 6M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14.3c2.2.7 3.5 2.6 3.5 5.7'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="plus"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="in"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12m0 0-4-4m4 4 4-4M5 20h14'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="out"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V8m0 0-4 4m4-4 4 4M5 4h14'/%3E%3C/svg%3E"); }
.tile-icon[data-icon="ban"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m5.6 5.6 12.8 12.8'/%3E%3C/svg%3E"); }

/* Download report menu */
.report-menu { position: relative; margin-left: auto; align-self: flex-end; }
.report-dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 0.35rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(15 42 67 / 15%); }
.report-dropdown[hidden] { display: none; }
.report-dropdown button { display: block; width: 100%; padding: 0.6rem 0.75rem; text-align: left; background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.report-dropdown button:hover, .report-dropdown button:focus-visible { background: #eef2f7; outline: none; }

/* Filter bar: soft tint so it reads as a toolbar; inputs stay white */
.filter-row { background: #e8eef6; border-color: #cdd8e8; box-shadow: none; }
.filter-row select, .filter-row input { background-color: #fff; }

/* Each tile group sits on a soft panel; the white tiles stand out on it */
.tiles { padding: 1rem; background: #edf2f8; border: 1px solid #d3deec; border-radius: 12px; }
@media (max-width: 640px) { .tiles { padding: 0.75rem; } }

/* Chart title strip */
.chart-head { background: #edf2f8; border-bottom-color: #d3deec; }

/* More contrast against the page background (#eef2f7) */
.chart-head { background: #d9e5f5; border-bottom: 1px solid #bccde4; border-left: 4px solid var(--primary); }
.chart-head h3 { color: var(--navy); }
.chart-head p { color: #46566d; }
.chart-head button { background: #fff; }
.tiles { background: #e1eaf5; border-color: #c5d3e6; }
.filter-row { background: #e1eaf5; border-color: #c5d3e6; }

/* List-page filter bars: plain and aligned */
.toolbar { align-items: center; }
.toolbar input, .toolbar select { height: 2.5rem; }
.toolbar input:focus-visible, .toolbar select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.toolbar .report-menu { align-self: center; }

/* Table header and rows */
th { padding: 0.7rem 0.75rem; background: #e8eef7; color: var(--navy); border-bottom: 1px solid #c5d3e6; }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
td { padding-left: 0.75rem; padding-right: 0.75rem; }
tbody tr:hover td { background: #f5f8fc; }

.footer-status.down i { background: #e5675b; box-shadow: 0 0 0 3px rgb(229 103 91 / 25%); }
.toolbar .date-field { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.toolbar .date-field input { flex: 0 0 auto; width: auto; }
