/* ==========================================================================
   G2 Ingegneria — design tokens condivisi
   ==========================================================================
   Questo file è IDENTICO in G2 Gestione Commesse (client/src/g2-tokens.css)
   e in Sicant (static/css/g2-tokens.css). Un test in ciascun repository ne
   confronta lo SHA-256 con un valore pinnato: chi lo modifica aggiorna il
   file e l'hash in tutti e due i repository nello stesso giro.

   Contiene SOLO variabili CSS: palette, ruoli semantici, famiglie e scala
   tipografica, spaziature, raggi, ombre, movimento, più il blocco scuro.
   Niente @font-face (i percorsi dei font sono dell'app), niente classi,
   niente regole su html/body: quelle stanno nel CSS dell'applicazione.

   Riferimento: docs/2026-10-11-specifica-ui-riferimento.md, §2 e §10.
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------------
     PRIMITIVE — scale di brand. Nei componenti si usano i ruoli semantici
     più sotto, non queste.
     ------------------------------------------------------------------------ */

  /* Teal — estratto dal brand (#014455), scala a 11 passi */
  --teal-50:  #E6EEF1;
  --teal-100: #C2D3DA;
  --teal-200: #9AB5BF;
  --teal-300: #6E93A1;
  --teal-400: #427586;
  --teal-500: #155A6E;   /* teal interattivo */
  --teal-600: #014455;   /* TEAL DI BRAND — primario */
  --teal-700: #013847;
  --teal-800: #012C38;
  --teal-900: #00202A;
  --teal-950: #00141B;

  /* Red — estratto dal brand (#D40000) */
  --red-50:  #FBE6E6;
  --red-100: #F4B8B8;
  --red-200: #EC8686;
  --red-300: #E25151;
  --red-400: #DB2929;
  --red-500: #D40000;   /* ROSSO DI BRAND — accento e azione primaria */
  --red-600: #B80000;
  --red-700: #990000;
  --red-800: #7A0000;
  --red-900: #5A0000;

  /* Neutri — bilanciati caldo/freddo per stare accanto al teal */
  --white:    #FFFFFF;
  --paper:    #F7F8F9;   /* sfondo pagina */
  --mist:     #EDEFF2;   /* superficie incassata */
  --haze:     #DFE3E7;   /* bordi su paper */
  --steel-100: #C9CFD4;
  --steel-200: #A6AFB6;
  --steel-300: #7F8A92;
  --steel-400: #5E6A73;
  --steel-500: #434F58;
  --steel-600: #2D3740;
  --steel-700: #1E272F;
  --steel-800: #131A20;
  --black:    #050A0E;

  /* ------------------------------------------------------------------------
     RUOLI SEMANTICI — da usare nei componenti
     ------------------------------------------------------------------------ */

  --brand:         var(--teal-600);
  --brand-ink:     var(--white);     /* testo e glifi su --brand */
  --brand-accent:  var(--red-500);   /* il punto rosso */
  --brand-muted:   var(--teal-50);   /* superfici tinte */

  --bg:            var(--paper);
  --bg-elevated:   var(--white);
  --bg-sunken:     var(--mist);
  --bg-inverse:    var(--teal-600);

  --fg:            var(--steel-700);   /* testo primario su chiaro */
  --fg-muted:      var(--steel-500);
  --fg-subtle:     var(--steel-400);
  --fg-inverse:    var(--white);       /* testo su teal */
  --fg-inverse-muted: #B7C7CD;

  --border:        var(--haze);
  --border-strong: var(--steel-200);
  --border-inverse: rgba(255,255,255,0.18);

  --focus-ring:    var(--red-500);     /* il focus è rosso: on-brand */

  /* Stati — colore pieno, fondo, bordo e testo su fondo tinto */
  --success:        #1F7A4D;
  --success-bg:     #E3F2EA;
  --success-border: #BFDECB;
  --success-text:   #1F7A4D;
  --warning:        #C67A00;
  --warning-bg:     #FBF1DD;
  --warning-border: #EAD4A8;
  --warning-text:   #8A5600;
  --info:           var(--teal-500);
  --info-bg:        var(--teal-50);
  --info-border:    var(--teal-100);
  --info-text:      var(--teal-600);
  --danger:         var(--red-500);
  --error-bg:       var(--red-50);
  --error-border:   var(--red-100);
  --error-text:     var(--red-500);
  --danger-bg:      var(--error-bg);   /* alias storico di Sicant */

  /* ------------------------------------------------------------------------
     TIPOGRAFIA — famiglie e scala
     ------------------------------------------------------------------------ */

  --font-sans:     'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display:  'Century Gothic', 'Inter Tight', sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Scala per cruscotti professionali, non per marketing */
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-30: 30px;
  --fs-38: 38px;
  --fs-48: 48px;
  --fs-60: 60px;
  --fs-80: 80px;

  --lh-tight:  1.1;
  --lh-snug:   1.25;
  --lh-normal: 1.5;
  --lh-loose:  1.7;

  /* ------------------------------------------------------------------------
     SPAZIATURE — griglia da 4px
     ------------------------------------------------------------------------ */
  --sp-0: 0;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* ------------------------------------------------------------------------
     RAGGI — conservativi. Il brand è architettonico, non morbido.
     ------------------------------------------------------------------------ */
  --r-0: 0px;
  --r-1: 2px;
  --r-2: 4px;     /* default per bottoni e input */
  --r-3: 6px;
  --r-4: 8px;     /* card */
  --r-5: 12px;
  --r-pill: 999px;

  /* ------------------------------------------------------------------------
     OMBRE — contenute. Uno strumento tecnico non galleggia.
     ------------------------------------------------------------------------ */
  --shadow-0: none;
  --shadow-1: 0 1px 2px rgba(1, 68, 85, 0.06), 0 0 0 1px rgba(1, 68, 85, 0.04);
  --shadow-2: 0 2px 6px rgba(1, 68, 85, 0.08), 0 1px 2px rgba(1, 68, 85, 0.06);
  --shadow-3: 0 8px 20px rgba(1, 68, 85, 0.10), 0 2px 6px rgba(1, 68, 85, 0.06);
  --shadow-4: 0 20px 40px rgba(1, 68, 85, 0.16), 0 4px 10px rgba(1, 68, 85, 0.08);
  --shadow-focus: 0 0 0 3px rgba(212, 0, 0, 0.25);
  --shadow-inset-border: inset 0 0 0 1px var(--border);

  /* Movimento */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1.05);
  --dur-fast: 120ms;
  --dur-med:  200ms;
  --dur-slow: 320ms;
}

/* ==========================================================================
   TEMA SCURO
   Attivato da data-theme="dark" su <html> in entrambe le app (§10): lo
   imposta lo script inline nel <head> prima del primo paint, poi il
   ThemeProvider (G2) o theme-toggle.js (Sicant). Preferenza in localStorage
   con chiave g2-theme: light | dark | system, default system.
   I valori sono quelli di G2, già verificati per contrasto.
   ========================================================================== */
[data-theme="dark"] {
  /* I neutri vengono ridefiniti perché molte regole li usano direttamente */
  --paper:   #0E1518;
  --mist:    #0A1215;
  --haze:    #1E2A2F;

  --brand:        var(--teal-500);   /* il teal-600 su fondo scuro sparisce */
  --brand-muted:  #14303A;

  --bg:           #0E1518;
  --bg-elevated:  #131C20;
  --bg-sunken:    #0A1215;
  --bg-inverse:   var(--teal-700);

  --fg:           #E3E8EA;
  --fg-muted:     #8B979D;
  --fg-subtle:    #5F6B71;

  --border:        var(--haze);
  --border-strong: #2D4049;

  --success-bg:     #0F2A1D;
  --success-border: #1C4231;
  --success-text:   #5FD0A0;
  --warning-bg:     #2A1F08;
  --warning-border: #4A3710;
  --warning-text:   #F0B550;
  --info-bg:        #0F2A35;
  --info-border:    #1C4252;
  --info-text:      #7ABFD0;
  --error-bg:       #2A0A0A;
  --error-border:   #4A1414;
  --error-text:     #F48686;
}
