/* ═══════════════════════════════════════════════════════════════
   F1 Command Center — design system (the only stylesheet)

   Calm pit-wall software: flat surfaces, 1px borders, no shadows,
   gradients or glow. Red (--accent) only for LIVE, the primary
   action and the active nav item. Driver data always in team colours.
   Spacing on a 4px grid. Type: Inter, tabular numbers.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg: #0B0C0F;
    --surface: #14161B;
    --surface-2: #1B1E24;
    --surface-3: #22262E;
    --border: #262A31;
    --border-strong: #353A43;
    --text: #E8EAED;
    --text-muted: #8B919A;
    --text-dim: #5C626B;

    --accent: #E10600;

    --purple: #A855F7;
    --green: #22C55E;
    --yellow: #FACC15;
    --red: #EF4444;
    --blue: #38BDF8;
    --orange: #FB923C;

    --tyre-s: #FF3333;
    --tyre-m: #FFD700;
    --tyre-h: #F0F0F0;
    --tyre-i: #43B02A;
    --tyre-w: #0067AD;

    --fs-xs: 12px;
    --fs-sm: 14px;
    --fs-md: 16px;
    --fs-lg: 20px;
    --fs-xl: 28px;
    --fs-xxl: 40px;

    --r-card: 8px;
    --r-input: 6px;
    --r-pill: 999px;

    --topbar-h: 56px;
    --rail-w: 80px;
    --pad: 16px;
    --gap: 12px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── base ──────────────────────────────────────────────────────── */
html, body {
    background: var(--bg) !important;
    color: var(--text);
    font-family: var(--font) !important;
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}
body .q-page, body .q-page-container, body .q-layout { background: var(--bg) !important; min-height: 0 !important; }
body .nicegui-content { padding: 0 !important; gap: 0 !important; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.strong { font-weight: 600; }
.c-purple { color: var(--purple); } .c-green { color: var(--green); } .c-yellow { color: var(--yellow); }
.c-red { color: var(--red); } .c-blue { color: var(--blue); } .c-orange { color: var(--orange); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── app shell ─────────────────────────────────────────────────── */
.app {
    position: fixed; inset: 0;
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    background: var(--bg);
}
.topbar {
    grid-column: 1 / -1;
    position: relative;
    display: flex; align-items: center; gap: var(--gap);
    padding: 0 var(--pad);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 5;
}
.brand { font-weight: 800; letter-spacing: 0.08em; font-size: 15px; color: var(--text); margin-right: 4px; }
.topbar .spacer { flex: 1; }
.session-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--r-input);
    background: var(--bg); color: var(--text);
    font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
}
.session-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.session-btn .q-icon { color: var(--text-muted); font-size: 18px; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; min-width: 34px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: var(--r-input);
    background: var(--bg); color: var(--text-muted); cursor: pointer; font-size: var(--fs-xs);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.on { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

/* track-status line under the top bar (visible across the room) */
.ambience { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.ambience.st-2, .ambience.st-4, .ambience.st-6, .ambience.st-7 { background: var(--yellow); }
.ambience.st-5 { background: var(--red); }

/* thin loading bar under the top bar */
.loadbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; display: none; }
.loadbar.on { display: block; }
.loadbar::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 30%;
    background: var(--text-muted); animation: loadbar 1.1s ease-in-out infinite;
}
@keyframes loadbar { from { left: -30%; } to { left: 100%; } }

/* ─── pills & chips ─────────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 8px;
    height: 28px; padding: 0 12px; border-radius: var(--r-pill);
    border: 1px solid var(--border); background: var(--bg);
    font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.pill { max-width: 100%; overflow: hidden; flex: none; line-height: 1; }
.pill > * { flex: none; }
.pill.is-live { border-color: #4A1512; background: #1F1112; cursor: pointer; }
.pill.is-live .lbl { color: var(--accent); letter-spacing: 0.08em; }
.pill.done { color: var(--text-muted); font-weight: 500; }
.pill.replay { cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.pulse { background: var(--accent); animation: pulse 1.8s ease-in-out infinite; }
.dot.blue { background: var(--blue); } .dot.green { background: var(--green); } .dot.dim { background: var(--text-dim); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 26px; padding: 0 10px; border-radius: var(--r-input);
    border: 1px solid var(--border); background: var(--surface-2);
    font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.chip .x { font-size: 14px; opacity: 0.6; }
.chip .x:hover { opacity: 1; }
.chip.driver { color: var(--text); font-weight: 700; padding-left: 0; overflow: hidden; }
.chip.driver .bar { width: 3px; align-self: stretch; margin-right: 4px; }
.chip.driver.dashed .bar { background-image: repeating-linear-gradient(transparent 0 3px, var(--bg) 3px 5px); }

.status-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
    border-radius: var(--r-input); font-size: var(--fs-xs); font-weight: 700;
    border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap;
}
.status-chip.st-1 { color: var(--green); border-color: #1E4A2E; }
.status-chip.st-2 { color: var(--yellow); border-color: #5A4C10; }
.status-chip.st-4, .status-chip.st-6, .status-chip.st-7 { color: #0B0C0F; background: var(--yellow); border-color: var(--yellow); }
.status-chip.st-5 { color: #fff; background: var(--red); border-color: var(--red); }

.tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; letter-spacing: 0.04em; vertical-align: 1px; }
.tag.pit { background: var(--blue); color: #000; }
.tag.out { background: var(--surface-3); color: var(--text); }
.tag.rit { background: var(--surface-3); color: var(--text-muted); }
.tag.cliff { background: var(--orange); color: #000; }
.tag.fl { background: var(--purple); color: #000; }

/* tyre badge: circle + age ("M 30") */
.tyre { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tyre .t {
    width: 17px; height: 17px; border-radius: 50%; border: 2px solid currentColor;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; line-height: 1;
}
.tyre.s .t { color: var(--tyre-s); } .tyre.m .t { color: var(--tyre-m); } .tyre.h .t { color: var(--tyre-h); }
.tyre.i .t { color: var(--tyre-i); } .tyre.w .t { color: var(--tyre-w); } .tyre.u .t { color: var(--text-dim); }
.tyre .age { color: var(--text); font-size: var(--fs-xs); }

/* ─── nav rail ──────────────────────────────────────────────────── */
.rail {
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 8px 0; z-index: 4;
}
.rail .items { display: flex; flex-direction: column; }
.nav-item {
    position: relative; height: 60px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--text-muted); font-size: 11px; font-weight: 500;
}
.nav-item .q-icon { font-size: 22px; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.nav-item .key { position: absolute; top: 4px; right: 8px; font-size: 9px; color: var(--text-dim); }

/* ─── main area ─────────────────────────────────────────────────── */
.main { overflow: auto; min-width: 0; min-height: 0; position: relative; }
.main.fit { overflow: hidden; display: flex; flex-direction: column; }
.page { padding: var(--pad) 20px 32px; display: flex; flex-direction: column; gap: var(--gap); max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.page-title { font-size: var(--fs-lg); font-weight: 700; margin-right: 8px; }
.page-sub { color: var(--text-muted); font-size: var(--fs-sm); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
    padding: 8px 14px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid transparent;
    cursor: pointer; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ─── panels (cards) ────────────────────────────────────────────── */
.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
}
.panel-head {
    display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
    border-bottom: 1px solid var(--border); flex: none;
}
.panel.collapsed .panel-head { border-bottom: none; }
.panel-title {
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-muted); white-space: nowrap;
}
.panel-head.click { cursor: pointer; user-select: none; }
.panel-head.click:hover .panel-title { color: var(--text); }
.panel-head .chev { color: var(--text-dim); font-size: 18px; margin-left: -4px; }
.panel-head .grow { flex: 1; }
.panel-body { padding: 12px; min-height: 0; flex: 1; }
.panel-body.flush { padding: 0; }
.panel-body.scroll { overflow: auto; }
.panel.collapsed .panel-body { display: none; }
.info-i { color: var(--text-dim); font-size: 16px; cursor: help; }
.info-i:hover { color: var(--text-muted); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 10px 14px; min-width: 0; }
.kpi .k { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.kpi .v { font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v.v-sm { font-size: var(--fs-lg); }
.kpi .c { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--gap); }
.grid-2e { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
@media (max-width: 1100px) { .grid-2, .grid-2e { grid-template-columns: minmax(0, 1fr); } }

/* "Lettura dell'ingegnere" */
.reading { display: flex; flex-direction: column; }
.reading .item { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); line-height: 1.45; }
.reading .item:first-child { border-top: none; padding-top: 0; }
.reading .item .q-icon { color: var(--purple); font-size: 18px; flex: none; margin-top: 1px; }

/* tables: rows separated by 1px dividers, never boxed rows */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-dim); text-align: left; padding: 6px 8px; white-space: nowrap;
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.tbl td { padding: 6px 8px; border-top: 1px solid var(--border); white-space: nowrap; }
.tbl tr:hover td { background: rgba(255,255,255,0.015); }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl .pos { width: 28px; text-align: right; font-weight: 700; color: var(--text-muted); }
.tbl .bar { width: 3px; padding: 0 !important; }
.tbl .drv { font-weight: 700; letter-spacing: 0.02em; }

/* list rows (recent sessions, standings, etc.) */
.rows { display: flex; flex-direction: column; }
.row-i { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-width: 0; }
/* rows may be wrapped by NiceGUI's html element: divide by position in .rows */
.rows > :not(:first-child) > .row-i, .rows > .row-i:not(:first-child) { border-top: 1px solid var(--border); }
.row-i .teambar { width: 3px; height: 20px; border-radius: 2px; flex: none; }
.row-i .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* buttons */
.btn-primary {
    background: var(--accent) !important; color: #fff !important; border-radius: var(--r-input) !important;
    font-weight: 600 !important; text-transform: none !important; padding: 0 18px !important; min-height: 40px !important;
}
.btn-secondary {
    background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border) !important;
    border-radius: var(--r-input) !important; text-transform: none !important; font-weight: 500 !important; min-height: 36px !important;
}
.btn-ghost { color: var(--text-muted) !important; text-transform: none !important; }

/* empty / unavailable: one line + one action */
.loading-note { margin-top: 10px; font-size: 13px; }
.empty { display: flex; align-items: center; gap: 12px; color: var(--text-muted); padding: 16px 0; }

/* skeleton placeholders (never blank pages or centred spinners) */
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
        background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: var(--r-card); }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel.kpi-s { height: 76px; } .skel.chart-lg { height: 520px; } .skel.chart-md { height: 360px; } .skel.line { height: 16px; }

/* chart containers */
.chart { width: 100%; }

.chart-fill { height: 100%; min-height: 140px; }

/* ─── home ──────────────────────────────────────────────────────── */
.home-top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gap); }
.home-bottom { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gap); }
/* both rows on the same columns, cards in a row the same height */
.home-top > div > .panel, .home-bottom > div > .panel { flex: 1; }
@media (max-width: 1100px) { .home-top, .home-bottom { grid-template-columns: minmax(0, 1fr); } }
.hero-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.01em; }
.countdown { font-size: var(--fs-xxl); font-weight: 800; letter-spacing: -0.02em; }
.countdown .u { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); margin: 0 6px 0 2px; }
.sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sched .s { border: 1px solid var(--border); border-radius: var(--r-input); padding: 8px 10px; background: var(--bg); }
.sched .s.next { border-color: var(--border-strong); background: var(--surface-2); }
.sched .s .n { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* ─── session switcher ──────────────────────────────────────────── */
.switcher { width: 720px; max-width: 96vw; max-height: 86vh; background: var(--surface) !important;
            border: 1px solid var(--border); border-radius: var(--r-card); display: flex; flex-direction: column; overflow: hidden; }
.switcher .sw-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.switcher .sw-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.switcher .sw-foot { padding: 8px 14px; border-top: 1px solid var(--border); display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); font-size: 10px; margin-right: 4px; }
.year-ctl { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-input); background: var(--bg); }
.year-ctl .y { font-weight: 700; padding: 0 8px; }
.ev { border-top: 1px solid var(--border); padding: 10px 8px; border-radius: var(--r-input); cursor: pointer; }
.ev:first-child { border-top: none; }
.ev:hover, .ev.cursor { background: var(--surface-2); }
.ev.open { background: var(--bg); }
.ev .rnd { width: 34px; color: var(--text-muted); font-weight: 700; font-size: var(--fs-xs); flex: none; }
.ev .nm { font-weight: 600; }
.ev .dt { color: var(--text-muted); font-size: var(--fs-xs); }
.ev-state { font-size: 11px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-muted); }
.ev-state.live { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.ev-state.next { color: var(--text); }
.sess-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 10px; }
.sess {
    border: 1px solid var(--border); border-radius: var(--r-input); padding: 8px; background: var(--surface);
    cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.sess:hover { border-color: var(--border-strong); background: var(--surface-2); }
.sess.current { border-color: var(--text-muted); }
.sess.live { border-color: var(--accent); }
.sess.future { cursor: default; opacity: 0.55; }
.sess .code { font-size: 11px; font-weight: 800; color: var(--text-muted); letter-spacing: 0.04em; display: flex; justify-content: space-between; }
.sess .name { font-size: var(--fs-xs); font-weight: 600; }
.sess .info { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess .info.pole { color: var(--purple); }
.sess .replay { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.sess .replay:hover { color: var(--text); }

/* ─── live pit wall ─────────────────────────────────────────────── */
.live { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; }
.strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 44px; }

.strip .lap { font-size: var(--fs-xl); font-weight: 800; margin-left: auto; }
.strip .wx { display: flex; gap: 12px; color: var(--text-muted); font-size: var(--fs-xs); }
.strip .wx b { color: var(--text); font-weight: 600; }

.panel-body.chartbody { display: flex; flex-direction: column; padding: 4px 8px 6px; min-height: 0; }
.chartbody > .nicegui-plotly, .chartbody .chart-fill { flex: 1; min-height: 0; height: 100%; width: 100%; }

/* timing tower */
.tower { width: 100%; border-collapse: collapse; table-layout: auto; }
.tower th { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim);
            text-align: left; padding: 3px 6px; position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.tower td { padding: 0 6px; height: 21px; border-top: 1px solid var(--border); white-space: nowrap; font-size: 13px; }
.tower tr.trow { cursor: pointer; }
.tower tr.trow:hover td { background: rgba(255,255,255,0.02); }
.tower tr.pinned td { background: var(--surface-2); }
.tower tr.out td { opacity: 0.45; }
.tower .r { text-align: right; }
.tower .p { width: 24px; text-align: right; font-weight: 700; color: var(--text-muted); }
.tower .tb { width: 3px; padding: 0; }
.tower tr.pinned .tb { width: 5px; }
.tower .d { font-weight: 700; letter-spacing: 0.03em; }
.tower .prev { color: var(--text-dim); }
.tower .catch { color: var(--green); }
.segs { display: inline-flex; gap: 1px; vertical-align: middle; }
.seg { width: 5px; height: 10px; border-radius: 1px; background: var(--surface-3); }
.seg.yellow { background: var(--yellow); } .seg.green { background: var(--green); }
.seg.purple { background: var(--purple); } .seg.pit { background: var(--blue); }
.segs .gap { width: 4px; }

/* engineer & race control lists */
.feed { display: flex; flex-direction: column; }
.feed .it { display: flex; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--border); line-height: 1.4; align-items: flex-start; }
.feed .it:first-child { border-top: none; }
.feed .it .q-icon { font-size: 16px; color: var(--text-muted); margin-top: 2px; flex: none; }
.feed .it .t { color: var(--text-dim); font-size: var(--fs-xs); white-space: nowrap; margin-top: 1px; flex: none; min-width: 44px; }
.feed .it.hl { background: rgba(250, 204, 21, 0.07); }
.feed .it.hl .q-icon { color: var(--yellow); }
.feed .it.red { background: rgba(239, 68, 68, 0.10); }
.feed .it.red .q-icon { color: var(--red); }
.feed .it.k-cliff .q-icon, .feed .it.k-deg .q-icon { color: var(--orange); }
.feed .it.k-pit_window .q-icon, .feed .it.k-fastest .q-icon { color: var(--purple); }
.feed .it.k-closing .q-icon { color: var(--blue); }
.feed .it.k-pit .q-icon { color: var(--blue); }
.feed .it.k-green .q-icon { color: var(--green); }
.feed .it.k-clipping .q-icon { color: var(--orange); }

.placeholder { color: var(--text-muted); padding: 12px; display: flex; align-items: center; gap: 10px; }

/* replay player bar */
.player {
    display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 52px; flex: none;
    background: var(--surface); border-top: 1px solid var(--border);
}
.player .time { min-width: 150px; text-align: center; color: var(--text-muted); font-size: var(--fs-xs); }
.player .time b { color: var(--text); font-weight: 600; }

/* ─── Quasar overrides (dark, flat) ─────────────────────────────── */
.q-field--outlined .q-field__control { border-radius: var(--r-input) !important; background: var(--bg) !important; }
.q-field--outlined .q-field__control:before { border-color: var(--border) !important; }
.q-field__native, .q-field__input, .q-select__dropdown-icon { color: var(--text) !important; }
.q-field__label { color: var(--text-muted) !important; }
.q-menu { background: var(--surface-2) !important; border: 1px solid var(--border); border-radius: var(--r-input) !important; box-shadow: none !important; }
.q-item { color: var(--text); min-height: 32px !important; }
.q-dialog__backdrop { background: rgba(11, 12, 15, 0.78) !important; }
.q-card { background: var(--surface) !important; box-shadow: none !important; }
.q-tooltip { background: var(--surface-3) !important; color: var(--text) !important; font-size: var(--fs-xs) !important; border: 1px solid var(--border); }
.q-notification { border-radius: var(--r-card) !important; font-family: var(--font) !important; box-shadow: none !important;
                  border: 1px solid var(--border); background: var(--surface-2) !important; color: var(--text) !important; }
.q-slider__track { background: var(--surface-3) !important; }
.q-btn { text-transform: none; }
.q-linear-progress { color: var(--text-muted) !important; }
.js-plotly-plot .plotly .modebar { display: none !important; }

/* ─── responsive: bottom nav under 900px ───────────────────────── */
@media (max-width: 900px) {
    .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr) 60px; }
    .rail { grid-row: 3; grid-column: 1; flex-direction: row; padding: 0; border-right: none; border-top: 1px solid var(--border); }
    .rail .items { flex-direction: row; flex: 1; }
    .nav-item { flex: 1; height: 60px; }
    .nav-item.active::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 3px; }
    .nav-item .key { display: none; }
    .topbar .hide-sm { display: none; }
    .page { padding: 12px; }
}

/* ─── TV mode: bigger text, no rail, more air ──────────────────── */
body.tv { font-size: 18px; }
body.tv .app { grid-template-columns: minmax(0, 1fr); }
body.tv .rail { display: none; }
body.tv .topbar { --topbar-h: 64px; }
body.tv .tower td { height: 30px; font-size: 18px; }
body.tv .tower th { font-size: 12px; }
body.tv .feed .it { font-size: 18px; padding: 8px 14px; }
body.tv .panel-title { font-size: 14px; }
body.tv .strip .lap { font-size: 36px; }
body.tv .strip .wx { font-size: 16px; }
body.tv .tbl td, body.tv .tbl th { font-size: 17px; }
body.tv .kpi .v { font-size: 34px; }
body.tv .page { padding: 24px 32px; }
body.tv .live { padding: 14px 18px; gap: 14px; }
body.tv .seg { width: 6px; height: 13px; }
body.tv .tyre .t { width: 22px; height: 22px; font-size: 12px; }

/* ─── lifecycle ─────────────────────────────────────────────────── */
.pill.pre { color: var(--text-muted); font-weight: 500; }
.chip.go-live { gap: 6px; border-color: #4A1512; color: var(--text); cursor: pointer; white-space: nowrap; }
.finished { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--border);
            border-radius: var(--r-card); background: var(--surface); }
.finished > i { font-size: 22px; color: var(--text-muted); }
.finished .recap { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.finished .recap .t { color: var(--text-dim); margin-right: 8px; }

/* ─── session modes (tower) ─────────────────────────────────────── */
.tag.box { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.tag.elim { background: transparent; color: var(--text-dim); border: 1px solid var(--border); text-transform: none; }
.tower tr.garage td { color: var(--text-dim); }
.tower tr.garage td.tb { opacity: 0.4; }
.tower tr.zone td.p { color: var(--orange); }
.tower tr.cutline td { height: 18px; padding: 0 8px; font-size: 11px; color: var(--orange);
                       border-top: 1px dashed var(--orange); background: transparent; text-align: left; }

/* ─── speed traps ───────────────────────────────────────────────── */
.tower.speeds .sm { font-size: 11px; }
.tower th.sortable { cursor: pointer; user-select: none; }
.tower th.sortable.on { color: var(--text); }
.feed details.grp > summary { display: flex; gap: 10px; align-items: baseline; cursor: pointer; list-style: none; }
.feed details.grp > summary::-webkit-details-marker { display: none; }
.feed details.grp > summary::after { content: "▸"; color: var(--text-dim); margin-left: 4px; }
.feed details.grp[open] > summary::after { content: "▾"; }
.feed details.grp > .it { padding-left: 28px; border-top: none; }
.rc-blue { font-size: 12px; color: var(--text-muted); }
.tower .tag { line-height: 13px; }
.rc-blue { white-space: nowrap; }
.panel-body .subhead { padding: 6px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
                       text-transform: uppercase; color: var(--text-muted); border-top: 1px solid var(--border); }
.placeholder.slim { padding: 8px 12px; }
.tower .cb { margin-right: 10px; white-space: nowrap; }
.mini-legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: var(--text-muted); padding: 0 4px 6px; }
.mini-legend .sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.mini-legend .sw.solid { background: var(--text-muted); }
.mini-legend .sw.tint { background: rgba(139,145,154,0.28); }

/* ─── race tools ────────────────────────────────────────────────── */
.due-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--text-dim); }
.due-dot.on { background: var(--orange); border-color: var(--orange); }
.rjlist .rj, .rjlist .duel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 12px;
                             border-top: 1px solid var(--border); font-size: 13px; }
.rjlist .rj:first-child, .rjlist .duel:first-child { border-top: none; }
.rjlist .tb { width: 3px; height: 14px; border-radius: 1px; }
.rjlist .sub { flex-basis: 100%; padding-left: 11px; font-size: 12px; color: var(--text-muted); }
.tag.traffic { background: transparent; color: var(--orange); border: 1px solid var(--orange); text-transform: none; }
.tag.clean { background: transparent; color: var(--green); border: 1px solid #1E4A2E; text-transform: none; }


/* ─── /live layout: tower | splitter | modules ──────────────────── */
/* Split, order, open/collapsed, heights and popped-out modules come from a <style> written by
   static/js/livelayout.js (per session mode, saved in the browser). */
.lw { --split: 58%; position: relative; flex: 1; min-height: 0; display: grid;
      grid-template-columns: minmax(0, var(--split)) 12px minmax(0, 1fr); }
.lw-left { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.lw-left > .lw-tower { flex: 1 1 auto; min-height: 200px; }
.lw-hsplit { flex: none; height: 12px; position: relative; cursor: row-resize; touch-action: none; }
.lw-hsplit::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 1px; }
.lw-hsplit::after { content: ""; position: absolute; left: 50%; top: 4px; width: 36px; height: 4px; margin-left: -18px;
                    border-radius: 2px; background: var(--border-strong); }
.lw-hsplit:hover::before, .lw-hsplit[data-drag]::before { background: var(--border-strong); }
.lw-hsplit:hover::after, .lw-hsplit[data-drag]::after { background: var(--text-muted); }
.lw-ldock { flex: 1 1 0px; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
            gap: 8px; padding-bottom: 2px; }
/* while a module is dragged, an empty left dock shows up as a drop zone */
.lw[data-dragging] .lw-ldock { display: flex !important; min-height: 90px; border-radius: var(--r-card);
                               outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.lw[data-dragging] .lw-hsplit { display: block !important; }
/* until the script has put each module in its dock (a moment after load) */
.lw:not([data-ready]) .lw-right, .lw:not([data-ready]) .lw-ldock { visibility: hidden; animation: lw-show 0s 2s forwards; }
@keyframes lw-show { to { visibility: visible; } }
.lw-tower[data-drop="1"] .tower .tc-mini,
.lw-tower[data-drop="2"] .tower .tc-mini, .lw-tower[data-drop="2"] .tower .tc-sec,
.lw-tower[data-drop="3"] .tower .tc-mini, .lw-tower[data-drop="3"] .tower .tc-sec, .lw-tower[data-drop="3"] .tower .tc-best { display: none; }
.lw-split { position: relative; cursor: col-resize; touch-action: none; }
.lw-split::before { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px; border-radius: 1px; }
.lw-split::after { content: ""; position: absolute; top: 50%; left: 4px; width: 4px; height: 36px; margin-top: -18px;
                   border-radius: 2px; background: var(--border-strong); }
.lw-split:hover::before, .lw-split[data-drag]::before { background: var(--border-strong); }
.lw-split:hover::after, .lw-split[data-drag]::after { background: var(--text-muted); }
.lw-right { min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
            gap: 8px; padding-bottom: 2px; }
.lw-notice { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid #5A4C10;
             border-radius: var(--r-card); background: rgba(250, 204, 21, 0.08); font-size: var(--fs-xs); }
.lw-notice:empty { display: none; }
.lw-notice button { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; }
.lw-drop { display: none; position: absolute; height: 3px; border-radius: 2px; background: var(--blue);
           z-index: 25; pointer-events: none; }
.lw-drop[data-on] { display: block; }
.lw-menu .q-item { min-width: 220px; }

.mod { flex: 2 1 0px; min-height: 120px; position: relative; }
.mod-head { gap: 4px; padding: 0 4px 0 2px; user-select: none; -webkit-user-select: none; }
.mod-grip { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 34px;
            color: var(--text-dim); cursor: grab; touch-action: none; border-radius: var(--r-input); }
.mod-grip .q-icon { font-size: 18px; }
.mod-grip:hover { color: var(--text-muted); background: var(--surface-2); }
.mod-title { cursor: pointer; overflow: hidden; text-overflow: ellipsis; margin-right: 2px; }
.mod-title:hover { color: var(--text); }
.mod-actions { display: flex; justify-content: flex-end; gap: 6px; align-items: center; min-width: 0; overflow: hidden; }
.mod-btn { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
           border: none; border-radius: var(--r-input); background: transparent; color: var(--text-dim); cursor: pointer; padding: 0; }
.mod-btn .q-icon { font-size: 18px; }
.mod-btn .q-icon.ic-b { display: none; }
.mod-btn:hover { color: var(--text); background: var(--surface-2); }
.mod[data-max] .b-max .ic-a { display: none; }
.mod[data-max] .b-max .ic-b { display: inline-flex; }
.mod-docked { display: none; align-items: center; gap: 8px; padding: 3px 6px 3px 12px; min-height: 36px; }
.mod-docked .panel-title, .mod-docked .muted { cursor: pointer; font-size: 12px; white-space: nowrap; }
.mod-docked .grow { flex: 1; }
.dock-btn { min-height: 26px !important; padding: 0 10px !important; }
.mod-resize { position: absolute; left: 0; right: 0; bottom: -7px; height: 12px; cursor: row-resize; touch-action: none; z-index: 2; }
.mod-resize::after { content: ""; position: absolute; left: 50%; width: 40px; margin-left: -20px; top: 5px; height: 3px; border-radius: 2px; }
.mod:hover > .mod-resize::after, .mod-resize[data-drag]::after { background: var(--border-strong); }
.mod[data-drag] { opacity: 0.4; }
/* maximize: over tower + modules (strip, top bar and replay bar stay) */
.mod[data-max] { position: absolute; inset: 0; z-index: 20; min-height: 0; height: auto !important; }
.mod[data-max] > .mod-resize, .mod[data-max] .b-pop, .mod[data-max] .mod-grip { display: none; }
.lw[data-has-max] > .lw-split { visibility: hidden; }
.mod .chart-fill { min-height: 60px; }
.mod .panel-body.chartbody { padding-bottom: 8px; }
.tel-box { flex: 1; min-height: 0; display: flex; gap: 8px; }
.tel-lap { flex: 3; min-width: 0; display: flex; }
.tel-map { flex: 2; min-width: 0; display: flex; }

/* a module in its own window (/live/panel/<key>) */
.pop { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.pop-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px 0 14px; flex: none;
            background: var(--surface); border-bottom: 1px solid var(--border); }
.pop-title { color: var(--text); }
.pop-sess { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pop-body { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }

/* under 1024 px: no splitter, tower on top, modules stacked below (each with its own height) */
@media (max-width: 1023.98px) {
    .main.fit { overflow: auto; }
    .main.fit > .live { flex: none; }
    .lw { display: flex; flex-direction: column; gap: 10px; flex: none; }
    .lw-split, .lw-hsplit, .lw-ldock { display: none !important; }
    .lw-left > .lw-tower { max-height: 62vh; flex: none !important; }
    .lw-right { overflow: visible; }
    .mod { flex: none; height: 260px; }
    .mod .b-pop { display: none; }
    .mod[data-max] { position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; z-index: 60; border-radius: 0; }
    .player { position: sticky; bottom: 0; z-index: 5; }
}

/* Dove guadagna: compact tiles above the chart */
.gain-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin: 4px 0 2px; }
.gain-kpis .kpi { padding: 6px 10px; }

/* ─── proportions pass (2026-10-24) ─────────────────────────────── */
/* tower: every column as narrow as its content, groups (times · sectors · tyre · mini-sectors)
   set apart by a gap, the spare width in the empty last column */
.tower th, .tower td { width: 1%; }
.tower th.fill, .tower td.fill { width: auto; padding: 0; }
.tower td.num, .tower th.r { font-variant-numeric: tabular-nums; }
.tower td.d { padding-right: 10px; }
.tower td.d + td, .tower th:nth-child(3) + th { padding-left: 12px; }
.tower td:not(.tc-sec) + td.tc-sec, .tower th:not(.tc-sec) + th.tc-sec,
.tower td.ty, .tower th.ty, .tower td.tc-mini, .tower th.tc-mini { padding-left: 16px; }
.tower td.tc-sec, .tower th.tc-sec { min-width: 52px; }
.tower tr.cutline td { width: auto; }
/* tables inside modules: compact, spare width at the end */
.mod-body table.tower { width: auto !important; min-width: 0; }
.mod-body .tower th, .mod-body .tower td { width: auto; }
.mod-body .tower td.tb, .mod-body .tower th.tb { width: 3px; }
.mod-body .tower td.r, .mod-body .tower th.r { padding-left: 14px; }
.mod-body table.tower th.fill, .mod-body table.tower td.fill { display: none; }

/* modules: content adapts to the module (container width, not the screen) */
.mod .mod-body { container-type: inline-size; }
.chartbody .chart-fill, .chartbody > .nicegui-plotly { min-height: 110px; }
/* a module that only shows a one-line message takes just its header + that line (never less);
   the space goes to the open ones */
.lw .mod:has(> .mod-body .placeholder):not(:has(.nicegui-plotly:not(.hidden))):not([data-max]) {
    flex: 0 0 auto !important; min-height: auto !important; }
.lw .mod:has(> .mod-body .placeholder):not(:has(.nicegui-plotly:not(.hidden))) > .mod-body { flex: 0 0 auto; }
/* modules never disappear: the header never shrinks, the body never spills over the next module
   (it scrolls), and a dock that can't fit its modules scrolls with a visible scrollbar */
.lw .mod > .mod-head { flex: none; }
.lw .mod > .mod-body { min-height: 0; overflow: auto; }
.lw .mod { flex-shrink: 0; }
.lw-ldock, .lw-right { scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.lw-ldock::-webkit-scrollbar, .lw-right::-webkit-scrollbar { width: 8px; }
.lw-ldock::-webkit-scrollbar-thumb, .lw-right::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
/* Dove guadagna: tiles beside the chart when the module is wide, stacked when narrow */
.gain-wrap { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.gain-wrap > .gain-side { flex: none; display: flex; flex-direction: column; gap: 4px; }
.gain-wrap > .gain-chart { flex: 1; min-height: 130px; min-width: 0; display: flex; }
.gain-wrap > .gain-chart > .nicegui-plotly { flex: 1; min-height: 0; }
@container (min-width: 860px) {
    .gain-wrap { flex-direction: row; }
    .gain-wrap > .gain-side { width: 470px; }
    .gain-wrap .gain-kpis { grid-template-columns: 1fr 1fr; }
}
.tower td.tb, .tower th.tb { width: 3px; min-width: 3px; max-width: 3px; }
.tower tr.pinned td.tb { width: 5px; min-width: 5px; max-width: 5px; }
.tower td.p, .tower th.p { width: 24px; }
.gain-kpis .kpi .v.v-sm { font-size: 18px; }

/* Classifica alone in its column: rows grow to fill it (--row-h set by livelayout.js) */
.lw-tower .tower tr.trow td { height: var(--row-h, 21px); }
.lw-tower[style*="--row-h"] .tower tr.trow td { font-size: calc(13px + (var(--row-h) - 21px) * 0.35); }
.lw-tower[style*="--row-h"] .seg { height: calc(var(--row-h) * 0.48); }
/* mini-sectors take the spare width of the tower (the empty end column only when they're dropped) */
.lw-tower .tower th.tc-mini, .lw-tower .tower td.tc-mini { width: auto; }
.lw-tower .tower td.tc-mini .segs { display: flex; width: 100%; max-width: 560px; }
.lw-tower .tower td.tc-mini .seg { flex: 1 1 5px; min-width: 4px; max-width: 16px; }
.lw-tower .tower td.tc-mini .segs .gap { flex: 0 0 6px; }
.lw-tower:not([data-drop="1"]):not([data-drop="2"]):not([data-drop="3"]) .tower .fill { width: 0; }

/* Long run · Migliori per mescola: a grid that fills the module (1-3 columns by width) */
.lr-best { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 18px; padding: 0 0 4px; }
.lrb { display: flex; align-items: center; gap: 8px; height: 21px; border-top: 1px solid var(--border);
       white-space: nowrap; font-size: 13px; overflow: hidden; }
.lrb-c { flex: none; width: 3px; height: 14px; border-radius: 1px; }
.lrb .d { width: 38px; flex: none; }
.lrb-t .cb { margin-right: 10px; }
body.tv .lrb { height: 30px; font-size: 18px; }

/* comparison modules: the two drivers this module compares (header chips) */
.pair-pick { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.pair-chip { cursor: pointer; gap: 2px; padding-right: 2px; height: 24px; }
.pair-chip .pair-caret { font-size: 16px; color: var(--text-muted); }
.pair-vs { font-size: 11px; }
.pair-menu .q-item { min-height: 30px; padding: 2px 12px; }
.pair-menu .pair-dot { display: inline-block; width: 4px; height: 14px; border-radius: 1px; margin-right: 6px; vertical-align: -2px; }
.pair-menu .pair-follow { color: var(--blue); }
/* tower sectors of the previous lap (TV style): still there, dimmed */
.tower td.tc-sec.sprev { opacity: 0.42; }
/* mini-sectors: car in the box / garage → bar dimmed; legend row under the header when wide */
.tower tr.inbox td.tc-mini .segs { opacity: 0.3; filter: saturate(0.4); }
.tower tr.seglegend td { height: 16px !important; border-top: none; padding-top: 0; padding-bottom: 2px; }
.tower tr.seglegend td { width: auto; overflow: hidden; }
.tower tr.seglegend .segleg { white-space: nowrap; display: flex; justify-content: flex-end; gap: 10px;
    font-size: 10px; color: var(--text-dim); line-height: 14px; }
.tower tr.seglegend .sl { display: inline-flex; align-items: center; gap: 4px; }
.tower tr.seglegend .seg { width: 8px; height: 8px; flex: none; }
.tower tr.seglegend { display: none; }
.lw-tower[data-wide] .tower tr.seglegend { display: table-row; }      /* set by livelayout.js */

/* Mappa pista (static/js/livemap.js): SVG track + a "Box" list at the side */
.lmap { flex: 1; min-height: 0; width: 100%; display: flex; }
.lmap-wrap { flex: 1; min-width: 0; min-height: 0; display: flex; gap: 6px; position: relative; }
.lmap-svg { flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; height: 100%; display: block; }
.lmap-track { fill: none; stroke: #2C3038; stroke-width: 7px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lmap-dot { cursor: default; }
.lmap-ghost { fill: none; }      /* dash and width set per frame in map units (livemap.js) */
.lmap-label { fill: var(--text); font-weight: 700; paint-order: stroke; stroke: var(--bg); stroke-width: 3px;
    vector-effect: non-scaling-stroke; pointer-events: none; font-family: inherit; }
.lmap-box { flex: none; max-height: 100%; display: flex; flex-direction: column; gap: 2px; padding: 2px 4px;
    border: 1px dotted var(--border); border-radius: 4px; align-self: flex-start; overflow: hidden; }
.lmap-box .lb-head { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); cursor: default; }
.lmap-box .lb-list { display: grid; grid-auto-flow: column; grid-template-rows: repeat(8, auto); gap: 1px 10px; }
.lmap-box .lb-item { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.lmap-box .lb-item i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.lmap-box .lb-item i.ring { background: transparent; border: 2px solid currentColor; box-sizing: border-box; }
.lmap-box.collapsed { cursor: pointer; }
.lmap-box.collapsed .lb-list { display: none; }
.lmap-box.collapsed.open { position: absolute; right: 0; top: 0; z-index: 3; background: var(--surface-1, #12151A); }
.lmap-box.collapsed.open .lb-list { display: grid; }

/* Velocità: bar ranking of top speeds */
.sp-pick { display: inline-flex; gap: 3px; flex: none; }
.sp-pick.sp-which { margin-left: 6px; }
.chip.chip-sm { height: 22px; padding: 0 7px; font-size: 11px; }
.spbars { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 4px 6px; }
.sb-row { display: grid; grid-template-columns: 40px 1fr 34px 34px; align-items: center; gap: 6px; height: 18px;
    cursor: pointer; border-radius: 3px; padding: 0 4px; }
.sb-row:hover { background: rgba(255,255,255,0.03); }
.sb-row.pinned { background: var(--surface-2); outline: 1px solid var(--border-strong); }
.sb-row.pinned .sb-d, .sb-row.pinned .sb-v { color: var(--text); font-weight: 800; }
.sb-d { font-weight: 700; font-size: 12px; letter-spacing: 0.03em; color: var(--text-muted); }
.sb-track { height: 10px; position: relative; }
.sb-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; opacity: 0.85; }
.sb-row.pinned .sb-bar { opacity: 1; box-shadow: 0 0 0 1px rgba(255,255,255,0.5); }
.sb-v { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.sb-x { font-size: 11px; }
.sb-v.c-purple { color: var(--purple); font-weight: 700; }
.sb-clip { color: var(--orange); font-weight: 700; cursor: help; white-space: nowrap; }
.sb-foot { font-size: 11px; padding: 0 12px 6px; }

/* tower: team marker (3-letter code in the team colour, no logos) */
.tower .tpill { display: inline-block; min-width: 26px; padding: 0 3px; margin-left: 5px; border-radius: 3px;
    font-size: 9px; font-weight: 800; letter-spacing: 0.04em; line-height: 13px; text-align: center; vertical-align: 1px; }
.tower tr.out .tpill, .tower tr.garage .tpill { opacity: 0.6; }
body.tv .tower .tpill { font-size: 12px; line-height: 17px; min-width: 34px; }

/* module header controls: short labels when the module is narrow */
.lw .mod, .pop { container-type: inline-size; container-name: modbox; }
.sp-pick .lbl-short { display: none; }
@container modbox (max-width: 620px) { .sp-pick .lbl-long { display: none; } .sp-pick .lbl-short { display: inline; } }

/* Home: "Prossima sessione" = the GP of the week, highlighted */
.panel.panel-hero { position: relative; overflow: hidden; border-color: rgba(239, 68, 68, 0.55);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(239, 68, 68, 0.04) 45%, var(--surface) 75%);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.15), 0 8px 28px rgba(239, 68, 68, 0.10); }
.panel.panel-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.panel.panel-hero > .panel-head { border-bottom-color: rgba(239, 68, 68, 0.25); }
.panel.panel-hero > .panel-head .panel-title { color: var(--red); }
.panel.panel-hero .countdown { color: #fff; }

/* Gomme e soste, Clipping: the table spans the whole module (row lines to the end) */
.lw .f-tyres .mod-body table.tower, .lw .f-clip .mod-body table.tower,
.pop-body table.tower { width: 100% !important; }

/* Home live card: red accent while a session is live; a faint chequered flag once it's over */
.panel.home-live { position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.panel.home-live::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); z-index: 2; }
.panel.home-live > .panel-head { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
    border-bottom-color: color-mix(in srgb, var(--accent) 28%, var(--border)); }
.panel.home-live > .panel-head .panel-title { color: var(--accent); }
.panel.home-live > .panel-head, .panel.home-live > .panel-body { position: relative; z-index: 1; }
.panel.home-live.done { border-color: var(--border-strong); }
.panel.home-live.done::before { background: var(--text-muted); }
.panel.home-live.done > .panel-head { background: none; border-bottom-color: var(--border); }
.panel.home-live.done > .panel-head .panel-title { color: var(--text-muted); }
.panel.home-live.done::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: conic-gradient(rgba(255,255,255,0.045) 25%, transparent 0 50%, rgba(255,255,255,0.045) 0 75%, transparent 0) 0 0 / 22px 22px;
    -webkit-mask-image: linear-gradient(105deg, transparent 35%, #000 100%); mask-image: linear-gradient(105deg, transparent 35%, #000 100%); }

/* chequered flag: chip in the top bar / status strip, icon next to a driver who took it */
.status-chip.chequered { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.status-chip.chequered i { font-size: 15px; }
.tower .fin i { font-size: 13px; vertical-align: -2px; color: var(--text); }
.tower tr.out .fin { display: none; }
.tag.prov { background: transparent; color: var(--yellow); border: 1px solid color-mix(in srgb, var(--yellow) 40%, var(--border));
    text-transform: none; cursor: help; }

/* Mondiale: the champion once the title is decided (gold version of the hero card) */
.panel.panel-hero.champion { padding: 20px 24px; border-color: rgba(250, 204, 21, 0.55);
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.16) 0%, rgba(250, 204, 21, 0.04) 45%, var(--surface) 75%);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.15), 0 8px 28px rgba(250, 204, 21, 0.10); }
.panel.panel-hero.champion::before { background: var(--yellow); }
.champion .champ-kicker { color: var(--yellow); font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; margin-bottom: 6px; }
.champion .champ-name { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.champion .champ-name .teambar { width: 5px; height: 30px; border-radius: 3px; flex: none; }
