/* Scadenzario C.I.G.I.T.
   Direzione: registro di sondaggio. Navy del marchio, carta tecnica,
   semaforo in tinte di terra; ogni soggetto ha la sua "carota" stratigrafica. */

:root {
  --navy-900: #001a40;
  --navy-800: #01285f;
  --navy-700: #0b3a7a;
  --navy-500: #3a5f98;
  --navy-100: #e3e9f3;

  --carta: #f4f1ea;
  --carta-2: #ebe6db;
  --superficie: #fffdf8;
  --linea: #ddd6c7;
  --linea-2: #ebe6da;

  --inchiostro: #14213a;
  --inchiostro-2: #46536b;
  --inchiostro-3: #7d8598;

  /* semaforo: terracotta, ocra, acciaio, muschio, sabbia */
  --scaduta: #b6402c;   --scaduta-bg: #f7e3dd;  --scaduta-ink: #85281a;
  --imminente: #d98a1f; --imminente-bg: #fbecd2; --imminente-ink: #87520a;
  --prossima: #2a6f97;  --prossima-bg: #dfedf5;  --prossima-ink: #174e6f;
  --ok: #5f8f5a;        --ok-bg: #e4efe1;        --ok-ink: #3b6337;
  --senza: #b9b0a0;     --senza-bg: #efebe3;     --senza-ink: #6d6555;

  --spettro: linear-gradient(90deg, #2a6f97 0%, #5f8f5a 25%, #e9c46a 50%, #d98a1f 72%, #b6402c 100%);

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --r: 10px;
  --ombra: 0 1px 0 rgba(20, 33, 58, .04), 0 1px 3px rgba(20, 33, 58, .06);
  --ombra-alta: 0 24px 60px -18px rgba(0, 26, 64, .45), 0 2px 6px rgba(0, 26, 64, .12);
  --barra: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: .005em;
  color: var(--inchiostro);
  background: var(--carta);
}
a { color: var(--navy-700); }
code, .mono { font-family: var(--mono); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; }

/* ------------------------------------------------------------- guscio */

.guscio { display: grid; grid-template-columns: var(--barra) 1fr; min-height: 100vh; }

.barra {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  color: #c9d4e8;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1'%3E%3Cpath d='M-20 60c40-30 80 20 130-5s90-40 150 0'/%3E%3Cpath d='M-20 90c50-25 90 25 135 0s95-35 145 5'/%3E%3Cpath d='M-20 120c45-20 95 30 140 5s85-30 140 10'/%3E%3Cpath d='M-20 150c55-25 85 30 140 5s90-25 140 15'/%3E%3Cpath d='M-20 185c45-20 95 25 140 0s90-20 140 15'/%3E%3Cpath d='M-20 220c50-20 90 25 140 0s95-25 140 10'/%3E%3Ccircle cx='190' cy='40' r='18'/%3E%3Ccircle cx='190' cy='40' r='32'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  overflow-y: auto;
  z-index: 30;
}
.barra::after { /* la freccia del logo, ridotta a una riga */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 3px; background: var(--spettro);
  background-size: 100% 100%; opacity: .9;
  background-image: linear-gradient(180deg, #2a6f97, #5f8f5a, #e9c46a, #d98a1f, #b6402c);
}
.barra__marchio { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 6px 18px; }
.barra__marchio img { width: 46px; height: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.barra__marchio b { display: block; font-size: 17px; letter-spacing: .06em; font-weight: 800; }
.barra__marchio small { display: block; font-size: 11px; color: #8fa3c6; letter-spacing: .03em; }

.barra__titoletto { margin: 8px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #6f86ad; }
.barra__titoletto--seguito { margin-top: 18px; }
.barra__nav { display: flex; flex-direction: column; gap: 2px; }
.barra a { color: inherit; text-decoration: none; }
.barra__nav a, .barra__piede > a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px;
  font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
  position: relative;
}
.barra__nav a span { flex: 1; }
.barra__nav a em { font-style: normal; font-family: var(--mono); font-size: 11px; color: #7f93b8; background: rgba(255,255,255,.06); padding: 1px 7px; border-radius: 99px; }
.barra__nav a:hover, .barra__piede > a:hover { background: rgba(255,255,255,.06); color: #fff; }
.barra__nav a.attivo, .barra__piede > a.attivo { background: rgba(255,255,255,.11); color: #fff; }
.barra__nav a.attivo::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #e9c46a, #d98a1f);
}
.barra__nav a.attivo em { background: rgba(233,196,106,.18); color: #f1d590; }

.barra__piede { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 2px; }
.barra__utente { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; margin: 6px 0 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #e9c46a, #d98a1f); color: var(--navy-900); font-weight: 800; font-size: 13px; }
.barra__nome { flex: 1; font-size: 13px; color: #dfe6f3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra__utente button { background: none; border: 0; color: #8fa3c6; cursor: pointer; padding: 6px; border-radius: 6px; }
.barra__utente button:hover { color: #fff; background: rgba(255,255,255,.08); }

.apri-barra { display: none; }

.lavoro { min-width: 0; padding: 30px clamp(16px, 3.4vw, 48px) 40px; max-width: 1320px; width: 100%; }

/* Strumenti (preventivi, richiesta prove): occupano tutta l'area di lavoro. */
.lavoro--strumento { padding: 0; max-width: none; height: 100vh; height: 100dvh; }
.strumento { display: block; width: 100%; height: 100%; border: 0; background: var(--carta); }

/* ------------------------------------------------------------- testata */

.testata { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.testata__sopra { margin: 0 0 2px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--inchiostro-3); font-weight: 600; }
.testata h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.05; font-weight: 800; letter-spacing: 0; color: var(--navy-800); }
.testata__azioni { display: flex; gap: 8px; }

/* ------------------------------------------------------------- bottoni */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 13.5px/1 var(--font); padding: 10px 15px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.btn:active { transform: translateY(1px); }
.btn--primario { background: var(--navy-800); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 6px -2px rgba(1,40,95,.6); }
.btn--primario:hover { background: var(--navy-700); }
.btn--chiaro { background: var(--superficie); color: var(--inchiostro); border-color: var(--linea); }
.btn--chiaro:hover { border-color: var(--navy-500); color: var(--navy-800); }
.btn--contorno { background: transparent; color: var(--navy-700); border-color: var(--navy-500); border-style: dashed; }
.btn--pericolo { background: transparent; color: var(--scaduta-ink); border-color: #e3b9ae; }
.btn--pericolo:hover { background: var(--scaduta-bg); }
.btn--mini { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn--pieno { width: 100%; padding: 13px; font-size: 15px; }

/* ------------------------------------------------------------- indicatori */

.indicatori { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0 22px; }
.indicatore {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px 20px; border-radius: var(--r); text-decoration: none; color: var(--inchiostro);
  background: var(--superficie); border: 1px solid var(--linea); box-shadow: var(--ombra);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  animation: sali .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 60ms);
}
.indicatore:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(1,40,95,.45); border-color: var(--c); }
.indicatore__n { font: 800 38px/1 var(--font); color: var(--c); font-variant-numeric: tabular-nums; }
.indicatore__n small { font-size: 16px; font-weight: 600; color: var(--inchiostro-3); margin-left: 2px; }
.indicatore__k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--inchiostro-2); }
.indicatore__strato { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: var(--c); opacity: .9; }
.indicatore__strato::after { /* granulometria */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.45) 1px, transparent 1.4px);
  background-size: 6px 5px;
}
.indicatore--crit { --c: var(--scaduta); }
.indicatore--warn { --c: var(--imminente); }
.indicatore--soon { --c: var(--prossima); }
.indicatore--fermo { --c: var(--inchiostro); }

/* ------------------------------------------------------------- filtri */

.filtri {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 8px;
  background: linear-gradient(var(--carta) 80%, rgba(244,241,234,0));
}
.cerca { flex: 1; min-width: 220px; position: relative; display: block; }
.cerca svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--inchiostro-3); }
.cerca input {
  width: 100%; font: 15px var(--font); padding: 11px 14px 11px 40px; border-radius: 9px;
  border: 1px solid var(--linea); background: var(--superficie); color: var(--inchiostro);
  transition: border-color .15s, box-shadow .15s;
}
.cerca input:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 4px rgba(42,111,151,.14); }

.interruttore { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; color: var(--inchiostro-2); cursor: pointer; user-select: none; }
.interruttore input { position: absolute; opacity: 0; pointer-events: none; }
.interruttore__pista { width: 36px; height: 21px; border-radius: 99px; background: var(--carta-2); border: 1px solid var(--linea); position: relative; transition: background .2s; }
.interruttore__pista::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.interruttore input:checked + .interruttore__pista { background: var(--scaduta); border-color: var(--scaduta); }
.interruttore input:checked + .interruttore__pista::after { transform: translateX(15px); }
.interruttore input:focus-visible + .interruttore__pista { box-shadow: 0 0 0 3px rgba(42,111,151,.3); }

/* ------------------------------------------------------------- agenda */

.gruppo { margin-top: 18px; animation: sali .45s cubic-bezier(.2,.7,.2,1) both; }
.gruppo__titolo {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--inchiostro-2);
  padding: 0 2px 8px; border-bottom: 1px solid var(--linea); margin-bottom: 10px;
}
.gruppo__titolo span::first-letter { text-transform: uppercase; }
.gruppo__titolo em { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0; color: var(--inchiostro-3); }
.gruppo--scadute .gruppo__titolo { color: var(--scaduta-ink); border-color: #e7c3b9; }

.righe { display: flex; flex-direction: column; gap: 6px; }
.riga {
  --c: var(--senza); --cbg: var(--senza-bg); --cink: var(--senza-ink);
  display: grid; grid-template-columns: 104px 1fr auto; gap: 16px; align-items: center;
  padding: 12px 14px 12px 0; background: var(--superficie); border: 1px solid var(--linea-2);
  border-radius: var(--r); position: relative; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.riga:hover { border-color: var(--linea); box-shadow: 0 8px 22px -16px rgba(1,40,95,.5); }
.riga::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.riga--scaduta   { --c: var(--scaduta);   --cbg: var(--scaduta-bg);   --cink: var(--scaduta-ink); }
.riga--imminente { --c: var(--imminente); --cbg: var(--imminente-bg); --cink: var(--imminente-ink); }
.riga--prossima  { --c: var(--prossima);  --cbg: var(--prossima-bg);  --cink: var(--prossima-ink); }
.riga--ok        { --c: var(--ok);        --cbg: var(--ok-bg);        --cink: var(--ok-ink); }
.riga--senza_data::before { background: repeating-linear-gradient(-45deg, var(--senza) 0 4px, transparent 4px 8px); }

.riga__data { display: flex; flex-direction: column; align-items: center; text-align: center; padding-left: 8px; line-height: 1.1; }
.riga__data b { font: 800 26px/1 var(--font); color: var(--cink); font-variant-numeric: tabular-nums; }
.riga__data span { font: 500 11px var(--mono); text-transform: uppercase; color: var(--inchiostro-2); margin-top: 3px; letter-spacing: .02em; }
.riga__data em { font: normal 600 10.5px var(--font); color: var(--cink); background: var(--cbg); border-radius: 99px; padding: 2px 7px; margin-top: 6px; white-space: nowrap; }
.riga__testo { min-width: 0; }
.riga__tipo { font-weight: 700; font-size: 15px; color: var(--inchiostro); text-decoration: none; }
.riga__tipo:hover { color: var(--navy-700); text-decoration: underline; text-underline-offset: 3px; }
.riga__soggetto { margin: 1px 0 0; color: var(--inchiostro-2); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.riga__soggetto code { font-size: 11px; background: var(--carta); border: 1px solid var(--linea-2); border-radius: 4px; padding: 1px 6px; color: var(--inchiostro-2); }
.riga__meta { margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 3px 0; font-size: 12.5px; color: var(--inchiostro-3); }
.riga__meta > * + *::before { content: "·"; display: inline-block; margin: 0 7px; color: var(--inchiostro-3); text-decoration: none; }
.riga__meta a { color: var(--navy-700); font-weight: 600; }
.etichetta { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--inchiostro-2); }
.riga__azioni { display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------- schede (carote) */

.griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; margin-top: 10px; }
.griglia--stretta { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.scheda, .tessera {
  position: relative; background: var(--superficie); border: 1px solid var(--linea-2); border-radius: 12px;
  box-shadow: var(--ombra); overflow: hidden; animation: sali .45s cubic-bezier(.2,.7,.2,1) both;
}
.scheda { padding: 16px 16px 0 34px; }
.scheda:hover, .tessera:hover { border-color: var(--linea); box-shadow: 0 14px 30px -20px rgba(1,40,95,.5); }

.carota { position: absolute; left: 0; top: 0; bottom: 0; width: 16px; display: flex; flex-direction: column; border-right: 1px solid var(--linea-2); background: var(--carta-2); }
.carota--orizzontale { position: static; width: auto; height: 8px; flex-direction: row; border: 0; margin: -16px -16px 14px; }
.strato { flex: 1; min-height: 6px; position: relative; }
.strato + .strato { box-shadow: 0 -1px 0 rgba(255,255,255,.55); }
.strato::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1.3px); background-size: 5px 4px; }
.carota--orizzontale .strato + .strato { box-shadow: -1px 0 0 rgba(255,255,255,.6); }
.strato--scaduta { background: var(--scaduta); }
.strato--imminente { background: var(--imminente); }
.strato--prossima { background: var(--prossima); }
.strato--ok { background: var(--ok); }
.strato--senza_data { background: repeating-linear-gradient(-45deg, var(--senza) 0 3px, var(--senza-bg) 3px 6px); }
.strato--senza_data::after { display: none; }

.scheda__testa { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--linea-2); }
.scheda__testa h3 { font-size: 16px; font-weight: 750; }
.scheda__testa code { display: block; margin-top: 3px; font-size: 11.5px; color: var(--inchiostro-3); line-height: 1.4; }

.bollino { flex: none; font: 700 10.5px/1 var(--font); letter-spacing: .09em; text-transform: uppercase; padding: 5px 9px; border-radius: 99px; white-space: nowrap; }
.bollino--fermo, .bollino--scaduta { background: var(--scaduta-bg); color: var(--scaduta-ink); box-shadow: inset 0 0 0 1px #ecc4ba; }
.bollino--avviso, .bollino--imminente { background: var(--imminente-bg); color: var(--imminente-ink); box-shadow: inset 0 0 0 1px #f0d4a6; }
.bollino--prossima { background: var(--prossima-bg); color: var(--prossima-ink); }
.bollino--regolare, .bollino--ok { background: var(--ok-bg); color: var(--ok-ink); box-shadow: inset 0 0 0 1px #cadfc5; }
.bollino--senza_data { background: var(--senza-bg); color: var(--senza-ink); }
.bollino--fermo::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--scaduta); margin-right: 6px; vertical-align: 1px; animation: pulsa 1.8s infinite; }

.scheda__voci { list-style: none; margin: 0; padding: 4px 0; }
.voce { display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px dashed var(--linea-2); }
.voce:last-child { border-bottom: 0; }
.voce__data { font: 500 12px/1.6 var(--mono); color: var(--inchiostro-2); position: relative; padding-left: 12px; }
.voce__data::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 2px; background: var(--senza); }
.voce--scaduta .voce__data { color: var(--scaduta-ink); font-weight: 600; }
.voce--scaduta .voce__data::before { background: var(--scaduta); }
.voce--imminente .voce__data::before { background: var(--imminente); }
.voce--prossima .voce__data::before { background: var(--prossima); }
.voce--ok .voce__data::before { background: var(--ok); }
.voce__tipo { font-size: 13.5px; font-weight: 600; color: var(--inchiostro); text-decoration: none; line-height: 1.4; }
.voce--senza_data .voce__tipo { color: var(--inchiostro-3); font-weight: 500; }
.voce__tipo:hover { color: var(--navy-700); text-decoration: underline; }
.voce__azioni { display: flex; gap: 4px; }
.voce--vuota { display: block; color: var(--inchiostro-3); font-size: 13px; }

.scheda__piede { display: flex; gap: 16px; padding: 10px 0 12px; border-top: 1px solid var(--linea-2); margin: 0 -16px 0 -18px; padding-left: 18px; background: linear-gradient(var(--superficie), var(--carta)); }
.scheda__piede a { font-size: 12.5px; font-weight: 650; color: var(--navy-700); text-decoration: none; }
.scheda__piede a:hover { text-decoration: underline; }

.tessera { padding: 16px; }
.tessera__motivo { margin: 10px 0 0; font-size: 13.5px; color: var(--inchiostro-2); }
.tessera--fermo { border-color: #ecc4ba; }
.tessera--fermo .tessera__motivo b { color: var(--scaduta-ink); }
.tessera--avviso .tessera__motivo b { color: var(--imminente-ink); }

/* ------------------------------------------------------------- storico */

.storico { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.storico::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: repeating-linear-gradient(var(--linea) 0 6px, transparent 6px 10px); }
.storico__voce { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px 14px; margin-bottom: 8px; background: var(--superficie); border: 1px solid var(--linea-2); border-radius: var(--r); }
.storico__voce::before { content: ""; position: absolute; left: -21px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--carta); }
.storico__voce time { display: flex; flex-direction: column; }
.storico__voce time b { font: 600 13px var(--mono); }
.storico__voce time span { font-size: 11px; color: var(--ok-ink); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.storico--compatto .storico__voce { padding: 9px 12px; background: var(--carta); }
.storico--compatto .storico__voce::before { box-shadow: 0 0 0 3px var(--superficie); }
.storico__vuoto { color: var(--inchiostro-3); font-size: 13.5px; padding: 4px 0; }

/* ------------------------------------------------------------- vuoto e legenda */

.vuoto { text-align: center; padding: 50px 20px; color: var(--inchiostro-3); grid-column: 1 / -1; }
.vuoto svg { width: 120px; height: 60px; stroke: var(--linea); stroke-width: 1.5; }
.vuoto svg .sonda { stroke: var(--navy-500); stroke-width: 3; stroke-dasharray: 60; animation: sonda 1.6s ease-out both; }
.vuoto b { display: block; color: var(--inchiostro); font-size: 16px; margin-top: 8px; }
.vuoto p { margin: 4px 0 0; }

.legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--linea); font-size: 12px; color: var(--inchiostro-3); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda__dx { margin-left: auto; font-family: var(--mono); font-size: 11.5px; }
.pallino { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pallino--scaduta { background: var(--scaduta); }
.pallino--imminente { background: var(--imminente); }
.pallino--prossima { background: var(--prossima); }
.pallino--ok { background: var(--ok); }
.pallino--senza_data { background: repeating-linear-gradient(-45deg, var(--senza) 0 2px, var(--senza-bg) 2px 4px); }

/* ------------------------------------------------------------- moduli e finestra */

.finestra {
  border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  background: var(--superficie); color: var(--inchiostro); box-shadow: var(--ombra-alta);
}
.finestra[open] { animation: apri .22s cubic-bezier(.2,.8,.2,1); }
.finestra::backdrop { background: rgba(0, 20, 50, .45); backdrop-filter: blur(3px); }
.finestra__corpo { max-height: calc(100vh - 40px); overflow-y: auto; }
.finestra__corpo:empty::before { content: "Caricamento…"; display: block; padding: 40px; text-align: center; color: var(--inchiostro-3); }

.modulo { padding: 22px 24px; }
.modulo--piatto { padding: 0; }
.modulo__testa { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin: -22px -24px 18px; padding: 20px 24px 16px; border-bottom: 1px solid var(--linea-2); position: relative; }
.modulo__testa::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--spettro); opacity: .85; }
.modulo__testa h2 { font-size: 21px; font-weight: 800; color: var(--navy-800); line-height: 1.2; }
.modulo__sopra { margin: 0 0 3px; font-size: 12px; font-weight: 600; color: var(--inchiostro-3); letter-spacing: .04em; }
.chiudi { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--inchiostro-3); cursor: pointer; padding: 0 4px; border-radius: 6px; }
.chiudi:hover { color: var(--inchiostro); background: var(--carta); }
.modulo__nota { color: var(--inchiostro-2); font-size: 13.5px; margin: 0 0 14px; }
.modulo__campi { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo--largo { grid-column: 1 / -1; }
.campo label { font-size: 12.5px; font-weight: 650; color: var(--inchiostro-2); }
.campo input:not([type=checkbox]), .campo select, .campo textarea {
  font: 14.5px var(--font); color: var(--inchiostro); width: 100%;
  padding: 10px 12px; border: 1px solid var(--linea); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.campo input[type=file] { padding: 8px; background: var(--carta); border-style: dashed; }
.campo textarea { resize: vertical; min-height: 64px; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 4px rgba(42,111,151,.14); }
.password { position: relative; display: block; }
.password input { padding-right: 44px !important; }
.password__occhio {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 6px; color: var(--inchiostro-3); cursor: pointer;
}
.password__occhio:hover { color: var(--navy-800); background: var(--carta); }
.password__occhio:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }
.campo small { font-size: 12px; color: var(--inchiostro-3); }
.campo .errore, .errorlist { color: var(--scaduta-ink); font-weight: 600; }
.campo--errore input, .campo--errore select { border-color: var(--scaduta); }
.campo--spunta label { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--inchiostro); font-weight: 500; cursor: pointer; }
.campo--spunta input { width: 17px; height: 17px; accent-color: var(--navy-800); }
.campo a { word-break: break-all; }
.modulo__piede { display: flex; gap: 8px; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--linea-2); }
.spazio { flex: 1; }

.riassunto { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 16px; border-radius: 9px; background: var(--carta); border-left: 4px solid var(--navy-500); }
.riassunto span { font-size: 13px; color: var(--inchiostro-2); }

.dettaglio__stato { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--cbg, var(--carta)); margin-bottom: 16px; }
.dettaglio__stato b { font-size: 17px; }
.dettaglio__stato > span:last-child { color: var(--cink, var(--inchiostro-2)); font-size: 13px; font-weight: 600; }
.dettaglio__dati { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.dettaglio__dati .largo { grid-column: 1 / -1; }
.dettaglio__dati dt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--inchiostro-3); }
.dettaglio__dati dd { margin: 2px 0 0; font-size: 14px; }
.dettaglio__dati code { font-size: 11.5px; color: var(--inchiostro-3); }
.dettaglio__sotto { margin: 22px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--inchiostro-2); }

.pagina-modulo { max-width: 680px; background: var(--superficie); border: 1px solid var(--linea-2); border-radius: 16px; box-shadow: var(--ombra); overflow: hidden; }
.pagina-modulo .chiudi { display: none; }
.indietro { display: block; padding: 12px 24px; font-size: 13px; text-decoration: none; background: var(--carta-2); }

.pannelli { display: grid; gap: 16px; margin-top: 24px; max-width: 760px; }
.pannello { background: var(--superficie); border: 1px solid var(--linea-2); border-radius: 12px; padding: 20px 22px; box-shadow: var(--ombra); }
.pannello h2 { font-size: 17px; font-weight: 750; color: var(--navy-800); margin-bottom: 6px; }

/* ------------------------------------------------------------- notifiche */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--navy-900); color: #fff; padding: 12px 16px 12px 14px; border-radius: 10px; font-size: 14px; max-width: 380px;
  box-shadow: var(--ombra-alta); border-left: 4px solid var(--ok); animation: sali .35s both, svanisci .4s 5s forwards;
}
.toast--error { border-left-color: var(--scaduta); }

/* ------------------------------------------------------------- accesso */

.accesso { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.accesso__lato { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); display: flex; flex-direction: column; justify-content: flex-start; padding: 56px 48px; }
.accesso__strati { position: absolute; inset: 42% 0 0 0; display: flex; flex-direction: column; }
.accesso__strati i { flex: 1; position: relative; animation: strato .9s cubic-bezier(.2,.7,.2,1) both; }
.accesso__strati i::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.22) 1px, transparent 1.5px); background-size: 7px 6px; }
.accesso__strati i:nth-child(1) { background: #c99b62; animation-delay: .05s; flex: .7; }
.accesso__strati i:nth-child(2) { background: #a8784a; animation-delay: .12s; }
.accesso__strati i:nth-child(3) { background: #8c5a35; animation-delay: .19s; flex: 1.3; }
.accesso__strati i:nth-child(4) { background: #6e6a63; animation-delay: .26s; }
.accesso__strati i:nth-child(5) { background: #4f4c48; animation-delay: .33s; flex: 1.4; }
.accesso__strati i:nth-child(6) { background: #2f2d2b; animation-delay: .4s; }
.accesso__strati::before { /* la sonda */
  content: ""; position: absolute; z-index: 2; left: 68%; top: -40px; bottom: 0; width: 14px;
  background: repeating-linear-gradient(180deg, #d9dde3 0 26px, #a9b0ba 26px 30px);
  box-shadow: 0 0 0 2px rgba(0,0,0,.25); animation: trivella 1.4s .3s cubic-bezier(.3,.8,.2,1) both;
}
.accesso__lato::before { content: ""; position: absolute; left: 0; right: 0; top: calc(42% - 4px); height: 4px; background: var(--spettro); z-index: 3; }
.accesso__motto { position: relative; z-index: 3; margin: 0; color: #fff; font-size: clamp(26px, 3vw, 40px); font-weight: 800; line-height: 1.05; text-transform: uppercase; letter-spacing: .01em; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.accesso__modulo { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); max-width: 560px; width: 100%; margin: 0 auto; }
.accesso__modulo img { width: 92px; height: auto; margin-bottom: 18px; }
.accesso__modulo h1 { font-size: clamp(30px, 3vw, 38px); font-weight: 800; color: var(--navy-800); letter-spacing: .01em; line-height: 1.1; }
.accesso__sotto { color: var(--inchiostro-2); margin: 6px 0 26px; }
.accesso__modulo .modulo__campi { grid-template-columns: 1fr; margin-bottom: 20px; }
.accesso__piede { margin-top: 32px; font-size: 12px; color: var(--inchiostro-3); font-family: var(--mono); }
.avviso-errore { background: var(--scaduta-bg); color: var(--scaduta-ink); padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }

/* ------------------------------------------------------------- animazioni */

@keyframes sali { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes apri { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes svanisci { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
@keyframes pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes sonda { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
@keyframes strato { from { transform: translateX(-30%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes trivella { from { transform: translateY(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------- schermi piccoli */

@media (max-width: 1100px) {
  .indicatori { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .guscio { grid-template-columns: 1fr; }
  .barra { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--ombra-alta); }
  .barra.aperta { transform: none; }
  .apri-barra { display: flex; flex-direction: column; justify-content: center; gap: 4px; position: fixed; top: 12px; right: 12px; z-index: 40; width: 42px; height: 42px; border-radius: 10px; border: 0; background: var(--navy-800); padding: 0 11px; cursor: pointer; box-shadow: var(--ombra-alta); }
  .apri-barra span { display: block; height: 2px; background: #fff; border-radius: 2px; }
  .lavoro { padding-top: 22px; }
  .testata { padding-right: 52px; }
  .riga { grid-template-columns: 84px 1fr; }
  .riga__azioni { grid-column: 2; }
  .accesso { grid-template-columns: 1fr; }
  .accesso__lato { min-height: 200px; padding: 24px; }
  .modulo__campi, .dettaglio__dati { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .indicatori { gap: 10px; }
  .indicatore__n { font-size: 30px; }
  .griglia, .griglia--stretta { grid-template-columns: 1fr; }
  .testata__azioni { width: 100%; }
  .testata__azioni .btn { flex: 1; }
  .legenda__dx { margin-left: 0; }
}
