/* The Rail: all styles (SPEC 7.8). No inline styles anywhere; JS only sets classes and CSSOM positions. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f4f5ef;
  --surface: #ffffff;
  --surface-2: #eceee5;
  --border: #dfe2d5;
  --border-strong: #c4c9b6;
  --text: #121410;
  --muted: #5a604e;
  --accent: #6f9400;
  --loss: #cc3333;
  --warn: #a76b00;
  --info: #2f6fe0;
  /* small-text variants that keep 4.5:1 on --surface and --bg */
  --accent-text: #4a6600;
  --loss-text: #b3261e;
  --warn-text: #8a5800;
  --info-text: #2a63c9;
  /* The Rail lime (the logo's ring, #d9f12a): filled buttons, switches, ticks; dark text on it */
  --accent-strong: #d9f12a;
  --on-accent: #121410;
  --accent-bg: rgba(111, 148, 0, 0.14);
  --loss-bg: rgba(204, 51, 51, 0.10);
  --warn-bg: rgba(167, 107, 0, 0.12);
  --info-bg: rgba(47, 111, 224, 0.10);
  --focus: #4a6600;
  --shadow: 0 8px 28px rgba(18, 20, 16, 0.14);
  --backdrop: rgba(18, 20, 16, 0.45);
  /* the running rail: header line and current tab (lime on white is only 1.3:1, so olive here) */
  --rail: #6f9400;
  --rail-dim: rgba(111, 148, 0, 0.40);
  /* GB greyhound trap colours (the same in both themes); the edge keeps 3 (white) and 4 (black) visible */
  --trap-1-bg: #d0021b;
  --trap-1-fg: #ffffff;
  --trap-2-bg: #0057b8;
  --trap-2-fg: #ffffff;
  --trap-3-bg: #ffffff;
  --trap-3-fg: #111111;
  --trap-4-bg: #111111;
  --trap-4-fg: #ffffff;
  --trap-5-bg: #ff8f00;
  --trap-5-fg: #111111;
  --trap-6-a: #111111;
  --trap-6-b: #ffffff;
  --trap-6-fg: #d0021b;
  --trap-edge: rgba(18, 20, 16, 0.30);
  /* P/L calendar shades, darker = bigger (light: olive tints, then a solid that keeps 4.5:1 with white) */
  --cal-pos-1: rgba(111, 148, 0, 0.12);
  --cal-pos-2: rgba(111, 148, 0, 0.24);
  --cal-pos-3: rgba(111, 148, 0, 0.40);
  --cal-pos-4: #4a6600;
  --cal-pos-4-fg: #ffffff;
  --cal-neg-1: rgba(204, 51, 51, 0.10);
  --cal-neg-2: rgba(204, 51, 51, 0.20);
  --cal-neg-3: rgba(204, 51, 51, 0.34);
  --cal-neg-4: #b3261e;
  --cal-neg-4-fg: #ffffff;
  --radius: 8px;
  /* the logo's lettering: a classical serif in capitals, from the device (CSP: no web fonts) */
  --font-display: "Trajan Pro", "Cinzel", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0b08;
    --surface: #13150f;
    --surface-2: #1b1e16;
    --border: #272b20;
    --border-strong: #3b4131;
    --text: #eef1e6;
    --muted: #a0a692;
    --accent: #d9f12a;
    --loss: #ff5c5c;
    --warn: #f0a83a;
    --info: #6aa6ff;
    --accent-text: #d9f12a;
    --loss-text: #ff7b7b;
    --warn-text: #f0a83a;
    --info-text: #8bb8ff;
    --accent-strong: #d9f12a;
    --on-accent: #0a0b08;
    --accent-bg: rgba(217, 241, 42, 0.13);
    --loss-bg: rgba(255, 92, 92, 0.14);
    --warn-bg: rgba(240, 168, 58, 0.14);
    --info-bg: rgba(106, 166, 255, 0.14);
    --focus: #e3ff6b;
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    --backdrop: rgba(0, 0, 0, 0.65);
    --rail: #d9f12a;
    --rail-dim: rgba(217, 241, 42, 0.28);
    --trap-edge: rgba(238, 241, 230, 0.34);
    --cal-pos-1: rgba(217, 241, 42, 0.12);
    --cal-pos-2: rgba(217, 241, 42, 0.24);
    --cal-pos-3: rgba(217, 241, 42, 0.40);
    --cal-pos-4: #d9f12a;
    --cal-pos-4-fg: #0a0b08;
    --cal-neg-1: rgba(255, 92, 92, 0.14);
    --cal-neg-2: rgba(255, 92, 92, 0.26);
    --cal-neg-3: rgba(255, 92, 92, 0.40);
    --cal-neg-4: #ff5c5c;
    --cal-neg-4-fg: #0a0b08;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b08;
  --surface: #13150f;
  --surface-2: #1b1e16;
  --border: #272b20;
  --border-strong: #3b4131;
  --text: #eef1e6;
  --muted: #a0a692;
  --accent: #d9f12a;
  --loss: #ff5c5c;
  --warn: #f0a83a;
  --info: #6aa6ff;
  --accent-text: #d9f12a;
  --loss-text: #ff7b7b;
  --warn-text: #f0a83a;
  --info-text: #8bb8ff;
  --accent-strong: #d9f12a;
  --on-accent: #0a0b08;
  --accent-bg: rgba(217, 241, 42, 0.13);
  --loss-bg: rgba(255, 92, 92, 0.14);
  --warn-bg: rgba(240, 168, 58, 0.14);
  --info-bg: rgba(106, 166, 255, 0.14);
  --focus: #e3ff6b;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.65);
  --rail: #d9f12a;
  --rail-dim: rgba(217, 241, 42, 0.28);
  --trap-edge: rgba(238, 241, 230, 0.34);
  --cal-pos-1: rgba(217, 241, 42, 0.12);
  --cal-pos-2: rgba(217, 241, 42, 0.24);
  --cal-pos-3: rgba(217, 241, 42, 0.40);
  --cal-pos-4: #d9f12a;
  --cal-pos-4-fg: #0a0b08;
  --cal-neg-1: rgba(255, 92, 92, 0.14);
  --cal-neg-2: rgba(255, 92, 92, 0.26);
  --cal-neg-3: rgba(255, 92, 92, 0.40);
  --cal-neg-4: #ff5c5c;
  --cal-neg-4-fg: #0a0b08;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
a { color: var(--info-text); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.main:focus { outline: none; }

.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;
}

.noscript { max-width: 1120px; margin: 24px auto; padding: 0 16px; }

/* ------------------------------------------------------------------ buttons and controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent-strong); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); filter: brightness(1.08); }
.btn-danger { color: var(--loss-text); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-small { padding: 0 12px; font-size: 14px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; min-height: 40px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.input, .select {
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: 16px;
}
.input:disabled, .select:disabled { opacity: 0.6; cursor: not-allowed; }
.input.is-invalid { border-color: var(--loss); }

.switch {
  -webkit-appearance: none; appearance: none;
  position: relative; flex: none;
  width: 44px; height: 26px; margin: 7px 0;
  border-radius: 999px; background: var(--border-strong);
  cursor: pointer;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.switch:checked { background: var(--accent-strong); }
.switch:checked::before { left: 21px; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

.switch-row {
  display: flex; align-items: center; gap: 12px; min-height: 40px; cursor: pointer;
}
.switch-row.is-disabled { cursor: not-allowed; }

.radio-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.radio {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer;
}
.radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }
.check {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }

/* ------------------------------------------------------------------ header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--rail-dim);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.brand-mark { display: block; border-radius: 50%; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase;
}

.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab {
  position: relative;
  min-height: 40px; padding: 0 14px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); }
/* the current tab sits on the rail: a lime bar over the header's bottom line
   (bottom -9px = the header's 8px padding + its 1px line, on the phone's second row too) */
.tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -9px; height: 3px;
  background: var(--rail);
}

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.theme-label { font-size: 13px; font-weight: 600; }

.user { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 8px 0 4px; max-width: 220px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.chev { color: var(--muted); flex: none; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  background: var(--accent-bg); color: var(--accent-text); font-size: 12px; font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.menu {
  position: absolute; z-index: 40; min-width: 180px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow);
}
.user-menu { right: 0; top: calc(100% + 6px); }
.row-menu { position: fixed; }
.menu-item {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text);
  text-align: left; text-decoration: none; cursor: pointer; font-size: 14px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item.is-danger { color: var(--loss-text); }

/* ------------------------------------------------------------------ banners and toasts */
.banners { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.banner {
  margin-top: 10px; padding: 8px 12px; border-radius: 6px; font-size: 14px;
  border: 1px solid transparent;
}
/* demo only: a slim ribbon on the rail, not an alert box */
.banner-demo {
  padding: 6px 12px; border: 0; border-left: 3px solid var(--rail); border-radius: 0;
  background: var(--surface); font-size: 13px; font-weight: 600;
}
.banner-stale { background: var(--warn-bg); padding: 4px 12px; font-size: 13px; }
.banner-error {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--loss-bg); border-color: var(--loss);
}

.toasts {
  position: fixed; left: 50%; bottom: 16px; z-index: 60;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 14px; border-radius: 8px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  font-size: 14px; pointer-events: auto;
}
.toast-action {
  min-height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid currentColor; background: transparent; color: inherit; font-weight: 600; cursor: pointer;
}

/* ------------------------------------------------------------------ layout */
.main { max-width: 1120px; margin: 0 auto; padding: 16px 16px 96px; }
.view { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
/* section titles in the brand's serif capitals (numbers never: its figures are not tabular) */
.view h2, .hero-title {
  font-family: var(--font-display); font-size: 13.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--accent-text); }
.neg { color: var(--loss-text); }

/* ------------------------------------------------------------------ filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
}
.seg {
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ------------------------------------------------------------------ tiles: the headline strip */
/* Profit is the headline figure; ROI, EV taken, Beat SP and Bets sit beside it, split by hairlines
   (no boxes). Below 768px: Profit across the top, the other four 2 x 2 under it. */
.tiles, .skeleton-tiles {
  display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
  gap: 0; align-items: stretch; padding: 4px 0 18px; border-bottom: 1px solid var(--border);
}
.tile { min-width: 0; padding: 0 16px; border-left: 1px solid var(--border); }
.tiles > :first-child { border-left: 0; padding-left: 0; }
.tile-label { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.tile-value { font-size: 22px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles > .tile:first-child .tile-value { font-size: 46px; line-height: 1.05; letter-spacing: -0.015em; }
.tile-sub { color: var(--muted); font-size: 13px; margin-top: 2px; text-wrap: pretty; }

/* ------------------------------------------------------------------ chart */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--accent); }
.swatch-expected { border-top: 2px dashed var(--muted); }
.chart-box { min-height: 180px; }
.chart-wrap { position: relative; width: 100%; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; border-radius: 8px; }
.chart-svg:focus { outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart-zero { stroke: var(--border-strong); stroke-width: 1.25; }
.chart-actual { stroke: var(--accent); }
.chart-expected { stroke: var(--muted); }
.chart-cross-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-band { fill: var(--surface-2); }
.chart-dot-actual { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-dot-expected { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 13px;
}
.chart-tip-head { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.chart-tip-actual { font-weight: 600; }
.chart-caption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 180px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
/* column heads only (never .table th: the row heads "Dogs", "November 2026" stay as written) */
.table thead th { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.sub { display: block; font-size: 12.5px; color: var(--muted); }
.cell-strong { font-weight: 600; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bets-table td.cell-menu { width: 44px; padding: 4px 0; text-align: right; }
.bets-table td.cell-when { white-space: nowrap; }
.bets-table tr.is-dim td { color: var(--muted); }
.bets-table tr.is-dim .cell-strong { font-weight: 500; }
.bets-table tbody tr:hover td { background: var(--surface-2); }
.bets-table td.pl { font-weight: 700; }

/* the race as a racecard line: off time in bold, then the course */
.race-off { font-weight: 700; color: var(--text); }
.is-dim .race-off { color: inherit; }

/* greyhound trap numbers in the GB trap colours (the aria-label says "Trap N") */
.trap {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 18px; height: 18px; margin-right: 7px; border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--trap-edge);
  font-size: 11.5px; font-weight: 800; line-height: 1; letter-spacing: 0; text-transform: none;
}
.trap-1 { background: var(--trap-1-bg); color: var(--trap-1-fg); }
.trap-2 { background: var(--trap-2-bg); color: var(--trap-2-fg); }
.trap-3 { background: var(--trap-3-bg); color: var(--trap-3-fg); }
.trap-4 { background: var(--trap-4-bg); color: var(--trap-4-fg); }
.trap-5 { background: var(--trap-5-bg); color: var(--trap-5-fg); }
/* black-and-white hoops, red number with a white halo so it reads on the black bands */
.trap-6 {
  background: repeating-linear-gradient(180deg, var(--trap-6-a) 0 3px, var(--trap-6-b) 3px 6px);
  color: var(--trap-6-fg);
  text-shadow: 0 0 1px var(--trap-6-b), 0 0 2px var(--trap-6-b), 0 0 2px var(--trap-6-b);
}
.dialog-title .trap { width: 22px; height: 22px; font-size: 14px; vertical-align: 2px; }

/* ------------------------------------------------------------------ stats tab */
/* Ruled sections on the page, form-guide style: a title over a hairline, then one compact grid
   of figures (no boxes); 140px columns give 2 across at 360px. */
#view-stats { gap: 28px; }
.stats-section { min-width: 0; }
.stats-section > .card-head { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 20px; margin: 0; }
/* Fixed counts for the known sections, so a card never sits alone on a row:
   Results (6 cards) 2 / 3 / 6 across; Your prices and Highs and lows (3 cards) 1 / 3 across. */
.stat-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-grid-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 480px) { .stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 560px) { .stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .stat-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat { min-width: 0; padding: 10px 0 12px; }
.stat dt, .stat dd { margin: 0; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat-value { margin-top: 2px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.stat-grid-6 > .stat:first-child .stat-value { font-size: 24px; line-height: 1.15; }
.stat-sub { margin-top: 2px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.stat-sub .cell-strong { color: var(--text); }
.stat-note { margin-top: 10px; }
.skeleton-stat { height: 68px; }
.stats-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px 40px; }
.table tbody th[scope="row"] {
  padding: 10px 8px; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text); font-weight: 600; vertical-align: top;
}
.table tbody tr:last-child th { border-bottom: 0; }
.export-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.export-card .help { margin-top: 2px; }
/* Wins v losses: two figures side by side at every width, then two bars that compare them */
.stat-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.avg-bars { display: grid; gap: 6px; margin-top: 2px; }
.avg-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.avg-track { display: block; height: 10px; }
.avg-bar { display: block; height: 100%; border-radius: 2px; }
.avg-bar-win { background: var(--accent); }
.avg-bar-loss { background: var(--loss); }

/* the form strip: a racecard form guide, oldest left, newest right (10 a row on a phone) */
.form-strip {
  display: grid; grid-template-columns: repeat(20, minmax(0, 28px)); gap: 4px;
  list-style: none; margin: 12px 0 0; padding: 0; touch-action: pan-y;
}
@media (max-width: 559.98px) { .form-strip { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.form-strip li { display: block; min-width: 0; }
.form-sq {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1 / 1; padding: 0;
  border: 1.5px solid currentColor; border-radius: 3px; background: transparent;
  font-size: 12px; font-weight: 800; line-height: 1; cursor: pointer;
}
.form-W { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.form-P { color: var(--info-text); }
.form-L { color: var(--loss-text); }
.form-sq.is-active { outline: 2px solid var(--text); outline-offset: 2px; }
.form-detail { margin-top: 12px; min-height: 42px; font-size: 13.5px; overflow-wrap: anywhere; }
.form-detail .pill { margin-right: 2px; vertical-align: 1px; }
.form-detail .trap, .stat-sub .trap { margin-right: 5px; }
.skeleton-form { height: 64px; margin-top: 12px; }
.stat-sub .pill-own, .form-detail .pill-own { vertical-align: 1px; }

/* the P/L calendar: Monday-first racing days, lime shades for a profit and red for a loss */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 32px; margin-top: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cal-month { font-size: 15px; font-weight: 650; text-align: center; }
.cal-nav { font-size: 22px; line-height: 1; color: var(--text); }
.cal-nav:disabled { opacity: 0.35; cursor: default; background: transparent; }
.cal { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 3px; }
.cal th {
  padding: 0 0 2px; text-align: center; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.cal td { padding: 0; }
.cal-day {
  display: flex; flex-direction: column; justify-content: space-between; align-items: stretch;
  width: 100%; min-height: 50px; padding: 4px 5px 5px; gap: 2px;
  border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text);
  text-align: left; cursor: pointer;
}
.cal-num { font-size: 11px; line-height: 1; color: var(--muted); }
.cal-pl { font-size: 12px; font-weight: 700; line-height: 1.1; text-align: right; white-space: nowrap; overflow: hidden; }
.cal-pl-open { font-weight: 600; color: var(--muted); }
.cal-open { border-style: dashed; border-color: var(--border-strong); }
.cal-even { background: var(--surface-2); }
.cal-pos-1, .cal-pos-2, .cal-pos-3, .cal-neg-1, .cal-neg-2, .cal-neg-3 { border-color: transparent; }
.cal-pos-1 { background: var(--cal-pos-1); }
.cal-pos-2 { background: var(--cal-pos-2); }
.cal-pos-3 { background: var(--cal-pos-3); }
.cal-pos-4 { background: var(--cal-pos-4); border-color: var(--cal-pos-4); color: var(--cal-pos-4-fg); }
.cal-neg-1 { background: var(--cal-neg-1); }
.cal-neg-2 { background: var(--cal-neg-2); }
.cal-neg-3 { background: var(--cal-neg-3); }
.cal-neg-4 { background: var(--cal-neg-4); border-color: var(--cal-neg-4); color: var(--cal-neg-4-fg); }
/* on a shaded day the date takes the day's own text colour (muted grey on a tint falls under 4.5:1) */
.cal-day[class*="cal-pos-"] .cal-num, .cal-day[class*="cal-neg-"] .cal-num, .cal-even .cal-num { color: inherit; }
/* outside the filter's window: no border (its date keeps full contrast: it is still a button) */
.cal-out { border-color: transparent; }
.cal-day.is-today .cal-num { font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.cal-day.is-active { box-shadow: inset 0 0 0 2px var(--text); }
.cal-day:focus-visible { outline-offset: 1px; }
.cal-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cal-detail {
  display: flex; flex-direction: column; gap: 2px; min-height: 76px; margin-top: 4px; padding: 10px 12px;
  border-left: 3px solid var(--rail); background: var(--surface); font-size: 13.5px;
}
.cal-detail-day { font-weight: 700; }
.skeleton-cal { height: 300px; margin-top: 10px; }

@media (min-width: 768px) {
  .cal-wrap { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
}

@media (min-width: 1024px) {
  .stats-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ pills */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 4px; border: 1px solid transparent;
  font-size: 12px; font-weight: 650; line-height: 18px; white-space: nowrap;
}
/* results read like a settled bookmaker slip's stamp: WON / PLACED / LOST / VOID / OPEN */
.pill-won, .pill-placed, .pill-lost, .pill-void, .pill-open {
  padding: 1px 6px; border: 1.5px solid currentColor; border-radius: 3px; background: transparent;
  font-size: 11px; font-weight: 800; line-height: 16px; letter-spacing: 0.09em; text-transform: uppercase;
}
.pill-won { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.pill-placed { color: var(--info-text); }
.pill-lost { color: var(--loss-text); }
.pill-void { color: var(--muted); }
.pill-open { border-style: dashed; color: var(--muted); }
.pill-late { background: var(--warn-bg); color: var(--warn-text); }
.pill-check {
  position: relative; background: transparent; border-color: var(--warn); color: var(--warn-text);
  cursor: pointer; font-family: inherit;
}
.pill-check::before { content: ""; position: absolute; inset: -11px -4px; }
.pill-auto { background: var(--info-bg); color: var(--info-text); }
/* an own bet's tag: "Own bet", "Double", "Treble" (6.17) */
.pill-own { background: var(--accent-bg); color: var(--accent-text); }
/* a leg's own result inside a double / treble: a smaller stamp after its selection */
.pill.pill-xs {
  margin-left: 6px; padding: 0 4px; border-width: 1px;
  font-size: 9.5px; line-height: 13px; letter-spacing: 0.08em; vertical-align: 1px;
}

/* ------------------------------------------------------------------ bets list */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list-toolbar .switch-row { font-size: 14px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.own-note { margin: 0 0 8px; }
/* a double / treble in the table: one line per leg in Race, Selection and Odds, so a leg reads across.
   A leg line never wraps (a wrapped race or stamp would push that column's later legs down a line,
   beside another leg's price); the table scrolls inside .table-scroll instead. */
.leg-line { display: block; min-height: 24px; line-height: 24px; white-space: nowrap; }
.leg-line .trap { vertical-align: 0; }
.leg-line .race { display: inline; }
.odds-total { display: block; margin-top: 3px; padding-top: 3px; border-top: 1px solid var(--border); white-space: nowrap; }
/* ... and on a phone card: each leg as a selection line over its racecard line */
.bet-card-kind { display: inline-flex; align-items: center; gap: 8px; padding-top: 9px; font-size: 13px; }
.legs { display: flex; flex-direction: column; gap: 6px; margin: 6px 10px 4px 0; padding-left: 10px; border-left: 2px solid var(--border-strong); }
.leg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 0; }
.leg-price { margin-left: auto; padding-left: 10px; font-weight: 600; }
.leg-meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.list-more { display: flex; justify-content: center; margin-top: 12px; }
.list-count { color: var(--muted); font-size: 13px; }
.cards { display: flex; flex-direction: column; gap: 0; }
.bet-card { padding: 8px 0 12px; border-top: 1px solid var(--border); }
.bet-card:first-child { border-top: 0; }
.bet-card.is-dim { color: var(--muted); }
.bet-card-l1 { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 8px; }
.bet-card-l1 .cell-strong { padding-top: 9px; }
.bet-card-l1 .pill { margin-top: 9px; }
.bet-card-l2, .bet-card-l3 { padding-right: 10px; }
.bet-card-l2 { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.bet-card-l3 { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 14px; }
.bet-card-l3 > :last-child { margin-left: auto; font-weight: 700; }
.bet-card .badges { padding-right: 10px; }
.bet-card-note {
  margin: 6px 10px 0 0; padding-left: 8px; border-left: 2px solid var(--warn);
  font-size: 12.5px; color: var(--muted);
}
.odds-adds { display: block; font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-ever { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 28px 12px; }
.empty-ever p { max-width: 460px; }

/* ------------------------------------------------------------------ skeleton */
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton-tile { height: 64px; margin-right: 16px; }
.skeleton-chart { height: 220px; }
.skeleton-row { height: 46px; margin-bottom: 8px; }
.boot { display: flex; flex-direction: column; gap: 16px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ------------------------------------------------------------------ dialogs */
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-title { font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
.dialog-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-help { font-size: 12.5px; color: var(--muted); }
.form-error { color: var(--loss-text); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions .spacer { flex: 1 1 auto; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; align-items: center; gap: 10px; }
.tip-list { display: flex; flex-direction: column; gap: 0; max-height: 48vh; overflow-y: auto; }
/* flex: none -- min-height replaces the content-based minimum, so in the scrolling column
   the rows would otherwise shrink to 48px and hide the date/time line under the next row. */
.tip-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  flex: none; width: 100%; min-height: 48px; padding: 9px 8px; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; color: var(--text); cursor: pointer;
}
.tip-item:hover { background: var(--surface-2); }
.tip-item:focus-visible { outline-offset: -2px; }
.tip-item .tip-meta { grid-column: 1 / 2; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.tip-item .tip-right { grid-row: 1 / 3; grid-column: 2 / 3; text-align: right; }
.tip-tag { display: block; font-size: 12px; color: var(--muted); }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; }

/* ------------------------------------------------------------------ add my own bet (6.17) */
.own-pick, .own-slip { display: flex; flex-direction: column; gap: 14px; }
/* the kind: two radios drawn as a segmented control (the radio stays focusable, just unseen) */
.kind-switch {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 3px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
}
.kind-opt {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 8px; border-radius: 7px; text-align: center;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
.kind-opt input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.kind-opt.is-on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.kind-opt:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
/* the picker is a column that fits the dialog: the tip list is the one part that shrinks, to the
   room left between the search above and the legs bar below, and scrolls on its own. The bar is a
   plain footer (not sticky), so it never covers a focused tip (WCAG 2.4.11); on a very short
   screen the list keeps 96px and the whole dialog scrolls instead. */
.dialog-own-pick[open] { display: flex; flex-direction: column; }
.dialog-own-pick .dialog-body { flex: 1 1 auto; min-height: 0; }
.own-pick { flex: 1 1 auto; min-height: 0; }
.own-pick > .tip-list { flex: 1 1 auto; min-height: 96px; max-height: 48vh; margin-top: -8px; }
.tip-item.is-picked, .tip-item.is-picked:hover { background: var(--accent-bg); }
.tip-item:disabled { cursor: not-allowed; opacity: 0.55; }
.tip-item:disabled:hover { background: transparent; }
.tip-tag.is-on { color: var(--accent-text); font-weight: 700; }
.tip-meta .pill-xs { margin: 0 6px 0 0; }
/* under the list: the legs so far and Continue */
.pick-bar {
  flex: none;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--border); background: var(--surface);
}
.pick-legs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 260px; min-width: 0; }
.pick-legs .help { flex: 1 0 100%; }
.leg-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; text-align: left;
}
.leg-chip .trap { margin-right: 4px; }
.leg-chip-x { color: var(--muted); font-size: 11px; }
/* the slip: each leg with its odds box, then the stake and the live total */
.own-legs { display: flex; flex-direction: column; }
.own-leg {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px; align-items: center; gap: 8px 14px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.own-leg:first-child { padding-top: 0; }
.own-leg-sel { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 2px; }
.own-leg-odds { display: flex; flex-direction: column; gap: 4px; }
.own-change { display: flex; }
.slip-total {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0;
  padding: 12px 14px; border-radius: 8px; background: var(--surface-2);
}
.slip-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.slip-value { margin: 2px 0 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.help.own-late { color: var(--warn-text); }

/* ------------------------------------------------------------------ placer */
.hero { display: flex; flex-direction: column; gap: 8px; }
.hero-title { font-size: 18px; }
.hero-title .soon { color: var(--warn-text); }
.preview { display: flex; flex-direction: column; gap: 4px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.preview-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--border);
}
.preview-row:last-of-type { border-bottom: 0; }
.preview-row .input { max-width: 160px; }
.preview-label { font-weight: 600; }
.footnote { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ settings */
.settings-form { display: flex; flex-direction: column; gap: 4px; }
.setting {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px 20px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.setting:last-of-type { border-bottom: 0; }
.setting-label { font-weight: 600; padding-top: 9px; }
.setting-control { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.setting-control .input { max-width: 220px; }
.channel-stakes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.channel-stakes .input { max-width: none; }
.help { color: var(--muted); font-size: 13px; }
.settings-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ auth views */
.view-auth { align-items: center; padding-top: 6vh; }
.auth-card {
  width: 100%; max-width: 440px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 22px;
  background: none; border: 0;
}
.auth-card .brand-mark { width: 64px; height: 64px; border-radius: 50%; }
.auth-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.auth-title::after {
  content: ""; display: block; width: 48px; height: 2px; margin: 12px auto 0; background: var(--rail);
}
.auth-note { color: var(--muted); font-size: 13px; max-width: 340px; }
.auth-error { color: var(--loss-text); font-size: 14px; }
.auth-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 280px; }

/* ------------------------------------------------------------------ responsive */
/* the headline strip below 1024px: Profit across the top, the other four in a row under it
   (five across would leave about 100px a figure at 768px and cut off a four-figure £) */
@media (max-width: 1023.98px) {
  .tiles, .skeleton-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: 4px; }
  .tiles > :first-child, .skeleton-tiles > :first-child { grid-column: 1 / -1; padding-bottom: 12px; }
  .tiles > .tile:not(:first-child) { padding: 10px 14px 12px; border-top: 1px solid var(--border); }
  .tiles > .tile:nth-child(2) { padding-left: 0; border-left: 0; }
  .skeleton-tile { margin: 0 14px 12px 0; }
}

@media (min-width: 768px) and (max-width: 959.98px) {
  .bets-table { font-size: 13.5px; }
  .bets-table th, .bets-table td { padding-left: 5px; padding-right: 5px; }
}

/* four tabs: brand, tabs and tools stay on one header row down to 640px (the icon button keeps
   its aria-label without the "Auto" text) */
@media (max-width: 899.98px) {
  .theme-label { display: none; }
  .tab { padding: 0 8px; }
}

@media (max-width: 767.98px) {
  .setting { grid-template-columns: 1fr; }
  .setting-label { padding-top: 0; }
  /* the headline strip: Profit across the top, then ROI / EV taken and Beat SP / Bets */
  .tiles, .skeleton-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles > .tile:first-child .tile-value { font-size: 38px; }
  .tiles > .tile:not(:first-child) { padding: 10px 14px 12px 0; border-left: 0; }
  .tiles > .tile:nth-child(odd):not(:first-child) { padding-left: 14px; border-left: 1px solid var(--border); }
}

@media (max-width: 639.98px) {
  .header-inner { gap: 6px 8px; }
  .tabs { order: 3; flex: 1 0 100%; margin-left: 0; }
  /* four tabs: sized by their text (nowrap), so "Auto-placer" never breaks at its hyphen */
  .tab { flex: 1 1 auto; padding: 0 6px; white-space: nowrap; }
  .theme-label { display: none; }
  .tab[aria-current="page"]::after { left: 4px; right: 4px; }
  .tile-value { font-size: 21px; }
  /* nowrap: else the column's line takes the chips' full width and the page scrolls sideways */
  .filters { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  /* one swipeable row of channel chips, edge to edge (no orphan chip on a second line); the 4px
     padding keeps the focus ring inside the scroller */
  .chips {
    flex-wrap: nowrap; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: -4px -16px; padding: 4px 16px; scroll-padding: 0 16px; scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .segmented { display: flex; }
  .seg { flex: 1 1 0; padding: 0 4px; }
  .card { padding: 14px 12px; }
  .field-row, .search-row { grid-template-columns: 1fr; }
  .add-row { grid-template-columns: minmax(0, 1fr) 100px; }
  .own-leg { grid-template-columns: minmax(0, 1fr) 112px; }
  .slip-total { padding: 10px 12px; }
  .slip-value { font-size: 15px; }
  /* 7 calendar days in 328px: about 43px a day */
  .cal { border-spacing: 2px; }
  .cal-day { min-height: 46px; padding: 3px 2px 4px; }
  .cal-pl { font-size: 11px; letter-spacing: -0.01em; text-align: center; }
  .cal-figures .stat-value { font-size: 16px; }

  /* dialogs become full-width bottom sheets */
  .dialog {
    width: 100%; max-width: 100%; max-height: 90vh;
    margin: auto 0 0 0; border-radius: 16px 16px 0 0; border-bottom: 0;
  }
  .dialog-body { padding: 16px 16px 20px; }
  .actions .btn { flex: 1 1 auto; }
  .actions .spacer { display: none; }
}

@media (max-width: 420px) {
  .user-name { display: none; }
  .user-chip { padding: 0 6px 0 4px; }
  .tabs { gap: 2px; }
  .tab { padding: 0 4px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
