/* Beauty Pro Desk - expert chat.
   Famiglia cosmetiFULL (ispirazione founderos): nero/bianco + accento lime,
   tipografia forte, respiro, tema scuro (default) e chiaro. */

/* Space Grotesk self-hostato (variabile 300-700): nessuna CDN terza.
   latin-ext copre i diacritici rumeni (a breve, s/t con virgola). */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-ext.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;
}

:root {
  --bg: #0a0a0a;
  --panel: #111110;
  --panel-2: #161615;
  --line: #242422;
  --text: #f4f4ef;
  --muted: #9a9a92;
  --lime: #c9f24e;
  --lime-ink: #0a0a0a;
  --accent-text: #c9f24e;   /* testo accent leggibile sul tema */
  --err: #ff8b7a;
  --err-line: #4a2018;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
/* Tema chiaro: unificato su lime + nero + grigio (niente verde scuro).
   Sfondo chiaro, testo e accenti-testo neri, lime per i riempimenti, grigio
   secondario. Il lime resta ereditato da :root (fill dei pulsanti, bordi eroe). */
:root[data-theme="light"] {
  --bg: #f6f6f1;
  --panel: #ffffff;
  --panel-2: #eeeee7;
  --line: #e2e2d8;
  --text: #0d0d0d;
  --muted: #66665e;
  --accent-text: #141414;   /* accento-testo nero (era verde oliva) */
  --err: #b3311c;
  --err-line: #eac6bf;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* l'attributo hidden vince sempre su display:flex/grid */
html { scroll-behavior: smooth; }

/* Solo screen reader */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visibile da tastiera su tutti i controlli */
button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
em { font-style: italic; }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.wordmark {
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 15px;
  padding: 0;
}
.wordmark .dot { color: var(--lime); -webkit-text-stroke: 0.5px var(--accent-text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent-text);
  border: 1px solid var(--accent-text);
  border-radius: 999px;
  padding: 4px 10px;
}
.icon-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { border-color: var(--accent-text); }

/* --- Drawer destro --- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(360px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 50;
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-title { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; font-size: 14px; }
.drawer-sec h3 {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 10px;
}
.guide { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: 8px 16px; font-size: 13px; }
.seg button.on { background: var(--lime); color: var(--lime-ink); font-weight: 700; }
.drawer-muted { color: var(--muted); font-size: 14px; margin: 0; }
.drawer-foot { margin-top: auto; color: var(--muted); font-size: 12px; }

/* --- Home --- */
.home { max-width: 1060px; margin: 0 auto; padding: 44px 28px 80px; }
.kicker {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--accent-text);
  margin: 0 0 14px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.hero h1 em { color: var(--accent-text); font-style: normal; }
.hero .sub { color: var(--muted); margin: 0 0 30px; font-size: 16.5px; max-width: none; }

/* Composer unificato (barra auto-instradata, eroe della home) */
.ask-card { margin-bottom: 26px; }
.ask-hint { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }

.composer-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 10px;
  transition: border-color 0.15s ease;
}
.composer-box:focus-within { border-color: var(--accent-text); }
/* Composer "eroe" della home: bordo lime + alone, cosi' la chat e' il fuoco unico
   (il trattamento hero e' passato qui dal vecchio box "decodifica etichetta"). */
.composer-hero {
  border-color: var(--lime);
  border-width: 1.5px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime) 22%, transparent);
}
.composer-hero:focus-within {
  border-color: var(--lime);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lime) 34%, transparent);
}
.composer textarea {
  display: block;
  width: 100%;
  resize: none;
  background: none;
  border: 0;
  color: var(--text);
  padding: 4px 2px 8px;
  font: inherit;
  line-height: 1.45;
  max-height: 180px;
  outline: none;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-tools { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
.tools-left { display: flex; gap: 6px; }
.tool-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-btn { position: relative; }
.tool-btn:hover { border-color: var(--accent-text); }
.tool-btn.rec { background: var(--lime); border-color: var(--lime); animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
/* Tooltip visibile al mouseover/focus sui pulsanti del composer (graffetta, foto, mic).
   Il title nativo resta come fallback per touch/screen reader. */
.tool-btn[data-tooltip]:hover::after,
.tool-btn[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.send-btn {
  background: var(--lime);
  border: 0;
  border-radius: 10px;
  color: var(--lime-ink);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 9px 22px;
}
.send-btn:disabled { opacity: 0.45; cursor: default; }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.a-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  padding: 4px 10px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-chip button { background: none; border: 0; color: var(--muted); padding: 0 0 0 2px; font-size: 12px; }
.a-chip button:hover { color: var(--err); }
.a-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

/* Griglia esperti */
.sec-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
/* Chip compatti: Nome + ruolo (lime), cliccabili. Sostituiscono le card alte. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-align: left;
  padding: 7px 15px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.chip:hover, .chip:focus-visible { border-color: var(--lime); background: var(--panel-2); outline: none; }
/* Rivelazione illuminata: il chip di chi risponde si accende in lime
   (bordo + alone + micro-scale), gli altri si attenuano. Funziona su entrambi
   i temi: sfondo tinto di lime + bordo lime, testo nel colore del tema. */
.chip.lit {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 16%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime) 32%, transparent);
  transform: scale(1.04);
}
.chip.dim { opacity: 0.35; }
.chip-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.chip-role { color: var(--accent-text); font-size: 12.5px; }
.foot-note { color: var(--muted); font-size: 13px; margin: 44px 0 0; max-width: none; }
.foot-note a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.foot-note a:hover { opacity: 0.75; }

/* Griglia per team: ogni team ha un titolo e la sua griglia di card. */
.team { margin-bottom: 16px; }
.team:last-child { margin-bottom: 0; }
.team-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Sezione "Cosa fa per te" (stile LabelLens): bullet con lead in grassetto. */
.benefits-sec { margin-top: 44px; }
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.benefit {
  background: var(--panel);
  padding: 18px 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}
.benefit b { color: var(--text); font-weight: 700; }

/* Reveal instradamento: chi sta rispondendo, prima/durante lo streaming. */
.msg-reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--accent-text);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 2px 0 16px;
}
.reveal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: pulse 1.2s ease infinite; flex-shrink: 0; }

/* Mini-chip dell'indicatore "sta rispondendo": pulsa mentre l'esperto streamma
   (.lit), si posa a fine risposta (.done: bordo lime fermo). */
.mini-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--muted);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.mini-chip b { font-family: var(--display); font-weight: 600; color: var(--text); }
.mini-chip.lit {
  border-color: var(--lime);
  color: var(--text);
  background: color-mix(in srgb, var(--lime) 14%, var(--panel));
  animation: glowPulse 1.4s ease infinite;
}
.mini-chip.done {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 8%, var(--panel)); /* leggibile anche su tema chiaro */
  animation: none;
}
.mini-chip.fail { border-color: var(--err); color: var(--err); animation: none; }
.mini-chip.fail b { color: var(--err); }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lime) 45%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--lime) 16%, transparent); }
}

/* Beat di analisi sotto il composer della home (copre la latenza del router). */
.ask-hint.analyzing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-text);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Tema chiaro: il dot lime pieno non stacca sul fondo chiaro; bordo scuro
   sottile (niente verde scuro, il testo nero resta il segnale primario).
   Il dim resta leggibile un filo di piu'. */
:root[data-theme="light"] .reveal-dot { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 55%, transparent); }
:root[data-theme="light"] .chip.dim { opacity: 0.45; }

/* prefers-reduced-motion: stati illuminati statici, nessun movimento.
   L'etichetta testuale (aria-live + reveal) resta il segnale primario. */
@media (prefers-reduced-motion: reduce) {
  .chip, .mini-chip, .reveal-dot, .typing, .tool-btn.rec {
    animation: none !important;
    transition: none !important;
  }
  .chip.lit { transform: none; }
  html { scroll-behavior: auto; }
}

/* --- Chat layout con sidebar --- */
.chat-layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 80px;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100dvh - 100px);
}
.new-chat {
  background: var(--lime);
  border: 0;
  border-radius: 10px;
  color: var(--lime-ink);
  font-family: var(--display);
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
}
.sidebar-label {
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.conv-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv-item { display: flex; align-items: center; border-radius: 8px; }
.conv-item.on { background: var(--panel); }
.conv-item:hover { background: var(--panel); }
.conv-open {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  text-align: left;
  font-size: 13.5px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-item:hover .conv-open { color: var(--text); }
.conv-del { background: none; border: 0; color: transparent; font-size: 11px; padding: 4px 8px; }
.conv-item:hover .conv-del { color: var(--muted); }
.conv-del:hover { color: var(--err) !important; }
.conv-empty { color: var(--muted); font-size: 13px; padding: 6px 10px; }

/* Chat */
/* Niente altezza forzata: il composer sta subito sotto il contenuto
   (bug "spazio nero vuoto" del giro 1) e diventa sticky solo quando si scorre. */
.chat { min-width: 0; display: flex; flex-direction: column; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.back {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 7px 14px;
  white-space: nowrap;
}
.back:hover { border-color: var(--accent-text); color: var(--accent-text); }
.hist-btn { display: none; }
.chat-head-id { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-name { font-family: var(--display); font-weight: 700; font-size: 17px; }
.chat-role { color: var(--muted); font-size: 13px; }

.messages { padding: 22px 0 8px; }
.msg { margin-bottom: 24px; max-width: 100%; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px 14px 3px 14px;
  padding: 12px 16px;
  max-width: 85%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.who-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg-expert .who {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent-text);
  text-transform: uppercase;
}
.msg-expert .bubble { overflow-wrap: break-word; }
.msg-expert .bubble p { margin: 0 0 12px; }
.msg-expert .bubble p:last-child { margin-bottom: 0; }
.msg-expert .bubble ul { margin: 0 0 12px; padding-left: 20px; }
.msg-expert .bubble li { margin-bottom: 4px; }
.msg-expert .bubble strong { color: var(--text); }
.msg-expert .bubble code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
}
.msg-synthesis { border-left: 2px solid var(--accent-text); padding-left: 16px; }
.msg-notice { color: var(--muted); font-size: 12.5px; margin: -8px 0 18px; }
.msg-error .bubble {
  color: var(--err);
  border: 1px solid var(--err-line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  display: inline-block;
}
.inline-err { color: var(--err); font-size: 13px; }
.typing { display: inline-block; color: var(--accent-text); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Composer chat: attaccato al contenuto, sticky quando la pagina scorre */
.chat-composer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0 16px;
}

/* --- Feedback --- */
.fb { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 5px 12px;
}
.fb-btn:hover { border-color: var(--accent-text); color: var(--text); }
.fb-btn.sel { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 700; }
.fb-note { display: flex; gap: 8px; flex: 1 1 100%; margin-top: 6px; }
.fb-note input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
}
.fb-note input:focus { outline: none; border-color: var(--accent-text); }
.fb-note button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 14px;
}
.fb-note button:hover { border-color: var(--accent-text); color: var(--accent-text); }
.fb-thanks { color: var(--accent-text); font-size: 13px; }

/* --- Mobile --- */
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 85vw);
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 20px 16px;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    max-height: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }
  .hist-btn { display: inline-flex; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .pill { display: none; }
  .home { padding: 30px 16px 60px; }
  .hero .sub { margin-bottom: 24px; }
  .benefits-grid { grid-template-columns: 1fr; }
  /* Niente micro-scale sul chip acceso: a filo del bordo destro creerebbe
     qualche px di overflow orizzontale. Glow + bordo lime bastano. */
  .chip.lit { transform: none; }
  .chat-layout { padding: 0 12px; }
  .msg-user .bubble { max-width: 94%; }
  .chat-head { gap: 10px; }
}

/* --- Gate beta privata + modale auth ----------------------------------------- */
/* Il gate e' la vista pre-login; il modale ospita register/login/sala d'attesa.
   CTA primaria = lime pieno (unica azione "forte"); secondarie ghost/outline.
   Tap target >= 44px su mobile; AA su entrambi i temi (testo nero su lime). */
.gate { max-width: 720px; margin: 0 auto; padding: 72px 28px 80px; }
.gate-hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.07;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.gate-hero h1 em { color: var(--accent-text); font-style: normal; }
.gate-hero .sub { color: var(--muted); margin: 0 0 26px; font-size: 16.5px; }
.gate-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.gate-cta {
  background: var(--lime);
  border: 0;
  border-radius: 12px;
  color: var(--lime-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  padding: 14px 26px;
  min-height: 48px;
  cursor: pointer;
}
.gate-cta:hover { filter: brightness(1.05); }
.gate-cta:disabled { opacity: 0.55; cursor: default; }
.gate-ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 13px 22px;
  min-height: 48px;
  cursor: pointer;
}
.gate-ghost:hover { border-color: var(--accent-text); }
.gate-privacy { color: var(--muted); font-size: 12.5px; max-width: 560px; line-height: 1.5; }

.auth-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 641px) {
  .auth-backdrop { align-items: center; padding: 16px; }
}
.auth-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 26px 24px 24px;
}
@media (min-width: 641px) { .auth-modal { border-radius: 16px; } }
/* La X: unica via di chiusura, visibile in OGNI stato (sala d'attesa inclusa). */
.auth-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; font-size: 16px; }
.auth-title { font-family: var(--display); font-weight: 700; font-size: 22px; margin: 0 0 16px; padding-right: 44px; }
.auth-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.auth-field { position: relative; }
.auth-field input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 12px 46px 12px 12px;
  min-height: 46px;
}
.auth-field input[type="text"], .auth-field input[type="email"] { padding-right: 12px; }
.auth-field input:focus { outline: none; border-color: var(--accent-text); }
.eye-btn {
  position: absolute;
  top: 50%; right: 4px;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  background: none; border: 0;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
}
.eye-btn:hover, .eye-btn.on { color: var(--text); }
.auth-err { color: var(--err); font-size: 13.5px; min-height: 18px; margin: 10px 0 4px; }
.auth-privacy { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 14px 0 0; }
.auth-submit { width: 100%; margin-top: 12px; }
.auth-switch {
  display: block;
  width: 100%;
  background: none; border: 0;
  color: var(--accent-text);
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 12px 0 2px;
  min-height: 44px;
  cursor: pointer;
}
.auth-wait { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; margin: 6px 0 12px; }
.auth-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.logout-btn { margin-top: 10px; min-height: 44px; }
