:root {
  --hour-height: 80px; /* deve corrispondere a HOUR_HEIGHT nel JS */
  --calendar-header-height: 116px; /* altezza header colonne + ase oraria */
  --bg: #f3f4ff;
  --card-bg: #ffffff;
  --primary: #6366f1;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --border: #d1d5db;
  --text-main: #111827;
  --text-soft: #6b7280;
}

/* RESET BASE */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

button {
  font-family: inherit;
}

/* APP LAYOUT */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP BAR */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 12px;
  background: #ffffff; /* bianco pieno */
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-wrap {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.top-bar-date-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;   /* aggiungi questa riga */
}

/* BOTTONI GENERALI */

.btn-pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  line-height: 1;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    color 0.12s ease;
}

.btn-pill:hover {
  background: #f9fafb;
  border-color: #cbd5f5;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.btn-muted {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #374151;
}

.btn-muted:hover {
  background: #eef2ff;
  border-color: #cbd5f5;
}

.btn-icon-circle {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  width: 40px;      /* più grande */
  height: 40px;     /* più grande */
  font-size: 1.2rem;/* icona più grande */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.btn-icon-circle:hover {
  background: #eef2ff;
  border-color: #cbd5f5;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.btn-primary {
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 22px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* niente glow gigante */
  box-shadow: none;
  transition:
    background 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.08s ease;
}

.btn-primary:hover {
  background: #4f46e5;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  padding: 7px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.btn:hover {
  background: #f9fafb;
  border-color: #cbd5f5;
}

.btn-danger {
  border-color: #f97373;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

.btn-block {
  width: 100%;
}

/* PULSANTE "OGGI" */

#todayBtn {
  min-width: 70px;
  justify-content: center;
}

/* PILLOLA DATA - Layout simmetrico come design target */
/* PILLOLA DATA - Design esatto */
.date-shell {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 0;
  overflow: visible;
}

.date-shell-arrow {
  background: transparent;
  border: none;
  color: #111827;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.date-shell-arrow:first-child {
  border-right: none;
}

.date-shell-arrow:last-child {
  border-left: none;
}

.date-shell-arrow:hover {
  background: #f9fafb;
}

.date-shell-main {
  background: transparent;
  border: none;
  color: #111827;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  min-width: 100px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.date-shell-main:hover {
  background: transparent;
}


/* ma testo chiaro su sfondo scuro non ti piaceva?
   Se lo vuoi chiaro con sfondo bianco basta cambiare:
   background e color della .date-shell sopra.
*/

/* nascondo del tutto la freccia verso il basso */
.date-trigger-icon {
  display: none;
}

/* input data nativo nascosto */
.date-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* LAYOUT PRINCIPALE */

.layout {
  padding: 16px 24px 24px;
}

.card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}

.card-title-row h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* CALENDARIO */

.calendar-wrapper {
  position: relative;       /* <— aggiunto */
  overflow-x: auto;
  padding-bottom: 6px;
}



.calendar {
  display: flex;
  width: 100%;
  overflow-x: auto;
}

/* Asse orario */

.time-axis {
  width: 70px;
  background: #f3f4f6;
  border-right: 1px solid #e5e7eb;
  padding-top: var(--calendar-header-height); /* stessa altezza delle colonne */
}


.time-slot-label {
  height: var(--hour-height);
  font-size: 0.72rem;
  color: var(--text-soft);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 10px 0 4px;
}

/* COLONNE (riempiono tutta la larghezza, niente pannello vuoto a destra) */

.calendar-columns {
  flex: 1;
  display: flex;
  position: relative;
}

.calendar-column {
  flex: 1 1 0;
  min-width: 220px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* HEADER COLONNA */

.column-header {
  position: relative;
  z-index: 20;       
  border-bottom: 1px solid e5e7eb;
  background: f9fafb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  gap: 8px;
  min-height: var(--calendar-header-height);
}

.employee-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--color-surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  border: 3px solid;
  border-color: var(--avatar-color, #6366f1);
  flex-shrink: 0;
  box-shadow: none;
  margin: 0;
}

/* Riga nome + freccia sotto l'avatar */
.employee-name-row {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;   /* centra il contenuto sotto l’avatar */
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  position: relative;        /* per posizionare la freccia */
}

.employee-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;        /* nome centrato */
}

.employee-menu-arrow {
  font-size: 0.7rem;
  color: var(--text-soft);
  opacity: 0;
  transform: translateY(1px);
  transition: opacity 0.12s ease;
  position: absolute;        /* NON influisce più sul centraggio del testo */
  right: -10px;              /* spostata leggermente a destra del nome */
}

.column-header:hover .employee-menu-arrow {
  opacity: 1;
}


/* Mini‑menu con una sola opzione */
.employee-actions-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;

  background: #ffffff;              /* ← bianco */
  color: var(--text-main);          /* testo scuro */
  border-radius: 8px;
  border: 1px solid #e5e7eb;        /* leggero bordo grigio */
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);

  padding: 6px 0;
  min-width: 230px;
  display: none;
  z-index: 110;
}

.employee-action-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 9px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-main);
}

.employee-action-item:hover {
  background: #f3f4f6;              /* hover chiaro */
}


.employee-actions-menu.visible {
  display: block;
}

.employee-actions-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;                        /* ← centro orizzontale */
  transform: translateX(-50%);      /* ← allinea davvero al centro */

  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #ffffff; /* stesso bianco del menu */
}

.employee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.employee-name {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

.employee-role {
  display: none;  ← NASCONDI IL RUOLO
}

.column-body {
  position: relative;
  background: #ffffff;
}

/* linee 15 minuti */

.hour-line {
  width: 100%;
  border-top: 1px solid #e5e7eb;   /* linea continua */
}

.hour-line.major {
  border-top-width: 1px;           /* opzionale: puoi metterla a 2px se vuoi evidenziare l’ora */
  border-top-style: solid;
}


/* Riga evidenziata (hover) */

.hover-row {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(129, 140, 248, 0.12);
  border-top: 1px solid rgba(129, 140, 248, 0.6);
  border-bottom: 1px solid rgba(129, 140, 248, 0.6);
  pointer-events: none;
  display: none;
  z-index: 5;
}

/* orario visualizzato dentro la riga */

.hover-time-indicator {
  position: fixed;
  z-index: 70;
  font-size: 0.75rem;
  color: #4f46e5;
  background: transparent;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.08s ease;
}

.hover-time-indicator.visible {
  opacity: 1;
}

/* =============================
   APPUNTAMENTI
   ============================= */

/* Contenitore posizionato dal JS: NON si muove */
.appointment-block {
  position: absolute;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  z-index: 10;
  background: transparent;
}

/* Card visibile dell'appuntamento */
.appointment-inner {
  height: 100%;
  width: 100%;                         /* parte da tutta la larghezza */
  border-radius: 12px;
  position: relative;
  background: var(--appt-color-bg);
  padding: 6px 10px;
  border-left: 4px solid var(--appt-color, #6366f1); /* bordino sinistro fisso */
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;

  /* transizioni per highlight + effetto porta */
  transition:
    box-shadow 0.12s ease,
    width 0.12s ease;
}

/* Bordi accesi su qualsiasi blocco */
.appointment-block:hover .appointment-inner {
  box-shadow: 0 0 0 2px var(--appt-color, #6366f1);
}

/* SOLO il blocco più a destra (classe messa dal JS):
   effetto porta → si accorcia da destra,
   spostando davvero il lato destro del blocco verso sinistra */
.appointment-block.appointment-hovered:hover .appointment-inner {
  width: calc(100% - 14px);  /* prova 10–16px finché ti piace */
}

/* Testi dentro al blocco */
.appt-time {
  font-size: 0.75rem;
  font-weight: 600;
}

.appt-client {
  font-size: 0.8rem;
  font-weight: 600;
}

.appt-service {
  font-size: 0.74rem;
  color: #4b5563;
}

/* Maniglia per allungare/accorciare l'appuntamento */
.appt-resize-handle {
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 26px;
  height: 5px;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.7);
  cursor: ns-resize;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.appointment-block:hover .appt-resize-handle,
.appointment-block.resizing .appt-resize-handle {
  opacity: 1;
}

.appointment-block.resizing {
  z-index: 20;
}




/* TOOLTIP BLOCCO */

.tooltip {
  position: fixed;
  z-index: 80;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  min-width: 280px;
  max-width: 320px;
  font-size: 0.8rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
  overflow: hidden;
}

.tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tooltip-header {
  padding: 10px 14px;
  border-radius: 12px 12px 0 0;
  background: var(--tooltip-color, #6366f1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  gap: 8px;
}

.tooltip-header-time {
  flex: 1;
}

.tooltip-phone {
  font-size: 0.78rem;
  color: #111827;
  margin-bottom: 3px;
}

.tooltip-phone strong {
  font-weight: 800;
}


.tooltip-header-status {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.tooltip-main {
  display: flex;
  padding: 14px;
  background: #ffffff;
  gap: 12px;
  border-top: 1px solid #f3f4f6;
}

.tooltip-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid;
  border-color: var(--tooltip-color, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  background: rgba(var(--tooltip-color-rgb, 99, 102, 241), 0.1);
  flex-shrink: 0;
}

.tooltip-info {
  flex: 1;
}

.tooltip-client {
  font-weight: 700;
  font-size: 0.85rem;
  color: #111827;
  margin-bottom: 4px;
}

.tooltip-service {
  color: #6b7280;
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.tooltip-extra {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* LINEA ORARIO ATTUALE */

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid #ef4444;
  z-index: 18;               /* sopra righe/appuntamenti, sotto header */
  pointer-events: none;
}

/* Badge con l'ora attuale sulla sinistra */
.now-time-indicator {
  position: absolute;       /* <— NON più fixed */
  z-index: 19;               /* sopra la linea, sotto l’header/top-bar */
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 2px solid #ef4444;
  background: #ffffff;
  color: #ef4444;
  box-shadow: 0 6px 16px rgba(248, 113, 113, 0.35);
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.now-time-indicator.visible {
  opacity: 1;
}



/* OVERLAY DESTRO (NUOVO/MODIFICA APPUNTAMENTO) */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 90;
}

.overlay.open {
  display: block;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

/* ===== FIX: OVERLAY PANEL DEVE ESSERE FIXED ===== */
.overlay-panel {
  position: fixed;  /* ← CAMBIATO da absolute a fixed */
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: #f9fafb;
  padding: 18px 18px 18px;
  box-shadow: -22px 0 40px rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 100; /* ← Aumenta il z-index per i picker */
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.overlay-header h2 {
  font-size: 1.25rem;
  margin: 0;
}

.overlay-close-btn {
  border-radius: 999px;
  border: none;
  width: 28px;
  height: 28px;
  background: rgba(31, 41, 55, 0.92);
  color: #f9fafb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.overlay-close-btn:hover {
  background: rgba(55, 65, 81, 1);
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* FORM OVERLAY */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.field-row .field {
  flex: 1;
}

.field-group label {
  font-size: 0.75rem;
  color: #4b5563;
}

.field-group input,
.field-group select,
.field-group textarea {
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 7px 9px;
  font-size: 0.8rem;
  outline: none;
  background: #ffffff;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.4);
}

.field-group textarea {
  resize: vertical;
  min-height: 70px;
}

.small {
  font-size: 0.7rem;
}

.muted {
  color: #6b7280;
}

.section-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 8px 0;
}

.edit-info {
  display: none;
}

.edit-info-row {
  display: flex;
  gap: 8px;
}

/* CALENDARIO GRANDE (DATA OVERLAY) */

/* Calendario grande stile Fresha (chiaro, sotto il pulsante data) */
.date-overlay {
  position: absolute;    /* segue lo scroll della pagina */
  top: 0;
  left: 0;
  display: none;
  z-index: 80;
}

.date-overlay.visible {
  display: block;
}

/* niente backdrop scuro */
.date-overlay-backdrop {
  display: none;
}


.date-overlay-panel {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.4);
  padding: 18px 20px 14px;
  min-width: 720px;
  max-width: 840px;
} 


.date-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.date-overlay-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.date-overlay-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.date-month-title {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.date-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: lowercase;
  margin-bottom: 4px;
}

.date-weekdays span {
  text-align: center;
}

.date-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  font-size: 0.75rem;
}

.date-day {
  border-radius: 999px;
  border: none;
  padding: 6px 0;
  background: transparent;
  cursor: pointer;
  color: #111827;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.date-day:hover {
  background: #eef2ff;
}

.date-day.today {
  border: 1px solid #c4b5fd;
}

.date-day.selected {
  background: #4f46e5;
  color: #ffffff;
}

.date-day.empty {
  cursor: default;
}

.date-overlay-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

/* SCROLLBAR CALENDARIO */

.calendar::-webkit-scrollbar {
  height: 8px;
}

.calendar::-webkit-scrollbar-track {
  background: #e5e7eb;
}

.calendar::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 999px;
}

/* === DRAG & DROP PRENOTAZIONI === */

.appointment-block.dragging {
  opacity: 0.8;
  z-index: 999; /* sopra a tutto */
  pointer-events: none;
  transition: none;
}

.drop-highlight {
  outline: 2px dashed #6366f1;
  outline-offset: -2px;
}

/* DIO */

/* ===========================
   DRAG & DROP CSS UPDATES
   =========================== */

/* Blocco mentre viene trascinato */
.appointment-block.dragging {
  opacity: 0.85;
  z-index: 999 !important;
  pointer-events: none;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.4);
  
  /* Effetto di "sollevamento" */
  transform: scale(1.02);
  transition: none;
}

.appointment-block.dragging .appointment-inner {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

/* Highlight colonna destinazione */
.calendar-column.drop-highlight {
  background: linear-gradient(
    to right,
    rgba(99, 102, 241, 0.08),
    rgba(99, 102, 241, 0.04)
  );
  
  /* Bordo sottile sulla sinistra */
  border-left: 3px solid rgba(99, 102, 241, 0.4);
  
  /* Animazione pulse */
  animation: drop-pulse 1.2s ease-in-out infinite;
}

@keyframes drop-pulse {
  0%, 100% {
    opacity: 1;
    border-left-color: rgba(99, 102, 241, 0.4);
  }
  50% {
    opacity: 0.8;
    border-left-color: rgba(99, 102, 241, 0.7);
  }
}

/* Transizione smooth quando il blocco ritorna alla posizione */
.appointment-block {
  transition:
    left 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.2s ease,
    opacity 0.15s ease;
}

/* Quando due blocchi si sovrappongono - affiancamento */
.appointment-block[data-lane-index="1"] {
  animation: slide-in-from-left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.appointment-block[data-lane-index="2"] {
  animation: slide-in-from-left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.appointment-block[data-lane-index="3"] {
  animation: slide-in-from-left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slide-in-from-left {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Effetto "successo" quando rilasciato in nuova posizione */
@keyframes drop-success {
  0% {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

/* Applica l'animazione di successo */
.appointment-block.drop-success {
  animation: drop-success 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Linea di rilascio (drop zone preview) */
.drop-zone-preview {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(99, 102, 241, 0.6),
    transparent
  );
  border-radius: 2px;
  pointer-events: none;
  z-index: 8;
  animation: pulse-line 0.6s ease-in-out infinite;
}

@keyframes pulse-line {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* ===== MENU LATERALE ===== */

.btn-menu-toggle {
  font-size: 1.2rem;
}

.side-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 75;
}

.side-menu-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 70px;
  height: 100vh;
  background: #ffffff;
  color: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  box-shadow: 6px 0 18px rgba(15, 23, 42, 0.45);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 80;
}

.side-menu.open {
  transform: translateX(0);
}

/* Contenitore icone nel menu */
.side-menu-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 40px;
  align-items: center;   /* centra i bottoni */
}

/* Bottone base */
.side-menu-item {
  width: 46px;           /* "grandezza" del selettore */
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, transform 0.1s ease;
  border-radius: 999px;  /* pill in hover */
  position: relative;      /* IMPORTANTE per la nuvoletta */
}

/* Nuvoletta tooltip a destra del menu */
.side-menu-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  color: #111827;
  padding: 6px 14px;        /* più grande */
  border-radius: 999px;
  font-size: 0.8rem;        /* leggermente più grande */
  font-weight: 600;         /* grassetto */
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
}


/* piccolo “triangolino” che punta al bottone */
.side-menu-item::before {
  content: "";
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #ffffff transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 99;
}

/* Mostra nuvoletta su hover/focus */
.side-menu-item:hover::after,
.side-menu-item:focus-visible::after {
  opacity: 1;
  transform: translate(4px, -50%);
}

.side-menu-item:hover::before,
.side-menu-item:focus-visible::before {
  opacity: 1;
}


.side-menu-item:hover:not(.side-menu-item-active) {
  background: rgba(148, 163, 184, 0.15);
}

/* Icona PNG */
.side-menu-icon {
  width: 26px;
  height: 26px;
  display: block;
}

/* Stato selezionato: viola più "grande" e arrotondato tipo Fresha */
.side-menu-item-active {
  background: var(--primary);
  border-radius: 16px;   /* meno estrema di 999px = rettangolo arrotondato */
}

.side-menu-item-active .side-menu-icon {
  filter: brightness(10); /* rende l'icona bianca se necessario */
}

.side-menu-item-active .side-menu-icon {
  filter: brightness(10); /* rende l'icona “bianca” se è chiara su trasparente */
}

/* === PAGINA SERVIZI =================================================== */

.services-card {
  margin-top: 16px;
}

/* Layout a due colonne: categorie a sinistra, elenco servizi a destra */
.services-layout {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

/* Colonna categorie */
.services-categories {
  width: 260px;
  background: #f9fafb;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

.services-categories h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

#servicesCategoryList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.services-category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.12s ease, color 0.12s ease;
}

.services-category-item:hover {
  background: #e5e7eb;
}

.services-category-item.active {
  background: #4f46e5;
  color: #ffffff;
}

.services-category-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.services-category-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.services-category-count {
  opacity: 0.8;
  font-size: 0.8rem;
}


/* Colonna principale (lista servizi) */
.services-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Barra di ricerca sopra la lista */
.services-toolbar {
  display: flex;
  justify-content: flex-start;
}

.services-toolbar .input {
  max-width: 320px;
}

/* Lista servizi raggruppata per categoria */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 28px;              /* più spazio tra categorie */
}

/* Titolo categoria sopra le card */
.services-category-section > h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
}

.services-category-section {
  display: flex;
  flex-direction: column;
  gap: 12px;              /* spazio tra card della stessa categoria */
}

/* Card singolo servizio (stile Fresha chiaro) */
.service-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  border-left: 4px solid var(--cat-color, #ec4899);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 520px;
  margin-bottom: 4px;
}

/* Nome + durata + descrizione */
.service-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.service-meta {
  font-size: 0.80rem;
  color: var(--text-soft);
}

.service-desc {
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Azioni in alto a destra (Importa / Nuovo servizio) */
.services-actions {
  display: flex;
  gap: 8px;
}

/* Centro il contenuto solo sulla pagina servizi */
.layout-services {
  max-width: 1180px;
  margin: 0 auto;
}


/* === CLIENTI === */

.clients-card {
  margin-top: 24px;
}

.clients-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.clients-toolbar {
  margin-top: 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.clients-search .input {
  width: 260px;
  max-width: 100%;
}

.clients-table-wrapper {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.clients-table thead {
  background-color: #f9fafb;
}

.clients-table th,
.clients-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.clients-table tbody tr:hover {
  background-color: #f3f4f6;
}

.clients-table td:first-child,
.clients-table th:first-child {
  text-align: center;
}

.clients-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.clients-page-buttons {
  display: flex;
  gap: 8px;
}

.client-details-panel {
  max-width: 520px;
}

.client-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent);
}

.client-header-info h2 {
  margin: 0;
  font-size: 1.1rem;
}

.client-header-sub {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.client-details-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.client-details-list {
  margin: 0;
  padding: 0;
}

.client-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.client-detail-row dt {
  font-weight: 500;
  color: var(--text-soft);
}

.client-detail-row dd {
  margin: 0;
  text-align: right;
}

.client-appointments-list {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Contenitore per ogni mese: label + timeline */
.client-month-group {
  position: relative;
  padding-left: 48px; /* un po' più spazio per pallino + linea */
  margin-bottom: 4px;
}

/* Linea verticale della timeline */
.client-month-group::before {
  content: "";
  position: absolute;
  left: 22px;           /* stessa x del centro del pallino */
  top: 24px;            /* parte subito sotto il pallino (h=24) */
  bottom: 0;
  width: 2px;
  background: var(--border);
}

/* Pallino con icona calendario in alto */
.client-month-bullet {
  position: absolute;
  left: 22px;           /* centro sulla stessa x della linea */
  top: 0;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.client-month-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}


/* Nome del mese (tipo “giugno”, “novembre 2025”) */
.client-month-title {
  font-size: 0.8rem;
  text-transform: lowercase;
  color: var(--text-soft);
  margin-bottom: 8px;
}

/* Card singolo appuntamento in stile Fresha */
.client-appt-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

/* Header card: titolo + badge stato */
.client-appt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.client-appt-title {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Riga con data, ora, centro */
.client-appt-time-row {
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Riga con trattamento e operatrice */
.client-appt-meta {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 4px;
}

/* Badge stato come nello screen (verde prenotato / rosso annullato) */
.client-appt-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.client-appt-status.booked {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.client-appt-status.cancelled {
  background: rgba(239, 68, 68, 0.16);
  color: #dc2626;
}

/* Colonna nome cliente: avatar + testo */
.clients-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cerchio con iniziale */
.client-avatar-table {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12); /* viola chiaro */
  color: #312e81;                        /* viola scuro */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Testo del nome accanto all'avatar */
.client-name-text {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Avatar grande con iniziale nel pannello dettagli */
.client-avatar-details {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12); /* viola chiaro */
  color: #312e81;                        /* viola scuro */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Nome cliente accanto all'avatar */
.client-details-name {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Pannello selezione cliente (stesso stile overlay destro) */
.client-picker-panel {
  width: 360px;
  max-width: 90vw;
}

/* Corpo del pannello */
.client-picker-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Barra di ricerca */
.client-picker-search .input {
  width: 100%;
}

/* Lista clienti */
.client-picker-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

/* Riga singolo cliente */
.client-picker-item {
  width: 100%;
  border: none;
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.client-picker-item:hover {
  background: #f3f4f6;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

/* Avatar + testi, riuso del cerchio che hai in tabella */
.client-picker-item .client-avatar-table {
  flex-shrink: 0;
}

.client-picker-texts {
  display: flex;
  flex-direction: column;
}

.client-picker-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.client-picker-phone {
  font-size: 0.78rem;
  color: #6b7280;
}

/* ===== PICKER CLIENTE E SERVIZI: posizionati a SINISTRA ===== */
#clientPickerOverlay .overlay-panel,
#servicePickerOverlay .overlay-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 360px; /* ← Ora funziona perché position: fixed */
  width: 360px;
  z-index: 101; /* ← Sopra il booking overlay ma coordinate fisse */
}

/* Backdro p nascosto per picker (usano il backdrop del booking overlay) */
#clientPickerOverlay .overlay-backdrop,
#servicePickerOverlay .overlay-backdrop {
  display: none;
}

/* Overlay laterali generici (clienti, servizi, calendario grande, ecc.) */
.side-overlay {

  position: fixed;
  inset: 0;
  display: none;
  z-index: 90;
}

.side-overlay.visible {
  /*pointer-events: auto;
  opacity: 1;*/
  display: block;
}

.side-overlay .overlay-backdrop {
  flex: 1;
  background: rgba(15, 23, 42, 0.35);
}

.side-overlay .overlay-panel {
  width: 360px;
  max-width: 90vw;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

/* Card per tipo fascia bloccata */
.blocked-type-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.blocked-type-card {
  background: #111827;
  color: #f9fafb;
  border-radius: 10px;
  border: 1px solid #4b5563;
  padding: 10px 10px 8px;
  text-align: left;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.blocked-type-card.selected {
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.7);
  background: #020617;
}

.blocked-type-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.blocked-type-sub {
  font-size: 0.7rem;
  color: #9ca3af;
}

.blocked-inner {
  background: #e5e7eb;
  border: 1px dashed #9ca3af;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.25;
  color: #374151;

  /* nuovo: riempi tutta l’altezza del blocco */
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}


.blocked-time {
  font-weight: 600;
  margin-bottom: 2px;
}

.blocked-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blocked-block:hover .blocked-inner {
  background: #d1d5db;
}

/* blocchi appuntamento e blocchi bloccati */
.booking-block {
  position: absolute;
  z-index: 10;
}

.blocked-block {
  position: absolute;
  z-index: 15;      /* sopra le linee orarie, sotto la linea rossa */
  pointer-events: auto;
}

.time-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 0.85rem;
  color: #111827;
  outline: none;
  cursor: pointer;
}

.time-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
}
/* Quando un gruppo è anche una row, metti i campi in orizzontale */
.field-group.field-row {
  flex-direction: row;
  align-items: flex-end; /* opzionale: allinea le select sulla stessa linea */
  gap: 10px;
}

.field-group.field-row .field {
  flex: 1;
}

.appt-head-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.appt-time {
  white-space: nowrap;
  flex: 0 0 auto;
}

.appt-client {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icona note in alto a destra del blocco */
.appt-head-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

/* icona piccola nell’angolo */
.appt-note-icon {
  margin-left: auto;          /* spinge l’icona tutto a destra */
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.9;
}

/* ===== MODAL "NUOVO CLIENTE" (centrata) ===== */
#clientCreateOverlay .client-create-panel{
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: min(720px, 92vw);
  max-width: 92vw;
  height: auto;
  max-height: 86vh;
  border-radius: 18px;
  background: #f9fafb;
  padding: 18px;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.35);
}

/* Il body deve scrollare dentro la modal (non la pagina) */
#clientCreateOverlay .overlay-body{
  overflow-y: auto;
  max-height: calc(86vh - 70px); /* circa: altezza header */
}

/* Header: titolo centrato, X a destra */
#clientCreateOverlay .overlay-header{
  position: relative;
  justify-content: center;
  padding-right: 36px; /* spazio per la X */
}

#clientCreateOverlay .overlay-header h2{
  flex: 1;
  text-align: center;
}

#clientCreateOverlay #clientCreateCloseBtn{
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* ===== MODAL "NUOVO SERVIZIO" (centrata) ===== */
#serviceCreateOverlay .service-create-panel{
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: min(720px, 92vw);
  max-width: 92vw;
  height: auto;
  max-height: none;
  border-radius: 18px;
  background: #f9fafb;
  padding: 18px;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.35);
}

#serviceCreateOverlay .overlay-body{
  overflow: visible;
  max-height: none;
}

#serviceCreateOverlay .overlay-header{
  position: relative;
  justify-content: center;
  padding-right: 36px;
}

#serviceCreateOverlay .overlay-header h2{
  flex: 1;
  text-align: center;
}

#serviceCreateOverlay #serviceCreateCloseBtn{
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Dropdown categoria (Nuovo Servizio) */
#serviceCreateOverlay .category-select{
  position: relative;
}

#serviceCreateOverlay .category-select-btn{
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 9px 10px;
  font-size: 0.85rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

#serviceCreateOverlay .category-select-placeholder{
  color: #6b7280;
}

#serviceCreateOverlay .category-select-btn.has-value .category-select-placeholder{
  color: #111827;
}

#serviceCreateOverlay .category-select-menu{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: none;
  overflow: visible;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
  padding: 8px;
  display: none;
  z-index: 200;
}

#serviceCreateOverlay .category-select-menu.open{
  display: block;
}

#serviceCreateOverlay .category-select-item{
  width: 100%;
  border: none;
  background: transparent;
  color: #000000;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

#serviceCreateOverlay .category-select-item:hover{
  background: rgba(255,255,255,0.08);
}

#serviceCreateOverlay .category-select-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

/* =========================================================
   TABLET (iPad e finestre strette). Il telefono è in fondo
   al file, nel blocco "TELEFONO (<= 640px)".
   ========================================================= */

:root{
  --mobile-nav-h: 60px; /* usata solo su telefono */
}

@media (max-width: 1024px) {
  .layout { padding: 14px 16px 18px; } /* desktop usa padding più ampio */
  .card { padding: 16px; }

  /* Overlay: un po' più largo su tablet, ma sempre contenuto */
  .overlay-panel { max-width: 92vw; }
}

@media (max-width: 900px) {
  /* TOP BAR: evita overflow e "sparpagliamento" */
  .top-bar { flex-wrap: wrap; gap: 10px; padding: 10px 14px 12px; }
  .top-bar-left { gap: 12px; }

  .top-bar-date-group{
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .btn-icon-circle{ width: 38px; height: 38px; font-size: 1.05rem; }
  .btn-primary{ padding: 8px 16px; }
}

/* =============================
   RICERCA FULL SCREEN (CHIARA)
============================= */
#searchOverlay .overlay-panel {
  left: 0;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  padding: 18px 18px 22px;
}

.search-header {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}
.search-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.search-subtitle {
  margin-top: 12px;
  text-align: center;
  max-width: 760px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.search-input-wrap {
  width: 100%;
  margin-top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-input {
  width: 100%;
  max-width: 760px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  font-size: 1.35rem;
  padding: 18px 18px;
  outline: none;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.search-content {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.search-section-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.search-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding-right: 4px;
}

.search-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.search-item:hover {
  background: #f9fafb;
}

.search-item-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.search-item-badge.booked{
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.search-item-badge.cancelled{
  background: rgba(239, 68, 68, 0.16);
  color: #dc2626;
}

.search-item-avatar{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: #312e81;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}


.search-item-title {
  font-weight: 650;
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.search-item-sub,
.search-item-meta {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.search-item-meta {
  margin-top: 6px;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .search-content { grid-template-columns: 1fr; }
  .search-title { font-size: 1.6rem; }
}

.search-overlay-panel{
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sposta la X della ricerca in alto a destra (come nello screenshot) */
#searchOverlay #searchOverlayCloseBtn {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));

  width: 56px;
  height: 56px;
  border-radius: 999px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;

  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  z-index: 120; /* sopra il pannello */
}

#searchOverlay #searchOverlayCloseBtn:hover {
  background: #f9fafb;
}


.btn-icon-circle img {
  width: 18px;
  height: 18px;
  display: block;
}

/* 1) Centra e limita la larghezza del "blocco" ricerca (così la X va più a sinistra) */
#searchOverlay .search-header,
#searchOverlay .search-input-wrap,
#searchOverlay .search-content {
  width: 100%;
  max-width: 1100px; /* cambia qui se la vuoi più a sinistra/destra */
  margin: 0 auto;
}

/* 2) La X diventa assoluta dentro l'header (non sul bordo viewport) */
#searchOverlay .search-header {
  position: relative;
  padding-right: 80px; /* spazio per non sovrapporsi al titolo */
}

/* 3) Stile/posizione della X */
#searchOverlay #searchOverlayCloseBtn {
  position: absolute;
  top: 0;
  right: 0;

  width: 56px;
  height: 56px;
  border-radius: 999px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;

  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  z-index: 5;
}

#searchOverlay #searchOverlayCloseBtn:hover {
  background: #f9fafb;
}

/* Più spazio tra input e blocco risultati */
#searchOverlay .search-content{
  margin-top: 117px; /* prova 32/40/56 finché ti piace */
}

body.no-scroll{
  overflow: hidden;
}

.services-container{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.floating-employee-bar{
  position: fixed;
  left: 0;              /* verrà sovrascritto via JS per allinearsi al calendario */
  width: 100%;          /* verrà sovrascritto via JS */
  top: 0;               /* verrà impostato via JS = altezza top-bar */
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
  z-index: 39;          /* sotto top-bar (40), sopra il resto */
  pointer-events: none; /* non blocca scroll/click sotto */
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}

.floating-employee-bar.visible{
  opacity: 1;
  transform: translateY(0);
}

.floating-employee-scroll{
  height: 100%;
  overflow: hidden; /* niente scrollbar */
}

.floating-employee-track{
  height: 100%;
  display: flex;
  align-items: center;
  will-change: transform;
}

.floating-time-spacer{
  flex: 0 0 auto; /* larghezza impostata via JS = time-axis */
  height: 100%;
}

.floating-employee-chip{
  flex: 0 0 auto; /* larghezza impostata via JS = colonna corrispondente */
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  box-sizing: border-box;
}

.floating-employee-chip .mini-avatar{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid var(--chip-color, #6366f1);
  background: #ffffff;
}

.floating-employee-chip .mini-name{
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

/* =========================
   PAGINA MAGAZZINO
   ========================= */

.layout.layout-inventory {
  max-width: none;
  width: 100%;
  margin: 0;
}

/* la card dentro si espande */
.layout.layout-inventory .inventory-card {
  width: 100%;
}

.inventory-card {
  margin-top: 16px;
}

.inventory-title-row {
  align-items: center;
}

.inventory-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.inventory-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.inventory-count-pill {
  min-width: 28px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: #111827;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.inventory-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Toolbar: search + filtri + sort */
.inventory-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 10px;
}

.inventory-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 240px;
}

.inventory-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
  pointer-events: none;
}

.inventory-search-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 10px 14px 10px 38px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.inventory-search-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.35);
}

.inventory-filter-btn,
.inventory-sort-btn {
  white-space: nowrap;
}

/* Tabella */
.inventory-table-wrapper {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  background: #ffffff;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.inventory-table thead {
  background: #f9fafb;
}

.inventory-table th,
.inventory-table td {
  padding: 12px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.inventory-table tbody tr:hover {
  background: #f3f4f6;
}

.col-check {
  width: 44px;
  text-align: center;
}

.col-qty,
.col-price {
  width: 140px;
}

.th-sort {
  color: #9ca3af;
  font-size: 0.9rem;
  margin-left: 6px;
}

/* Celle prodotto */
.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.inventory-table .product-thumb {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 96px;          /* evita che si restringa/rompa il layout */
  background: #f3f4f6;
}

.inventory-table .product-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inventory-table .product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
}

/* (opzionale) un po’ più aria nelle righe */
.inventory-table th,
.inventory-table td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.product-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-sub {
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pill */
.category-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: #312e81;
  font-size: 0.78rem;
  font-weight: 700;
}

.qty-pill,
.price-pill {
  font-weight: 600;
  color: #111827;
}

/* Footer */
.inventory-footer {
  margin-top: 10px;
}

/* Responsive */
@media (max-width: 900px) {
  .inventory-toolbar {
    flex-wrap: wrap;
  }

  .inventory-filter-btn,
  .inventory-sort-btn {
    flex: 1 1 auto;
  }
}

/* Telefono: elenco compatto, vedi il blocco "TELEFONO (<= 640px)" in fondo */

/* =========================
   MAGAZZINO - Overlay full screen (Aggiungi prodotto)
   ========================= */

.inv-full-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 200; /* sopra side-menu e overlay esistenti */
}

.inv-full-overlay.open {
  display: block;
}

.inv-full-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.inv-full-panel {
  position: relative;
  height: 100vh;
  width: 100vw;
  background: #ffffff;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.inv-full-header {
  height: 64px;
  min-height: 64px;
  display: grid;
  grid-template-columns: 64px 1fr 140px;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  backdrop-filter: none;
}

.inv-full-title {
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1rem;
  color: var(--text-main);
}

.inv-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
}

.inv-icon-btn:hover {
  background: #f9fafb;
}

.inv-save-btn {
  justify-self: end;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
}

.inv-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.inv-full-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 26px;
}

.inv-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
}

.inv-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inv-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.inv-card-title {
  font-weight: 800;
  margin-bottom: 10px;
}

.inv-card-sub {
  margin-top: -4px;
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.inv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.inv-field label {
  font-size: 0.78rem;
  color: rgb(0 0 0);
  font-weight: 700;
}

.inv-muted {
  color: var(--text-soft);
  font-weight: 600;
}

.inv-field input,
.inv-field textarea {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px 10px;
  outline: none;
  font-size: 0.9rem;
}

.inv-field textarea {
  min-height: 120px;
  resize: vertical;
}

.inv-field input:focus,
.inv-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.inv-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.inv-counter {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.inv-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Picker buttons (marchio / categoria) */
.inv-picker-btn {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-picker-placeholder.has-value {
  color: rgba(17, 24, 39, 1);
  font-weight: 700;
}

.inv-picker-placeholder {
  color: var(--muted);
}

.inv-picker-caret {
  opacity: 0.7;
}

/* Select unità (dropdown) */
.inv-select-wrap {
  position: relative;
}

.inv-select-btn {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;
  max-height: 320px;
  overflow: auto;
  z-index: 30;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.18);
}

.inv-select-menu.open {
  display: block;
}

.inv-select-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-main);
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.inv-select-item:hover {
  background: #f3f4f6;
}

/* Importo + prezzo */
.inv-amount-row,
.inv-money-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 10px;
}

.inv-amount-prefix,
.inv-money-prefix {
  opacity: 0.75;
  font-weight: 800;
  font-size: 0.85rem;
}

.inv-amount-row input,
.inv-money-row input {
  border: none;
  background: transparent;
  padding: 10px 0;
  color: var(--text-main);
  width: 100%;
  outline: none;
}

/* Dropzone */
.inv-dropzone {
  border-radius: 14px;
  border: 1px dashed rgba(99, 102, 241, 0.55);
  background: #f9fafb;
  padding: 18px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.inv-dropzone.dragover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.9);
}

.inv-drop-inner.hidden {
  display: none;
}

.inv-drop-icon {
  font-size: 1.2rem;
  opacity: 0.9;
  text-align: center;
}

.inv-drop-text {
  margin-top: 8px;
  font-weight: 800;
  text-align: center;
}

.inv-image-preview {
  position: absolute;
  inset: 0;
  display: none;
}

.inv-image-preview.visible {
  display: block;
}

.inv-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inv-remove-img {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-main);
  cursor: pointer;
}

.inv-hint {
  margin-top: 12px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

/* Modali (marchio / categoria) */
.inv-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 260;
}

.inv-modal.open {
  display: grid;
  place-items: center;
}

.inv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.inv-modal-panel {
  position: relative;
  width: min(720px, 92vw);
  max-height: 78vh;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}

.inv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.inv-modal-title {
  font-weight: 900;
  color: var(--text-main);
}

.inv-modal-body {
  padding: 14px 16px 16px;
  overflow: auto;
  max-height: calc(78vh - 60px);
}

.inv-modal-search {
  position: relative;
}

.inv-search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
}

.inv-modal-search input{
  width: 100%;
  padding: 10px 10px 10px 34px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--text-main);
  border-radius: 12px;
  outline: none;
}

.inv-modal-search input:focus{
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.inv-inline-action{
  width: 100%;
  margin-top: 10px;
  text-align: left;
  border: 1px dashed #d1d5db;
  background: #ffffff;
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}

.inv-inline-action:hover{
  background: #f9fafb;
}

.inv-list{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-list-item{
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--text-main);
  padding: 12px 12px;
  border-radius: 14px;
  cursor: pointer;
}

.inv-list-item:hover{
  background: #f3f4f6;
}

.inv-list-main{
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inv-list-title{
  font-weight: 900;
  letter-spacing: -0.01em;
}

.inv-list-sub{
  font-size: 0.82rem;
  opacity: 1;
  color: var(--text-soft);
}

/* Responsive overlay */
@media (max-width: 980px){
  .inv-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px){
  .inv-full-header{
    grid-template-columns: 52px 1fr 110px;
    padding: 0 12px;
  }

  .inv-save-btn{
    padding: 10px 14px;
  }

  .inv-row-2{
    grid-template-columns: 1fr;
  }

  .inv-full-body{
    padding: 14px 12px 22px;
  }

  .inv-card{
    padding: 14px;
  }
}


/* Magazzino: lista + pannello dettagli */
.layout.layout-inventory{
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.inventory-card{
  flex: 1 1 auto;
  min-width: 0;
}

.product-details-panel{
  width: 420px;
  flex: 0 0 420px;
  position: sticky;
  top: 88px; /* regola se la tua top-bar è più alta */
  max-height: none;
  overflow: visible;
}

.product-details-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.product-details-title{
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

/* Mobile: pannello a overlay full-screen */
@media (max-width: 900px){
  .layout.layout-inventory{ display: block; }
  .product-details-panel{
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: none;
    z-index: 120;
  }
}

/* --- FIX pannello dettagli: niente scroll orizzontale --- */
.layout.layout-inventory{
  overflow-x: hidden;
}

.product-details-panel{
  overflow: hidden;              /* niente scrollbar doppia */
  display: flex;
  flex-direction: column;
}

/* header fisso, body scrolla solo in verticale */
.product-details-body{
  flex: 1 1 auto;
  min-height: 0;                 /* IMPORTANTISSIMO in flex per evitare overflow */
  overflow: visible;
}

/* immagini sempre dentro il pannello */
.product-details-panel img{
  max-width: 100%;
  height: auto;
  display: block;
}

/* se hai un wrapper immagine nel markup */
.product-details-image{
  width: 100%;
  overflow: hidden;
}

/* mobile: pannello veramente full screen senza “bordo/gap” */
@media (max-width: 900px){
  .product-details-panel{
    height: 100vh;               /* oppure 100dvh se preferisci */
    border-radius: 0;
  }
}

.product-details-panel[hidden]{
  display: none !important;
}

.inv-sort-menu{
  position: fixed;
  min-width: 320px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.25);
  padding: 8px;
  display: none;
  z-index: 500;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
}

.inv-sort-menu.open{ display:block; }

.inv-sort-item{
  width:100%;
  border:none;
  background:transparent;
  text-align:left;
  padding:10px 10px;
  border-radius:10px;
  cursor:pointer;
  display:flex;
  gap:10px;
  align-items:center;
  font-size:0.9rem;
}

.inv-sort-item:hover{ background:#f3f4f6; }

.inv-sort-check{
  width:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:#4f46e5;
}

.btn-inline-ico{
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
  opacity: .9;
}

/* Overlay Filtri (centrale) */
.inv-filters-overlay{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 650; /* sopra sort menu (500) */
}

.inv-filters-overlay.open{ display: grid; place-items: center; }

.inv-filters-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.inv-filters-panel{
  position: relative;
  width: min(760px, 92vw);
  max-height: 82vh;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inv-filters-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.inv-filters-title{
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text-main);
}

.inv-filters-body{
  padding: 16px 18px 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.invf-label{
  font-size: 0.82rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 6px;
}

.inv-filters-footer{
  padding: 14px 18px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* bottone X */
.inv-filters-close{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.inv-filters-close:hover { 
  background: #f9fafb; 
}

/* --- MAGAZZINO: menu "Opzioni" --- */
.inv-options-menu{
  position: fixed;
  min-width: 260px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.18);
  padding: 8px;
  display: none;
  z-index: 520; /* sotto filtri(650), sopra pagina */
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
}
.inv-options-menu.open{ display:block; }

.inv-options-item{
  width:100%;
  border:none;
  background:transparent;
  text-align:left;
  padding:10px 10px;
  border-radius:10px;
  cursor:pointer;
  display:flex;
  gap:10px;
  align-items:center;
  font-size:0.9rem;
  color:#111827;
}
.inv-options-item:hover{ background:#f3f4f6; }
.inv-options-ico{ width:16px; height:16px; display:block; object-fit:contain; opacity:.9; }

/* --- Overlay gestione (centrale, tipo Filtri) --- */
.inv-manage-overlay{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 700; /* sopra filtri */
}
.inv-manage-overlay.open{
  display: grid;
  place-items: center;
}
.inv-manage-backdrop{
  position:absolute;
  inset:0;
  background: rgba(15,23,42,0.35);
}
.inv-manage-panel{
  position: relative;
  width: min(760px, 92vw);
  max-height: 82vh;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:18px;
  box-shadow: 0 30px 80px rgba(15,23,42,0.25);
  overflow: hidden;
  display:flex;
  flex-direction: column;
}
.inv-manage-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:10px;
  padding:16px 18px 12px;
  border-bottom:1px solid #e5e7eb;
}
.inv-manage-title{
  font-weight: 900;
  font-size: 1.05rem;
  color: #111827;
}
.inv-manage-close{
  width:40px;
  height:40px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#fff;
  cursor:pointer;
  font-size:20px;
  line-height:1;
}
.inv-manage-close:hover{ background:#f9fafb; }

.inv-manage-body{
  padding:14px 16px 16px;
  overflow:auto;
}
.inv-manage-search{
  position: relative;
}
.inv-manage-search input{
  width:100%;
  padding: 10px 10px 10px 34px;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  outline:none;
}
.inv-manage-search input:focus{
  border-color: rgba(99,102,241,.7);
  box-shadow: 0 0 0 1px rgba(99,102,241,.35);
}
.inv-manage-search .inv-search-ico{
  position:absolute;
  left:12px;
  top:50%;
  transform: translateY(-50%);
  opacity:.7;
}

.inv-manage-add{
  width:100%;
  margin-top:10px;
  text-align:left;
  border: 1px dashed #d1d5db;
  background:#fff;
  color:#111827;
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight: 800;
}
.inv-manage-add:hover{ background:#f9fafb; }

.inv-manage-list{
  margin-top:12px;
  display:flex;
  flex-direction: column;
  gap:10px;
}
.inv-manage-item{
  width:100%;
  text-align:left;
  border:1px solid #e5e7eb;
  background:#fff;
  padding:12px 12px;
  border-radius:14px;
  cursor:pointer;
}
.inv-manage-item:hover{ background:#f3f4f6; }

.inv-manage-item-title{
  font-weight: 900;
  letter-spacing: -0.01em;
}
.inv-manage-item-sub{
  font-size: 0.82rem;
  color: #6b7280;
  margin-top: 3px;
}

/* icona lente nella barra ricerca prodotti */
.inventory-search-icon{
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
  opacity: 0.75;
}

/* icona lente dentro gli input (modali/overlay) */
.inv-search-ico{
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
}

.btn-success{
  border-radius: 999px;
  border: none;
  background: #16a34a;
  color: #ffffff;
  padding: 8px 22px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}
.btn-success:hover{
  background: #15803d;
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.28);
  transform: translateY(-1px);
}

/* --- MAGAZZINO: overlay Gestisci quantità --- */
.inv-adjust-overlay{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 720; /* sopra inv-manage-overlay 700 */
}
.inv-adjust-overlay.open{ display: block; }

.inv-adjust-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.inv-adjust-panel{
  position: relative;
  height: 100vh;
  width: 100vw;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.inv-adjust-header{
  height: 64px;
  min-height: 64px;
  display: grid;
  grid-template-columns: 64px 1fr 140px;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: relative;
}

.inv-adjust-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 1.25rem;   /* più grande */
  line-height: 1;
  pointer-events: none; /* evita click “strani” sopra i bottoni */
}

.inv-adjust-save{
  justify-self: end;
  border-radius: 999px;
  border: none;
  background: #16a34a;
  color: #fff;
  padding: 10px 18px;
  font-weight: 900;
  cursor: pointer;
}
.inv-adjust-save:disabled{
  opacity: .45;
  cursor: not-allowed;
}

.inv-adjust-body{
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.inv-adjust-col{
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}
.inv-adjust-col + .inv-adjust-col{
  border-left: 1px solid #e5e7eb;
}

.inv-adjust-card{
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.inv-adjust-col-title{
  font-weight: 900;
  margin-bottom: 8px;
}
.inv-adjust-search{
  position: relative;
}
.inv-adjust-search input{
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 10px 14px 10px 38px;
  font-size: 0.85rem;
  outline: none;
}
.inv-adjust-search img{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: .75;
}

.inv-adjust-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inv-adjust-item{
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}
.inv-adjust-item:hover{ background: #f3f4f6; }

.inv-adjust-item-name{
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-adjust-item-sub{
  font-size: .78rem;
  color: #6b7280;
  margin-top: 2px;
}

.inv-adjust-main{
  flex: 1 1 auto;
  min-width: 0;
}

.inv-adjust-qty{
  width: 92px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
}

.inv-adjust-mini-btn{
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
  margin-left: auto;
}
.inv-adjust-mini-btn:hover{ background: #f9fafb; }

@media (max-width: 900px){
  .inv-adjust-body{ grid-template-columns: 1fr; }
  .inv-adjust-col + .inv-adjust-col{ border-left: none; border-top: 1px solid #e5e7eb; }
}

.inv-adjust-item.inv-adjust-empty{
  background: #fff;
}

.inv-adjust-item.inv-adjust-empty .inv-adjust-item-name{
  font-weight: 600;     /* non bold */
  font-size: 0.88rem;   /* più piccola */
  color: #6b7280;
}

.inv-adjust-card{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.inv-adjust-col .inv-adjust-card:nth-of-type(2){
  max-height: 240px; /* Selezionati */
}

.inv-adjust-col .inv-adjust-card:nth-of-type(3){
  flex: 1 1 auto;    /* Risultati prende lo spazio rimanente */
  min-height: 0;
}

.inv-adjust-list{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;    /* scroll */
  padding-right: 4px;
}

.inv-adjust-thumb{
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  flex: 0 0 64px;
}

.inv-adjust-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Header: bottone sempre a destra */
.inv-adjust-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inv-adjust-save{
  margin-left: auto;
}

.product-details-actions{
  margin-top: 18px;          /* spazio richiesto */
  padding-top: 14px;         /* aria extra */
  border-top: 1px solid #e5e7eb; /* separatore (opzionale ma pulito) */
  display: flex;
  gap: 10px;
}

.product-details-name{
  font-weight: 800;
}

.inv-inline-action{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Bottone rosso leggero con testo nero (leggibile) */
.btn-soft-danger{
  background: #fee2e2;
  border-color: #fca5a5;
  color: #111827;
}
.btn-soft-danger:hover{
  background: #fecaca;
  border-color: #f87171;
}

/* Bottoni con icona a sinistra: evita crescita e centra bene testo+icona */
.btn.btn-left-ico{
  line-height: 1;
  justify-content: flex-start;
  gap: 10px;
}

/* Rende l'icona sempre della stessa misura e perfettamente centrata */
.btn.btn-left-ico .btn-inline-ico{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: block;
  object-fit: contain;
  align-self: center;
}

#addServiceBtn .btn-inline-ico {
  display: inline-block;
  vertical-align: middle;
}

#removeServiceBtn .btn-inline-ico {
  display: inline-block;
  vertical-align: middle;
}

/* -------- Context menu appuntamento -------- */
#apptContextMenu {
  position: fixed;
  display: none;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 8px;
  z-index: 300; /* sopra tooltip/overlay */
}
#apptContextMenu.open { display: block; }
#apptContextMenu .appt-ctx-item{
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #111827;
}
#apptContextMenu .appt-ctx-item:hover { background: #f3f4f6; }

/* -------- Modalità riprogramma (oscura tutto) -------- */
body.reschedule-mode .calendar-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  z-index: 25;
  pointer-events: none; /* puoi comunque cliccare lo slot */
}

/* “Spegni” i blocchi non selezionati */
body.reschedule-mode .appointment-block {
  opacity: 0.30;
}

/* “Illumina” i blocchi selezionati */
body.reschedule-mode .appointment-block.reschedule-selected {
  opacity: 1;
  z-index: 30; /* sopra overlay scuro */
}
body.reschedule-mode .appointment-block.reschedule-selected .appointment-inner {
  box-shadow: 0 0 0 3px rgba(99,102,241,0.95), 0 18px 40px rgba(0,0,0,0.35);
}

/* fai vedere anche la riga hover sopra l’overlay (opzionale ma utile) */
body.reschedule-mode .hover-row { z-index: 31; }

/* -------- Barra viola in alto -------- */
#rescheduleBar {
  position: fixed;
  left: 0;
  right: 0;
  height: 52px;
  background: #6d28d9;
  color: #fff;
  z-index: 120; /* sopra calendario e floating bar */
  display: none;
}
body.reschedule-mode #rescheduleBar { display: block; }

#rescheduleBar .reschedule-bar-inner{
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#rescheduleBar .reschedule-bar-title{
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
#rescheduleBar .reschedule-bar-close{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
#rescheduleBar .reschedule-bar-close:hover{
  background: rgba(255,255,255,0.22);
}

#rescheduleBar .reschedule-bar-inner{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
}

#rescheduleBar .reschedule-bar-title{
  text-align: center;
  line-height: 1;
}

#rescheduleBar .reschedule-bar-close{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ====== RESCHEDULE: griglia + orari più leggibili (FIX) ====== */

/* NON alzare il fondo bianco sopra l'overlay */
body.reschedule-mode .column-body{
  z-index: auto;
}

/* Asse orario leggibile */
body.reschedule-mode .time-axis{
  position: relative;
  z-index: 26; /* appena sopra overlay (25) */
  background: rgba(17,24,39,0.55);
  backdrop-filter: blur(2px);
}

body.reschedule-mode .time-slot-label{
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  font-size: 0.80rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Righe sopra overlay */
body.reschedule-mode .hour-line{
  position: relative;
  z-index: 26;
  border-top-color: rgba(255,255,255,0.22);
  border-top-width: 1px;
}

body.reschedule-mode .hour-line.major{
  border-top-color: rgba(255,255,255,0.40);
  border-top-width: 2px;
}

/* Etichetta orario hover più contrastata */
body.reschedule-mode .hover-time-indicator{
  color: #ffffff;
  background: rgba(17,24,39,0.75);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  text-shadow: none;
}

/* ===== RESCHEDULE: hover row + badge viola ===== */

/* Riga hover più evidente */
body.reschedule-mode .hover-row{
  background: rgba(99, 102, 241, 0.35);           /* viola più visibile */
  border-top: 1px solid rgba(99, 102, 241, 0.95);
  border-bottom: 1px solid rgba(99, 102, 241, 0.95);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.55);
  z-index: 31;                                    /* già previsto nel tuo CSS */
}

/* Badge orario: viola + testo bianco bold */
body.reschedule-mode .hover-time-indicator{
  background: rgba(99, 102, 241, 0.95);           /* viola pieno */
  color: #ffffff;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}

/* ===== RESCHEDULE: hover row + badge = viola top-bar (#6d28d9) ===== */

body.reschedule-mode .hover-row{
  background: rgba(109, 40, 217, 0.32);            /* #6d28d9 */
  border-top: 1px solid rgba(109, 40, 217, 0.95);
  border-bottom: 1px solid rgba(109, 40, 217, 0.95);
  box-shadow: 0 0 0 1px rgba(109, 40, 217, 0.50);
  z-index: 31;                                     /* sopra overlay scuro */
}

body.reschedule-mode .hover-time-indicator{
  background: #6d28d9;                             /* stesso viola top bar */
  color: #ffffff;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}

/* -------- Context menu appuntamento (FIX selector + icona + bold) -------- */

#apptContextMenu{
  position: fixed;
  display: none;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 8px;
  z-index: 300;
}

#apptContextMenu.open{ display: block; }

#apptContextMenu .appt-ctx-item{
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #111827;

  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

#apptContextMenu .appt-ctx-item:hover{ background: #f3f4f6; }

#apptContextMenu .appt-ctx-ico{
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  flex: 0 0 18px;
}

#apptContextMenu .appt-ctx-label{
  font-weight: 800;
}

/* ========== DISABILITA HOVER/RESIZE in modalità riprogramma ========== */
body.reschedule-mode .appointment-block .appt-resize-handle{
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Blocca l’effetto “porta” (shrink) e qualsiasi transizione width */
body.reschedule-mode .appointment-block .appointment-inner{
  width: 100% !important;
  transition: box-shadow 0.12s ease !important; /* niente width */
}

/* Centra icona + testo SOLO sul bottone "Crea un nuovo cliente" */
#createClientBtn.btn.btn-left-ico {
  justify-content: center;
}

.client-details-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   RIFINITURE COMUNI (desktop + telefono)
   Valgono ovunque ma non cambiano l'aspetto del desktop:
   tolgono i comportamenti "da sito web" al tocco.
   ========================================================= */

html {
  -webkit-tap-highlight-color: transparent; /* niente flash grigio al tocco su iPhone */
  -webkit-text-size-adjust: 100%;           /* niente testo ingrandito in orizzontale */
}
body {
  overscroll-behavior-y: contain;
}

/* Tocco immediato (niente attesa del doppio tocco) e niente selezione del testo
   dei pulsanti tenendo premuto */
button, .btn, .btn-primary, .btn-pill, .btn-icon-circle, .side-menu-item {
  touch-action: manipulation;
}
button, [role="tab"], [role="radio"] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Contorno visibile solo navigando con la tastiera */
:where(button, a, [role="tab"], [role="radio"], [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Barra di ricerca unificata (Clienti, Servizi, picker cliente/servizio):
   stesso stile "pillola + lente" del Magazzino */
.input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  background-image: url("icon/cerca.png");
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 14px 14px;
  padding: 10px 14px 10px 38px;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.35);
}
.input::placeholder {
  color: #9ca3af;
}

/* Footer dei pannelli (Salva ecc.): sempre visibile sotto il contenuto che scorre */
.overlay-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid #e5e7eb;
}

.overlay-body {
  overscroll-behavior: contain; /* scorrendo il pannello non si muove la pagina dietro */
}

.appt-resize-handle {
  touch-action: none;
}

/* Altezza "vera" sul telefono: 100dvh segue la barra di Safari che appare/scompare */
.overlay-panel,
.inv-full-panel,
.inv-adjust-panel {
  height: 100vh;
  height: 100dvh;
}

@media (max-width: 900px) {
  .product-details-panel {
    height: 100vh;
    height: 100dvh;
  }
}

/* Pulsanti salva disattivati durante il salvataggio */
.btn-primary:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Elementi solo-telefono: nascosti su desktop */
.emp-chips,
.fab {
  display: none;
}

/* Menu laterale chiuso: la sua ombra sporgeva come una striscia grigia sul bordo sinistro */
@media (min-width: 641px) {
  .side-menu:not(.open) {
    box-shadow: none;
  }
}

/* ---------- Messaggio breve (toast) ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 400;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  background: #111827;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Pannello appuntamento: azioni in modifica ---------- */
#editInfo {
  flex-direction: column; /* il JS lo mostra con display: flex */
  gap: 8px;
}
.edit-info-row .btn {
  flex: 1 1 0;
}

/* Coppie di campi (es. Ora inizio / Ora fine): etichetta sempre sopra il campo */
.field-row .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* I campi dei moduli non ereditano il font della pagina: usavano quello di sistema */
input,
select,
textarea {
  font-family: inherit;
}

/* ---------- Colonne di operatrici non più attive ---------- */
.employee-name-row.is-static {
  cursor: default;
}
.calendar-column.is-inactive .employee-name {
  color: #6b7280;
}
.employee-inactive-badge {
  position: absolute; /* non cambia l'altezza dell'intestazione (allineamento con gli orari) */
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.66rem;
  font-weight: 700;
}
.calendar-column.is-inactive .column-body {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    rgba(148, 163, 184, 0.07) 10px 20px
  );
}

/* ---------- Impostazioni ---------- */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
}
.settings-section:first-child {
  padding-top: 4px;
}
.settings-section:last-child {
  border-bottom: none;
}
.settings-section-title,
.team-section-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.settings-team-card,
.team-action-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  font: inherit;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.settings-team-avatars {
  display: inline-flex;
  flex: 0 0 auto;
}
.settings-team-avatar {
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--avatar-color, #6366f1);
  box-shadow: 0 0 0 2px #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #111827;
}
.settings-team-avatar:first-child {
  margin-left: 0;
}
.settings-team-text,
.team-action-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-team-title,
.team-action-title {
  font-size: 0.9rem;
  font-weight: 700;
}
.settings-team-sub {
  font-size: 0.75rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-team-chevron,
.team-row-chevron {
  flex: 0 0 auto;
  font-size: 1.35rem;
  line-height: 1;
  color: #9ca3af;
}

/* ---------- Pannello Team ---------- */
.team-panel {
  width: 400px;
}
.team-header {
  gap: 8px;
}
.team-header h2 {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-back-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0 0 3px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-size: 1.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.team-back-btn[hidden] {
  display: none;
}
.team-panel .overlay-body {
  gap: 12px;
}
.team-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-soft);
}
.team-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.78rem;
  line-height: 1.45;
}
.team-error {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #b91c1c;
}
.team-error:empty {
  display: none;
}
.team-warning {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.78rem;
  line-height: 1.4;
}
.team-section-title {
  margin-top: 6px;
}

.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}
.team-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.team-row:last-child {
  border-bottom: none;
}
.team-row-main {
  flex: 1;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.team-row-main.is-static {
  cursor: default;
}
.team-row-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.team-row-sub {
  font-size: 0.72rem;
  color: var(--text-soft);
}
.team-list-inactive .team-row-name {
  color: #6b7280;
}
.team-row-order {
  display: flex;
  gap: 4px;
}
.team-order-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.team-order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.team-reactivate-btn {
  flex: 0 0 auto;
}

.team-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 3px solid var(--avatar-color, #6366f1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: #111827;
}
.team-avatar.is-large {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}
.team-edit-head {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.team-field-help {
  margin: -6px 0 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--text-soft);
}
.team-field-label {
  font-size: 0.75rem;
  color: #4b5563;
}
.team-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 2px;
}
.team-swatch {
  position: relative;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.team-swatch[aria-checked="true"] {
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--swatch);
}
.team-swatch[aria-checked="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.team-action-card.is-danger .team-action-title {
  color: #b91c1c;
}
.team-action-sub {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-soft);
}

.team-future {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.team-future-count {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
}
.team-check,
.team-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.team-check input,
.team-radio input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.team-radio > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.team-radio-sub {
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-soft);
}
.team-radio-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}
.team-radio-card select {
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.85rem;
  background: #ffffff;
}
.team-future-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.team-future-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  background: #f9fafb;
}
.team-future-item.has-conflict {
  border-color: #fde68a;
  background: #fffbeb;
}
.team-future-when {
  font-size: 0.78rem;
  font-weight: 700;
}
.team-future-what {
  font-size: 0.76rem;
  color: #4b5563;
}
.team-future-warn {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b45309;
}
.team-future-more {
  padding: 2px 10px;
  font-size: 0.76rem;
  color: var(--text-soft);
}

/* ---------- Menu azioni del "+" (telefono) ---------- */
.sheet-overlay .overlay-backdrop {
  background: rgba(15, 23, 42, 0.4);
}
.action-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  width: min(480px, calc(100% - 16px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-sheet-group {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}
.action-sheet-item {
  min-height: 56px;
  border: none;
  background: #ffffff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.action-sheet-group .action-sheet-item + .action-sheet-item {
  border-top: 1px solid #e5e7eb;
}
.action-sheet-cancel {
  border-radius: 14px;
  color: #111827;
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  .settings-team-card:hover,
  .team-action-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  }
  .team-row-main:not(.is-static):hover {
    background: #f9fafb;
  }
  .team-order-btn:not(:disabled):hover,
  .team-back-btn:hover {
    background: #eef2ff;
  }
}

/* =========================================================
   SCHERMI TOUCH (telefono e tablet): niente "hover" appiccicoso.
   Su iPhone il primo tocco attiva :hover e lo lascia attivo:
   anelli, ombre e spostamenti restavano accesi dopo il tocco.
   Al loro posto un riscontro immediato alla pressione (:active).
   ========================================================= */
@media (hover: none) {
  .appointment-block:hover .appointment-inner {
    box-shadow: none;
  }
  .appointment-block.appointment-hovered:hover .appointment-inner {
    width: 100%;
  }
  .btn-primary:hover {
    background: var(--primary);
    box-shadow: none;
    transform: none;
  }
  .btn:hover,
  .btn-icon-circle:hover {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: none;
  }
  .btn-pill:hover {
    box-shadow: none;
  }
  .btn-muted:hover,
  .btn-pill.btn-muted:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
  }
  .btn-danger:hover {
    background: #ffffff;
    border-color: #f97373;
  }
  .clients-table tbody tr:hover {
    background-color: transparent;
  }
  .client-picker-item:hover {
    background: #ffffff;
    box-shadow: none;
  }
  .search-item:hover {
    background: #ffffff;
  }
  .side-menu-item:hover:not(.side-menu-item-active) {
    background: transparent;
  }
  .services-category-item:hover:not(.active) {
    background: transparent;
  }

  .hover-time-indicator,
  .hover-row,
  .tooltip {
    display: none !important;
  }

  /* Maniglia per allungare l'appuntamento: sempre visibile (non c'è l'hover),
     nell'angolo in basso a destra per non coprire il testo dei blocchi brevi */
  .appt-resize-handle {
    opacity: 1;
    left: auto;
    right: 8px;
    transform: none;
    width: 28px;
    height: 5px;
    bottom: 4px;
    background: rgba(17, 24, 39, 0.4);
  }
  .employee-menu-arrow {
    opacity: 1;
  }

  /* Riscontro al tocco */
  .btn:active,
  .btn-pill:active,
  .btn-icon-circle:active,
  .client-picker-item:active,
  .search-item:active,
  .settings-team-card:active,
  .team-action-card:active,
  .team-row-main:not(.is-static):active,
  .team-order-btn:not(:disabled):active,
  .action-sheet-item:active {
    background-color: #f3f4f6;
  }
  .btn-primary:active {
    background: #4338ca;
    transform: scale(0.98);
  }
  .btn,
  .btn-pill,
  .btn-icon-circle,
  .btn-primary {
    transition: background-color 0.1s ease, transform 0.1s ease;
  }
}

/* =========================================================
   TELEFONO (<= 640px) — iPhone
   Unico blocco per il telefono: prima c'erano tre strati di
   correzioni (600px, 420px, 640px) che si contraddicevano.
   ========================================================= */
@media (max-width: 640px) {
  :root {
    --mobile-nav-h: 60px;
    --calendar-header-height: 0px; /* intestazioni colonne nascoste: le operatrici sono in alto */
  }

  /* Safari ingrandisce la pagina se un campo ha il testo sotto i 16px */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* ---------------- Barra in alto ---------------- */
  .top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    box-shadow: 0 1px 0 #e5e7eb, 0 6px 16px rgba(15, 23, 42, 0.06);
  }
  .top-bar-left {
    display: contents; /* logo, data e operatrici diventano righe della barra */
  }
  .btn-menu-toggle {
    display: none; /* sostituito dalla barra di navigazione in basso */
  }
  .logo-wrap {
    order: 1;
    min-height: 42px;
  }
  .logo-img {
    height: 30px;
  }
  .top-bar-right {
    order: 2;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .top-bar-right .btn-icon-circle {
    width: 42px;
    height: 42px;
  }
  #addBookingBtn {
    display: none; /* sul telefono c'è il "+" in basso a destra */
  }

  .top-bar-date-group {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
  }
  #todayBtn {
    flex: 0 0 auto;
    min-width: 64px;
    height: 42px;
    font-size: 14px;
    font-weight: 600;
  }
  .date-shell {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    border-radius: 12px;
    justify-content: space-between;
  }
  .date-shell-arrow {
    flex: 0 0 44px;
    width: 44px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    font-size: 22px;
  }
  .date-shell-main {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0 4px;
    font-size: 15px;
    font-weight: 700;
  }

  /* Operatrici del giorno: tocca per passare a un'altra (o scorri il calendario) */
  .emp-chips {
    order: 4;
    flex: 1 1 100%;
    display: flex;
    gap: 6px;
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .emp-chips::-webkit-scrollbar {
    display: none;
  }
  .emp-chips:empty {
    display: none;
  }
  /* Avatar sopra e nome sotto: con 4-5 operatrici i nomi interi ci stanno */
  .emp-chip {
    flex: 1 0 0;
    min-width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 4px 4px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: #6b7280;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  }
  .emp-chip-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    border: 2px solid var(--chip-color);
    background: var(--chip-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
  }
  .emp-chip-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .emp-chip.is-current {
    border-color: var(--chip-color);
    background: var(--chip-bg);
    color: #111827;
    font-weight: 800;
  }
  .emp-chip.is-current .emp-chip-avatar {
    background: #ffffff;
  }
  .emp-chip.is-inactive .emp-chip-avatar {
    border-style: dashed;
  }

  /* ---------------- Navigazione in basso ---------------- */
  .side-menu-backdrop {
    display: none !important;
  }
  .side-menu {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    flex-direction: row;
    transform: none;
    transition: none;
    border-top: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
  }
  .side-menu.open {
    transform: none;
  }
  .side-menu-inner {
    width: 100%;
    height: var(--mobile-nav-h);
    margin: 0;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
  }
  .side-menu-item {
    flex: 1 1 0;
    width: auto;
    height: 100%;
    flex-direction: column;
    gap: 2px;
    border-radius: 0;
    background: transparent;
  }
  .side-menu-item-active {
    background: transparent;
    border-radius: 0;
  }
  .side-menu-icon {
    box-sizing: content-box;
    width: 24px;
    height: 24px;
    padding: 4px 18px;
    border-radius: 999px;
    transition: background-color 0.16s ease;
  }
  .side-menu-item-active .side-menu-icon {
    filter: none;
    background: #e0e7ff;
  }
  .side-menu-item::before {
    display: none;
  }
  .side-menu-item::after,
  .side-menu-item:hover::after,
  .side-menu-item:focus-visible::after {
    display: block;
    position: static;
    content: attr(data-label);
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    opacity: 1;
    transform: none;
    pointer-events: none;
  }
  .side-menu-item-active::after,
  .side-menu-item-active:hover::after {
    color: var(--primary);
    font-weight: 800;
  }

  /* ---------------- Pagine ---------------- */
  .layout {
    padding: 12px 12px calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  .card {
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  }
  .card-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .card-title-row h2 {
    font-size: 1.05rem;
  }

  /* ---------------- Calendario ---------------- */
  .layout-calendar {
    padding: 0 0 calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 88px);
  }
  .calendar-card {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .calendar-card .card-title-row,
  .calendar-card .column-header,
  .floating-employee-bar {
    display: none;
  }
  .calendar-wrapper {
    overflow: visible;
    padding-bottom: 0;
  }
  .calendar {
    overflow: visible;
  }
  .time-axis {
    width: 48px;
    flex: 0 0 48px;
    background: #f9fafb;
  }
  .time-slot-label {
    padding: 3px 6px 0 2px;
    font-size: 11px;
    font-weight: 600;
  }

  /* Una colonna = tutta la larghezza; si passa all'operatrice accanto
     scorrendo col dito (scroll-snap: la fisica è quella nativa di iOS) */
  .calendar-columns {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .calendar-columns::-webkit-scrollbar {
    display: none;
  }
  .calendar-column {
    flex: 0 0 100%;
    min-width: 0;
    border-right: none;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .appointment-inner {
    padding: 4px 10px;
  }
  .appt-time {
    font-size: 12px;
  }
  .appt-client {
    font-size: 14px;
    font-weight: 700;
  }
  .appt-service {
    font-size: 12px;
  }
  .blocked-inner {
    font-size: 12px;
  }

  .now-time-indicator {
    padding: 1px 5px;
    font-size: 11px;
  }

  /* Avvisi sopra la barra di navigazione, non sopra le sue icone */
  .toast {
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }

  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 70;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 18px;
    background: var(--primary);
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.4), 0 2px 6px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.12s ease;
  }
  .fab span {
    margin-top: -3px;
  }
  .fab:active {
    transform: scale(0.94);
    background: #4f46e5;
  }
  body.reschedule-mode .fab {
    display: none;
  }

  /* Barra "Sposta": testo su più righe se serve, X sempre a destra */
  #rescheduleBar {
    height: auto;
  }
  #rescheduleBar .reschedule-bar-inner {
    min-height: 48px;
    padding: 8px 56px 8px 16px;
    justify-content: flex-start;
  }
  #rescheduleBar .reschedule-bar-title {
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
  }

  /* Calendario piccolo per scegliere la data: un mese solo */
  .date-overlay-panel {
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 14px;
  }
  .date-overlay-months {
    grid-template-columns: 1fr;
  }
  #dateMonthRight {
    display: none;
  }
  .date-month-title {
    font-size: 15px;
  }
  .date-weekdays {
    font-size: 12px;
  }
  .date-day {
    min-height: 40px;
    font-size: 15px;
  }
  .date-overlay-footer {
    flex-wrap: wrap;
    justify-content: center;
  }
  .date-overlay-footer .btn-pill {
    flex: 1 1 calc(33.333% - 6px);
    min-height: 40px;
    padding: 8px 4px;
    font-size: 0.75rem;
  }

  /* ---------------- Pannelli: a tutto schermo ---------------- */
  .overlay-panel,
  .side-overlay .overlay-panel,
  #clientPickerOverlay .overlay-panel,
  #servicePickerOverlay .overlay-panel,
  #clientCreateOverlay .client-create-panel,
  #serviceCreateOverlay .service-create-panel {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    transform: none;
    border-radius: 0;
    box-shadow: none;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #clientCreateOverlay .overlay-body,
  #serviceCreateOverlay .overlay-body {
    max-height: none;
    overflow-y: auto;
  }
  .overlay-header {
    min-height: 44px;
    margin-bottom: 4px;
    gap: 10px;
  }
  .overlay-header h2 {
    font-size: 1.2rem;
  }
  .overlay-close-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    font-size: 14px;
  }
  .overlay-footer {
    padding-top: 12px;
  }
  .overlay-footer .btn-primary {
    min-height: 48px;
    font-size: 16px;
  }

  /* Campi comodi da toccare */
  .field-group label {
    font-size: 13px;
  }
  .field-group input,
  .field-group select,
  .field-group textarea,
  .time-select {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
  }
  .btn,
  .btn-pill,
  .btn-primary {
    min-height: 44px;
  }
  .btn-block {
    font-size: 15px;
  }
  .edit-info-row .btn {
    padding: 8px;
    font-size: 13px;
    line-height: 1.2;
  }

  /* Tendine con lo stesso aspetto dei campi di testo (invece del grigio di sistema) */
  .field-group select,
  .time-select,
  .team-radio-card select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 36px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    color: var(--text-main);
  }
  .field-row {
    flex-direction: column;
  }
  /* Orario inizio/fine restano affiancati: stanno bene e vanno letti insieme */
  .field-group.field-row,
  .field-row:has(.time-select) {
    flex-direction: row;
    align-items: flex-end;
  }

  /* Elenchi di scelta (cliente, trattamento) a tutta altezza */
  .client-picker-body {
    flex: 1;
    min-height: 0;
  }
  .client-picker-list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .client-picker-item {
    min-height: 52px;
    padding: 10px 12px;
    font-size: 15px;
  }
  .client-picker-name {
    font-size: 15px;
  }
  .client-picker-phone {
    font-size: 13px;
  }
  #servicePickerOverlay .side-overlay-header,
  .side-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 8px;
  }
  .side-overlay-header h2 {
    margin: 0;
    font-size: 1.2rem;
  }

  /* Animazione d'ingresso dei pannelli (come le schermate di iOS) */
  @media (prefers-reduced-motion: no-preference) {
    .overlay.open > .overlay-panel,
    .side-overlay.visible > .overlay-panel {
      animation: estelab-panel-in 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .sheet-overlay.open .action-sheet {
      animation: estelab-sheet-up 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    }
  }

  /* ---------------- Ricerca ---------------- */
  #searchOverlay .overlay-panel {
    align-items: stretch;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #searchOverlay .search-header {
    position: static;
    padding-right: 0;
  }
  #searchOverlay #searchOverlayCloseBtn {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 15px !important;
    box-shadow: none;
  }
  #searchOverlay .search-input-wrap {
    margin-top: 52px;
  }
  .search-input {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 17px !important;
    box-shadow: none;
  }
  .search-subtitle {
    display: none;
  }
  #searchOverlay .search-content {
    display: block;
    flex: 1;
    min-height: 0;
    margin-top: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .search-col + .search-col {
    margin-top: 20px;
  }
  .search-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .search-item {
    box-shadow: none;
  }

  /* ---------------- Impostazioni / Team ---------------- */
  .team-panel {
    width: 100%;
  }
  .team-back-btn {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .team-order-btn {
    width: 40px;
    height: 40px;
  }
  .team-swatch {
    width: 38px;
    height: 38px;
  }

  /* ---------------- Clienti ---------------- */
  .clients-card {
    margin-top: 0;
  }
  .clients-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #clientsAddBtn {
    grid-column: 1 / -1;
    order: -1;
  }
  .clients-actions .btn {
    width: 100%;
  }
  /* Azione principale in evidenza (la classe btn-primary era annullata da .btn) */
  #clientsAddBtn,
  #servicesAddBtn,
  #newClientSaveBtn,
  #newServiceSaveBtn {
    border-color: transparent;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
  }
  #clientsAddBtn:active,
  #servicesAddBtn:active,
  #newClientSaveBtn:active,
  #newServiceSaveBtn:active {
    background: #4338ca;
  }
  /* Annulla | Salva affiancati in fondo ai moduli */
  .overlay-footer .field-row {
    flex-direction: row;
  }
  .clients-toolbar {
    margin-top: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .clients-search .input {
    width: 100%;
  }

  /* Tabella → elenco compatto: avatar, nome e telefono. Il resto è nella scheda. */
  .clients-table-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
  }
  .clients-table,
  .clients-table tbody {
    display: block;
  }
  .clients-table thead {
    display: none;
  }
  .clients-table tbody tr {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    cursor: pointer;
  }
  .clients-table tbody tr:last-child {
    border-bottom: none;
  }
  .clients-table tbody tr:active {
    background: #f9fafb;
  }
  .clients-table tbody td {
    display: block;
    padding: 0;
    border: none;
  }
  .clients-table tbody td:nth-child(1),
  .clients-table tbody td:nth-child(4),
  .clients-table tbody td:nth-child(5),
  .clients-table tbody td:nth-child(6) {
    display: none;
  }
  .clients-table tbody td:nth-child(2) {
    flex: 1 1 auto;
    min-width: 0;
  }
  .clients-table tbody td:nth-child(3) {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--text-soft);
  }
  .clients-name-cell {
    min-width: 0;
  }
  .client-avatar-table {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }
  .client-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
  }
  .clients-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 12px;
  }
  .clients-page-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* Scheda cliente */
  .client-details-panel {
    max-width: none;
  }
  .client-details-header {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .client-details-header > div:first-child {
    padding-right: 48px;
    min-width: 0;
  }
  .client-header-info {
    min-width: 0;
  }
  .client-header-info h2,
  .client-header-sub {
    overflow-wrap: anywhere;
  }
  .client-details-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #clientDetailsCloseBtn {
    position: absolute;
    top: 4px;
    right: 0;
  }
  .client-detail-row {
    font-size: 14px;
  }
  .client-detail-row dd {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .client-appointments-list {
    max-height: none;
    overflow: visible;
  }

  /* ---------------- Servizi ---------------- */
  .layout-services {
    max-width: none;
    margin: 0;
  }
  .services-card {
    margin-top: 0;
  }
  .services-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .services-actions .btn {
    width: 100%;
  }
  .services-layout {
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
  }
  .services-categories {
    width: 100%;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .services-categories h3 {
    display: none;
  }
  #servicesCategoryList {
    display: flex;
    gap: 8px;
    margin: 0 -14px;
    padding: 2px 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #servicesCategoryList::-webkit-scrollbar {
    display: none;
  }
  .services-category-item {
    flex: 0 0 auto;
    min-height: 38px;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    white-space: nowrap;
  }
  .services-category-item.active {
    border-color: transparent;
  }
  .services-main {
    width: 100%;
    gap: 12px;
  }
  .services-toolbar .input {
    max-width: none;
  }
  .services-list {
    gap: 18px;
  }
  .services-category-section {
    gap: 8px;
  }
  .services-category-section > h3 {
    margin: 0 0 2px;
    font-size: 0.9rem;
  }
  .service-card {
    max-width: none;
    margin-bottom: 0;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--cat-color, #ec4899);
    border-radius: 12px;
    box-shadow: none;
  }
  #serviceCreateOverlay .category-select-menu {
    max-height: 45vh;
    overflow-y: auto;
  }

  /* ---------------- Magazzino ---------------- */
  .inventory-card {
    margin-top: 0;
  }
  .inventory-title-row {
    flex-direction: column;
    align-items: stretch;
  }
  .inventory-actions {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 8px;
  }
  .inventory-actions > button {
    min-height: 44px;
    justify-content: center;
  }
  .inventory-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }
  .inventory-search {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .inventory-filter-btn,
  .inventory-sort-btn {
    min-width: 0;
    min-height: 44px;
  }
  .inventory-sort-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tabella → elenco: foto, nome e codice a sinistra; prezzo e quantità a destra */
  .inventory-table-wrapper {
    border-radius: 14px;
  }
  .inventory-table,
  .inventory-table tbody {
    display: block;
  }
  .inventory-table thead {
    display: none;
  }
  .inventory-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
  }
  .inventory-table tbody tr:last-child {
    border-bottom: none;
  }
  .inventory-table tbody tr:active {
    background: #f9fafb;
  }
  .inventory-table tbody td {
    display: block;
    width: auto;
    padding: 0;
    border: none;
  }
  .inventory-table tbody td.col-check,
  .inventory-table tbody td.col-category {
    display: none;
  }
  .inventory-table tbody td.col-product {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-width: 0;
  }
  .inventory-table tbody td.col-price {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    font-size: 15px;
  }
  .inventory-table tbody td.col-qty {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
    font-size: 12px;
    color: var(--text-soft);
  }
  .inventory-table tbody td.col-qty::before {
    content: "Qtà ";
  }
  .inventory-table .product-thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 10px;
  }
  .product-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 14px;
    line-height: 1.3;
  }
  .product-sub {
    font-size: 12px;
  }
  .product-details-panel {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
  }
  /* Pannelli a tutto schermo del Magazzino: niente contenuto sotto la barra di stato
     o sotto l'indicatore Home quando l'app è aperta dalla schermata Home */
  .inv-full-panel,
  .inv-adjust-panel {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .product-details-body {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@keyframes estelab-panel-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes estelab-sheet-up {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
