:root {
  --nero: #0f0f0d;
  --carta: #1a1815;
  --carta-su: #24211c;
  --filo: rgba(243, 236, 226, .13);
  --crema: #f3ece2;
  --spento: #b5ad9f;
  --arancio: #f28a17;
  --rosso: #ff6b4a;
  --verde: #8fd19e;
  --grana: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --sfumatura:
    radial-gradient(circle at 12% 12%, #ff4812 0%, rgba(255, 72, 18, 0) 55%),
    radial-gradient(circle at 70% 0%, #ffb228 0%, rgba(255, 178, 40, 0) 50%),
    #f28a17;
  --margine: 18px;
  --alto-menu: 68px;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Archivo", system-ui, sans-serif;
  background: var(--nero);
  color: var(--crema);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: left; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--arancio); outline-offset: 2px; }
main:focus { outline: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* alone arancione con grana, in alto: la firma di Vision */
.alone {
  position: fixed; z-index: -1; top: -170px; right: -110px;
  width: 420px; height: 340px; border-radius: 50%;
  background: var(--sfumatura); filter: blur(62px); opacity: .62; pointer-events: none;
}
.alone::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: var(--grana); mix-blend-mode: overlay; opacity: .5;
}

/* MENU: barra in basso sul telefono, colonna a sinistra sul computer */
.logo { display: none; width: 112px; }
.logo img { display: block; width: 100%; }
.logo span {
  display: block; margin-top: 5px; font-family: "Lexend", sans-serif; font-weight: 500;
  font-size: 10.4px; letter-spacing: .094em; text-transform: uppercase; white-space: nowrap; line-height: 1;
}
.menu {
  position: fixed; z-index: 5; left: 12px; right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  border-radius: 24px;
  background: rgba(32, 28, 23, .72);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .17);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .22), 0 12px 32px rgba(0, 0, 0, .45);
}
.voci { display: grid; grid-template-columns: repeat(5, 1fr); padding: 5px; }
.voci a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 54px; justify-content: center; border-radius: 19px;
  font-size: 11px; font-weight: 600; text-decoration: none; color: var(--spento);
}
.voci a[aria-current="page"] { background: var(--crema); color: var(--nero); }

/* PAGINA */
main {
  max-width: 1040px; margin: 0 auto;
  padding: calc(26px + env(safe-area-inset-top)) var(--margine) calc(var(--alto-menu) + 104px + env(safe-area-inset-bottom));
}
.testata { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
h1 { font-size: 2.6rem; font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.sommario { margin-top: 8px; color: var(--spento); font-size: .98rem; }
.sommario b { color: var(--crema); font-weight: 700; }
.sommario .urgente { color: var(--rosso); font-weight: 700; }

/* HOME */
.numeri { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.numero {
  display: block; padding: 14px 16px; text-decoration: none;
  background: var(--carta); border: 1px solid var(--filo); border-radius: 18px;
}
.numero:hover { background: var(--carta-su); }
.numero b { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.numero span { display: block; margin-top: 4px; font-size: .86rem; color: var(--spento); }
.numero.urgente b { color: var(--rosso); }
.tutte { display: inline-block; margin-top: 8px; padding: 8px 0; font-size: .9rem; font-weight: 600; color: var(--arancio); text-underline-offset: 3px; }
.tutto-ok { margin-top: 30px; padding: 14px 16px; border: 1px solid rgba(143, 209, 158, .35); border-radius: 18px; color: var(--verde); font-weight: 600; }
.vuoto a { display: inline-block; margin-top: 14px; padding: 12px 22px; border-radius: 999px; background: var(--arancio); color: var(--nero); font-weight: 700; text-decoration: none; }

/* PROFILO */
.scheda-bianca { margin-top: 12px; padding: 16px; background: var(--carta); border: 1px solid var(--filo); border-radius: 18px; }
.chi { margin-top: 24px; display: flex; align-items: center; gap: 14px; }
.iniziale {
  flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sfumatura); color: var(--nero); font-size: 1.5rem; font-weight: 800; text-transform: uppercase;
}
.chi b { display: block; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.chi span { display: block; color: var(--spento); font-size: .92rem; overflow-wrap: anywhere; }
.scheda-bianca .campo:first-child { margin-top: 0; }
.scheda-bianca .primario, .secondario {
  min-height: 46px; padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
}
.scheda-bianca .primario { display: block; margin: 0 0 0 auto; }
.secondario { display: block; width: 100%; text-align: center; border: 1px solid var(--filo); }
.secondario:hover { background: var(--carta-su); }
.secondario + .secondario { margin-top: 8px; }
.nota { font-size: .86rem; color: var(--spento); margin-bottom: 12px; }
.esito { min-height: 1.3em; margin-top: 10px; font-size: .9rem; color: var(--verde); }
.esito.errore { color: var(--rosso); }

h3 {
  margin: 30px 0 10px; font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--spento);
}
h3.urgente { color: var(--rosso); }
.griglia { display: grid; gap: 10px; }

/* SCHEDE */
.riga {
  display: flex; align-items: stretch;
  background: var(--carta); border: 1px solid var(--filo); border-radius: 18px; overflow: hidden;
}
.corpo { flex: 1; min-width: 0; padding: 14px 16px; display: block; width: 100%; }
.corpo:hover { background: var(--carta-su); }
.titolo { font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dettaglio { margin-top: 3px; font-size: .9rem; color: var(--spento); overflow-wrap: anywhere; }
.piede { margin-top: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .86rem; color: var(--spento); }
.importo { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; color: var(--crema); font-variant-numeric: tabular-nums; }
.data-urgente { color: var(--rosso); font-weight: 600; }
.fatta .titolo, .fatta .importo { color: var(--spento); }

.etichetta {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid var(--filo); color: var(--crema); white-space: nowrap;
}
.etichetta.acceso { background: var(--arancio); border-color: var(--arancio); color: var(--nero); }
.etichetta.ok { border-color: rgba(143, 209, 158, .5); color: var(--verde); }
.etichetta.spento { color: var(--spento); }

/* spunta veloce: pagato / uscita */
.spunta { flex: none; width: 58px; display: grid; place-items: center; border-right: 1px solid var(--filo); }
.spunta i {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--spento);
  display: grid; place-items: center; color: transparent;
}
.spunta svg { width: 16px; height: 16px; stroke-width: 3; }
.spunta:hover i { border-color: var(--arancio); }
.spunta[aria-pressed="true"] i { background: var(--arancio); border-color: var(--arancio); color: var(--nero); }

/* contatti del cliente */
.azioni { flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--filo); }
.azioni a { flex: 1; min-height: 46px; width: 54px; display: grid; place-items: center; color: var(--arancio); }
.azioni a + a { border-top: 1px solid var(--filo); }
.azioni a:hover { background: var(--carta-su); }

/* bottone + */
.aggiungi {
  position: fixed; z-index: 4; right: 16px;
  bottom: calc(var(--alto-menu) + 28px + env(safe-area-inset-bottom));
  height: 54px; padding: 0 22px 0 17px; border-radius: 999px;
  display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--nero);
  background: var(--arancio); box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
.aggiungi svg { stroke-width: 2.6; }

.vuoto { margin-top: 26px; padding: 32px 22px; text-align: center; border: 1px dashed var(--filo); border-radius: 18px; color: var(--spento); }
.vuoto b { display: block; color: var(--crema); font-size: 1.1rem; margin-bottom: 4px; }

/* SCHEDA DI MODIFICA: sale dal basso sul telefono, al centro sul computer */
dialog {
  border: 1px solid rgba(255, 255, 255, .17); color: var(--crema); background: #1d1a16;
  width: 100%; max-width: 100%; max-height: 92dvh;
  margin: auto 0 0; border-radius: 24px 24px 0 0;
  overflow-y: auto; overscroll-behavior: contain;
}
dialog::backdrop { background: rgba(0, 0, 0, .62); }
form { padding: 20px var(--margine) calc(18px + env(safe-area-inset-bottom)); }
form header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
form h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.chiudi { width: 44px; height: 44px; margin: -8px -10px -8px 0; display: grid; place-items: center; border-radius: 50%; }
.chiudi:hover { background: var(--carta-su); }

.campo { display: block; margin-top: 12px; }
.campo > span { display: block; margin-bottom: 5px; font-size: .86rem; font-weight: 600; color: var(--spento); }
.campo input, .campo select {
  width: 100%; min-height: 48px; padding: 0 13px; font-size: 16px;
  background: var(--nero); border: 1px solid var(--filo); border-radius: 12px; appearance: none; -webkit-appearance: none;
}
.campo select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b5ad9f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 18px;
}
.campo [aria-invalid="true"] { border-color: var(--rosso); }
.spunta-campo { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 12px; font-weight: 600; cursor: pointer; }
.spunta-campo input { width: 24px; height: 24px; accent-color: var(--arancio); }
.errore { min-height: 1.3em; margin-top: 10px; font-size: .9rem; color: var(--rosso); }
form footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.primario { min-height: 50px; padding: 0 30px; border-radius: 999px; background: var(--arancio); color: var(--nero); font-weight: 700; margin-left: auto; }
.elimina { min-height: 50px; padding: 0 8px; color: var(--rosso); font-weight: 600; font-size: .95rem; }
.elimina[hidden] { display: none; }

/* ACCESSO */
body.fuori .menu, body.fuori main { display: none; }
.accesso[hidden] { display: none; }
.accesso {
  min-height: 100dvh; max-width: 400px; margin: 0 auto;
  padding: calc(44px + env(safe-area-inset-top)) var(--margine) 32px;
  display: flex; flex-direction: column; justify-content: center;
}
.accesso .logo { display: block; margin-bottom: 44px; }
.accesso form { padding: 0; }
.accesso h1 { margin-bottom: 20px; }
.accesso .primario { width: 100%; text-align: center; }

/* COMPUTER */
@media (min-width: 860px) {
  .menu {
    top: 16px; left: 16px; bottom: 16px; right: auto; width: 214px; padding: 24px 12px 18px;
    border-radius: 26px; display: flex; flex-direction: column;
  }
  .menu .logo { display: block; margin: 0 0 30px 12px; }
  .voci { display: flex; flex-direction: column; gap: 4px; padding: 0; }
  .voci a { flex-direction: row; justify-content: flex-start; gap: 11px; min-height: 46px; padding: 0 13px; font-size: 15px; border-radius: 14px; }
  .voci a:not([aria-current="page"]):hover { color: var(--crema); background: rgba(255, 255, 255, .07); }
  .voci a[data-vista="profilo"] { margin-top: 18px; }
  .numeri { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .numero b { font-size: 2rem; }
  .profilo { max-width: 520px; }

  main { margin-left: 246px; max-width: none; padding: 44px 44px 60px; }
  main > * { max-width: 1040px; }
  h1 { font-size: 3.4rem; }
  .griglia { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
  .aggiungi { position: static; box-shadow: none; flex: none; }

  dialog { width: 480px; margin: auto; border-radius: 24px; max-height: 88dvh; }
  form { padding: 24px; }
  .alone { width: 620px; height: 440px; top: -210px; right: -120px; }
}

@media (prefers-reduced-transparency: reduce) {
  .menu { background: #24211c; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
