/* ═══════════════════════════════════════════════════════════════════
   selezione-footballapi · Dark Terminal UI
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Layout */
  --content-max: 1500px;

  /* Spacing scale */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 18px;

  /* Radius scale */
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* Surfaces */
  --bg: #0c1117;
  --bg-muted: #192230;
  --panel: rgba(14, 20, 30, 0.9);

  /* Text */
  --ink: #edf3fb;
  --muted: #7f92a8;
  --muted-strong: #a8b7c9;

  /* Lines */
  --line-rgb: 168, 183, 201;
  --line: rgba(var(--line-rgb), 0.12);
  --line-strong: rgba(var(--line-rgb), 0.2);

  /* ── Hue channels — single RGB source per hue, so every solid + alpha
     variant resolves from one place (use as rgb(var(--x-rgb)) /
     rgba(var(--x-rgb), a)). This is what makes the palette re-themeable. ── */
  --accent-rgb: 104, 183, 214;        /* brand accent → teal */
  --accent-bright-rgb: 34, 211, 238;  /* bright accent → cyan */
  --success-rgb: 81, 191, 122;
  --warning-rgb: 213, 162, 77;
  --danger-rgb: 219, 107, 112;
  --info-rgb: 129, 140, 248;          /* indigo — "info" tone + Log Analyzer categorical */
  --magenta-rgb: 236, 72, 153;         /* Over-odds chart 4th line (distinct from the 1X2 hues) */

  /* Brand colors (accent unified to teal) */
  --accent: rgb(var(--accent-rgb));
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-bright: rgb(var(--accent-bright-rgb));
  /* Teal base token — now the same hue as --accent. Kept as an alias for the
     existing var(--teal) usages; single source stays --accent-rgb. */
  --teal: var(--accent);
  --teal-soft: var(--accent-soft);

  /* Status colors */
  --success: rgb(var(--success-rgb));
  --success-soft: rgba(var(--success-rgb), 0.12);
  --warning: rgb(var(--warning-rgb));
  --warning-soft: rgba(var(--warning-rgb), 0.12);
  --danger: rgb(var(--danger-rgb));
  --danger-soft: rgba(var(--danger-rgb), 0.12);
  --info: rgb(var(--info-rgb));
  --info-soft: rgba(var(--info-rgb), 0.12);
  --magenta: rgb(var(--magenta-rgb));

  /* Icona "live" (broadcast / on-air) usata come mask-image rossa nei badge live. */
  --live-broadcast-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23000'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18.364%2019.364a9%209%200%201%200%20-12.728%200'/%3E%3Cpath%20d='M15.536%2016.536a5%205%200%201%200%20-7.072%200'/%3E%3Cpath%20d='M12%2013m-1%200a1%201%200%201%200%202%200a1%201%200%201%200%20-2%200'/%3E%3C/svg%3E");

  /* Effects */
  --shadow: 0 24px 48px rgba(4, 10, 20, 0.28);
  --shadow-soft: 0 12px 24px rgba(4, 10, 20, 0.18);
  --glow-accent: none;
  --glow-teal: none;
  --motion-fast: 100ms;
  --motion-base: 140ms;
  --motion-ease: cubic-bezier(0.2, 0, 0.2, 1);

  /* Betfair Exchange back/lay convention colors */
  --bf-back-rgb: 79, 172, 247;
  --bf-lay-rgb: 255, 134, 186;
  --bf-back: rgb(var(--bf-back-rgb));
  --bf-lay: rgb(var(--bf-lay-rgb));

  /* Fonts */
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
}

/* ─── File Map ───────────────────────────────────────────────────
   1. Reset / typography / layout primitives
   2. Hero, tabs, status banner
   3. Forms, grids, cards, buttons, pills
   4. Tables, results, drawers, modals
   5. Scope selector, progress, skeleton
   6. KPI cards (.dashboard-kpi-* support, reused by Log Analyzer)
   7. "Professional Workspace Refinements" — overrides applied on top
   8. Analytics / Toast / Screening config
   9. Estimates and ops panels
  10. Diagnostics, screening progress bar, content-loading overlay
   Each section ends with its own @media responsive overrides — kept local
   to the section for context, intentionally not collapsed to a single block.
   ──────────────────────────────────────────────────────────────── */

/* ─── Reset ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(var(--accent-bright-rgb), 0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 20%, rgba(var(--accent-bright-rgb), 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 100%, rgba(var(--accent-bright-rgb), 0.03) 0%, transparent 50%),
    var(--bg);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open { overflow: hidden; }

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #080C12;
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid rgba(var(--accent-bright-rgb), 0.45);
  outline-offset: 2px;
}

button, input, select, textarea { font: inherit; }

/* ─── Layout ─────────────────────────────────────────────────────── */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 20px;
  width: min(var(--content-max), calc(100% - 88px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-shell{
  display: grid;
  gap: clamp(18px, 2vw, 24px);
}

.panel,
.drawer-section {
  min-width: 0;
}

.panel {
  display: grid;
  gap: var(--space-2);
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tab-panel.active,
.section-stack,
.card-list,
.mini-grid,
.drawer-body,
.summary-grid,
.result-list{
  display: grid;
  gap: var(--space-2);
}

.section-copy {
  display: grid;
  gap: 5px;
  max-width: 76ch;
}

.eyebrow {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

/* ─── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.1;
  color: var(--ink);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  font-family: 'Bebas Neue', 'Barlow Condensed', sans-serif;
  font-size: clamp(2.4rem, 4vw, 3.5rem);
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 0 0 32px rgba(var(--accent-bright-rgb), 0.35);
}

h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(1.2rem, 1.4vw, 1.5rem);
  letter-spacing: 0.04em;
  font-weight: 700;
  text-transform: uppercase;
}

h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  text-transform: uppercase;
}

h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-header p,
.empty-state,
.meta-text{
  margin: 0;
  color: var(--muted-strong);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.section-header .chart-interaction-hint,
.chart-interaction-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--teal);
}

.chart-interaction-hint::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1px solid rgba(var(--accent-bright-rgb), 0.35);
  border-radius: 50%;
  background: rgba(var(--accent-bright-rgb), 0.08);
  color: var(--teal);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}

/* Long-form hint: flow as a normal paragraph instead of an inline-flex row, so
   multiple sentences and <em> emphasis don't collapse into shrunk flex columns
   (one letter per line). The "i" badge stays as an inline marker at the start. */
.section-header .chart-interaction-hint.is-paragraph,
.chart-interaction-hint.is-paragraph {
  display: block;
  text-wrap: pretty;
}

.chart-interaction-hint.is-paragraph::before {
  margin-right: 6px;
  vertical-align: 1px;
}

/* ─── Section Header ─────────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 16px;
}

.section-header.compact { gap: 10px; }

.section-header > *,
.result-summary > * {
  min-width: 0;
}

.section-actions,
.action-row,
.tabs,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.action-row-prominent {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ─── Tabs ───────────────────────────────────────────────────────── */
/* The nav is a flex row: the account cluster (logout + username) is pinned
   left and never scrolls; the tabs live in a flexible rail that centers them
   and scrolls horizontally on its own when they don't fit. */
.tabs {
  position: sticky;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  top: max(10px, env(safe-area-inset-top));
  z-index: 6;
  padding: 9px 12px;
  gap: 10px;
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(var(--line-rgb), 0.15);
}

.tab-rail {
  /* basis 0 (not auto): the rail grows from zero into the space the account
     cluster leaves, instead of claiming its full content width and pushing the
     cluster off the right edge. */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  /* Centered when the tabs fit; `safe` falls back to start-aligned (nothing
     clipped/unreachable) once they overflow and the rail starts scrolling. */
  justify-content: safe center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-rail::-webkit-scrollbar { display: none; }
/* Keep each tab at its natural width and let the rail scroll — otherwise the
   tabs shrink below their label and the text overflows onto its neighbour. */
.tab-rail > .tab-button { flex: 0 0 auto; }

.tabs-panel { padding: 5px 6px; }

.tabs.tabs-panel { padding: 9px 12px; }

.tabs::-webkit-scrollbar { display: none; }

.tab-button {
  display: grid;
  grid-template-columns: 22px minmax(0, auto);
  grid-template-areas:
    "icon label"
    "icon meta";
  align-items: center;
  justify-content: start;
  column-gap: 10px;
  row-gap: 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  min-height: 54px;
  padding: 10px 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  position: relative;
  transition:
    background-color var(--motion-base) var(--motion-ease),
    color var(--motion-base) var(--motion-ease),
    border-color var(--motion-base) var(--motion-ease);
}

.tab-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
  opacity: 0;
  transition: opacity var(--motion-base) var(--motion-ease);
}

.tab-button.active::before {
  opacity: 0.65;
}

.tab-icon {
  grid-area: icon;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--muted);
  opacity: 0.82;
  transition:
    color var(--motion-base) var(--motion-ease),
    opacity var(--motion-base) var(--motion-ease),
    transform var(--motion-base) var(--motion-ease);
}

.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-label {
  grid-area: label;
  min-width: 0;
}

.tab-meta {
  grid-area: meta;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  /* Reserve the badge slot height so tabs with a badge (e.g. Screening) don't
     grow 4px taller than their siblings. Matches .tab-badge height. */
  min-height: 17px;
}

.tab-status {
  min-width: 0;
  color: rgba(var(--line-rgb), 0.68);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}

.button,
.tab-button{
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(var(--accent-bright-rgb), 0.16);
}

.tab-button:hover {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
}

.tab-button.active {
  background: rgba(var(--accent-bright-rgb), 0.09);
  color: var(--accent);
  border-color: rgba(var(--accent-bright-rgb), 0.2);
  box-shadow: inset 0 1px 0 rgba(var(--accent-bright-rgb), 0.1);
}

.tab-button:hover .tab-icon,
.tab-button.active .tab-icon {
  color: currentColor;
  opacity: 1;
}

.tab-button.active .tab-icon {
  transform: translateY(-1px);
}

.tab-button[data-nav-order-draggable="true"] {
  cursor: grab;
  user-select: none;
}

.tab-button[data-nav-order-draggable="true"]:active {
  cursor: grabbing;
}

.tab-button.dragging {
  opacity: 0.42;
}

.tab-button.drop-before {
  box-shadow: inset 2px 0 0 0 var(--accent-bright);
}

.tab-button.drop-after {
  box-shadow: inset -2px 0 0 0 var(--accent-bright);
}

/* Navbar status stays brand-aligned: positive/active states use the teal accent
   (not success-green), so the nav chrome reads as one hue. warning/danger keep
   their semantic colors as the only non-teal signals. */
.tab-button[data-nav-status="success"] .tab-status,
.tab-button[data-nav-status="info"] .tab-status,
.tab-button[data-nav-status="loading"] .tab-status { color: var(--accent); }
.tab-button[data-nav-status="warning"] .tab-status { color: var(--warning); }
.tab-button[data-nav-status="danger"] .tab-status { color: var(--danger); }

.tab-button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(var(--accent-bright-rgb), 0.4);
  outline-offset: 1px;
  border-color: rgba(var(--accent-bright-rgb), 0.5);
}

.tab-panel { display: none; }

.tab-panel.active { gap: 22px; }

/* ─── Form Controls ──────────────────────────────────────────────── */
.inline-field,
label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
}

label span {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  background: rgba(8, 12, 20, 0.8);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  font-family: 'DM Sans', sans-serif;
}

input:hover, select:hover {
  border-color: rgba(var(--accent-bright-rgb), 0.2);
}

input[type="checkbox"] {
  width: 17px;
  min-width: 17px;
  min-height: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--accent);
  background: transparent;
}

/* Select arrow override */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235E738A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-grid,
.results-columns{
  display: grid;
  gap: var(--space-2);
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.results-columns {
  grid-template-columns: 1fr;
}

.section-stack {
  border-color: rgba(var(--accent-bright-rgb), 0.14);
  background: linear-gradient(160deg, rgba(var(--accent-bright-rgb), 0.04), var(--panel));
}

.dashboard-kpi-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  min-height: 128px;
  padding: 20px 22px;
  align-items: center;
}

.dashboard-kpi-card + .dashboard-kpi-card {
  border-left: 1px solid rgba(var(--line-rgb), 0.12);
}
.dashboard-kpi-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-kpi-copy span {
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-kpi-copy strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3vw, 2.42rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dashboard-kpi-copy small {
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.35;
}

.toolbar-search { min-width: 0; }

@media (max-width: 900px) {
}

.mini-card,
.fixture-card,
.result-card,
.drawer-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(10, 16, 28, 0.85);
}

.mini-card,
.drawer-section {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.fixture-card,
.result-card {
  display: grid;
  gap: 14px;
  padding: 20px 20px 20px 24px;
}

.drawer-section {
  background: rgba(8, 12, 22, 0.9);
}

.drawer-section h3 {
  margin-bottom: 2px;
}

/* ─── Toggle ─────────────────────────────────────────────────────── */
.toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.7);
}

.toggle input {
  width: auto;
  min-height: auto;
  margin: 3px 0 0;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  min-height: 42px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    transform var(--motion-fast) var(--motion-ease),
    opacity var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease);
}

.button:hover { transform: translateY(-1px); }

.button:disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button.primary {
  color: #080C12;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}

.button.primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  box-shadow: 0 0 32px rgba(var(--accent-bright-rgb), 0.35);
}

.button.secondary {
  color: var(--ink);
  background: rgba(var(--accent-bright-rgb), 0.06);
  border-color: var(--line-strong);
}

.button.secondary:hover {
  background: rgba(var(--accent-bright-rgb), 0.1);
  border-color: rgba(var(--accent-bright-rgb), 0.25);
}

.button.ghost {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(var(--accent-bright-rgb), 0.15);
}

.button.ghost:hover {
  background: rgba(var(--accent-bright-rgb), 0.14);
  border-color: rgba(var(--accent-bright-rgb), 0.3);
}

.button.ghost.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(var(--danger-rgb), 0.2);
}

.button[aria-busy="true"] {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
  gap: 8px;
}

.button[aria-busy="true"]::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── Pills & Badges ──────────────────────────────────────────────────────
   Single source of truth for `.pill`. A second declaration block lived below
   at ~line 3260 and silently overrode font, padding, radius and text-transform
   to refresh the theme — the cascade-merged result is what's encoded here.
   ───────────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-family: "DM Sans", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: none;
}

.pill.neutral {
  color: var(--muted-strong);
  background: rgba(var(--line-rgb), 0.08);
  border: 1px solid rgba(var(--line-rgb), 0.12);
}

.pill.success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(var(--success-rgb), 0.2);
}

.pill.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(var(--warning-rgb), 0.2);
}

.pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
}

.pill.info {
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid rgba(var(--info-rgb), 0.2);
}

.result-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-summary h3 {
  font-size: 1rem;
  margin: 0;
  letter-spacing: 0.01em;
}

/* ─── Card Lists ─────────────────────────────────────────────────── */
.card-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  position: relative;
  gap: 16px;
}

/* Preview fixture: scroll interno al panel */
#fixtures-preview.card-list {
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
}

#fixtures-preview.card-list::-webkit-scrollbar {
  width: 5px;
}
#fixtures-preview.card-list::-webkit-scrollbar-track {
  background: transparent;
}
#fixtures-preview.card-list::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-bright-rgb), 0.2);
}

.results-columns {
  position: relative;
}

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-shell {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 20, 0.85);
  box-shadow: inset 0 1px 0 rgba(var(--accent-bright-rgb), 0.04);

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
  scrollbar-gutter: stable both-edges;
}

.table-shell::-webkit-scrollbar { height: 6px; }
.table-shell::-webkit-scrollbar-track { background: transparent; }
.table-shell::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-bright-rgb), 0.2);
}

/* Cap the 60+ row table so it scrolls inside the panel; this also activates
   the globally-sticky `th` (which only engages once the shell is a scroll box). */
#league-insights-table-shell {
  max-height: min(62vh, 620px);
  overflow-y: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(8, 12, 20, 0.95);
  border-bottom-color: rgba(var(--accent-bright-rgb), 0.15);
}

.table-shell td {
  max-width: 420px;
  white-space: normal;
  overflow: hidden;
}

.table-shell td .meta-text,
.table-shell td strong {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

tbody tr:hover {
  background: rgba(var(--accent-bright-rgb), 0.03);
}

/* ─── League Insights: badges, heatmap, 1X2 bar, stat coverage ─────── */
.comp-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid transparent;
}

.comp-badge--cup {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(var(--warning-rgb), 0.32);
}

.comp-badge--league {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.28);
}

/* Data bar: a small teal mini-bar rendered right under the value (its fill
   width ∝ the value within the column, set inline in JS). Encodes magnitude
   only — longer fill = higher in the column. */
#league-insights-table .ins-bar {
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 4px;
  border-radius: 2px;
  background: rgba(var(--line-rgb), 0.18);
  overflow: hidden;
}

#league-insights-table .ins-bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.8);
}

/* Low-coverage stat cell: the value stays full-contrast, but its data bar turns
   amber and an "n/m" caption appears below it, so it reads immediately as an
   average over fewer matches (tooltip carries the same detail). */
#league-insights-table .ins-bar--thin > i {
  background: rgba(var(--warning-rgb), 0.9);
}

#league-insights-table .ins-cov {
  display: block;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  line-height: 1;
  color: var(--warning);
}

/* 100%-stacked 1 / X / 2 outcome bar with colour-matched percentages. */
.ins-1x2-cell { min-width: 104px; }

.ins-1x2 {
  display: flex;
  width: 100%;
  min-width: 88px;
  height: 9px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(var(--line-rgb), 0.14);
}

.ins-1x2__seg { height: 100%; }
/* Shared 1/X/2 key (also used by the "Panoramica Leghe" doughnut):
   1 = cyan (home), X = slate grey (draw), 2 = green (away). Amber is reserved
   for the cup badge / coverage asterisk, not for an outcome. */
.ins-1x2__seg--home { background: rgba(var(--accent-bright-rgb), 0.85); }
.ins-1x2__seg--draw { background: rgba(var(--line-rgb), 0.5); }
.ins-1x2__seg--away { background: rgba(var(--success-rgb), 0.85); }

.ins-1x2__nums {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.ins-1x2__num--home { color: var(--accent-bright); }
.ins-1x2__num--draw { color: rgba(var(--line-rgb), 0.9); }
.ins-1x2__num--away { color: var(--success); }

/* Compact the 14-column table so it fits the panel width (vertical scroll only).
   Overrides the global `table { min-width: 820px }` and the wide default cell
   padding; numeric cells + headers never wrap, while the Lega name wraps on
   word boundaries (not per-letter) so long names stay readable. */
#league-insights-table {
  min-width: 0;
  font-size: 0.78rem;
  table-layout: auto;
}

#league-insights-table th,
#league-insights-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

#league-insights-table td {
  vertical-align: middle;
}

#league-insights-table th {
  font-size: 0.6rem;
  letter-spacing: 0.03em;
}

#league-insights-table td:first-child {
  white-space: normal;
}

#league-insights-table td:first-child strong {
  overflow-wrap: normal;
  word-break: normal;
}

#league-insights-table .ins-1x2-cell { min-width: 78px; }
#league-insights-table .ins-1x2 { min-width: 66px; }

/* Rows are clickable: open that league's Panoramica Lega. Slightly stronger
   hover than the default row highlight to signal clickability. */
#league-insights-table tbody tr.li-row { cursor: pointer; }
#league-insights-table tbody tr.li-row:hover { background: rgba(var(--accent-bright-rgb), 0.08); }

/* ─── Results ────────────────────────────────────────────────────── */
.result-column { display: grid; }

.result-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 20, 0.85);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.result-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  background: rgba(10, 16, 26, 0.9);
}

.result-group > summary::-webkit-details-marker { display: none; }

.result-group[open] > summary {
  border-bottom: 1px solid var(--line);
}

.result-list {
  padding: 18px;
  gap: 16px;
  max-height: none;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
}

.result-card.candidate {
  border-color: rgba(var(--success-rgb), 0.24);
  background: linear-gradient(160deg, rgba(var(--success-rgb), 0.06), rgba(10, 16, 28, 0.9));
}

.result-card.filtered_out {
  border-color: rgba(var(--warning-rgb), 0.24);
  background: linear-gradient(160deg, rgba(var(--warning-rgb), 0.06), rgba(10, 16, 28, 0.9));
}

.result-card.not_evaluable {
  border-color: rgba(var(--danger-rgb), 0.24);
  background: linear-gradient(160deg, rgba(var(--danger-rgb), 0.06), rgba(10, 16, 28, 0.9));
}

.reason-code {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

.fixture-card.stale,
.stale-banner {
  border-color: rgba(var(--warning-rgb), 0.3);
  background: linear-gradient(160deg, rgba(var(--warning-rgb), 0.05), rgba(10, 16, 28, 0.9));
}

/* ─── Mini Card Title Row & Help Icon ───────────────────────────── */
.mini-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-card-title-row strong {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.mini-card-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(var(--line-rgb), 0.15);
  border: 1px solid rgba(var(--line-rgb), 0.25);
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  transition: background 120ms ease, color 120ms ease;
}

.mini-card:hover .mini-card-help {
  background: rgba(var(--accent-bright-rgb), 0.18);
  color: var(--teal);
}
.mini-card:hover,
.fixture-card:hover,
.result-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

/* ─── Drawer ─────────────────────────────────────────────────────── */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 160ms ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(880px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  background: #0A0F1A;
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.6);
  overscroll-behavior: contain;
  animation: slideInRight 220ms ease;
}

.drawer-header-copy {
  display: grid;
  gap: 5px;
  max-width: 72ch;
}

.drawer-meta { gap: 7px; }

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.96);
  backdrop-filter: blur(8px);
}

.drawer-body {
  overflow: auto;
  padding: 14px 16px 18px;
  gap: 10px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
}

.hidden { display: none !important; }

/* ─── Animations ─────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUpIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.mini-grid > *,
.results-columns > *{
  min-width: 0;
}

/* ─── Summary Grid in Drawer ─────────────────────────────────────── */
.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* ─── Scope dropdown (shared shell, used by the screening league picker) ─ */
.scope-dropdown {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 20, 0.85);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.scope-dropdown[open] {
  border-color: rgba(var(--accent-bright-rgb), 0.2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4), var(--glow-teal);
}

.scope-dropdown-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.scope-dropdown-summary::-webkit-details-marker { display: none; }

.scope-dropdown-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.scope-dropdown-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 120ms ease, border-color 120ms ease;
}

.scope-dropdown[open] .scope-dropdown-caret {
  transform: rotate(-135deg);
  border-color: var(--teal);
}

.scope-dropdown-panel {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(6, 9, 16, 0.9);
}

.scope-dropdown-meta { gap: 7px; }

.scope-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.scope-search-field {
  flex: 1 1 280px;
  display: grid;
  gap: 5px;
}

.scope-search-field input { width: 100%; }

/* ─── Progress Bar ───────────────────────────────────────────────── */
.progress-track {
  position: relative;
  height: 6px;
  background: rgba(var(--line-rgb), 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.progress-fill-warning { background: var(--warning); box-shadow: 0 0 8px rgba(var(--warning-rgb), 0.4); }
.progress-fill-success { background: var(--success); box-shadow: 0 0 8px rgba(var(--success-rgb), 0.4); }
.progress-fill-danger  { background: var(--danger);  box-shadow: 0 0 8px rgba(var(--danger-rgb), 0.4); }
@keyframes progress-indeterminate {
  0%   { left: -35%; width: 35%; }
  60%  { left: 100%; width: 35%; }
  100% { left: 100%; width: 35%; }
}

.progress-fill-indeterminate {
  position: absolute;
  top: 0;
  height: 100%;
  width: 35%;
  border-radius: 99px;
  background: var(--teal);
  box-shadow: 0 0 12px rgba(var(--accent-bright-rgb), 0.5);
  animation: progress-indeterminate 1.6s ease-in-out infinite;
}

/* ─── Spinner ────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Content-area loading overlay (requires parent position: relative) */
.content-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(8, 12, 20, 0.72);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.content-loading-overlay .progress-track {
  width: min(280px, 70%);
}

/* ─── Responsive: 3-column results from medium screens ──────────── */
@media (min-width: 960px) {
  .results-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
  }
}

/* ─── 960px breakpoint ───────────────────────────────────────────── */
@media (max-width: 960px) {
}

@media (max-width: 1240px) {
  .layout {
    width: min(var(--content-max), calc(100% - 56px));
  }
}

@media (max-width: 1024px) {
  .layout {
    width: min(var(--content-max), calc(100% - 40px));
  }

  .mini-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .dashboard-kpi-card:nth-child(odd) {
    border-left: 0;
  }

  .dashboard-kpi-card:nth-child(n + 3) {
    border-top: 1px solid rgba(var(--line-rgb), 0.12);
  }
  .tabs { top: max(8px, env(safe-area-inset-top)); }
}

@media (max-width: 760px) {
  .layout {
    width: min(var(--content-max), calc(100% - 20px));
    gap: 14px;
    padding-top: 20px;
  }

  .panel,
  .drawer-section {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .tabs {
    justify-content: flex-start;
    padding: 6px;
    gap: 4px;
    scroll-padding-inline: 5px;
  }

  .tabs.tabs-panel {
    padding: 6px;
  }

  .tab-button {
    grid-template-columns: 18px minmax(0, auto);
    column-gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .tab-icon,
  .tab-icon svg {
    width: 18px;
    height: 18px;
  }

  .tab-status {
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .scope-toolbar { align-items: stretch; }

  .scope-toolbar .action-row {
    width: 100%;
  }

  .scope-toolbar .action-row .button {
    flex: 1 1 160px;
  }

  .form-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi-card {
    min-height: 104px;
    border-left: 0 !important;
  }

  .dashboard-kpi-card + .dashboard-kpi-card {
    border-top: 1px solid rgba(var(--line-rgb), 0.12);
  }

  .section-actions,
  .action-row {
    align-items: stretch;
  }

  .button {
    width: 100%;
    justify-content: center;
  }

  .tabs {
    justify-content: flex-start;
    padding: 6px;
  }

  table { min-width: 520px; }

  th, td {
    padding: 9px 10px;
    font-size: 0.82rem;
  }

  .table-shell td { max-width: 100%; }

  .drawer-panel { width: 100%; }

  .drawer-header,
  .drawer-body {
    padding-left: 13px;
    padding-right: 13px;
  }
}

/* ─── Professional Workspace Refinements ─────────────────────────── */
body {
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.08), transparent 24%),
    linear-gradient(180deg, #0f1621 0%, #0c1117 38%, #0a0f15 100%);
}

body::before {
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent 24%),
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  opacity: 0.28;
}

.layout {
  /* Gutter scales with viewport so narrow laptop windows (1100–1366) don't
     waste 72px on margins. Capped at 72 for ultra-wide screens; the 760px
     media query below replaces this for mobile widths. */
  width: min(1500px, calc(100% - clamp(24px, 4vw, 72px)));
  gap: 18px;
  padding-top: 28px;
}

.panel {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(17, 24, 36, 0.96), rgba(12, 18, 27, 0.92));
  box-shadow: var(--shadow);
}

.tabs {
  top: max(14px, env(safe-area-inset-top));
  justify-content: flex-start;
  padding: 9px 12px;
  border-radius: 18px;
  background: rgba(9, 13, 22, 0.88);
  box-shadow: 0 8px 24px rgba(4, 10, 20, 0.28), 0 0 0 1px rgba(var(--line-rgb), 0.1);
}

.tab-button {
  padding: 10px 18px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-size: 1.04rem;
  letter-spacing: 0.07em;
  min-height: 54px;
}

.tab-button:hover {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
}

.tab-button.active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.18);
  box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), 0.12), 0 2px 8px rgba(4, 10, 20, 0.2);
}

.section-stack{
  background: linear-gradient(180deg, rgba(18, 25, 37, 0.96), rgba(12, 18, 27, 0.92));
}

label span {
  color: var(--muted-strong);
}

input,
select,
textarea {
  border-color: rgba(var(--line-rgb), 0.18);
  border-radius: 12px;
  background: rgba(10, 15, 24, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

input::placeholder,
textarea::placeholder {
  color: rgba(var(--line-rgb), 0.54);
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  text-transform: none;
}

.button.primary {
  color: #081017;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-color: rgba(var(--accent-rgb), 0.32);
  box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.2);
}

.button.primary:hover {
  border-color: rgba(var(--accent-rgb), 0.36);
  box-shadow: 0 14px 30px rgba(var(--accent-rgb), 0.24);
}

.button.secondary {
  color: var(--ink);
  background: rgba(var(--line-rgb), 0.08);
  border-color: rgba(var(--line-rgb), 0.16);
}

.button.secondary:hover {
  background: rgba(var(--line-rgb), 0.12);
  border-color: rgba(var(--line-rgb), 0.22);
}

.button.danger {
  color: #fff5f5;
  background: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.34);
  box-shadow: 0 12px 28px rgba(var(--danger-rgb), 0.22);
}

.button.danger:hover {
  background: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.4);
  box-shadow: 0 14px 30px rgba(var(--danger-rgb), 0.26);
}

.button.ghost {
  color: var(--ink);
  background: transparent;
  border-color: rgba(var(--line-rgb), 0.14);
}

.button.ghost:hover {
  background: rgba(var(--line-rgb), 0.08);
  border-color: rgba(var(--line-rgb), 0.22);
}
.mini-card,
.fixture-card,
.result-card,
.drawer-section {
  border-color: rgba(var(--line-rgb), 0.12);
  background: linear-gradient(180deg, rgba(16, 23, 35, 0.94), rgba(10, 15, 24, 0.92));
}

.table-shell {
  border-color: rgba(var(--line-rgb), 0.12);
  background: rgba(10, 15, 24, 0.86);
  box-shadow: none;
}

th {
  color: var(--muted-strong);
  background: rgba(14, 20, 31, 0.96);
  border-bottom-color: rgba(var(--line-rgb), 0.12);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

tbody tr:hover {
  background: rgba(var(--accent-rgb), 0.06);
}

.result-group {
  background: rgba(10, 15, 24, 0.84);
  box-shadow: none;
}

.result-group > summary {
  background: rgba(12, 18, 28, 0.9);
}

.result-card.candidate {
  border-left: 3px solid rgba(var(--success-rgb), 0.5);
}

.result-card.filtered_out {
  border-left: 3px solid rgba(var(--warning-rgb), 0.5);
}

.result-card.not_evaluable,
.fixture-card.stale,
.stale-banner {
  border-left: 3px solid rgba(var(--danger-rgb), 0.5);
}

.section-header p,
.empty-state,
.meta-text{
  color: var(--muted-strong);
}

.drawer-panel {
  background: linear-gradient(180deg, rgba(17, 24, 36, 0.98), rgba(10, 15, 24, 0.98));
}

@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes surfaceFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tab-panel.active > .page-shell > * {
  animation: surfaceIn 220ms ease both;
}

@media (max-width: 760px) {
  .layout {
    width: min(1500px, calc(100% - 20px));
  }
}

/* ─── Job Metric Cards ───────────────────────────────────────────── */
.estimate-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 10px;
}

.estimate-stat-card {
  display: grid;
  gap: 4px;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 24, 0.92);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.estimate-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.estimate-stat-card.success { border-color: rgba(var(--success-rgb), 0.22); }
.estimate-stat-card.success::before { background: linear-gradient(90deg, var(--success), transparent); }
.estimate-stat-card.warning { border-color: rgba(var(--warning-rgb), 0.22); }
.estimate-stat-card.warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
.estimate-stat-card.info    { border-color: rgba(var(--accent-bright-rgb), 0.22); }
.estimate-stat-card.info::before    { background: linear-gradient(90deg, var(--teal), transparent); }
.estimate-stat-card.neutral { border-color: var(--line); }
.estimate-stat-card.neutral::before { background: linear-gradient(90deg, var(--muted), transparent); opacity: 0.3; }

.estimate-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.estimate-stat-card.success .estimate-stat-value { color: var(--success); }
.estimate-stat-card.warning .estimate-stat-value { color: var(--warning); }
.estimate-stat-card.info    .estimate-stat-value { color: var(--teal); }

.estimate-stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.2;
}

/* ─── Metric Detail Cards (drawer tab: Metriche) ────────────────── */
.metric-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* ─── Odds context cards (drawer tab: Odds) ─────────────────────────
   Same surface/border language as .metric-detail-card so the drawer stays
   uniform; replaces the old raw <table>. */
.odds-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.odds-ctx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 14px 16px 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(10, 16, 26, 0.92));
  overflow: hidden;
  transition: border-color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}
.odds-ctx-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }

/* Left accent bar tinted by selection (home / away / draw). */
.odds-ctx-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line-strong);
}
.odds-ctx-card.occ-home::before { background: var(--accent); }
.odds-ctx-card.occ-away::before { background: var(--info); }
.odds-ctx-card.occ-draw::before { background: var(--warning); }

.occ-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.occ-metric {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occ-price {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Selection chip (colored dot) + min/max qualifier */
.occ-selrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.occ-selection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
}
.occ-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.occ-home .occ-dot { background: var(--accent); }
.occ-away .occ-dot { background: var(--info); }
.occ-draw .occ-dot { background: var(--warning); }
.occ-qual {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-strong);
  background: rgba(var(--line-rgb), 0.14);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}

.occ-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  font-size: 0.75rem;
}
.occ-book { color: var(--muted-strong); font-weight: 600; }
.occ-sep { color: var(--muted); }
.occ-market { color: var(--muted); }

.occ-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  flex-wrap: wrap;
  min-width: 0;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.occ-matching {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  white-space: nowrap;
}
.occ-matching.is-matched {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(var(--success-rgb), 0.25);
}
.occ-matching.is-unmatched {
  color: var(--muted-strong);
  background: rgba(var(--line-rgb), 0.12);
  border: 1px solid var(--line);
}

.occ-snap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.occ-clock { opacity: 0.7; flex-shrink: 0; }

.metric-detail-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(10, 16, 26, 0.9);
  position: relative;
  padding-left: 18px;
}

.metric-detail-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--line-strong);
}

.metric-detail-card.success::before { background: var(--success); }
.metric-detail-card.warning::before { background: var(--warning); }
.metric-detail-card.danger::before  { background: var(--danger); }
.metric-detail-card.info::before    { background: var(--teal); }
.metric-detail-card.neutral::before { background: var(--muted); }

.mdc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mdc-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mdc-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.mdc-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.67rem;
  color: var(--muted);
  word-break: break-all;
}

.mdc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.mdc-badges .pill-sm { font-size: 0.72rem; }

.mdc-filter-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mdc-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.mdc-op {
  font-size: 0.8rem;
  color: var(--muted);
}

.mdc-threshold {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--muted-strong);
}

.mdc-audit {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  margin-top: 2px;
}

.mdc-audit > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--muted);
  user-select: none;
}

.mdc-audit > summary::-webkit-details-marker { display: none; }
.mdc-audit[open] > summary { color: var(--muted-strong); margin-bottom: 6px; }

/* ─── Audit key-value grid ───────────────────────────────────────── */
.audit-kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 4px 0;
}

.akv-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.67rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 1px;
}

.akv-val {
  font-size: 0.72rem;
  color: var(--muted-strong);
  word-break: break-word;
}

/* ─── pill-sm utility ────────────────────────────────────────────── */
.pill-sm {
  font-size: 0.68rem;
  padding: 2px 7px;
}

/* ─── Result Summary Badges ──────────────────────────────────────── */
#results-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}

.result-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 8px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}

.result-stat-badge.success {
  color: var(--success);
  background: rgba(var(--success-rgb), 0.10);
  border-color: rgba(var(--success-rgb), 0.28);
}

.result-stat-badge.warning {
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.10);
  border-color: rgba(var(--warning-rgb), 0.28);
}

.result-stat-badge.danger {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.10);
  border-color: rgba(var(--danger-rgb), 0.28);
}

.result-stat-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

/* ─── Card Layout Improvements ───────────────────────────────────── */
.result-card,
.fixture-card {
  position: relative;
  padding-left: 20px;
}

.fixture-card.success  { border-left: 3px solid rgba(var(--success-rgb), 0.5); }
.fixture-card.warning  { border-left: 3px solid rgba(var(--warning-rgb), 0.5); }
.fixture-card.danger   { border-left: 3px solid rgba(var(--danger-rgb), 0.5); }
.fixture-card.neutral  { border-left: 3px solid var(--line-strong); }

.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-teams {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.team-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.team-vs {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ─── Fixture/team logos ──────────────────────────────────────────────
   Constrain the provider <img> to a small size. Without an explicit size
   the remote crest/flag renders at its full intrinsic resolution and blows
   the card layout apart. The logo itself is shown clean (no frame); the
   subtle badge background/border is applied ONLY to the initials fallback
   (.logo-missing = no logo URL, .logo-failed = image failed to load). */
.fixture-logo {
  --logo-size: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--logo-size);
  height: var(--logo-size);
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.fixture-logo--sm { --logo-size: 22px; }

.fixture-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.fixture-logo-fallback {
  display: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.fixture-logo.logo-missing,
.fixture-logo.logo-failed {
  background: rgba(var(--line-rgb), 0.12);
  border: 1px solid rgba(var(--line-rgb), 0.18);
}

.fixture-logo.logo-missing .fixture-logo-fallback,
.fixture-logo.logo-failed .fixture-logo-fallback {
  display: inline-flex;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta-kickoff {
  color: var(--muted-strong);
  font-weight: 500;
}

.meta-sep {
  opacity: 0.35;
}

.meta-country {
  opacity: 0.65;
}

.card-metrics-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Strategy1 feed: one grouped fixture card carries a clickable chip per matched
   strategy (code + its ✓/~ counts); each chip opens that strategy's detail. */
.card-strategies-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.strategy-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.22);
  background: rgba(var(--accent-bright-rgb), 0.06);
  color: inherit;
  cursor: pointer;
  transition: border-color var(--motion-fast, 100ms), background var(--motion-fast, 100ms);
}

.strategy-chip:hover,
.strategy-chip:focus-visible {
  border-color: rgba(var(--accent-bright-rgb), 0.5);
  background: rgba(var(--accent-bright-rgb), 0.12);
}

.strategy-chip__code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.strategy-chip__counts {
  display: inline-flex;
  gap: 5px;
}

/* Reason code(s) shown on filtered_out / not_evaluable strategy chips. */
.strategy-chip .chip-reason {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--warning);
  white-space: nowrap;
}

.feed-include-toggle {
  display: inline-flex;
  align-items: stretch;
  cursor: pointer;
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
}

/* Native checkbox visually hidden but kept focusable / clickable. */
.feed-include-toggle__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  accent-color: var(--accent);
  z-index: 1;
}

.feed-include-toggle__pill {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  min-height: 52px;
  border: 1px solid rgba(var(--line-rgb), 0.16);
  border-left-width: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  background-color: rgba(var(--line-rgb), 0.04);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(var(--line-rgb), 0.72);
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.feed-include-toggle__pill::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgba(var(--line-rgb), 0.45);
  background-color: transparent;
  transition: background-color 150ms ease, border-color 150ms ease;
  flex-shrink: 0;
}

.feed-include-toggle:hover .feed-include-toggle__pill {
  background-color: rgba(var(--line-rgb), 0.08);
  border-color: rgba(var(--line-rgb), 0.24);
  color: var(--ink);
}

.feed-include-toggle__input:checked + .feed-include-toggle__pill {
  background-color: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.36);
  color: var(--accent);
}

.feed-include-toggle__input:checked + .feed-include-toggle__pill::before {
  background-color: var(--accent);
  border-color: var(--accent);
}

.feed-include-toggle__input:focus-visible + .feed-include-toggle__pill {
  outline: 2px solid rgba(var(--accent-bright-rgb), 0.4);
  outline-offset: 1px;
}

/* Action-row dentro le card: separazione visiva */
.fixture-card .action-row,
.result-card .action-row {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  gap: 8px;
}

/* Tabelle nel drawer: scroll orizzontale */
.drawer-section .table-shell {
  overflow-x: auto;
}

.drawer-section table {
  min-width: 520px;
}

/* ─── Drawer più largo su schermi ampi ───────────────────────────── */
@media (min-width: 1200px) {
  .drawer-panel {
    width: min(960px, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }

  .content-loading-overlay,
  .drawer-panel,
  .toast,
  .toast--removing {
    animation: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   ANALYTICS PANEL
   ═══════════════════════════════════════════════════════════════════ */

.analytics-page-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* ─── Selector bar ─────────────────────────────────────────────────── */
.analytics-selector-bar {
  border-color: rgba(var(--accent-bright-rgb), 0.18);
  background: linear-gradient(160deg, rgba(var(--accent-bright-rgb), 0.05), var(--panel));
}

.analytics-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 32px;
  padding-top: 4px;
}

.analytics-fixture-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--teal);
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  max-width: none;
}

.analytics-league-selector {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  min-width: min(320px, 100%);
  flex: 1 1 320px;
}

/* The load button has no label row above it; offset it down by one label line
   so it sits on the same control line as the input and the scope selects. */
.analytics-league-selector > .button {
  margin-top: 1.55rem;
}

.analytics-league-selector .inline-field {
  min-width: min(240px, 100%);
  flex: 1 1 280px;
}

.analytics-league-search-status[data-tone="success"] {
  color: var(--accent);
}

.analytics-league-search-status[data-tone="warning"] {
  color: var(--warning);
}

.analytics-league-search-status[data-tone="danger"] {
  color: var(--danger);
}

/* ─── Chart panels ─────────────────────────────────────────────────── */
.chart-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(10, 16, 28, 0.88);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-width: 0;
  overflow: hidden;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  height: clamp(230px, 28vw, 360px);
  min-height: clamp(230px, 28vw, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chart-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: none;
}

.chart-canvas-wide {
  height: clamp(250px, 26vw, 330px);
  min-height: clamp(250px, 26vw, 330px);
}

.chart-canvas-wide canvas {
  max-height: none;
}

.chart-canvas-tall {
  min-height: 320px;
}

.chart-canvas-tall canvas {
  max-height: none;
}

/* League overview needs variable height set by JS — remove the cap */
#panel-league-overview .chart-canvas-tall {
  max-height: none;
  overflow: visible;
}

#panel-league-overview .chart-canvas-tall canvas {
  max-height: none;
}

.chart-empty {
  margin: 0;
  text-align: center;
  padding: 20px 0 8px;
  overflow-wrap: anywhere;
}

/* ─── Top grid: radar + timeline side by side ──────────────────────── */
.analytics-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.analytics-top-grid > *,
.analytics-dist-grid > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .analytics-top-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Panoramica Leghe (League Insights overview) ──────────────────── */
.li-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
}

.li-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.5);
}

.li-kpi-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.li-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.leagues-overview-charts {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-3);
}

.leagues-overview-charts > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .leagues-overview-charts {
    grid-template-columns: 1fr;
  }
}

/* ─── Score distribution sub-grid ─────────────────────────────────── */
.analytics-dist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
  min-width: 0;
}

@media (max-width: 700px) {
  .analytics-dist-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Match-stats sub-grid: themed stat cards (auto-fit, wraps cleanly) ── */
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
  align-items: start;
  min-width: 0;
}

.analytics-stats-grid > * {
  min-width: 0;
}

/* ─── Sub-view switch (Lega / Squadra) ────────────────────────────── */
.analytics-subview-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.analytics-subview-tabs .button {
  padding: 6px 18px;
  font-size: 0.85rem;
  touch-action: manipulation;
}

.analytics-subview-tabs .button.active,
.analytics-context-tabs .button.active {
  background: rgba(var(--accent-bright-rgb), 0.15);
  border-color: var(--teal);
  color: var(--teal);
}

.analytics-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.analytics-view[hidden] {
  display: none;
}

.analytics-controls-panel {
  border-color: rgba(var(--accent-bright-rgb), 0.18);
}

/* ─── Season scope selector (League Insights) ─────────────────────── */
.analytics-season-selector {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px 24px;
  min-width: min(240px, 100%);
  flex: 1 1 360px;
}

/* Two scope controls (Stagione + Tipo) sit side by side with a gap, and wrap
   to stack on narrow widths instead of fighting for the same 100% width. */
.analytics-season-selector .inline-field {
  flex: 1 1 160px;
  min-width: 150px;
}

/* ─── Team explorer controls ──────────────────────────────────────── */
.analytics-team-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

.analytics-team-controls .inline-field {
  min-width: min(240px, 100%);
  flex: 1 1 240px;
}

.analytics-team-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.analytics-context-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.analytics-context-tabs .eyebrow {
  margin-right: 4px;
}

.analytics-context-tabs .button {
  padding: 4px 12px;
  font-size: 0.8rem;
  touch-action: manipulation;
}

/* ─── Loading overlay for charts ──────────────────────────────────── */
.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 28, 0.7);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  backdrop-filter: blur(4px);
}

#panel-team-profile .chart-canvas-wrap {
  height: clamp(260px, 30vw, 380px);
  min-height: clamp(260px, 30vw, 380px);
}

#panel-goal-timeline .chart-canvas-wrap {
  height: clamp(240px, 24vw, 320px);
  min-height: clamp(240px, 24vw, 320px);
}

#panel-score-dist .chart-canvas-wrap {
  height: clamp(220px, 22vw, 300px);
  min-height: clamp(220px, 22vw, 300px);
}

#panel-analytics,
#panel-league-overview {
  scroll-margin-top: 18px;
}

@media (max-width: 760px) {
  .analytics-controls {
    gap: 14px;
  }

  .analytics-league-selector {
    flex-basis: 100%;
  }

  .chart-canvas-wrap {
    height: clamp(220px, 62vw, 300px);
    min-height: clamp(220px, 62vw, 300px);
  }

  .chart-canvas-wide {
    height: clamp(240px, 68vw, 320px);
    min-height: clamp(240px, 68vw, 320px);
  }

  .chart-canvas-tall {
    min-height: 280px;
  }
}

/* ─── Toast Notifications ────────────────────────────────────────── */
@keyframes toastIn {
  from { transform: translateX(calc(100% + 24px)); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; max-height: 140px; margin-bottom: 8px; }
  to   { transform: translateX(calc(100% + 24px)); opacity: 0; max-height: 0; margin-bottom: 0; }
}

@keyframes toastProgressShrink {
  from { width: 100%; }
  to   { width: 0%; }
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(400px, calc(100vw - 48px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px 15px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  border-left-width: 3px;
  background: rgba(14, 20, 32, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
  pointer-events: auto;
  cursor: default;
  animation: toastIn 260ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
  position: relative;
  transition: box-shadow 120ms ease;
}

.toast:hover {
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.65), 0 1px 0 rgba(255,255,255,0.06) inset;
}

.toast.toast--removing {
  animation: toastOut 280ms ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

.toast-icon svg {
  width: 12px;
  height: 12px;
  display: block;
}

.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--ink);
}

.toast-msg {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}

.toast-title + .toast-msg {
  color: var(--ink-dim, rgba(var(--line-rgb),0.8));
}

.toast-action {
  margin-top: 6px;
  background: none;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 120ms ease;
  min-height: unset;
  width: fit-content;
}

.toast-action:hover { opacity: 1; }

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 1px 2px;
  font-size: 1rem;
  line-height: 1;
  min-height: unset;
  width: auto;
  transition: color 120ms ease;
  margin-top: -1px;
}

.toast-close:hover { color: var(--ink); }

/* ── Variants ── */
/* Left-accent bar per type reinforces the at-a-glance priority of the
   bottom-right toasts (mirrors the result-card accent language). */
.toast--info {
  border-color: rgba(var(--accent-rgb), 0.22);
  border-left-color: rgba(var(--accent-bright-rgb), 0.85);
}
.toast--info .toast-icon {
  background: var(--teal-soft);
  color: var(--teal);
}
.toast--info .toast-title { color: var(--teal); }
.toast--info .toast-action { color: var(--teal); }

.toast--success {
  border-color: rgba(var(--success-rgb), 0.25);
  border-left-color: rgba(var(--success-rgb), 0.85);
}
.toast--success .toast-icon {
  background: var(--success-soft);
  color: var(--success);
}
.toast--success .toast-title { color: var(--success); }
.toast--success .toast-action { color: var(--success); }

.toast--error {
  border-color: rgba(var(--danger-rgb), 0.32);
  border-left-color: rgba(var(--danger-rgb), 0.9);
}
.toast--error .toast-icon {
  background: var(--danger-soft);
  color: var(--danger);
}
.toast--error .toast-title { color: var(--danger); }
.toast--error .toast-action { color: var(--danger); }

.toast--warning {
  border-color: rgba(var(--warning-rgb), 0.28);
  border-left-color: rgba(var(--warning-rgb), 0.85);
}
.toast--warning .toast-icon {
  background: var(--warning-soft);
  color: var(--warning);
}
.toast--warning .toast-title { color: var(--warning); }
.toast--warning .toast-action { color: var(--warning); }

.toast--signal {
  border-color: rgba(var(--accent-rgb), 0.22);
  border-left-color: rgba(var(--accent-bright-rgb), 0.85);
}
.toast--signal .toast-icon {
  background: var(--teal-soft);
  color: var(--teal);
}
.toast--signal .toast-title { color: var(--teal); }
.toast--signal .toast-action { color: var(--teal); }

/* ── Progress bar ── */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  width: 100%;
  animation: toastProgressShrink linear forwards;
  animation-play-state: running;
}

.toast--info    .toast-progress { background: var(--teal);    opacity: 0.45; }
.toast--success .toast-progress { background: var(--success); opacity: 0.45; }
.toast--error   .toast-progress { background: var(--danger);  opacity: 0.45; }
.toast--warning .toast-progress { background: var(--warning); opacity: 0.45; }

.toast:hover .toast-progress {
  animation-play-state: paused;
}

/* ─── Past Date Warning ──────────────────────────────────────────── */
.past-date-warning {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--warning);
  font-weight: 500;
}

/* ─── Tab Count Badges ───────────────────────────────────────────── */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-width: 18px;
  height: 17px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-rgb), 0.15);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.tab-button.active .tab-badge {
  background: var(--accent);
  border-color: var(--accent);
  color: #081017;
}

/* ─── Preset Callout ─────────────────────────────────────────────── */
/* ─── Threshold Operator Code ───────────────────────────────────── */
.threshold-op {
  display: inline-flex;
  align-items: center;
  color: rgba(var(--accent-rgb), 0.65);
}

.threshold-op .op-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Filter Active Indicator ────────────────────────────────────── */
input.filter-active,
select.filter-active {
  border-color: rgba(var(--accent-rgb), 0.35) !important;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.08) !important;
}

@media (max-width: 1120px) {
}

@media (max-width: 760px) {

}

/* ─── Shared Full Detail Overlay ────────────────────────────────── */
.detail-overlay-backdrop {
  background: rgba(2, 5, 10, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.detail-overlay-panel {
  position: relative;
  top: auto;
  right: auto;
  width: min(1440px, calc(100% - 24px));
  height: min(calc(100vh - 24px), 1100px);
  margin: 12px auto;
  border: 1px solid rgba(var(--line-rgb), 0.12);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(14, 21, 34, 0.98), rgba(8, 12, 20, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
  animation: fadeUpIn 180ms ease;
}

.detail-overlay-header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(var(--line-rgb), 0.08);
  background: rgba(8, 12, 20, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.detail-overlay-copy {
  display: grid;
  gap: 6px;
  max-width: 90ch;
}

.detail-overlay-copy h2 {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(1.25rem, 1.2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
}

.detail-overlay-body {
  display: block;
  overflow: auto;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(12, 18, 30, 0.94), rgba(8, 12, 20, 0.98));
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.18) transparent;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  min-height: 100%;
}

.detail-layout.without-subnav {
  grid-template-columns: 1fr;
}

.detail-subnav-shell {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 22px 18px 24px;
  border-right: 1px solid rgba(var(--line-rgb), 0.08);
  background:
    linear-gradient(180deg, rgba(12, 18, 30, 0.98), rgba(10, 16, 26, 0.94));
}

.detail-subnav-kicker {
  color: var(--muted);
}

.detail-subnav {
  display: grid;
  gap: 8px;
}

.detail-subnav-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--line-rgb), 0.08);
  border-radius: 14px;
  background: rgba(8, 12, 20, 0.45);
  color: var(--muted-strong);
  cursor: pointer;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.detail-subnav-button:hover,
.detail-subnav-button:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--ink);
}

.detail-subnav-button.active {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.detail-content {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 22px 22px 26px;
}

.detail-intro {
  gap: 16px;
  padding: 22px 24px;
  border-color: rgba(var(--accent-rgb), 0.18);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(10, 16, 26, 0.94) 38%),
    rgba(10, 16, 26, 0.94);
}

.detail-intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.detail-intro-copy {
  display: grid;
  gap: 8px;
  max-width: 74ch;
}

.detail-intro-copy h3 {
  font-family: "DM Sans", sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-transform: none;
}

.detail-intro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: flex-start;
}

.detail-section {
  gap: 16px;
  border-radius: 20px;
  scroll-margin-top: 24px;
}

.detail-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(var(--line-rgb), 0.08);
}

.detail-section-copy {
  display: grid;
  gap: 6px;
  max-width: 78ch;
}

.detail-section-copy h3 {
  font-family: "DM Sans", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.28;
  text-transform: none;
}

.detail-section-body {
  display: grid;
  gap: 14px;
}

.detail-section-meta {
  justify-content: flex-end;
}

.detail-stack {
  gap: 14px;
}

/* ─── Log Analyzer ─────────────────────────────────────────────── */
.clm-page-shell {
  gap: 16px;
}

.clm-toolbar,
.clm-technical-panel {
  border-color: rgba(var(--line-rgb), 0.16);
  background: rgba(8, 14, 22, 0.92);
}

.clm-controls,
.clm-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.clm-filters {
  grid-template-columns: 140px repeat(3, minmax(160px, 1fr)) auto;
}

.clm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  border: 1px solid rgba(var(--line-rgb), 0.12);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(var(--line-rgb), 0.12);
}

.clm-kpi-card {
  grid-template-columns: minmax(0, 1fr);
  min-height: 116px;
  padding: 18px 20px;
  align-content: center;
  background: rgba(6, 11, 19, 0.82);
}

.clm-kpi-card.tone-danger {
  border-top: 2px solid rgba(var(--danger-rgb), 0.9);
}

.clm-kpi-card.tone-warning {
  border-top: 2px solid rgba(var(--warning-rgb), 0.9);
}

.clm-kpi-card.tone-success {
  border-top: 2px solid rgba(var(--success-rgb), 0.82);
}

.clm-kpi-card + .clm-kpi-card {
  border-left: 0;
}

.clm-kpi-card .dashboard-kpi-copy {
  gap: 6px;
}

.clm-kpi-card .dashboard-kpi-copy strong {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(1.7rem, 2.15vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.clm-kpi-card .dashboard-kpi-copy small {
  max-width: 34ch;
  font-size: 0.86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.clm-alert-list {
  display: grid;
  gap: 10px;
}

/* ─── Alert header (breakdown contatori) ─────────────────────────── */
.la-alerts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.la-alerts-header-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

/* ─── Alert card base (sostituisce clm-alert-card) ─────── */
.la-alert-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid rgba(148, 163, 184, 0.5);
  border-radius: var(--radius-md);
  background: rgba(10, 16, 26, 0.76);
}

.la-alert-card.tone-danger {
  border-left-color: rgba(var(--danger-rgb), 0.95);
  background: rgba(var(--danger-rgb), 0.16);
}

.la-alert-card.tone-warning {
  border-left-color: rgba(var(--warning-rgb), 0.95);
  background: rgba(var(--warning-rgb), 0.14);
}

.la-alert-card.tone-success {
  border-left-color: rgba(var(--success-rgb), 0.84);
  background: rgba(var(--success-rgb), 0.14);
}

/* Header riga: label + badge durata/contatore */
.la-alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.la-alert-label {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Spiegazione contestuale — tono più basso, leggibile */
.la-alert-explain {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Griglia campi chiave-valore strutturati */
.la-alert-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.la-alert-kv {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 80px;
}

.la-alert-kv span {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.la-alert-kv strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Overshoot percentuale dentro il badge (es. "+1432%") */
.la-alert-overshoot {
  opacity: 0.75;
  font-size: 0.85em;
}

/* Fallback per messaggi raw (errori senza campi strutturati) */
.la-alert-detail-raw {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Riga meta: timestamp · source */
.la-alert-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.clm-technical-panel {
  padding: 0;
}

.clm-technical-panel > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.clm-technical-panel > summary::-webkit-details-marker {
  display: none;
}

.clm-technical-panel > summary::marker {
  content: "";
}

.clm-technical-panel > summary span {
  color: var(--ink);
  font-weight: 700;
}

.clm-technical-panel > summary small {
  color: var(--muted-strong);
  font-size: 0.78rem;
  text-align: right;
}

.clm-technical-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.la-events-count {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.clm-raw-block {
  padding: 16px 18px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.clm-table-shell {
  max-height: 620px;
  overflow-y: auto;
}

.clm-message {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
}

.clm-error {
  display: block;
  margin-bottom: 5px;
  color: rgba(var(--danger-rgb), 0.95);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ─── Last cycle panel ─────────────────────────────────────────────── */
.clm-last-cycle {
  display: grid;
  gap: 16px;
}

/* Nuova headline ciclo */
.la-cycle-headline {
  display: grid;
  gap: 12px;
}

.la-cycle-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.la-cycle-date {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.la-cycle-result-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.la-cycle-big-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.la-cycle-big-stat strong {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1;
  color: var(--ink);
}

.la-cycle-big-cand strong {
  color: var(--success);
}

.la-cycle-big-stat span {
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.la-cycle-small-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.la-cycle-small-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.la-cycle-small-stat span {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
}

.la-cycle-small-stat small {
  color: var(--muted-strong);
  font-size: 0.72rem;
}

.la-cycle-small-stat.la-muted span {
  color: var(--muted-strong);
  font-weight: 500;
}

/* Barra risultato candidati/filtrati/non valutabili */
.la-cycle-result-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(var(--line-rgb), 0.08);
}

.la-crb-cand { display: block; height: 100%; background: var(--success); }
.la-crb-filt { display: block; height: 100%; background: rgba(148, 163, 184, 0.45); }
.la-crb-noteval { display: block; height: 100%; background: var(--warning); opacity: 0.7; }

/* Strategy1 detail row */
.la-cycle-s1-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 22, 0.55);
  border: 1px solid var(--line);
}

.la-cycle-s1-label {
  color: var(--muted-strong);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-right: 4px;
}

.la-cycle-s1-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(var(--line-rgb), 0.07);
  border: 1px solid var(--line);
}

.la-cycle-s1-chip span {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.la-cycle-s1-chip strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

/* Phase card tweaks */
.la-phase-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  font-weight: 400;
}

.la-phase-pct {
  color: var(--muted-strong);
  font-size: 0.8em;
  margin-left: 3px;
}

.la-phase-run-note {
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(var(--line-rgb), 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  line-height: 1.4;
}

/* Evaluations section */
.la-evaluations {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 14, 22, 0.7);
}

.la-evaluations-header {
  display: grid;
  gap: 3px;
}

.la-evaluations-title {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.la-evaluations-sub {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.la-evaluations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.la-eval-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(var(--line-rgb), 0.05);
  border: 1px solid var(--line);
  min-width: 0;
}

.la-eval-stat.tone-success { border-color: rgba(var(--success-rgb), 0.22); background: rgba(var(--success-rgb), 0.12); }
.la-eval-stat.tone-warning { border-color: rgba(var(--warning-rgb), 0.22); background: rgba(var(--warning-rgb), 0.12); }
.la-eval-stat.tone-danger  { border-color: rgba(var(--danger-rgb), 0.22);  background: rgba(var(--danger-rgb), 0.12); }

.la-eval-stat strong {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink);
}

.la-eval-stat span {
  color: var(--muted-strong);
  font-size: 0.72rem;
  line-height: 1.3;
}

.la-eval-stat small {
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  line-height: 1.3;
  margin-top: 1px;
}

.clm-chip.is-duration {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.clm-phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.clm-phase-card {
  --phase-accent: rgba(148, 163, 184, 0.7);
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--phase-accent);
  border-radius: var(--radius-md);
  background: rgba(10, 16, 26, 0.78);
  min-width: 0;
}

.clm-phase-card.tone-success {
  --phase-accent: var(--success);
}

.clm-phase-card.tone-warning {
  --phase-accent: var(--warning);
}

.clm-phase-card.is-missing {
  opacity: 0.55;
}

.clm-phase-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.clm-phase-card header strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.clm-phase-card header small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.clm-phase-counts {
  display: grid;
  gap: 6px;
}

.clm-phase-cand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.clm-phase-cand strong {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink);
}

.clm-phase-cand span {
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.clm-phase-empty {
  font-size: 1.4rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.clm-stack-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(var(--line-rgb), 0.08);
}

.clm-stack-bar .seg {
  display: block;
  height: 100%;
}

.clm-stack-bar .seg-cand {
  background: var(--success);
}

.clm-stack-bar .seg-filt {
  background: rgba(148, 163, 184, 0.55);
}

.clm-stack-bar .seg-noteval {
  background: var(--warning);
}

.clm-phase-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 0;
  font-size: 0.78rem;
}

.clm-phase-detail > div {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.clm-phase-detail dt {
  color: var(--muted-strong);
  font-weight: 400;
}

.clm-phase-detail dd {
  color: var(--ink);
  margin: 0;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* ─── Cycles card list ──────────────────────────────────────────────── */
.clm-cycles-table {
  max-height: 560px;
  overflow-y: auto;
}

.la-cycle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.la-cycle-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-left: 3px solid rgba(148, 163, 184, 0.25);
}

.la-cycle-card.tone-success {
  border-left-color: var(--success);
}

.la-cycle-card.tone-warning,
.la-cycle-card.is-incomplete {
  border-left-color: var(--warning);
  background: rgba(var(--warning-rgb), 0.03);
}

.la-cycle-card-incomplete {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.12);
  border: 1px solid rgba(var(--warning-rgb), 0.3);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  align-self: center;
  letter-spacing: 0.02em;
}

.la-cycle-card-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.la-cycle-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.la-cycle-card-time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted-strong);
  white-space: nowrap;
}

.la-cycle-card-target {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 600;
}

.la-cycle-card-stats {
  display: flex;
  gap: 20px;
  flex: 1;
}

.la-cycle-card-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.la-cycle-card-stat strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.1;
}

.la-cycle-card-stat.is-primary strong {
  font-size: 1.1rem;
}

.la-cycle-card-stat.is-primary.tone-success strong {
  color: var(--success);
}

.la-cycle-card-stat.is-primary.tone-warning strong {
  color: var(--warning);
}

.la-cycle-card-stat small {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.la-cycle-card-s1 {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  align-self: center;
}

.clm-raw-header {
  margin-top: 12px;
}

@media (max-width: 1180px) {
  .clm-controls,
  .clm-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clm-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .clm-kpi-card:nth-child(4) {
    border-left: 0;
  }

}

@media (max-width: 760px) {
  .clm-controls,
  .clm-filters,
  .clm-phase-grid {
    grid-template-columns: 1fr;
  }

  .clm-technical-panel > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .clm-technical-panel > summary small {
    text-align: left;
  }

  .clm-kpis {
    grid-template-columns: 1fr;
  }

  .clm-kpi-card + .clm-kpi-card {
    border-left: 0;
    border-top: 1px solid rgba(var(--line-rgb), 0.12);
  }
}

/* ─── Log Analyzer: KPI value row with badges ──────────────────────── */
.la-kpi-value-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(1.7rem, 2.15vw, 2.35rem);
  line-height: 1.08;
  color: var(--ink);
}

.la-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
}

.la-badge-success {
  background: rgba(var(--success-rgb), 0.42);
  color: rgba(var(--success-rgb), 0.95);
  border: 1px solid rgba(var(--success-rgb), 0.28);
}

.la-badge-warning {
  background: rgba(var(--warning-rgb), 0.36);
  color: rgba(var(--warning-rgb), 0.95);
  border: 1px solid rgba(var(--warning-rgb), 0.28);
}

.la-badge-danger {
  background: rgba(var(--danger-rgb), 0.38);
  color: rgba(var(--danger-rgb), 0.95);
  border: 1px solid rgba(var(--danger-rgb), 0.28);
}

.la-badge-neutral {
  background: rgba(30, 41, 59, 0.6);
  color: var(--muted-strong);
  border: 1px solid var(--line);
}

.la-badge-delta {
  font-size: 0.78rem;
  align-self: center;
}

/* ─── Event family badges (LogEvent.* stable IDs grouped by prefix) ──── */
.la-event-badge {
  border-style: solid;
  border-width: 1px;
}
.la-event-fam-http      { background: rgba(30, 64, 175, 0.32);  color: rgba(147, 197, 253, 0.96); border-color: rgba(59, 130, 246, 0.30); }
.la-event-fam-api       { background: rgba(91, 33, 182, 0.32);  color: rgba(196, 181, 253, 0.96); border-color: rgba(139, 92, 246, 0.30); }
.la-event-fam-screening { background: rgba(14, 116, 144, 0.32); color: rgba(125, 211, 252, 0.96); border-color: rgba(14, 165, 233, 0.30); }
.la-event-fam-evaluation{ background: rgba(13, 148, 136, 0.28); color: rgba(94, 234, 212, 0.96);  border-color: rgba(20, 184, 166, 0.30); }
.la-event-fam-refresh   { background: rgba(var(--warning-rgb), 0.32);  color: rgba(var(--warning-rgb), 0.96);  border-color: rgba(var(--warning-rgb), 0.30); }
.la-event-fam-sync      { background: rgba(67, 56, 202, 0.30);  color: rgba(165, 180, 252, 0.96); border-color: rgba(99, 102, 241, 0.30); }
.la-event-fam-job       { background: rgba(15, 118, 110, 0.30); color: rgba(110, 231, 183, 0.96); border-color: rgba(16, 185, 129, 0.30); }
.la-event-fam-runtime   { background: rgba(75, 85, 99, 0.40);   color: rgba(229, 231, 235, 0.96); border-color: rgba(107, 114, 128, 0.30); }
.la-event-fam-other     { background: rgba(30, 41, 59, 0.6);    color: var(--muted-strong);        border-color: var(--line); }

/* ─── Event row: clickable filter chips + duration chip + details ────── */
.la-evrow-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  margin-right: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.55);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
}
.la-evrow-chip:hover {
  border-color: rgba(96, 165, 250, 0.55);
  color: rgba(191, 219, 254, 0.95);
}
.la-evrow-meta {
  display: inline-block;
  margin-right: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.la-evrow-msg-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.la-evrow-duration {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
}
.la-evrow-duration-muted   { background: rgba(30, 41, 59, 0.55); color: var(--muted); }
.la-evrow-duration-neutral { background: rgba(30, 41, 59, 0.7);  color: var(--muted-strong); }
.la-evrow-duration-warning { background: rgba(var(--warning-rgb), 0.42); color: rgba(var(--warning-rgb), 0.95); }
.la-evrow-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  padding: 0 4px;
}
.la-evrow-toggle:hover { color: var(--ink); border-color: var(--line); border-radius: 4px; }
.la-evrow-toggle.is-empty { cursor: default; color: var(--line); }
.la-evrow-toggle.is-empty:hover { color: var(--line); border-color: transparent; }
.la-evrow.is-expanded { background: rgba(15, 23, 42, 0.35); }
.la-evrow-details {
  padding: 10px 12px 14px;
  background: rgba(15, 23, 42, 0.25);
}
.la-evrow-kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 14px;
  margin: 0;
}
.la-evrow-kv-item {
  display: flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.la-evrow-kv-item dt {
  color: var(--muted);
  flex-shrink: 0;
}
.la-evrow-kv-item dd {
  margin: 0;
  color: var(--muted-strong);
  overflow-wrap: anywhere;
}
.la-evrow-tb {
  margin-top: 10px;
}
.la-evrow-tb summary {
  cursor: pointer;
  color: rgba(var(--danger-rgb), 0.95);
  font-size: 0.75rem;
}
.la-evrow-tb pre {
  margin: 6px 0 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(var(--danger-rgb), 0.40);
  border-radius: 6px;
  color: rgba(var(--danger-rgb), 0.95);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ─── Pannello "Efficienza Screening" ───────────────────────────────────── */
.clm-efficiency-panel { margin-top: 14px; }
.la-eff-grid {
  display: grid;
  gap: 14px;
}
.la-eff-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.la-eff-headline-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.la-eff-kind {
  background: rgba(14, 116, 144, 0.35);
  color: rgba(125, 211, 252, 0.96);
  border: 1px solid rgba(14, 165, 233, 0.40);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}
.la-eff-target {
  font-family: var(--font-mono);
  color: var(--muted-strong);
  font-size: 0.82rem;
}
.la-eff-preset {
  background: rgba(91, 33, 182, 0.30);
  color: rgba(196, 181, 253, 0.96);
  border: 1px solid rgba(139, 92, 246, 0.30);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.la-eff-time { color: var(--muted); font-size: 0.78rem; }

.la-eff-headline-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.la-eff-stat {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 8px;
  min-width: 92px;
}
.la-eff-stat strong { font-size: 1.15rem; color: var(--ink); }
.la-eff-stat small { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.la-eff-stat.tone-success strong { color: rgba(var(--success-rgb), 0.96); }
.la-eff-stat.tone-warning strong { color: rgba(var(--warning-rgb), 0.96); }

.la-eff-section h4 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.la-eff-section-desc {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.la-eff-phasebars { display: grid; gap: 4px; }
.la-eff-phasebar {
  display: grid;
  grid-template-columns: 200px 1fr 80px;
  gap: 10px;
  align-items: center;
  font-size: 0.78rem;
}
.la-eff-phasebar-label {
  color: var(--muted-strong);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.la-eff-phasebar-track {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.la-eff-phasebar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.85), rgba(14, 165, 233, 0.85));
  border-radius: 4px;
}
.la-eff-phasebar-value {
  text-align: right;
  color: var(--muted);
  font-family: var(--font-mono);
}

.la-eff-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.la-eff-card {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.la-eff-card h4 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-strong);
}
.la-eff-card dl { margin: 0; display: grid; gap: 3px; }
.la-eff-card dl > div { display: flex; justify-content: space-between; gap: 8px; font-size: 0.78rem; }
.la-eff-card dl dt { color: var(--muted); }
.la-eff-card dl dd { margin: 0; color: var(--ink); font-family: var(--font-mono); }
.la-eff-bad { color: rgba(var(--danger-rgb), 0.95); }

.la-eff-endpoints {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.la-eff-endpoints li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 2px 0;
  border-top: 1px solid rgba(30, 41, 59, 0.5);
}
.la-eff-endpoints li:first-child { border-top: none; }
.la-eff-ep-name { color: var(--ink); }
.la-eff-ep-stats { color: var(--muted); }

.la-eff-topslow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}
.la-eff-topslow li {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
}
.la-eff-topslow-dur {
  font-family: var(--font-mono);
  color: rgba(var(--warning-rgb), 0.95);
  min-width: 70px;
}
.la-eff-topslow-meta { color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; }
.la-eff-outcome {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-family: var(--font-mono);
}
.la-eff-outcome-candidate    { background: rgba(var(--success-rgb), 0.40); color: rgba(var(--success-rgb), 0.95); }
.la-eff-outcome-filtered_out { background: rgba(30, 41, 59, 0.55); color: var(--muted-strong); }
.la-eff-outcome-not_evaluable{ background: rgba(var(--warning-rgb), 0.40); color: rgba(var(--warning-rgb), 0.95); }

/* ─── Log Analyzer: screening health diagnostics surface ─────────────── */
.clm-screening-health {
  display: block;
}
.la-health-card {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.la-health-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.la-health-card-header h4 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.la-health-card-header time {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}
.la-health-status-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
}
.la-health-status-bar span {
  display: block;
  height: 100%;
  transition: width 0.2s ease;
}
.la-health-status-exact { background: var(--success); }
.la-health-status-proxy { background: var(--info); }
.la-health-status-unavailable { background: var(--warning); }
.la-health-status-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--muted);
  margin-bottom: 12px;
}
.la-health-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.la-health-legend-item strong {
  color: var(--ink);
  font-weight: 600;
}
.la-health-legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--muted-strong);
}
.la-health-legend-item.tone-success::before { background: var(--success); }
.la-health-legend-item.tone-info::before { background: var(--info); }
.la-health-legend-item.tone-warning::before { background: var(--warning); }
.la-health-section {
  margin-top: 12px;
}
.la-health-section h4 {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.la-health-reason-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.la-health-reason {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
}
.la-health-reason-label {
  font-family: var(--font-mono);
  color: var(--muted-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.la-health-reason-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.la-health-reason-bar > span {
  display: block;
  height: 100%;
}
.la-health-reason.warning .la-health-reason-bar > span { background: var(--warning); }
.la-health-reason.info .la-health-reason-bar > span { background: var(--info); }
.la-health-reason.neutral .la-health-reason-bar > span { background: rgba(148, 163, 184, 0.7); }
.la-health-reason-count {
  font-family: var(--font-mono);
  color: var(--muted-strong);
  font-size: 0.78rem;
}
.la-health-metric-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.la-health-metric-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: baseline;
  font-size: 0.78rem;
}
.la-health-metric-list li strong {
  font-family: var(--font-mono);
  color: var(--muted-strong);
}
.la-health-metric-count {
  font-family: var(--font-mono);
  color: var(--muted);
}
.la-health-metric-count strong {
  color: var(--warning);
  font-weight: 600;
}
.la-health-metric-reasons {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 1px;
}
.la-health-reason-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--muted);
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.la-health-reason-tag strong { color: var(--muted-strong); font-weight: 600; }
.la-health-reason-tag.warning {
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.10);
  border-color: rgba(var(--warning-rgb), 0.20);
}
.la-health-reason-tag.warning strong { color: var(--warning); }
.la-health-reason-tag.info {
  color: var(--info);
  background: rgba(var(--info-rgb), 0.10);
  border-color: rgba(var(--info-rgb), 0.20);
}
.la-health-reason-tag.info strong { color: var(--info); }

.la-cycle-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.lay-match-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) 112px;
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid rgba(var(--line-rgb), 0.12);
  border-radius: 14px;
  background: rgba(8, 12, 20, 0.44);
}

.lay-match-main {
  display: grid;
  gap: 8px;
  align-content: center;
}

.lay-match-main h3 {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-size: 1.18rem;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}

.lay-match-main h3 span {
  color: var(--muted);
  font-weight: 600;
}

.lay-match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.86rem;
}

.lay-match-meta > * {
  padding: 5px 8px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: var(--radius-pill);
  background: rgba(12, 18, 30, 0.6);
}

.lay-odds-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lay-odds-strip div,
.lay-stat {
  display: grid;
  gap: 4px;
  align-content: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: 10px;
  background: rgba(12, 18, 30, 0.66);
}

.lay-odds-strip span,
.lay-stat span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lay-odds-strip strong,
.lay-stat strong {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.1;
}

.lay-score-gauge {
  --score-color: var(--success);
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(8, 12, 20, 0.98) 56%, transparent 58%),
    conic-gradient(var(--score-color) var(--score-pct), rgba(var(--line-rgb), 0.16) 0);
}

.lay-score-gauge.warning { --score-color: var(--warning); }
.lay-score-gauge.danger { --score-color: var(--danger); }

.lay-score-gauge div {
  display: grid;
  place-items: center;
  line-height: 1;
}

.lay-score-gauge strong {
  font-size: 1.35rem;
}

.lay-score-gauge span {
  color: var(--muted);
  font-size: 0.74rem;
}

.lay-score-breakdown {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.42);
}

.lay-score-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lay-score-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: 10px;
  background: rgba(12, 18, 30, 0.58);
}

.lay-score-summary-card.success { border-color: rgba(var(--success-rgb), 0.32); }
.lay-score-summary-card.warning { border-color: rgba(var(--warning-rgb), 0.32); }
.lay-score-summary-card.danger { border-color: rgba(var(--danger-rgb), 0.34); }

.lay-score-summary-card strong {
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.25;
}

.lay-score-summary-card span:last-child {
  color: var(--muted-strong);
  font-size: 0.76rem;
  line-height: 1.35;
}

.lay-factor-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.lay-factor-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: 10px;
  background: rgba(12, 18, 30, 0.58);
}

.lay-factor-card.success { border-color: rgba(var(--success-rgb), 0.32); }
.lay-factor-card.warning { border-color: rgba(var(--warning-rgb), 0.32); }
.lay-factor-card.danger { border-color: rgba(var(--danger-rgb), 0.34); }

.lay-factor-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.lay-factor-top strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.2;
}

.lay-factor-top span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.lay-factor-bar {
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.12);
}

.lay-factor-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
}

.lay-factor-fill.success { background: var(--success); }
.lay-factor-fill.warning { background: var(--warning); }
.lay-factor-fill.danger { background: var(--danger); }

.lay-factor-meta {
  display: grid;
  gap: 7px;
  align-content: start;
  min-width: 0;
}

.lay-factor-meta > span:first-child {
  color: var(--muted-strong);
  font-size: 0.76rem;
  line-height: 1.3;
}

.lay-side-stack,
.lay-module {
  display: grid;
  gap: 12px;
}

.lay-module,
.lay-matrix-wrap {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.42);
}

.lay-module-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.lay-module-head h4 {
  margin: 2px 0 0;
  font-family: "DM Sans", sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0;
  text-transform: none;
}

.lay-bar-row {
  display: grid;
  gap: 6px;
}

.lay-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.84rem;
}

.lay-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.12);
}

.lay-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
}

.lay-bar-fill.success { background: var(--success); }
.lay-bar-fill.warning { background: var(--warning); }
.lay-bar-fill.danger { background: var(--danger); }
.lay-bar-fill.info { background: var(--teal); }

.lay-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lay-matrix-center {
  min-width: 0;
}

.lay-matrix {
  display: grid;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.lay-matrix-cell {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid rgba(var(--line-rgb), 0.08);
  border-radius: 8px;
  background: rgba(var(--accent-rgb), var(--heat-alpha, 0.16));
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.lay-matrix-head {
  background: rgba(var(--line-rgb), 0.1);
  color: var(--muted-strong);
}

.lay-matrix-risk {
  border-color: rgba(var(--danger-rgb), 0.45);
  box-shadow: inset 0 0 0 1px rgba(var(--danger-rgb), 0.18);
}

.lay-matrix-top {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.22);
}

.lay-matrix-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.lay-h2h-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lay-h2h-list li,
.lay-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(var(--line-rgb), 0.08);
  border-radius: 10px;
  background: rgba(12, 18, 30, 0.54);
}

.lay-h2h-list span,
.lay-table-row span {
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.84rem;
}

.lay-h2h-main {
  display: grid;
  gap: 3px;
}

.lay-h2h-list .lay-h2h-date {
  color: var(--muted-strong);
  font-family: "JetBrains Mono", monospace;
}

.lay-h2h-list .lay-h2h-teams {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lay-h2h-list strong,
.lay-table-row strong {
  color: var(--ink);
}

.lay-table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lay-table-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

@media (max-width: 1100px) {

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .lay-match-header{
    grid-template-columns: 1fr;
  }

  .lay-factor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lay-score-summary-grid {
    grid-template-columns: 1fr;
  }

  .lay-score-gauge {
    width: 112px;
    justify-self: start;
  }

  .detail-subnav-shell {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(var(--line-rgb), 0.08);
  }

  .detail-subnav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .detail-subnav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 760px) {
  .detail-section-head {
    flex-direction: column;
  }

  .detail-intro-grid {
    grid-template-columns: 1fr;
  }

  .lay-stat-row,
  .lay-score-summary-grid,
  .lay-factor-grid,
  .lay-table-grid,
  .lay-table-row {
    grid-template-columns: 1fr;
  }

  .detail-overlay-panel {
    width: min(100% - 12px, 1440px);
    height: calc(100vh - 12px);
    margin: 6px auto;
    border-radius: 20px;
  }

  .detail-overlay-header {
    padding: 16px;
  }

  .detail-subnav-shell,
  .detail-content {
    padding-inline: 16px;
  }

  .detail-content {
    padding-top: 16px;
    padding-bottom: 18px;
  }

  .detail-intro,
  .detail-section {
    padding: 16px;
    border-radius: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   METRICS SUMMARY BAR — stats row above catalog
   ═══════════════════════════════════════════════════════════════════ */

.metrics-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.msb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: rgba(12, 18, 27, 0.7);
  font-size: 0.78rem;
  font-family: "DM Sans", sans-serif;
  white-space: nowrap;
}

.msb-badge .msb-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.msb-badge .msb-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.msb-badge--active {
  border-color: rgba(var(--accent-bright-rgb), 0.28);
  background: rgba(var(--accent-bright-rgb), 0.07);
}
.msb-badge--active .msb-value { color: var(--accent-bright); }

.msb-badge--preset {
  border-color: rgba(var(--warning-rgb), 0.18);
  background: rgba(var(--warning-rgb), 0.05);
}
.msb-badge--preset .msb-value { color: var(--warning, var(--warning)); }

/* ═══════════════════════════════════════════════════════════════════
   METRIC GROUP HEADER — dot + colored counter badges
   ═══════════════════════════════════════════════════════════════════ */

.metric-group-dot {
  display: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.metric-group-dot--score    { background: var(--muted-strong); }
.metric-group-dot--halftime { background: var(--info); box-shadow: 0 0 6px rgba(var(--info-rgb), 0.4); }
.metric-group-dot--events   { background: var(--accent-bright); box-shadow: 0 0 6px rgba(var(--accent-bright-rgb), 0.4); }
.metric-group-dot--odds     { background: var(--warning); box-shadow: 0 0 6px rgba(var(--warning-rgb), 0.4); }
.metric-group-dot--other    { background: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   DIAGNOSTICA SCREENING — layout orizzontale
   ═══════════════════════════════════════════════════════════════════ */

/* KPI bar orizzontale: Candidate / Fixture analizzate / Hit rate */
.diag-kpi-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(8, 12, 20, 0.6);
}

.diag-kpi {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 12px;
  min-width: 0;
}

.diag-kpi-sep {
  width: 1px;
  background: var(--line);
  flex-shrink: 0;
}

.diag-kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.diag-kpi-label {
  font-size: 0.72rem;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

/* Colore per la KPI candidate */
.diag-kpi-candidate .diag-kpi-value { color: var(--success); }
.diag-kpi-pct .diag-kpi-value        { color: var(--teal); }

/* Barra progresso full-width */
.diag-progress-wrap {
  padding: 0 2px;
}

.diag-progress-track {
  height: 8px;
  background: rgba(var(--line-rgb), 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.diag-progress-track .progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ─── Diagnostics new layout ─────────────────────────────────────── */

.diag-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.diag-block {
  background: rgba(10, 16, 26, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diag-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.diag-block-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-strong);
}

.diag-block-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Eligibility block (Motivi esclusione) ───────────────────────── */

.diag-eligibility-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.diag-eligibility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diag-eligibility-label {
  font-size: 0.8rem;
  color: var(--muted-strong);
  cursor: default;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diag-eligibility-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--warning);
  font-weight: 600;
  flex-shrink: 0;
}

/* Responsive: sotto 600px, KPI in 2x2 */
@media (max-width: 600px) {
  .diag-kpi-bar {
    flex-wrap: wrap;
  }

  .diag-kpi {
    flex: 1 1 45%;
  }

  .diag-kpi-sep:nth-child(4) {
    display: none;
  }
}

/* ─── Screening Progress Card (single honest indicator) ─────────── */
@keyframes spb-fill-grow {
  from { opacity: 0; transform: scaleX(0.6); }
  to   { opacity: 1; transform: scaleX(1); }
}

@keyframes spc-appear {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-bright-rgb), 0.55); }
  60%      { box-shadow: 0 0 0 6px rgba(var(--accent-bright-rgb), 0); }
}

@keyframes spc-bar-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(280%); }
}

/* Improved content loading overlay */
@keyframes overlay-hide {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.content-loading-overlay {
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 180ms ease both;
}

.content-loading-overlay.is-hiding {
  animation: overlay-hide 180ms ease both;
}

.content-loading-overlay .progress-fill-indeterminate {
  background: linear-gradient(90deg, var(--teal), var(--accent), var(--teal));
  background-size: 200% 100%;
  animation: progress-indeterminate 1.6s ease-in-out infinite;
}

.content-loading-label {
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  color: var(--teal);
  opacity: 0.8;
}

/* Diag progress bar animated entry */
.diag-progress-track .progress-fill {
  transition: width 700ms cubic-bezier(0.4, 0, 0.2, 1);
}

.diag-progress-track .progress-fill[data-animated="true"] {
  animation: spb-fill-grow 400ms ease both;
}

/* ─── Unified top surfaces ───────────────────────────────────────── */
.workspace-hero {
  position: relative;
  overflow: hidden;
  border-color: rgba(var(--accent-bright-rgb), 0.18);
  background: linear-gradient(140deg, rgba(9, 16, 25, 0.98), rgba(4, 8, 15, 0.96));
}

.workspace-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(var(--accent-bright-rgb), 0.18) 47%, transparent 48%),
    linear-gradient(45deg, transparent 0 42%, rgba(var(--accent-rgb), 0.16) 43%, transparent 44%);
  background-size: 140px 140px;
}

.workspace-hero > * {
  position: relative;
  z-index: 1;
}

.workspace-hero .section-copy {
  max-width: 76ch;
}

.workspace-hero .section-copy h2 {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(1.35rem, 2.4vw, 2.05rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.workspace-hero .section-copy p {
  color: var(--muted-strong);
  font-size: 0.98rem;
  line-height: 1.55;
}

.workspace-hero .button.secondary,
.workspace-hero .button.ghost {
  background: rgb(18, 25, 35);
  border-color: rgba(var(--line-rgb), 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.workspace-hero .button.secondary:hover,
.workspace-hero .button.ghost:hover {
  background: rgb(24, 33, 45);
  border-color: rgba(var(--accent-bright-rgb), 0.30);
}

/* ─── Auth: login overlay (tactical operations terminal) ─────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Layered atmosphere: deep base + teal command glow + faint console grid. */
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(var(--accent-bright-rgb), 0.12), transparent 60%),
    radial-gradient(90% 70% at 50% 118%, rgba(var(--accent-rgb), 0.09), transparent 55%),
    linear-gradient(rgba(var(--line-rgb), 0.045) 1px, transparent 1px) 0 0 / 100% 40px,
    linear-gradient(90deg, rgba(var(--line-rgb), 0.045) 1px, transparent 1px) 0 0 / 40px 100%,
    #070b11;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.4s ease both;
}

.login-card {
  position: relative;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 34px 32px 26px;
  background: linear-gradient(180deg, rgba(25, 34, 48, 0.55), rgba(12, 17, 23, 0.86));
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: var(--radius-xl);
  box-shadow:
    0 30px 80px -28px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: login-card-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
/* Accent sweep along the top edge. */
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-bright), transparent);
  background-size: 200% 100%;
  animation: login-sweep 4s linear infinite;
}
@keyframes login-sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Staggered entrance for the card's children. */
.login-card > * { animation: login-rise 0.5s ease both; }
.login-title { animation-delay: 0.06s; }
.login-subtitle { animation-delay: 0.12s; }
.login-field:nth-of-type(1) { animation-delay: 0.18s; }
.login-field:nth-of-type(2) { animation-delay: 0.24s; }
.login-button { animation-delay: 0.32s; }
@keyframes login-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.login-title {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: 2.9rem;
  line-height: 0.92;
  letter-spacing: 1.5px;
  color: var(--ink);
  text-shadow: 0 0 28px rgba(var(--accent-bright-rgb), 0.28);
}
.login-subtitle { margin: -4px 0 4px; color: var(--muted); font-size: 0.86rem; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-strong);
}
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
  pointer-events: none;
  transition: stroke 0.2s ease;
}
.login-field input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  background: rgba(7, 11, 17, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.login-field input::placeholder { color: rgba(var(--line-rgb), 0.35); }
.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(7, 11, 17, 0.85);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}
.login-input-wrap:focus-within svg { stroke: var(--accent-bright); }

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: rgba(var(--danger-rgb), 0.1);
  border: 1px solid rgba(var(--danger-rgb), 0.32);
  color: var(--danger);
  font-size: 0.8rem;
  line-height: 1.3;
}
.login-error svg { width: 15px; height: 15px; flex: none; }
.login-error.shake { animation: login-shake 0.4s ease; }
@keyframes login-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.login-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 4px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #04121a;
  border: none;
  border-radius: var(--radius-md);
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.login-button:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(var(--accent-bright-rgb), 0.6); }
.login-button:active { transform: translateY(0); }
.login-button:disabled { cursor: progress; filter: saturate(0.7) brightness(0.92); }
.login-button-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(4, 18, 26, 0.35);
  border-top-color: #04121a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.login-button.is-loading .login-button-spinner { display: inline-block; }
.login-button.is-loading .login-button-label { opacity: 0.8; }

/* Anti-bot chip (ALTCHA PoW): one row whose icon + tint track data-state
   (idle → solving → ready / error), set by auth.js. */
.login-altcha {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.5);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 600;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.login-altcha svg { width: 16px; height: 16px; flex: none; }
.login-altcha-shield { opacity: 0.8; }
.login-altcha-check { display: none; color: var(--success); }
.login-altcha-spinner {
  display: none;
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid rgba(var(--accent-bright-rgb), 0.25);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.login-altcha[data-state="solving"] { border-color: rgba(var(--accent-bright-rgb), 0.3); color: var(--accent); }
.login-altcha[data-state="solving"] .login-altcha-shield { display: none; }
.login-altcha[data-state="solving"] .login-altcha-spinner { display: inline-block; }
.login-altcha[data-state="ready"] {
  border-color: rgba(var(--success-rgb), 0.35);
  background: rgba(var(--success-rgb), 0.08);
  color: var(--success);
}
.login-altcha[data-state="ready"] .login-altcha-shield { display: none; }
.login-altcha[data-state="ready"] .login-altcha-check { display: inline; }
.login-altcha[data-state="error"] { border-color: rgba(var(--warning-rgb), 0.35); color: var(--warning); }

@media (prefers-reduced-motion: reduce) {
  .login-overlay,
  .login-card,
  .login-card > *,
  .login-card::before,
  .login-altcha-spinner,
  .login-button-spinner { animation: none !important; }
}

/* ─── Account cluster in the navbar (avatar + username + logout) ──────────
   Sits at the far right of the nav bar, set off from the tabs by a thin
   divider. The identity stacks a role-tinted monogram avatar over the
   username; the logout mirrors a .tab-button's height/typography with a
   navbar-style line icon. Hidden entirely when auth is off. */
/* ─── Profilo: voce effettiva della navbar (avatar identicon + username) ──── */
.tab-button--profile { --uc-rgb: var(--accent-rgb); }
.tab-button--profile[data-role="analyst"] { --uc-rgb: var(--accent-bright-rgb); }
.tab-button--profile[data-role="admin"]   { --uc-rgb: var(--warning-rgb); }
.tab-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  /* Tessera pixel identicon = quadrato (stile GitHub): un ritaglio circolare
     tagliava le celle degli angoli e su un pattern denso appariva "spaccato".
     Angoli arrotondati come le altre superfici avatar (Profilo, lista Admin,
     favicon), così la piastrella si vede intera. */
  border-radius: var(--radius-md);
  padding: 0;
  background: #0b1b22;
  overflow: hidden;
  color: rgb(var(--uc-rgb));
}
.tab-avatar .identicon {
  width: 100%;
  height: 100%;
  display: block;
  stroke: none;
  stroke-width: 0;
}
.tab-avatar .identicon rect { stroke: none; }
.tab-button--profile .tab-label {
  max-width: 14ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-button--profile:hover .tab-avatar,
.tab-button--profile:focus-visible .tab-avatar,
.tab-button--profile.active .tab-avatar { box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.5); }

/* ─── Profilo (gestione account come pagina) ──────────────────────────────
   Identity sibling of the login surface: same gradient card + accent sweep,
   now rendered IN PAGE inside the Profilo tab (the modal overlay was removed).
   A wide two-column body (avatar | credentials) keeps a content-
   heavy panel from running tall. Class hooks (.account-chip*, .account-swatch,
   .account-variant, .account-field, .account-msg …) are consumed by
   tabs/profilo.js — keep them. Sections are native <details> elements; the
   <summary> acts as the toggle header. */
.profilo-shell { display: flex; justify-content: center; }
.account-card {
  position: relative; width: min(760px, 100%); overflow: hidden;
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px clamp(20px, 3vw, 30px) 24px;
  background: linear-gradient(180deg, rgba(25, 34, 48, 0.55), rgba(12, 17, 23, 0.92));
  border: 1px solid rgba(var(--accent-rgb), 0.22); border-radius: var(--radius-xl);
  box-shadow: 0 30px 80px -28px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fadeUpIn 200ms var(--motion-ease);
}
/* accent sweep along the top edge — ties it to the login card */
.account-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-bright), transparent);
  background-size: 200% 100%; animation: login-sweep 4s linear infinite;
}
/* Variante pagina (tab Profilo): stessa card, ma in flusso e più larga. */
.account-card--page { width: min(920px, 100%); animation: none; }
/* Logout in testa alla pagina Profilo (la navbar resta pulita). */
.account-logout {
  margin-left: auto; align-self: flex-start; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
}

.account-head { display: flex; align-items: center; gap: 16px; padding-right: 40px; }
.account-avatar {
  width: 58px; height: 58px; border-radius: var(--radius-lg); overflow: hidden; flex: 0 0 auto;
  background: var(--bg); border: 1px solid var(--line-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.account-avatar .identicon { width: 100%; height: 100%; display: block; }
.account-eyebrow {
  margin: 0 0 3px; font-family: "JetBrains Mono", monospace; font-size: 0.6rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-bright);
}
.account-name { margin: 0; font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--ink); }
.account-subline { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

.account-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.account-chip { background: rgba(var(--line-rgb), 0.05); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px 11px; }
.account-chip-k { display: block; font-family: "JetBrains Mono", monospace; font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.account-chip-v { display: block; font-size: 0.86rem; font-weight: 700; color: var(--ink); margin-top: 4px; }
.account-chip--ok .account-chip-v { color: var(--success); }
.account-chip--warn .account-chip-v { color: var(--warning); }

/* Credentials row: username | password as two balanced columns (the avatar
   band sits full-width above). Collapses to one column on narrow screens. */
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

/* Sections are inset cards (replaces the old border-top dividers). */
.account-section { background: rgba(var(--line-rgb), 0.035); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px 16px 16px; }
.account-sct { margin: 0 0 10px; font-family: "JetBrains Mono", monospace; font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-strong); }

/* Collapsible sections: <details> with <summary> as toggle header */
details.account-section > summary.account-sct {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
}
details.account-section > summary.account-sct::-webkit-details-marker { display: none; }
details.account-section > summary.account-sct::after {
  content: "▾"; font-size: 0.85em; color: var(--muted);
  transition: transform 0.18s ease; flex-shrink: 0; margin-left: 8px;
}
details.account-section:not([open]) > summary.account-sct { margin-bottom: 0; }
details.account-section:not([open]) > summary.account-sct::after { transform: rotate(-90deg); }
.account-help { margin: -2px 0 12px; font-size: 0.74rem; line-height: 1.5; color: var(--muted); }
.account-pick-label { display: block; font-family: "JetBrains Mono", monospace; font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 12px 0 7px; }
.account-pick-label:first-of-type { margin-top: 0; }

.account-palette { display: flex; flex-wrap: wrap; gap: 9px; }
.account-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  transition: transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}
.account-swatch:hover { transform: scale(1.12); }
.account-swatch.is-default { border-color: rgba(var(--line-rgb), 0.5); }
.account-swatch.is-selected { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(var(--accent-bright-rgb), 0.25); }

.account-variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.account-variant {
  aspect-ratio: 1; border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--line); cursor: pointer; padding: 4px;
  transition: border-color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}
.account-variant:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.account-variant .identicon { width: 100%; height: 100%; display: block; }
.account-variant.is-selected { border-color: var(--accent-bright); box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.4); }

.account-form { display: flex; flex-direction: column; gap: 11px; }
.account-field { display: flex; flex-direction: column; gap: 6px; }
.account-field > span { font-family: "JetBrains Mono", monospace; font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-strong); }
.account-field input {
  width: 100%; padding: 10px 13px; color: var(--ink);
  background: rgba(7, 11, 17, 0.6); border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  font-family: "DM Sans", sans-serif; font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.account-field input:focus { outline: none; border-color: var(--accent); background: rgba(7, 11, 17, 0.85); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16); }
.account-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.account-msg { font-size: 0.76rem; color: var(--success); }
.account-msg.is-error { color: var(--danger); }

@media (max-width: 640px) {
  .account-grid { grid-template-columns: 1fr; }
  .account-chips { grid-template-columns: repeat(2, 1fr); }
  .account-name { font-size: 1.5rem; }
}

/* ─── Admin ──────────────────────────────────────────────────────────────
   Brought in line with the rest of the workspace: hero with icon badge +
   status pill, per-section icon badges, icon-led stat cards and refined
   tables. Class names consumed by admin.js are preserved. */
.admin-shell { display: grid; gap: clamp(18px, 2vw, 24px); }

/* Hero */
.admin-hero-header { align-items: center; }
.admin-hero-lead { display: flex; align-items: center; gap: 16px; min-width: 0; }
/* Shared icon-badge recipe — hero / section / stat differ only in size + fill. */
.admin-hero-icon,
.admin-section-icon,
.admin-stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
}
.admin-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(150deg, rgba(var(--accent-bright-rgb), 0.16), rgba(var(--accent-rgb), 0.06));
  border: 1px solid rgba(var(--accent-bright-rgb), 0.28);
  box-shadow: inset 0 1px 0 rgba(var(--accent-bright-rgb), 0.12);
}
.admin-hero-icon svg { width: 28px; height: 28px; }
.admin-hero-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
/* Re-assert the eyebrow identity: the more specific `.workspace-hero
   .section-copy p` rule would otherwise flatten its color and size. */
.admin-hero .section-copy p.eyebrow { color: var(--accent); font-size: 0.68rem; line-height: 1.2; }

/* Icon + label buttons (refresh, create, filter) */
.admin-refresh-btn,
.admin-create-submit,
.admin-filter-btn { gap: 8px; }
.admin-refresh-btn svg,
.admin-create-submit svg,
.admin-filter-btn svg { width: 16px; height: 16px; }

/* Per-section header: icon badge + copy on the left, count pill on the right */
.admin-section-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-section-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(var(--accent-bright-rgb), 0.08);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.18);
}
.admin-section-icon svg { width: 20px; height: 20px; }

/* Overview stat cards — icon-led, with a tone-aware accent rail */
/* ─── Admin → Arricchimento DB ───────────────────────────────────── */
.admin-enrichment-body {
  display: grid;
  gap: var(--space-2);
}
.admin-enrichment-dropzone {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 16px 18px;
  border: 1.5px dashed rgba(var(--accent-rgb), 0.3);
  border-radius: var(--radius-lg);
  background: rgba(var(--accent-rgb), 0.05);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.admin-enrichment-dropzone:hover,
.admin-enrichment-dropzone:focus-visible,
.admin-enrichment-dropzone.is-dragover {
  border-color: rgba(var(--accent-bright-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.08);
  outline: none;
}
.admin-enrichment-import-ok { margin: 0; color: var(--ink); }
.admin-enrichment-import-ids { margin: 0; font-family: var(--font-mono); }
.admin-enrichment-error { margin: 0; color: rgb(var(--danger-rgb)); }
.admin-enrichment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-enrichment-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 20, 0.55);
}
.admin-enrichment-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.admin-enrichment-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 640px) {
  .admin-enrichment-stats { grid-template-columns: 1fr; }
}
.admin-enrichment-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(var(--line-rgb), 0.1);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.42);
}
.admin-enrichment-stat-value {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.admin-enrichment-stat-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-enrichment-fails-title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: rgb(var(--danger-rgb));
}
.admin-enrichment-fail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.admin-enrichment-fail {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-left: 3px solid rgba(var(--danger-rgb), 0.5);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(var(--danger-rgb), 0.06);
}
.admin-enrichment-fail-scope { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
.admin-enrichment-fail-job { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.admin-enrichment-fail-error { font-size: 0.76rem; color: var(--muted-strong); word-break: break-word; }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-2);
}
.admin-stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  background:
    linear-gradient(160deg, rgba(var(--accent-bright-rgb), 0.04), transparent 60%),
    rgba(8, 12, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--motion-base) var(--motion-ease), transform var(--motion-base) var(--motion-ease);
}
.admin-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.7;
}
.admin-stat-card:hover { border-color: rgba(var(--accent-bright-rgb), 0.28); transform: translateY(-1px); }
/* Tone-aware cards (warning / danger) resolve every color from one per-tone
   RGB channel, so adding a tone is a single line, not a block of declarations. */
.admin-stat-card[data-tone="warning"] { --stat-tone-rgb: var(--warning-rgb); }
.admin-stat-card[data-tone="danger"] { --stat-tone-rgb: var(--danger-rgb); }
.admin-stat-card[data-tone="warning"]::before,
.admin-stat-card[data-tone="danger"]::before { background: rgb(var(--stat-tone-rgb)); }
.admin-stat-card[data-tone="warning"] .admin-stat-icon,
.admin-stat-card[data-tone="danger"] .admin-stat-icon {
  color: rgb(var(--stat-tone-rgb));
  background: rgba(var(--stat-tone-rgb), 0.12);
  border-color: rgba(var(--stat-tone-rgb), 0.22);
}
.admin-stat-card[data-tone="warning"] .admin-stat-value,
.admin-stat-card[data-tone="danger"] .admin-stat-value { color: rgb(var(--stat-tone-rgb)); }
.admin-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(var(--accent-bright-rgb), 0.08);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.16);
}
.admin-stat-icon svg { width: 22px; height: 22px; }
.admin-stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-stat-label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }
.admin-stat-value { color: var(--ink); font-size: 1.55rem; line-height: 1; font-family: "Bebas Neue", sans-serif; letter-spacing: 0.02em; }
.admin-stat-hint { color: var(--muted); font-size: 0.7rem; }

/* Create-user form: labelled fields in a responsive grid, submit bottom-aligned */
.admin-create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-2);
  align-items: end;
}
.admin-create-submit { min-height: 46px; }
.admin-error {
  margin: var(--space-1) 0 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(var(--danger-rgb), 0.22);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

/* Filter rows */
.admin-filter-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; margin-bottom: var(--space-1); }
.admin-filter-field { flex: 1 1 180px; }
.admin-search { flex: 1 1 240px; max-width: 360px; }
.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 12px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
}
.admin-checkbox span { text-transform: none; letter-spacing: 0; }

/* Tables */
.admin-table-scroll {
  /* Long tables (the audit log paginates 200 rows) scroll inside their own
     box instead of stretching the page; the sticky thead stays pinned to the
     top of this container. Short tables stay natural — the cap only bites when
     content overflows it. */
  max-height: min(62vh, 600px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 20, 0.4);
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
}
.admin-table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.admin-table-scroll::-webkit-scrollbar-track { background: transparent; }
.admin-table-scroll::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: rgba(var(--accent-bright-rgb), 0.18); }
.admin-table-scroll::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent-bright-rgb), 0.28); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th,
.admin-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(10, 16, 26, 0.96);
  backdrop-filter: blur(8px);
}
.admin-table tbody tr { transition: background-color var(--motion-fast) var(--motion-ease); }
.admin-table tbody tr:hover { background: rgba(var(--accent-bright-rgb), 0.04); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table td { color: var(--ink); }
.admin-table select,
.admin-table input[type="date"] {
  min-height: 34px;
  padding: 5px 8px;
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--ink);
}
.admin-ua { color: var(--muted-strong); font-size: 0.82rem; font-weight: 600; cursor: default; }
.admin-empty { color: var(--muted); text-align: center; padding: 22px 16px; }
.admin-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Mini action buttons in table rows */
.btn-mini {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(var(--accent-bright-rgb), 0.06);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted-strong);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), background-color var(--motion-fast) var(--motion-ease);
}
.btn-mini:hover { border-color: rgba(var(--accent-bright-rgb), 0.4); color: var(--accent); background: rgba(var(--accent-bright-rgb), 0.1); }
.btn-mini.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(var(--danger-rgb), 0.18); }
.btn-mini.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(var(--danger-rgb), 0.16); }

/* Status badges (role state, MFA, session expiry, audit status) — clean
   text chips, tone-tinted, no leading dot. */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-badge.ok { background: var(--success-soft); color: var(--success); border: 1px solid rgba(var(--success-rgb), 0.22); }
.admin-badge.off { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(var(--danger-rgb), 0.22); }
.admin-badge.warn { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(var(--warning-rgb), 0.22); }
.admin-badge.info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(var(--info-rgb), 0.22); }

/* MFA cell: the on/off state is a clickable switch (enable/disable), with a
   status note and an optional Reset. data-state tints it: off neutral,
   pending warning, on success. */
.admin-mfa-cell { white-space: nowrap; }
.admin-mfa-toggle-wrap { display: inline-flex; align-items: center; gap: 10px; }

.admin-switch {
  --sw-rgb: var(--success-rgb);
  flex: 0 0 auto;
  display: inline-flex;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.admin-switch[data-state="off"] { --sw-rgb: var(--line-rgb); }
.admin-switch[data-state="pending"] { --sw-rgb: var(--warning-rgb); }
.admin-switch[data-state="on"] { --sw-rgb: var(--success-rgb); }

.admin-switch-track {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: rgba(var(--sw-rgb), 0.16);
  border: 1px solid rgba(var(--sw-rgb), 0.4);
  transition: background-color var(--motion-base) var(--motion-ease), border-color var(--motion-base) var(--motion-ease);
}
.admin-switch-thumb {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted-strong);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform var(--motion-base) var(--motion-ease), background-color var(--motion-base) var(--motion-ease);
}
.admin-switch[aria-checked="true"] .admin-switch-track { background: rgba(var(--sw-rgb), 0.28); }
.admin-switch[aria-checked="true"] .admin-switch-thumb { transform: translate(18px, -50%); background: rgb(var(--sw-rgb)); }
.admin-switch:hover .admin-switch-track { border-color: rgba(var(--sw-rgb), 0.6); }
.admin-switch:focus-visible { outline: none; }
.admin-switch:focus-visible .admin-switch-track { box-shadow: 0 0 0 3px rgba(var(--sw-rgb), 0.25); }

.admin-mfa-note {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-mfa-note.off { color: var(--muted); }
.admin-mfa-note.pending { color: var(--warning); }
.admin-mfa-note.on { color: var(--success); }

@media (prefers-reduced-motion: reduce) {
  .admin-switch-track,
  .admin-switch-thumb { transition: none; }
}

/* Current session: a quiet accent tag + a soft row emphasis instead of a
   loud badge. The first cell carries a thin accent rail. */
.admin-session-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent-bright);
  background: rgba(var(--accent-bright-rgb), 0.1);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.28);
}
.admin-table tbody tr.is-current { background: rgba(var(--accent-bright-rgb), 0.05); }
.admin-table tbody tr.is-current:hover { background: rgba(var(--accent-bright-rgb), 0.08); }
.admin-table tbody tr.is-current td:first-child { box-shadow: inset 2px 0 0 var(--accent-bright); }

/* Collapsible panel (Audit): same <details> pattern as the Log Analyzer raw
   events. The summary carries the section header; a chevron flips when open. */
.admin-collapsible { padding: 0; }
.admin-collapsible-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-xl);
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.admin-collapsible-summary::-webkit-details-marker { display: none; }
.admin-collapsible-summary::marker { content: ""; }
.admin-collapsible-summary:hover { background: rgba(var(--accent-bright-rgb), 0.03); }
.admin-collapsible-summary .admin-section-lead { flex: 1 1 auto; min-width: 0; }
.admin-collapse-chevron { display: inline-flex; color: var(--muted); transition: transform var(--motion-base) var(--motion-ease); }
.admin-collapse-chevron svg { width: 18px; height: 18px; }
.admin-collapsible[open] .admin-collapse-chevron { transform: rotate(180deg); }
.admin-collapsible[open] > .admin-collapsible-summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.admin-collapsible-body { display: grid; gap: var(--space-2); padding: 18px 24px 22px; }

@media (max-width: 720px) {
  .admin-hero-header { align-items: flex-start; }
  .admin-hero-actions { width: 100%; }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
  .admin-create-submit { grid-column: 1 / -1; }
}

/* --- Login MFA views (code entry, enrollment, backup codes) --- */
.login-hint {
  margin: -2px 0 2px;
  font-size: 0.78rem;
  color: var(--muted);
}
.login-enroll-qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 2px auto 8px;
  padding: 10px;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  image-rendering: pixelated; /* keep QR modules crisp when scaled */
}
.login-enroll-secret {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(7, 11, 17, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
}
.login-enroll-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-strong);
}
/* Key on its own full-width line; the reveal/copy buttons sit on a tidy row
   beneath it, right-aligned — so a long base32 secret never crowds them. */
.login-enroll-secret-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.login-enroll-secret code {
  flex: 1 1 100%;
  min-width: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  letter-spacing: 0.14em;
  line-height: 1.5;
  color: var(--accent-bright);
  word-break: break-all;
  user-select: all;
  transition: filter 0.15s ease;
}
/* Hidden by default: the QR is the primary path; the key is a fallback. */
.login-enroll-secret code.is-masked {
  filter: blur(7px);
  user-select: none;
  -webkit-user-select: none;
}
.login-enroll-actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}
.login-enroll-uri { font-size: 0.8rem; color: var(--muted); }
.login-enroll-uri summary { cursor: pointer; color: var(--muted-strong); }
.login-enroll-uri code {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(7, 11, 17, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted-strong);
  word-break: break-all;
  user-select: all;
}
.login-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.74rem;
  background: var(--bg-muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted-strong);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.login-copy svg { flex-shrink: 0; width: 11px; height: 11px; display: block; }
.login-copy:hover { border-color: var(--accent); color: var(--ink); }
.login-copy-block { display: flex; justify-content: center; width: 100%; margin: 4px 0 0; }
.login-backup-list {
  list-style: none;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  background: rgba(7, 11, 17, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  user-select: all;
}

/* ── Admin audit extended filters / pager / detail ───────────────────────── */
.admin-filter-input { min-width: 8rem; }
.admin-audit-pager { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.admin-detail { opacity: .7; font-size: .85em; margin-left: .4rem; max-width: 22rem;
    display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    vertical-align: bottom; }

/* ── Users table: clickable identity cell with a role-tinted monogram ──────── */
.admin-user-link {
  --row-rgb: var(--accent-rgb);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.admin-user-link[data-role="analyst"] { --row-rgb: var(--accent-bright-rgb); }
.admin-user-link[data-role="admin"]   { --row-rgb: var(--warning-rgb); }
.admin-user-link:focus-visible { outline: none; }
.admin-user-mono {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  overflow: hidden;
  background: #0b1b22;
  border: 1px solid rgba(var(--row-rgb), 0.3);
}
.admin-user-mono .identicon { display: block; width: 100%; height: 100%; }
.admin-user-name {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease);
}
.admin-user-link:hover .admin-user-name,
.admin-user-link:focus-visible .admin-user-name {
  color: rgb(var(--row-rgb));
  border-bottom-color: rgba(var(--row-rgb), 0.5);
}

/* ── Per-user activity card ─────────────────────────────────────────────────── */
.admin-user-card {
  margin-top: 4px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-bright);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(var(--accent-bright-rgb), 0.05), transparent 55%),
    rgba(8, 12, 20, 0.5);
  box-shadow: var(--shadow-soft);
}
.admin-user-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.admin-user-card-head h3 { margin: 0; font-size: 1.05rem; }
.admin-user-card-body { display: grid; gap: 16px; }

.admin-activity-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-activity-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 150px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.45);
}
.admin-activity-stat-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.admin-activity-stat-value { font-family: "Barlow Condensed", system-ui, sans-serif; font-weight: 600; font-size: 1rem; color: var(--ink); }

.admin-activity-group { display: grid; gap: 7px; }
.admin-activity-title {
  margin: 0;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-strong);
}
.admin-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  /* A long history scrolls within its group instead of ballooning the card. */
  max-height: 232px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-bright-rgb), 0.2) transparent;
}
.admin-activity-list::-webkit-scrollbar { width: 6px; }
.admin-activity-list::-webkit-scrollbar-track { background: transparent; }
.admin-activity-list::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: rgba(var(--accent-bright-rgb), 0.18); }
.admin-activity-list::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent-bright-rgb), 0.28); }
.admin-activity-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.4);
  font-size: 0.82rem;
}
.admin-activity-list li.admin-empty { justify-content: center; padding: 10px 12px; border-style: dashed; color: var(--muted); }
.admin-activity-time { flex: 0 0 auto; font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.admin-activity-act { flex: 1 1 auto; min-width: 0; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-activity-list .admin-badge { flex: 0 0 auto; }

/* ── Partite Live + Indicatori Live (Piano 5) ─────────────────────── */
/* ═══════════════════════════════════════════════════════════════════
   Partite Live + Indicatori Live — broadcast-grade live surfaces.
   Same dark-terminal vocabulary as the rest of the app (glass panels,
   teal/cyan accents, Barlow heads, JetBrains-Mono numerics), pushed to a
   live-ops feel: pulsing status, scoreboard cards, SofaScore-style bars.
   ═══════════════════════════════════════════════════════════════════ */
.live-shell { display: flex; flex-direction: column; gap: 16px; }

/* ── Hero strip ───────────────────────────────────────────────────── */
.live-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 2px 2px;
}
.live-hero-title {
  font-family: 'Bebas Neue', 'Barlow Condensed', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 0 0 28px rgba(var(--accent-bright-rgb), 0.3);
}
.live-hero-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.live-subtitle { margin: 2px 0 0; color: var(--muted-strong); font-size: 0.9rem; }
.live-refresh-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.5);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Inline Tabler-style icons (mockup parity). pointer-events:none so an icon
   inside a button never becomes the click target. */
.li-icon { flex-shrink: 0; vertical-align: -0.18em; pointer-events: none; }
#panel-indicatori-live .section-copy h2 { display: inline-flex; align-items: center; gap: 9px; }

/* ── Live status badge (shared) ───────────────────────────────────── */
.live-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.live-status-badge.is-live { color: var(--danger); background: var(--danger-soft); border-color: rgba(var(--danger-rgb), 0.22); }
.live-status-badge.is-live::before {
  content: "";
  width: 13px;
  height: 13px;
  background-color: currentColor;
  -webkit-mask: var(--live-broadcast-icon) center / contain no-repeat;
  mask: var(--live-broadcast-icon) center / contain no-repeat;
  animation: live-blink 1.4s ease-in-out infinite;
}
.live-status-badge.is-scheduled { color: var(--muted-strong); background: rgba(var(--line-rgb), 0.08); }
.live-status-badge.is-finished { color: var(--muted); background: rgba(var(--line-rgb), 0.06); }

/* ── Live team side + score (shared: match-wall tile + dettaglio) ──── */
.live-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-team--home { justify-content: flex-end; }
.live-team--away { justify-content: flex-start; }
.live-team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.live-score {
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  padding: 0 4px;
}
/* Chip segnale (condivisa: tile del match wall + timeline del dettaglio). */
.live-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-bright);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.18);
}
.live-chip--more { opacity: 0.65; cursor: default; }

/* Chip statistica live (condivisa: tile del match wall + dettaglio). */
.live-stat-chip {
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.1);
  color: var(--muted-strong);
  border: 1px solid var(--line);
  white-space: nowrap;
}
/* Mini momentum: due zone tenui + barre ad alto contrasto. La larghezza resta
   fluida per non forzare overflow nelle righe mobile. */
.live-sparkline-bars { display: block; flex: 0 1 auto; max-width: 100%; height: auto; }
.live-sparkline-bars .spark-zone--home { fill: rgba(var(--accent-bright-rgb), 0.09); }
.live-sparkline-bars .spark-zone--away { fill: rgba(var(--info-rgb), 0.09); }
.live-sparkline-bars .spark-base { stroke: var(--line-strong); stroke-width: 0.8; }
.live-sparkline-bars .spark-up { fill: var(--accent); }
.live-sparkline-bars .spark-down { fill: var(--info); }

/* ── Pin button (tile del match wall) ────────────────────────────── */
.live-pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 2px 4px;
  transition: color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}
.live-pin-btn svg { display: block; }
.live-pin-btn:hover { color: var(--accent); transform: scale(1.15); }
.live-pin-btn[aria-pressed="true"] { color: var(--warning); }

/* ═══ MATCH WALL — griglia protagonista ══════════════════════════════
   La home live è una griglia di tile (una per partita di oggi), raggruppate per
   stato (In corso / In programma / Concluse) e filtrabili. Il click su una tile
   apre il dettaglio nell'overlay ancorato in alto. Sostituisce il board a 3
   colonne (stili legacy sotto, ormai inerti — nessun elemento li usa più). ── */

/* Toolbar: ricerca + filtro di stato segmentato (pill). Search box e filtro alla
   STESSA altezza (min-height 42) e centrati, così la barra resta allineata. */
.live-wall-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.live-wall-bar .live-search-wrap { flex: 1 1 260px; }
/* Search box condivisa (viveva nel vecchio board, ora vive qui col wall). */
.live-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  min-width: 200px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(8, 12, 20, 0.5);
  transition: border-color var(--motion-fast) var(--motion-ease);
}
.live-search-wrap:focus-within { border-color: var(--accent); }
.live-search-wrap .li-icon { color: var(--muted); }
/* La regola globale input:focus-visible (vedi sopra) batte in specificità il
   outline:none qui sotto e disegna un secondo anello rettangolare sopra la pill
   del wrap: doppio bordo. La sopprimiamo esplicitamente in :focus-visible così
   resta solo il focus-within del wrap. */
.live-search:focus-visible { outline: none; }
.live-search {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  /* type=search disegna una cornice/pill nativa arrotondata dentro il wrap
     (doppio bordo): la sopprimiamo così resta solo la pill del wrap. */
  appearance: none;
  -webkit-appearance: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 0;
}
.live-search::placeholder { color: var(--muted); }
.live-search::-webkit-search-decoration,
.live-search::-webkit-search-cancel-button,
.live-search::-webkit-search-results-button,
.live-search::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; }
.live-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.05);
}
.live-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease);
}
.live-filter-btn:hover { color: var(--ink); }
.live-filter-btn.is-active { color: var(--bg); background: var(--accent); }
.live-filter-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.45); }
.live-filter-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.14);
  color: inherit;
}
.live-filter-btn.is-active .live-filter-count { background: rgba(0, 0, 0, 0.22); }
.live-filter-btn .lf-ico { width: 15px; height: 15px; flex-shrink: 0; }
.live-filter-btn .lf-ico--live { color: var(--danger); }
.live-filter-btn .lf-ico--hot { color: var(--warning); }
.live-filter-btn.is-active .lf-ico { color: var(--bg); }

/* Gruppi per stato. */
.live-wall { display: flex; flex-direction: column; gap: 26px; }
.mw-group { display: flex; flex-direction: column; gap: 12px; }
.mw-group-head { display: flex; align-items: center; gap: 12px; }
.mw-group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-strong);
  white-space: nowrap;
}
.mw-group-title .li-icon { color: var(--muted); }
.mw-group-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.1);
  color: var(--muted-strong);
}
/* Riga-fiammifero che parte dal titolo e si sfuma verso il bordo. */
.mw-group-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.mw-group--live .mw-group-title,
.mw-group--live .mw-group-title .li-icon { color: var(--danger); }
.mw-group--hot .mw-group-title,
.mw-group--hot .mw-group-title .li-icon { color: var(--warning); }
.mw-group--pinned .mw-group-title,
.mw-group--pinned .mw-group-title .li-icon { color: var(--warning); }

.mw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* ── Tile ─────────────────────────────────────────────────────────── */
.mw-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px 15px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(8, 12, 20, 0.5));
  transition: border-color var(--motion-base) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-base) var(--motion-ease);
}
/* Barra d'accento sul bordo alto, colorata per stato. */
.mw-tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: transparent; }
.mw-tile.is-live::before { background: linear-gradient(90deg, var(--danger), transparent); }
.mw-tile:hover,
.mw-tile:focus-visible { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35); outline: none; }
.mw-tile:focus-visible { box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.45); }
.mw-tile.is-finished { opacity: 0.6; }
.mw-tile.is-finished:hover { opacity: 0.85; }
.mw-tile.is-pinned { border-color: rgba(var(--warning-rgb), 0.34); }
.mw-tile.is-open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* Hot (segnale attivo): cornice ambra pulsante — i "segnali che lampeggiano". */
.mw-tile.is-hot {
  border-color: rgba(var(--warning-rgb), 0.5);
  background: linear-gradient(180deg, rgba(var(--warning-rgb), 0.07), rgba(8, 12, 20, 0.55));
  animation: mw-hot-glow 1.8s ease-in-out infinite;
}
.mw-tile.is-hot::before { background: linear-gradient(90deg, var(--warning), transparent); }
@keyframes mw-hot-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--warning-rgb), 0); }
  50% { box-shadow: 0 0 18px -2px rgba(var(--warning-rgb), 0.35); }
}
@media (prefers-reduced-motion: reduce) { .mw-tile.is-hot { animation: none; } }

.mw-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mw-league { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.mw-league-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.72;
  filter:
    brightness(0)
    invert(1)
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.85));
}
.mw-league-name {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mw-tile-status { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }

.mw-tile-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.mw-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mw-team--home { justify-content: flex-end; text-align: right; }
.mw-team--away { justify-content: flex-start; text-align: left; }
.mw-team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
}
.mw-tile.is-scheduled .mw-team-name { font-weight: 600; color: var(--muted-strong); }
.mw-centre { display: flex; align-items: center; justify-content: center; min-width: 42px; }
.mw-score {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.mw-tile.is-live .mw-score { color: var(--accent-bright); }
.mw-kick { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; color: var(--muted-strong); }

.mw-tile-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.mw-tile.is-hot .mw-tile-signals .live-chip {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(var(--warning-rgb), 0.3);
  animation: live-hot-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .mw-tile.is-hot .mw-tile-signals .live-chip { animation: none; } }

/* Sparkline momentum incassata in un pozzetto scuro (legge come strip dati). */
.mw-tile-spark { border-radius: var(--radius-md); background: rgba(4, 8, 14, 0.4); border: 1px solid var(--line); padding: 5px 8px; }
.mw-tile-spark .live-sparkline-bars { width: 100%; height: auto; display: block; }
.mw-tile-stats { display: flex; flex-wrap: wrap; gap: 6px; }

/* ═══ Detail overlay (ancorato in alto) ══════════════════════════════
   Modale pulito che parte dall'alto (niente spazio morto): scrim + card centrata
   scrollabile. Su mobile diventa full-screen. ── */
.live-detail-overlay { position: fixed; inset: 0; z-index: 1000; }
/* Scroll-lock del body mentre l'overlay è aperto (classe messa da openLiveDetail). */
body.live-detail-open { overflow: hidden; }
.live-detail-scrim { position: absolute; inset: 0; background: rgba(4, 8, 14, 0.68); backdrop-filter: blur(2px); animation: fadeIn var(--motion-base) var(--motion-ease); }
.live-detail-overlay .live-detail-content {
  position: absolute;
  top: 2.5vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, 94vw);
  max-width: none;
  max-height: 95vh;
  margin: 0;
  padding: 22px 24px 26px;
  overflow-y: auto;
  background: var(--bg-muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  animation: mw-detail-in var(--motion-base) var(--motion-ease);
}
.live-detail-overlay .live-detail-content::-webkit-scrollbar { width: 8px; }
.live-detail-overlay .live-detail-content::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 8px; }
@keyframes mw-detail-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .live-detail-scrim, .live-detail-overlay .live-detail-content { animation: none; } }

@media (max-width: 640px) {
  .mw-grid { grid-template-columns: 1fr; }
  .live-filter { width: 100%; }
  .live-filter-btn { flex: 1; justify-content: center; padding: 8px 8px; }
  .live-detail-overlay .live-detail-content {
    top: 0;
    left: 0;
    transform: none;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
    padding: 16px 14px 24px;
    animation: none;
  }
}

/* ── Dettaglio match: contenuto del pannello affiancato (L3) ───────── */
.live-detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--motion-fast) var(--motion-ease);
}
.live-detail-close:hover { color: var(--ink); }
.live-detail-head { margin-bottom: 18px; padding-right: 24px; }
.live-detail-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.live-detail-score .live-team-name { font-size: 1.05rem; }
.live-detail-score .fixture-logo { --logo-size: 34px; }
.live-detail-scoreline { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.live-score--lg { font-size: 2rem; line-height: 1; }
.live-detail-block { margin-bottom: 18px; }
.live-detail-block:last-child { margin-bottom: 0; }
.live-detail-block > .eyebrow { margin-bottom: 10px; }
.live-detail-block .eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.live-detail-block .eyebrow .li-icon { color: var(--accent); }
/* Sezioni collassabili (head partita, contesto, momentum, stats, quote): header
   cliccabile (label + chevron), corpo nascosto da collassato. */
.is-collapsible > .ldb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; cursor: pointer; user-select: none; border-radius: var(--radius-md); transition: color var(--motion-fast) var(--motion-ease); }
.is-collapsible > .ldb-head:hover .ldb-chevron { color: var(--accent); }
.is-collapsible > .ldb-head:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.4); }
.ldb-chevron { display: inline-flex; color: var(--muted); flex-shrink: 0; transition: transform var(--motion-base) var(--motion-ease); }
.is-collapsible.is-collapsed > .ldb-head { margin-bottom: 0; }
.is-collapsible.is-collapsed > .ldb-head .ldb-chevron { transform: rotate(-90deg); }
.is-collapsible.is-collapsed > .ldb-body { display: none; }
/* Header "Partita": chevron a sinistra (evita la X di chiusura in alto a destra). */
.live-detail-head.is-collapsible > .ldb-head { justify-content: flex-start; }
.live-detail-head.is-collapsible > .ldb-head .eyebrow { color: var(--muted-strong); }
.ctx-label-text { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.live-detail-subhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.live-detail-subhead > .eyebrow { margin: 0; }
.live-proxy-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(var(--warning-rgb), 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
/* Momentum bidirezionale (SVG inline, mockup): su = casa (accent), giù = trasferta (info). */
.live-detail-subhead-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.mom-legend { display: flex; align-items: center; gap: 14px; font-size: 0.74rem; color: var(--muted-strong); }
.mom-legend[hidden] { display: none; }
.mom-legend-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.mom-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.mom-dot--home { background: var(--accent); }
.mom-dot--away { background: var(--info); }
.live-momentum-chart { margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(4, 8, 14, 0.34); }
.live-momentum-chart[hidden] { display: none; }
.live-momentum-bars { display: block; width: 100%; height: auto; }
.live-momentum-bars .mom-zone--home { fill: rgba(var(--accent-bright-rgb), 0.16); }
.live-momentum-bars .mom-zone--away { fill: rgba(var(--info-rgb), 0.16); }
.live-momentum-bars .mom-unplayed { fill: rgba(var(--line-rgb), 0.05); }
/* Zona pre-copertura (0' -> primo minuto coperto): tratteggio diagonale tenue, distinto
   dal velo "non giocato" a destra - il buco iniziale si legge come "dati non
   disponibili", non come zero pressione. Il rect usa fill="url(#momPrecovHatch)". */
.live-momentum-bars .mom-precov-line { stroke: rgba(var(--line-rgb), 0.35); stroke-width: 1; }
.live-momentum-bars .mom-base { stroke: var(--line-strong); stroke-width: 1.25; }
.live-momentum-bars .mom-grid { stroke: var(--line); stroke-width: 0.6; opacity: 0.42; }
.live-momentum-bars .mom-ht { stroke: var(--muted); stroke-width: 1; opacity: 0.7; stroke-dasharray: 4 3; }
.live-momentum-bars .spark-up { fill: var(--accent); }
.live-momentum-bars .spark-down { fill: var(--info); }
.live-momentum-bars .mom-axis { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
/* Marker gol: pallina colorata per squadra (casa=accent-bright, trasferta=info) + pentagono bianco. */
.live-momentum-bars .mom-goal-line,
.odds-trend-bars .mom-goal-line,
.edge-chart .mom-goal-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.5; }
.live-momentum-bars .mom-goal-dot,
.odds-trend-bars .mom-goal-dot,
.edge-chart .mom-goal-dot { fill: var(--muted); stroke: var(--line-strong); stroke-width: 1.4; }
.live-momentum-bars .mom-goal-pent,
.odds-trend-bars .mom-goal-pent,
.edge-chart .mom-goal-pent { fill: rgba(255,255,255,0.85); }
/* Casa = accent-bright (cyan), trasferta = info (indigo): colore su pallina + linea guida. */
.live-momentum-bars .mom-goal--home .mom-goal-dot,
.odds-trend-bars .mom-goal--home .mom-goal-dot,
.edge-chart .mom-goal--home .mom-goal-dot { fill: var(--accent-bright); stroke: var(--accent-bright); }
.live-momentum-bars .mom-goal--home .mom-goal-line,
.odds-trend-bars .mom-goal--home .mom-goal-line,
.edge-chart .mom-goal--home .mom-goal-line { stroke: var(--accent-bright); opacity: 0.72; }
.live-momentum-bars .mom-goal--away .mom-goal-dot,
.odds-trend-bars .mom-goal--away .mom-goal-dot,
.edge-chart .mom-goal--away .mom-goal-dot { fill: var(--info); stroke: var(--info); }
.live-momentum-bars .mom-goal--away .mom-goal-line,
.odds-trend-bars .mom-goal--away .mom-goal-line,
.edge-chart .mom-goal--away .mom-goal-line { stroke: var(--info); opacity: 0.72; }
/* Cartellino rosso (rettangolino nella corsia alta + linea guida). Non scoped al
   grafico così vale anche nel grafico edge Momentum-vs-Mercato. */
.mom-card-rect { fill: var(--danger); stroke: rgba(4, 8, 14, 0.85); stroke-width: 1; }
.mom-card-line { stroke: var(--danger); stroke-width: 1.4; stroke-dasharray: 2 2; opacity: 0.7; }
/* Linea "adesso" sul minuto corrente (stile SofaScore). */
.live-momentum-bars .mom-now { stroke: var(--warning); stroke-width: 1.5; }
.live-momentum-bars .mom-now-dot { fill: var(--warning); }
/* Puntini indicatori: un dot colorato (colore per-indicatore) al minuto di attivazione,
   con una linea-guida verticale che lo àncora al minuto preciso (stesso linguaggio dei
   marker gol). Il fill/stroke colore arriva inline dalla mappa colori. */
.live-momentum-bars .mom-ind-guide { stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.55; }
.live-momentum-bars .mom-ind-dot { stroke: rgba(4, 8, 14, 0.9); stroke-width: 1.4; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.55)); }
/* Cursore dello scrubber: guida tratteggiata al minuto selezionato (distinta dalla
   linea "adesso" piena). */
.live-momentum-bars .mom-cursor,
.edge-chart .mom-cursor { stroke: var(--muted-strong); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.72; }
/* Stemmi delle squadre a lato del grafico: logo nel cerchio o iniziali di ripiego. */
/* Stemmi a lato: logo "nudo" (niente sfondo/cornice); solo le iniziali di ripiego
   quando il logo manca. */
.live-momentum-bars .mom-crest-initials,
.edge-chart .mom-crest-initials { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.mom-method { margin: 7px 2px 0; color: var(--muted-strong); font-size: 0.8rem; line-height: 1.5; }
/* Grafico edge Momentum-vs-Mercato (Punto 5): UNA serie firmata ad area rispetto alla
   mezzeria (casa=accent sopra, trasferta=info sotto — stesso linguaggio del momentum),
   guide di soglia ±threshold, fasce evidenti sui minuti di value (l'area lì è a piena
   saturazione), linea mercato tratteggiata come riferimento. */
.edge-chart-wrap { width: 100%; }
.edge-line { stroke: var(--accent-bright); stroke-width: 2.4; fill: none; }
.edge-src { stroke-width: 1; opacity: 0.35; fill: none; }
.edge-src--mkt { stroke: var(--muted); stroke-dasharray: 3 3; }
.edge-area { opacity: 0.22; }
.edge-area--home { fill: var(--accent); }
.edge-area--away { fill: var(--info); }
.edge-area-value { opacity: 0.62; }
.edge-area-value--home { fill: var(--accent); }
.edge-area-value--away { fill: var(--info); }
.edge-window { opacity: 0.30; }
.edge-window--home { fill: var(--accent); }
.edge-window--away { fill: var(--info); }
.edge-th { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.55; }
.edge-th-label { fill: var(--muted); font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.03em; text-transform: uppercase; }
.edge-chart .mom-axis { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.edge-chart .mom-ht { stroke: var(--muted); stroke-width: 1; opacity: 0.7; stroke-dasharray: 4 3; }
.edge-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 13px; font-size: 0.72rem; color: var(--muted); }
.edge-legend-item { display: inline-flex; align-items: center; gap: 6px; }
/* Swatch della legenda: linee (mercato/soglia) come barrette tratteggiate, aree edge
   come tessere colorate. */
.edge-key { display: inline-block; flex: none; width: 16px; height: 3px; border-radius: 2px; }
.edge-key--mkt { height: 0; background: none; border-radius: 0; border-top: 2px dashed var(--muted); }
.edge-key--th { height: 0; background: none; border-radius: 0; border-top: 1px dashed var(--muted); opacity: 0.8; }
.edge-key--home, .edge-key--away { width: 14px; height: 11px; border-radius: 3px; opacity: 0.34; }
.edge-key--home { background: var(--accent); }
.edge-key--away { background: var(--info); }
/* Etichette di lato nel grafico (casa sopra / trasferta sotto). */
.edge-side { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.03em; text-transform: uppercase; fill: var(--muted); }
.edge-side--home { fill: var(--accent); }
.edge-side--away { fill: var(--info); }
/* Variante Over/Under dell'edge: stessi swatch/opacità, poli Over (ambra "caldo",
   sopra) / Under (indaco "freddo", sotto). Solo il fill cambia; l'opacità la danno
   le classi base .edge-area / .edge-area-value / .edge-window. */
.edge-area--over, .edge-area-value--over, .edge-window--over { fill: var(--warning); }
.edge-area--under, .edge-area-value--under, .edge-window--under { fill: var(--info); }
.edge-key--over, .edge-key--under { width: 14px; height: 11px; border-radius: 3px; opacity: 0.34; }
.edge-key--over { background: var(--warning); }
.edge-key--under { background: var(--info); }
.edge-side--over { fill: var(--warning); }
.edge-side--under { fill: var(--info); }
.edge-chart .mom-base { stroke: var(--line-strong); stroke-width: 1; }
/* Keyframe di lampeggio dei segnali attivi — usata dalle chip sulle tile del match
   wall (.mw-tile.is-hot; rispetta prefers-reduced-motion nel blocco del wall). */
@keyframes live-hot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Possession track (stile 1: barra casa/trasferta) — sotto il grafico momentum ── */
.live-control-track { margin: 8px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.live-control-track[hidden] { display: none; }
.live-control-head { margin: 0 2px 8px; }
.live-control-head .ctrl-eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-strong); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }
.live-control-head .ctrl-eyebrow .li-icon { color: var(--accent); }
.poss-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.poss-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.82rem; font-weight: 700; width: 40px; flex-shrink: 0; }
.poss-val--home { color: var(--accent); }
.poss-val--away { color: var(--info); text-align: right; }
.poss-track { flex: 1; display: flex; height: 16px; border-radius: 6px; overflow: hidden; gap: 2px; background: rgba(var(--line-rgb), 0.1); }
.poss-seg { height: 100%; transition: width var(--motion-base) var(--motion-ease); }
.poss-seg--home { background: var(--accent); }
.poss-seg--away { background: var(--info); }
.poss-names { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }

/* ── Timeline "Segnali attivati" — sotto il grafico momentum ───────────────── */
.live-signals-timeline { margin: 8px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.live-signals-timeline[hidden] { display: none; }
.live-signals-timeline .live-control-head { display: flex; align-items: center; justify-content: space-between; }
.sigtl-head-meta { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sigtl-count {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; color: var(--muted-strong);
  background: rgba(var(--line-rgb), 0.12); border-radius: var(--radius-pill); padding: 1px 8px;
}
/* Lista scrollabile internamente quando lunga (header sopra; niente pagina allungata). */
.sigtl-list { display: flex; flex-direction: column; gap: 2px; max-height: 168px; overflow-y: auto; }
.sigtl-row {
  display: grid; grid-template-columns: 2.4rem 10px 1fr auto; align-items: center; gap: 8px;
  padding: 4px 2px; border-radius: 6px;
}
.sigtl-row:hover { background: rgba(var(--line-rgb), 0.06); }
.sigtl-min { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--muted-strong); font-variant-numeric: tabular-nums; }
.sigtl-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sigtl-label { font-size: 0.8rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sigtl-score { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Odds trend chart (1X2 over time, log Y) ──────────────────────── */
.odds-trend-wrap { margin-top: 14px; }
.odds-trend-wrap[hidden] { display: none; }
.odds-trend-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
.odds-trend-title { color: var(--muted-strong); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }
.odds-trend-legend { display: inline-flex; align-items: center; gap: 12px; font-size: 0.74rem; color: var(--muted-strong); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.otrend-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.otrend-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.odds-trend-chart { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(4, 8, 14, 0.34); }
.odds-trend-chart[hidden] { display: none; }
.odds-trend-bars { display: block; width: 100%; height: auto; }
.otrend-line { stroke-width: 1.7; fill: none; }
.otrend-line--home, .otrend-dot--home { stroke: var(--accent); }
.otrend-line--draw, .otrend-dot--draw { stroke: var(--warning); }
.otrend-line--away, .otrend-dot--away { stroke: var(--info); }
/* Grafico Over: 4 mercati separati (0.5/1.5/2.5/3.5), colori distinti dal 1X2 (i due
   grafici non sono mai visibili insieme, ma i colori restano coerenti col resto dell'app). */
.otrend-line--over_05, .otrend-dot--over_05 { stroke: var(--success); }
.otrend-line--over_15, .otrend-dot--over_15 { stroke: var(--accent-bright); }
.otrend-line--over_25, .otrend-dot--over_25 { stroke: var(--warning); }
.otrend-line--over_35, .otrend-dot--over_35 { stroke: var(--magenta); }
/* Coda "mercato sospeso": stesso colore della selezione, ma tratteggiata e attenuata,
   per distinguere l'ultimo prezzo noto da una quota reale tradeable. */
.otrend-line--suspended { stroke-dasharray: 3 3; opacity: 0.45; }
/* Coda "linea già decisa" (solo grafico Over): l'esito è già matematicamente certo dal
   punteggio corrente (es. Over 0.5 dopo il primo gol) — la quota resta reale/attendibile,
   semplicemente non più interessante da leggere come prezzo "in movimento". Tratteggio
   diverso da --suspended sopra: qui la quota non è in dubbio, è solo decisa. */
.otrend-line--locked { stroke-dasharray: 6 3; opacity: 0.55; }
.otrend-legend-item--locked { opacity: 0.7; }
.otrend-legend-locked-tag { color: var(--muted); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; }
.otrend-dot--home { fill: var(--accent); }
.otrend-dot--draw { fill: var(--warning); }
.otrend-dot--away { fill: var(--info); }
.otrend-dot--over_05 { fill: var(--success); }
.otrend-dot--over_15 { fill: var(--accent-bright); }
.otrend-dot--over_25 { fill: var(--warning); }
.otrend-dot--over_35 { fill: var(--magenta); }
.otrend-dot { stroke: none; }
.otrend-legend-item .otrend-dot--home { background: var(--accent); }
.otrend-legend-item .otrend-dot--draw { background: var(--warning); }
.otrend-legend-item .otrend-dot--away { background: var(--info); }
.otrend-legend-item .otrend-dot--over_05 { background: var(--success); }
.otrend-legend-item .otrend-dot--over_15 { background: var(--accent-bright); }
.otrend-legend-item .otrend-dot--over_25 { background: var(--warning); }
.otrend-legend-item .otrend-dot--over_35 { background: var(--magenta); }
.odds-trend-empty { margin: 8px 2px 0; }

/* ── Periodo (Tutti/1°/2°) + scrubber del grafico quote ───────────── */
.otrend-period { display: inline-flex; gap: 4px; margin: 0 2px 8px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(4, 8, 14, 0.28); }
.otrend-period[hidden] { display: none; }
.otrend-period-btn { appearance: none; border: 0; background: transparent; color: var(--muted-strong); font-size: 0.72rem; font-family: var(--font-mono); letter-spacing: 0.02em; padding: 4px 10px; border-radius: calc(var(--radius-md) - 3px); cursor: pointer; transition: background 0.12s ease, color 0.12s ease; }
.otrend-period-btn:hover { color: var(--ink); }
.otrend-period-btn.is-active { background: var(--accent-soft); color: var(--accent-bright); }

/* Controlli colonna "Movimento" della tabella quote: riga riferimento (Kickoff/Finestra)
   + sotto-riga finestra (base Gioco/Orologio + 3 preset durata, doppio-click per editarli). */
.odds-move-controls { margin: 4px 2px 2px; display: flex; flex-direction: column; gap: 6px; }
.odds-move-controls[hidden] { display: none; }
.odds-move-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.odds-move-row.odds-move-window[hidden] { display: none; }
.odds-move-label { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-strong); }
.odds-move-window { padding-left: 8px; }
.odds-move-presets .otrend-period-btn { min-width: 34px; text-align: center; }
.otrend-scrub { margin: 9px 2px 0; display: flex; flex-direction: column; gap: 7px; }
.otrend-scrub[hidden] { display: none; }
.otrend-range { width: 100%; accent-color: var(--accent); cursor: pointer; }
.otrend-readout { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.otrend-ro-min { color: var(--ink); font-weight: 700; font-size: 0.8rem; min-width: 34px; }
.otrend-ro-cell { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 8px; border-radius: 999px; background: rgba(var(--line-rgb), 0.14); }
.otrend-ro-sel { font-weight: 700; font-size: 0.7rem; }
.otrend-ro-cell--home .otrend-ro-sel { color: var(--accent); }
.otrend-ro-cell--draw .otrend-ro-sel { color: var(--warning); }
.otrend-ro-cell--away .otrend-ro-sel { color: var(--info); }
.otrend-ro-cell--over_05 .otrend-ro-sel { color: var(--success); }
.otrend-ro-cell--over_15 .otrend-ro-sel { color: var(--accent-bright); }
.otrend-ro-cell--over_25 .otrend-ro-sel { color: var(--warning); }
.otrend-ro-cell--over_35 .otrend-ro-sel { color: var(--magenta); }
.otrend-ro-odd { color: var(--ink); font-size: 0.8rem; }
.ld-scrub-label { color: var(--muted-strong); font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.74rem; }
.otrend-cursor { stroke: var(--muted-strong); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.65; }
.otrend-cursor-dot { stroke: rgba(4, 8, 14, 0.6); stroke-width: 1; }
.otrend-cursor-dot--home { fill: var(--accent); }
.otrend-cursor-dot--draw { fill: var(--warning); }
.otrend-cursor-dot--away { fill: var(--info); }

/* ── Detail context header (predictions + standings, on-demand) ───── */
.live-detail-context { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 8px; }
.live-detail-context[hidden] { display: none; }
.live-detail-context .ctx-block { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(4, 8, 14, 0.28); }
.live-detail-context .ctx-label { display: flex; align-items: center; gap: 6px; color: var(--muted-strong); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 9px; }
.live-detail-context .ctx-label .li-icon { color: var(--accent); }

/* Pronostico: tris di esiti 1·X·2 (tile stile lavagna) + consiglio */
.otiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.otile { background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px 10px; }
.otile.is-fav { border-color: var(--accent-bright); border-width: 2px; padding: 8px 9px; }
.otile-top { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.otile-badge { width: 18px; height: 18px; border-radius: 5px; background: rgba(var(--line-rgb), 0.16); color: var(--muted-strong); font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.otile.is-fav .otile-badge { background: var(--accent); color: #04222c; }
.otile-team { font-size: 0.74rem; color: var(--muted-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otile-pct { font-family: 'Bebas Neue', 'Barlow Condensed', sans-serif; font-size: 1.5rem; line-height: 1; color: var(--ink); }
.otile-fill { margin-top: 7px; height: 4px; border-radius: 3px; background: rgba(var(--line-rgb), 0.12); overflow: hidden; }
.otile-fill span { display: block; height: 100%; border-radius: 3px; }
.otile--home .otile-fill span { background: var(--accent); }
.otile--draw .otile-fill span { background: var(--muted); }
.otile--away .otile-fill span { background: var(--info); }
.ctx-advice { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: var(--warning-soft); border: 1px solid rgba(var(--warning-rgb), 0.25); font-size: 0.76rem; line-height: 1.45; color: #e7d2a6; }
.ctx-advice .li-icon { color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.ctx-advice b { color: #f0dcab; margin-right: 5px; }

/* Classifica: riga squadra con posizione + forma a pill */
.ctx-team-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin-bottom: 8px; }
.ctx-team-row:last-of-type { margin-bottom: 0; }
.ctx-team-name { font-size: 0.84rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-rank { font-family: 'Bebas Neue', 'Barlow Condensed', sans-serif; font-size: 1.35rem; line-height: 1; color: var(--accent); }
.ctx-rank sup { font-size: 0.6rem; color: var(--muted); }
.ctx-form { display: flex; gap: 4px; }
.ctx-form-empty { color: var(--muted); }
.form-pill { width: 19px; height: 19px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; }
.form-pill.fp--w { background: rgba(var(--success-rgb), 0.16); color: #7fd6a0; }
.form-pill.fp--d { background: rgba(var(--warning-rgb), 0.16); color: #e0bd7e; }
.form-pill.fp--l { background: rgba(var(--danger-rgb), 0.16); color: #e89a9d; }
.ctx-foot { display: block; margin-top: 9px; font-size: 0.72rem; color: var(--muted); }

/* ── Precedenti e forma (H2H + ultime partite, SofaScore-style) ──── */
.live-detail-h2h { margin: 2px 0 8px; }
.live-detail-h2h[hidden] { display: none; }
.h2h-block { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(4, 8, 14, 0.28); }
.h2h-block .ctx-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted-strong); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 9px; cursor: pointer; }
.h2h-block .ctx-label .li-icon { color: var(--accent); }
.h2h-block .ldb-body { display: flex; flex-direction: column; gap: 14px; }
.h2h-sub-title { margin: 0 0 7px; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.h2h-summary { font-size: 0.76rem; color: var(--muted-strong); margin-bottom: 8px; line-height: 1.45; }
.h2h-sum-goals { color: var(--accent); }
.h2h-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.h2h-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 8px; background: rgba(8, 12, 20, 0.4); font-size: 0.8rem; }
.h2h-out { width: 19px; height: 19px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; flex-shrink: 0; }
.h2h-out--na { background: rgba(var(--line-rgb), 0.16); color: var(--muted); }
.h2h-meet { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.h2h-meet b { color: var(--ink); font-family: var(--font-mono); }
.h2h-date { color: var(--muted); font-size: 0.72rem; font-family: var(--font-mono); white-space: nowrap; }
.h2h-score { color: var(--ink); font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.h2h-venue { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 4px; margin-right: 6px; font-size: 0.58rem; font-weight: 700; background: rgba(var(--accent-rgb), 0.16); color: var(--accent); }
.h2h-venue--away { background: rgba(var(--info-rgb), 0.16); color: var(--info); }
.h2h-recent { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.h2h-recent-name { margin: 0 0 6px; font-size: 0.78rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .h2h-recent { grid-template-columns: 1fr; } }

/* ── Analisi (matrice Poisson + narrativa deterministica, no LLM) ──── */
.live-detail-analysis[hidden] { display: none; }
.live-analysis-block .ldb-body { display: flex; flex-direction: column; gap: 13px; }
.pmatrix-wrap { overflow-x: auto; }
/* table-layout fixed + width 100% → le 6 colonne si dividono la larghezza del pannello
   e non sforano mai (niente colonna tagliata); border-spacing dà la griglia a celle. */
.pmatrix { border-collapse: separate; border-spacing: 2px; width: 100%; table-layout: fixed; font-variant-numeric: tabular-nums; }
.pmatrix-cap { caption-side: top; text-align: left; color: var(--muted); font-size: 0.63rem; letter-spacing: 0.02em; line-height: 1.3; margin-bottom: 8px; }
.pmatrix th { color: var(--muted-strong); font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; padding: 2px; text-align: center; }
.pmatrix thead th:first-child, .pmatrix tbody th { width: 20px; color: var(--muted); }
.pmatrix-cell { text-align: center; padding: 6px 2px; font-size: 0.62rem; color: var(--ink); border-radius: 4px; border: 1px solid rgba(var(--accent-rgb), 0.12); }
.pmatrix-cell.is-top { box-shadow: inset 0 0 0 2px var(--accent-bright); font-weight: 700; }
/* Top-5 risultati esatti sotto la matrice (0053). */
.pmatrix-top-wrap { margin-top: 10px; }
.pmatrix-top-title { display: block; color: var(--muted); font-size: 0.63rem; letter-spacing: 0.02em; margin-bottom: 5px; }
.pmatrix-top { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pmatrix-top li { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 8px; border-radius: 999px; background: rgba(var(--accent-rgb), 0.1); border: 1px solid rgba(var(--accent-rgb), 0.16); }
.pmatrix-top-score { font-weight: 700; font-size: 0.72rem; color: var(--ink); }
.pmatrix-top-pct { font-size: 0.62rem; color: var(--muted-strong); }
/* Analisi lay "altro risultato" (goleada) nel drawer screening. */
.lay-score-row { display: flex; gap: 10px; margin-bottom: 10px; }
.lay-score-card { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: rgba(var(--accent-rgb), 0.06); border: 1px solid rgba(var(--accent-rgb), 0.14); }
.lay-score-card.is-active { border-color: var(--accent-bright); box-shadow: inset 0 0 0 1px var(--accent-bright); }
.lay-score-team { font-size: 0.7rem; color: var(--muted-strong); font-weight: 600; }
.lay-score-val { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.lay-score-cap { font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.lay-edge { color: var(--muted-strong); margin: 2px 0 8px; }
.lay-edge-none { color: var(--muted); font-style: italic; margin: 2px 0 8px; }
/* Lay "altro risultato": strip quote per lato - quota giusta (modello) vs reale
   (Betfair) + edge evidenziato (verde value / rosso contro). */
.lay-quote-strip { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(var(--accent-rgb), 0.14); }
.lay-quote-item { display: flex; flex-direction: column; gap: 1px; }
.lay-quote-k { font-size: 0.55rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lay-quote-v { font-size: 0.92rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.lay-quote-edge.pos .lay-quote-v { color: var(--success); }
.lay-quote-edge.neg .lay-quote-v { color: var(--danger); }
/* Esito 1X2 (favorito del modello) sopra la matrice: barra proporzionale + legenda,
   cosi' l'1-1 modale non si legge come "previsione pareggio". */
.o1x2 { margin: 10px 0 4px; }
.o1x2-head { font-size: 0.63rem; color: var(--muted); letter-spacing: 0.02em; margin-bottom: 5px; }
.o1x2-hint { font-style: italic; }
.o1x2-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface); }
.o1x2-fill { display: block; height: 100%; }
.o1x2-fill.home { background: rgba(var(--accent-rgb), 0.85); }
.o1x2-fill.draw { background: var(--muted); }
.o1x2-fill.away { background: rgba(var(--warning-rgb), 0.8); }
.o1x2-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.o1x2-item { font-size: 0.72rem; color: var(--muted-strong); }
.o1x2-item b { color: var(--ink); font-variant-numeric: tabular-nums; }
.o1x2-item.is-fav { color: var(--ink); font-weight: 700; }
.o1x2-item.home.is-fav b { color: var(--accent-bright); }
.la-section { display: flex; flex-direction: column; gap: 3px; }
.la-section-title { margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-strong); }
.la-section-body { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--ink); }
.la-note { margin: 0; font-size: 0.82rem; color: var(--muted-strong); }
.la-disclaimer { margin: 2px 0 0; font-size: 0.72rem; color: var(--muted); font-style: italic; }

/* ── Analisi: card strutturata (barra 1X2 + chip + forma + confronto) ──
   Colori esiti coerenti col resto del dettaglio: casa = accent (teal, come il
   momentum "su"), trasferta = info (indigo, momentum "giù"), pareggio = neutro. */
.an-bar { display: flex; flex-direction: column; gap: 6px; }
.an-bar-labels { display: flex; }
.an-bar-lab { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; overflow: hidden; font-size: 0.72rem; color: var(--muted-strong); white-space: nowrap; }
.an-bar-name { overflow: hidden; text-overflow: ellipsis; }
.an-bar-pct { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.an-bar-track { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; background: rgba(var(--line-rgb), 0.12); }
.an-bar-seg--home { background: rgba(var(--accent-rgb), 0.85); }
.an-bar-seg--draw { background: rgba(var(--line-rgb), 0.4); }
.an-bar-seg--away { background: rgba(var(--info-rgb), 0.85); }
.an-bar-seg + .an-bar-seg { border-left: 2px solid rgba(4, 8, 14, 0.6); }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chip { padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: rgba(8, 12, 20, 0.5); font-size: 0.72rem; color: var(--muted-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.form-pill.is-last { box-shadow: 0 0 0 1.5px currentColor; }
.an-cmp { display: flex; flex-direction: column; gap: 9px; }
.an-cmp-row { display: grid; grid-template-columns: 2.6rem 1fr 2.6rem; align-items: center; gap: 8px; }
.an-cmp-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.78rem; }
.an-cmp-val--home { text-align: right; color: var(--accent); }
.an-cmp-val--away { text-align: left; color: var(--info); }
.an-cmp-mid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.an-cmp-label { text-align: center; font-size: 0.7rem; color: var(--muted-strong); }
.an-cmp-bars { display: flex; gap: 2px; }
.an-cmp-side { flex: 1; height: 6px; border-radius: 3px; background: rgba(var(--line-rgb), 0.12); overflow: hidden; display: flex; }
.an-cmp-side--home { justify-content: flex-end; }
.an-cmp-seg { display: block; height: 100%; border-radius: 3px; }
.an-cmp-seg--home { background: rgba(var(--accent-rgb), 0.85); }
.an-cmp-seg--away { background: rgba(var(--info-rgb), 0.85); }
.an-synthesis { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--ink); }

/* ── Comparative stats (SofaScore-style mirrored bars) ────────────── */
/* Sotto-etichetta del blocco statistiche, ora unito sotto il grafico momentum:
   un divisore sottile lo separa dall'onda. */
.live-stats-eyebrow { margin: 16px 2px 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.live-detail-stats { display: flex; flex-direction: column; gap: 16px; }
.cmp-row { display: flex; flex-direction: column; gap: 6px; }
.cmp-row-head { display: grid; grid-template-columns: 4rem 1fr 4rem; align-items: center; gap: 10px; }
.cmp-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); font-size: 0.92rem; }
.cmp-home { text-align: right; }
.cmp-away { text-align: left; }
.cmp-label { text-align: center; color: var(--muted-strong); font-size: 0.78rem; }
/* Tracce speculari: casa ancorata al centro da sinistra, ospite dal centro verso
   destra. Il piccolo gap centrale rende immediato il confronto dei due lati. */
.cmp-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp-side { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(var(--line-rgb), 0.16); }
.cmp-side--home { justify-content: flex-end; }
.cmp-side--away { justify-content: flex-start; }
.cmp-seg { height: 100%; display: block; transition: width var(--motion-base) var(--motion-ease); border-radius: inherit; }
.cmp-seg--home { background: var(--accent); }
.cmp-seg--away { background: var(--info); }
.cmp-bars--nodata .cmp-seg { background: rgba(var(--line-rgb), 0.2); }

/* ── Context odds ─────────────────────────────────────────────────── */
.live-detail-odds { display: flex; flex-direction: column; gap: 12px; }

/* ── Mercato in-play (Fase 5): volume + badge R8 (riusati dal blocco unificato) ── */
.mkt-badge {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 999px; margin-left: 6px;
}
.mkt-badge.is-ok { color: var(--success); background: var(--success-soft); }
.mkt-badge.is-warn { color: var(--warning); background: var(--warning-soft); }
.mkt-vol { font-size: 0.72rem; color: var(--muted-strong); font-family: var(--font-mono); }

/* ── Unified odds block (back/lay/drop per outcome — solo quote) ─────────── */
.odds-unified {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden;
  background: rgba(4, 8, 14, 0.3);
}
/* Header row */
.uodds-head {
  display: grid; grid-template-columns: 1.4rem 1fr;
  gap: 0 8px; align-items: center;
  padding: 5px 10px 4px; border-bottom: 1px solid var(--line);
  font-size: 0.63rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.odds-unified.has-market .uodds-head {
  grid-template-columns: 1.4rem 1fr 1fr 3.2rem;
}
.uodds-h { text-align: right; }
.uodds-hback { color: var(--bf-back); }
.uodds-hlay  { color: var(--bf-lay); }
/* Data rows */
.uodds-row {
  display: grid; grid-template-columns: 1.4rem 1fr;
  gap: 0 8px; align-items: center;
  padding: 7px 10px;
}
.odds-unified.has-market .uodds-row {
  grid-template-columns: 1.4rem 1fr 1fr 3.2rem;
}
.uodds-row--home { background: rgba(var(--accent-rgb), 0.04); }
/* Outcome label */
.uodds-sel {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.88rem;
  color: var(--muted-strong);
}
.uodds-row--home .uodds-sel { color: var(--accent); }
.uodds-row--draw .uodds-sel { color: var(--warning); }
.uodds-row--away .uodds-sel { color: var(--info); }
/* Back / Lay / Drop values */
.uodds-back {
  text-align: right; font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  color: var(--bf-back); font-variant-numeric: tabular-nums;
}
.uodds-lay {
  text-align: right; font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  color: var(--bf-lay); font-variant-numeric: tabular-nums;
}
.uodds-drop {
  text-align: right; font-family: var(--font-mono); font-weight: 600; font-size: 0.78rem;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.uodds-drop.is-down { color: var(--success); }
.uodds-drop.is-up   { color: var(--danger); }
/* Footer (volume + badge) */
.uodds-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

/* ── Vista "Finestra": tutte le finestre (preset) a confronto ─────────────── */
/* Colonne dinamiche (Back [+Lay] + N finestre) via --ucols, così header e righe
   restano allineate; min-width: max-content + overflow-x → scroll sui pannelli
   stretti invece di schiacciare le colonne. */
.odds-unified--win { overflow-x: auto; }
.odds-unified.odds-unified--win .uodds-head,
.odds-unified.odds-unified--win .uodds-row {
  grid-template-columns: var(--ucols);
  min-width: max-content;
}
/* Chip minuti editabile nell'header (doppio click → modifica la durata) */
.uodds-winh {
  justify-self: end; min-width: 0; padding: 1px 7px;
  font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.5; cursor: pointer;
}
/* Cella finestra: quota di riferimento (da quanto partiva) sopra il movimento */
.uodds-win {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  text-align: right; font-variant-numeric: tabular-nums;
}
.uodds-win-ref {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem; color: var(--bf-back);
}
.uodds-win-d {
  font-family: var(--font-mono); font-weight: 600; font-size: 0.68rem; color: var(--muted);
}
.uodds-win-d.is-down { color: var(--success); }
.uodds-win-d.is-up   { color: var(--danger); }
/* Hint sotto i controlli Movimento (rimpiazza la vecchia riga di preset) */
.odds-move-hint { font-size: 0.66rem; color: var(--muted); line-height: 1.4; }

/* ── Odds trend chart extras ─────────────────────────────────────────────── */
.otrend-grid { stroke: rgba(var(--line-rgb), 0.3); stroke-width: 1; stroke-dasharray: 3 5; }
.otrend-grid-label { font-size: 9px; fill: var(--muted); font-family: var(--font-mono); }
.odds-trend-bars--odds .otrend-line { stroke-width: 2; }

/* ── Indicatori Live — locked state ───────────────────────────────── */
.live-locked-card {
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 48px 32px;
  max-width: 480px;
  margin: 12px auto;
  justify-items: center;
}
.live-locked-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.2);
}
.live-locked-icon svg { width: 26px; height: 26px; }
.live-locked-card .empty-state { max-width: 38ch; }

/* ── Indicatori Live — master-detail (lista + editor) ─────────────── */
.ind2-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.ind2-rail { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ind2-rail-head { padding: 16px 16px 13px; border-bottom: 1px solid var(--line); }
.ind2-rail-head .section-copy h2 { margin: 0 0 2px; }
.ind2-rail-head .section-copy p { margin: 0 0 12px; font-size: 0.78rem; color: var(--muted); }
.ind2-search { position: relative; margin-bottom: 10px; }
.ind2-search .li-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ind2-search input { width: 100%; height: 38px; padding: 0 12px 0 34px; color: var(--ink); background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); font: inherit; font-size: 0.84rem; transition: border-color var(--motion-fast) var(--motion-ease); }
.ind2-search input::placeholder { color: var(--muted); }
.ind2-search input:focus { outline: none; border-color: rgba(var(--accent-bright-rgb), 0.45); }
.ind2-new { width: 100%; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed rgba(var(--accent-bright-rgb), 0.4); border-radius: var(--radius-md); background: rgba(var(--accent-bright-rgb), 0.06); color: var(--accent-bright); font: inherit; font-weight: 700; font-size: 0.84rem; cursor: pointer; transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease); }
.ind2-new:hover { background: rgba(var(--accent-bright-rgb), 0.12); border-color: var(--accent-bright); }

.ind2-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.ind2-list::-webkit-scrollbar { width: 8px; }
.ind2-list::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 8px; }
.ind2-group { display: flex; align-items: center; gap: 8px; padding: 12px 8px 7px; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.ind2-group-count { margin-left: auto; color: var(--muted-strong); background: rgba(var(--line-rgb), 0.1); padding: 1px 7px; border-radius: var(--radius-pill); letter-spacing: 0.04em; }
.ind2-empty { padding: 4px 9px 10px; font-size: 0.78rem; color: var(--muted); }

.ind2-item { position: relative; width: 100%; text-align: left; display: grid; grid-template-columns: 3px minmax(0, 1fr) auto auto; gap: 0 11px; align-items: center; padding: 10px 11px 10px 12px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; margin-bottom: 2px; transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease); }
.ind2-item:hover { background: rgba(var(--line-rgb), 0.05); }
.ind2-item.is-selected { background: var(--accent-soft); border-color: rgba(var(--accent-bright-rgb), 0.3); }
.ind2-item-rail { grid-row: 1 / span 2; align-self: stretch; border-radius: var(--radius-pill); background: var(--line-strong); }
.ind2-item.is-on .ind2-item-rail { background: var(--success); }
.ind2-item-main { min-width: 0; }
.ind2-item-top { display: flex; align-items: center; gap: 8px; }
.ind2-item-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind2-item.is-off .ind2-item-name { color: var(--muted-strong); }
.ind2-live { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; color: var(--success); background: rgba(var(--success-rgb), 0.12); padding: 2px 7px; border-radius: var(--radius-pill); }
.ind2-live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); animation: ind2blip 1.8s var(--motion-ease) infinite; }
@keyframes ind2blip { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.ind2-tag { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.ind2-item-logic { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.ind2-lchip { font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted-strong); background: rgba(var(--line-rgb), 0.08); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.ind2-lchip.is-market { color: var(--warning); background: rgba(var(--warning-rgb), 0.1); }
.ind2-lchip.is-gate { color: var(--muted); }
.ind2-lchip.is-predict { color: var(--accent); background: var(--accent-soft); }
.ind2-lchip.is-more { color: var(--accent-bright); }
.ind2-item-sw { flex-shrink: 0; }
.ind2-item-sw .ind-switch-track { width: 34px; height: 19px; }
.ind2-item-sw .ind-switch-thumb { width: 13px; height: 13px; }
.ind2-item-sw input:checked + .ind-switch-track { background: rgba(var(--success-rgb), 0.18); border-color: rgba(var(--success-rgb), 0.5); }
.ind2-item-sw input:checked + .ind-switch-track .ind-switch-thumb { transform: translateX(15px); background: var(--success); }

/* detail panel */
.ind2-detail { padding: 18px 20px 20px; min-height: 520px; }
.ind2-headwrap { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ind2-title-static { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.55rem; letter-spacing: 0.01em; color: var(--ink); }
.ind2-title-input { width: 100%; background: transparent; border: none; border-bottom: 1px solid transparent; color: var(--ink); font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.55rem; letter-spacing: 0.01em; padding: 2px 0; transition: border-color var(--motion-fast) var(--motion-ease); }
.ind2-title-input:focus { outline: none; border-bottom-color: rgba(var(--accent-bright-rgb), 0.5); }
.ind2-dup { color: var(--muted-strong); }
.ind2-dup:hover { color: var(--accent-bright); }

.ind2-nl { font-size: 0.86rem; line-height: 1.55; color: var(--muted-strong); background: rgba(8, 12, 20, 0.4); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 10px 13px; margin: 14px 0 18px; }
.ind2-nl b { color: var(--ink); font-weight: 700; }
.ind2-nl .nl-soft { color: var(--muted); }
.ind2-nl .nl-empty { color: var(--muted); font-style: italic; }

.ind2-sec-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 11px; }
.ind2-sec-head .li-icon { color: var(--accent); }
.ind2-sec-head:not(:first-of-type) { margin-top: 22px; }
.ind2-sec-hint { margin-left: auto; font-family: var(--font-body, inherit); letter-spacing: 0; text-transform: none; font-weight: 400; font-size: 0.74rem; color: var(--muted); }

/* Custom Telegram message (per-indicator, optional) */
.ind2-msg-input { width: 100%; box-sizing: border-box; resize: vertical; min-height: 56px; background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); font-family: var(--font-body, inherit); font-size: 0.86rem; line-height: 1.45; padding: 9px 11px; transition: border-color var(--motion-fast) var(--motion-ease); }
.ind2-msg-input:focus { outline: none; border-color: rgba(var(--accent-bright-rgb), 0.5); }
.ind2-msg-input::placeholder { color: var(--muted); }
.ind2-msg-hint { margin-top: 5px; text-align: right; font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* read-only condition tiles (base indicators) */
.leaf { display: flex; align-items: center; gap: 10px; background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px 10px; margin-bottom: 8px; }
.leaf:last-child { margin-bottom: 0; }
.leaf-ic { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-bright); }
.leaf--market .leaf-ic { background: rgba(var(--warning-rgb), 0.12); color: var(--warning); }
.leaf-metric { font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.leaf-scope { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: rgba(var(--line-rgb), 0.08); padding: 2px 7px; border-radius: 5px; }
.leaf-sel { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 5px; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; flex-shrink: 0; }
.leaf-sel--s1 { color: #04222c; background: var(--accent); }
.leaf-sel--sX { color: var(--ink); background: rgba(var(--line-rgb), 0.2); }
.leaf-sel--s2 { color: #0b0f2a; background: var(--info); }
.leaf-op { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; color: var(--accent-bright); }
.leaf-val { font-family: var(--font-mono); font-weight: 700; font-size: 0.92rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.leaf-win { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 0.62rem; color: var(--muted); background: rgba(var(--line-rgb), 0.07); padding: 2px 7px; border-radius: 5px; }
.cond-op-static { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.84rem; color: var(--muted-strong); }
.cond-op-static b { color: var(--ink); }

@media (max-width: 860px) {
  .ind2-layout { grid-template-columns: 1fr; }
  .ind2-list { max-height: 320px; }
  .ind2-detail { min-height: 0; }
}

.ind-editor { /* il box contenitore è ora il pannello .ind2-detail */ }
.ind-editor:empty { display: none; }
.ind-editor-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.ind-name-field { flex: 1 1 220px; }
.ind-editor-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.ind-attivo { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted-strong); cursor: pointer; }
.ind-base-note { margin: 12px 0 0; font-size: 0.78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ind-base-note .li-icon { color: var(--accent); }
.ind-preview { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.ind-preview-text { font-size: 0.84rem; display: inline-flex; align-items: center; gap: 7px; }
.ind-preview-text.is-on { color: var(--success); }
.ind-preview-text.is-on .li-icon { color: var(--success); }
.ind-preview-text.is-off { color: var(--muted); }
.ind-preview-count { font-weight: 700; }
/* Feedback di validità per indicatore (runtime in memoria del daemon). */
.ind-runtime-row { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ind-runtime { font-size: 0.76rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 1.5; border: 1px solid currentColor; }
.ind-runtime--idle, .ind-runtime--neutral { color: var(--muted); }
.ind-runtime--ok { color: var(--success); }
.ind-runtime--warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.ind-runtime-fired { font-size: 0.72rem; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); padding: 1px 7px; border-radius: 999px; }
.ind-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.ind-badge--base { color: var(--muted-strong); background: rgba(var(--line-rgb), 0.1); }
.ind-badge--custom { color: var(--accent-bright); background: var(--accent-soft); border: 1px solid rgba(var(--accent-bright-rgb), 0.2); }

/* Toggle switch */
.ind-switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.ind-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ind-switch-track {
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: rgba(var(--line-rgb), 0.18);
  border: 1px solid var(--line);
  transition: background var(--motion-base) var(--motion-ease), border-color var(--motion-base) var(--motion-ease);
  display: flex;
  align-items: center;
  padding: 0 2px;
}
.ind-switch-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted-strong);
  transition: transform var(--motion-base) var(--motion-ease), background var(--motion-base) var(--motion-ease);
}
.ind-switch input:checked + .ind-switch-track { background: var(--accent-soft); border-color: rgba(var(--accent-bright-rgb), 0.4); }
.ind-switch input:checked + .ind-switch-track .ind-switch-thumb { transform: translateX(16px); background: var(--accent-bright); }
.ind-switch input:focus-visible + .ind-switch-track { box-shadow: 0 0 0 2px rgba(var(--accent-bright-rgb), 0.4); }

/* ── Indicatori Live — editor ─────────────────────────────────────── */
#indicatori-live-editor { margin-top: 0; }
/* 7 colonne: icona-metrica, metrica, scope/esito, operatore, valore, finestra (o
   placeholder per il mercato), elimina. L'icona iniziale (accent / ambra per il
   mercato) distingue a colpo d'occhio statistica-squadra da mercato. */
.cond-row { display: grid; grid-template-columns: 30px minmax(0, 1.6fr) minmax(0, 1fr) 0.75fr 0.85fr 1.2fr 1.9rem; gap: 8px; align-items: center; margin-bottom: 8px; }
.cond-ic { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent-bright); }
.cond-ic--market { background: rgba(var(--warning-rgb), 0.12); color: var(--warning); }
/* Mercato (Fase 5b): etichetta "mercato" al posto del selettore esito per il volume. */
.cond-market-all { color: var(--muted); font-size: 0.8rem; text-align: center; align-self: center; }
/* Drop% (Fase 5b+): la sola metrica di mercato con finestra — input minuti (vuoto =
   dal kickoff) + selettore unità (reali/gioco) affiancati nella cella finestra. */
.cond-window-drop { display: flex; gap: 4px; min-width: 0; align-items: center; }
.cond-window-drop .cond-window { min-width: 0; flex: 1 1 3ch; }
.cond-window-drop .cond-window-unit { flex: 0 0 auto; width: auto; padding-left: 5px; padding-right: 5px; font-size: 0.78rem; }
.cond-row select,
.cond-row input,
#indicatori-live-editor .field input,
#indicatori-live-editor .field select {
  background: rgba(8, 12, 20, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  padding: 8px 10px;
  transition: border-color var(--motion-fast) var(--motion-ease);
}
.cond-row select:focus,
.cond-row input:focus,
#indicatori-live-editor .field input:focus,
#indicatori-live-editor .field select:focus { outline: none; border-color: rgba(var(--accent-bright-rgb), 0.45); }
/* Gate come card (finestra minuti a tutta larghezza; risultato e riarmo affiancati). */
.ed-gates { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0; }
.gate { background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 13px; }
.gate--minutes { grid-column: 1 / -1; }
.gate-lab { display: flex; align-items: center; gap: 7px; font-size: 0.74rem; color: var(--muted-strong); margin-bottom: 10px; }
.gate-lab .li-icon { color: var(--accent); }
.gate select, .gate input { width: 100%; background: rgba(8, 12, 20, 0.6); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); padding: 8px 10px; font: inherit; transition: border-color var(--motion-fast) var(--motion-ease); }
.gate select:focus, .gate input:focus { outline: none; border-color: rgba(var(--accent-bright-rgb), 0.45); }
.gate select#ed-gate { margin-bottom: 8px; }
.gate-minute-row { display: flex; align-items: center; gap: 10px; }
.gate-dash { color: var(--muted); }
.gate-cooldown { display: flex; align-items: center; gap: 9px; }
.gate-cooldown input { width: 80px; text-align: center; font-family: var(--font-mono); font-weight: 700; }
.gate-unit { font-size: 0.78rem; color: var(--muted); }
.gate-ro-val { font-size: 0.92rem; color: var(--ink); font-weight: 600; }
.ed-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 0.78rem; color: var(--muted); }
.form-errors { color: var(--danger); margin-top: 10px; }

/* ── Buttons used by the live surfaces (btn-primary / btn-link) ────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  min-height: 40px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #080C12;
  background: var(--accent);
  transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); transform: translateY(-1px); box-shadow: 0 0 28px rgba(var(--accent-bright-rgb), 0.3); }
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  transition: color var(--motion-fast) var(--motion-ease);
}
.btn-link:hover { color: var(--accent-bright); text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: var(--danger); filter: brightness(1.15); }

/* ── Storico segnali (area Account) ───────────────────────────────── */
.account-count { color: var(--muted); font-weight: 600; font-size: 0.85em; }
.account-history {
  position: relative;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(var(--accent-bright-rgb), 0.24);
  border-left: 3px solid var(--accent-bright);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.09), rgba(8, 12, 20, 0.26) 42%),
    rgba(var(--line-rgb), 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 18px 44px -34px rgba(var(--accent-rgb), 0.72);
}
.account-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(var(--accent-bright-rgb), 0.14);
}
.account-history-copy { min-width: 0; }
.account-history-eyebrow {
  margin: 0 0 5px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.account-history h3 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink);
}
.account-history-metrics { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.account-history-metric {
  min-width: 96px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid rgba(var(--accent-bright-rgb), 0.18);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.42);
}
.account-history-metric .account-count {
  font-family: var(--font-mono);
  font-size: 1.12rem;
  line-height: 1;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
}
.account-history-metric > span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.account-history-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.account-section--history {
  min-width: 0;
  background: rgba(8, 12, 20, 0.38);
  border-color: rgba(var(--accent-bright-rgb), 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.account-signals { container-type: inline-size; }
.account-section--history > .account-sct {
  font-family: "DM Sans", sans-serif;
  font-size: 0.96rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.account-sct-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-sct-title { font-weight: 800; line-height: 1.1; }
.account-sct-sub {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
@container (min-width: 1040px) {
  .account-history-panels {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
    align-items: start;
  }
}
.account-signals-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 13px;
  padding: 9px;
  border: 1px solid rgba(var(--line-rgb), 0.16);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.35);
}
.account-signals-older {
  flex: 1 1 320px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted-strong);
}
.account-signals-older > span {
  flex: 0 0 auto;
  min-width: 0;
  line-height: 1.35;
  white-space: nowrap;
}
.account-signals-older select {
  flex: 1 1 118px;
  min-width: 118px;
  background: rgba(8, 12, 20, 0.5); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 6px 8px; font: inherit;
}
.account-danger { color: var(--danger); border-color: var(--danger); }
.account-danger:hover:not(:disabled) { filter: brightness(1.12); }
.account-signals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent;
}
.account-signals-list::-webkit-scrollbar { width: 8px; }
.account-signals-list::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 8px; }
.account-signal-group {
  overflow: hidden;
  border: 1px solid rgba(var(--line-rgb), 0.14);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.24);
}
.account-signal-group:last-child { border-bottom: 1px solid rgba(var(--line-rgb), 0.14); }
.account-signal-group-header {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 10px 11px;
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: 0;
  line-height: 1.2;
}
.account-signal-group-header.is-clickable { cursor: pointer; transition: background 0.12s ease; }
.account-signal-group-header.is-clickable:hover,
.account-signal-group-header.is-clickable:focus-visible { background: rgba(var(--accent-bright-rgb), 0.12); outline: none; }
.account-signal-group-chevron { display: inline-flex; color: var(--muted); flex-shrink: 0; transition: transform var(--motion-base) var(--motion-ease); }
.account-signal-group.is-collapsed .account-signal-group-chevron { transform: rotate(-90deg); }
.account-signal-group.is-collapsed .account-signal-group-header { border-radius: 0; }
.account-signal-group.is-collapsed .account-signal-group-body { display: none; }
.account-signal-group.is-collapsed { min-height: 44px; }
.account-signal-group-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.account-signal-group-count {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-bright, var(--accent));
  background: rgba(var(--accent-bright-rgb), 0.13);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.16);
  padding: 2px 8px;
  border-radius: 999px;
}
.account-signal-group-count-label {
  font-family: "DM Sans", sans-serif;
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 700;
  color: var(--muted-strong);
}
.account-signal-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.account-signal-group .account-signal-row:last-child { border-bottom: none; }
.account-signal-row.is-clickable { cursor: pointer; border-radius: var(--radius-md); transition: background 0.12s ease; }
.account-signal-row.is-clickable:hover,
.account-signal-row.is-clickable:focus-visible { background: var(--accent-soft); outline: none; }
.account-signal-time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.account-signal-match { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-signal-chip {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright, var(--accent));
  font-size: 0.78rem;
  white-space: nowrap;
}
.account-signal-min { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--danger); }
.account-signal-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 1px solid transparent; border-radius: var(--radius-md);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 0.9rem; line-height: 1;
  transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease);
}
.account-signal-del:hover { color: var(--danger); background: var(--accent-soft); }

/* ── Grading dei segnali (esito + predizione + base rate sulla riga) ── */
.account-signal-row {
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, auto) 28px;
}
.account-signal-grade { min-width: 0; display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.account-signal-pred {
  font-family: var(--font-mono); font-size: 0.7rem; white-space: nowrap;
  padding: 1px 7px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
}
.account-signal-outcome {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  white-space: nowrap; padding: 1px 7px; border-radius: 999px;
}
.account-signal-outcome.is-ok { color: var(--success); background: rgba(var(--success-rgb), 0.12); }
.account-signal-outcome.is-ko { color: var(--danger); background: rgba(var(--danger-rgb), 0.1); }
.account-signal-outcome.is-void { color: var(--muted); background: rgba(var(--line-rgb), 0.1); }
.account-signal-outcome.is-pending { color: var(--muted-strong); border: 1px dashed var(--line); }
.account-signal-base { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

@container (max-width: 700px) {
  .account-signals-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }

  .account-signals-older {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 0.7fr);
    align-items: center;
  }

  .account-signals-toolbar > .button {
    width: 100%;
    min-width: 0;
    padding-inline: 12px;
  }

  .account-signal-row {
    grid-template-columns: auto minmax(0, 1fr) auto 28px;
    gap: 6px 8px;
    padding-left: 10px;
  }

  .account-signal-time {
    grid-column: 1;
    grid-row: 1;
  }

  .account-signal-chip {
    grid-column: 2;
    grid-row: 1;
  }

  .account-signal-min {
    grid-column: 3;
    grid-row: 1;
  }

  .account-signal-grade {
    grid-column: 1 / 4;
    grid-row: 2;
    justify-content: flex-start;
  }

  .account-signal-del {
    grid-column: 4;
    grid-row: 1 / 3;
    align-self: center;
  }
}

@container (max-width: 460px) {
  .account-signals-older {
    grid-template-columns: 1fr;
  }

  .account-signals-older > span {
    white-space: normal;
  }

  .account-signal-row {
    grid-template-columns: minmax(0, 1fr) auto 28px;
    padding-left: 8px;
  }

  .account-signal-time {
    grid-column: 1 / 3;
    grid-row: 1;
    font-size: 0.7rem;
  }

  .account-signal-chip {
    grid-column: 1;
    grid-row: 2;
  }

  .account-signal-min {
    grid-column: 2;
    grid-row: 2;
  }

  .account-signal-grade {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .account-signal-del {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

/* ── Rendimento indicatori (hit-rate vs base rate → lift) ───────────── */
.account-performance-list { display: flex; flex-direction: column; }
.account-perf-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(5, minmax(52px, auto)) 64px;
  align-items: center; gap: 10px;
  padding: 6px 8px; border-bottom: 1px solid rgba(var(--line-rgb), 0.1);
  font-size: 0.84rem;
}
.account-perf-head {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line);
}
.account-perf-row:last-child { border-bottom: none; }
.account-perf-name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-perf-cell { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted-strong); text-align: right; }
.account-perf-lift { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; color: var(--muted); }
.account-perf-lift.is-pos { color: var(--success); }
.account-perf-lift.is-neg { color: var(--danger); }

/* ── Affidabilità indicatori (griglia fasce × indicatori, tier Wilson) ── */
.rel-shell { display: flex; flex-direction: column; gap: 14px; }
.rel-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.78rem; color: var(--muted); }
.rel-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rel-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.rel-dot--green { background: rgba(var(--success-rgb), 0.8); }
.rel-dot--amber { background: rgba(var(--warning-rgb), 0.8); }
.rel-dot--grey  { background: rgba(var(--line-rgb), 0.5); }
.rel-dot--red   { background: rgba(var(--danger-rgb), 0.8); }

.rel-grid-host { display: flex; flex-direction: column; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.rel-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.6fr) repeat(7, minmax(84px, 1fr));
  gap: 6px; align-items: stretch; min-width: 820px;
}
.rel-row--head { min-width: 820px; }
.rel-name {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rel-base-tag, .rel-off {
  flex: 0 0 auto; padding: 1px 7px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.05em;
}
.rel-base-tag { color: var(--accent); background: var(--accent-soft); }
.rel-off { color: var(--muted); border: 1px dashed var(--line); }
.rel-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 7px 4px; border-radius: var(--radius-md);
  border: 1px solid transparent; font-family: var(--font-mono);
  font-variant-numeric: tabular-nums; text-align: center;
}
.rel-cell--head {
  background: none; justify-content: flex-end; padding-bottom: 2px;
  color: var(--muted); font-size: 0.64rem; letter-spacing: 0.07em; text-transform: uppercase;
}
.rel-row--head .rel-name {
  align-items: flex-end; color: var(--muted);
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.07em;
  text-transform: uppercase; font-weight: 400;
}
.rel-cell--green { background: rgba(var(--success-rgb), 0.13); border-color: rgba(var(--success-rgb), 0.4); color: var(--success); }
.rel-cell--amber { background: rgba(var(--warning-rgb), 0.11); border-color: rgba(var(--warning-rgb), 0.35); color: var(--warning); }
.rel-cell--red   { background: rgba(var(--danger-rgb), 0.1); border-color: rgba(var(--danger-rgb), 0.32); color: var(--danger); }
.rel-cell--grey  { background: rgba(var(--line-rgb), 0.07); color: var(--muted); font-size: 0.72rem; }
.rel-hit { font-weight: 700; font-size: 0.92rem; line-height: 1.1; }
.rel-lift { font-size: 0.68rem; }
.rel-n { font-size: 0.62rem; opacity: 0.75; }

.rel-group {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: rgba(var(--line-rgb), 0.03);
}
.rel-group--compare { border-color: rgba(var(--accent-rgb), 0.4); }
.rel-group-head { display: flex; align-items: center; gap: 10px; }
.rel-group-name { font-weight: 700; color: var(--ink); }
.rel-group-badge {
  padding: 1px 8px; border-radius: 999px; font-family: var(--font-mono);
  font-size: 0.64rem; letter-spacing: 0.05em;
  color: var(--accent-bright, var(--accent)); background: var(--accent-soft);
}

/* ── Badge esteso dei segnali attivi (affidabilità situazionale) ────── */
.mw-tile-badges { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sig-badge {
  --sb-rgb: var(--line-rgb);
  display: flex; flex-direction: column; gap: 4px;
  padding: 7px 9px; border-radius: var(--radius-md);
  border: 1px solid rgba(var(--sb-rgb), 0.35);
  background: rgba(var(--sb-rgb), 0.06);
}
.sig-badge--green { --sb-rgb: var(--success-rgb); }
.sig-badge--amber { --sb-rgb: var(--warning-rgb); }
.sig-badge--red   { --sb-rgb: var(--danger-rgb); }
.sig-badge-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sig-badge-fire {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted-strong);
}
.sig-badge-body {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.72rem;
}
.sig-badge-pred {
  flex: 0 0 auto; padding: 1px 7px; border-radius: 999px; font-size: 0.68rem;
  color: var(--accent); background: var(--accent-soft); white-space: nowrap;
}
.sig-badge-nums { color: var(--ink); white-space: nowrap; }
.sig-badge-nums b { color: rgb(var(--sb-rgb)); }
.sig-badge--none .sig-badge-nums b { color: var(--ink); }
.sig-badge-arrow { color: var(--muted); }
.sig-badge-ci { color: var(--muted); white-space: nowrap; }
.sig-badge-nopred { color: var(--muted); font-style: italic; font-family: inherit; }
/* Sparkline lift per fascia: barre ± attorno all'asse, fascia corrente evidenziata. */
.sig-spark { flex: 0 0 auto; margin-left: auto; display: block; }
.sig-spark-axis { stroke: rgba(var(--line-rgb), 0.5); stroke-width: 1; }
.sig-spark-bar.is-pos { fill: rgba(var(--success-rgb), 0.75); }
.sig-spark-bar.is-neg { fill: rgba(var(--danger-rgb), 0.75); }
.sig-spark-bar.is-current { stroke: var(--accent-bright, var(--accent)); stroke-width: 1.4; }
.sig-spark-empty { stroke: rgba(var(--line-rgb), 0.6); stroke-width: 1.6; }
.sig-spark-empty.is-current { stroke: var(--accent-bright, var(--accent)); }

/* ── Editor refinements (mockup parity) ───────────────────────────── */
.cond-del-btn { justify-content: center; color: var(--danger); padding: 4px; }

/* ── Strategie (Punto 3): pannello, lista, card, editor, targhette ─── */
.strat-panel { padding: 18px 20px 22px; }
.strat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.strat-head .ind2-new { width: auto; padding: 0 14px; }
.strat-list { display: flex; flex-direction: column; gap: 8px; }
.strat-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(var(--line-rgb), 0.03); padding: 4px 8px 4px 4px; transition: border-color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease); }
.strat-card:hover { border-color: rgba(var(--accent-bright-rgb), 0.4); background: rgba(var(--accent-bright-rgb), 0.05); }
.strat-card.is-off { opacity: 0.6; }
.strat-card-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; background: transparent; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); }
.strat-card-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.strat-card-name { font-weight: 600; font-size: 0.92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strat-card-sub { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--muted); }
.strat-off { font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; margin-left: 6px; }
.strat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--accent-bright); }
.strat-dot--none { background: var(--line-strong); }
.strat-del { flex-shrink: 0; padding: 6px; color: var(--danger); }

/* ── Screening builder P0: description, readable summary, duplica, BETWEEN, and the
   sectioned + searchable filter picker (Punti 1-3). ──────────────────────────── */
.strat-card-actions { display: inline-flex; gap: 2px; flex-shrink: 0; }
.strat-dup { padding: 6px; color: var(--muted-strong); }
.strat-dup:hover { color: var(--accent-bright); }
.strat-card-desc { display: block; font-size: 0.8rem; color: var(--muted-strong); margin: 1px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strat-card-sub { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

.strat-desc-input { width: 100%; background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); padding: 8px 10px; font: inherit; font-size: 0.85rem; margin: 6px 0 4px; transition: border-color var(--motion-fast) var(--motion-ease); }
.strat-desc-input:focus { outline: none; border-color: rgba(var(--accent-bright-rgb), 0.45); }

.strat-summary { display: flex; gap: 8px; align-items: baseline; background: rgba(8, 12, 20, 0.4); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 9px 12px; margin: 12px 0 14px; }
.strat-summary-label { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.strat-summary-text { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--muted-strong); }

/* Strategie cond-row uses flex (variable child count — BETWEEN adds a 2nd value input)
   instead of the live builder's fixed 7-col grid. */
#strat-ed-conds .cond-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#strat-ed-conds .cond-metric-pick { flex: 1 1 170px; min-width: 0; }
#strat-ed-conds .cond-row > select[data-f="operator"] { flex: 0 0 auto; }
#strat-ed-conds .cond-row > input[data-f="value"],
#strat-ed-conds .cond-row > input[data-f="value2"] { flex: 0 1 92px; min-width: 56px; }
#strat-ed-conds .cond-del-btn { margin-left: auto; }

.cond-metric-pick { background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); padding: 8px 10px; font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color var(--motion-fast) var(--motion-ease); }
.cond-metric-pick:hover { border-color: rgba(var(--accent-bright-rgb), 0.45); }
.cond-metric-pick.is-empty { color: var(--muted); }
.cond-between-sep { color: var(--muted); font-size: 0.8rem; }

/* ── Sensitivity sulla soglia (drawer, stratega #3) ──────────────────────── */
.cond-sens-btn { justify-content: center; color: var(--muted-strong); padding: 4px; }
.cond-sens-btn:hover { color: var(--accent-bright); }
.sens-chart { width: 100%; height: auto; margin-bottom: 10px; }
.sens-bar { fill: rgba(var(--accent-rgb), 0.45); }
.sens-bar.is-current { fill: rgb(var(--accent-bright-rgb)); }
.sens-x { fill: var(--muted); font-size: 10px; }
.sens-line { stroke: rgb(var(--warning-rgb)); stroke-width: 2; }
.sens-table-wrap { max-height: 40vh; overflow-y: auto; }
.sens-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sens-table th, .sens-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.sens-table th:first-child, .sens-table td:first-child { text-align: left; }
.sens-table tr.is-current td { color: rgb(var(--accent-bright-rgb)); font-weight: 600; }

.metric-pop { position: fixed; z-index: 1200; max-height: 360px; width: max-content; max-width: min(440px, 92vw); display: flex; flex-direction: column; background: var(--bg-muted); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow); overflow: hidden; }
.metric-pop[hidden] { display: none; }
.metric-pop-search { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-bottom: 1px solid var(--line); color: var(--muted); }
.metric-pop-q { flex: 1; background: transparent; border: none; outline: none; color: var(--ink); font: inherit; font-size: 0.9rem; }
.metric-pop-list { overflow-y: auto; padding: 4px; }
.metric-pop-sec { margin-bottom: 4px; }
.metric-pop-sec[hidden] { display: none; }
.metric-pop-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 3px; position: sticky; top: 0; background: var(--bg-muted); }
.metric-pop-sec-name { font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-bright); }
.metric-pop-sec-count { font-family: var(--font-mono); font-size: 0.58rem; font-weight: 700; color: var(--muted); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; }
.metric-pop-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: transparent; border: none; border-radius: 7px; color: var(--ink); font: inherit; font-size: 0.86rem; padding: 7px 9px; cursor: pointer; }
.metric-pop-item[hidden] { display: none; }
.metric-pop-item:hover { background: var(--accent-soft); color: var(--accent-bright); }
.metric-pop-item-label { flex: 1; text-align: left; }
.cov-badge { font-size: 10px; padding: 1px 6px; border-radius: var(--radius-pill); flex-shrink: 0; }
.cov-ok { color: rgb(var(--success-rgb)); background: rgba(var(--success-rgb), 0.12); }
.cov-warn { color: rgb(var(--warning-rgb)); background: rgba(var(--warning-rgb), 0.12); }
.cov-bad { color: rgb(var(--danger-rgb)); background: rgba(var(--danger-rgb), 0.12); }
.strat-nv-causes { margin: 6px 0 4px; font-size: 12px; color: var(--muted-strong); }
.metric-pop-empty { padding: 14px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Inline editor: opens as an accordion attached under its strategy card. The
   row wraps card + accordion so the list gap stays between strategies and the
   panel sits flush beneath its own card. */
.strat-row { display: flex; flex-direction: column; }
.strat-row.is-open > .strat-card {
  border-color: rgba(var(--accent-bright-rgb), 0.4);
  border-bottom-color: transparent;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: rgba(var(--accent-bright-rgb), 0.06);
}
.strat-acc {
  overflow: hidden;
  border: 1px solid rgba(var(--accent-bright-rgb), 0.4);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  background: rgba(var(--line-rgb), 0.02);
  animation: stratAccOpen var(--motion-base) var(--motion-ease);
}
.strat-row.is-new .strat-acc {
  border-top: 1px solid rgba(var(--accent-bright-rgb), 0.4);
  border-radius: var(--radius-md);
}
.strat-acc-inner { padding: 16px 18px 18px; }
@keyframes stratAccOpen {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.strat-screen-panel { margin-top: 16px; }
.strat-run-controls { display: inline-flex; align-items: center; gap: 8px; }
.strat-date { font: inherit; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface, transparent); color: var(--ink); }
.strat-results { display: flex; flex-direction: column; gap: 14px; max-height: 72vh; overflow-y: auto; }
.strat-date-sep { color: var(--muted); font-size: 13px; align-self: center; }
/* Multi-day results: internal scroll (the page must not grow), sticky day headers. */
.strat-day { display: flex; flex-direction: column; gap: 14px; }
.strat-day-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 6px 2px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 13px;
  text-transform: capitalize;
}
.strat-result { border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(var(--line-rgb), 0.02); padding: 10px 12px; }
.strat-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.strat-result-counts { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted-strong); }
.strat-result-cands { display: flex; flex-direction: column; gap: 6px; }
.strat-bucket { margin-top: 8px; }
.strat-bucket > summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); padding: 4px 0; }
.strat-bucket > .strat-cand { margin-top: 4px; }
.strat-cand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(var(--line-rgb), 0.03); padding: 8px 12px; }
.strat-cand--info { background: transparent; border-style: dashed; opacity: 0.85; }
.strat-cand-state { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; color: var(--muted); margin-left: auto; }
.strat-cand-state.is-confirmed { color: var(--success); }
.strat-cand-preset { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent-bright); white-space: nowrap; }
.strat-cand-teams { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 160px; font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.strat-cand-team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strat-cand-vs { color: var(--muted); font-weight: 400; }
.strat-cand-time { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted-strong); }
.strat-cand-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.strat-cand-ok { padding: 4px 12px; min-height: 0; display: inline-flex; align-items: center; gap: 5px; }
.strat-cand-no { color: var(--muted); }
.strat-cand-detail { padding: 6px; color: var(--muted-strong); }
.strat-cand-detail:hover { color: var(--accent-bright); }
/* Esito-target ("cosa caccia") — badge + editor controls */
.strat-target { color: var(--muted-strong); font-size: 12px; white-space: nowrap; }
.strat-target--sm { font-size: 11px; color: var(--muted); }
.strat-target-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.strat-target-score { display: inline-flex; align-items: center; gap: 4px; }
.strat-target-score input { width: 64px; }
/* Multi "esito mercato" (0053): stacked rows + an add button below. */
.strat-target-list { display: flex; flex-direction: column; gap: 8px; }
.strat-target-add { margin-top: 6px; }
.strat-target-del { margin-left: auto; }
/* Account → Storico screening */
.account-screening-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.account-screening-list::-webkit-scrollbar { width: 8px; }
.account-screening-list::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 8px; }
.account-screen-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 10px;
  border: 1px solid rgba(var(--line-rgb), 0.13);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.26);
}
.account-screen-day { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted-strong); min-width: 42px; }
.account-screen-preset { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; color: var(--accent-bright); white-space: nowrap; }
.account-screen-teams { flex: 1; min-width: 140px; font-size: 0.86rem; font-weight: 700; color: var(--ink); }
.account-screen-vs { color: var(--muted); }
.account-screen-status { font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--muted); }
.account-screen-status--confirmed { color: var(--success); background: rgba(var(--success-rgb), 0.12); border-color: rgba(var(--success-rgb), 0.3); }
.account-screen-status--dismissed { color: var(--muted); }
.account-screen-status--pending { color: var(--warning); background: rgba(var(--warning-rgb), 0.1); border-color: rgba(var(--warning-rgb), 0.3); }
.account-screen-score { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; color: var(--ink); }
.strat-color-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.strat-color-pick input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; cursor: pointer; }
/* Targhetta strategia su una card Partite Live (Punto 3). */
.strat-badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent-bright); background: rgba(var(--accent-bright-rgb), 0.12); border: 1px solid rgba(var(--accent-bright-rgb), 0.3); padding: 2px 7px; border-radius: var(--radius-pill); white-space: nowrap; }
.strat-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.strat-badge-day { font-weight: 600; opacity: 0.7; }
.strat-badges { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── Editor: albero condizioni AND/OR (Fase 4 — tree builder) ──────── */
/* Gruppi come schede con spina colorata a sinistra: teal = E (tutte), indaco = O
   (almeno una). La spina + l'indentazione rendono leggibile l'annidamento (A o B) e C. */
.cond-group { position: relative; border-radius: var(--radius-lg); }
.cond-group--root { padding: 14px 14px 12px 17px; border: 1px solid var(--line); background: rgba(var(--accent-rgb), 0.04); }
.cond-group--root[data-op="or"] { background: rgba(var(--info-rgb), 0.05); }
.cond-group:not(.cond-group--root) { margin: 10px 0; padding: 11px 12px 9px 15px; border: 1px solid var(--line); background: rgba(var(--accent-rgb), 0.05); }
.cond-group:not(.cond-group--root)[data-op="or"] { background: rgba(var(--info-rgb), 0.06); }
.cond-spine { position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: var(--radius-pill); background: var(--accent); }
.cond-group[data-op="or"] > .cond-spine { background: var(--info); }
.cond-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.cond-group-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cond-group-children { display: flex; flex-direction: column; }
/* Segmented E/O: pillola con lo stato attivo pieno (teal per E, indaco per O). */
.cond-op-toggle { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--radius-pill); background: rgba(8, 12, 20, 0.5); border: 1px solid var(--line); }
.cond-op-btn {
  border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body, inherit); font-weight: 600; font-size: 0.76rem; color: var(--muted);
  padding: 4px 12px; border-radius: var(--radius-pill);
  transition: background var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.cond-op-btn b { font-family: 'Barlow Condensed', sans-serif; font-size: 0.92rem; line-height: 1; }
.cond-op-btn.is-active { background: var(--accent); color: #04222c; }
/* ft-only market → HT horizon disabled (cross-half + corner/card/shot settle at FT). */
.cond-op-btn.is-disabled, .cond-op-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cond-group[data-op="or"] > .cond-group-head .cond-op-btn.is-active { background: var(--info); color: #0b0f2a; }
.ed-gates .field > span { display: inline-flex; align-items: center; gap: 6px; }
.ed-gates .field > span .li-icon { color: var(--accent); }

/* ── Screening-detail drawer (Punto 3 click-through "why") ───────────
   Fixture header (crests) + the strategy's condition tree, read-only and
   annotated with each leaf's computed value/status. Leaves reuse
   .metric-detail-card; only actual nesting gets the boxed .sd-group
   treatment (mirrors .cond-group--root vs .cond-group in the editor above),
   so the common flat-AND case still reads as a plain list of cards. */
.sd-intro { display: flex; flex-direction: column; gap: 6px; }
.sd-teams { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.sd-team-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-vs { flex-shrink: 0; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.sd-tree { display: flex; flex-direction: column; gap: 10px; }
.sd-tree-children { display: flex; flex-direction: column; gap: 10px; }
.sd-group { position: relative; display: flex; flex-direction: column; gap: 10px; margin: 2px 0; padding: 12px 12px 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(var(--line-rgb), 0.04); }
.sd-group::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: var(--radius-pill); background: var(--line-strong); }
.sd-group--success::before { background: var(--success); }
.sd-group--warning::before { background: var(--warning); }
.sd-group--danger::before { background: var(--danger); }
.sd-op-badge { align-self: flex-start; font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-strong); background: rgba(var(--line-rgb), 0.14); border-radius: var(--radius-pill); padding: 2px 8px; }
.sd-group-children { display: flex; flex-direction: column; gap: 10px; }
.mdc-reason { margin: 0; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .live-hero { align-items: flex-start; }
  .live-team-name { font-size: 0.85rem; }
  .cmp-row-head { grid-template-columns: 2.8rem 1fr 2.8rem; gap: 8px; }
  .cond-row { grid-template-columns: 26px 1fr 1fr; }
}

/* ── Indicator user-groups + ordering/pin (drag = reorder, gruppo = menu) ── */
.ind2-user-group { margin-bottom: 2px; }
.ind2-user-group-head { display: flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: var(--radius-md); background: rgba(var(--line-rgb), 0.04); margin-bottom: 1px; border-left: 3px solid var(--ig-color, var(--accent-bright)); cursor: pointer; transition: background var(--motion-fast) var(--motion-ease); }
.ind2-user-group-head:hover { background: rgba(var(--line-rgb), 0.08); }
.ind2-user-group-toggle { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: var(--radius-md); background: transparent; color: var(--muted); padding: 0; cursor: pointer; flex-shrink: 0; transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease), transform var(--motion-base) var(--motion-ease); }
.ind2-user-group-toggle:hover, .ind2-user-group-toggle:focus-visible { color: var(--ink); background: rgba(var(--line-rgb), 0.12); outline: none; }
.ind2-user-group.is-collapsed .ind2-user-group-toggle { transform: rotate(-90deg); }
.ind2-user-group-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ig-color, var(--accent-bright)); flex-shrink: 0; }
.ind2-user-group-name { flex: 1; font-family: var(--font-mono); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); border: none; background: transparent; padding: 0; cursor: text; min-width: 0; }
.ind2-user-group-name:focus { outline: none; color: var(--accent-bright); }
.ind2-user-group-disband { border: none; background: none; padding: 1px 4px; cursor: pointer; color: var(--muted); font-size: 0.82rem; line-height: 1; border-radius: 3px; transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease); }
.ind2-user-group-disband:hover { color: var(--danger); background: rgba(var(--danger-rgb), 0.1); }
.ind2-user-group-body { padding-left: 8px; border-left: 2px solid var(--ig-color, var(--accent-bright)); margin-left: 11px; }
.ind2-user-group.is-collapsed .ind2-user-group-body { display: none; }
.ind2-item[draggable="true"] { cursor: grab; }
.ind2-item[draggable="true"]:active { cursor: grabbing; }
.ind2-item.dragging { opacity: 0.35; }
/* Indicatore d'inserimento del riordino (linea accent sopra/sotto la riga bersaglio). */
.ind2-item.drop-before { box-shadow: inset 0 2px 0 0 var(--accent-bright); }
.ind2-item.drop-after { box-shadow: inset 0 -2px 0 0 var(--accent-bright); }

/* Controlli per riga: pin + menu gruppo. */
.ind2-item-ctrls { display: inline-flex; align-items: center; gap: 2px; }
.ind2-ctrl { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-md); color: var(--muted); cursor: pointer; transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease); }
.ind2-ctrl:hover { color: var(--ink); background: rgba(var(--line-rgb), 0.12); }
.ind2-pin.is-on { color: var(--accent-bright); }
.ind2-pin.is-on:hover { color: var(--accent-bright); }

/* Zona "Fissati" in cima alla lista personali. */
.ind2-pin-zone { margin-bottom: 4px; }
.ind2-subhead { display: flex; align-items: center; gap: 5px; padding: 3px 10px 4px; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-bright); }

/* Popover menu gruppo (esplicito, sostituisce il drag-to-group). */
.ind2-menu-pop { position: fixed; z-index: 1200; min-width: 168px; max-width: 240px; padding: 4px; background: var(--bg-muted); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.35)); display: flex; flex-direction: column; gap: 1px; }
.ind2-menu-item { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; padding: 7px 9px; border: none; background: transparent; color: var(--ink); font-size: 0.82rem; border-radius: var(--radius-sm, 6px); cursor: pointer; }
.ind2-menu-item:hover { background: var(--accent-soft); }
.ind2-menu-item.is-danger { color: var(--danger); }
.ind2-menu-item.is-danger:hover { background: rgba(var(--danger-rgb), 0.1); }
.ind2-menu-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ── Statistiche live: ordine + pin globale (modalità "Ordina") ──────────── */
.live-stats-eyebrow-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 2px 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.live-stats-eyebrow-row .live-stats-eyebrow { margin: 0; padding-top: 0; border-top: none; }
/* Quando il possesso (con border-bottom) è visibile subito sopra la riga
   "Statistiche a confronto" (con border-top), i due separatori si sommavano in una
   doppia linea: la riga statistiche eredita il separatore dal possesso e rimuove il
   proprio. Col possesso nascosto (es. partita non iniziata) il border-top resta. */
.live-control-track:not([hidden]) + .live-stats-eyebrow-row { border-top: none; padding-top: 0; margin-top: 0; }
.live-stats-edit-btn { flex-shrink: 0; font-size: 0.72rem; font-weight: 600; color: var(--muted-strong); background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 3px 10px; cursor: pointer; transition: color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease); }
.live-stats-edit-btn:hover { color: var(--ink); border-color: var(--accent-bright); }
.live-stats-edit-btn.is-on { color: var(--accent-bright); border-color: var(--accent-bright); background: var(--accent-soft); }
/* Il contenuto della riga vive ora in .cmp-row-main (gap fra valori e barre); in
   modalità Ordina la riga diventa orizzontale: maniglia | contenuto | pin. */
.cmp-row-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.cmp-row.is-editing { flex-direction: row; align-items: center; gap: 8px; cursor: grab; }
.cmp-row.is-editing:active { cursor: grabbing; }
.cmp-row.dragging { opacity: 0.4; }
.cmp-row.drop-before { box-shadow: inset 0 2px 0 0 var(--accent-bright); }
.cmp-row.drop-after { box-shadow: inset 0 -2px 0 0 var(--accent-bright); }
.cmp-grip { flex-shrink: 0; display: inline-flex; align-items: center; color: var(--muted); }
.cmp-pin { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--radius-md); color: var(--muted); cursor: pointer; transition: color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease); }
.cmp-pin:hover { color: var(--ink); background: rgba(var(--line-rgb), 0.12); }
.cmp-pin.is-on, .cmp-pin.is-on:hover { color: var(--accent-bright); }

/* ── Mobile UX refinements ─────────────────────────────────────────
   Overrides kept at the end because the stylesheet has section-local media
   rules. The goal is less nested scrolling, stronger touch targets and safer
   overlays without changing markup or application flow. */
@media (max-width: 760px) {
  body { min-height: 100dvh; }

  .layout {
    width: min(1500px, calc(100% - 16px));
    gap: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .page-shell,
  .admin-shell,
  .live-shell {
    gap: 14px;
  }

  .panel,
  .drawer-section {
    padding: 14px;
    border-radius: var(--radius-lg);
  }

  .tabs {
    top: max(6px, env(safe-area-inset-top));
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }

  .tab-rail {
    gap: 6px;
    padding-inline: 1px;
    scroll-padding-inline: 8px;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .tab-button {
    scroll-snap-align: start;
    column-gap: 8px;
    border-radius: 12px;
    font-size: 0.94rem;
    letter-spacing: 0.055em;
  }

  .tab-button--profile .tab-label {
    display: none;
  }

  .section-header {
    gap: 12px;
  }

  .section-actions,
  .action-row,
  .admin-hero-actions,
  .ind-editor-actions,
  .ed-actions {
    width: 100%;
    margin-left: 0;
  }

  .btn-primary,
  .btn-mini,
  .cond-op-btn,
  .ind2-ctrl,
  .cmp-pin,
  .live-pin-btn {
    min-height: 40px;
  }

  .drawer-panel {
    height: 100dvh;
  }

  .drawer-header,
  .drawer-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .ind2-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .live-search-wrap {
    width: 100%;
    min-width: 0;
  }

  .ind2-rail {
    overflow: visible;
  }

  .ind2-detail {
    padding: 14px;
  }

  .ind-editor-actions,
  .ed-actions,
  .account-actions,
  .account-signals-toolbar,
  .admin-filter-row {
    align-items: stretch;
  }

  .ind-editor-actions > *,
  .ed-actions > *,
  .account-actions > *,
  .account-signals-toolbar > * {
    flex: 1 1 auto;
  }

  .admin-search,
  .admin-filter-field,
  .admin-filter-input {
    flex: 1 1 100%;
    max-width: none;
  }

  .admin-collapsible-summary,
  .admin-collapsible-body {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 640px) {
  .login-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .login-card {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: 28px 20px 22px;
    border-radius: 16px;
  }

  .login-title {
    font-size: 2.35rem;
  }

  .account-card {
    padding: 22px 14px 16px;
    border-radius: 16px;
  }

  .account-head {
    align-items: flex-start;
    gap: 12px;
    padding-right: 34px;
  }

  .account-section {
    padding: 13px;
  }

  .account-history {
    padding: 14px;
    border-radius: 16px;
  }

  .account-history-head {
    flex-direction: column;
    gap: 12px;
  }

  .account-history-metrics {
    width: 100%;
    justify-content: stretch;
  }

  .account-history-metric {
    flex: 1 1 120px;
  }

  .account-signal-row {
    grid-template-columns: auto minmax(0, 1fr) auto 28px;
    gap: 6px 8px;
  }

  .account-signal-time {
    grid-column: 1;
    grid-row: 1;
  }

  .account-signal-chip {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account-signal-min {
    grid-column: 3;
    grid-row: 1;
  }

  .account-signal-grade {
    grid-column: 1 / 4;
    grid-row: 2;
    justify-content: flex-start;
  }

  .account-signal-del {
    grid-column: 4;
    grid-row: 1 / 3;
    align-self: center;
  }

  .live-detail-close {
    position: sticky;
    top: max(10px, env(safe-area-inset-top));
    right: auto;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    margin-bottom: -12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(8, 12, 20, 0.86);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .live-detail-head {
    padding-right: 0;
  }

  .live-detail-score {
    gap: 10px;
  }

  .live-score--lg {
    font-size: 1.7rem;
  }

  .otiles {
    grid-template-columns: 1fr;
  }

  .cond-row {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(8, 12, 20, 0.36);
  }

  .cond-row > .cond-ic {
    grid-column: 1;
    grid-row: 1;
  }

  .cond-row > [data-f="metric_id"] {
    grid-column: 2;
  }

  .cond-row > [data-f="team_scope"],
  .cond-row > [data-f="selection"],
  .cond-row > [data-f="operator"],
  .cond-row > [data-f="value"],
  .cond-row > .cond-market-all,
  .cond-row > .cond-window,
  .cond-row > .cond-window-drop {
    grid-column: 1 / -1;
  }

  .cond-row > .cond-window-na {
    display: none;
  }

  .cond-del-btn {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 38px;
    border: 1px solid rgba(var(--danger-rgb), 0.22);
    border-radius: var(--radius-md);
    background: rgba(var(--danger-rgb), 0.06);
  }

  .gate-minute-row,
  .gate-cooldown {
    flex-wrap: wrap;
  }

  .gate-cooldown input {
    flex: 1 1 96px;
  }
}

@media (max-width: 520px) {
  .tab-button {
    grid-template-areas: "icon label";
    grid-template-columns: 18px minmax(0, auto);
    column-gap: 7px;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
  }

  .tab-meta {
    display: none;
  }

  .admin-create-form,
  .admin-stat-grid,
  .admin-enrichment-stats,
  .account-chips {
    grid-template-columns: 1fr;
  }

  .admin-hero-lead,
  .admin-section-lead {
    align-items: flex-start;
  }

  .admin-collapsible-summary {
    align-items: flex-start;
    gap: 10px;
  }

  .account-signal-row {
    grid-template-columns: minmax(0, 1fr) auto 28px;
    gap: 6px 8px;
    padding-left: 8px;
  }

  .account-signal-time {
    grid-column: 1 / 3;
    grid-row: 1;
    font-size: 0.7rem;
  }

  .account-signal-chip {
    grid-column: 1;
    grid-row: 2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account-signal-min {
    grid-column: 2;
    grid-row: 2;
  }

  .account-signal-grade {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .account-signal-del {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

/* ─── CLM (Admin › log/monitoring zone) ───────────────────────────────────── */
.admin-clm-header {
  flex-wrap: wrap;
  gap: var(--space-2);
}
.admin-clm-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.admin-clm-tabs .button {
  padding: 6px 18px;
  font-size: 0.85rem;
  touch-action: manipulation;
}
.admin-clm-tabs .button.active {
  background: rgba(var(--accent-bright-rgb), 0.15);
  border-color: var(--teal);
  color: var(--teal);
}
.admin-clm-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.admin-clm-view[hidden] {
  display: none;
}

.clm-system {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.clm-toolbar-ranges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}
.clm-range {
  padding: 5px 14px;
  font-size: 0.82rem;
}
.clm-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
}
.clm-window-note {
  margin-top: var(--space-2);
  font-size: 0.82rem;
}
.clm-window-note.tone-warning {
  color: var(--warning, #e0a93b);
}
.clm-band-note,
.clm-band-subsection h4 {
  font-size: 0.8rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  margin: var(--space-2) 0 6px;
}
.clm-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-2);
}
.clm-stat-grid-tally {
  margin-top: var(--space-2);
}
.clm-tally-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.clm-tally-list li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.55);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
  font-size: 0.82rem;
}
.clm-tally-list li strong {
  font-variant-numeric: tabular-nums;
}

/* ── Lean "Log sistema" cockpit: verdict + health tiles + anomalies ──────────── */
.clm-verdict-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.14);
}
.clm-verdict-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(var(--line-rgb), 0.08);
  color: var(--muted-strong);
}
.clm-verdict-icon svg { width: 15px; height: 15px; display: block; }
.clm-verdict-card.tone-success .clm-verdict-icon { background: var(--success-soft); color: var(--success); }
.clm-verdict-card.tone-warning .clm-verdict-icon { background: var(--warning-soft); color: var(--warning); }
.clm-verdict-card.tone-danger .clm-verdict-icon { background: var(--danger-soft); color: var(--danger); }
.clm-verdict-card.tone-danger { background: var(--danger-soft); border-color: rgba(var(--danger-rgb), 0.4); }
.clm-verdict-card.tone-warning { border-color: rgba(var(--warning-rgb), 0.32); }
.clm-verdict-title { margin: 0; font-size: 0.98rem; font-weight: 600; color: var(--ink); }
.clm-verdict-sub { margin: 3px 0 0; font-size: 0.82rem; color: var(--muted-strong); }

.clm-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-2);
}
.clm-tile {
  background: rgba(8, 12, 20, 0.45);
  border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
}
.clm-tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.clm-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(var(--line-rgb), 0.08);
  color: var(--muted-strong);
}
.clm-tile-icon svg { width: 11px; height: 11px; display: block; }
.clm-tile.tone-success .clm-tile-icon { background: var(--success-soft); color: var(--success); }
.clm-tile.tone-warning .clm-tile-icon { background: var(--warning-soft); color: var(--warning); }
.clm-tile.tone-danger .clm-tile-icon { background: var(--danger-soft); color: var(--danger); }
.clm-tile-label { font-size: 0.84rem; color: var(--muted-strong); }
.clm-tile-status { margin-left: auto; font-size: 0.76rem; color: var(--muted); }
.clm-tile.tone-success .clm-tile-status { color: var(--success); }
.clm-tile.tone-warning .clm-tile-status { color: var(--warning); }
.clm-tile.tone-danger .clm-tile-status { color: var(--danger); }
.clm-tile-rows { display: flex; flex-direction: column; gap: 7px; font-size: 0.84rem; }
.clm-tile-row { display: flex; justify-content: space-between; gap: 10px; }
.clm-tile-row > span:first-child { color: var(--muted); }
.clm-tile-row > span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }
.clm-tile-row > span.tone-danger { color: var(--danger); }
.clm-tile-row > span.tone-warning { color: var(--warning); }
.clm-tile-empty { margin: 0; font-size: 0.82rem; color: var(--muted); }

.clm-anomalies-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-2); }
.clm-anomalies-head h3 { margin: 0; }
.clm-anomalies-list {
  border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.clm-anomaly-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(var(--accent-bright-rgb), 0.08);
  font-size: 0.84rem;
}
.clm-anomaly-row:last-child { border-bottom: none; }
.clm-anomaly-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clm-anomaly-chip {
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-bright-rgb), 0.1);
  color: var(--muted-strong);
  font-size: 0.74rem;
  white-space: nowrap;
}
.clm-anomaly-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; color: var(--ink); }

/* Backtest */
.bt-panel { display: flex; flex-direction: column; gap: 18px; }
.bt-selectors { display: flex; flex-direction: column; gap: 10px; }
.bt-strategy-list { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-strategy-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  cursor: pointer;
  background: rgba(var(--line-rgb), 0.03);
}
.bt-strategy-pick input { margin: 0; }
.bt-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.bt-run-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.bt-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.76rem; color: var(--muted-strong); }
.bt-field input { font: inherit; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface, transparent); color: var(--ink); }
.bt-note { margin: 0; font-size: 0.78rem; color: var(--muted); font-style: italic; }
.bt-banner-warn { color: var(--warning); background: var(--warning-soft); border: 1px solid rgba(var(--warning-rgb), 0.2); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.84rem; }
.bt-no-target { border-left: 3px solid var(--warning); padding-left: 10px; }

.bt-kpi-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.bt-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(var(--line-rgb), 0.03);
}
.bt-kpi-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: #6a7888; }
.bt-kpi-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.2; }
.bt-badge-warn {
  grid-column: 1 / -1;
  align-self: start;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(var(--warning-rgb), 0.2);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  width: fit-content;
}

.bt-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.bt-chart-block h4 { margin: 0 0 6px; font-size: 0.82rem; color: var(--muted-strong); }
.bt-equity-svg, .bt-bars-svg { width: 100%; height: auto; display: block; }
.bt-equity-line { fill: none; stroke: var(--accent-bright, currentColor); stroke-width: 2; }
.bt-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.bt-bar-pos { fill: var(--success); }
.bt-bar-neg { fill: var(--danger); }

.bt-bets-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bt-bets-head h4 { margin: 0; flex: 0 0 auto; }
.bt-bets-head input[type="search"] { flex: 1 1 220px; font: inherit; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface, transparent); color: var(--ink); }
.bt-export-actions { display: flex; gap: 8px; }

/* Tabelle con scroll interno: la pagina non deve allungarsi, header sticky. */
.bt-table-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.bt-table-scroll table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.bt-table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}
.bt-table-scroll td { padding: 7px 10px; border-bottom: 1px solid rgba(var(--line-rgb), 0.5); white-space: nowrap; }
.bt-table-scroll tbody tr:last-child td { border-bottom: none; }

.bt-win { color: var(--success); font-weight: 600; }
.bt-loss { color: var(--danger); font-weight: 600; }
.bt-void { color: var(--muted-strong); }

.bt-breakdowns { display: flex; flex-direction: column; gap: 10px; }
.bt-tab-row { display: flex; gap: 6px; }
.bt-tab-btn {
  font: inherit;
  font-size: 0.8rem;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
}
.bt-tab-btn.is-active { color: var(--ink); background: rgba(var(--accent-bright-rgb), 0.12); border-color: rgba(var(--accent-bright-rgb), 0.4); }

.bt-cmp-table th.bt-cmp-th { cursor: pointer; user-select: none; }
.bt-cmp-th.is-sorted-asc::after { content: " ▲"; font-size: 0.7em; }
.bt-cmp-th.is-sorted-desc::after { content: " ▼"; font-size: 0.7em; }
.bt-cmp-row { cursor: pointer; }
.bt-cmp-row:hover { background: rgba(var(--accent-bright-rgb), 0.05); }
.bt-cmp-row.is-active { background: rgba(var(--accent-bright-rgb), 0.1); }
.bt-cmp-name { display: flex; align-items: center; gap: 6px; }
.bt-cmp-error { color: var(--muted); font-style: italic; }

.bt-detail-title { margin: 0; font-size: 1rem; color: var(--ink); }

/* ══════════════════════════════════════════════════════════════════
   MONEY MANAGEMENT
   ══════════════════════════════════════════════════════════════════ */

/* Colori P&L condivisi (usati anche dalle tabelle Backtest). */
.profit-pos { color: var(--success); font-weight: 600; }
.profit-neg { color: var(--danger); font-weight: 600; }

.mm-panel-root { display: flex; flex-direction: column; }
#money-root { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mm-panel { min-width: 0; background: var(--bg-muted); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; }
.mm-panel > h3 { margin: 0 0 10px; font-size: 0.95rem; color: var(--ink); }
.mm-panel > h4 { margin: 12px 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6a7888; }
.mm-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mm-panel-head h3 { margin: 0; }
.mm-muted { color: var(--muted-strong); font-weight: 400; }
.mm-danger { color: var(--danger); }

/* Top bar */
.mm-topbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.mm-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; color: #6a7888; }
.mm-field select, .mm-field input { background: rgb(14, 20, 28); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 8px; padding: 6px 8px; font-size: 0.85rem; }
.mm-field--wide { position: relative; flex: 1 1 220px; }
.mm-topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.mm-units-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.mm-toggle-btn { background: transparent; color: var(--muted-strong); border: none; padding: 6px 12px; font-size: 0.82rem; cursor: pointer; }
.mm-toggle-btn.is-active { background: rgba(var(--accent-bright-rgb), 0.15); color: var(--accent-bright); }

/* KPI grid */
.mm-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.mm-kpi { background: rgb(14, 20, 28); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.mm-kpi--accent { border-color: rgba(var(--accent-bright-rgb), 0.35); }
.mm-kpi-label { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #6a7888; }
.mm-kpi-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.mm-badge-warn { grid-column: 1 / -1; color: var(--warning); font-size: 0.72rem; }

/* Two-column layout */
.mm-two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .mm-two-col { grid-template-columns: 1fr; } }

/* Tables */
.mm-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
.mm-positions-table, .mm-bets-table, .mm-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.mm-positions-table th, .mm-bets-table th, .mm-breakdown-table th { text-align: left; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6a7888; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mm-positions-table td, .mm-bets-table td, .mm-breakdown-table td { padding: 6px 8px; border-bottom: 1px solid rgba(var(--line-rgb), 0.06); font-variant-numeric: tabular-nums; }
.mm-bets-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.mm-row-actions { white-space: nowrap; display: flex; gap: 6px; }
.mm-side { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.mm-side--back { background: rgba(94, 193, 255, 0.14); color: #5ec1ff; }
.mm-side--lay { background: rgba(219, 107, 112, 0.16); color: var(--danger); }
.mm-won { color: var(--success); font-weight: 600; }
.mm-lost { color: var(--danger); font-weight: 600; }
.mm-void { color: var(--muted-strong); }
.mm-pending { color: var(--warning); }
.mm-clv-inline { font-size: 0.68rem; margin-left: 4px; }

/* Tab row (breakdown selector) */
.mm-tab-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.mm-tab-btn { background: transparent; border: 1px solid var(--line-strong); color: var(--muted-strong); border-radius: 6px; padding: 4px 10px; font-size: 0.76rem; cursor: pointer; }
.mm-tab-btn.is-active { background: rgba(var(--accent-bright-rgb), 0.12); color: var(--accent-bright); border-color: rgba(var(--accent-bright-rgb), 0.3); }

/* SVG charts */
.mm-capital-svg { width: 100%; height: 180px; }
.mm-capital-line { fill: none; stroke: var(--accent-bright); stroke-width: 1.6; }
.mm-flow-in { fill: var(--success); }
.mm-flow-out { fill: var(--danger); }
.mm-bars-svg { width: 100%; height: 90px; }
.mm-bar-pos { fill: rgba(var(--success-rgb), 0.7); }
.mm-bar-neg { fill: rgba(var(--danger-rgb), 0.7); }
.mm-zero { stroke: rgba(var(--line-rgb), 0.3); stroke-width: 1; }
.mm-heatmap-wrap { overflow-x: auto; }
.mm-heatmap-svg { display: block; max-width: none; }
.mm-heat-pos { fill: var(--success); }
.mm-heat-neg { fill: var(--danger); }
.mm-heat-zero { fill: rgba(var(--line-rgb), 0.2); }
.mm-heat-month { fill: #6a7888; font-size: 9px; }

/* CLV block */
.mm-clv-head { display: flex; gap: 24px; margin-bottom: 10px; flex-wrap: wrap; }
.mm-clv-kpi { display: flex; flex-direction: column; }
.mm-clv-kpi span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6a7888; }
.mm-clv-kpi strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* Guardrail banner */
.mm-guardrail-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--warning-soft); border: 1px solid rgba(var(--warning-rgb), 0.4); border-radius: var(--radius-md); padding: 10px 14px; color: var(--warning); }
.mm-guardrail-banner ul { margin: 0; padding-left: 16px; font-size: 0.82rem; }
.mm-guardrail-icon { font-size: 1.1rem; }

/* Bankroll manager + inline forms */
.mm-bankroll-manager { background: var(--bg-muted); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 14px; }
.mm-bankroll-manager summary { cursor: pointer; font-size: 0.85rem; color: var(--ink); font-weight: 600; }
.mm-inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.mm-inline-form input, .mm-inline-form select { background: rgb(14, 20, 28); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 6px; padding: 6px 8px; font-size: 0.82rem; }

/* Bet form */
.mm-bet-form { background: var(--bg-muted); border: 1px solid rgba(var(--accent-bright-rgb), 0.25); border-radius: var(--radius-md); padding: 14px 16px; }
.mm-bet-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mm-bet-form-actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.mm-liability { display: block; margin-top: 3px; font-size: 0.7rem; color: var(--warning); }
.mm-fx-dropdown { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 4px 0; list-style: none; background: rgb(18, 25, 35); border: 1px solid var(--line-strong); border-radius: 8px; max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.mm-fx-dropdown li { padding: 6px 10px; cursor: pointer; font-size: 0.82rem; }
.mm-fx-dropdown li:hover { background: rgba(var(--accent-bright-rgb), 0.1); }
/* Badge "conclusa" nell'autocomplete: distingue le partite finite (bet passate). */
.mm-fx-done { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 0.66rem; font-weight: 600; color: var(--muted-strong); background: var(--line-strong); vertical-align: middle; }
/* Nota in testa al form quando si modifica una posizione aperta. */
.mm-form-note { margin: 0 2px 8px; font-size: 0.8rem; font-weight: 600; color: var(--accent-bright); }
.mm-stake-suggest { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mm-stake-suggest input { background: rgb(14, 20, 28); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 6px; padding: 6px 8px; font-size: 0.82rem; width: 120px; }
.mm-sg-out { font-size: 0.82rem; color: var(--muted-strong); }
.mm-bets-actions { display: flex; gap: 8px; align-items: center; }
.mm-bets-actions input { background: rgb(14, 20, 28); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 6px; padding: 5px 8px; font-size: 0.82rem; }
