/* Zero Futsal Knowledge - Calcio a 5 Live (Accent Ladder: blu #1d5fbf + DM Sans) */
:root {
  --ground: #f5f7fa;
  --surface: #ffffff;
  --raised: #f1f4f8;
  --border: #e3e8ef;
  --rule: #eef2f6;
  --control: #cbd3df;
  --text: #111827;
  --muted: #4b5563;
  --faint: #636a75;
  --accent: #1d5fbf;
  --accent-soft: #eef4fc;
  --accent-track: #d5e4f7;
  --accent-ink: #103a7a;
  --primary: #111827;
  --primary-ink: #ffffff;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfce7; --pill-positive-ink: #14532d;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #f1f4f8; --pill-neutral-ink: #374151;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 16px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.num, table, .kpi-value { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { color: var(--accent); flex: none; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.stamp { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Main column */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  overflow-x: clip;
}
.hero-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.scope-line { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
.hero-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tabs */
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  position: relative;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.tab-btn[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tab-btn[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent);
}

.tab-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); min-width: 0; }

/* Panels & Spotlight */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}
.spotlight-card {
  background: var(--accent-soft);
  border-color: var(--accent-track);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.spotlight-body { display: grid; gap: 6px; min-width: 0; }
.spotlight-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-text { font-size: 13px; font-weight: 500; color: var(--accent-ink); }
.spotlight-teams { font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text); }
.spotlight-note { font-size: 13px; color: var(--muted); }
.spotlight-cta { flex: none; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.wrap-head { flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; line-height: 1.3; font-weight: 600; }
.panel-meta { font-size: 13px; color: var(--muted); }
.head-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.body-note { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* KPI Strip 4 celle divise da 1px */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.kpi { padding: 14px 16px; display: grid; gap: 4px; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 24px; line-height: 1.2; font-weight: 600; color: var(--text); }
.kpi-sub { font-size: 13px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 36px;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  font-size: 14px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row-us td { background: var(--accent-soft); font-weight: 600; }
th.num, td.num { text-align: right; white-space: nowrap; }
.pos-col { width: 34px; }
.team-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.team-logo { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background: var(--surface); border: 1px solid var(--border); flex: none; }

/* Match rows */
.match-list { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.match-row + .match-row { border-top: 1px solid var(--rule); }
.match-row.is-us { background: var(--accent-soft); margin: 0; padding: 12px 10px; border-radius: 6px; border-top-color: transparent; }
.match-main { display: grid; gap: 4px; min-width: 0; }
.match-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.match-teams { font-size: 14px; font-weight: 600; color: var(--text); }
.match-venue { font-size: 13px; color: var(--muted); }
.match-side { display: flex; align-items: center; gap: 8px; flex: none; }
.score-box {
  min-width: 58px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--raised);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Power Ranking & Progress */
.pr-list { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 0; min-width: 0; }
.pr-row + .pr-row { border-top: 1px solid var(--rule); }
.pr-row.is-us { background: var(--accent-soft); margin: 0; padding: 12px 10px; border-radius: 6px; border-top-color: transparent; }
.pr-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: nowrap; }
.pr-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pr-rank { font-size: 14px; font-weight: 700; min-width: 26px; }
.pr-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-score-wrap { display: flex; align-items: center; gap: 8px; flex: none; }
.pr-track { width: 88px; height: 6px; border-radius: 999px; background: var(--accent-track); overflow: hidden; }
.pr-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.pr-val { font-size: 14px; font-weight: 700; min-width: 34px; text-align: right; }
.pr-note { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Europa League Grids */
.fasce-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pot-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px; display: grid; gap: 8px; background: var(--surface); align-content: start; }
.pot-card.pot-us { border-color: var(--accent); background: var(--accent-soft); }
.pot-title { font-size: 14px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.pot-team { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.pot-team-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pot-team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pot-team.is-us .pot-team-name { font-weight: 700; color: var(--accent-ink); }

.fixtures-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fixture-box { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px; display: grid; gap: 4px; background: var(--raised); }
.fixture-day { font-size: 13px; font-weight: 600; color: var(--muted); }
.fixture-opp { font-size: 14px; font-weight: 600; color: var(--text); }

.guide-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.guide-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 14px; display: grid; gap: 6px; }
.guide-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.sub-well { padding: 12px 14px; border-radius: var(--radius-card); background: var(--raised); font-size: 13px; color: var(--muted); display: grid; gap: 4px; }

/* Controls, Pills, Segmented */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: var(--radius-control);
  border: 1px solid var(--control); background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--raised); }
.btn.small-btn { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary-outline { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); font-weight: 600; }
.input.compact-select { height: 34px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-size: 13px; }

.segmented {
  display: inline-flex; padding: 2px; border-radius: 7px;
  background: var(--raised); border: 1px solid var(--border); max-width: 100%; overflow-x: auto;
}
.segmented button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; }

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-track); }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  background: var(--primary); color: var(--primary-ink);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 500;
}

@media (max-width: 900px) {
  .fasce-grid, .fixtures-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; }
  .stamp { display: none; }
  .container { padding: 16px 16px 32px; gap: 14px; }
  h1 { font-size: 21px; }
  .spotlight-card { flex-direction: column; align-items: stretch; padding: 14px; }
  .spotlight-cta .btn { width: 100%; min-height: 44px; }
  .panel { padding: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .hide-sm { display: none; }
  th, td { padding: 8px 6px; font-size: 13px; }
  .team-cell { min-width: 112px; gap: 6px; }
  .pr-track { width: 64px; }
  .match-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .match-side { justify-content: space-between; }
  .fasce-grid, .fixtures-grid, .guide-cols { grid-template-columns: 1fr; }
  .btn, .segmented button { min-height: 36px; }
}
