/* Ippion — demo interna. Tema scuro, accento arancione, quote in giallo oro. */

/* Barlow / Barlow Condensed (SIL OFL), latin subset served from /fonts: no third-party origin. */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/barlow-400.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/barlow-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-700.woff2) format('woff2'); }

:root {
  --bg: #0d1218;
  --bg-2: #11171e;
  --surface: #19212b;
  --surface-2: #212b37;
  --surface-3: #2a3644;
  --surface-4: #334252;
  --line: #2f3b49;
  --line-2: #3c4a5a;
  --text: #e9eef3;
  --muted: #95a3b2;
  --faint: #6d7b8a;
  --accent: #e96105;
  --accent-2: #c25004;
  --accent-ink: #1b222c;
  --odds: #f4cf4a;
  --odds-bg: #34414f;
  --odds-bg-hover: #405062;
  --odds-final: #ebff00; /* Snai's colour for prices of finished races */
  --st-open: #3d8bfd;
  --st-closed: #e5484d;
  --st-result: #2fb46c;
  --st-void: #8b98a5;
  --hot: #ffb224;
  --danger: #ff6b6b;
  --ok: #3ad08a;
  --focus: #ff9d5c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  min-height: 100vh;
}

a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.header-inner {
  /* Full width like the three columns below: the logo lines up with the programme column (as on Snai). */
  max-width: none; margin: 0; height: 54px; padding: 0 16px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; flex: none; text-decoration: none; border-radius: 4px; }
/* Ippion logo (public/img/ippion-logo.svg, 245×68): orange horse mark + IPPION wordmark drawn as paths. */
.brand-logo { height: 30px; width: auto; }
.main-nav { display: flex; align-items: stretch; height: 100%; gap: 4px; }
.main-nav a {
  display: flex; align-items: center; padding: 0 12px; text-decoration: none;
  font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.header-side { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.clock { font: 600 14px/1 var(--font-cond); color: var(--muted); letter-spacing: .04em; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { margin: 0; padding: 10px 16px; }
.breadcrumb ol { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--faint); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--accent); font-weight: 600; }

/* ---------- Shell ---------- */
/* A tutta larghezza come Snai: le tre colonne toccano i bordi della finestra, senza cornice. */
.shell {
  padding: 0 0 32px;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 64px; max-height: calc(100vh - 76px); display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-head { display: none; }
.side-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.side-tab {
  background: none; border: 0; padding: 14px 6px 12px; font-weight: 700; font-size: 14px; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.side-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.side-tab:hover { color: var(--text); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); position: relative; }

/* Filter pills: dark rounded groups, a thin divider between the two halves, the pressed half lit. */
.fgroup { display: inline-flex; align-items: stretch; height: 28px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.fpill {
  background: transparent; border: 0; padding: 0 9px; min-width: 32px; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: background-color .15s, color .15s;
}
.fpill + .fpill { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .16); }
.fpill:hover { background: var(--surface-4); }
.fpill[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.fpill[aria-pressed="true"] + .fpill, .fpill + .fpill[aria-pressed="true"] { box-shadow: none; }
.fpill .icon { width: 16px; height: 16px; }
.fpill .flag { width: 18px; height: 12px; border-radius: 2px; }
.fpill-txt { font: 700 11px/1 var(--font); letter-spacing: .03em; }
.fround {
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text);
  display: inline-grid; place-items: center; padding: 0;
}
.fround:first-of-type { margin-left: auto; }
.fround:hover:not(:disabled) { background: var(--surface-4); }
.fround[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.fround:disabled { opacity: .45; cursor: default; }
.fround .icon { width: 16px; height: 16px; }

/* Settings popover of the programme. */
.side-settings {
  position: absolute; top: calc(100% - 4px); right: 10px; z-index: 5; width: min(270px, calc(100% - 20px));
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 12px; display: grid; gap: 10px;
}
.ss-title { font: 700 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ss-opt { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; }
.ss-opt input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.ss-opt span { display: grid; gap: 2px; }
.ss-opt small { color: var(--muted); font-size: 12px; }
.ss-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ss-actions .btn { padding: 6px 12px; font-size: 13px; }

.side-body { overflow-y: auto; flex: 1; min-height: 120px; }
.side-foot { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }

.country { border-bottom: 1px solid var(--line); }
.country > summary, .meeting > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.country > summary::-webkit-details-marker, .meeting > summary::-webkit-details-marker { display: none; }
.country > summary { padding: 13px 14px; font: 700 14px/1 var(--font); letter-spacing: .02em; text-transform: uppercase; }
.country > summary:hover { background: var(--surface-2); }
.country .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.chev { width: 16px; height: 16px; color: var(--text); transition: transform .2s; }
/* apertura tendine: dissolvenza come su Snai (opacity 300ms ease-out) */
.acc-in { animation: acc-in .3s ease-out; }
@keyframes acc-in { from { opacity: 0; } }
details[open] > summary .chev { transform: rotate(180deg); }

.meeting { border-top: 1px solid var(--line); background: var(--bg-2); }
.meeting > summary { padding: 10px 14px 10px 22px; font-size: 13px; font-weight: 600; }
.meeting > summary:hover { background: var(--surface-2); }
.meeting .disc { color: var(--muted); }
.meeting .meet-time { margin-left: auto; color: var(--muted); font-size: 12px; }
.meeting .meet-venue { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting .meet-count { margin-left: auto; color: var(--muted); font: 600 12px/1 var(--font); font-variant-numeric: tabular-nums; }

/* Square race tiles: number, status-coloured time strip, Tot corner triangle, T / TQQ marks. */
.race-tiles { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 12px 22px; }
.race-tile {
  position: relative; width: 46px; height: 46px; display: flex; flex-direction: column; text-decoration: none;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface);
}
.race-tile:hover { border-color: var(--accent); }
.race-tile.is-current { outline: 2px solid var(--accent); outline-offset: 1px; }
.race-tile.has-tot::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 11px 11px 0; border-color: transparent var(--accent) transparent transparent;
}
.rt-num { position: relative; flex: 1; display: grid; place-items: center; }
.rt-num b { font: 700 19px/1 var(--font-cond); }
.rt-mark { position: absolute; left: 3px; bottom: 1px; font: italic 700 10px/1 var(--font); color: var(--odds); }
.rt-mark.rt-tqq { font-size: 8px; letter-spacing: -.02em; }
.rt-time { height: 15px; display: grid; place-items: center; font: 600 10.5px/1 var(--font); color: #fff; }
.race-tile.no-time .rt-time { height: 5px; }

/* Antepost list: date box, discipline, venue / race / runners + distance, flag. */
.ap-item {
  display: grid; grid-template-columns: 40px 18px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.ap-item:hover { background: var(--surface-2); }
.ap-item.is-current { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
.ap-date { display: grid; justify-items: center; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.ap-date b { font: 700 17px/1 var(--font-cond); padding: 5px 0 3px; }
.ap-date span { width: 100%; text-align: center; font: 700 10px/1 var(--font); text-transform: uppercase; padding: 3px 0; background: var(--accent); color: var(--accent-ink); }
.ap-disc { color: var(--muted); display: grid; place-items: center; }
.ap-disc .icon { width: 17px; height: 17px; }
.ap-main { display: grid; gap: 2px; min-width: 0; }
.ap-venue { font-weight: 700; text-transform: uppercase; font-size: 13px; }
.ap-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-sub { display: flex; gap: 10px; color: var(--muted); font-size: 12px; }
.ap-item .flag { width: 20px; height: 14px; border-radius: 2px; }
.race-chip {
  display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; text-decoration: none;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface);
}
.race-chip b { font: 700 14px/1.2 var(--font-cond); padding: 3px 0 1px; }
.race-chip span { font: 600 11px/1 var(--font); width: 100%; text-align: center; padding: 3px 4px; color: #fff; }
.race-chip:hover { border-color: var(--accent); }
.race-chip.is-current { outline: 2px solid var(--accent); }

.next-list li a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  text-decoration: none; font-size: 13px;
}
.next-list li a:hover { background: var(--surface-2); }
.next-list .next-venue { font-weight: 700; text-transform: uppercase; font-size: 13px; }
.next-list .next-sub { color: var(--muted); font-size: 12px; }
.side-empty { padding: 22px 16px; color: var(--muted); font-size: 13px; text-align: center; }

.legend { background: var(--surface-2); border-radius: var(--radius-sm); padding: 0 12px; }
.legend summary { padding: 10px 0; font: 700 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); cursor: pointer; }
.legend ul { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 0 0 12px; font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.st-open { background: var(--st-open); }
.st-closed { background: var(--st-closed); }
.st-scheduled { background: #f2960b; }
.st-result { background: var(--st-result); }
.st-void { background: var(--st-void); }
.legend-ico .icon, .legend-ico { width: 15px; height: 15px; color: var(--muted); }
.legend-hot { color: var(--hot); font-size: 12px; width: 18px; text-align: center; }
.legend .legend-marks { grid-template-columns: auto auto 1fr; border-top: 1px solid var(--line); padding-top: 10px; }
.lg-mark { position: relative; width: 22px; height: 14px; display: inline-grid; place-items: center; font: italic 700 10px/1 var(--font); color: var(--odds); }
.lg-mark.lg-tqq { width: auto; font-size: 9px; }
.lg-tot::after {
  content: ""; position: absolute; top: 1px; right: 4px; width: 0; height: 0;
  border-style: solid; border-width: 0 11px 11px 0; border-color: transparent var(--accent) transparent transparent;
}
/* "Annullata": grey strip, also used for races in any state the legend does not list. */
.dot.st-void { background: var(--st-void); }
.odd.is-susp { color: var(--muted); font-style: italic; }

.sidebar-backdrop { display: none; }

/* ---------- Main column ---------- */
.main-col { min-width: 0; min-height: 70vh; padding: 0 8px; }
.toolbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: relative; flex-wrap: wrap;
}
.toolbar-title { font: 600 26px/1 var(--font-cond); color: var(--muted); letter-spacing: .01em; }
.toolbar .program-btn { display: none; }
.radio-btn {
  display: inline-flex; align-items: center; gap: 8px; background: none; border: 0;
  font: 700 13px/1 var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.radio-btn .icon {
  width: 30px; height: 30px; padding: 6px; border-radius: 50%; border: 1px solid var(--line-2);
}
.radio-btn[aria-pressed="true"] .icon { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface-2); padding: 0 16px 0 40px; font-size: 14px;
}
.search input::placeholder { color: var(--faint); }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-ico.icon, .search .icon { width: 17px; height: 17px; }
.search > .icon { position: absolute; left: 14px; top: 11px; color: var(--muted); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 30; background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 360px; overflow-y: auto;
}
.search-results a {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center;
  padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 13px;
}
.search-results a:hover, .search-results a:focus { background: var(--surface-3); }
.search-results .sr-name { font-weight: 700; }
.search-results .sr-sub { grid-column: 2; color: var(--muted); font-size: 12px; }
.search-results .sr-field { font-size: 11px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.search-results .sr-empty { padding: 14px; color: var(--muted); font-size: 13px; }

.slip-buttons { display: flex; gap: 8px; margin-left: auto; }

.content { padding: 16px; outline: none; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 700 13px/1 var(--font); letter-spacing: .05em; text-transform: uppercase; text-decoration: none;
}
.btn-light { background: #f3f6f9; color: #0f151c; }
.btn-light:hover { background: #fff; }
.btn-dark { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff7a1f; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: none; border-color: var(--line-2); color: var(--text); }
.btn-block { width: 100%; }
.badge-count {
  min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; display: inline-grid; place-items: center; padding: 0 5px; letter-spacing: 0;
}
.badge-count.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center;
  background: none; border: 1px solid var(--line-2); color: var(--text); text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Sezioni ---------- */
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title { font: 600 24px/1.1 var(--font-cond); letter-spacing: .01em; }
.section-head .spacer { margin-left: auto; }
.carousel-nav { display: flex; gap: 8px; margin-left: auto; }
.carousel-nav .icon-btn { width: 30px; height: 30px; }
.carousel-nav .icon-btn .icon { width: 16px; height: 16px; }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-3); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 14px;
}
.seg button {
  background: none; border: 0; padding: 12px; font: 700 13px/1 var(--font); letter-spacing: .06em;
  text-transform: uppercase; color: var(--text);
}
.seg button[aria-selected="true"] { background: var(--surface-4); color: var(--accent); }
.seg button:disabled { color: var(--faint); cursor: not-allowed; }
.seg.seg-single { grid-template-columns: 1fr; }

.carousel {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 340px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin;
}
.carousel > * { scroll-snap-align: start; }
/* In evidenza: as on Snai, three whole cards fill the row at any width (never a cut card);
   the arrows move by one full page. */
.carousel.carousel-3 { grid-auto-columns: max(250px, calc((100% - 28px) / 3)); }

/* ---------- Card corsa (evidenza) ---------- */
.race-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-width: 0;
}
.rc-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 8px; }
.num-time { display: flex; flex-direction: column; align-items: center; min-width: 44px; border-radius: 6px; overflow: hidden; background: var(--surface-4); }
.num-time b { font: 700 20px/1.1 var(--font-cond); padding: 4px 0 2px; }
.num-time span { width: 100%; text-align: center; font: 600 11px/1 var(--font); padding: 4px 3px; color: #fff; }
.rc-title { min-width: 0; flex: 1; }
.rc-venue { display: flex; align-items: center; gap: 6px; font: 700 14px/1.2 var(--font); text-transform: uppercase; }
.rc-venue .icon { width: 15px; height: 15px; color: var(--muted); }
.rc-name { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot {
  display: inline-flex; gap: 1px; background: var(--hot); color: #3b2300; border-radius: 999px;
  padding: 3px 7px; font-size: 10px; line-height: 1; flex: none;
}
.rc-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rc-facts dt { font-size: 11px; color: var(--muted); }
.rc-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; }
.rc-favs { padding: 8px 12px 4px; }
.rc-favs-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding-bottom: 6px; }
.fav { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) 88px; gap: 8px; align-items: center; padding: 6px 0; }
.fav-num { font: 700 15px/1 var(--font-cond); color: var(--accent); text-align: center; }
.fav-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-go {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px;
  color: var(--accent); font: 700 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
}
.rc-go:hover { text-decoration: underline; }

/* ---------- Quote ---------- */
.odd {
  height: 40px; min-width: 70px; width: 100%; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--odds-bg); color: var(--text); font: 700 15px/1 var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.odd:hover { background: var(--odds-bg-hover); }
.odd[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.odd { position: relative; }
.odd.trend-up::after, .odd.trend-down::after {
  position: absolute; top: 3px; right: 5px; font-size: 8px; line-height: 1;
}
.odd.trend-up::after { content: "▲"; color: var(--ok); }
.odd.trend-down::after { content: "▼"; color: var(--danger); }
.odd[aria-pressed="true"].trend-up::after, .odd[aria-pressed="true"].trend-down::after { color: var(--accent-ink); }
.flash-up { animation: flash-up 2.4s ease-out; }
.flash-down { animation: flash-down 2.4s ease-out; }
@keyframes flash-up { 0%, 35% { background-color: rgba(58, 208, 138, .45); color: #eafff4; } }
@keyframes flash-down { 0%, 35% { background-color: rgba(255, 107, 107, .45); color: #fff0f0; } }
span.flash-up, span.flash-down { border-radius: 4px; }

.live-pill {
  display: inline-flex; align-items: center; gap: 6px; font: 700 11px/1 var(--font); letter-spacing: .06em;
  color: var(--ok); padding: 6px 8px; border-radius: 6px; background: rgba(58, 208, 138, .1);
}
.live-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.live-pill.is-off { color: var(--faint); background: var(--surface-2); }
.live-pill.is-off::before { animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.si-odds .was { color: var(--faint); text-decoration: line-through; font-weight: 600; margin-right: 6px; font-size: 12px; }
.si-odds.up { color: var(--ok); }
.si-odds.down { color: var(--danger); }
.odd.is-static { cursor: default; color: var(--muted); }
.odd.is-off { color: var(--faint); background: var(--surface-3); cursor: default; }
/* Race no longer open: final prices as plain lime text on the row, as on Snai; missing ones grey. */
.odd.is-final { background: transparent; border-color: transparent; color: var(--odds-final); }
.odd.is-final.is-off { color: var(--c500, #5b697c); }

/* ---------- Silks e bandiere ---------- */
.silk { width: 30px; height: 26px; flex: none; object-fit: contain; }
.silk.sm { width: 24px; height: 21px; }
.flag { width: 20px; height: 14px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }

/* ---------- CORSE IN PARTENZA header ---------- */
.cip-header {
  background: linear-gradient(135deg, #1a2332, #0d1219); padding: 12px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; justify-content: center;
}
.cip-header span { color: #f90; font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }

/* ---------- Ippica Broadcast (come Snai: player a sinistra, canali a destra) ---------- */
.bc { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; align-items: start; }
.bc-player { background: #2e3845; border-radius: 6px; padding: 8px 8px 0; min-width: 0; }
.bc-screen, .bc-msg { aspect-ratio: 16 / 9; background: #000; border-radius: 2px; overflow: hidden; }
.bc-video { width: 100%; height: 100%; display: block; background: #000; }
.bc-msg { display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; color: #9cabc0; font-size: 14px; background: #0f1315; }
.bc-msg .icon { width: 40px; height: 40px; color: #5b697c; }
.bc-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px 12px; }
.bc-caption small, .bc-card small { display: block; font: 600 11px/1.3 var(--font); color: #bbcade; text-transform: uppercase; }
.bc-caption strong { display: block; font: 700 20px/1.2 var(--font-cond); color: var(--accent); text-transform: uppercase; }
.bc-ext { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: #fff; flex: none; }
.bc-ext:hover { background: #3f4d60; }
.bc-ext.is-off { color: #5b697c; }
.bc-ext .icon { width: 20px; height: 20px; }
.bc-list { display: grid; gap: 12px; max-height: 470px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.bc-card { background: #2e3845; border-radius: 6px; padding: 12px; }
.bc-card.is-playing { box-shadow: inset 3px 0 0 var(--accent); }
.bc-card-top { display: flex; justify-content: space-between; gap: 8px; }
.bc-card strong { display: block; font: 700 14px/1.3 var(--font); color: #fff; text-transform: uppercase; margin-top: 4px; }
.bc-hours { display: block; font-size: 11px; color: #9cabc0; margin-top: 2px; }
.bc-more { background: none; border: 0; color: #fff; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; }
.bc-more .icon { width: 16px; height: 16px; transition: transform .2s; }
.bc-more[aria-expanded="true"] { color: var(--accent); }
.bc-more[aria-expanded="true"] .icon { transform: rotate(180deg); }
.bc-venues { margin-top: 8px; font-size: 12px; color: #bbcade; }
.bc-venues ul { margin-top: 4px; display: grid; gap: 2px; color: #fff; font-weight: 600; }
.bc-card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.bc-status, .bc-watch { font: 700 14px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.bc-watch { background: none; border: 0; padding: 4px 0; }
.bc-watch:hover { text-decoration: underline; }
@media (max-width: 1180px) {
  .bc { grid-template-columns: 1fr; }
  .bc-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: none; }
}

/* ---------- Dirette ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; min-height: 320px; }
.player {
  background: #0d1219; border-radius: var(--radius); border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
/* keep legacy .player-msg for backward compat */
.player-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--muted); font-size: 14px;
}
.player-msg .icon { width: 42px; height: 42px; margin: 0 auto 10px; color: var(--faint); }
.player-cap { position: relative; padding: 12px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.player-cap small { display: block; font-size: 11px; color: var(--muted); }
.player-cap strong { color: var(--accent); font: 700 18px/1.1 var(--font-cond); text-transform: uppercase; }
/* new player internals */
.player-inner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
.player-badge { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: #f90; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #f90; display: inline-block; animation: pulse 1.6s infinite; }
.player-channel-name { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: #fff; }
.player-channel-name .icon { width: 24px; height: 24px; color: var(--muted); }
.player-msg-text { color: var(--faint); text-align: center; font-size: 13px; margin: 0; }
.player-bar { background: #1a2332; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; }
.player-bar-code { font-size: 12px; color: var(--muted); }
.player-bar-status { font-size: 12px; font-weight: 700; color: var(--ok); }
/* channel list */
.channels { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 320px; padding-right: 4px; }
.channel {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; cursor: pointer;
  background: #0d1219; border: 1px solid transparent; border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.channel:hover { background: #1a2332; }
.channel.is-active { border-color: #f90; background: rgba(255, 153, 0, 0.08); }
.ch-info { flex: 1; min-width: 0; }
.ch-code { display: block; font-size: 11px; color: var(--muted); font-style: normal; }
.ch-name { display: block; font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-status { font-size: 11px; color: var(--muted); font-style: normal; white-space: nowrap; }
.ch-status.is-live { color: var(--ok); }
.channel .icon { color: var(--faint); flex-shrink: 0; }
.channel[aria-pressed="true"] { border-color: var(--accent); }

/* ---------- Liste corse ---------- */
.list-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.race-rows { display: grid; gap: 6px; }
.race-line {
  display: grid; grid-template-columns: 50px minmax(0, 1.4fr) minmax(0, 1.6fr) 24px; gap: 12px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px;
  text-decoration: none;
}
.race-line:hover { border-color: var(--line-2); background: var(--surface-3); }
.race-line .rl-venue { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.race-line .rl-venue .icon { width: 14px; height: 14px; color: var(--muted); }
.race-line .rl-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.race-line .rl-right { font-size: 12px; }
.race-line .rl-meta { display: flex; gap: 14px; color: var(--text); font-weight: 600; }
.race-line .rl-odds { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-weight: 700; }
.race-line .rl-odds b { color: var(--text); }
.race-line .rl-odds span { color: var(--odds); }
.race-line .rl-arr { color: var(--muted); }
.race-line .rl-arr b { color: var(--text); letter-spacing: .03em; }
.race-line > .icon { color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 12px; font-weight: 700; font-size: 13px; }
.pager .icon-btn { width: 28px; height: 28px; border-color: var(--accent); color: var(--accent); }
.pager .icon-btn .icon { width: 14px; height: 14px; }

/* ---------- Risultati ---------- */
.result-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.res-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.res-head .tag { background: var(--surface-4); color: var(--text); padding: 4px 8px; border-radius: 4px; font-weight: 700; font-size: 11px; text-transform: uppercase; }
.res-venue { font: 700 16px/1.2 var(--font); text-transform: uppercase; margin: 8px 0 6px; display: flex; gap: 6px; align-items: center; }
.placing { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.placing .pos { font: 700 20px/1 var(--font-cond); color: var(--hot); }
.placing .p-name { font-weight: 700; font-size: 13px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placing .p-sub { font-size: 11px; color: var(--muted); }
.placing .p-odds { text-align: right; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.placing .p-odds b { display: block; color: var(--odds); font-size: 15px; }

/* ---------- News ---------- */
.news-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.news-card time { font-size: 11px; color: var(--muted); }
.news-card h3 { font-size: 14px; font-weight: 700; line-height: 1.3; }
.news-card p { font-size: 13px; color: var(--muted); }
.news-card details summary { color: var(--accent); font: 700 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; margin-top: auto; list-style: none; }
.news-card details summary::-webkit-details-marker { display: none; }
.news-card details[open] summary { margin-bottom: 6px; }
.news .carousel { grid-auto-columns: minmax(220px, 1fr); }
.version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }

/* ---------- Dettaglio corsa ---------- */
.race-header { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.rh-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rh-title { display: flex; align-items: center; gap: 10px; font: 700 24px/1.1 var(--font-cond); text-transform: uppercase; letter-spacing: .02em; }
.rh-title .flag { width: 28px; height: 19px; }
.rh-title .icon { width: 22px; height: 22px; color: var(--muted); }
.race-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; max-width: 100%; }
.race-nav .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 420px; }
.race-nav .icon-btn { width: 30px; height: 30px; }
.race-nav .race-chip { flex-direction: row; min-width: 0; flex: none; }
.race-nav .race-chip b { padding: 4px 8px; }
.race-nav .race-chip span { width: auto; padding: 6px 8px; }
.rh-facts { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 12px; }
.rh-facts dt { font-size: 11px; color: var(--muted); }
.rh-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; }
.state-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-open { color: #7fb4ff; }
.state-closed { color: #ff8a8d; }
.state-scheduled { color: #ffb45c; }
.state-result { color: #63d99a; }

.market-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 14px 0 8px; }
.market-tab {
  background: none; border: 0; padding: 10px 12px; font: 700 13px/1 var(--font); text-transform: uppercase;
  color: var(--text); border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center;
}
.market-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.market-tab:disabled { color: var(--faint); cursor: not-allowed; }
.market-tab .soon { font-size: 10px; background: var(--surface-3); color: var(--muted); border-radius: 4px; padding: 3px 5px; }
.sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sort { font-size: 15px; font-weight: 600; color: var(--text); }
.sort select {
  appearance: none; -webkit-appearance: none; height: 38px; min-width: 162px; cursor: pointer;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M.75.75l4 4 4-4' stroke='%231b222c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 0; color: var(--accent-ink); border-radius: 4px; padding: 0 30px 0 14px;
  font: 700 12px/1 var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.sort select:hover { filter: brightness(.92); }
.sort select option { background: var(--surface-2); color: var(--text); }

/* Vincente/Piazzato list. Sized on the centre column (.market-body is an inline-size container), not on
   the viewport: with the program sidebar and the slip column open, a 1280 px screen leaves ~490 px here. */
.runners-head, .runner-row {
  display: grid; grid-template-columns: 46px 34px minmax(0, 1fr) 110px 84px repeat(3, 78px) 32px; gap: 10px; align-items: center;
}
.r-odds { display: contents; }
.runners-head { padding: 6px 12px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.runners-head .r-odds span { text-align: center; }
.runner { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; }
.runner.is-open { border-color: var(--line-2); background: var(--surface-3); }
.runner-row { padding: 8px 12px; }
/* Finished race: a finishing-position box ("1°", "-" when unplaced) before the number, as on Snai. */
.runners-head.has-pos, .runner-row.has-pos { grid-template-columns: 34px 30px 34px minmax(0, 1fr) 110px 84px repeat(3, 78px) 32px; }
.r-pos {
  display: grid; place-items: center; height: 34px; border-radius: var(--radius-sm);
  background: var(--c100, #1b222c); color: var(--accent); font: 700 17px/1 var(--font-cond);
}
.r-num { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.r-num b { font: 700 18px/1 var(--font-cond); color: var(--accent); }
.r-num small { font-size: 10px; color: var(--muted); margin-top: 4px; }
.r-name { min-width: 0; }
.r-name strong { font-size: 14px; }
.r-name .r-sex { color: var(--muted); font-size: 12px; white-space: nowrap; }
.r-name p { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-name .r-rating { font-size: 11px; color: var(--muted); }
.r-form { font-size: 11px; color: var(--muted); }
.r-form b { display: block; color: var(--text); font-size: 13px; margin-top: 3px; letter-spacing: .04em; }
.runner.is-scratched .r-name strong { text-decoration: line-through; color: var(--muted); }
.nr-tag { grid-column: span 2; text-align: center; font-size: 12px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: .05em; }
.expand { background: none; border: 0; color: var(--text); width: 32px; height: 32px; display: grid; place-items: center; }
.expand .icon { transition: transform .2s; }
.expand[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* Scheda cavallo (Riepilogo / Prestazioni / Legenda), ricalcata sul pannello Snai */
.runner-more { padding: 8px 24px 20px; }
.hd-tabs.seg { grid-template-columns: repeat(3, 1fr); gap: 8px; background: none; border-radius: 0; overflow: visible; margin-bottom: 14px; }
.hd-tabs.seg button { height: 42px; border: 1px solid #45556a; border-radius: 4px; background: #1b222c; color: #fff; font: 700 15px/1 var(--font-cond); letter-spacing: .06em; }
.hd-tabs.seg button[aria-selected="true"] { background: #45556a; color: var(--accent); }
.hd-tabs.seg button:not([aria-selected="true"]):hover { background: #2e3845; }
.hd { display: grid; gap: 16px; font-size: 12px; }
.hd .hd-props { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.hd-props > div { border-bottom: 1px solid #45556a; padding-bottom: 6px; min-width: 0; }
.hd-props dt, .hd dl dt { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #9cabc0; }
.hd-props dd { margin: 6px 0 0; font-weight: 600; font-size: 14px; color: #fff; overflow-wrap: anywhere; }
.hd-driver, .hd-box { background: #1b222c; border: 1px solid #45556a; border-radius: 6px; padding: 12px 14px; }
.hd h4 { font: 700 11px/1.2 var(--font); text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.hd-driver { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hd-driver-name { font: 700 18px/1.1 var(--font-cond); color: #fff; letter-spacing: .02em; }
.hd dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 16px; margin: 0; }
.hd-driver dl { grid-template-columns: repeat(4, auto); }
.hd dl dd { margin: 4px 0 0; font-weight: 700; font-size: 15px; color: #fff; }
.hd-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hd-box-2 dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hd-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 8px 0; }
.perf-wrap { overflow-x: auto; }
.perf-pos { font-weight: 700; color: #fff; white-space: nowrap; }
@media (max-width: 1180px) {
  .hd .hd-props { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hd-boxes { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .runner-more { padding: 8px 10px 14px; }
  .hd .hd-props { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd dl, .hd-driver dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 16px; }
.facts-grid dt { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.facts-grid dd { margin: 3px 0 0; font-weight: 600; font-size: 14px; }
.perf { width: 100%; border-collapse: collapse; font-size: 13px; }
.perf th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 600; padding: 6px 8px; }
.perf td { padding: 8px; border-top: 1px solid var(--line); }
.legend-text { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }

.result-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }
.result-box h2 { font: 600 20px/1.1 var(--font-cond); margin-bottom: 8px; }
.result-box ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 18px; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(229, 72, 77, .12); color: #ffb3b5; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.note.info { background: rgba(233, 97, 5, .12); color: #ffc39a; }

/* ---------- Pagine ---------- */
.page-title { font: 600 28px/1.1 var(--font-cond); margin-bottom: 14px; }
.date-switch { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.date-switch .day { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; text-decoration: none; }
.date-switch .day[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Risultati e partenti ---------- */
.res-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 12px; }
.res-controls .date-switch { margin-bottom: 0; }
.res-archive { display: flex; align-items: center; gap: 8px; }
.res-archive label { font: 700 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.res-date-input {
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 12px;
  font: 600 13px/1 var(--font); color: var(--text); color-scheme: dark;
}
.res-date-input:focus-visible { border-color: var(--accent); }
.res-search-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.res-search { position: relative; }
.res-search .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; }
.res-search input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 14px 9px 36px; font-size: 14px;
}
.res-search input:focus-visible { border-color: var(--accent); }
.res-search-list {
  position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.res-search-list a { display: grid; gap: 2px; padding: 9px 12px; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 13px; }
.res-search-list a:hover, .res-search-list a:focus-visible { background: var(--surface-3); }
.res-search-list a span { color: var(--muted); font-size: 12px; }
.res-search-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.res-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.res-day-title { font: 600 20px/1.1 var(--font-cond); }
.res-filters { margin-left: auto; }
.res-grid { display: grid; gap: 6px; }
.res-row {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px;
}
.res-venue {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 10px; border-radius: 6px;
  background: var(--surface-3); font: 700 13px/1.1 var(--font); text-transform: uppercase;
}
.res-venue .flag { width: 20px; height: 14px; border-radius: 2px; flex: none; }
.res-venue-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-gt { flex: none; padding: 3px 6px; border-radius: 4px; font: 700 11px/1 var(--font); letter-spacing: .04em; }
.res-gt.is-gl { background: #2d6a4f; color: #e8fff2; }
.res-gt.is-tr { background: #4a4e9c; color: #eef0ff; }
.res-races { display: flex; flex-wrap: wrap; gap: 6px; }
.res-race {
  position: relative; display: inline-flex; align-items: stretch; height: 34px; border-radius: 6px; overflow: hidden;
  text-decoration: none; border: 1px solid var(--line-2);
}
.res-race:hover, .res-race:focus-visible { border-color: var(--accent); }
.res-race.has-tot::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 9px 9px 0; border-color: transparent var(--accent) transparent transparent;
}
.rr-num { min-width: 30px; display: grid; place-items: center; background: var(--bg-2); font: 700 16px/1 var(--font-cond); padding: 0 6px; }
.rr-time { display: flex; align-items: center; gap: 5px; padding: 0 9px; font: 600 12px/1 var(--font); color: #fff; }
.rr-mark { font: italic 700 10px/1 var(--font); color: #fff4b8; }
.res-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.res-legend li { display: flex; align-items: center; gap: 6px; }
.res-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.res-back:hover { color: var(--text); }
.res-payouts, .res-runners { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }
.res-payouts h3, .res-runners h3 { font: 600 18px/1.1 var(--font-cond); margin-bottom: 8px; }
.res-payouts dl { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0; }
.res-payouts dt { font-size: 11px; color: var(--muted); }
.res-payouts dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; color: var(--odds); }
.res-table { display: grid; }
.res-tr { display: grid; grid-template-columns: 44px 36px minmax(0, 2fr) minmax(0, 2fr) 110px 64px; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.res-th { border-top: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.res-tr small { color: var(--muted); font-size: 11px; }
.res-people { display: grid; }
.res-pos { font: 700 16px/1 var(--font-cond); color: var(--accent); }
.res-num { font-weight: 700; }
.res-odds { font-weight: 700; color: var(--odds); text-align: right; }
.res-tr.is-withdrawn { color: var(--muted); }
.res-tr.is-withdrawn .res-pos { color: var(--muted); }
@media (max-width: 760px) {
  .res-row { grid-template-columns: 1fr; }
  .res-search-row { grid-template-columns: 1fr; }
  .res-filters { margin-left: 0; }
  .res-tr { grid-template-columns: 36px 28px minmax(0, 1fr) 54px; }
  .res-tr > :nth-child(4), .res-tr > :nth-child(5) { display: none; }
}
.meeting-block { margin-bottom: 18px; }
.meeting-block h2 { display: flex; align-items: center; gap: 8px; font: 700 15px/1.2 var(--font); text-transform: uppercase; margin-bottom: 8px; }
.meeting-block h2 small { color: var(--muted); font-weight: 600; text-transform: none; }

.prose { max-width: 760px; display: grid; gap: 12px; color: #cfd8e1; }
.prose h1 { font: 600 30px/1.1 var(--font-cond); color: var(--text); }
.prose h2 { font: 600 21px/1.2 var(--font-cond); color: var(--text); margin-top: 10px; }
.prose ul { list-style: disc; padding-left: 20px; display: grid; gap: 6px; }
.prose a { color: var(--accent); }
.prose strong { color: var(--text); font-weight: 700; }
.prose ol { list-style: decimal; padding-left: 22px; display: grid; gap: 8px; }
.prose li::marker { color: var(--accent); font-weight: 700; }

/* Help pages, as on Snai: page list on the left, text on the right; list on top when the centre
   column is narrow (sized on the column, which shrinks when the sidebar and the slip are shown). */
.info-wrap { container-type: inline-size; }
.info-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; padding-top: 8px; }
.info-nav { position: sticky; top: 72px; }
.info-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px;
  color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--line);
}
.info-nav a:hover { background: var(--surface-2); }
.info-nav a[aria-current="page"] { background: var(--c300, #3f4d60); box-shadow: inset 0 -2px 0 var(--accent); }
.info-nav a [data-icon], .info-nav a svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.info-table { overflow-x: auto; }
.info-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th, .info-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.info-table thead th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.info-table tbody th { color: var(--text); font-weight: 700; }
@container (max-width: 680px) {
  .info-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .info-nav { position: static; }
  .info-nav ul { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .info-nav a { border: 1px solid var(--line); border-radius: var(--radius-sm); white-space: nowrap; padding: 8px 12px; }
  .info-nav a [data-icon], .info-nav a svg { display: none; }
}

.bet-list { display: grid; gap: 10px; }
.bet-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.bet-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.bet-id { font-weight: 700; font-size: 14px; }
.bet-date { font-size: 12px; color: var(--muted); }
.bet-mode { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; background: var(--surface-4); padding: 4px 8px; border-radius: 4px; }
.bet-sels { margin: 10px 0; display: grid; gap: 8px; font-size: 13px; }
.bet-sels > li { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.bet-sels > li:first-child { border-top: 0; padding-top: 0; }
.bet-race { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.bet-sels .bet-race { margin-top: 0; }
.bet-race b { color: var(--text); font-weight: 700; }
.bet-race .flag { width: 16px; height: 11px; }
.bet-disc { display: inline-flex; color: var(--muted); }
.bet-disc .icon { width: 13px; height: 13px; }
.bet-time { color: var(--accent); font-weight: 700; }
.bet-rname { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-pick { display: flex; gap: 8px; align-items: baseline; }
.bet-sels .t { color: var(--muted); font-size: 11px; text-transform: uppercase; flex: none; }
.bet-sels .o { margin-left: auto; color: var(--odds); font-weight: 700; }
.bet-st.st-won, .bet-st.st-partially_won { color: var(--ok, #2fbf71); }
.bet-st.st-lost, .bet-st.st-rejected { color: var(--danger, #e5484d); }
.bet-foot { display: flex; gap: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.bet-foot b { color: var(--text); }

.empty, .error-state { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h2, .error-state h2 { color: var(--text); font: 600 22px/1.1 var(--font-cond); }
.error-state .icon, .empty .icon { width: 36px; height: 36px; color: var(--faint); }

.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-row { height: 54px; margin-bottom: 6px; }
.skel-card { height: 300px; }

/* ---------- Biglietto ---------- */
/* Struttura e misure ricalcate sul biglietto Snai (tab 10px, barra gruppi 8/20px, notch 20x40, stepper 28px). */
.slip {
  --c100: #1b222c; --c200: #2e3845; --c300: #3f4d60; --c400: #45556a; --c500: #5b697c; --c600: #9cabc0; --c700: #bbcade;
  position: fixed; z-index: 60; top: 116px; right: max(16px, calc((100vw - 1480px) / 2 + 16px)); width: 380px;
  max-height: calc(100vh - 132px); overflow-y: auto; background: var(--c100); border: 1px solid var(--c400);
  box-shadow: var(--shadow); scrollbar-width: thin;
}
.slip-tabs { display: grid; grid-template-columns: 1fr 1fr 44px; position: sticky; top: 0; background: var(--c100); z-index: 2; }
.slip-tab {
  background: none; border: 0; border-bottom: 1px solid transparent; padding: 10px; color: #fff;
  font: 700 14px/20px var(--font); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  transition: color .2s ease-in-out, background-color .2s ease-in-out;
}
.slip-tab[aria-selected="true"] { color: var(--accent); background: var(--c400); border-bottom-color: var(--accent); }
.slip-tab[aria-selected="false"]:hover { background: var(--c200); }
.slip-tab .badge-count { margin-left: 6px; vertical-align: 1px; }
.slip-close { width: 30px; height: 30px; align-self: center; border-color: var(--c400); }

/* The three group tabs share the width (QF / Totalizzatore / Nazionale with their counters): they must
   always be fully visible, in the 320-340 px desktop column as well as in the 375 px phone sheet. */
.slip { container: slip / inline-size; }
.slip-groups {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px;
  background: var(--c200); overflow-x: auto; scrollbar-width: thin;
}
.group-btn {
  display: inline-flex; align-items: center; gap: 2px; flex: none; background: none; border: 0; padding: 0; color: #fff;
  font: 500 13px/16px var(--font); text-transform: uppercase; white-space: nowrap; transition: color .2s ease-in-out;
}
.group-btn .icon { width: 16px; height: 16px; flex: none; }
@container slip (max-width: 334px) {
  .group-btn .icon { display: none; }
}
.group-btn[aria-selected="true"] { color: var(--accent); }
.group-btn[aria-selected="false"]:hover { color: var(--c700); }

.slip-modes { display: flex; align-items: stretch; background: var(--c100); }
.mode-tabs { display: flex; align-items: center; gap: 12px; padding-left: 20px; background: var(--c200); }
.mode-tab {
  background: none; border: 0; padding: 8px 0; color: var(--c500);
  font: 700 16px/16px var(--font); white-space: nowrap; transition: color .2s ease-in-out;
}
.mode-tab[aria-selected="true"] { color: var(--accent); }
.mode-tab:disabled { cursor: not-allowed; }
.mode-tab:not(:disabled):not([aria-selected="true"]):hover { color: var(--c700); }
/* raccordo curvo fra la linguetta Multipla/Sistema e l'area scura di Svuota */
.mode-notch { display: flex; width: 40px; flex: none; }
.mode-notch::before { content: ""; width: 20px; height: 40px; background: var(--c200); border-bottom-right-radius: 20px; }
.mode-notch > span { width: 20px; height: 40px; background: var(--c200); }
.mode-notch > span::before { content: ""; display: block; width: 20px; height: 40px; background: var(--c100); border-top-left-radius: 20px; }
.clear-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px 8px 8px;
  background: none; border: 0; color: var(--accent);
  font: 700 12px/14px var(--font); letter-spacing: .96px; text-transform: uppercase;
}
.clear-btn .icon { width: 18px; height: 18px; margin-top: -2px; }
.clear-btn:hover:not(:disabled) { filter: brightness(1.15); }
.clear-btn:disabled { cursor: default; }

.slip-body { background: var(--c100); }
.slip-empty { text-align: center; padding: 12px 20px 16px; color: var(--c700); font-size: 15px; line-height: 1.35; }
.slip-empty-title { font: 700 22px/1.2 var(--font-cond); color: #fff; margin-bottom: 14px; }
.slip-list { display: grid; gap: 6px; padding: 10px 12px 0; }
.slip-list:empty { display: none; }
.slip-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 3px 10px; align-items: center;
  background: var(--c200); border-radius: 4px; padding: 8px 8px 8px 12px;
}
.slip-item .si-race { grid-column: 1 / -1; font-size: 11px; color: var(--c600); text-transform: uppercase; letter-spacing: .03em; }
.slip-item .si-runner { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-item .si-runner small { color: var(--accent); margin-right: 6px; font-weight: 700; }
.slip-item .si-type { font-size: 12px; color: var(--c600); grid-column: 1; }
.slip-item .si-odds { color: var(--odds); font-weight: 700; grid-row: 2 / span 2; grid-column: 2; }
.slip-item .icon-btn { width: 28px; height: 28px; grid-row: 2 / span 2; grid-column: 3; border: 0; background: var(--c300); }
.slip-item .icon-btn:hover { background: var(--c400); }
.slip-item .icon-btn .icon { width: 14px; height: 14px; }
.slip-options { padding: 10px 12px 0; }

.slip-form { background: var(--c100); padding: 8px 0 12px; }
.slip-summary { display: grid; gap: 8px; margin: 4px 0 8px; padding: 0 12px; font: 700 14px/1.05rem var(--font); }
.sum-row { display: flex; justify-content: space-between; gap: 10px; }
.sum-row span { color: var(--c600); font-weight: 500; }
.sum-row.sum-win span { color: #fff; font-weight: 700; }
.stake-row { display: flex; align-items: center; padding: 4px 0 4px 12px; }
.amount { display: flex; align-items: center; gap: 2px; flex: none; }
.amount .step {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px;
  background: var(--c300); color: var(--accent); font: 500 14px/1 var(--font);
}
.amount .step .icon { width: 14px; height: 14px; }
.amount .step:hover { background: var(--c400); }
.amount input {
  width: 80px; height: 28px; min-width: 0; text-align: center; border-radius: 4px; border: 1px solid var(--c300);
  background: var(--c300); color: #fff; font: 500 16px/1 var(--font); outline: none;
}
.amount input:focus { border-color: var(--accent); }
.amount input[aria-invalid="true"] { border-color: var(--danger); }
.bet-btn {
  flex: 1; min-width: 0; margin: 0 12px; min-height: 32px; padding: 6px 12px; border: 0; border-radius: 4px;
  background: var(--accent); color: var(--c100); box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  font: 700 12px/14px var(--font); letter-spacing: .96px; text-transform: uppercase; white-space: nowrap;
  transition: filter .2s ease-in-out, background-color .2s ease-in-out;
}
.bet-btn:hover:not(:disabled) { filter: brightness(.9); }
.bet-btn:active:not(:disabled) { filter: brightness(.75); }
.bet-btn:disabled { background: var(--c200); color: var(--c500); cursor: not-allowed; }
.slip-form .field-error, .slip-form .form-error { padding: 0 12px; margin: 6px 0 0; }
.hint { font-size: 11px; color: var(--faint); margin: 6px 0 2px; }
.field { display: grid; gap: 6px; margin-bottom: 10px; font-size: 13px; }
.field label { color: var(--muted); }
.field select { height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-3); padding: 0 10px; }
.slip .field label { color: var(--c600); font-size: 12px; }
.slip .field select { height: 32px; border-radius: 4px; border-color: var(--c300); background: var(--c300); font-size: 13px; }
.field-error, .form-error { color: var(--danger); font-size: 12px; min-height: 0; }
.field-error:empty, .form-error:empty { display: none; }
.form-error { margin: 6px 0; }
.slip-feedback { padding: 0 12px 12px; }
.slip-feedback:empty { display: none; }

.confirm-dialog {
  width: min(360px, calc(100vw - 32px)); padding: 0; border: 1px solid #45556a; border-radius: 8px;
  background: #1b222c; color: var(--text); box-shadow: var(--shadow);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.confirm-dialog form { padding: 20px; display: grid; gap: 10px; text-align: center; }
.confirm-dialog h2 { font: 700 20px/1.2 var(--font-cond); }
.confirm-dialog p { color: #bbcade; font-size: 14px; }
.confirm-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dlg-btn { min-height: 36px; border: 0; border-radius: 4px; font: 700 12px/14px var(--font); letter-spacing: .96px; text-transform: uppercase; }
.dlg-secondary { background: #45556a; color: #fff; }
.dlg-secondary:hover { filter: brightness(1.2); }
.dlg-primary { background: var(--accent); color: #1b222c; }
.dlg-primary:hover { filter: brightness(.9); }
.confirm { margin-top: 12px; background: rgba(233, 97, 5, .12); border: 1px solid var(--accent-2); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 6px; font-size: 13px; }
.confirm h3 { display: flex; gap: 8px; align-items: center; color: var(--accent); font-size: 15px; }
.confirm-actions { display: flex; gap: 8px; margin-top: 4px; }
.confirm-actions .btn { height: 34px; font-size: 12px; }
.slip-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 55; }
@media (min-width: 761px) { .slip-backdrop { background: transparent; } }
.fav-main { min-width: 0; }
.runners { display: block; }
.slip-bets .bet-card { padding: 10px 12px; }
.slip-bets .bet-list { gap: 8px; }
.slip-bets-foot { margin-top: 12px; text-align: center; }

/* ---------- Toast ---------- */
/* Shown just under the header: the bottom of the screen holds the sticky selection bar and, on phones,
   the slip sheet with its stake stepper and "Scommetti", which must stay reachable right after a click. */
.toast {
  position: fixed; left: 50%; top: 88px; transform: translateX(-50%); z-index: 80; pointer-events: none;
  background: var(--surface-4); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center;
}
/* Phone slip sheet open: stay in the dimmed strip above the sheet, clear of its Biglietto / Mie giocate tabs. */
.toast.over-sheet { top: 12px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 8px; }
.more { max-width: 1480px; margin: 0 auto; padding: 26px 16px 8px; }
.more h2 { font: 600 22px/1.1 var(--font-cond); margin-bottom: 12px; }
.more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
.more-grid a { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: 14px; }
.more-grid a:hover { color: var(--accent); }
.more-grid .icon { width: 15px; height: 15px; color: var(--muted); }
.footer-bottom { max-width: 1480px; margin: 0 auto; padding: 18px 16px 28px; display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.footer-warn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text); font-weight: 600; }
.footer-warn a { color: var(--accent); }
.age { border: 2px solid var(--danger); color: var(--danger); border-radius: 50%; width: 32px; height: 32px; display: inline-grid; place-items: center; font-weight: 700; font-size: 11px; }
.footer-version { color: var(--faint); }

/* ---------- Responsive ---------- */

/* Desktop: programme column from 1024px. The betting slip is a persistent right column only on wide
   windows; below that, as on Snai, it leaves the page and BIGLIETTO / MIE GIOCATE open it as a panel.
   Keep the 1536px value in sync with SLIP_COLUMN_MQ in app.js. */
@media (min-width: 1024px) {
  .shell { grid-template-columns: 400px minmax(0, 1fr); }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (min-width: 1536px) {
  .shell { grid-template-columns: 400px minmax(0, 1fr) 340px; }
  .slip {
    border-width: 0 0 1px 1px;
    display: flex !important; flex-direction: column;
    position: sticky; top: 64px; right: auto; width: auto;
    max-height: calc(100vh - 76px); z-index: 1; box-shadow: none;
  }
  .slip-close { display: none; }
  .slip-buttons { display: none; }
  .slip-tabs { grid-template-columns: 1fr 1fr; }
  .slip-backdrop { display: none; }
}

@media (max-width: 1180px) {
  .live { grid-template-columns: 1fr; min-height: auto; }
  .channels { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .channel { min-width: 160px; flex: 1 1 160px; }
}

@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; padding: 0 0 24px; }
  .main-col { padding: 0; }
  .toolbar .program-btn { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 70; top: 0; left: 0; bottom: 0; width: min(340px, 88vw); max-height: none;
    border-radius: 0; transform: translateX(-102%); transition: transform .2s ease;
  }
  .sidebar.is-open { transform: none; }
  .sidebar-head { display: flex; justify-content: flex-end; padding: 8px; border-bottom: 1px solid var(--line); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .55); }
  .sidebar-backdrop[hidden] { display: none; }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-nav { display: none; }
  .breadcrumb { padding: 8px 16px; }
}

@media (max-width: 760px) {
  .header-inner { gap: 12px; }
  .toolbar { gap: 8px; padding: 10px 12px; }
  .toolbar-title { font-size: 22px; }
  .radio-btn span:last-child { display: none; }
  .search { order: 10; flex-basis: 100%; }
  .slip-buttons .btn { padding: 0 10px; font-size: 12px; }
  .content { padding: 12px; }
  .carousel, .carousel.carousel-3 { grid-auto-columns: minmax(270px, 86%); }
  .race-line { grid-template-columns: 46px minmax(0, 1fr) 20px; }
  .race-line .rl-right { grid-column: 2; }
  .race-line > .icon { grid-column: 3; grid-row: 1 / span 2; }
  .race-nav { margin-left: 0; width: 100%; }
  .race-nav .chips { max-width: none; flex: 1; }
  .odd { min-width: 0; font-size: 14px; }
  .silk { width: 24px; height: 21px; }
  .market-bar .sort { margin-left: 0; width: 100%; }
  .slip {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 86vh;
    border-radius: 16px 16px 0 0;
  }
  .more-grid { grid-template-columns: 1fr; }
}

/* ---------- Mercati della corsa (menu Snai, griglie, barra di selezione) ---------- */
.product-tabs { margin-top: 14px; }
.market-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.market-tab.has-sub .icon { width: 14px; height: 14px; transition: transform .2s; }
.market-tab.has-sub[aria-expanded="true"] .icon { transform: rotate(180deg); }
.market-tab:hover:not([aria-selected="true"]) { color: var(--accent); }
.sub-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.sub-tab {
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-3);
  font: 700 12px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--text);
}
.sub-tab:hover { border-color: var(--accent); }
.sub-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.info-btn {
  width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px solid var(--accent); background: none; color: var(--accent);
  font: italic 700 13px/1 Georgia, "Times New Roman", serif; display: inline-grid; place-items: center; padding: 0;
}
.info-btn:hover { background: var(--accent); color: var(--accent-ink); }
.info-body { white-space: pre-line; text-align: left; line-height: 1.45; }
.info-dialog { width: min(480px, calc(100vw - 32px)); }
.info-actions { grid-template-columns: 1fr; }
.confirm-dialog form { position: relative; }
.dlg-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-color: #45556a; }
.dlg-close .icon { width: 14px; height: 14px; }
.confirm-dialog h2 { padding: 0 28px; }
.grid-retry { height: 32px; margin-left: auto; font-size: 12px; }

.market-body { container-type: inline-size; }
.mk-head, .mk-row {
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: 46px 34px minmax(0, 1fr) 110px repeat(var(--cols, 2), 78px) 32px;
}
.mk-cells { display: contents; }
.mk-row > .mk-form, .mk-head > .mk-form { display: block; }
.mk-head { padding: 6px 12px; margin-top: 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.mk-head .mk-cells span { text-align: center; }
.mk-row { padding: 8px 12px; }
.mk-row-label .mk-label { grid-column: 1 / span 4; min-width: 0; }
.mk-label strong { font: 700 16px/1.2 var(--font-cond); letter-spacing: .02em; }
.mk-label p { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qf-badge {
  display: inline-block; margin-top: 4px; padding: 3px 6px; border-radius: 4px; background: var(--surface-4);
  font: 700 10px/1 var(--font); letter-spacing: .05em; color: var(--odds);
}
.r-nr { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: .05em; }
.odd.cell { min-width: 0; flex-direction: column; gap: 1px; line-height: 1; }
.odd.cell-combo, .odd.cell-maps { font: 700 16px/1 var(--font-cond); color: var(--c-cell, #c9d4df); }
.odd.cell-maps { color: var(--odds); }
.odd.cell[aria-pressed="true"] { color: var(--accent-ink); }
.odd.cell:disabled { opacity: .38; cursor: not-allowed; }
button.odd:disabled:hover { background: var(--odds-bg); }
.cell-cap { font-size: 10px; font-weight: 600; color: var(--muted); }
.odd[aria-pressed="true"] .cell-cap { color: var(--accent-ink); }

.sel-bar-wrap { position: sticky; bottom: 0; z-index: 5; padding-bottom: 8px; }
.sel-bar-wrap:empty { display: none; }
.sel-bar {
  margin-top: 12px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line-2); border-top: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .35);
}
.sb-parts { display: grid; gap: 10px; min-width: 0; flex: 1 1 260px; }
.sb-info { display: grid; gap: 3px; min-width: 0; flex: 1 1 260px; }
.sb-title { font: 700 15px/1.2 var(--font-cond); letter-spacing: .03em; text-transform: uppercase; color: var(--accent); }
.sb-counts { font-size: 12px; color: var(--muted); }
.sb-comb { font-size: 13px; color: var(--muted); }
.sb-comb b { color: var(--text); font-size: 14px; }
.sb-hint { font-size: 12px; color: #ffc39a; }
.sb-hint.is-warn { color: var(--danger); }
.sb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-actions .btn { height: 36px; font-size: 12px; }
.sb-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

@container (max-width: 760px) {
  .mk-head, .mk-row { grid-template-columns: 40px 30px minmax(0, 1fr) repeat(var(--cols, 2), 64px) 32px; gap: 8px; }
  .mk-row > .mk-form, .mk-head > .mk-form { display: none; }
  .mk-row-label .mk-label { grid-column: 1 / span 3; }
}
/* Narrow column (phone, or many maps): horse on the first line, the selectable cells on the second. */
@container (max-width: 560px) {
  .mk-head, .mk-row { grid-template-columns: 34px 26px minmax(0, 1fr) 28px; gap: 6px; padding-left: 8px; padding-right: 8px; }
  .mk-cells { display: grid; grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px; }
  .mk-head > :not(.mk-cells) { display: none; }
  .mk-head .mk-cells { grid-row: 1; }
  .mk-row > :last-child:not(.mk-cells) { grid-row: 1; grid-column: 4; }
  .mk-row-label .mk-label { grid-column: 1 / span 3; }
  .odd.cell { height: 38px; }
}

/* Vincente/Piazzato rows follow the centre column width. */
@container (max-width: 820px) {
  .runners-head, .runner-row { grid-template-columns: 40px 30px minmax(0, 1fr) repeat(4, 70px) 32px; gap: 8px; }
  .runners-head > .r-form, .runner-row > .r-form { display: none; }
  .runners-head.has-pos, .runner-row.has-pos { grid-template-columns: 30px 34px 30px minmax(0, 1fr) repeat(4, 70px) 32px; }
}
/* Narrow column (laptop with sidebar + slip, tablet, phone): horse on the first line, the four prices
   (Vincente, P2, P3, P4) on their own line underneath, so every button stays inside the card. */
@container (max-width: 620px) {
  .runners-head, .runner-row { grid-template-columns: 34px 26px minmax(0, 1fr) 32px; gap: 6px 8px; padding-left: 8px; padding-right: 8px; }
  .r-odds { display: grid; grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .runners-head > :not(.r-odds) { display: none; }
  .runners-head .r-odds { grid-row: 1; }
  .runner-row > .expand { grid-row: 1; grid-column: 4; }
  .runners-head.has-pos, .runner-row.has-pos { grid-template-columns: 30px 30px 26px minmax(0, 1fr) 32px; }
  .runner-row.has-pos > .expand { grid-column: 5; }
  .r-pos { height: 30px; font-size: 15px; }
  .r-odds .odd { min-width: 0; height: 38px; }
}

/* Narrow phones: the header must not push the page sideways. */
@media (max-width: 420px) {
  .header-inner { gap: 8px; padding: 0 12px; }
  .brand-logo { height: 24px; }
  .header-side { gap: 8px; }
  .header-side .clock { display: none; }
}

/* ---------- Biglietto: carrelli QF, Totalizzatore, Nazionale ---------- */
.group-count {
  min-width: 16px; height: 16px; margin-left: 3px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--c100);
  display: inline-grid; place-items: center; font: 700 10px/1 var(--font);
}
.mode-tab.is-static { color: var(--accent); cursor: default; }
.slip-options .field { margin-bottom: 4px; }
.sys-table { display: grid; margin: 4px 0 8px; border-top: 1px solid var(--c200); }
.sys-head { display: none; }
.sys-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--c200); }
.sys-label { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: pointer; }
.sys-label input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.sys-label b { display: block; font-size: 14px; color: #fff; }
.sys-label small { display: block; font-size: 11px; color: var(--c600); }
/* Each row is its own grid and the second column also holds "Vincita …" (different lengths per row):
   pinning the stepper to the right edge keeps the -/input/+ of every Sistema row in one column. */
.sys-amount { justify-self: end; }
.sys-amount input { width: 64px; }
.sys-total, .sys-win { font-size: 12px; color: var(--c700); }
.sys-total::before { content: "Totale "; color: var(--c600); }
.sys-win { text-align: right; }
.sys-win::before { content: "Vincita "; color: var(--c600); }
.sys-submit { padding-left: 0; }
.pool-card { margin: 10px 12px 0; padding: 10px 12px; background: var(--c200); border-radius: 4px; display: grid; gap: 8px; }
.pool-card .si-race { font-size: 11px; color: var(--c600); text-transform: uppercase; letter-spacing: .03em; }
.pool-bet { font-weight: 700; font-size: 14px; color: #fff; }
.pool-maps { display: grid; gap: 6px; margin-top: 6px; }
.pool-maps li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.pm-label { color: var(--c600); min-width: 74px; }
.pm-horse {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px 0 9px; border: 0; border-radius: 13px;
  background: var(--c300); color: #fff; font: 700 13px/1 var(--font);
}
.pm-horse .icon { width: 11px; height: 11px; color: var(--accent); }
.pm-horse:hover { background: var(--c400); }
.pm-empty { color: var(--c500); }
.mult-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 12px 8px; }
.mult-label { color: var(--c600); font-size: 14px; }
.mult-row .amount input { width: 56px; }
.pool-msgs { padding: 0 12px; }
.pool-msgs:empty { display: none; }
.pool-msgs .form-error { margin: 4px 0 0; padding: 0; }
.bet-systems { font-size: 12px; color: var(--muted); margin: -4px 0 8px; }

/* ---------- Le mie giocate: ricevuta ---------- */
.bet-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.bet-receipt { height: 28px; padding: 0 10px; font-size: 11px; }
.bet-id-btn { padding: 0; color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; }
.bet-id-btn:hover { color: var(--accent); }
.bet-assist { font-size: 12px; color: var(--odds); font-weight: 600; }

/* ---------- Ricevuta del ticket (receipt.js) ---------- */
/* White panel with the thermal ticket (302 px); yellow action buttons; full screen on phones. */
.rcpt-dialog {
  --receipt-action: #f5c542;
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 10px;
  background: #f4f4f2; color: #111; box-shadow: var(--shadow); overflow: auto; overscroll-behavior: contain;
}
.rcpt-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.rcpt-close {
  position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; z-index: 3; width: 34px; height: 34px;
  background: #fff; border-color: #c9c9c9; color: #111; font: 400 24px/1 Arial, sans-serif;
}
.rcpt-close:hover { background: #ececec; }
.rcpt-body { padding: 12px 16px 18px; clear: none; }
.rcpt-toast {
  position: sticky; top: 8px; z-index: 2; margin: 8px 52px 0 16px; padding: 8px 12px; border-radius: 8px;
  background: #1b222c; color: #fff; font-size: 13px; text-align: center;
}
.rcpt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 44px 10px 0; }
.rcpt-btn {
  height: 40px; border: 0; border-radius: 6px; background: var(--receipt-action); color: #000;
  font: 700 13px/1 var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.rcpt-btn:hover { filter: brightness(.94); }
.rcpt-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 2px #000; }
.rcpt-menu { display: grid; gap: 4px; margin: -4px 0 10px; padding: 6px; background: #fff; border: 1px solid #d5d5d5; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.rcpt-menu-item { height: 38px; border: 0; border-radius: 6px; background: none; color: #111; text-align: left; padding: 0 12px; font-weight: 600; }
.rcpt-menu-item:hover, .rcpt-menu-item:focus-visible { background: #f2efe4; }
.rcpt-menu-item.is-current::after { content: " · predefinita"; color: #6b6b6b; font-weight: 400; font-size: 12px; }
.rcpt-ops { display: grid; gap: 8px; margin-bottom: 10px; }
.rcpt-op-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rcpt-op {
  height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid #8a8a8a; background: #fff; color: #111;
  font: 700 12px/1 var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.rcpt-op:hover { background: #f0f0f0; }
.rcpt-op:disabled { opacity: .5; cursor: not-allowed; }
.rcpt-op-danger { border-color: #c62828; color: #b71c1c; }
.rcpt-op-danger:hover { background: #fdecec; }
.rcpt-op-note { font-size: 12px; color: #444; font-variant-numeric: tabular-nums; }
.rcpt-confirm { padding: 10px; border: 1px solid #c62828; border-radius: 8px; background: #fff7f7; display: grid; gap: 8px; font-size: 13px; }
.rcpt-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.rcpt-pending { margin-bottom: 8px; text-align: center; font-weight: 700; color: #7a5b00; }
.rcpt-state { min-height: 220px; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; color: #333; font-weight: 600; padding: 40px 12px; }
.rcpt-error { color: #8a1c1c; }
.rcpt-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #d9d9d9; border-top-color: #111; animation: rcpt-spin .8s linear infinite; }
@keyframes rcpt-spin { to { transform: rotate(360deg); } }
.rcpt-paper { display: flex; justify-content: center; }
.rcpt-copy-src { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.rcpt-print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none; }

/* Ticket body as on screen (the print page has its own sheet). */
.rcpt-ticket {
  width: 302px; max-width: 100%; padding: 12px 10px 14px; background: #fff; color: #000;
  font: 400 12px/1.3 Arial, Helvetica, sans-serif; border: 1px solid #dcdcdc; box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
.rcpt-ticket p, .rcpt-ticket dl, .rcpt-ticket dd, .rcpt-ticket ol { margin: 0; padding: 0; }
.rcpt-copy { text-align: center; font-weight: 700; letter-spacing: .12em; }
.rcpt-brand { text-align: center; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.rcpt-head { border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 4px 0; }
.rcpt-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.rcpt-row dt { font-size: 10px; font-weight: 700; color: #333; flex: none; }
.rcpt-row dd { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.rcpt-band { margin: 6px 0; padding: 4px 0; background: #000; color: #fff; text-align: center; font-weight: 700; font-size: 13px; letter-spacing: .1em; }
.rcpt-line { padding: 5px 0; border-bottom: 1px dashed #9a9a9a; }
.rcpt-l-title { font-weight: 700; }
.rcpt-l-sub { font-size: 10px; color: #333; display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.rcpt-flag { width: 14px; height: 10px; display: inline-block; }
.rcpt-l-bet { display: flex; align-items: center; gap: 6px; margin-top: 3px; padding: 4px 6px; background: #ebebeb; }
.rcpt-l-what { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 5px; }
.rcpt-l-label { font-weight: 700; }
.rcpt-l-label::after { content: ":"; }
.rcpt-l-comb { color: #444; font-size: 11px; }
.rcpt-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; flex: none; }
.rcpt-dot.dot-won { background: #1a9b4b; }
.rcpt-dot.dot-lost { background: #d0202a; }
.rcpt-dot.dot-void { background: #fff; }
.rcpt-l-odds { font-size: 13px; font-variant-numeric: tabular-nums; }
.rcpt-totals { margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rcpt-box { border: 1px solid #000; padding: 3px 5px; display: flex; flex-direction: column; gap: 1px; }
.rcpt-box-wide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; }
.rcpt-box dt { font-size: 9px; font-weight: 700; color: #333; }
.rcpt-box dd { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.rcpt-barcode { display: none; }
.rcpt-footer { margin-top: 8px; text-align: center; font-size: 11px; font-weight: 700; }

@media (max-width: 519px) {
  .rcpt-dialog { width: 100vw; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; }
  .rcpt-body { padding: 8px 12px 24px; }
  .rcpt-actions { margin-right: 44px; gap: 6px; }
  .rcpt-btn { font-size: 12px; letter-spacing: .02em; }
}

/* ---------- Rete agenzie: header ---------- */
.net-login-btn, .net-quick { height: 34px; padding: 0 14px; font-size: 12px; }
/* Account chip (b2b-bridge.js mountAccount): identity on the left, balance on the right, one
   button. The balance is the figure people check between bets, so it gets the condensed display
   face and tabular figures; the role tag carries the accent, as the nav underline does. */
.net-chip { position: relative; display: flex; }
.net-chip.is-floating { position: fixed; top: 7px; right: 12px; z-index: 45; }
.acct-btn {
  display: flex; align-items: center; gap: 10px; height: 40px; max-width: 380px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.acct-btn.has-avatar { padding-left: 5px; }
.acct-btn:hover { background: var(--surface-2); }
.acct-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--surface-2); }
.acct-avatar {
  flex: none; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(233, 97, 5, .16); color: var(--accent); font: 700 14px/1 var(--font-cond); letter-spacing: .04em;
}
.acct-id { display: grid; min-width: 0; line-height: 1.15; }
.acct-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.acct-role { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.acct-bal {
  display: grid; justify-items: end; flex: none; line-height: 1; gap: 3px;
  padding-left: 10px; border-left: 1px solid var(--line);
}
.acct-bal[hidden] { display: none; }
.acct-bal-label { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.acct-bal-value { font: 700 18px/1 var(--font-cond); letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-bal.is-low .acct-bal-value, .acct-bal.is-credit .acct-bal-value { color: var(--hot); }
.acct-bal.is-credit .acct-bal-label { color: var(--hot); }
.acct-bal.is-empty .acct-bal-value { color: var(--danger); }
.acct-bal-value.is-updated { animation: acct-tick 1.3s ease-out; }
@keyframes acct-tick { 0%, 30% { color: var(--odds); } }
.acct-caret { flex: none; color: var(--muted); font-size: 11px; transition: transform .15s; }
.acct-btn[aria-expanded="true"] .acct-caret { transform: rotate(180deg); color: var(--text); }

.acct-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 292px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.acct-head { display: grid; gap: 3px; padding: 12px 14px 10px; }
.acct-head-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.acct-head-sub { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; color: var(--muted); }
.acct-head-role { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.acct-head-detail { overflow-wrap: anywhere; }
.acct-sum { padding: 12px 14px; background: var(--bg-2); border-block: 1px solid var(--line); }
.acct-sum[hidden] { display: none; }
.acct-sum-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.acct-sum-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.acct-sum-value { font: 700 28px/1 var(--font-cond); font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-sum.is-low .acct-sum-value, .acct-sum.is-credit .acct-sum-value { color: var(--hot); }
.acct-sum.is-empty .acct-sum-value { color: var(--danger); }
.acct-sum-rows { display: grid; gap: 5px; margin-top: 10px; }
.acct-sum-rows:empty { display: none; }
.acct-sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.acct-sum-row dt { color: var(--muted); }
.acct-sum-row dd { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-meter { --used: 0; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.acct-meter[hidden] { display: none; }
.acct-meter-fill { display: block; height: 100%; width: calc(var(--used) * 100%); background: var(--hot); border-radius: 2px; }
.acct-menu { display: grid; gap: 1px; padding: 6px; }
.acct-item {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: var(--text);
  text-align: left; text-decoration: none; font: 600 14px/1.2 var(--font); cursor: pointer;
}
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-3); }
.acct-item:focus-visible { outline-offset: -2px; }
.acct-item.is-primary { color: var(--accent); font-weight: 700; }
.acct-item.is-exit { color: var(--muted); }
.acct-item.is-exit:hover, .acct-item.is-exit:focus-visible { color: var(--text); }
.acct-sep { height: 1px; margin: 4px 4px; background: var(--line); }
@media (prefers-reduced-motion: reduce) {
  .acct-bal-value.is-updated { animation: none; }
  .acct-btn, .acct-caret { transition: none; }
}
@media (max-width: 1023px) { .net-quick { display: none; } }
@media (max-width: 1199px) { .acct-name { max-width: 130px; } }
/* Phones: initials + balance only; name and role are in the menu header. */
@media (max-width: 760px) {
  body.has-account .live-pill { display: none; }
  .acct-btn { gap: 8px; padding-right: 8px; }
  .acct-btn:not(.has-avatar) { padding-left: 10px; }
  .acct-btn.has-balance .acct-id { display: none; }
  .acct-btn.has-balance .acct-bal { padding-left: 0; border-left: 0; }
  .acct-btn.has-balance .acct-avatar ~ .acct-bal { padding-left: 8px; border-left: 1px solid var(--line); }
  .acct-btn:not(.has-balance) .acct-name { max-width: 110px; }
}

/* ---------- Rete agenzie: giocata assistita nel biglietto ---------- */
.assist-panel { margin: 8px 12px; padding: 10px; border: 1px solid var(--accent-2); border-radius: 6px; background: rgba(233, 97, 5, .08); display: grid; gap: 8px; }
.assist-panel.is-blocked { border-color: var(--c400); background: var(--c200); color: var(--c700); font-size: 13px; }
.assist-title { font: 700 13px/1.2 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.assist-combo { position: relative; }
.assist-input { width: 100%; height: 36px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--c400); background: var(--c300); color: var(--text); }
.assist-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(233, 97, 5, .35); }
.assist-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 220px; overflow-y: auto; padding: 4px;
  background: var(--c100); border: 1px solid var(--c400); border-radius: 6px; box-shadow: var(--shadow);
}
.assist-opt, .assist-empty { display: flex; align-items: baseline; gap: 8px; padding: 8px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.assist-empty { color: var(--c600); cursor: default; }
.assist-opt[aria-selected="true"], .assist-opt:hover { background: var(--c300); }
.assist-opt-name { font-weight: 700; }
.assist-opt-nick { color: var(--c600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.assist-opt-bal { margin-left: auto; color: var(--odds); font-variant-numeric: tabular-nums; flex: none; }
.assist-chip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 4px; background: var(--c300); }
.assist-chip-name { display: grid; min-width: 0; }
.assist-chip-name small { color: var(--c600); font-size: 11px; }
.assist-chip-bal { font-size: 12px; color: var(--odds); font-weight: 600; }
.assist-change { margin-left: auto; height: 28px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--c500); background: none; color: var(--text); font: 700 11px/1 var(--font); text-transform: uppercase; }
.assist-change:hover { border-color: var(--accent); }
.assist-help { font-size: 11px; color: var(--c600); line-height: 1.35; }
.net-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.net-check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.net-check small { display: block; font-weight: 400; color: var(--muted); }

/* ---------- Rete agenzie: dialoghi ---------- */
.net-dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
.net-dialog-wide { width: min(640px, calc(100vw - 24px)); }
.net-dialog form, .net-dialog .net-dlg-body { text-align: left; }
.net-dialog > .net-dlg-head, .net-dialog .net-form > .net-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0; }
.net-dialog .net-form > .net-dlg-head { padding: 0; }
.net-dialog .net-dlg-head h2 { padding: 0; font: 700 22px/1.2 var(--font-cond); }
.net-dialog .net-dlg-head .dlg-close { position: static; flex: none; }
.net-dlg-body { padding: 12px 16px 4px; display: grid; gap: 12px; }
.net-dialog > .form-error { padding: 0 16px 14px; margin: 0; }
.net-dlg-text { color: #bbcade; font-size: 14px; text-align: left; }
.net-login form { padding: 18px 18px 20px; gap: 12px; }
.net-login-brand { color: var(--muted); font-size: 13px; }
.net-login-brand:empty { display: none; }
.net-submit { min-height: 42px; font-size: 13px; }
.net-form { display: grid; gap: 12px; }
.net-field { display: grid; gap: 5px; font-size: 13px; min-width: 0; }
.net-field label { color: var(--muted); font-weight: 600; }
.net-field input, .net-field select {
  width: 100%; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-3); color: var(--text);
}
.net-field input:focus, .net-field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(233, 97, 5, .3); }
.net-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.net-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.net-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.net-fieldset { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 12px 12px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.net-fieldset legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.net-form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.net-form-actions .dlg-btn { min-width: 140px; padding: 0 14px; }
.dlg-danger { background: #c62828; color: #fff; }
.dlg-danger:hover { filter: brightness(1.1); }
.net-secret-box { display: grid; gap: 6px; padding: 10px; border: 1px dashed var(--odds); border-radius: var(--radius-sm); background: rgba(244, 207, 74, .07); }
.net-secret-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.net-secret { font: 700 18px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; color: var(--odds); overflow-wrap: anywhere; }
.net-ok { color: var(--ok); font-weight: 700; }
.net-dl { display: grid; gap: 0; margin: 0; }
.net-dl > div { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.net-dl dt { color: var(--muted); }
.net-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.net-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.net-drawer { margin-right: 0; margin-top: 0; height: 100vh; max-height: 100vh; width: min(460px, 100vw); border-radius: 0; border-width: 0 0 0 1px; }
@media (max-width: 760px) {
  .net-grid2 { grid-template-columns: 1fr; }
  .net-drawer { width: 100vw; }
}

/* ---------- Rete agenzie: console #/rete ---------- */
.net-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 12px; }
.net-head .page-title { margin-bottom: 2px; }
.net-sub { color: var(--muted); font-size: 14px; font-weight: 600; }
.net-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 12px; }
.net-head-kpis { margin: 0; flex: 1 1 360px; max-width: 560px; min-width: 0; }
@media (max-width: 760px) {
  .net-head-kpis { flex-basis: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .net-head-kpis .net-kpi { padding: 8px; }
  .net-head-kpis .net-kpi-value { font-size: 16px; }
}
.net-kpi { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.net-kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.net-kpi-value { font: 700 20px/1.15 var(--font-cond); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.net-kpi small { color: var(--muted); font-size: 11px; }
.net-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.net-tab {
  flex: none; padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.net-tab:hover { color: var(--text); }
.net-tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.net-panel { display: grid; gap: 12px; min-width: 0; }
.net-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.net-tools .net-field { width: auto; min-width: 140px; }
.net-tools .net-search { flex: 1 1 200px; }
.net-tools .net-search input { height: 38px; }
.net-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.net-dates { display: flex; align-items: center; gap: 6px; }
.net-dates input { height: 38px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-3); color: var(--text); }
.net-new, .net-csv { height: 38px; font-size: 12px; }
.net-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.net-crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.net-crumbs [aria-current] { color: var(--text); font-weight: 700; }
.net-sep { color: var(--faint); }
.net-h3 { font: 600 20px/1.1 var(--font-cond); margin-top: 8px; }
.net-card { padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; }
.net-card.net-dl { justify-items: stretch; }
.net-list { display: grid; gap: 10px; min-width: 0; }
.net-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.net-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.net-table th { position: sticky; top: 0; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 8px 10px; white-space: nowrap; }
.net-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.net-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.net-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.net-row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.net-small { height: 28px; padding: 0 10px; font-size: 11px; }
.net-danger { border-color: #a33; color: #ff8a8a; }
.net-user { display: grid; text-align: left; padding: 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; }
.net-user small { color: var(--muted); font-weight: 400; }
.net-user:hover b { color: var(--accent); }
.net-code { padding: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.net-status.st-suspended, .net-bet-st.st-lost { color: var(--danger); }
.net-status.st-closed, .net-bet-st.st-cancelled, .net-bet-st.st-rejected, .net-bet-st.st-void { color: var(--muted); }
.net-bet-st.st-won, .net-bet-st.st-partially_won { color: var(--ok); font-weight: 700; }
.net-two { display: grid; font-size: 12px; color: var(--muted); }
.net-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.net-totals:empty { display: none; }
.net-empty, .net-loading { padding: 18px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.net-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--danger); border-radius: var(--radius-sm); color: var(--danger); }
.net-more { justify-self: center; }

/* Narrow panel (phones, or the main column between programme and slip): rows become stacked cards,
   no horizontal page scroll. A container query, so it follows the panel width, not the window. */
.net-panel { container: netpanel / inline-size; }
@media (max-width: 760px) {
  .net-tools .net-field, .net-period, .net-period .net-field { flex: 1 1 100%; min-width: 0; }
  .net-dates { flex-wrap: wrap; }
  .net-dates input { flex: 1 1 120px; min-width: 0; }
}
@container netpanel (max-width: 560px) {
  .net-table-wrap { overflow: visible; border: 0; }
  .net-table, .net-table tbody, .net-table tr, .net-table td { display: block; width: 100%; }
  .net-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .net-table tr { margin-bottom: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
  .net-table td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); text-align: right; }
  .net-table td:first-child { border-top: 0; }
  .net-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; }
  .net-table td.net-actions { display: block; text-align: left; }
  .net-table td.net-actions::before { display: block; margin-bottom: 4px; }
  .net-table .num { white-space: normal; }
  .net-two { text-align: right; }
  .net-user { text-align: right; justify-items: end; }
}

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