:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel2: #1e242c;
  --border: #2a323d;
  --text: #e7ecf2;
  --muted: #93a1b0;
  --accent: #a8c900;      /* verde lime SpotBox (logo) */
  --accent-d: #7e9a00;
  --accent-ink: #12160a;  /* testo su sfondo accent */
  --brand-navy: #202a38;  /* blu/antracite del monitor nel logo */
  --danger: #e5533c;
  --warn: #e0a72b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text);
  padding: 7px 12px; border-radius: 8px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-d); }
button.danger { color: var(--danger); }
button.small { padding: 4px 8px; font-size: 12px; }
input, select {
  font: inherit; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--panel2); border: 1px solid var(--border); }
.pill.ok { color: var(--accent); border-color: var(--accent-d); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.off { color: var(--muted); }
.pill.exp { color: var(--danger); border-color: var(--danger); }
code { background: #0a0d10; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; word-break: break-all; }

/* layout */
header.top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--accent);
}
header.top .spacer { flex: 1; }
header.top .brand-ctx { font-size: 12px; letter-spacing: 0.5px; }

/* ── brand (logo SpotBox) ─────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { flex: none; display: block; }
.brand-word { display: flex; flex-direction: column; line-height: 1; }
.brand-word .name { margin: 0; font-weight: 800; letter-spacing: 0.5px; font-size: 16px; }
.brand-word .name .spot { color: var(--accent); }
.brand-word .name .box { color: var(--text); }
.brand-word .tag { margin-top: 3px; font-size: 9px; letter-spacing: 1.8px; color: var(--muted); text-transform: uppercase; }
.brand.lg .brand-mark svg { width: 52px; height: 42px; }
.brand.lg .brand-word .name { font-size: 27px; }
.brand.lg .brand-word .tag { font-size: 10px; margin-top: 5px; }
nav.tabs { display: flex; gap: 4px; padding: 10px 20px 0; background: var(--panel); border-bottom: 1px solid var(--border); }
nav.tabs button { border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; background: transparent; }
nav.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Le stesse schede dentro la pagina view-only: li' vivono gia' dentro <main>, che
   ha il suo padding, e non devono ridisegnare la fascia dell'intestazione. */
#view-root nav.tabs { padding: 0; margin-bottom: 14px; background: transparent; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
section.tab { display: none; }
section.tab.active { display: block; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card .thumb { width: 100%; aspect-ratio: 16/9; background: #000 center/contain no-repeat; border-bottom: 1px solid var(--border); }
.card .body { padding: 12px; }
.card .body h3 { margin: 0 0 4px; font-size: 15px; }
.card .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.chips .pill { font-size: 10px; padding: 1px 6px; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
/* Elenco Points della tabella Palinsesto: con 22 Point puo' essere lungo, e
   sul telefono la colonna e' quella che si mangia piu' spazio. */
.points-cell { font-size: 11px; line-height: 1.5; color: var(--muted); }
.thumb-sm { display: block; width: 140px; aspect-ratio: 16/9; object-fit: contain; background: #000; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; }
.thumb-sm:hover { border-color: var(--accent); }

/* Ingrandimento dell'anteprima (pagina view-only) */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 40px 24px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.6); background: #000; }
.lightbox .lb-name { position: absolute; left: 24px; bottom: 14px; right: 90px; color: #cfd6df; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox .lb-close { position: absolute; top: 14px; right: 18px; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 14px; font-size: 15px; cursor: pointer; }
.lightbox .lb-close:hover { background: rgba(255,255,255,.22); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; min-width: 130px; }
.stat .n { font-size: 26px; font-weight: 700; color: var(--accent); }
.stat .l { font-size: 12px; color: var(--muted); }

/* login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse 800px 500px at 50% -10%, rgba(168, 201, 0, 0.10), transparent 60%),
    var(--bg);
}
.login-card { background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 14px; padding: 28px; width: 340px; }
.login-card .brand { margin-bottom: 4px; }
.login-card p.muted { margin: 10px 0 0; }
.login-card .field { margin-bottom: 12px; }
.login-card input { width: 100%; }

/* upload / template preview */
.preview-box { position: relative; width: 100%; aspect-ratio: 16/9; background: #000 center/contain no-repeat; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.preview-window { position: absolute; border: 2px dashed var(--accent); background: rgba(168,201,0,0.12); display: grid; place-items: center; text-align: center; }
.preview-window span { font-size: 12px; color: var(--accent); background: rgba(0,0,0,0.55); padding: 3px 8px; border-radius: 6px; }
.err { color: var(--danger); }
.ok { color: var(--accent); }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 8px; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.toast.err { border-left-color: var(--danger); }
.checklist { display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.checklist label { display: flex; align-items: center; gap: 6px; color: var(--text); margin: 0; }

/* Tabella Palinsesto sotto ~480px: la miniatura fissa da 140px + due colonne
   data facevano superare i 375px di un telefono normale, e il browser
   rimpiccioliva l'INTERA pagina per stare nello schermo invece di andare a
   capo (misurato: 447px di tabella contro 375 di viewport). */
@media (max-width: 480px) {
  th, td { padding: 6px 6px; }
  .thumb-sm { width: 64px; }
  .points-cell { font-size: 10px; }
}
