/* =========================================================
   MyKinetico — App Cliente v0
   Stile mobile-first, allineato al gestionale (tema dark)
   ========================================================= */

/* Font self-hosted (lancia scarica-font.command per popolare fonts/) */
@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   BRAND COBALT v2 (blocco 2) — CHIARO di default, scuro opt-in.
   Il login è già Cobalt (superficie a sé); qui passa tutto il corpo.
   ========================================================= */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #f5f6f8;
  --surface3: #e7ebf2;
  --accent: #0A84FF;
  --accent-2: #5E5CE6;
  --grad: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  --accent-dim: rgba(10,132,255,0.10);
  --text: #0e1420;
  --text-muted: #6b7480;
  --text-dim: #9aa2ad;
  --border: rgba(14,20,32,0.09);
  --hair: rgba(14,20,32,0.05);
  --danger: #FF453A;
  --danger-dim: rgba(255,69,58,0.12);
  --warning: #FF9F0A;
  --warning-dim: rgba(255,159,10,0.14);
  --positive: #34C759;
  --info: #0A84FF;
  --wa: #25D366;
  --shadow: 0 1px 2px rgba(14,20,32,.06), 0 10px 26px rgba(14,20,32,.09);
  --shadow-btn: 0 8px 22px rgba(30,90,220,.28);
}

body.tema-scuro {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2230;
  --surface3: #242c3a;
  --accent: #4d9fff;
  --accent-2: #7d7bf0;
  --grad: linear-gradient(135deg, #2f7fff 0%, #6d6bf0 100%);
  --accent-dim: rgba(77,159,255,0.16);
  --text: #e8edf5;
  --text-muted: #9aa4b2;
  --text-dim: #6b7480;
  --border: rgba(255,255,255,0.10);
  --hair: rgba(255,255,255,0.06);
  --danger: #ff6b60;
  --danger-dim: rgba(255,107,96,0.16);
  --warning: #ffb340;
  --warning-dim: rgba(255,179,64,0.16);
  --positive: #45d364;
  --info: #4d9fff;
  --wa: #25D366;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 26px rgba(0,0,0,.35);
  --shadow-btn: 0 8px 22px rgba(20,60,160,.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  /* Cobalt v2: Inter se presente, altrimenti il font di sistema (SF Pro su
     iPhone) — nativo e pulito, come nel login. */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* =========================================================
   APP CONTAINER mobile-first (max 480px, centrato)
   ========================================================= */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* =========================================================
   LOGIN
   ========================================================= */
#login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
}

.logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 196, 154, 0.18);
}

.logo span {
  font-size: 36px;
  font-weight: 700;
  color: #0e0e0f;
  letter-spacing: -2px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.brand-name span {
  color: var(--accent);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

.input-group {
  margin-bottom: 14px;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-group input::placeholder { color: var(--text-dim); }

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 196, 154, 0.15);
}

/* =========================================================
   BOTTONI (allineati al gestionale)
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #007a61; }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 77, 0.2);
}
.btn-danger:hover { background: rgba(255, 77, 77, 0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-block {
  width: 100%;
  padding: 13px 18px;
}

.demo-hint {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}

/* =========================================================
   ACCESSO — 2 schermate, altezza fissa, niente scroll (redo)
   Palette Cobalt esplicita del mockup approvato. La cura del
   difetto tastiera è tutta qui: 100dvh (NON 100vh) + ancoraggio
   space-between + overflow hidden → il campo resta sopra la
   tastiera, mai sovrapposizioni, mai scroll.
   ========================================================= */

/* Durante l'accesso il contenitore è alto quanto l'area DAVVERO visibile
   (100dvh): la tastiera aperta lo accorcia invece di coprirlo. */
body.login-active { overflow: hidden; }
body.login-active #app { min-height: 0; height: 100dvh; }

#login-screen {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;      /* annulla il center della vecchia regola legacy */
  justify-content: flex-start;
  padding: 0;
  background: #f0f2f5;
  color: #0e1420;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --lg-grad: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  --lg-cobalt: #0A84FF;
  --lg-ink: #0e1420;
  --lg-muted: #6b7480;
  --lg-muted-2: #9aa2ad;
  --lg-surface: #fff;
  --lg-hair: rgba(14,20,32,.09);
  --lg-shadow: 0 1px 2px rgba(14,20,32,.06), 0 12px 30px rgba(14,20,32,.10);
  --lg-shadow-btn: 0 8px 22px rgba(30,90,220,.30);
}

/* Ogni schermata: contenuto ancorato in alto e in basso, vuoto unico in mezzo. */
.lg-screen {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 26px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.lg-top { display: flex; flex-direction: column; gap: 22px; }
.lg-bottom { display: flex; flex-direction: column; }

/* brand */
.lg-brandtop { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.lg-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--lg-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--lg-shadow-btn); margin: 0;
}
.lg-logo span { color: #fff; font-weight: 800; font-size: 22px; letter-spacing: -1px; line-height: 1; }
.lg-wordmark { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--lg-ink); }

/* hero */
.lg-hero h2 { font-size: 26px; line-height: 1.18; margin: 0; font-weight: 700; letter-spacing: -0.02em; color: var(--lg-ink); text-wrap: balance; }
.lg-hero p  { margin: 8px 0 0; color: var(--lg-muted); font-size: 14.5px; line-height: 1.5; }
.lg-hero .lg-sent-to { margin: 10px 0 0; }
.lg-hero .lg-mail { margin: 3px 0 0; font-size: 16px; font-weight: 700; color: var(--lg-ink); word-break: break-all; }
.lg-hero .lg-spam { margin: 12px 0 0; font-size: 13px; color: var(--lg-muted-2); }

/* card email */
.lg-card { background: var(--lg-surface); border: 1px solid var(--lg-hair); border-radius: 20px; padding: 18px; box-shadow: var(--lg-shadow); }
.lg-field { display: block; }
.lg-lbl { display: block; font-size: 12px; font-weight: 600; color: var(--lg-muted); letter-spacing: 0.02em; margin: 0 0 7px 2px; text-transform: none; }
.lg-input { display: flex; align-items: center; gap: 9px; border: 1px solid var(--lg-hair); border-radius: 13px; padding: 0 13px; height: 50px; background: #fbfcfe; transition: border-color 0.15s, box-shadow 0.15s; }
.lg-input svg { width: 19px; height: 19px; color: var(--lg-muted-2); flex: none; }
.lg-input input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--lg-ink); width: 100%; }
.lg-input input::placeholder { color: var(--lg-muted-2); }
.lg-input:focus-within { border-color: var(--lg-cobalt); box-shadow: 0 0 0 3px rgba(10,132,255,0.15); }

/* CTA */
.lg-cta { margin-top: 13px; width: 100%; height: 52px; border: 0; border-radius: 14px; background: var(--lg-grad); color: #fff; font: inherit; font-size: 15.5px; font-weight: 650; letter-spacing: 0.01em; cursor: pointer; box-shadow: var(--lg-shadow-btn); display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.12s, opacity 0.12s; }
.lg-cta svg { width: 18px; height: 18px; }
.lg-cta:active { transform: scale(0.98); }
.lg-cta:disabled { opacity: 0.6; cursor: default; }

.lg-error { margin: 12px 2px 0; font-size: 12.5px; line-height: 1.45; color: #c0392b; }

/* footnote schermata 1 */
.lg-foot { margin: 14px 4px 0; text-align: center; font-size: 12.5px; color: var(--lg-muted-2); }

/* schermata 2, in fondo e defilati: "rimanda" primario, "cambia email" più quieto */
.lg-resend { display: block; margin: 16px auto 0; font-size: 13.5px; color: var(--lg-cobalt); font-weight: 600; background: none; border: 0; cursor: pointer; }
.lg-resend:disabled { color: var(--lg-muted-2); cursor: default; }
.lg-change { display: block; margin: 8px auto 0; font-size: 12.5px; color: var(--lg-muted-2); font-weight: 500; background: none; border: 0; cursor: pointer; }
.lg-change:hover { color: var(--lg-ink); }

/* stato "codice a 6 cifre" */
.lg-input-code { justify-content: center; }
.lg-input-code input {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 10px;
  padding-left: 10px; /* compensa il letter-spacing per restare centrato */
  color: var(--lg-ink);
  caret-color: var(--lg-cobalt);
}
.lg-input-code input::placeholder { letter-spacing: 8px; color: var(--lg-muted-2); font-weight: 600; }

/* stato "connessione" (anti-flash) */
.lg-loading { align-items: center; justify-content: center; text-align: center; }
.lg-logo-lg { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 20px; }
.lg-logo-lg span { font-size: 30px; }
.lg-spinner { width: 22px; height: 22px; border: 2.5px solid rgba(14,20,32,0.12); border-top-color: var(--lg-cobalt); border-radius: 50%; animation: lg-spin 0.7s linear infinite; }
.lg-loading-txt { margin-top: 14px; font-size: 13.5px; color: var(--lg-muted); }
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* =========================================================
   APP (post login)
   ========================================================= */
#app-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

/* TOP BAR fissa */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  height: 56px;
}

.topbar-studio {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 8px 6px 4px;
  margin-left: -8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.topbar-studio:hover { background: var(--surface2); }
.topbar-studio:active { background: var(--surface3); }

.topbar-studio-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.topbar-studio-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.topbar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  color: var(--text);
  transition: background 0.15s;
}

.topbar-btn:hover { background: var(--surface3); }

.topbar-btn svg {
  width: 20px;
  height: 20px;
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.app-content {
  flex: 1;
  padding: 16px;
}

/* =========================================================
   BLOCCO IDENTITÀ (Home) — avatar emoji + nome + stats
   ========================================================= */
.identity-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 4px 18px;
  margin-bottom: 6px;
}

.avatar-emoji {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}

.avatar-emoji:active { transform: scale(0.96); }
.avatar-emoji:hover { border-color: var(--accent); }

.avatar-emoji::after {
  content: "";
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.identity-info {
  flex: 1;
  min-width: 0;
}

.identity-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  color: var(--text);
}

.identity-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.identity-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.identity-stat .num {
  font-family: 'DM Mono', 'SF Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.identity-stat .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.view { display: none; }
.view.active { display: block; }

/* =========================================================
   CARDS (allineate al gestionale: surface + border + 12px)
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Quando lo stat-label è dentro card-header-row, il margine sotto è gestito dal contenitore */
.card-header-row .stat-label { margin-bottom: 0; }

/* Heading di sezione che vive FUORI da una card (es. label "Acquista pacchetto" prima di una grid) */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 4px 8px;
  margin-top: 4px;
}
.section-heading-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.section-heading-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.stat-value {
  font-family: 'DM Mono', 'SF Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

/* CARD ABBONAMENTO — stat-card stile, accent come highlight */
.card-abb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.card-abb::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
}

.abb-tipo {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.abb-numbers {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.abb-residue {
  font-family: 'DM Mono', 'SF Mono', monospace;
  font-size: 40px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1;
}

.abb-totali {
  font-size: 14px;
  color: var(--text-muted);
}

.abb-progress {
  margin-top: 14px;
  height: 6px;
  background: var(--surface3);
  border-radius: 999px;
  overflow: hidden;
}

.abb-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.abb-info {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.abb-info span:first-child { color: var(--text-muted); }
.abb-info span:last-child { color: var(--text); font-weight: 500; }

/* BADGE (stile gestionale) */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-green { background: var(--accent-dim); color: var(--accent); }
.badge-orange { background: var(--warning-dim); color: var(--warning); }
.badge-red { background: var(--danger-dim); color: var(--danger); }

/* =========================================================
   LISTE (prenotazioni / storico)
   ========================================================= */
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 4px; }

.list-date {
  width: 48px;
  flex-shrink: 0;
  text-align: center;
  margin-right: 14px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 8px 0;
}
.list-date .day {
  font-family: 'DM Mono', 'SF Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}
.list-date .month {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

.list-meta { flex: 1; min-width: 0; }
.list-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--text);
}
.list-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 28px 16px;
  font-size: 13px;
}

/* =========================================================
   PROFILO
   ========================================================= */
.profilo-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.profilo-row:last-child { border-bottom: none; padding-bottom: 0; }
.profilo-row:first-child { padding-top: 4px; }

.profilo-row .label {
  color: var(--text-muted);
  font-size: 13px;
}
.profilo-row .value {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  text-align: right;
}

/* Toggle tema (chiaro/scuro) */
.tema-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.tema-opt {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.tema-opt.active {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   TAB BAR (mobile bottom nav)
   ========================================================= */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 10;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1px;
  transition: color 0.15s;
}

.tab-btn.active { color: var(--accent); }

.tab-icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

/* =========================================================
   DEMO BANNER
   ========================================================= */
.demo-banner {
  background: var(--warning-dim);
  color: var(--warning);
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================================
   CARD PIEGHEVOLE (es. prossime prenotazioni)
   ========================================================= */
.expand-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  border-top: 1px solid var(--border);
  transition: color 0.15s;
}

.expand-link:hover { color: var(--text); }

.expand-link svg {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  margin-left: 4px;
  transition: transform 0.2s;
}

.expand-link.expanded svg {
  transform: rotate(180deg);
}

.list-extra {
  display: none;
}

.list-extra.show {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   OVERLAY BACKDROP
   ========================================================= */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  animation: fadeBackdrop 0.2s ease-out;
}

@keyframes fadeBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================
   PANNELLO NOTIFICHE (slide da destra)
   ========================================================= */
.panel-notifiche {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 92%;
  max-width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s ease-out;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.panel-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.panel-close svg { width: 16px; height: 16px; }
.panel-close:hover { background: var(--surface3); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.notif-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.notif-item:hover { background: var(--surface2); }
.notif-item:last-child { border-bottom: none; }

.notif-item.non-letta::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 8px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

.notif-item.non-letta { padding-left: 24px; }

.notif-titolo {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}

.notif-testo {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
}

.notif-data {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.notif-tipo-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 6px;
}

.notif-tipo-documento { background: var(--accent-dim); color: var(--accent); }
.notif-tipo-promemoria { background: rgba(77,159,255,0.12); color: var(--info); }
.notif-tipo-scadenza { background: var(--warning-dim); color: var(--warning); }
.notif-tipo-modifica { background: var(--surface3); color: var(--text-muted); }
.notif-tipo-comunicazione { background: var(--surface3); color: var(--text-muted); }

/* =========================================================
   MODAL STATO (selettore emoji)
   ========================================================= */
.modal-stato {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.modal-stato:not(.hidden) { pointer-events: auto; }

.modal-stato-content {
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 22px 18px 28px;
  border-top: 1px solid var(--border);
  animation: slideInBottom 0.25s ease-out;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideInBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-stato-header {
  text-align: center;
  margin-bottom: 22px;
}

.modal-stato-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.modal-stato-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.stati-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stato-opt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 6px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.stato-opt:hover {
  background: var(--surface3);
  border-color: var(--text-dim);
}

.stato-opt.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.stato-opt .emo {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
  line-height: 1;
}

.stato-opt .lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}

/* =========================================================
   PROFILO HERO (avatar grande + nome + stato)
   ========================================================= */
.profilo-hero {
  text-align: center;
  padding: 8px 16px 22px;
}

.avatar-big {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  font-size: 56px;
  margin: 0 auto 14px;
  display: flex;
}

.avatar-big::after {
  width: 16px;
  height: 16px;
  bottom: 6px;
  right: 6px;
  border-width: 3px;
}

.profilo-nome {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 2px;
}

.profilo-stato {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* Card header con meta a destra */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.card-header-meta {
  display: flex;
  align-items: center;
}

/* =========================================================
   LISTA DOCUMENTI
   ========================================================= */
.doc-list {
  margin-top: 4px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { opacity: 0.85; }
.doc-item:first-child { padding-top: 4px; }

.doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doc-icon svg { width: 18px; height: 18px; }
.doc-icon.ok      { background: var(--accent-dim); color: var(--accent); }
.doc-icon.warn    { background: var(--warning-dim); color: var(--warning); }
.doc-icon.danger  { background: var(--danger-dim); color: var(--danger); }
.doc-icon.muted   { background: var(--surface3); color: var(--text-muted); }

.doc-meta {
  flex: 1;
  min-width: 0;
}

.doc-titolo {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}

.doc-stato {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.doc-stato.ok      { color: var(--accent); }
.doc-stato.warn    { color: var(--warning); }
.doc-stato.danger  { color: var(--danger); }
.doc-stato.muted   { color: var(--text-muted); }

/* =========================================================
   AIUTO — righe contatto
   ========================================================= */
.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.contact-row:last-child { border-bottom: none; }
.contact-row:first-child { padding-top: 4px; }
.contact-row:hover { opacity: 0.85; }

.contact-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.contact-icon svg { width: 18px; height: 18px; }

.contact-text { flex: 1; min-width: 0; }
.contact-title { font-size: 14px; font-weight: 500; }
.contact-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.contact-arrow {
  font-size: 22px;
  color: var(--text-dim);
  font-weight: 300;
  line-height: 1;
}

/* =========================================================
   MODALE DOCUMENTO (full screen)
   ========================================================= */
.modal-doc {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideInBottom 0.25s ease-out;
}

.modal-doc-content {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.modal-doc-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  z-index: 5;
}

.modal-doc-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.modal-doc-back svg { width: 20px; height: 20px; }
.modal-doc-back:hover { background: var(--surface3); }

.modal-doc-title { flex: 1; min-width: 0; }
.modal-doc-tipo {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.modal-doc-nome {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-doc-body { padding: 16px; padding-bottom: 40px; }

.doc-banner {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.4;
}
.banner-ok      { background: var(--accent-dim); color: var(--accent); }
.banner-warn    { background: var(--warning-dim); color: var(--warning); }
.banner-danger  { background: var(--danger-dim); color: var(--danger); }
.banner-info    { background: rgba(77,159,255,0.10); color: var(--info); }

.doc-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 18px;
}

/* =========================================================
   FIRMA DIGITALE
   ========================================================= */
.firma-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.firma-istruzioni {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 6px;
}

.firma-canvas-wrap {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface2);
  height: 180px;
  margin-bottom: 14px;
  overflow: hidden;
}

.firma-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.firma-line {
  position: absolute;
  bottom: 36px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.firma-placeholder {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
  transition: opacity 0.2s;
}

.firma-actions {
  display: flex;
  gap: 10px;
}

.firma-actions .btn { flex: 1; }

.firma-saved {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  padding: 6px 0;
}

/* =========================================================
   TOAST (notifica successo)
   ========================================================= */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   SUBTABS (tabs interni nelle viste — es. Storico)
   ========================================================= */
.subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.subtab-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.subtab-btn.active {
  background: var(--accent);
  color: #fff;
}

.substoria { display: none; }
.substoria.active { display: block; }

/* =========================================================
   STORICO — gruppi per mese
   ========================================================= */
.month-group { margin-bottom: 18px; }

.month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.month-count {
  font-family: 'DM Mono', monospace;
  color: var(--accent);
  font-size: 13px;
}

/* =========================================================
   STORICO — card abbonamento (scheda compatta)
   ========================================================= */
.abb-card { margin-bottom: 12px; }

.abb-card-attivo {
  border-color: var(--accent);
  position: relative;
}

.abb-card-attivo::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 12px 0 0 12px;
}

.abb-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.abb-card-tipo {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}

.abb-card-period {
  font-size: 12px;
  color: var(--text-muted);
}

.badge-gray {
  background: var(--surface3);
  color: var(--text-muted);
}

.abb-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.abb-stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
}

.abb-stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.abb-stat-num span {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 2px;
}

.abb-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

/* =========================================================
   STORICO — I TUOI NUMERI (totali)
   ========================================================= */
.numeri-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;   /* 3 totali su fila unica (tolto "Settimane di fila") */
  gap: 12px;
  margin-top: 12px;
}

.numero-item {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.numero-num {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.numero-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

/* =========================================================
   PRENOTA — calendario settimana + slot
   ========================================================= */
.week-card {
  padding: 14px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.week-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.week-nav-btn svg { width: 16px; height: 16px; }
.week-nav-btn:hover { background: var(--surface3); }

.week-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  text-transform: capitalize;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-cell {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 2px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.day-cell:hover:not(:disabled) { background: var(--surface2); }

.day-cell.selected {
  background: var(--accent);
  color: #fff;
}

.day-cell.selected .day-name,
.day-cell.selected .day-num { color: #fff; }

.day-cell.today:not(.selected) {
  border-color: var(--accent);
}

.day-cell.closed {
  opacity: 0.35;
  cursor: not-allowed;
}

.day-name {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.day-num {
  font-family: 'DM Mono', monospace;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

/* SLOT GRID */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.slot-btn {
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.slot-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.slot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.slot-libero {
  /* default */
}

.slot-pieno {
  background: var(--surface2);
  border-color: var(--border);
}

.slot-mio {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.slot-mio:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.slot-ora {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.slot-stato {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.slot-libero .slot-stato { color: var(--accent); }
.slot-pieno .slot-stato { color: var(--text-muted); }
.slot-mio .slot-stato { color: var(--accent); }

/* =========================================================
   LISTINO PACCHETTI
   ========================================================= */
.pack-list {
  margin-top: 6px;
}

.pack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
}

.pack-consigliato {
  border-color: var(--accent);
  background: var(--surface);
}

.pack-flag {
  position: absolute;
  top: -8px;
  left: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 5px;
}

.pack-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 10px;
}

.pack-tipo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  flex: 1;
}

.pack-price {
  font-family: 'DM Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
}
.pack-price span {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 2px;
}

.pack-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.pack-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}

/* =========================================================
   CHECKOUT (modale acquisto)
   ========================================================= */
.checkout-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 6px 0;
  color: var(--text);
}

.checkout-summary-row span:first-child { color: var(--text-muted); }
.checkout-summary-row span:last-child { font-weight: 500; }

.checkout-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
}

.checkout-summary-total span:last-child {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  color: var(--accent);
}
.checkout-summary-total span:last-child span {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 2px;
}

.checkout-form {
  margin-top: 6px;
}

.input-row {
  display: flex;
  gap: 10px;
}

/* Loader spinner (pagamento in corso) */
.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   LO STUDIO — Social + ultimi contenuti
   ========================================================= */
.social-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 18px;
}

.social-btn {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
  color: #fff;
}

.social-btn:active { transform: scale(0.94); }
.social-btn:hover { opacity: 0.92; }
.social-btn svg { width: 22px; height: 22px; }

/* Brand colors */
.social-ig {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.social-fb { background: #1877f2; }
.social-tt { background: #000; }
.social-web { background: var(--accent); }

/* Light mode: social neutral background per chi ha più senso */
body.light-mode .social-tt { background: #1a1a1a; }

.ultimi-post-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.post-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.post-card:active { transform: scale(0.96); }

.post-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 6px;
}

.post-emoji {
  font-size: 38px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.post-tipo-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 6px 3px 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  backdrop-filter: blur(4px);
}
.post-tipo-badge svg {
  width: 8px;
  height: 8px;
}

.post-titolo {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =========================================================
   STUDIO MODALE — hero + status
   ========================================================= */
.studio-hero {
  text-align: center;
  padding: 8px 16px 22px;
}

.studio-hero-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  color: var(--text);
}

.studio-hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.studio-hero-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.studio-hero-status.open {
  background: var(--accent-dim);
  color: var(--accent);
}

.studio-hero-status.closed {
  background: var(--surface3);
  color: var(--text-muted);
}

.studio-hero-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* =========================================================
   STUDIO — Orari
   ========================================================= */
.orari-list { margin-top: 4px; }

.orari-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.orari-row:last-child { border-bottom: none; }
.orari-row:first-child { padding-top: 4px; }

.orari-giorno {
  color: var(--text-muted);
  font-weight: 500;
}
.orari-fasce {
  font-family: 'DM Mono', monospace;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}

.orari-row.today {
  color: var(--accent);
}
.orari-row.today .orari-giorno,
.orari-row.today .orari-fasce {
  color: var(--accent);
  font-weight: 600;
}

.orari-row.chiuso .orari-fasce {
  color: var(--text-dim);
  font-style: italic;
}

/* =========================================================
   STUDIO — Team
   ========================================================= */
.team-list { margin-top: 6px; }

.team-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.team-item:last-child { border-bottom: none; }
.team-item:first-child { padding-top: 4px; }

.team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.team-meta { flex: 1; min-width: 0; }
.team-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.team-ruolo {
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================
   PROFILO — hint sotto le card
   ========================================================= */
.profilo-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
}
.profilo-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* =========================================================
   SCROLLBAR (stile gestionale)
   ========================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* =========================================================
   DIALOG — modale custom (conferma / alert)
   Sostituisce confirm()/alert() nativi
   ========================================================= */
.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.dialog-wrap.show { opacity: 1; pointer-events: auto; }

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-box {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 22px 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  transform: translateY(8px) scale(0.98);
  transition: transform .2s ease;
}
.dialog-wrap.show .dialog-box {
  transform: translateY(0) scale(1);
}

.dialog-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 8px;
}

.dialog-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.dialog-body strong { color: var(--text); }

.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dialog-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
  font-size: 14px;
  padding: 10px 16px;
}

/* Tone variants — accento border-top per chiarezza visiva */
.dialog-box.dialog-tone-danger {
  border-top: 3px solid var(--danger);
}
.dialog-box.dialog-tone-warn {
  border-top: 3px solid var(--warning);
}

/* =========================================================
   PROFILO — riga cliccabile (action) + nota piccola
   ========================================================= */
.profilo-row-action {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.profilo-row-action:last-child { border-bottom: none; }
.profilo-row-action:hover { background: var(--surface2); }
.profilo-row-action .label {
  font-size: 14px;
  color: var(--danger);
  font-weight: 500;
}
.profilo-row-action .contact-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

.profilo-row-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 0 2px;
}

/* =========================================================
   NOTIFICHE — pulsante azione header + empty state migliorato
   ========================================================= */
.panel-action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 8px;
  transition: all .15s ease;
}
.panel-action:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text-muted);
}

/* =========================================================
   EMPTY STATES curati (con emoji + titolo + sub)
   ========================================================= */
.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-emoji {
  font-size: 38px;
  margin-bottom: 10px;
  opacity: 0.7;
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

/* Stato abbonamento "in attesa di attivazione" */
.abb-card-attesa {
  border: 1px dashed var(--warning) !important;
  background: var(--warning-dim);
}

/* =========================================================
   HOME — welcome message per cliente nuovo (sostituisce stats)
   ========================================================= */
.identity-welcome {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 4px;
  max-width: 280px;
}

/* =========================================================
   DOCUMENTI — click-to-accept (Privacy GDPR)
   ========================================================= */
.accept-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.accept-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* =========================================================
   PROFILO — riga editabile (email/telefono)
   ========================================================= */
.profilo-row-editable {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  font-size: 14px;
}
.profilo-row-editable .label {
  color: var(--text-muted);
  font-size: 13px;
}
.profilo-row-editable .value-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}
.profilo-row-editable .edit-icon {
  color: var(--text-muted);
  font-size: 13px;
  opacity: 0.7;
}
.profilo-row-editable:hover .edit-icon {
  color: var(--accent);
  opacity: 1;
}

/* Input dentro dialog (per OTP, edit contatti) */
.dialog-box .input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dialog-box .input-group label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.dialog-box .input-group input {
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.dialog-box .input-group input:focus {
  border-color: var(--accent);
}

/* =========================================================
   COBALT v2 — componenti "firma" del brand (blocco 2)
   Il grosso del restyle arriva dai token (:root) in cima;
   qui i pezzi che devono avere un aspetto specifico.
   ========================================================= */

/* Avatar a INIZIALI (l'emoji-stato è disattivato in v1) */
.avatar-emoji.avatar-initials {
  background: var(--grad);
  border: 0;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: default;
  box-shadow: var(--shadow-btn);
}
.avatar-emoji.avatar-initials:hover { border: 0; }
.avatar-emoji.avatar-initials::after { display: none; }
.avatar-big.avatar-initials { font-size: 30px; }

/* Carnet in GRADIENTE (card abbonamento in Home) */
.card.card-abb {
  background: var(--grad);
  border: 0;
  color: #fff;
  box-shadow: 0 12px 30px rgba(30,90,220,.30);
}
.card-abb::before { display: none; }
.card-abb .stat-label { color: #fff; opacity: .85; }
.card-abb .abb-tipo   { color: #fff; }
.card-abb .abb-residue{ color: #fff; }
.card-abb .abb-totali { color: #fff; opacity: .9; }
.card-abb .abb-progress { background: rgba(255,255,255,.28); }
.card-abb .abb-progress-fill { background: #fff; }
.card-abb .abb-info span { color: #fff !important; opacity: .95; }

/* Subtab a pillola (Storico) */
.subtabs { background: var(--surface3); border-color: transparent; }
.subtab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(14,20,32,.10);
}

/* Prenota — pannello "come prenoto?" (Chiama / WhatsApp) */
.pren-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 44px 22px 34px; min-height: 56vh; }
.pren-ic { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.pren-ic svg { width: 30px; height: 30px; color: var(--accent); }
.pren-title { margin: 12px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.pren-sub { margin: 8px 6px 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.55; max-width: 32ch; }
.pren-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin-top: 22px; }
.pren-cta { height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 650; font-size: 15px; color: #fff; }
.pren-cta svg { width: 19px; height: 19px; }
.pren-cta.grad { background: var(--grad); box-shadow: var(--shadow-btn); }
.pren-cta.wa { background: var(--wa); box-shadow: 0 8px 20px rgba(37,211,102,.28); }
.pren-cta:active { transform: scale(.98); }
.pren-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-dim); }

/* =========================================================
   BLOCCO 3 — registro probatorio + download + upload cert
   ========================================================= */
.firma-proof { border: 1px solid rgba(10,132,255,.22); background: var(--accent-dim); border-radius: 16px; padding: 15px 16px; margin-top: 14px; }
.firma-proof .proof-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.firma-proof .proof-head svg { width: 19px; height: 19px; color: var(--accent); }
.firma-proof .proof-head b { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.firma-proof .proof-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(10,132,255,.14); font-size: 12.5px; }
.firma-proof .proof-row:first-of-type { border-top: 0; }
.firma-proof .proof-row .k { color: var(--text-muted); flex: none; }
.firma-proof .proof-row .v { font-weight: 600; text-align: right; color: var(--text); }
.firma-proof .proof-row .v.mono { font-family: 'DM Mono', ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; }
.firma-proof .proof-note { margin-top: 10px; font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* download discreto: azione minore, non protagonista */
.doc-download { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px auto 4px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.doc-download svg { width: 15px; height: 15px; }
.doc-download:hover { color: var(--text); }

/* upload certificato medico */
.cert-drop { border: 1.5px dashed rgba(10,132,255,.4); border-radius: 14px; padding: 22px 16px; text-align: center; background: var(--accent-dim); cursor: pointer; }
.cert-drop svg { width: 30px; height: 30px; color: var(--accent); }
.cert-drop .t { font-size: 13.5px; font-weight: 650; margin-top: 8px; color: var(--text); }
.cert-drop .s { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.cert-file { font-size: 13px; font-weight: 600; color: var(--accent); margin-top: 10px; word-break: break-all; }

/* Pallino "attenzione" (documenti da firmare / in scadenza) su campanella + tab.
   NON è la notifica vera: è solo il cue che c'è qualcosa da sistemare. */
.topbar-btn { position: relative; }
.tab-btn { position: relative; }
.attn-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); pointer-events: none; }
#bell-attn { top: 2px; right: 2px; }
#profilo-attn { top: 3px; left: 50%; transform: translateX(7px); }

/* ===================================================================
   COSTANZA (gamification "La tua costanza")
   Card BIANCA (superficie normale) sotto l'abbonamento cobalto: due card
   cobalto di fila litigherebbero. L'unico cobalto della feature è il premio.
   =================================================================== */
.cost-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.cost-chev { color: var(--text-dim); font-size: 16px; }
.cost-bar { display: flex; gap: 4px; margin-bottom: 8px; }
.cost-seg { flex: 1; height: 6px; border-radius: 3px; background: var(--surface3); }
.cost-seg.on { background: var(--accent); }
.cost-stato { font-size: 13px; }
.cost-stato.accent { color: var(--accent); }             /* manca 1: cambia SOLO il colore del testo */
.cost-dots-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.cost-dots { display: flex; gap: 5px; }
.cost-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--accent); }
.cost-dot.off { background: none; border: 1.5px dashed var(--text-dim); }
.cost-cap { font-size: 12px; color: var(--text-muted); }
.cost-card { cursor: pointer; }

/* Riquadro premio — cobalto pieno, sopra l'abbonamento, coriandoli una volta */
.cost-prize { background: var(--grad); color: #fff; position: relative; overflow: hidden; box-shadow: 0 12px 30px rgba(30,90,220,.30); }
.cost-prize-emoji { font-size: 26px; line-height: 1; margin-bottom: 10px; }
.cost-prize-title { font-size: 16px; line-height: 1.35; margin-bottom: 8px; font-weight: 600; }
.cost-prize-testo { font-size: 13px; margin-bottom: 10px; }
.cost-prize-inner { background: rgba(255,255,255,.18); border-radius: 9px; padding: 9px 11px; font-size: 12px; line-height: 1.45; }
.cost-conf { position: absolute; width: 5px; height: 9px; border-radius: 1px; }
.cost-prize-celebrate .cost-conf { animation: cost-fall .9s ease-out 1 both; }
@keyframes cost-fall {
  0%   { transform: translateY(-16px) rotate(0);    opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translateY(8px)  rotate(45deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .cost-prize-celebrate .cost-conf { animation: none; } }

/* Dettaglio (overlay a schermata piena) */
#cost-detail-ov { position: fixed; inset: 0; background: var(--bg); z-index: 200; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; }
#cost-detail-ov.show { transform: none; }
.cd-panel { max-width: 480px; margin: 0 auto; padding: 16px; }
.cd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cd-back { font-size: 26px; line-height: 1; background: none; border: none; color: var(--text); padding: 2px 8px; cursor: pointer; }
.cd-title { font-size: 16px; }
.cd-sub-h { font-size: 12px; color: var(--text-muted); }
.cd-list { padding: 6px 12px; }
.cd-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.cd-row:last-child { border-bottom: 0; }
.cd-ico { width: 18px; text-align: center; font-size: 14px; flex: none; }
.cd-ico.ok { color: var(--positive); }
.cd-ico.dim { color: var(--text-dim); }
.cd-ring { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--accent); }
.cd-main { flex: 1; }
.cd-when { font-size: 13px; }
.cd-note { font-size: 12px; color: var(--text-muted); }
.cd-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cd-sub.accent { color: var(--accent); }
.cd-next { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.cd-next-emoji { font-size: 16px; }

/* ===================================================================
   I TUOI NUMERI (sotto-sezione Storico) — grafico a 12 slot fissi.
   Larghezza/altezza fisse (identica per chi ha 2 mesi e per chi ne ha 12),
   scala sul massimo storico, mesi a zero visibili, niente rosso.
   =================================================================== */
.numeri-kicker { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.numeri-title { font-size: 13px; margin-bottom: 14px; }
.numeri-chart { position: relative; height: 118px; }
.navg { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--text-dim); }
.navglbl { position: absolute; right: 0; font-size: 9px; color: var(--text-dim); background: var(--surface); padding: 0 3px; }
.nbars { position: absolute; left: 0; right: 0; bottom: 0; height: 118px; display: flex; align-items: flex-end; gap: 6px; }
.nslot { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.nb { width: 100%; border-radius: 3px 3px 0 0; background: var(--accent); }
.nb.now { background: var(--accent-2); }              /* mese in corso = indaco, non trasparenza */
.nb.zero { height: 6px; border-radius: 3px; background: var(--surface3); }        /* mese a zero */
.nb.none { height: 6px; border-radius: 3px; background: var(--surface3); opacity: .5; }  /* prima dell'iscrizione */
.nlabels { display: flex; gap: 6px; margin-top: 8px; }
.nlbl { flex: 1; text-align: center; font-size: 10px; color: var(--text-dim); height: 14px; }
.nlbl.now { color: var(--text); }
.nlbl.off { color: var(--text-dim); opacity: .5; }
.nfoot { display: flex; justify-content: space-between; border-top: 1px solid var(--hair); padding-top: 9px; margin-top: 9px; }
.nfoot span { font-size: 11px; }
.nfoot .dim { color: var(--text-dim); }
.nfoot .muted { color: var(--text-muted); }
/* Rispetto a prima: crescita verde, calo/pari GRIGIO (mai rosso) */
.nrisp-big { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.nrisp-big .mono { font-size: 24px; }
.nrisp-big.up .mono { color: var(--positive); }
.nrisp-big.down .mono { color: var(--text-dim); }
.nrisp-big.flat { font-size: 16px; color: var(--text-dim); }
.nsmall { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
