:root {
  --fondo-1: oklch(0.155 0.028 265);
  --fondo-2: oklch(0.125 0.024 268);
  --testo:   oklch(0.95 0.01 265);
  --testo-2: oklch(0.80 0.015 265);
  --muto:    oklch(0.66 0.02 265);
  --bordo:   oklch(0.32 0.03 265);
  --bordo-2: oklch(0.28 0.028 265);
  --vetro:   oklch(1 0 0 / 0.04);
  --oro:     oklch(0.84 0.12 85);
  --oro-2:   oklch(0.90 0.03 90);
  --verde:   oklch(0.82 0.16 155);
  --rosso:   oklch(0.68 0.19 25);
  --ambra:   oklch(0.84 0.13 85);
  --sans: 'Instrument Sans', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  color: var(--testo);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 12% 18%, oklch(1 0 0 / 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 27% 62%, oklch(1 0 0 / 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 41% 12%, oklch(1 0 0 / 0.45) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 58% 78%, oklch(1 0 0 / 0.30) 0 1px, transparent 1.5px),
    radial-gradient(circle at 73% 30%, oklch(1 0 0 / 0.50) 0 1px, transparent 1.5px),
    radial-gradient(circle at 88% 66%, oklch(1 0 0 / 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 66% 48%, oklch(1 0 0 / 0.25) 0 1px, transparent 1.5px),
    radial-gradient(circle at 19% 88%, oklch(1 0 0 / 0.40) 0 1px, transparent 1.5px),
    radial-gradient(900px 620px at 78% 8%, oklch(0.34 0.09 285 / 0.75), transparent 70%),
    radial-gradient(700px 500px at 6% 96%, oklch(0.30 0.06 240 / 0.6), transparent 70%),
    linear-gradient(180deg, var(--fondo-1), var(--fondo-2));
  background-attachment: fixed;
}

.mono { font-family: var(--mono); }
.muto { color: var(--muto); }
.piccolo { font-size: 10px; }

@keyframes twinkle { 0%,100% { opacity: .9 } 50% { opacity: .35 } }
@keyframes orbit { from { transform: rotate(0) } to { transform: rotate(360deg) } }
@keyframes spinRing {
  from { transform: rotate(-18deg) rotateX(74deg) rotateZ(0) }
  to   { transform: rotate(-18deg) rotateX(74deg) rotateZ(360deg) }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

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

.testata {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 20px 44px; border-bottom: 1px solid var(--bordo);
}
.marchio-cliente { display: flex; align-items: center; gap: 11px; }
.stemma { height: 44px; width: auto; display: block; filter: drop-shadow(0 0 8px oklch(0.82 0.13 85 / .4)); }
.wordmark { font-size: 16px; font-weight: 600; letter-spacing: .2em; color: var(--oro-2); text-transform: uppercase; }
.testata-destra { display: flex; align-items: center; gap: 18px; }
.testata-destra .mono { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.esci {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muto); background: transparent; border: 1px solid var(--bordo);
  border-radius: 9px; padding: 7px 12px; cursor: pointer; transition: color .15s, border-color .15s;
}
.esci:hover { color: var(--testo); border-color: oklch(0.50 0.03 265); }

/* ---------- griglia ---------- */

.griglia {
  flex: 1; display: grid; grid-template-columns: 1.15fr 1fr;
  align-items: start; gap: 40px; padding: 34px 44px 40px 108px;
}
.colonna-sinistra { display: flex; flex-direction: column; gap: 26px; max-width: 640px; }
.colonna-destra { display: flex; flex-direction: column; align-items: center; gap: 30px; }

.titolo-blocco { display: flex; flex-direction: column; gap: 12px; }
h1 { margin: 0; font-size: 58px; line-height: .96; font-weight: 600; letter-spacing: -.04em; }
.by { font-size: 26px; font-weight: 400; letter-spacing: .01em; color: oklch(0.72 0.02 265); margin-left: 14px; }
.claim { font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--oro); }

.pill {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  padding: 18px 24px; border: 1px solid var(--bordo); border-radius: 18px;
  background: var(--vetro); align-self: flex-start; max-width: 100%;
  transition: border-color .3s;
}
.punto { width: 11px; height: 11px; border-radius: 50%; background: var(--muto); animation: twinkle 2.6s ease-in-out infinite; }
.etichetta { font-size: 30px; font-weight: 500; letter-spacing: .06em; white-space: nowrap; }
.meta { font-size: 12px; white-space: nowrap; color: oklch(0.72 0.02 265); }

.azioni { display: flex; gap: 12px; flex-wrap: wrap; }
.primario {
  font-family: inherit; font-size: 15px; font-weight: 600; color: oklch(0.16 0.03 265);
  background: var(--oro); border: 0; border-radius: 14px; padding: 16px 28px; cursor: pointer;
  transition: filter .15s, transform .15s;
}
.primario:hover { filter: brightness(1.1); transform: translateY(-1px); }
.primario:disabled { opacity: .55; cursor: default; transform: none; filter: none; }
.secondario {
  font-family: inherit; font-size: 15px; font-weight: 600; color: oklch(0.94 0.01 265);
  background: transparent; border: 1px solid oklch(0.40 0.03 265); border-radius: 14px;
  padding: 16px 26px; cursor: pointer; transition: background .15s, border-color .15s;
}
.secondario:hover { background: oklch(1 0 0 / .06); border-color: oklch(0.60 0.04 265); }

.corpo { margin: 0; max-width: 48ch; font-size: 16.5px; line-height: 1.5; color: var(--testo-2); text-wrap: pretty; }

/* ---------- pianeta ---------- */

.pianeta { position: relative; width: 252px; height: 252px; flex: none; display: grid; place-items: center; }
.alone { position: absolute; inset: 0; border-radius: 50%; opacity: .14; filter: blur(6px);
         background: radial-gradient(circle at 50% 50%, var(--muto) 0%, transparent 62%); transition: background .4s; }
.orbita { position: absolute; width: 232px; height: 232px; border-radius: 50%;
          border: 1px dashed oklch(0.42 0.03 265); animation: orbit 46s linear infinite; }
.luna { position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: oklch(0.86 0.06 90); }
.sfera {
  width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, oklch(0.86 0.09 88), oklch(0.62 0.10 62) 46%, oklch(0.34 0.07 45) 96%);
  box-shadow: inset -18px -12px 40px oklch(0.14 0.03 265 / .75), 0 0 60px oklch(0.70 0.10 70 / .28);
}
.anello {
  position: absolute; width: 236px; height: 236px; border-radius: 50%;
  border: 11px solid oklch(0.78 0.07 80 / .42); border-bottom-color: oklch(0.86 0.08 85 / .6);
  transform: rotate(-18deg) rotateX(74deg); animation: spinRing 90s linear infinite;
}

/* ---------- metriche e registro ---------- */

.metriche { width: 100%; max-width: 430px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scheda { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px;
          border: 1px solid var(--bordo); border-radius: 18px; background: var(--vetro); }
.numero { font-size: 28px; line-height: 1; font-weight: 500; }
.etichetta-piccola { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: oklch(0.68 0.02 265); }

.registro { width: 100%; max-width: 430px; display: flex; flex-direction: column; }
.registro > .etichetta-piccola { margin-bottom: 12px; }
.riga-att { display: grid; grid-template-columns: 62px 1fr; gap: 14px; align-items: baseline;
            padding: 12px 0; border-top: 1px solid var(--bordo-2); }
.riga-att .ora { font-family: var(--mono); font-size: 11.5px; color: oklch(0.64 0.02 265); }
.riga-att .txt { font-size: 13.5px; line-height: 1.45; color: var(--testo-2); }
.riga-att .txt.errore { color: var(--rosso); }
.registro-vuoto { margin: 0; padding: 12px 0; border-top: 1px solid var(--bordo-2);
                  font-size: 13px; color: oklch(0.58 0.02 265); }

/* ---------- chat ---------- */

.chat {
  position: fixed; left: 26px; bottom: 26px; z-index: 22;
  width: 394px; max-width: calc(100vw - 40px); height: 560px; max-height: calc(100vh - 56px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid oklch(0.38 0.04 265); border-radius: 22px;
  background: radial-gradient(420px 220px at 10% -10%, oklch(0.32 0.08 285 / .65), transparent 70%),
              linear-gradient(180deg, oklch(0.215 0.032 265), oklch(0.16 0.026 268));
  box-shadow: 0 30px 80px oklch(0.06 0.02 265 / .7); animation: riseIn .22s ease-out;
}
.chat[hidden] { display: none; }
.chat-testata { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                padding: 16px 18px; border-bottom: 1px solid oklch(0.30 0.03 265); flex: none; }
.chat-chi { display: flex; align-items: center; gap: 11px; }
.chat-chi > div { display: flex; flex-direction: column; gap: 2px; }
.chat-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--verde);
              box-shadow: 0 0 10px var(--verde); flex: none; }
.chat-nome { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.chat-sotto { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: oklch(0.68 0.02 265); }
.chat-x { font-family: inherit; font-size: 13px; line-height: 1; color: oklch(0.86 0.015 265);
          background: transparent; border: 1px solid oklch(0.34 0.03 265); border-radius: 10px;
          width: 30px; height: 30px; flex: none; cursor: pointer; transition: background .15s; }
.chat-x:hover { background: oklch(1 0 0 / .08); }

.chat-lista { flex: 1 1 auto; min-height: 0; overflow-y: auto;
              display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.bolla-msg { display: flex; flex-direction: column; gap: 5px; max-width: 86%; animation: riseIn .25s ease-out; }
.bolla-msg .testo { padding: 12px 15px; font-size: 14px; line-height: 1.5; }
.bolla-msg .quando { font-family: var(--mono); font-size: 10px; color: oklch(0.64 0.02 265); }
.bolla-msg.cliente { align-self: flex-end; align-items: flex-end; }
.bolla-msg.cliente .testo { background: var(--oro); color: oklch(0.16 0.03 265); border-radius: 16px 16px 6px 16px; }
.bolla-msg.operatore { align-self: flex-start; align-items: flex-start; }
.bolla-msg.operatore .testo { background: oklch(0.26 0.03 265); color: var(--testo); border-radius: 16px 16px 16px 6px; }
.chat-vuota { margin: auto 0; text-align: center; font-size: 13.5px; line-height: 1.5;
              color: oklch(0.62 0.02 265); padding: 0 12px; }

.chat-composer { flex: none; display: flex; flex-direction: column; gap: 10px;
                 padding: 14px 16px 16px; border-top: 1px solid oklch(0.30 0.03 265); }
#bozza { width: 100%; height: 60px; resize: none; font-family: inherit; font-size: 14px; line-height: 1.5;
         color: var(--testo); background: oklch(1 0 0 / .05); border: 1px solid oklch(0.34 0.03 265);
         border-radius: 14px; padding: 12px 14px; outline: none; transition: border-color .15s; }
#bozza:focus { border-color: var(--oro); }
#bozza::placeholder { color: oklch(0.60 0.02 265); }
.chat-riga { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.piccolo-btn { font-size: 14px; border-radius: 12px; padding: 11px 20px; }

.bolla {
  position: fixed; left: 26px; bottom: 26px; z-index: 22; width: 56px; height: 56px;
  display: grid; place-items: center; font-family: inherit; font-size: 20px; color: var(--testo);
  border: 1px solid oklch(0.42 0.04 265); border-radius: 50%;
  background: linear-gradient(180deg, oklch(0.26 0.04 265), oklch(0.18 0.028 268));
  box-shadow: 0 18px 44px oklch(0.06 0.02 265 / .6); cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.bolla[hidden] { display: none; }
.bolla:hover { transform: translateY(-2px); border-color: oklch(0.66 0.07 265); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px;
         display: grid; place-items: center; border-radius: 999px; background: var(--rosso);
         color: oklch(0.98 0.01 25); font-family: var(--mono); font-size: 11px; font-weight: 500; }
.badge[hidden] { display: none; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 30;
         display: flex; align-items: center; gap: 11px; padding: 14px 22px;
         border: 1px solid oklch(0.36 0.03 265); border-radius: 999px; background: oklch(0.22 0.03 265);
         box-shadow: 0 20px 50px oklch(0.08 0.02 265 / .6); font-size: 13.5px;
         animation: riseIn .22s ease-out; }
.toast[hidden] { display: none; }

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

.accesso { margin: auto; width: 100%; max-width: 400px; padding: 40px 36px;
           border: 1px solid var(--bordo); border-radius: 22px; background: oklch(1 0 0 / .04);
           box-shadow: 0 30px 80px oklch(0.06 0.02 265 / .5); }
.accesso h1 { font-size: 34px; margin-bottom: 6px; }
.accesso .claim { display: block; margin-bottom: 28px; }
.campo { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.campo label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
               text-transform: uppercase; color: oklch(0.68 0.02 265); }
.campo input { font-family: inherit; font-size: 15px; color: var(--testo);
               background: oklch(1 0 0 / .05); border: 1px solid oklch(0.34 0.03 265);
               border-radius: 12px; padding: 13px 14px; outline: none; transition: border-color .15s; }
.campo input:focus { border-color: var(--oro); }
.accesso .primario { width: 100%; margin-top: 8px; }
.errore-box { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px;
              border: 1px solid oklch(0.45 0.10 25); background: oklch(0.30 0.07 25 / .3);
              font-size: 13.5px; color: oklch(0.90 0.06 25); }
.nota { margin: 20px 0 0; font-size: 12.5px; line-height: 1.5; color: oklch(0.62 0.02 265); }

@media (max-width: 1080px) {
  .griglia { grid-template-columns: 1fr; padding: 28px 24px 120px; }
  .colonna-destra { align-items: flex-start; }
  h1 { font-size: 42px; }
  .chat { left: 12px; right: 12px; width: auto; }
}

