/*! XLScout Check - (c) 2026 Stefano Lullia - XLSuiteVolley. Tutti i diritti riservati. Copia, modifica e ridistribuzione vietate senza autorizzazione scritta. */
[hidden] { display: none !important; }
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --text: #1c1b19;
  --muted: #6b675f;
  --line: #e6e2da;
  --accent: #e8590c;
  --accent-soft: #fff1e8;
  --severe: #c92a2a;
  --severe-soft: #fdecec;
  --warn: #b7791f;
  --warn-soft: #fdf5e3;
  --ok: #2b8a3e;
  --home: #1971c2;
  --away: #9c36b5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312;
    --surface: #1d1c1a;
    --surface-2: #232220;
    --text: #edeae4;
    --muted: #a39e94;
    --line: #34322e;
    --accent: #ff7a33;
    --accent-soft: #3a2316;
    --severe: #ff6b6b;
    --severe-soft: #3a1c1c;
    --warn: #f0b44c;
    --warn-soft: #362a14;
    --home: #4dabf7;
    --away: #da77f2;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
.muted { color: var(--muted); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.brand b { color: var(--accent); font-weight: 800; }
.logo svg { width: 30px; height: 30px; display: block; }
.logo circle { fill: var(--accent); }
.logo path { stroke: #fff; stroke-width: 7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.topnav { display: flex; gap: 22px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.topnav a:hover { color: var(--text); }

/* Hero */
.hero { padding: 64px 0 48px; text-align: center; }
.hero h1 { font-size: clamp(32px, 5.5vw, 54px); font-weight: 800; letter-spacing: -.03em; }
.accent { color: var(--accent); }
.lead { max-width: 680px; margin: 18px auto 32px; color: var(--muted); font-size: 17px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-width: 620px; margin: 0 auto; padding: 44px 24px;
  background: var(--surface); border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 20px; cursor: pointer; transition: .18s; box-shadow: var(--shadow);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); outline: none; transform: translateY(-1px); }
.dz-icon { width: 46px; height: 46px; stroke: var(--accent); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.dz-title { font-size: 19px; font-weight: 600; }
.dz-sub { color: var(--muted); }
.privacy { display: block; max-width: 620px; margin: 20px auto 0; color: var(--muted); font-size: 14px; }
.privacy svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; fill: none; stroke: var(--ok); stroke-width: 2; }
.err { color: var(--severe); background: var(--severe-soft); display: inline-block; padding: 10px 16px; border-radius: 10px; margin-top: 16px; }
.hero.compact { padding: 0; }
.hero.compact .wrap { display: none; }

/* Results */
.results { padding: 28px 0 56px; }
.match-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.team { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-v { justify-content: flex-end; text-align: right; }
.team-name { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.team-staff { color: var(--muted); font-size: 13px; }
.tag { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 800; font-size: 13px; color: #fff; }
.tag-h { background: var(--home); }
.tag-v { background: var(--away); }
.tag.sm { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.score { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.match-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; cursor: pointer; font: inherit; color: var(--text); transition: .15s; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.kpi:hover { transform: translateY(-1px); }
.kpi-num { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-lbl { color: var(--muted); font-weight: 500; font-size: 14px; }
.kpi-severe .kpi-num { color: var(--severe); }
.kpi-warn .kpi-num { color: var(--warn); }
.kpi.active { border-color: currentColor; }
.kpi-severe.active { border-color: var(--severe); background: var(--severe-soft); }
.kpi-warn.active { border-color: var(--warn); background: var(--warn-soft); }
.kpi-roster.active { border-color: var(--accent); background: var(--accent-soft); }

.layout { display: grid; grid-template-columns: 270px 1fr; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.filters { position: sticky; top: 78px; }
.filters h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; }
.filters h3:first-child { margin-top: 0; }
.chk { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; cursor: pointer; font-size: 14px; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.chk .cnt { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 0 8px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
input[type=search] { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; }
input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { font-size: 20px; }
.actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
#gridBody tr { cursor: pointer; }
#gridBody tr:hover td { background: var(--accent-soft); }
.c-num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.severe { background: var(--severe-soft); color: var(--severe); }
.pill.warning { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 40px 0 20px; font-size: 15px; }
.empty b { color: var(--ok); }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.hint.top { margin: 0 0 16px; }

.rose { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rose h4 { margin-bottom: 10px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.grid.small td, .grid.small th { padding: 6px 10px; }
.grid select { font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.grid select.changed { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Info sections */
.info { padding: 64px 0; }
.info.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 28px; text-align: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 12px; }
.step h3 { font-size: 18px; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.check-doc { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface-2); }
.check-doc h3 { font-size: 16px; margin-bottom: 6px; }
.check-doc p { margin: 0; color: var(--muted); font-size: 14px; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 10px 0 0; }

.footer { padding: 28px 0; border-top: 1px solid var(--line); font-size: 13px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
#modalBody { padding: 16px 20px 20px; }
.ctx-info { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.ctx-info b { color: var(--text); }
.ctx { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ctx li { display: flex; gap: 14px; padding: 6px 12px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; border-bottom: 1px solid var(--line); }
.ctx li:last-child { border-bottom: 0; }
.ctx .n { color: var(--muted); width: 44px; text-align: right; flex: none; }
.ctx .h { color: var(--home); } .ctx .v { color: var(--away); }
.ctx li.hl { background: var(--severe-soft); font-weight: 600; }
.ctx li.hl.w { background: var(--warn-soft); }
.ctx-legend { color: var(--muted); font-size: 12px; margin-top: 10px; }
.ctx-errors { margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; order: 2; }
  .rose { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topnav { display: none; }
  .hero { padding: 40px 0 32px; }
  .match-teams { grid-template-columns: 1fr; text-align: left; }
  .team-v { justify-content: flex-start; flex-direction: row-reverse; text-align: left; }
  .score { font-size: 26px; }
  .summary { gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-num { font-size: 24px; }
  .kpi-lbl { font-size: 12px; }
  /* tabella → card */
  .table-wrap { border: 0; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  #gridBody tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 10px 12px; display: grid; grid-template-columns: auto auto 1fr auto; gap: 4px 10px; }
  #gridBody td { border: 0; padding: 0; text-align: left; }
  #gridBody td.c-riga::before { content: "Riga "; color: var(--muted); }
  #gridBody td.c-set::before { content: "Set "; color: var(--muted); }
  #gridBody td.c-gioc, #gridBody td.c-err, #gridBody td.c-code { grid-column: 1 / -1; }
  #gridBody td.c-sq { justify-self: end; }
}

@media print {
  .topbar, .hero, .info, .footer, .filters, .actions, .summary .kpi-roster, .hint, .btn-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11px; }
  .layout { display: block; }
  .panel, .match-card, .kpi { box-shadow: none; border-color: #ccc; }
  .results { padding: 0; }
  .grid th { position: static; }
}

.roster-note { margin: 0 0 16px; padding: 10px 16px; border-radius: 10px; font-size: 14px; background: var(--card, transparent); border: 1px solid var(--line, #ddd); }
.roster-note.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.roster-note.ok { color: var(--ok, #2f855a); }
.roster-note div + div { margin-top: 4px; }
