/* ===================================================================
   REDESIGN OVERLAY — caricato dopo app.css per upgrade visivo
   senza ricompilare Tailwind. Tutte le regole sono additive: rispettano
   lo stato esistente e aggiungono presence/depth/feedback.
   =================================================================== */

/* -------------------------------------------------------------------
   1. Tipografia: balance + numeri tabulari ovunque + tracking fine
   ------------------------------------------------------------------- */
h1, h2, h3 {
  text-wrap: balance;          /* niente parole orfane */
}
p, li, dd {
  text-wrap: pretty;           /* line-break ottimizzato */
}
.font-h1, .font-h2 {
  letter-spacing: -0.025em;    /* tracking più stretto sui display */
}
.tabular-nums, .font-h1, .font-h2, [class*="tabular"] {
  font-feature-settings: "tnum", "ss01";
}

/* -------------------------------------------------------------------
   2. Body: subtle warm background gradient + grain overlay
   ------------------------------------------------------------------- */
body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(248, 153, 71, 0.04), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(28, 27, 27, 0.025), transparent 70%),
    #fcf9f8;
}

/* Grain ultra-soft, fissato sopra al body, non interagibile */
/* Grain dietro tutto: isolation crea uno stacking context al body */
body { isolation: isolate; }
body::before { z-index: -1; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.018 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
/* -------------------------------------------------------------------
   3. Shadow tinted: niente più pure-black, prendono tono dal contesto
   ------------------------------------------------------------------- */
.card-surface {
  box-shadow:
    0 1px 0 rgba(28, 27, 27, 0.02),
    0 4px 14px -4px rgba(28, 27, 27, 0.06),
    0 2px 4px -2px rgba(28, 27, 27, 0.04);
  transition:
    transform 240ms cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 240ms cubic-bezier(0.34, 1.4, 0.64, 1),
    border-color 240ms ease;
}

/* Card cliccabili (anchor o data-row) → lift su hover */
a > .card-surface:hover,
.card-surface[data-row]:hover,
.list-row-mobile:hover,
article.card-surface:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(28, 27, 27, 0.03),
    0 12px 28px -8px rgba(28, 27, 27, 0.10),
    0 4px 10px -4px rgba(28, 27, 27, 0.06);
  border-color: rgba(196, 199, 199, 0.6);
}

/* Card-hero-dark: glow arancione sottile sotto invece di shadow nera */
.card-hero-dark {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 18px 40px -16px rgba(248, 153, 71, 0.18),
    0 8px 20px -8px rgba(28, 27, 27, 0.35);
}
.card-hero-dark::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* -------------------------------------------------------------------
   4. Bottoni: spring + active feedback + focus tinted
   ------------------------------------------------------------------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost {
  transition:
    transform 200ms cubic-bezier(0.34, 1.5, 0.64, 1),
    background-color 200ms ease,
    box-shadow 200ms ease,
    color 200ms ease;
}
.btn-primary { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 6px 14px -6px rgba(28,27,27,0.35); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 10px 24px -8px rgba(28,27,27,0.40); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { box-shadow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 6px 14px -6px rgba(248,153,71,0.45); }
.btn-secondary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 10px 24px -8px rgba(248,153,71,0.55); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0); }

.btn-ghost:hover { transform: translateY(-1px); }

/* Focus ring tinted arancione per accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(248, 153, 71, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* -------------------------------------------------------------------
   5. List-row: hover sottile, transition fluida
   ------------------------------------------------------------------- */
.list-row {
  transition: background-color 180ms ease, padding-left 220ms cubic-bezier(0.34, 1.5, 0.64, 1);
}
.list-row:hover {
  padding-left: calc(var(--tw-space-x-reverse, 16px) + 4px);
  background-color: rgba(240, 237, 237, 0.7);
}

/* Active sidebar/tab: indicatore animato */
.nav-item-active {
  background-image: linear-gradient(90deg, rgba(248,153,71,0.10), transparent 60%);
}

/* -------------------------------------------------------------------
   6. Tabs (cliente, impostazioni, ecc): underline animata
   ------------------------------------------------------------------- */
.tab {
  position: relative;
  transition: color 180ms ease;
}
.tab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 260ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.tab.tab-active::after { transform: scaleX(1); }

/* -------------------------------------------------------------------
   7. Bottom-nav: indicatore cerchio dietro icona attiva
   ------------------------------------------------------------------- */
.tab-item {
  position: relative;
  transition: color 180ms ease;
}
.tab-item .material-symbols-outlined {
  position: relative;
  transition: transform 220ms cubic-bezier(0.34, 1.5, 0.64, 1);
}
.tab-item.tab-item-active .material-symbols-outlined {
  transform: translateY(-2px);
}
.tab-item.tab-item-active::before {
  content: "";
  position: absolute;
  top: 8px;
  width: 36px; height: 36px;
  border-radius: 999px;
  background: rgba(248, 153, 71, 0.18);
  z-index: -1;
}

/* -------------------------------------------------------------------
   8. Skeleton loader (sostituisce lo spinner di app.js)
   ------------------------------------------------------------------- */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-card {
  background:
    linear-gradient(90deg, rgba(244, 240, 240, 0.6) 0%, rgba(255, 255, 255, 0.9) 50%, rgba(244, 240, 240, 0.6) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: 1rem;
  border: 1px solid #e4e2e1;
}
.skeleton-line {
  background:
    linear-gradient(90deg, #eae7e7 0%, #f6f3f2 50%, #eae7e7 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: 6px;
  height: 12px;
}

/* -------------------------------------------------------------------
   9. Stagger entry: contenuti che entrano a cascata
   Si attiva applicando .stagger-in al container, e i figli diretti
   ricevono fade+translateY con delay incrementale.
   ------------------------------------------------------------------- */
@keyframes pt-fadeup {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stagger-in > * {
  opacity: 0;
  animation: pt-fadeup 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stagger-in > *:nth-child(1) { animation-delay:  20ms; }
.stagger-in > *:nth-child(2) { animation-delay:  80ms; }
.stagger-in > *:nth-child(3) { animation-delay: 140ms; }
.stagger-in > *:nth-child(4) { animation-delay: 200ms; }
.stagger-in > *:nth-child(5) { animation-delay: 260ms; }
.stagger-in > *:nth-child(6) { animation-delay: 320ms; }
.stagger-in > *:nth-child(n+7) { animation-delay: 380ms; }

/* Riduzione movimento per chi preferisce */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .stagger-in > * { opacity: 1 !important; transform: none !important; }
}

/* -------------------------------------------------------------------
   10. Sidebar logo: gradient arancione sottile sull'icona quando hover
   ------------------------------------------------------------------- */
aside .ms-fill {
  filter: drop-shadow(0 0 8px rgba(248, 153, 71, 0.35));
}

/* -------------------------------------------------------------------
   11. Empty state: più ricco, illustrazione monocromatica
   ------------------------------------------------------------------- */
.empty-state {
  position: relative;
  overflow: hidden; /* il glow ::before sborda di -20%: senza clip allarga la pagina (overflow orizzontale) */
}
.empty-state::before {
  content: "";
  position: absolute;
  inset: -10% -20%;
  background: radial-gradient(circle at center, rgba(248, 153, 71, 0.06), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* -------------------------------------------------------------------
   11b. Utility assenti da app.css (build Tailwind congelata al 2026-05-05;
   non c'è build step: le classi nuove vanno aggiunte qui a mano)
   ------------------------------------------------------------------- */
.opacity-80 { opacity: .8; }
.max-w-sm { max-width: 24rem; }
.max-w-2xl { max-width: 42rem; }
/* Griglia giorni/orari (setup wizard step 2 + impostazioni) e checkbox dei giorni */
.grid-cols-\[110px_50px_1fr_1fr\] { grid-template-columns: 110px 50px 1fr 1fr; }
.grid-cols-\[100px_60px_1fr_1fr\] { grid-template-columns: 100px 60px 1fr 1fr; }
@media (max-width: 480px) {
  .grid-cols-\[110px_50px_1fr_1fr\],
  .grid-cols-\[100px_60px_1fr_1fr\] { grid-template-columns: 84px 36px 1fr 1fr; }
}
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.accent-secondary-fixed { accent-color: rgb(248 153 71); }

/* -------------------------------------------------------------------
   11c. Overlay di transizione a fine setup wizard ("Termina e accedi")
   ------------------------------------------------------------------- */
.setup-done-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 24px;
  background: rgba(252, 249, 248, 0.96);
  backdrop-filter: blur(6px);
  animation: pt-fadeup 240ms ease-out;
  transition: opacity 400ms ease;
}
.setup-done-overlay.is-hidden { opacity: 0; pointer-events: none; }

/* Toast di conferma/errore (impostazioni & co.) — centrato in basso,
   sopra la bottom-nav su mobile */
.pt-toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 80; display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
  animation: pt-toast-in 220ms ease-out;
}
/* Keyframe dedicato: pt-fadeup anima `transform` e cancellerebbe il
   translateX(-50%) qui sopra, facendo entrare il toast fuori asse. */
@keyframes pt-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (min-width: 1024px) { .pt-toast { bottom: 32px; } }
.setup-done-overlay .setup-spinner {
  width: 44px; height: 44px; border-radius: 999px;
  border: 3px solid rgb(248 153 71);
  border-top-color: transparent;
  animation: pt-spin 800ms linear infinite;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------
   12. Avatar: subtle inner ring per dare profondità
   ------------------------------------------------------------------- */
.avatar {
  box-shadow: 0 0 0 1px rgba(28, 27, 27, 0.04) inset, 0 1px 2px rgba(28, 27, 27, 0.04);
}

/* -------------------------------------------------------------------
   13. Modali: backdrop con blur più pronunciato e fade
   ------------------------------------------------------------------- */
.modal-backdrop {
  animation: pt-fadeup 200ms ease-out;
  backdrop-filter: blur(8px) saturate(0.9);
}
.modal-card {
  animation: pt-modal-pop 320ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes pt-modal-pop {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------------------------------------------------------------------
   14. Inputs: focus glow arancione
   ------------------------------------------------------------------- */
.input-text:focus {
  box-shadow: 0 0 0 3px rgba(248, 153, 71, 0.25);
  border-color: #1b1c1c;
}

/* Un campo readonly non deve accendersi come se fosse modificabile: la
   regola sopra vive anche (con priorità, per ordine di caricamento) nel
   Tailwind congelato di app.css — serve l'attributo nel selettore per
   guadagnare la specificità e annullare bordo scuro + anello arancione. */
.input-text[readonly]:focus {
  box-shadow: none;
  border-color: rgb(196, 199, 199);
}

/* -------------------------------------------------------------------
   15. Scrollbar discreta (Webkit)
   ------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(28, 27, 27, 0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(28, 27, 27, 0.20); background-clip: padding-box; }

/* -------------------------------------------------------------------
   16. Selection accent
   ------------------------------------------------------------------- */
::selection { background: rgba(248, 153, 71, 0.55); color: #1b1c1c; }

/* ===================================================================
   AMPLIFICATIONS — effetti più pronunciati per essere subito visibili
   =================================================================== */

/* Lift card più marcato */
a > .card-surface:hover,
.card-surface[data-row]:hover,
.list-row-mobile:hover,
article.card-surface:hover {
  transform: translateY(-4px) !important;
  box-shadow:
    0 1px 0 rgba(28, 27, 27, 0.04),
    0 20px 40px -10px rgba(28, 27, 27, 0.16),
    0 6px 14px -6px rgba(28, 27, 27, 0.10) !important;
}

/* Bottoni: lift + scale leggero, shadow tinted PIÙ visibile */
.btn-primary:hover  { transform: translateY(-2px) scale(1.01) !important; box-shadow: 0 14px 28px -10px rgba(28,27,27,0.45) !important; }
.btn-secondary:hover{ transform: translateY(-2px) scale(1.01) !important; box-shadow: 0 14px 28px -10px rgba(248,153,71,0.65) !important; }

/* Card hero scura: glow arancione PIÙ acceso */
.card-hero-dark {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 28px 60px -20px rgba(248, 153, 71, 0.30),
    0 12px 24px -10px rgba(28, 27, 27, 0.40) !important;
}

/* Tab underline più spessa */
.tab::after { height: 3px !important; }

/* Bottom-nav active: cerchio dietro più grande/visibile */
.tab-item.tab-item-active::before {
  width: 44px !important; height: 44px !important;
  background: rgba(248, 153, 71, 0.28) !important;
  box-shadow: 0 0 0 3px rgba(248, 153, 71, 0.10);
}

/* Body grain leggermente più visibile */
body::before { opacity: 0.55 !important; }


/* ===================================================================
   Restyle B1 — sidebar collapse smooth + dashboard tweaks
   =================================================================== */

/* Sidebar transition smooth (var-driven) */
aside#sidebar {
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
aside#sidebar [data-only-expanded] {
  transition: opacity 180ms ease-out, transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Nav-item più solido: padding consistente e gap fisso */
aside#sidebar .nav-item {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  position: relative;
}
aside#sidebar .nav-item.nav-item-active {
  background: linear-gradient(90deg, rgba(248,153,71,0.18), rgba(248,153,71,0.04) 90%);
  color: #1b1c1c;
  font-weight: 700;
  border-right: 0;
}
aside#sidebar .nav-item.nav-item-active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: #db7a2a;
  border-radius: 0 3px 3px 0;
}

/* Stat-card dashboard: hover più espressivo */
[data-stats] a {
  text-decoration: none;
  border: 1px solid #e4e2e1;
  position: relative;
}
[data-stats] a:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(28,27,27,0.04),
    0 14px 30px -12px rgba(28,27,27,0.14),
    0 4px 10px -4px rgba(28,27,27,0.08);
  border-color: rgba(28,27,27,0.16);
}

/* ===================================================================
   Bottom-nav smart hide
   =================================================================== */
nav#bottom-nav {
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
nav#bottom-nav.nav-hidden {
  transform: translateY(110%);
}

/* ============================================================
   PWA iOS — safe-area insets per status bar trasparente.
   Su iOS standalone (apple-mobile-web-app-status-bar-style=
   black-translucent) il contenuto va sotto la status bar.
   Aggiungiamo padding al top bar mobile + main, e al bottom nav
   per home indicator iPhone (env(safe-area-inset-bottom)).
   ============================================================ */
.topbar-mobile {
  padding-top: env(safe-area-inset-top);
  height: calc(3.5rem + env(safe-area-inset-top)) !important;
}
@media (max-width: 1023.98px) {
  main#view {
    padding-top: calc(68px + env(safe-area-inset-top)) !important;
  }
}
/* Bottom nav: aggiungi safe-area anche a sinistra/destra (notch landscape) */
#bottom-nav {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: max(env(safe-area-inset-bottom), 4px);
}

/* -------------------------------------------------------------------
   Lista clienti: griglia adattiva sullo spazio reale (non sul viewport).
   Con sidebar aperta su iPad landscape i breakpoint Tailwind contavano
   il viewport intero -> 3 colonne schiacciate. auto-fill conta il
   contenitore: ogni card ha minimo 340px o va a capo.
   ------------------------------------------------------------------- */
.clienti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

/* -------------------------------------------------------------------
   18. Dashboard: hero "centro di comando" + timeline giornaliera
   ------------------------------------------------------------------- */

/* Glow arancione radiale: l'unico punto di colore forte della pagina */
.hero-glow {
  position: absolute;
  top: -140px; right: -100px;
  width: 440px; height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 153, 71, 0.20), transparent 65%);
  pointer-events: none;
}

/* Orario fantasma gigante: profondità senza aggiungere elementi */
.hero-watermark {
  position: absolute;
  right: -16px; bottom: -64px;
  font-family: Lexend, sans-serif;
  font-weight: 900;
  font-size: 220px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  user-select: none;
  font-feature-settings: "tnum";
}

/* L'orario È il hero: Lexend Black con alone arancione */
.hero-time {
  font-family: Lexend, sans-serif;
  font-weight: 900;
  font-size: clamp(44px, 4.5vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: #f89947;
  text-shadow: 0 0 36px rgba(248, 153, 71, 0.35);
  font-feature-settings: "tnum";
}

.hero-countdown {
  background: rgba(248, 153, 71, 0.12);
  color: #f89947;
  border: 1px solid rgba(248, 153, 71, 0.30);
}

/* Avatar sovrapposti nel hero: il bordo nero li stacca dal fondo scuro */
.hero-avatars { display: flex; }
.hero-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: Lexend, sans-serif;
  font-weight: 700; font-size: 13px;
  color: #1b1c1c;
  border: 2px solid #000;
  margin-left: -10px;
  position: relative;
}
.hero-avatar:first-child { margin-left: 0; }

/* --- Timeline giornaliera --- */
.timeline { position: relative; padding: 6px 0; }
/* Linea verticale continua; i nodi (position:relative) le passano sopra */
.timeline::before {
  content: "";
  position: absolute;
  left: 88px; top: 18px; bottom: 18px;
  width: 2px;
  background: rgba(28, 27, 27, 0.07);
}
.timeline-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  position: relative;
  border-radius: 14px;
  transition: background-color 180ms ease;
}
a.timeline-row:hover { background: rgba(28, 27, 27, 0.035); }
.timeline-ora { width: 52px; text-align: right; flex-shrink: 0; }
.timeline-node {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fcf9f8;
  border: 2px solid rgba(28, 27, 27, 0.25);
  flex-shrink: 0;
  position: relative;
}
/* Passato: nodo arancione con spunta, riga attenuata */
.timeline-row.is-past { opacity: 0.55; }
.timeline-row.is-past .timeline-node { background: #f89947; border-color: #f89947; }
.timeline-row.is-past .timeline-node::after {
  content: "\2713";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #1b1c1c;
}
/* In corso: nodo pulsante */
.timeline-row.is-now .timeline-node {
  background: #f89947; border-color: #f89947;
  box-shadow: 0 0 0 4px rgba(248, 153, 71, 0.25);
  animation: timeline-pulse 1.8s ease-in-out infinite;
}
@keyframes timeline-pulse {
  50% { box-shadow: 0 0 0 7px rgba(248, 153, 71, 0.12); }
}
/* Prossimo: evidenza arancione soft su tutta la riga */
.timeline-row.is-next { background: rgba(248, 153, 71, 0.08); }
.timeline-row.is-next .timeline-node {
  background: #1b1c1c; border-color: #f89947;
  box-shadow: 0 0 0 4px rgba(248, 153, 71, 0.18);
}
a.timeline-row.is-next:hover { background: rgba(248, 153, 71, 0.14); }
/* Indicatore "adesso": rosso calendario, taglia la giornata in due */
.timeline-now {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 16px;
  position: relative;
}
.timeline-now-label {
  font-family: Manrope, sans-serif;
  font-size: 11px; font-weight: 700;
  color: rgb(186 26 26);
  white-space: nowrap;
  width: 66px; text-align: right; flex-shrink: 0;
}
.timeline-now-line {
  flex: 1; height: 2px;
  background: rgba(186, 26, 26, 0.65);
  border-radius: 2px;
  position: relative;
}
.timeline-now-line::before {
  content: "";
  position: absolute;
  left: -3px; top: -2px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgb(186 26 26);
}

/* Numeri stat: Lexend Black, il dato domina la label */
.stat-num {
  font-family: Lexend, sans-serif;
  font-weight: 900;
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum";
}
.stat-num-sm {
  font-family: Lexend, sans-serif;
  font-weight: 900;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

/* -------------------------------------------------------------------
   19. Chat trainer↔cliente: stile WhatsApp
   Thread su fondo beige, bolle compatte con coda, orario e spunte dentro
   la bolla, chip giorno bianche, bande grigie per header e composer.
   Markup generato da js/views/_chat.js.
   ------------------------------------------------------------------- */

/* Thread: beige caldo con micro-pattern, come lo sfondo doodle di WhatsApp */
[data-msg-thread] {
  background-color: #efe9e1;
  background-image: radial-gradient(rgba(28, 27, 27, 0.045) 1px, transparent 1px);
  background-size: 16px 16px;
}

.chat-row {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
@media (min-width: 768px) {
  .chat-row { max-width: 65%; }
}
.chat-row-me    { align-self: flex-end;   align-items: flex-end; }
.chat-row-other { align-self: flex-start; align-items: flex-start; }
/* Dentro un gruppo i messaggi quasi si toccano (gap-xs del thread - 6px) */
.chat-row.is-grouped { margin-top: -6px; }

.chat-bubble {
  position: relative;
  padding: 6px 9px 8px 9px;
  font-family: Manrope, sans-serif;
  font-size: 14.5px;
  line-height: 1.4;
  border-radius: 8px;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(28, 27, 27, 0.10);
}
/* Anima solo l'ultima bolla: il re-render non fa saltare il thread */
[data-msg-thread] > .chat-row:last-child .chat-bubble {
  animation: chat-pop 200ms ease-out both;
}
@keyframes chat-pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Verde-arancione chiaro per i miei (palette PT al posto del verde WhatsApp) */
.chat-bubble-me    { background: #fbddc4; color: #1b1c1c; }
.chat-bubble-other { background: #ffffff; color: #1b1c1c; }

/* Coda in alto, solo sul primo messaggio del gruppo */
.chat-bubble-me:not(.is-cont) { border-top-right-radius: 0; }
.chat-bubble-me:not(.is-cont)::after {
  content: "";
  position: absolute;
  top: 0; right: -7px;
  border-top: 9px solid #fbddc4;
  border-right: 7px solid transparent;
}
.chat-bubble-other:not(.is-cont) { border-top-left-radius: 0; }
.chat-bubble-other:not(.is-cont)::before {
  content: "";
  position: absolute;
  top: 0; left: -7px;
  border-top: 9px solid #ffffff;
  border-left: 7px solid transparent;
}

/* Orario + spunte dentro la bolla, in basso a destra: il testo scorre attorno */
.chat-time {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 9px -2px -4px 10px;
  font-size: 10.5px;
  line-height: 1;
  color: rgba(28, 27, 27, 0.45);
  user-select: none;
}
.chat-tick { font-size: 14px !important; color: rgba(28, 27, 27, 0.35); }
.chat-tick.is-read { color: #53bdeb; }   /* azzurro "letto" alla WhatsApp */

/* Chip giorno: bianche con ombra leggera */
.chat-day { align-self: center; margin: 10px 0 6px; }
.chat-day span {
  font-family: Manrope, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(28, 27, 27, 0.50);
  background: #ffffff;
  box-shadow: 0 1px 1px rgba(28, 27, 27, 0.08);
  padding: 5px 12px;
  border-radius: 8px;
}

/* Header e composer: bande grigio caldo piatte, come WhatsApp */
.chat-header {
  background: #f4f1ec;
  border-bottom: none !important;
  /* respiro attorno ad avatar + nome (il pt-md/pb-sm del markup era stretto) */
  padding: 16px 20px !important;
}
.chat-footer {
  background: #f4f1ec;
  border-top: none !important;
}
.chat-footer [data-msg-input] {
  border-radius: 22px;
  background: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 1px rgba(28, 27, 27, 0.06);
}
/* Invio: cerchio arancione con icona scura (il "verde WhatsApp" della palette PT) */
.chat-footer [data-msg-send] {
  border-radius: 50%;
  width: 46px;
  height: 46px;
  min-height: 46px !important;
  padding: 0 !important;
  flex-shrink: 0;
  background: #f89947 !important;
  color: #1b1c1c !important;
}
.chat-footer [data-msg-send]:hover { background: #faa866 !important; }

/* Voce del dropdown notifiche messaggi (campanello trainer) — hover coerente con .nav-item */
.notif-item { border-radius: 12px; transition: background-color .15s ease; }
.notif-item:hover { background-color: rgb(246 243 242); }

/* ===================================================================
   12. Area cliente — tab-bar desktop come "segmented pills" con accento
   arancione, coerente col bottom-nav mobile (prima: underline nera → stacco
   netto desktop/mobile). Scoping su [data-area-tab] per non toccare le
   altre .tab (impostazioni/trainer). CSS-only: propaga su tutte le viste.
   =================================================================== */
[data-area-tab].tab {
  padding: 9px 15px !important;          /* prima 24px .25rem: barra troppo alta */
  border-radius: 999px;
  border-bottom-width: 0 !important;
  font-weight: 600;
  color: rgb(68 71 72);
}
[data-area-tab].tab::after { display: none !important; }   /* via underline: usiamo il fill pill */
[data-area-tab].tab:hover {
  background-color: rgb(243 236 231);
  color: rgb(27 28 28) !important;
  border-color: transparent !important;
}
[data-area-tab].tab.tab-active {
  background-color: rgb(105 43 0);       /* stesso arancione brand del mobile */
  color: #fcf9f8 !important;
  border-color: transparent !important;
  box-shadow: 0 4px 10px -4px rgba(105, 43, 0, 0.45);
}
/* Contenitore tab-bar: un filo più compatto e con inset da "segmented control" */
.card-surface:has(> [data-area-tab]) {
  padding: 6px !important;
  gap: 4px;
}
/* Nasconde la scrollbar orizzontale della tab-bar (resta scrollabile) */
.card-surface:has(> [data-area-tab])::-webkit-scrollbar { height: 0; }

/* ===================================================================
   13. Area cliente su DESKTOP: sidebar dedicata stile trainer.
   app.js aggiunge html.cliente-mode per il ruolo cliente.
   - #cliente-sidebar: nascosta di default, flex solo a lg+ in cliente-mode
   - la tab-bar orizzontale interna alle viste sparisce (la sostituisce la
     sidebar a lg+, la bottom-nav sotto lg) -> niente più elementi allineati
     a sinistra in alto
   - la campanella notifiche (trainer-only) è nascosta al cliente
   =================================================================== */
#cliente-sidebar { display: none; }
html.cliente-mode div:has(> .card-surface > [data-area-tab]) { display: none !important; }
html.cliente-mode [data-notif-bell] { display: none !important; }
@media (min-width: 1024px) {
  html.cliente-mode #cliente-sidebar { display: flex; }
}

/* ===================================================================
   14. Utility assenti in app.css (Tailwind congelato) usate dal redesign
   =================================================================== */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Icona "messaggi dal coach" nella topbar mobile: solo per il cliente
   (la topbar è già lg:hidden → appare solo su mobile/tablet). */
html.cliente-mode [data-cliente-notif] { display: flex !important; }

/* -------------------------------------------------------------------
   20. Nutrizione: chip giorni, pill macro, dropdown ricerca alimenti
   ------------------------------------------------------------------- */
.day-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(28, 27, 27, 0.12);
  font-family: Lexend, sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #1b1c1c;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.day-chip:hover { transform: translateY(-1px); }
.day-chip.is-active { background: #1b1c1c; color: #fcf9f8; border-color: #1b1c1c; }
.day-chip-kcal { font-family: Manrope, sans-serif; font-weight: 600; font-size: 10px; opacity: 0.55; }
.day-chip.is-active .day-chip-kcal { color: #f89947; opacity: 1; }

/* Sottotitolo generico del chip giorno: stessa resa di .day-chip-kcal ma con
   nome neutro — la scheda mensile ci mostra il nome dell'allenamento (o
   "riposo"), non le kcal. */
.day-chip-sub { font-family: Manrope, sans-serif; font-weight: 600; font-size: 10px; opacity: 0.55; }
.day-chip.is-active .day-chip-sub { color: #f89947; opacity: 1; }

/* Pill macro: P arancione-arancione, C ambra, G azzurro */
.macro {
  font-family: Manrope, sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.macro-p { background: rgba(248, 153, 71, 0.28); color: #5b2e0a; }
.macro-c { background: rgba(255, 193, 7, 0.20);  color: #8a6100; }
.macro-g { background: rgba(96, 165, 250, 0.20); color: #1e50a0; }

/* Dropdown ricerca alimento nell'editor dieta */
.alimento-dd {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 40;
  background: #fff;
  border: 1px solid rgba(28, 27, 27, 0.10);
  border-radius: 12px;
  box-shadow: 0 12px 28px -8px rgba(28, 27, 27, 0.18);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

/* -------------------------------------------------------------------
   21. Nutrizione: colori per categoria alimento + input titolo editor
   Ogni categoria ha un colore (var --cat): bordo sinistro sulle righe
   dieta, pallino nel catalogo, label tinta.
   ------------------------------------------------------------------- */
.cat-carne      { --cat: #e25c4c; }
.cat-pesce      { --cat: #4c9fe2; }
.cat-uova       { --cat: #f4b942; }
.cat-cereali    { --cat: #c98d4b; }
.cat-legumi     { --cat: #9b7fd4; }
.cat-verdura    { --cat: #58b368; }
.cat-frutta     { --cat: #f286a0; }
.cat-secca      { --cat: #a8793d; }
.cat-condimenti { --cat: #6b7280; }
.cat-altro      { --cat: #94a3b8; }

.cat-border {
  border-left: 4px solid var(--cat, #e4e2e1);
  border-radius: 2px;
}
.cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cat, #94a3b8);
  flex-shrink: 0;
}
.cat-text {
  color: var(--cat, inherit);
  font-weight: 700;
}

/* Nome dieta nell'editor: campo protagonista, non un input qualunque */
.input-title {
  font-family: Lexend, sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Stepper porzioni nell'editor dieta ("2 × 1 uovo" con − / +) */
.porz-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(28, 27, 27, 0.05);
  border-radius: 999px;
  padding: 2px 6px;
  font-family: Manrope, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}
.porz-step button {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(28, 27, 27, 0.15);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.porz-step button:hover { background: #1b1c1c; color: #fff; }

/* -------------------------------------------------------------------
   22. Cliente online: chip giorno "fatto" + overlay fine allenamento
   ------------------------------------------------------------------- */
.day-chip.is-done { border-color: #f89947; }
.day-chip.is-done .day-chip-sub { color: #8c4f1a; opacity: 1; font-weight: 700; }
.day-chip.is-active.is-done .day-chip-sub { color: #f89947; }

.festa-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 24px;
}
.festa-check {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: rgba(248, 153, 71, 0.22);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
  animation: festa-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.festa-check .material-symbols-outlined { font-size: 56px !important; color: #8c4f1a; }
@keyframes festa-pop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0);      opacity: 1; }
}
.festa-record {
  margin-top: 8px;
  background: rgba(248, 153, 71, 0.18);
  color: #5b2e0a;
  font-family: Manrope, sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 12px;
  text-align: center;
}

/* -------------------------------------------------------------------
   23. Storico sessioni (dettaglio cliente, lato coach): card-diario
   Mattonella data nera, numeri chiave nel riepilogo, serie come chip
   con il set più pesante evidenziato in arancione.
   ------------------------------------------------------------------- */
.sess-card { overflow: hidden; }
.sess-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.sess-summary::-webkit-details-marker { display: none; }
.sess-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: #1b1c1c;
  color: #fcf9f8;
  flex-shrink: 0;
}
.sess-data-g { font-family: Lexend, sans-serif; font-weight: 900; font-size: 20px; line-height: 1.1; }
.sess-data-m { font-family: Manrope, sans-serif; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #f89947; }
.sess-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sess-stats { display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-left: auto; }
.sess-stat { font-family: Manrope, sans-serif; font-size: 11px; color: #777; white-space: nowrap; }
.sess-stat b { font-family: Lexend, sans-serif; font-weight: 800; font-size: 16px; color: #1b1c1c; }
.sess-chevron { transition: transform 220ms cubic-bezier(0.34, 1.4, 0.64, 1); color: #999; }
details[open] .sess-chevron { transform: rotate(180deg); }
.sess-body { padding: 4px 16px 14px; border-top: 1px solid rgba(28, 27, 27, 0.06); }
.sess-ex {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(28, 27, 27, 0.08);
  flex-wrap: wrap;
}
.sess-ex:last-child { border-bottom: none; }
.sess-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sess-ex-nome { font-family: Manrope, sans-serif; font-weight: 700; font-size: 13.5px; color: #1b1c1c; flex: 1; min-width: 120px; }
.sess-sets { display: flex; gap: 5px; flex-wrap: wrap; }
.sess-set {
  font-family: Manrope, sans-serif;
  font-weight: 700;
  font-size: 12px;
  font-feature-settings: "tnum";
  background: rgba(28, 27, 27, 0.05);
  border-radius: 8px;
  padding: 3px 8px;
  color: #333;
  white-space: nowrap;
}
.sess-set span { opacity: 0.4; padding: 0 1px; }
.sess-set i { font-style: normal; font-weight: 600; font-size: 9.5px; opacity: 0.55; padding-left: 1px; }
.sess-set.is-best { background: rgba(248, 153, 71, 0.32); color: #5b2e0a; }

/* Freccia di tendenza carichi nello storico sessioni */
.sess-trend {
  font-family: Manrope, sans-serif;
  font-weight: 800;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: 1px;
}
.sess-trend.up   { background: rgba(248, 153, 71, 0.30); color: #5b2e0a; }
.sess-trend.down { background: rgba(186, 26, 26, 0.10);  color: #a33333; }
.sess-trend.flat { background: rgba(28, 27, 27, 0.05);   color: #888; }

/* -------------------------------------------------------------------
   24. Selettore modello abbonamento (Nuovo Cliente + modal Rinnovo)
   ------------------------------------------------------------------- */
.abb-modo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(28, 27, 27, 0.12);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.abb-modo .material-symbols-outlined { font-size: 22px; color: #777; }
.abb-modo-t { font-family: Lexend, sans-serif; font-weight: 700; font-size: 13px; color: #1b1c1c; line-height: 1.2; }
.abb-modo-s { font-family: Manrope, sans-serif; font-size: 10.5px; color: #888; line-height: 1.2; }
.abb-modo:hover { border-color: rgba(28, 27, 27, 0.35); transform: translateY(-1px); }
.abb-modo.is-active { border-color: #1b1c1c; background: rgba(248, 153, 71, 0.12); }
.abb-modo.is-active .material-symbols-outlined { color: #1b1c1c; }

/* -------------------------------------------------------------------
   25. Mobile: editor dieta più comodo su schermi stretti
   ------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* chip dei giorni sempre a portata durante lo scroll (sotto la topbar) */
  .day-chips {
    position: sticky;
    top: 56px;
    z-index: 25;
    background: #fcf9f8;
    padding-top: 6px;
    padding-bottom: 6px;
    margin-top: -6px;
  }
  .day-chip { padding: 6px 10px; font-size: 12px; }
  .day-chip-kcal { font-size: 9px; }
  .macro { font-size: 10px; padding: 2px 6px; }
}

/* -------------------------------------------------------------------
   26. Area cliente — banner stato documenti nel Profilo
   Card d'avviso con testo che va a capo: le vecchie pillole con
   nowrap sbordavano dallo schermo su mobile.
   ------------------------------------------------------------------- */
.avviso-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.35;
}
.avviso-doc .material-symbols-outlined { flex-shrink: 0; font-size: 22px; }
.avviso-doc--warn { background: #fdf0d3; color: #5f4a00; border: 1px solid #e8d59a; }
.avviso-doc--ok   { background: #f6ead7; color: #43290b; border: 1px solid #e3c9a8; }
.avviso-doc--err  { background: #ffdad6; color: #93000a; border: 1px solid #f3b6b0; }

/* -------------------------------------------------------------------
   27. Sistema di aiuto: icona ⓘ inline + popover
   ------------------------------------------------------------------- */
.help-i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 4px; vertical-align: middle;
  border-radius: 999px; color: #6b7280; background: rgba(120,120,120,.12);
  cursor: help; flex-shrink: 0; transition: color .15s ease, background .15s ease;
}
.help-i:hover { color: #1b1c1c; background: rgba(248,153,71,.35); }
.help-pop {
  position: fixed; z-index: 70; width: 260px; max-width: calc(100vw - 24px);
  background: #12141c; color: #fff; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.28); animation: pt-fadeup 160ms ease-out;
}
.help-pop-t { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.help-pop-b { font-size: 12.5px; line-height: 1.45; opacity: .9; }

/* -------------------------------------------------------------------
   Utility `underline`: Tailwind ce l'ha, ma la build e' congelata dal
   2026-05-05 e la classe non e' finita in app.css. Risultato: 26 usi in
   giro per l'app — compresi i rimandi fra informativa, cookie policy e
   termini — dove il link sembrava testo normale. Una riga, e tornano link.
   ------------------------------------------------------------------- */
.underline { text-decoration-line: underline; }

/* -------------------------------------------------------------------
   Cliente senza scheda mensile: la voce "La mia scheda" sparisce da
   tutti e tre i posti in cui compare (barra laterale, foglio "Altro",
   barra a schede dentro le pagine). Serve una regola di documento e non
   uno style inline: la barra a schede sta nei partial e viene ridisegnata
   a ogni cambio vista, quindi qualunque modifica puntuale verrebbe persa.
   L'allenamento della singola seduta si apre dagli appuntamenti.
   ------------------------------------------------------------------- */
html.senza-scheda-mensile a[href="#/area-cliente/scheda"] { display: none !important; }
