@charset "UTF-8";
/* =====================================================================================
   iDealer 4.0 - Design system del pannello web - "Coerenza" (ridesign metrico)
   Percorso: admin/assets/panel.css

   FILO CONDUTTORE: la coerenza non e' un'opinione, e' una METRICA. Ogni elemento
   interattivo del pannello (input, select, button) condivide le STESSE tre grandezze:
   altezza --h-input (38px), raggio --radius (8px), padding orizzontale --pad-x (12px).
   Da queste tre regole condivise nasce l'allineamento automatico di form, filtri e
   celle d'azione: niente bottoni piu' alti degli input, niente select con estetica
   propria, niente checkbox sfalsati rispetto alle intestazioni di colonna.

   COMPONENTI DI COERENZA (usati dalle pagine):
   - .filter-grid    griglia per form di filtro e form compatti (auto-fit minmax 180px);
   - .filter-actions fila di bottoni dentro .filter-grid (submit + reset);
   - .cell-actions   fila di bottoni dentro una cella "Azioni" (inline-flex, gap 4px);
   - .check-control  riga alta 38px che centra verticalmente un checkbox rispetto
                     agli input della stessa riga;
   - td[data-label]  etichetta di colonna mostrata dallo stack verticale < 768px.

   TOKEN NON NEGOZIABILI:
   - superfici chiare neutre (--bg / --surface / --surface-alt), bordi --border;
   - sidebar quasi nera (--side-*) con UN solo accento pieno: teal profondo --accent;
   - metriche condivise: --h-input 38px, --radius 8px, --pad-x 12px.

   Vincoli rispettati:
   - NESSUN asset esterno: nessun framework, nessuna CDN, nessun font remoto; gli UNICI
     url() ammessi sono i glifi SVG inline come data-URI;
   - PHP server-rendered: zero JavaScript obbligatori;
   - COMPATIBILITA: tutte le classi usate dalle pagine `admin/*.php` restano definite
     con lo stesso significato (`.card`, `.alert*`, `.btn*`, `.muted`, `.row`, `.small`,
     `table/th/td`, `.thumb`, `.pager`, `.folder`, `form.inline`, `code`,
     `input/select/textarea`, `label`, `details/summary`, `.stat*`, `.status-filter`);
     le variabili `--border`, `--border-strong` (usate inline da `notifications.php`)
     e `--brand` (usata inline da `workshop_order.php`) restano presenti.

   Sezioni: 1 token | 2 base | 3 shell/sidebar | 4 topbar | 5 titoli e azioni |
             6 card e griglie | 7 tabelle | 8 form | 9 bottoni | 10 alert e toast |
             11 badge | 12 stati vuoti e dettagli | 13 statistiche | 14 login |
             15 responsive
   ===================================================================================== */

/* ------------------------------------------------------------------ 1. TOKEN */
:root {
  /* Superfici */
  --bg: #f7f8fa;                    /* fondo contenuto */
  --surface: #ffffff;               /* card, form */
  --surface-alt: #f1f3f5;           /* hover righe, superficie secondaria */
  --border: #dee2e6;                /* bordo standard (anche inline: notifications.php) */
  --border-strong: #ced4da;         /* bordo input/select (anche inline: notifications.php) */

  /* Sidebar */
  --side-bg: #1b1e27;               /* sidebar quasi nera */
  --side-surface: #232836;          /* hover voci sidebar */
  --side-text: #9da5b4;             /* testo voci non attive */
  --side-text-active: #ffffff;      /* testo voce attiva */
  --side-border: rgba(255, 255, 255, .06);

  /* Accento: UN solo colore distintivo */
  --accent: #0c8f93;                /* teal profondo, automotive */
  --accent-hover: #0a7a7e;
  --accent-light: #e0f2f1;
  --accent-text: #ffffff;           /* testo su fondo accent */
  --accent-ring: rgba(12, 143, 147, .18);  /* alone di focus */
  --brand: var(--accent);           /* alias usato inline da workshop_order.php */

  /* Testo */
  --text: #343a40;
  --text-strong: #212529;
  --text-muted: #868e96;

  /* Stati */
  --ok: #2f9e44;      --ok-bg: #ebfbee;      --ok-border: rgba(47, 158, 68, .28);
  --warn: #e8590c;    --warn-bg: #fff4e6;    --warn-border: rgba(232, 89, 12, .28);
  --error: #e03131;   --error-bg: #fff5f5;   --error-border: rgba(224, 49, 49, .28);
  --info: #1971c2;    --info-bg: #e7f5ff;    --info-border: rgba(25, 113, 194, .28);
  --neutral-soft: var(--surface-alt);
  --neutral-border: var(--border);

  /* Metriche condivise - OGNI elemento interattivo usa queste TRE grandezze */
  --h-input: 38px;                  /* altezza UNIFORME di input, select e button */
  --radius: 8px;                    /* border-radius UNIFORME di card, input, select, button */
  --pad-x: 12px;                    /* padding orizzontale UNIFORME */

  /* Tipografia */
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;

  /* Spaziature */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;

  /* Ombre */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);

  /* Layout */
  --sidebar-w: 252px;
  --content-max: 1280px;            /* larghezza del contenuto: meno margine sprecato */
}

/* ------------------------------------------------------------------ 2. BASE */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

p { margin: 0 0 var(--sp-2); }

code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .92em;
  color: var(--text-strong);
}

::selection { background: var(--accent-light); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ 3. SHELL + SIDEBAR */
.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sidebar: blocco scuro compatto, struttura pulita */
.sidebar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-2);
  background: var(--side-bg);
  color: var(--side-text);
}

/* Blocco marchio: monogramma teal piatto + nome + claim */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--side-border);
}

.brand-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-text { min-width: 0; }

.brand-name {
  display: block;
  color: var(--side-text-active);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.15;
}

.brand-tag {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, .35);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.sidebar-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.nav-group-label {
  margin: 0;
  padding: 0 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .35);
}

.nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px 14px;
  border-radius: 7px;
  color: var(--side-text);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}

.nav-link:hover {
  background: var(--side-surface);
  color: var(--side-text-active);
}

/* Voce attiva: teal pieno, il punto di riferimento della navigazione */
.nav-link.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.nav-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--side-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .02em;
  text-align: center;
}

.nav-link:hover .nav-count {
  background: rgba(255, 255, 255, .12);
  color: var(--side-text-active);
}

.nav-link.active .nav-count {
  background: rgba(255, 255, 255, .22);
  color: var(--accent-text);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-3) 48px;
}

/* ------------------------------------------------------------------ 4. TOPBAR */
header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}

header.topbar .spacer { flex: 1 1 auto; }

/* Identita' operativa: punto teal di stato + nome */
header.topbar .who {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

header.topbar .who::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

header.topbar .who strong { color: var(--text-strong); }

/* ------------------------------------------------------------------ 5. TITOLI E AZIONI DI PAGINA */
.page-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.page-head h1 { margin: 0; }

.page-head-text { min-width: 0; }
.page-head-subtitle { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

h1 {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.15;
  color: var(--text-strong);
  margin: 0 0 var(--sp-3);
}

/* Unico segno di marca: barra teal accanto al titolo di pagina */
.page-head-text h1 {
  position: relative;
  padding-left: 14px;
}

.page-head-text h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}

h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.005em;
  line-height: 1.3;
  color: var(--text-strong);
  margin: var(--sp-4) 0 var(--sp-2);
}

h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  margin: var(--sp-3) 0 var(--sp-2);
}

/* Il primo h2 di una card non apre un vuoto sotto il bordo superiore */
.card > h2:first-child,
.card-primary > h2:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ 6. CARD E GRIGLIE */
/* Superficie pulita: bordo, raggio e ombra condivisi con il resto del sistema */
.card,
.card-primary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.card-primary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-sm);
}

.card > :first-child,
.card-primary > :first-child { margin-top: 0; }

.card > :last-child,
.card-primary > :last-child { margin-bottom: 0; }

/* Fila generica di campi/controlli (compatibilita' con le pagine esistenti) */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: flex-end;
}

.row > div { flex: 0 0 auto; max-width: 100%; }

/* GRIGLIA DI FILTRI E FORM COMPATTI: le colonne si adattano allo spazio disponibile,
   gli elementi poggiano tutti sulla stessa linea di base (align-items: end) e i
   controlli occupano tutta la colonna invece del vecchio tetto di 360px. */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.filter-grid > div { min-width: 0; }

.filter-grid label { margin-top: 0; }

.filter-grid :is(input, select, textarea) { max-width: 100%; }

/* Fila di bottoni dentro la griglia (submit + reset): stessa linea degli input */
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

/* ------------------------------------------------------------------ 7. TABELLE */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

th, td {
  text-align: left;
  padding: 10px var(--pad-x);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* Intestazione discreta e leggibile: maiuscoletto con tracking */
thead th {
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  white-space: nowrap;
}

td { font-variant-numeric: tabular-nums; }

tbody tr { transition: background .1s ease; }

tbody tr:hover { background: var(--surface-alt); }

tbody tr:last-child td { border-bottom: 0; }

th.align-right, td.align-right { text-align: right; }
th.align-center, td.align-center { text-align: center; }

/* CHECKBOX IN TABELLA: centrati orizzontalmente e verticalmente sia nell'intestazione
   che nelle celle quando il checkbox e' l'unico contenuto (colonne "Attivo"/selezione).
   Regola progressiva: senza :has() resta solo l'assetto verticale, mai una rottura. */
td > input[type=checkbox]:only-child,
th > input[type=checkbox]:only-child {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

td:has(> input[type=checkbox]:only-child),
th:has(> input[type=checkbox]:only-child) { text-align: center; }

/* BOTTONI IN CELLA: tutti sulla stessa linea, allineati al centro della riga */
td .btn,
td button { vertical-align: middle; }

/* Form inline dentro una cella: box flessibile, nessun spostamento di baseline */
td form.inline {
  display: inline-flex;
  vertical-align: middle;
  margin: 0;
}

/* Paginatore */
.pager {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

/* ------------------------------------------------------------------ 8. FORM */
label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: var(--sp-2) 0 var(--sp-1);
}

/* REGOLA DI COERENZA FONDAMENTALE: STESSA altezza (--h-input), STESSO raggio
   (--radius), STESSO padding (--pad-x) per input, select e button. Il selettore
   condiviso rende impossibile che i tre componenti divergano di nuovo. */
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=tel],
input[type=search],
input[type=date],
input[type=url],
input[type=file],
select {
  height: var(--h-input);
  width: 100%;
  max-width: 360px;
  padding: 0 var(--pad-x);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-base);
  line-height: calc(var(--h-input) - 2px);
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}

input[type=file] { padding: 7px var(--pad-x); line-height: 1.4; }

/* Select: STESSA estetica degli input, chevron SVG inline (unico url() ammesso qui) */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: calc(var(--pad-x) + 22px);
  background: var(--surface)
    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 1.5L6 6.5L11 1.5' fill='none' stroke='%23868e96' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right var(--pad-x) center;
}

input[type=checkbox],
input[type=radio] {
  margin: 0 var(--sp-1) 0 0;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  accent-color: var(--accent);
}

input:hover, select:hover { border-color: var(--text-muted); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Textarea: min-height invece di height fissa, stesse superfici e raggio degli input */
textarea {
  width: 100%;
  max-width: 560px;
  min-height: 7rem;
  padding: var(--sp-2) var(--pad-x);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}

/* Checkbox allineato alla riga: il contenitore ha l'altezza di un input e il
   checkbox e' centrato al suo interno, cosi' "Attivo/Attiva" e' sulla stessa
   linea visiva dei campi vicini in .row e .filter-grid */
.check-control {
  display: flex;
  align-items: center;
  height: var(--h-input);
}

.check-control input[type=checkbox] { margin: 0; vertical-align: middle; }

/* Checkbox dentro una label di testo ("Confermo di ..."): niente offset ereditato */
label > input[type=checkbox],
label > input[type=radio] { vertical-align: -3px; }

form.inline { display: inline-flex; align-items: center; gap: var(--sp-1); }

.field { margin-bottom: var(--sp-2); }

.field-hint {
  display: block;
  margin: var(--sp-1) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.field-error {
  display: block;
  margin: var(--sp-1) 0 0;
  color: var(--error);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.field-required { color: var(--error); }

/* ------------------------------------------------------------------ 9. BOTTONI */
/* Stessa anatomia dei campi: altezza --h-input, raggio --radius, padding --pad-x */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: var(--h-input);
  padding: 0 calc(var(--pad-x) + 4px);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-base);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}

/* Primary: accent pieno */
button, .btn {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

button:hover, .btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}

button:active, .btn:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .18); }

button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled, .btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Secondary: bianco con bordo */
button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

button.secondary:hover, .btn.secondary:hover {
  background: var(--surface-alt);
  border-color: var(--text-muted);
  color: var(--text-strong);
}

button.secondary:active, .btn.secondary:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .08); }

/* Danger: rosso pieno */
button.danger, .btn.danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

button.danger:hover, .btn.danger:hover {
  background: #c92a2a;
  border-color: #c92a2a;
}

/* Small: piu' denso nel testo ma STESSA altezza degli altri controlli: e' la
   condivisione dell'altezza che tiene allineati i bottoni nelle celle "Azioni" */
button.small, .btn.small {
  height: var(--h-input);
  padding: 0 var(--pad-x);
  font-size: var(--fs-sm);
}

/* AZIONI IN CELLA: fila compatta e allineata (link + form inline nello stesso td) */
.cell-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* ------------------------------------------------------------------ 10. ALERT E TOAST */
.alert {
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: var(--sp-3);
  border: 1px solid transparent;
  border-left-width: 3px;
  font-size: var(--fs-base);
}

.alert-success {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
  border-left-color: var(--ok);
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
  border-left-color: var(--error);
}

/* I flash di sessione diventano toast: consumati alla richiesta successiva (nessun JS per
   chiuderli, nessun asset esterno). `pointer-events:none` sulla pila: un toast non deve
   mai bloccare i click sulla pagina sotto. */
.toast-stack {
  position: fixed;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(420px, calc(100vw - var(--sp-4)));
  pointer-events: none;
}

.toast {
  margin: 0;
  box-shadow: var(--shadow-md);
  animation: toast-in .25s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------------------------------------ 11. BADGE */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.6;
  white-space: nowrap;
}

.badge::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-neutral { background: var(--neutral-soft); color: var(--text); border-color: var(--neutral-border); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge-error { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }

/* ------------------------------------------------------------------ 12. STATI VUOTI, DETTAGLI, VARI */
/* Stato vuoto: glifo "documento" disegnato in CSS puro, tinta neutra */
.empty-state {
  padding: 36px var(--sp-3);
  text-align: center;
  color: var(--text-muted);
}

.empty-state::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  background-image:
    linear-gradient(var(--accent) 0 0),
    linear-gradient(var(--border-strong) 0 0),
    linear-gradient(var(--border-strong) 0 0);
  background-repeat: no-repeat;
  background-size: 22px 3px, 22px 3px, 15px 3px;
  background-position: 50% 38%, 50% 51%, 50% 64%;
}

.empty-state-title {
  display: block;
  margin-bottom: var(--sp-1);
  color: var(--text-strong);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.empty-state-text { display: block; }

.muted { color: var(--text-muted); font-size: var(--fs-sm); }

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.folder {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--sp-2) 14px;
  margin: var(--sp-2) 0;
  background: var(--surface-alt);
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
  margin: var(--sp-2) 0;
  background: var(--surface);
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-strong);
}

summary::marker { color: var(--accent); }

.summary { cursor: pointer; font-weight: 700; }

/* Filtro di stato (elenchi con collegamenti "tutti/aperti/chiusi") */
.status-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.status-filter a {
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}

.status-filter a:hover {
  border-color: var(--text-muted);
  color: var(--text-strong);
}

/* Voce attiva: stessa anatomia del bottone primary, in versione pill */
.status-filter a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* ------------------------------------------------------------------ 13. STATISTICHE (dashboard) */
.stat-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: var(--sp-3);
}

/* Stessa superficie delle card: le pagine possono aggiungere un bordo
   sinistro di accento inline (es. timeline di workshop_order.php) */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  margin-top: var(--sp-1);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-unit { font-size: var(--fs-lg); font-weight: 600; vertical-align: top; }

/* ------------------------------------------------------------------ 14. LOGIN */
/* Pannello scuro a sinistra (marchio + claim + lista punti), card bianca a destra.
   Su schermo stretto il pannello diventa un banner superiore. */
.auth-body { background: var(--side-bg); }

.auth-shell { min-height: 100vh; }

.auth-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 26px 24px;
  background: var(--side-bg);
  color: var(--side-text);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--side-text-active);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .03em;
}

.auth-brand-name { line-height: 1.2; }

.auth-side .brand-mark {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.auth-tagline {
  margin: 0;
  max-width: 38ch;
  color: var(--side-text);
  font-size: var(--fs-sm);
  line-height: 1.65;
}

.auth-points {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.auth-points li {
  position: relative;
  padding-left: 18px;
  color: var(--side-text);
  font-size: var(--fs-sm);
}

/* Tratto teal come proiettile: lo stesso segno del titolo di pagina */
.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 9px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* Segno di marca: barra teal compatta */
.auth-stripes {
  display: block;
  margin-top: 24px;
  width: 56px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.auth-shell .content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5) var(--sp-3);
  background: var(--bg);
}

/* La card di accesso: stessa superficie e stesso raggio delle card del pannello */
.auth-shell main {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xl);
  letter-spacing: -.01em;
}

.auth-shell input[type=text],
.auth-shell input[type=email],
.auth-shell input[type=password] { max-width: none; }

.auth-form .field { margin-bottom: var(--sp-3); }
.auth-form .field label { margin-top: 0; }

/* Pulsante di accesso a tutta larghezza, stessa altezza di ogni bottone */
.auth-shell main button[type=submit] {
  width: 100%;
  margin-top: var(--sp-1);
}

/* ------------------------------------------------------------------ 15. RESPONSIVE */
@media (min-width: 900px) {
  .shell { flex-direction: row; }

  .sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    min-height: 100vh;
    position: sticky;
    top: 0;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-2) var(--sp-3);
    overflow-y: auto;
  }

  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--sp-3);
  }

  .nav-group { gap: var(--sp-1); }

  .nav { flex-direction: column; flex-wrap: nowrap; }

  .nav-link { width: 100%; }

  .nav-count { margin-left: auto; }

  /* Login asimmetrico: pannello brand a sinistra, form centrato a destra */
  .auth-shell { flex-direction: row; }

  .auth-shell .auth-side {
    flex: 0 0 40%;
    min-height: 100vh;
    justify-content: center;
    padding: 48px 52px;
    gap: 14px;
  }

  .auth-shell .auth-stripes { margin-top: 40px; }

  .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}

/* Schermo stretto: card e tabelle diventano stack verticali. Le celle portano la
   propria etichetta da td[data-label] (aggiunta dalle pagine); le tabelle che non la
   dichiarano restano leggibili come blocchi di valori. */
@media (max-width: 767px) {
  main { padding: var(--sp-3) var(--sp-2) 40px; }

  h1 { font-size: var(--fs-xl); }

  .card,
  .card-primary { padding: var(--sp-2); }

  /* I gruppi di campi si impilano: niente colonne schiacciate */
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .row > div { max-width: 100%; }

  .row :is(input, select, textarea) { max-width: 100%; }

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

  .page-actions { width: 100%; }

  /* Stack verticale delle tabelle: ogni riga diventa una mini-card, ogni cella
     mostra la propria etichetta a sinistra e il valore a destra */
  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead { display: none; }

  table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  tbody tr {
    padding: var(--sp-2);
    border-bottom: 1px solid var(--border);
  }

  tbody tr:last-child { border-bottom: 0; }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
    overflow-wrap: anywhere;
  }

  td:last-child { border-bottom: 0; }

  td[colspan] {
    display: block;
    padding: 0;
    border-bottom: 0;
    text-align: center;
  }

  td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
  }

  td:has(> input[type=checkbox]:only-child) { justify-content: center; }

  td .cell-actions { justify-content: flex-end; }

  .toast-stack { right: var(--sp-2); }
}

/* Rispetto delle preferenze di riduzione del movimento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   Modale di conferma (richiesta owner 2026-09-18): sostituisce
   il confirm() nativo. Costruita da admin/assets/panel.js.
   ============================================================ */
.panel-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 18, 26, .55);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.panel-confirm {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 16px;
  box-shadow: 0 18px 45px rgba(15, 18, 26, .28);
}
.panel-confirm-title {
  margin: 0;
  font-size: 17px;
  color: var(--text-strong);
}
.panel-confirm-rule {
  width: 44px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  margin: 8px 0 12px;
}
.panel-confirm-message {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}
.panel-confirm-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
