/* Geist ospitato da noi: il portale del cliente è pubblico, e nessun
   indirizzo IP dei clienti dello studio deve finire a Google. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../font/geist-1.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../font/geist-2.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../font/geist-3.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../font/geist-4.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../font/geist-5.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ═══════════════════════════════════════════════════════════════
   Quaderna — fondamenta comuni a dashboard e portale cliente
   Stessa grammatica di pony.solutions e sparcle.it: una famiglia
   sola (Geist), pesi a fare la gerarchia, pillole, raggi larghi,
   ombre neutre. Colore di marca: il blu del segno dello studio.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* superfici */
  --bg:          #F5F7FB;
  --surface:     #FFFFFF;
  --surface-2:   #FAFBFD;
  --line:        #E6E8EE;
  --line-strong: #D6DAE3;

  /* inchiostro */
  --ink:   #14161A;
  --muted: #4A4F57;
  --soft:  #868C95;

  /* marchio */
  --blu:       #2C6BD4;
  --blu-scuro: #1F4FA3;
  --blu-tenue: #EDF3FD;
  --blu-linea: #CFE0F8;
  --grigio-m:  #CFCFCF;

  /* stati */
  --ok:          #12795A;
  --ok-tenue:    #E4F3ED;
  --attesa:      #9A6209;
  --attesa-tenue:#FBF1DF;
  --manca:       #C0342A;
  --manca-tenue: #FCEBE9;

  /* forma */
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --ombra:      0 1px 2px rgba(20,22,26,.04), 0 8px 24px -14px rgba(20,22,26,.18);
  --ombra-alta: 0 2px 6px rgba(20,22,26,.06), 0 30px 60px -30px rgba(20,22,26,.32);

  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2,.7,.3,1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* `hidden` deve vincere su qualsiasi display dichiarato più sotto */
[hidden] { display: none !important; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.028em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(28px, 3.6vw, 40px); font-weight: 650; }
h2 { font-size: clamp(21px, 2.4vw, 26px); }
h3 { font-size: 18px; letter-spacing: -.02em; }

::selection { background: var(--blu); color: #fff; }

:focus-visible { outline: 2px solid var(--blu); outline-offset: 2px; border-radius: 6px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Icone: un tratto solo, sempre lo stesso ─────────────────── */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
     stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-s { width: 16px; height: 16px; stroke-width: 1.9; }
.i-l { width: 26px; height: 26px; stroke-width: 1.5; }

/* ── Bottoni ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 10px 19px;
  font-size: 14.5px; font-weight: 550; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, box-shadow .25s,
              transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .42; pointer-events: none; }

.btn-blu   { background: var(--blu); color: #fff; box-shadow: 0 6px 18px -8px rgba(20,22,26,.34); }
.btn-blu:hover { background: var(--blu-scuro); box-shadow: 0 10px 24px -10px rgba(20,22,26,.38); }
.btn-ink   { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #24272D; }
.btn-piano { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-piano:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-nudo  { color: var(--muted); }
.btn-nudo:hover { background: rgba(20,22,26,.05); color: var(--ink); }
.btn-rosso { color: var(--manca); }
.btn-rosso:hover { background: var(--manca-tenue); }

.btn-sm { padding: 7px 14px; font-size: 13.5px; }
.btn-lg { padding: 14px 26px; font-size: 16px; font-weight: 600; }
.btn-xl { padding: 17px 30px; font-size: 17px; font-weight: 600; }

.btn-tondo {
  width: 38px; height: 38px; padding: 0; border-radius: 999px; color: var(--soft);
}
.btn-tondo:hover { background: rgba(20,22,26,.06); color: var(--ink); }

.btn.in-corso { pointer-events: none; color: transparent !important; position: relative; }
.btn.in-corso::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(20,22,26,.28); border-top-color: var(--ink);
  animation: gira .7s linear infinite;
}
.btn-blu.in-corso::after, .btn-ink.in-corso::after {
  border-color: rgba(255,255,255,.35); border-top-color: #fff;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* ── Campi ───────────────────────────────────────────────────── */
.campo { display: block; margin-bottom: 16px; }
.campo > span { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .2s, box-shadow .2s;
}
.campo textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--blu); box-shadow: 0 0 0 3px var(--blu-tenue);
}
.campo input::placeholder, .campo textarea::placeholder { color: var(--soft); }
.campo .aiuto { display: block; margin-top: 7px; font-size: 13px; color: var(--soft); line-height: 1.45; }
.campo-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ── Targhette di stato ──────────────────────────────────────── */
.punto { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--soft); }
.punto.ok { background: var(--ok); }
.punto.attesa { background: var(--attesa); }
.punto.manca { background: var(--manca); }

.targa {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 550; line-height: 1.4;
  background: rgba(20,22,26,.05); color: var(--muted);
}
.targa.ok     { background: var(--ok-tenue);     color: var(--ok); }
.targa.attesa { background: var(--attesa-tenue); color: var(--attesa); }
.targa.manca  { background: var(--manca-tenue);  color: var(--manca); }
.targa.blu    { background: var(--blu-tenue);    color: var(--blu-scuro); }

/* ── Finestre ────────────────────────────────────────────────── */
dialog.finestra {
  /* il reset azzera i margini: il dialog va ricentrato a mano */
  margin: auto;
  width: min(560px, calc(100vw - 28px)); padding: 0; border: 0;
  border-radius: var(--r-xl); background: var(--surface); color: var(--ink);
  box-shadow: var(--ombra-alta);
}
dialog.finestra::backdrop { background: rgba(20,22,26,.34); backdrop-filter: blur(3px); }
dialog.finestra[open] { animation: entra 240ms var(--ease); }
@keyframes entra { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.f-testa { display: flex; align-items: flex-start; gap: 16px; padding: 24px 26px 12px; }
.f-testa h2 { font-size: 21px; }
.f-testa p { margin-top: 5px; font-size: 14.5px; color: var(--soft); }
.f-corpo { padding: 8px 26px 4px; max-height: min(62vh, 620px); overflow-y: auto; }
.f-piede { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px 24px; }

/* ── Avvisi ──────────────────────────────────────────────────── */
#avvisi {
  position: fixed; z-index: 90; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 8px;
  width: min(430px, calc(100vw - 24px)); pointer-events: none;
}
.avviso {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 500;
  box-shadow: var(--ombra-alta); animation: sale 280ms var(--ease);
}
.avviso.errore { background: var(--manca); }
@keyframes sale { from { opacity: 0; transform: translateY(12px); } }

/* ── Scadenza ────────────────────────────────────────────────
   Quattro livelli, sempre gli stessi da tutte e due le parti:
   calma → vicina → urgente → scaduta. */
.scad {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14.5px; line-height: 1.3; white-space: nowrap;
}
.scad b { font-weight: 650; letter-spacing: -.01em; }
.scad .scad-data { opacity: .78; font-weight: 450; }
.scad .i { flex: none; }

.scad-grande { padding: 11px 18px; font-size: 16px; gap: 9px; }
.scad-grande b { font-size: 17px; }

.scad-calma   { background: var(--surface); border-color: var(--line); color: var(--muted); }
.scad-calma b { color: var(--ink); }
.scad-calma .i { color: var(--soft); }

.scad-vicina  { background: var(--attesa-tenue); border-color: #ECD7AB; color: var(--attesa); }
.scad-urgente { background: var(--manca-tenue);  border-color: #F2C5C1; color: var(--manca); }
.scad-scaduta { background: var(--manca); border-color: var(--manca); color: #fff; }
.scad-chiusa  { background: var(--surface-2); border-color: var(--line); color: var(--soft); }

/* pulsa piano solo quando è davvero il momento */
.scad-urgente, .scad-scaduta { animation: scad-battito 2.6s ease-in-out 3; }
@keyframes scad-battito {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,52,42,0); }
  50%      { box-shadow: 0 0 0 5px rgba(192,52,42,.12); }
}

/* nastro d'allarme, solo negli ultimi due giorni */
.scad-nastro {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; border-radius: var(--r-lg);
  background: var(--manca-tenue); border: 1px solid #F2C5C1;
  color: var(--manca); font-size: 15px; font-weight: 550; line-height: 1.4;
}
.scad-nastro .i { flex: none; }
.scad-nastro-forte { background: var(--manca); border-color: var(--manca); color: #fff; }

/* ── Metro di avanzamento ────────────────────────────────────── */
/* Barra di completamento: la traccia è il totale, i segmenti pieni
   sono solo ciò che è stato fatto. Quello che manca non si colora. */
.metro { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--line); }
.metro > i { display: block; height: 100%; transition: width 500ms var(--ease); }
.metro-grande { height: 9px; }
/* l'ultimo pezzo pieno chiude arrotondato: si legge dove sei arrivato */
.metro > i:last-of-type { border-radius: 0 999px 999px 0; }
.metro .q-ok { background: var(--ok); }
.metro .q-attesa { background: var(--attesa); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ── utilità minute ──────────────────────────────────────────
   Nate per togliere gli attributi style dal codice: con una CSP
   che vieta gli stili in linea, un attributo style non si applica
   e il pezzo si scompone. Meglio dieci classi che una CSP debole. */
.u-flex1      { flex:1; }
.u-flex1-min0 { flex:1; min-width:0; }
.u-auto-sx    { margin-left:auto; }
.u-no-sx      { margin-left:0; }
.u-mt-4       { margin-top:4px; }
.u-mt-10      { margin-top:10px; }
.u-mt-14      { margin-top:14px; }
.u-mt-16      { margin-top:16px; }
.u-mb-6       { margin-bottom:6px; }
.u-mb-12      { margin-bottom:12px; }
.u-mb-14      { margin-bottom:14px; }
.u-mb-16      { margin-bottom:16px; }
.u-largo      { width:100%; }
.u-muto       { font-size:14.5px; color:var(--muted); }
.u-muto-15    { font-size:15px; color:var(--muted); }
.u-normale    { font-style:normal; font-weight:400; color:var(--soft); }
.u-riga-cta   { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.u-riga-mezzo { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.u-nudo       { box-shadow:none; border:0; padding:40px 0; }

/* ── quanto del piano è già usato ────────────────────────────── */
.piano-stato {
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  margin:0 0 14px; padding:10px 16px; border-radius:12px;
  background:var(--surface-2); border:1px solid var(--line);
  font-size:13px; color:var(--muted);
}
.piano-stato b { color:var(--ink); font-weight:650; }
.piano-stato .piano-pieno { margin-left:auto; color:var(--manca); }

/* ── il piano, nelle impostazioni ─────────────────────────────── */
.scheda-piano { padding: 22px 24px; }
.piano-testa { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.piano-allarme {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--r);
  background: var(--manca-tenue); color: var(--manca); font-size: 14px;
}
.piano-uso {
  display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.piano-uso b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.piani-scelta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-top: 18px;
}
.piano-mini {
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
  padding: 18px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--line);
}
.piano-mini b { font-size: 15px; }
.piano-mini-prezzo { font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.piano-mini-prezzo small { font-size: 13px; font-weight: 450; color: var(--soft); letter-spacing: 0; }
.piano-mini .btn { width: 100%; margin-top: 10px; }
.piano-mini .collega { font-size: 12.5px; align-self: center; }
.piano-mini-fatt { font-size: 12px; color: var(--soft); margin-top: -2px; }
