/* SPELL Design System (CIB D.7.05 Rev. 8), base di tutte le pagine:
   Colori del CIB e loro tinte
   (100/80/60/40/20/10% verso il bianco), font Tahoma (già installato sui computer:
   nessun font scaricato da server esterni, per il GDPR).
   Regole di contrasto del CIB: l'arancione non si usa mai per il testo su
   fondo chiaro, e non regge testo bianco sopra (testo nero/antracite). */
:root {
  /* colori principali */
  --blu-spell: #3f619a;
  --blu-20: #d9e0eb;
  --blu-10: #eceff5;
  --arancione-teatro: #f3a842;
  --arancione-40: #fadcb3;
  --arancione-20: #fdeed9;
  /* colori secondari */
  --azzurro-spell: #8fafd3;
  --azzurro-40: #d2dfed;
  --azzurro-20: #e9eff6;
  --azzurro-10: #f4f7fb;
  --corallo-spell: #f8723c;
  --corallo-10: #fef1ec;
  --sabbia-spell: #e4cda7;
  --sabbia-40: #f4ebdc;
  --sabbia-20: #faf5ed;
  --antracite-spell: #2e2e2e;
  --antracite-80: #585858;
  --antracite-20: #d5d5d5;
  --antracite-10: #eaeaea;
  --bianco: #ffffff;
  --nero: #000000;
  /* palette applicativa Vibrant Energy (non nel CIB): solo per gli stati hover */
  --navy: #2c4470;

  /* ruoli */
  --bg: var(--azzurro-10);
  --card: var(--bianco);
  --ink: var(--antracite-spell);
  --muted: var(--antracite-80);
  --border: var(--azzurro-40);

  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 9999px;
  --font: Tahoma, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--blu-spell); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--blu-spell); }
h3, h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
small, .muted { color: var(--muted); }
code { font-family: var(--mono); font-size: 0.85em; background: var(--blu-10); color: var(--blu-spell); padding: 0.05rem 0.35rem; border-radius: var(--radius-sm); }

/* Barra superiore: testo sempre bianco sul blu (6,2:1). */
.topbar { background: var(--blu-spell); color: var(--bianco); display: flex; align-items: center; gap: 1.25rem; padding: 0.7rem 1.5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 0.6rem; color: var(--bianco); }
.brand .logo { font-weight: 700; letter-spacing: 0.18em; font-size: 1.05rem; }
.brand .app { font-weight: 500; padding-left: 0.6rem; border-left: 2px solid var(--arancione-teatro); }
.topbar nav a { color: var(--bianco); text-decoration: none; font-weight: 500; }
.topbar nav a:hover { text-decoration: underline; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.topbar .meta { font-family: var(--mono); font-size: 0.75rem; color: var(--bianco); white-space: nowrap; }
.token-field { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--bianco); margin: 0; }
.token-field input { width: 7rem; padding: 0.3rem 0.5rem; font-size: 0.8rem; background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.45); color: var(--bianco); }
.token-field input::placeholder { color: rgba(255, 255, 255, 0.75); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.1rem; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.card > h2 { margin-bottom: 0.75rem; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--muted); margin: 0.6rem 0 0.25rem; }
input, select, textarea { font: inherit; font-size: 0.88rem; padding: 0.42rem 0.6rem; border: 1px solid var(--antracite-20); border-radius: var(--radius-md); background: var(--bianco); color: var(--ink); margin: 0; }
textarea { width: 100%; line-height: 1.5; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blu-spell); outline-offset: 1px; }
.field-full { width: 100%; }

button { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.45rem 0.9rem; border-radius: var(--radius-md); border: 1px solid transparent; background: var(--blu-spell); color: var(--bianco); cursor: pointer; margin: 0; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--navy); }
button.primary-accent { background: var(--arancione-teatro); color: var(--nero); }
button.primary-accent:hover:not(:disabled) { background: var(--arancione-teatro); box-shadow: inset 0 0 0 2px var(--antracite-spell); }
button.secondary { background: var(--bianco); color: var(--blu-spell); border-color: var(--border); }
button.secondary:hover:not(:disabled) { background: var(--blu-10); }
button.danger { background: var(--bianco); color: var(--antracite-spell); border-color: var(--corallo-spell); }
button.danger:hover:not(:disabled) { background: var(--corallo-10); }
button.small { padding: 0.24rem 0.55rem; font-size: 0.78rem; }
button:disabled { opacity: 0.45; cursor: default; }

.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }

/* Messaggi: il corallo non regge il testo, quindi testo scuro su tinta corallo. */
#err, .err { color: var(--antracite-spell); background: var(--corallo-10); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; font-size: 0.85rem; margin: 0.5rem 0 0; }
.ok { color: var(--antracite-spell); background: var(--azzurro-20); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; font-size: 0.85rem; margin: 0.5rem 0 0; }
#err:empty, .err:empty, .ok:empty { display: none; }
.warn { color: var(--antracite-spell); background: var(--arancione-20); border-radius: var(--radius-sm); padding: 0 0.3rem; }

/* Stati di sessione: blu (in corso), sabbia (sala d'attesa), arancione (pausa), antracite (conclusa). */
.pill { display: inline-block; padding: 0.12rem 0.6rem; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; background: var(--azzurro-20); color: var(--antracite-spell); white-space: nowrap; }
.pill.s-RUNNING { background: var(--blu-spell); color: var(--bianco); }
.pill.s-LOBBY { background: var(--sabbia-spell); color: var(--nero); }
.pill.s-PAUSED { background: var(--arancione-teatro); color: var(--nero); }
.pill.s-COMPLETED, .pill.s-ARCHIVED { background: var(--antracite-10); color: var(--antracite-spell); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 0.5rem; border-bottom: 1px solid var(--border); }
td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.dot.on { background: var(--blu-spell); }
.dot.off { background: var(--antracite-20); }

.list-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }

.signature { text-align: center; font-size: 0.75rem; color: var(--muted); padding: var(--space-6) 0 var(--space-4); }
