:root{
  /* Palette neutra: agenda bianca. I colori restano solo sulle colonne. */
  --bg-main:#ffffff;
  --bg-panel:#ffffff;
  --bg-header:#f4f4f5;
  --bg-time:#f7f7f8;
  --row-even:#ffffff;
  --row-odd:#fafafa;

  --border:#a9a9b0;
  --border-soft:#cfcfd4;

  --text-main:#1f2023;
  --text-soft:#71717a;

  --accent:#3f3f46;
  --accent-dark:#27272a;
  --accent-soft:#f0f0f1;

  --radius-lg:22px;
  --radius-md:14px;
  --radius-sm:10px;

  --shadow-soft:0 8px 24px rgba(0,0,0,0.05);
  --shadow-card:0 10px 30px rgba(0,0,0,0.07);

  --header-h:82px;

  /* PROMO — verde scuro, chiesto dal centro il 04/08/2026. Prima era
     arancione (#ffe3c2), lo stesso tono di "richiama lei": due esiti
     diversi che a colpo d'occhio si somigliavano. Il fondo è scuro, quindi
     il testo sopra va chiaro — ovunque compaia. */
  --promo:#2f6b4a;
  --promo-fg:#ffffff;
}

html,
body{
  height:100%;
  margin:0;
  overflow:hidden;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

body{
  background:#ffffff;
  color:var(--text-main);
}

/* ================= GENERALI ================= */

button{
  border:none;
  background:#f4f4f5;
  color:var(--text-main);
  padding:10px 14px;
  border-radius:12px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:background .15s ease, transform .12s ease, box-shadow .15s ease;
  box-shadow:0 2px 8px rgba(0,0,0,0.03);
}

button:hover{
  background:#e8e8ea;
  box-shadow:0 4px 12px rgba(0,0,0,0.05);
}

button:active{
  transform:translateY(1px);
}

input,
select,
textarea{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text-main);
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
  outline:none;
}

input:focus,
select:focus,
textarea:focus{
  border-color:#a9a9b0;
  box-shadow:0 0 0 3px rgba(63,63,70,.12);
}

textarea{
  resize:vertical;
  min-height:96px;
}

/* ================= HEADER ================= */

.main-header{
  position:sticky;
  top:0;
  z-index:100;
  height:var(--header-h);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;

  padding:14px 26px;

  background:rgba(255,255,255,0.9);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border-soft);
  box-shadow:0 4px 18px rgba(0,0,0,0.04);
}

.header-left,
.header-center,
.header-right{
  display:flex;
  align-items:center;
  gap:10px;
}

.header-center{
  flex:1;
  justify-content:center;
}

.header-right{
  justify-content:flex-end;
}

.header-right button{
  white-space:nowrap;
}


.header-overflow-btn{
  width:40px;
  min-width:40px;
  padding:0;
  font-size:20px;
  line-height:1;
  letter-spacing:1px;
}

.header-logo{
  height:46px;
  width:auto;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
}

.arrow-btn{
  width:36px;
  min-width:36px;
  height:36px;
  padding:0;
  border-radius:12px;
  font-size:18px;
  line-height:1;
}

.today-btn{
  height:36px;
  padding:0 14px;
  border-radius:12px;
  font-size:13px;
  font-weight:700;
  letter-spacing:.4px;
  line-height:1;
  background:var(--accent-soft);
  color:var(--accent-dark);
}

#day-selector{
  width:144px;
  text-align:center;
  background:#ffffff;
}

.search-input-field{
  width:260px;
  background:#ffffff;
}

/* ================= HOME / PLANNER ================= */

#planner{
  position:absolute;
  top:var(--header-h);
  left:0;
  right:0;
  bottom:0;
  padding:22px 20px 20px;
  background:transparent;
  overflow:hidden;
}

#planner-scroll{
  width:100%;
  height:100%;
  overflow-x: auto;
  overflow-y: auto;
  background:#ffffff;
  border:1px solid var(--border-soft);
  border-radius:24px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    0 10px 30px rgba(0,0,0,0.04);
  position:relative;
  overscroll-behavior: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ================= CSS GRID STICKY CELLS ================= */

/* Corner: ORARIO — sticky sia in alto che a sinistra */
.sticky-corner-cell{
  position:sticky;
  top:0;
  left:0;
  z-index:90;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:700;
  color:#3c3834;
  background:var(--bg-time);
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}

/* Header servizi: sticky solo in alto */
.sticky-header-cell{
  position:sticky;
  top:0;
  z-index:80;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:700;
  color:#3c3834;
  background:var(--bg-header);
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  white-space:nowrap;
  cursor:pointer;
}

.sticky-header-cell:hover{
  background:#ebebed;
}

/* Colonna ore: sticky solo a sinistra — z-index sopra gli eventi (z-index:60) */
.sticky-time-cell{
  position:sticky;
  left:0;
  z-index:70;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:600;
  color:#6f6963;
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border-soft);
  border-top:1px solid transparent;
  background:var(--bg-time);
}

/* Grid cell */
.grid-cell{
  position:relative;
  border-right:1px solid var(--border-soft);
  border-bottom:1px solid var(--border-soft);
  border-top:1px solid transparent;
  transition:background .15s ease;
}

/* Orario fantasma in ogni cella */
.grid-cell::before{
  content:attr(data-time);
  position:absolute;
  top:3px;
  left:6px;
  font-size:10px;
  font-weight:500;
  color:rgba(0,0,0,0.32);
  pointer-events:none;
  letter-spacing:0.2px;
}

.grid-cell.out-of-shift::before{
  opacity:0.5;
}

/* Events layer: assoluto sopra la griglia */
#events-layer{
  pointer-events:none;
}

#planner-grid{
  position:relative;
  min-width:max-content;
  background:#fff;
  border-radius:22px;
  /* Non usare overflow:hidden qui — rompe position:sticky dei figli */
  /* Fix rendering su display retina durante scroll veloce */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ================= HEADER CELLS ================= */

/* Column headers: ora gestiti da .sticky-corner-cell e .sticky-header-cell */

/* ================= TIME CELLS ================= */

/* Time cells: ora gestiti da .sticky-time-cell */

/* ================= GRID CELLS ================= */

/* Le grid-cell ora usano gli stili da .grid-cell definiti nella sezione sticky */

.grid-cell:hover{
  background:#f5f5f6 !important;
}

.row-even{
  background:var(--row-even);
}

.row-odd{
  background:var(--row-odd);
}

/* ================= EVENTI ================= */


.appointment-item{
  position:absolute;
  background:#ffffff;
  border:2px solid var(--accent);
  border-radius:10px;
  padding:6px 8px;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.04),
    0 8px 18px rgba(0,0,0,0.06);
  cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  z-index:60;
  overflow:hidden;
  /* Safari: impedisce allo scroll di intercettare i touch prima del JS */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Consulenza: stesso colore su tutto il bordo, tratteggiato per distinguerla */
.appointment-item.ev-consulenza{
  border-style:dashed;
}

/* Durante il drag disabilitiamo la transition per risposta immediata */
.appointment-item.dragging{
  transition: none !important;
}

/* Durante il drag: blocca selezione testo su tutto il documento */
body.dragging,
body.dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: grabbing !important;
}
.appointment-item:hover{
  transform:translateY(-1px);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.06),
    0 10px 20px rgba(0,0,0,0.08);
}

.event-header{
  display:flex;
  align-items:baseline;
  gap:5px;
  margin-bottom:1px;
  min-width:0;
}
.event-time{
  flex:0 0 auto;
  font-size:10.5px;
  font-weight:700;
  color:var(--text-soft);
  letter-spacing:0.3px;
  opacity:0.75;
}
.event-header .event-name{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.event-name{
  font-weight:700;
  font-size:12px;
  margin-bottom:1px;
  color:#36312d;
  line-height:1.3;
}

.event-phone{
  font-size:12px;
  color:#777068;
}

.event-notes{
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:11px;
  font-weight:600;
  font-style:italic;
  color:#7a2e22;
  background:#f4c9bd;
  background-image:linear-gradient(180deg,#f6d0c5 0%,#efbeae 100%);
  padding:4px 7px;
  margin-top:5px;
  border-radius:5px;
  line-height:1.25;
  white-space:pre-wrap;
  box-shadow:0 1px 2px rgba(122,46,34,0.12), inset 0 1px 0 rgba(255,255,255,0.4);
  letter-spacing:0.1px;
}

/* Celle fuori turno — scuritimento visibile */
.grid-cell.out-of-shift{
  background:rgba(0,0,0,0.10) !important;
}

.row-even.out-of-shift{
  background:rgba(0,0,0,0.09) !important;
}

.row-odd.out-of-shift{
  background:rgba(0,0,0,0.13) !important;
}

/* Modalità incolla: cursore crosshair sulle celle vuote */
body.paste-mode .grid-cell{
  cursor: cell;
}

body.paste-mode .grid-cell:hover{
  background: rgba(63,63,70,.10) !important;
}

/* ================= MODAL ================= */

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.25);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:200;
}

/* Card base di ogni modale: sfondo, padding, angoli, ombra.
   Le varianti (.event-modal-box, .customers-modal-box, .group-manager-box)
   aggiungono solo larghezza e altezza. */
.modal-box{
  background:var(--bg-panel);
  border:1px solid var(--border-soft);
  border-radius:20px;
  padding:24px;
  box-shadow:0 24px 60px rgba(0,0,0,0.22);
  width:min(96vw, 560px);
  max-height:88vh;
  overflow-y:auto;
}

/* ================= TOAST ================= */

.toast{
  position:fixed;
  bottom:30px;
  left:50%;
  transform:translateX(-50%);
  background:#2f2b27;
  color:#fff;
  padding:12px 18px;
  border-radius:12px;
  font-size:13px;
  opacity:0;
  pointer-events:none;
  transition:.3s;
  z-index:300;
  box-shadow:0 10px 24px rgba(0,0,0,0.15);
}

.toast.show{
  opacity:1;
}

/* ================= SCROLLBAR ================= */

::-webkit-scrollbar{
  width:10px;
  height:10px;
}

::-webkit-scrollbar-thumb{
  background:#d5cec6;
  border-radius:999px;
}

::-webkit-scrollbar-thumb:hover{
  background:#c7bfb6;
}

::-webkit-scrollbar-track{
  background:#eee8e1;
}

/* ================= RESPONSIVE ================= */

/* =================================================
   RESPONSIVE — breakpoint unici e ordinati
   1280  desktop medio
   1100  laptop 13", iPad Pro landscape
    960  iPad landscape
    820  tablet portrait / iPad mini
    560  smartphone grande
    420  smartphone piccolo
================================================= */

/* ── 1280: desktop medio ── */
@media (max-width: 1280px){
  .search-input-field{ width:220px; }
}

/* ── 1100: laptop 13" / iPad Pro landscape ── */
@media (max-width: 1100px){
  .main-header{
    padding:12px 16px;
    gap:10px;
  }
  .header-logo{ height:34px; }
  .search-input-field{ width:160px; }
  #day-selector{ width:128px; }
  .header-right{ gap:6px; }
  .header-right button{
    font-size:13px;
    padding:0 10px;
    min-height:44px;
  }
  #planner{ padding:16px; }
}

/* ── 960: iPad landscape ── */
@media (max-width: 960px){
  .search-input-field{ width:140px; }
  .header-right button{
    font-size:12px;
    padding:0 8px;
  }
  #day-selector{ width:118px; }
}

/* ── 820: tablet portrait / iPad mini ── */
@media (max-width: 820px){
  :root{ --header-h:auto; }

  #planner{ top:auto; }

  html, body{ overflow:auto; }
  body{ overflow-x:hidden; }

  .main-header{
    position:relative;
    height:auto;
    padding:12px 14px;
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .header-left,
  .header-center,
  .header-right{ width:100%; }
  .header-left{ justify-content:center; }
  .header-center{
    flex:none;
    justify-content:center;
    flex-wrap:wrap;
    gap:8px;
  }
  .header-right{
    justify-content:center;
    flex-wrap:wrap;
    gap:8px;
  }
  .header-logo{ height:38px; }
  #day-selector{ width:150px; max-width:100%; }
  .search-input-field{ width:100%; max-width:400px; }
  .header-right button{
    font-size:14px;
    padding:0 12px;
    min-height:44px;
  }

  #planner{
    position:relative;
    top:auto; left:auto; right:auto; bottom:auto;
    height:calc(100svh - var(--header-measured, 180px) - 28px);
    min-height:400px;
    padding:12px;
  }
  #planner-scroll{ border-radius:18px; }

  .event-modal-box{
    width:min(96vw, 640px);
    padding:20px;
  }
}

/* ── 560: smartphone grande ── */
@media (max-width: 560px){
  .main-header{ padding:10px 10px; }
  .header-center{ gap:6px; }
  .arrow-btn{ width:34px; min-width:34px; height:34px; }
  .today-btn{ height:34px; padding:0 10px; font-size:12px; }
  #day-selector{ width:100%; max-width:none; }
  .search-input-field{ width:100%; max-width:none; }

  #planner{
    padding:8px;
    height:calc(100svh - var(--header-measured, 200px) - 16px);
  }
  #planner-scroll{ border-radius:14px; }

  .event-modal-box{
    width:calc(100vw - 12px);
    padding:16px;
    border-radius:16px;
  }
  .event-modal-actions{ flex-wrap:wrap; gap:8px; }
  .event-modal-actions button{
    flex:1 1 calc(50% - 4px);
    min-width:calc(50% - 4px);
  }

  .toast{
    width:calc(100vw - 24px);
    left:12px; right:12px;
    transform:none;
    text-align:center;
  }
}

/* ── 420: smartphone piccolo ── */
@media (max-width: 420px){
  .header-right{
    flex-direction:column;
    align-items:stretch;
  }
  .header-right button{ width:100%; }
  .header-center{
    flex-direction:column;
    align-items:stretch;
  }
  .header-center .arrow-btn{ align-self:center; }
  .header-center .today-btn{ align-self:center; }

  #planner{
    height:calc(100svh - var(--header-measured, 260px) - 12px);
  }

  .event-name{ font-size:12px; }
  .event-phone{ font-size:12px; }

  .event-modal-actions button{
    flex:1 1 100%;
    min-width:100%;
  }
}





/* ================= SCROLL PERFORMANCE ================= */
#planner-scroll{
  /* -webkit-overflow-scrolling: touch rimosso — causa moire su iOS moderno */
  scroll-behavior: auto;
}

.event-modal-box {
  width: min(94vw, 1100px);
  max-height: 92svh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px 32px;
  border-radius: 22px;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

.event-modal-title {
  margin: 0 0 18px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  color: #3f3d46;
}

.event-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  align-items: end;
}

/* Campo con didascalia sopra: si capisce cosa si sta scrivendo anche a campo pieno */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-cap {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-left: 2px;
}

/* Titoletti di sezione del modale (Cliente / Appuntamento / Note) */
.mob-section {
  display: block;
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.event-form-grid > .mob-section:first-child { margin-top: 0; }

/* Stato appuntamento / esito consulenza: un riquadro, non un muro di controlli */
.ev-block {
  grid-column: 1 / -1;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fafafa;
}

.ev-block-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.ev-misure {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.pencil-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  color: #3f3d46;
  font-size: 18px;
  padding: 16px 18px;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.pencil-input {
  min-height: 58px;
}

.pencil-textarea {
  grid-column: 1 / -1;
  min-height: 130px;
  resize: vertical;
  line-height: 1.45;
}

.pencil-input:focus,
.pencil-textarea:focus {
  border-color: #3f3f46;
  box-shadow: 0 0 0 4px rgba(63, 63, 70, 0.12);
}

.event-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}

.event-modal-actions button {
  min-width: 120px;
  min-height: 52px;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  background: #3f3f46;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.event-modal-actions button:hover {
  opacity: 0.92;
}

@media (max-width: 768px) {
  .event-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ev-block { padding: 16px; gap: 14px; }
  .ev-misure { gap: 10px; }
  .ev-spost-row { padding: 12px; }

  .pencil-textarea {
    grid-column: auto;
  }

  .event-modal-box {
    width: 94vw;
    padding: 18px;
  }

  .pencil-input,
  .pencil-textarea {
    font-size: 17px;
  }
}
/* ================= DIALOG CUSTOM ================= */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.dialog-overlay.open {
  display: flex;
}

.dialog-box {
  background:#f4f4f5;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 28px 26px 22px;
  width: min(400px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-message {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 0;
}

.dialog-input-wrap {
  width: 100%;
}

.dialog-input-wrap .pencil-input {
  font-size: 16px;
  text-align: center;
}

.dialog-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.dialog-buttons button {
  min-width: 110px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 14px;
  flex: 1;
}

.dialog-btn-primary {
  background: var(--accent) !important;
  color: #fff !important;
}

.dialog-btn-primary:hover {
  background: var(--accent-dark) !important;
}

.dialog-btn-danger {
  background: #d94f3d !important;
  color: #fff !important;
}

.dialog-btn-danger:hover {
  background: #c0402f !important;
}

@media (max-width: 560px) {
  .dialog-box {
    padding: 22px 18px 18px;
    border-radius: 16px;
  }

  .dialog-buttons button {
    min-width: calc(50% - 5px);
  }
}

/* ================= LINEA ORA CORRENTE ================= */

#current-time-line {
  pointer-events: none;
}
/* ================= IMPOSTAZIONI COLONNA ================= */

.col-settings-box {
  width: min(96vw, 740px);
  padding: 28px 30px 22px;
  border-radius: 22px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.col-settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.col-settings-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.col-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.col-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.col-color-swatch:hover {
  transform: scale(1.12);
}

.col-color-swatch.selected {
  border-color: #2f2b27;
  transform: scale(1.15);
}

.col-shift-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* Tag servizio sulla card evento */
.event-duration-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-left: 5px;
  opacity: .8;
}

.event-service-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pulsante picker servizi nel modal evento */
.ev-services-btn {
  grid-column: 1 / -1;
  text-align: left !important;
  cursor: pointer;
  min-height: 58px;
  font-size: 16px;
  color: var(--text-soft);
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  transition: border-color .15s, background .15s;
}
.ev-services-btn:hover {
  border-color: var(--accent);
  background: #fffef9;
}


.event-service-tag2 {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #1a6b6b;
  background: #d0eeee;
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Picker servizi (overlay sopra modal evento) */
.srv-picker-item {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  background: var(--bg-main);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  transition: border-color .12s, background .12s, color .12s;
  min-height: 44px;
}
.srv-picker-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.srv-picker-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}
.srv-picker-selected:hover { background: #e5d4b0; }

/* ── Modal servizi ── */

/* Contenitore unico: sezioni verticali una sotto l'altra */
.srv-two-cols {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}

/* Una sezione per categoria */
.srv-col {
  border-bottom: 1px solid var(--border-soft);
}
.srv-col:last-child { border-bottom: none; }

/* Intestazione sezione: solo una striscia sottile con accent color laterale */
.srv-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 8px;
  gap: 10px;
}

/* Accent color: solo un punto colorato + testo, niente background pieno */
.srv-col-header-1 .srv-col-title { color: var(--accent-dark); }
.srv-col-header-2 .srv-col-title { color: #1a7070; }
.srv-col-header-3 .srv-col-title { color: #7b3fa0; }
.srv-col-header-4 .srv-col-title { color: #a05020; }

/* Intestazione senza background pesante */
.srv-col-header-1,
.srv-col-header-2,
.srv-col-header-3,
.srv-col-header-4 {
  background: none;
}

.srv-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: background .12s;
  flex: 1;
}
.srv-col-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.srv-col-header-1 .srv-col-title::before { background: var(--accent); }
.srv-col-header-2 .srv-col-title::before { background: #3aadad; }
.srv-col-header-3 .srv-col-title::before { background: #b07ad0; }
.srv-col-header-4 .srv-col-title::before { background: #d08040; }

.srv-col-title:hover { background: #f0ebe3; }
.srv-col-title .srv-rename-hint {
  font-size: 12px;
  font-weight: 400;
  opacity: 0;
  transition: opacity .12s;
  margin-left: 4px;
}
.srv-col-title:hover .srv-rename-hint { opacity: .6; }

/* Pulsanti azione intestazione */
.srv-add-btn {
  background: none;
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-soft);
  transition: border-color .12s, color .12s, background .12s;
  white-space: nowrap;
}
.srv-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

/* Pulsante elimina lista: solo icona, discreta */
.srv-del-cat {
  border: none !important;
  padding: 5px 8px !important;
  color: var(--text-soft) !important;
  background: none !important;
  font-size: 14px !important;
  opacity: .4;
  transition: opacity .12s !important;
}
.srv-del-cat:hover {
  opacity: 1 !important;
  color: #c0392b !important;
  background: #fdecea !important;
}

/* Lista voci */
.srv-col-list {
  padding: 0 4px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Voce come chip/pill — non come riga intera */
.srv-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-main);
  border: 1.5px solid var(--border-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  transition: border-color .12s, background .12s;
}
.srv-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.srv-item-name { font-weight: 500; }

.srv-item-edit {
  font-size: 12px;
  color: var(--text-soft);
  opacity: 0;
  transition: opacity .12s;
}
.srv-item:hover .srv-item-edit { opacity: .7; }

.srv-empty {
  font-size: 13px;
  color: var(--text-soft);
  padding: 4px 0 10px;
  font-style: italic;
}

/* Toggle "tecnologia" sui servizi (solo Rubano) */
.srv-item-tech-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;height:22px;
  border-radius:50%;
  background:rgba(0,0,0,0.04);
  border:1.5px solid var(--border-soft);
  font-size:12px;line-height:1;
  color:var(--text-soft);
  margin-left:2px;
  cursor:pointer;
  transition:all .12s ease;
}
.srv-item-tech-toggle:hover{
  background:rgba(0,0,0,0.08);
  color:var(--text-main);
}
.srv-item-tech-toggle.on{
  background:#fff2c4;
  border-color:#d8b13b;
  color:#7a5800;
  box-shadow:0 0 0 2px rgba(216,177,59,0.18);
}
.srv-item.is-tech{
  border-color:#d8b13b;
  background:#fff8e1;
}


@media (max-width: 560px) {
  .col-settings-box {
    width: calc(100vw - 16px);
    padding: 20px 14px;
    border-radius: 16px;
  }

  .col-shift-row {
    flex-direction: column;
    gap: 10px;
  }
}
/* ── Menu badge sede ── */
.loc-menu-item {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  transition: background .1s;
}
.loc-menu-item:hover { background: var(--accent-soft); }
.loc-menu-danger { color: #c0392b; }
.loc-menu-danger:hover { background: #fdecea; }
.loc-menu-sep {
  height: 1px;
  background: var(--border-soft);
  margin: 2px 0;
}

/* ================= DESKTOP SCROLL GRAB ================= */

/* Hint visivo: cursore grab quando Alt è premuto */
#planner-scroll {
  /* Il cursore grab viene applicato via JS durante il drag */
}

/* Scrollbar desktop: visibile e cliccabile */
@media (pointer: fine) {
  #planner-scroll {
    scrollbar-width: auto;         /* Firefox */
    scrollbar-color: #b8b0a6 #e4ddd6;
  }

  #planner-scroll::-webkit-scrollbar {
    width: 14px;
    height: 14px;                  /* scrollbar orizzontale più alta */
  }

  #planner-scroll::-webkit-scrollbar-thumb {
    background: #b8b0a6;
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
    min-width: 40px;               /* thumb non troppo piccolo */
  }

  #planner-scroll::-webkit-scrollbar-thumb:hover {
    background: #9e9690;
    border: 3px solid transparent;
    background-clip: padding-box;
  }

  #planner-scroll::-webkit-scrollbar-thumb:active {
    background: #857f7a;
  }

  #planner-scroll::-webkit-scrollbar-track {
    background: #e4ddd6;
    border-radius: 999px;
  }

  #planner-scroll::-webkit-scrollbar-corner {
    background: #e4ddd6;
  }

  /* Cursore grab su sfondo griglia per indicare che si può trascinare */
  #planner-scroll {
    cursor: grab;
  }
  #planner-scroll:active {
    cursor: grabbing;
  }
  /* Ma non sugli eventi — quelli hanno il loro cursore */
  #planner-scroll .appointment-item {
    cursor: grab;
  }
  #planner-scroll .grid-cell {
    cursor: crosshair;
  }
}



/* (I titoletti .mob-section ora sono visibili anche da desktop: la regola che
   li nascondeva è stata tolta, lo stile è più su insieme al form evento.) */

/* ================= NOTAZIONE APPUNTAMENTI (dal cartaceo del cliente) =================
   Il colore riempie tutta la card. Stato appuntamento: */
/* Cliente uomo: evidenziatore azzurro (flag, priorità sotto lo stato) */
.appointment-item.ev-uomo{ background:#aedcf7 !important; }
/* Disdetta + nuovo appuntamento: doppio evidenziatore verde+rosa (come sul foglio) */
.appointment-item.stato-disdetta_nuovo{
  background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%) !important;
}
/* Consulenza spostata: doppio evidenziatore verde+rosa. Lo portano SIA
   l'appuntamento di partenza (esito "SPOST. AL") SIA quello creato in
   automatico nel nuovo giorno, così la coppia si riconosce a colpo d'occhio. */
.appointment-item.ev-spostata{
  background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%) !important;
}

/* Solo disdetta: rosa pieno */
.appointment-item.stato-disdetta{ background:#f79cc0 !important; }
/* Appuntamento in PROMO: stesso arancio della promo consulenza */
.appointment-item.stato-promo{ background:var(--promo) !important; color:var(--promo-fg) !important; }
/* Presentata (stato "venuta"): verde pieno + nome barrato (sul foglio si sbarra quando la persona arriva) */
.appointment-item.stato-venuta{ background:#bfe7a0 !important; }
.appointment-item.stato-venuta .event-name{
  text-decoration:line-through;
  text-decoration-thickness:2px;
  text-decoration-color:#2f2b27;
}
/* Non presentata senza avviso (stato "non_venuta"): grigio pieno + bordo scuro marcato (il "cerchiato") */
.appointment-item.stato-non_venuta{
  background:#e0ddd8 !important;
  box-shadow:inset 0 0 0 2.5px #2f2b27;
}
.appointment-item.stato-non_venuta .event-name{
  text-decoration:underline;
  text-decoration-style:double;
  text-underline-offset:2px;
}

.ev-badge-parziale{
  color:#d32f2f;
  font-weight:900;
  font-size:15px;
  line-height:1;
  margin-left:4px;
}
.ev-badge-prima{
  display:inline-block;
  background:#1D9E75;
  color:#fff;
  border-radius:999px;
  font-size:9.5px;
  font-weight:800;
  padding:1px 5px;
  margin-left:4px;
  line-height:1.4;
  vertical-align:1px;
}
/* Spunta "svolto" accanto al nome */
.ev-badge-svolto{
  display:inline-block;
  color:#0f7d3d;
  font-weight:900;
  font-size:13px;
  margin-left:5px;
  vertical-align:1px;
}

/* Avviso "sedute in esaurimento" sulla card dell'appuntamento — ben visibile */
.ev-sessline{ margin-top:4px; }
.ev-badge-sesslow{
  display:inline-block; background:#ff9e2c; color:#3a1c00;
  border-radius:6px; letter-spacing:.3px;
  font-size:11px; font-weight:900; padding:2px 7px; line-height:1.4;
  box-shadow:0 1px 3px rgba(0,0,0,.18);
}
.ev-badge-sessend{
  display:inline-block; background:#d94f3d; color:#fff;
  border-radius:6px; letter-spacing:.3px;
  font-size:11px; font-weight:900; padding:2px 7px; line-height:1.4;
  box-shadow:0 1px 3px rgba(0,0,0,.2);
}
/* Anello attorno alla card per farla saltare all'occhio */
.appointment-item.card-sesslow{
  box-shadow:0 0 0 2.5px #ff9e2c, 0 6px 16px rgba(0,0,0,0.10) !important;
}
.appointment-item.card-sessend{
  box-shadow:0 0 0 2.5px #d94f3d, 0 6px 16px rgba(0,0,0,0.10) !important;
}

/* ================= CONSULENZE ================= */
.ev-consulenza-tag,
.ev-app-tag{
  display:inline-block;
  font-size:9.5px;
  font-weight:800;
  letter-spacing:.4px;
  color:#3a352c;
  background:rgba(255,255,255,0.55);
  border-radius:6px;
  padding:1px 6px;
  margin:2px 0 1px;
}
.ev-promo-tag{
  background:var(--promo);
  color:var(--promo-fg);
  border-radius:6px;
  padding:0 5px;
  font-weight:800;
}
/* Colore pieno della card per esito consulenza (evidenzia com'è andata) */
.appointment-item.esito-ok{ background:#b7e59a !important; }
.appointment-item.esito-promo{ background:var(--promo) !important; color:var(--promo-fg) !important; }
.appointment-item.esito-miss{ background:#ddd7cf !important; }
.appointment-item.esito-risp{ background:#e6f2a8 !important; }
.appointment-item.esito-spost{ background:#ffe9a3 !important; }
.appointment-item.esito-richiama{ background:#ffd9a8 !important; }
.appointment-item.esito-nv{ background:#f4ab9c !important; }
.appointment-item.esito-nr{ background:#cfcac3 !important; }
/* Consulenza con solo PROMO (nessun esito): arancio tenue */
.appointment-item.cons-promo{ background:var(--promo) !important; color:var(--promo-fg) !important; }

/* Riga flag nel modal evento */
.ev-flags-row{ display:flex; gap:16px; flex-wrap:wrap; }
.ev-flag{
  display:flex;
  align-items:center;
  gap:7px;
  font-size:13.5px;
  color:var(--text-main);
  cursor:pointer;
  white-space:nowrap;
}
.ev-flag input[type="checkbox"]{ width:17px; height:17px; cursor:pointer; }

/* ================= HEADER A DUE LIVELLI (maxi-colonna servizio + numeri) ================= */
.group-header-cell{
  position:sticky;
  top:0;
  z-index:80;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:800;
  letter-spacing:.6px;
  color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,.18);
  background:var(--bg-header);
  border-right:1px solid rgba(255,255,255,.35);
  border-bottom:1px solid var(--border);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sub-header-cell{
  position:sticky;
  top:34px;   /* GROUP_HEADER_HEIGHT */
  z-index:80;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12.5px;
  font-weight:800;
  color:#3c3834;
  background:var(--bg-header);
  border-right:1px solid var(--border-soft);
  border-bottom:1px solid var(--border);
  cursor:pointer;
}

.sub-header-cell:hover{
  filter:brightness(0.94);
}

/* ================= CLIENTI (anagrafica) ================= */
.customers-modal-box{ width:min(96vw, 780px); max-height:90vh; display:flex; flex-direction:column; }

/* Aprendo una scheda cliente si nasconde la lista, la ricerca e "+ Nuovo":
   resta solo la scheda (e Chiudi). */
.customers-modal-box.form-open #customers-list,
.customers-modal-box.form-open #customers-search,
.customers-modal-box.form-open #customers-new-btn{ display:none !important; }
.customers-modal-box.form-open .customer-form{ margin-top:6px; border-top:none; padding-top:0; }

/* Riga pacchetto nel form cliente: sedute · prezzo · data · spunta discreta */
.cf-pkg-add-3{ grid-template-columns:1fr 1fr 1fr auto !important; }

/* La spunta non ha etichetta e riprende il grigio dei bordi: si vede solo se
   la si cerca. Chi deve usarla sa dov'è; per tutti gli altri è un dettaglio
   del modulo. Area di tocco piena (44px) anche se il quadratino è piccolo. */
.cf-pk-flag{
  display:flex; align-items:center; justify-content:center;
  width:44px; min-height:46px; cursor:pointer; user-select:none;
}
.cf-pk-flag input{
  width:15px; height:15px; margin:0; cursor:pointer;
  accent-color:var(--text-soft, #8a8f98);
  opacity:.45; transition:opacity .15s ease;
}
.cf-pk-flag:hover input, .cf-pk-flag input:checked{ opacity:1; }
.cf-pk-flag input:focus-visible{ outline:2px solid var(--text-soft, #8a8f98); outline-offset:2px; }
.customers-header{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; flex-wrap:wrap; margin-bottom:16px;
}
.customers-list{ overflow-y:auto; flex:1; display:flex; flex-direction:column; gap:6px; min-height:120px; }
.customer-row{
  display:flex; flex-direction:column; gap:2px;
  padding:11px 14px; border:1px solid var(--border-soft); border-radius:12px;
  background:#fff; cursor:pointer; transition:background .12s ease, border-color .12s ease;
}
.customer-row:hover{ background:var(--accent-soft); border-color:var(--accent); }
.customer-row-main{ display:flex; align-items:center; gap:8px; }
.customer-row-name{ font-size:15px; font-weight:700; color:var(--text-main); }
.customer-row-meta{ font-size:13px; color:var(--text-soft); }
.customers-empty{ padding:28px 12px; text-align:center; color:var(--text-soft); font-size:14px; }

.customer-sex-badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:20px; height:20px; padding:0 5px; border-radius:6px;
  font-size:11px; font-weight:800; color:#fff;
}
.customer-sex-badge.sex-f{ background:#D4537E; }
.customer-sex-badge.sex-m{ background:#378ADD; }

.customer-form{
  margin-top:16px; border-top:1px solid var(--border-soft); padding-top:16px;
}

/* CRM nel form cliente: PT / obiettivo / pacchetti */
.cf-crm-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:16px 18px; margin-top:16px;
}
.cf-packages-block{
  margin-top:16px; padding-top:14px; border-top:1px dashed var(--border-soft);
}
@media (max-width:560px){
  .cf-crm-grid{ grid-template-columns:1fr; }
}

/* Suggerimenti autocomplete nel modal appuntamento */
.ev-suggestions{
  border:1px solid var(--border-soft); border-radius:12px; overflow:hidden;
  background:#fff; box-shadow:0 6px 18px rgba(0,0,0,0.06); max-height:230px; overflow-y:auto;
}
.ev-suggestion-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 13px; cursor:pointer; border-bottom:1px solid var(--border-soft);
}
.ev-suggestion-row:last-child{ border-bottom:none; }
.ev-suggestion-row:hover{ background:var(--accent-soft); }
.ev-suggestion-name{ font-size:14px; font-weight:600; color:var(--text-main); display:flex; align-items:center; gap:7px; }
.ev-suggestion-meta{ font-size:13px; color:var(--text-soft); white-space:nowrap; }
.ev-suggestion-add{
  padding:11px 13px; cursor:pointer; font-size:14px; font-weight:700;
  color:var(--accent-dark); background:var(--accent-soft);
}
.ev-suggestion-add:hover{ background:#e7d7b8; }

/* Il modal clienti sta sopra il modal appuntamento */
#customers-modal{ z-index:200; }
#group-manager-modal{ z-index:200; }

/* ================= GESTIONE GRUPPO COLONNE ================= */
.group-manager-box{ width:min(96vw, 560px); max-height:88vh; overflow-y:auto; }
.gm-section{ margin:16px 0; }
.gm-label{ font-size:13px; font-weight:700; color:var(--text-soft); margin-bottom:8px; letter-spacing:.3px; }
.gm-columns{ display:flex; flex-direction:column; gap:6px; }
.gm-col-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:9px 13px; border:1px solid var(--border-soft); border-radius:11px; background:#fff;
}
.gm-col-name{ font-size:15px; font-weight:700; color:var(--text-main); }
.gm-col-actions{ display:flex; gap:8px; }
.gm-btn-rename, .gm-btn-del{
  padding:7px 13px; border-radius:9px; font-size:13px; font-weight:600; cursor:pointer; border:none;
}
.gm-btn-rename{ background:#eee7de; color:var(--text-main); }
.gm-btn-del{ background:#f4d9d0; color:#a3341a; }

.col-color-swatches{ display:flex; flex-wrap:wrap; gap:9px; }
.col-color-swatch{
  width:34px; height:34px; border-radius:9px; cursor:pointer; padding:0;
  border:2px solid transparent; box-shadow:0 1px 3px rgba(0,0,0,0.12);
}
.col-color-swatch.selected{ border-color:var(--text-main); outline:2px solid #fff; outline-offset:-4px; }

/* Storico appuntamenti nella scheda cliente */
.customer-appointments{ margin-top:16px; border-top:1px solid var(--border-soft); padding-top:12px; }
.customer-appt-list{ display:flex; flex-direction:column; gap:5px; max-height:200px; overflow-y:auto; margin-top:6px; }
.customer-appt-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:8px 12px; border-radius:9px; background:#fff; border:1px solid var(--border-soft);
  font-size:13.5px;
}
.customer-appt-row.past{ opacity:.55; }
.customer-appt-when{ font-weight:600; color:var(--text-main); }
.customer-appt-col{ color:var(--text-soft); font-size:12.5px; }

/* =====================================================================
   HOME (index.html) — logo dell'istituto + accesso ad Agenda e Resoconto
   ===================================================================== */

.home-body{
  overflow:auto;
  background:#faf9f7;
}

.home{
  min-height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:34px;
  padding:56px 22px 72px;
}

.home-logo{
  width:min(340px,72vw);
  height:auto;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
}

.home-nav{
  display:flex;
  flex-direction:column;
  gap:14px;
  width:min(420px,100%);
}

.home-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:66px;
  padding:0 24px;
  border-radius:18px;
  background:#fff;
  border:1px solid var(--border-soft);
  box-shadow:var(--shadow-soft);
  color:var(--text-main);
  font-size:19px;
  font-weight:700;
  letter-spacing:.6px;
  text-decoration:none;
  transition:transform .12s ease, box-shadow .15s ease, background .15s ease;
}

.home-btn:hover{
  background:#fff;
  box-shadow:var(--shadow-card);
  transform:translateY(-1px);
}

.home-btn:active{ transform:translateY(1px); }

.home-btn-primary{
  background:#639922;
  border-color:#5a8b1f;
  color:#fff;
  font-size:21px;
}

.home-btn-primary:hover{ background:#6faa27; }

/* Tre scale di verde: Agenda (scuro) → Report (medio) → CRM (chiaro).
   Testo sempre bianco; ombra sottile per restare leggibile anche sul verde chiaro. */
.home-btn-agenda,
.home-btn-report,
.home-btn-crm{
  color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,0.28);
}
.home-btn-agenda{ background:#5d8f1f; border-color:#517d1b; font-size:21px; }
.home-btn-agenda:hover{ background:#6aa125; }
.home-btn-report{ background:#82b539; border-color:#72a231; }
.home-btn-report:hover{ background:#8fc245; }
.home-btn-crm{ background:#a6ce62; border-color:#95bd52; }
.home-btn-crm:hover{ background:#b1d870; }

/* Chiude la sessione senza passare dal CRM: serve a chi lascia il tablet in
   sala e vuole richiudere la porta prima di andarsene. Volutamente defilato —
   nell'uso normale la sessione scade da sola a fine giornata. */
.home-exit{
  margin-top:28px;
  background:none; border:none; cursor:pointer;
  font-size:13px; font-weight:600; letter-spacing:.04em;
  color:var(--text-soft, #8a8580); text-decoration:underline;
  text-underline-offset:3px; padding:8px 12px;
}
.home-exit:hover{ color:#c0392b; }

/* Link che vivono nell'header accanto ai bottoni (Home / Agenda / Resoconto) */
.header-link{
  display:inline-flex;
  align-items:center;
  padding:10px 14px;
  border-radius:12px;
  background:#f4f4f5;
  color:var(--text-main);
  font-size:14px;
  font-weight:600;
  text-decoration:none;
  white-space:nowrap;
  box-shadow:0 2px 8px rgba(0,0,0,0.03);
}

.header-link:hover{ background:#e8e8ea; }

/* =====================================================================
   MODAL EVENTO — spostamento consulenza e personal trainer
   ===================================================================== */

.ev-spost-row{
  display:grid;
  grid-template-columns:auto 1fr 1fr;
  align-items:center;
  gap:12px;
  padding:16px;
  border:1px solid var(--border-soft);
  border-radius:14px;
  background:#fff;
}

.ev-spost-label{
  font-size:13px;
  font-weight:600;
  color:var(--text-soft);
  white-space:nowrap;
}

.ev-spost-hint{
  grid-column:1/-1;
  font-size:12px;
  color:var(--text-soft);
  line-height:1.4;
}

.ev-pt-row{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:12px;
}

.ev-pt-add{
  white-space:nowrap;
  min-height:44px;
}

/* Sigla del PT sulla card della consulenza */
.ev-pt-tag{
  color:#1f3f5c;
  background:#d6e6f5;
  border-radius:6px;
  padding:0 5px;
  font-weight:800;
}

/* =====================================================================
   RESOCONTO (resoconto.html)
   ===================================================================== */

.report-body{ overflow:auto; background:#faf9f7; }

/* Interruttore Giornaliero / Settimanale */
.mode-switch{
  display:inline-flex;
  background:#f4f4f5;
  border-radius:12px;
  padding:3px;
  gap:3px;
}

.mode-switch button{
  background:transparent;
  box-shadow:none;
  padding:8px 16px;
  border-radius:10px;
  font-size:13.5px;
  color:var(--text-soft);
}

.mode-switch button.is-active{
  background:#fff;
  color:var(--text-main);
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
}

.report{
  max-width:1400px;
  margin:0 auto;
  padding:26px 26px 70px;
}

.report-title{
  font-size:24px;
  font-weight:800;
  letter-spacing:.3px;
  margin-bottom:26px;
}

.report-section{ margin-bottom:34px; }

/* Bande che separano APPUNTAMENTI e CONSULENZE */
.report-band{
  border:1px solid var(--border-soft);
  border-radius:20px;
  background:#fff;
  box-shadow:var(--shadow-soft);
  padding:20px 22px 24px;
}
.report-band-title{
  font-size:20px; font-weight:800; letter-spacing:.3px; color:var(--text-main);
  margin-bottom:16px; padding-bottom:12px; border-bottom:2px solid var(--border-soft);
}
.report-band h3.report-h2{ margin-bottom:12px; }

/* Colori tessere/righe per stato appuntamento (come in agenda) */
.tile.appt-venuta,         .tile.appt-venuta:hover{ background:#bfe7a0; }
.tile.appt-non_venuta,     .tile.appt-non_venuta:hover{ background:#e0ddd8; }
.tile.appt-disdetta_nuovo, .tile.appt-disdetta_nuovo:hover{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.tile.appt-disdetta,       .tile.appt-disdetta:hover{ background:#f79cc0; }
.tile.appt-promo,          .tile.appt-promo:hover{ background:var(--promo); color:var(--promo-fg); }

.badge-app-venuta{ background:#bfe7a0; }
.badge-app-non_venuta{ background:#e0ddd8; }
.badge-app-disdetta_nuovo{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.badge-app-disdetta{ background:#f79cc0; }
.badge-app-promo{ background:var(--promo); color:var(--promo-fg); }

.report-h2{
  font-size:12px;
  font-weight:800;
  letter-spacing:1.4px;
  text-transform:uppercase;
  color:var(--text-soft);
  margin-bottom:12px;
}

.report-h2-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.report-h2-row .report-h2{ margin-bottom:0; }

.report-filters{ display:flex; gap:10px; }
.report-filters select{ width:auto; min-width:170px; min-height:42px; font-size:14px; }

/* --- Tessere di riepilogo --- */
.tiles{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(132px,1fr));
  gap:12px;
}

/* Riepilogo diviso: Appuntamenti vs Consulenze */
.kpi-split{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.kpi-group{
  border:1px solid var(--border-soft); border-radius:16px; background:#fff;
  box-shadow:var(--shadow-soft); padding:16px 16px 18px;
}
.kpi-group-cap{
  font-size:13px; font-weight:800; letter-spacing:.4px; color:var(--text-main);
  margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border-soft);
}
.kpi-group .tiles{ grid-template-columns:repeat(auto-fill,minmax(108px,1fr)); gap:10px; }
@media (max-width:760px){ .kpi-split{ grid-template-columns:1fr; } }

/* Ogni tessera è un pulsante: porta alla sezione col dettaglio di quell'esito */
.tile{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
  width:100%;
  text-align:left;
  border:1px solid var(--border-soft);
  border-radius:16px;
  padding:16px 16px 14px;
  background:#fff;
  box-shadow:var(--shadow-soft);
  cursor:pointer;
  transition:transform .12s ease, box-shadow .15s ease;
}

.tile:hover{
  box-shadow:var(--shadow-card);
  transform:translateY(-2px);
}

.tile:active{ transform:translateY(0); }

.tile:focus-visible{ outline:2px solid var(--text-main); outline-offset:2px; }

/* Nessuna consulenza in quella categoria: niente sezione dove andare */
.tile-empty{
  cursor:default;
  opacity:.45;
  box-shadow:none;
}

.tile-empty:hover{ transform:none; box-shadow:none; }

.tile-value{
  font-size:30px;
  font-weight:800;
  line-height:1.1;
  color:var(--text-main);
}

.tile-label{
  font-size:11.5px;
  font-weight:700;
  letter-spacing:.7px;
  text-transform:uppercase;
  color:var(--text-soft);
}

/* Stessi colori delle card in agenda: l'esito si riconosce a colpo d'occhio.
   Il testo resta in inchiostro scuro, mai nel colore dell'esito. */
.tile.tile-total,
.tile.tile-total:hover{ background:var(--text-main); }
.tile-total .tile-value{ color:#fff; font-size:34px; }
.tile-total .tile-label{ color:rgba(255,255,255,.72); }
.tile.tile-esito-ok,       .tile.tile-esito-ok:hover{ background:#b7e59a; }
.tile.tile-esito-promo,    .tile.tile-esito-promo:hover{ background:var(--promo); color:var(--promo-fg); }
.tile.tile-esito-miss,     .tile.tile-esito-miss:hover{ background:#ddd7cf; }
.tile.tile-esito-risp,     .tile.tile-esito-risp:hover{ background:#e6f2a8; }
.tile.tile-esito-spost,    .tile.tile-esito-spost:hover{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.tile.tile-esito-richiama, .tile.tile-esito-richiama:hover{ background:#ffd9a8; }
.tile.tile-esito-nv,       .tile.tile-esito-nv:hover{ background:#f4ab9c; }
.tile.tile-esito-nr,       .tile.tile-esito-nr:hover{ background:#cfcac3; }
.tile.tile-promo,          .tile.tile-promo:hover{ background:var(--promo); color:var(--promo-fg); }
.tile.tile-qds,            .tile.tile-qds:hover{ background:#d6e6f5; }
.tile.tile-muted,          .tile.tile-muted:hover{ background:#f4f4f5; }

/* --- Tabelle --- */
.table-scroll{
  overflow-x:auto;
  border:1px solid var(--border-soft);
  border-radius:16px;
  background:#fff;
  box-shadow:var(--shadow-soft);
}

.report-table{
  width:100%;
  border-collapse:collapse;
  font-size:13.5px;
}

.report-table th,
.report-table td{
  padding:11px 14px;
  text-align:left;
  border-bottom:1px solid #ececed;
  white-space:normal;
}

.report-table thead th{
  position:sticky;
  top:0;
  background:#f7f7f8;
  font-size:11px;
  font-weight:800;
  letter-spacing:.8px;
  text-transform:uppercase;
  color:var(--text-soft);
  white-space:nowrap;
}

.report-table tbody tr:last-child td{ border-bottom:none; }
.report-table tbody tr:hover{ background:#fafafa; }
.report-table tfoot td{
  border-top:2px solid var(--border-soft);
  border-bottom:none;
  background:#fafafa;
  font-weight:700;
}

.report-table .num{ text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.report-table .strong{ font-weight:700; }
.report-table .nowrap{ white-space:nowrap; }
.report-table .notes{ color:var(--text-soft); max-width:280px; }
.report-table .row-muted td{ color:var(--text-soft); }
.report-table .empty{
  text-align:center;
  color:var(--text-soft);
  padding:34px 14px;
}

/* --- Etichette esito / flag nel dettaglio --- */
.badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:7px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.4px;
  white-space:nowrap;
  color:var(--text-main);
}

.badge-ok{ background:#b7e59a; }
.badge-miss{ background:#ddd7cf; }
.badge-risp{ background:#e6f2a8; }
.badge-spost{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.badge-richiama{ background:#ffd9a8; }
.badge-nv{ background:#f4ab9c; }
.badge-nr{ background:#cfcac3; }
.badge-promo{ background:var(--promo); color:var(--promo-fg); }
.badge-qds{ background:#d6e6f5; color:#1f3f5c; }
.badge-done{ background:#e6f2a8; }
.badge-muted{ background:#f0f0f1; color:var(--text-soft); }

@media (max-width:760px){
  .report{ padding:18px 14px 60px; }
  .report-title{ font-size:19px; margin-bottom:18px; }
  .tiles{ grid-template-columns:repeat(auto-fill,minmax(108px,1fr)); }
  .tile-value{ font-size:24px; }
  .report-filters{ width:100%; }
  .report-filters select{ flex:1; min-width:0; }
  .ev-spost-row{ grid-template-columns:1fr; }
  .ev-pt-row{ grid-template-columns:auto 1fr auto; }
}

/* I link dell'header seguono le stesse riduzioni dei bottoni ai vari breakpoint */
@media (max-width:1100px){
  .header-link{ font-size:13px; padding:0 10px; min-height:44px; }
}
@media (max-width:960px){
  .header-link{ font-size:12px; padding:0 8px; }
}
@media (max-width:820px){
  .header-link{ font-size:14px; padding:0 12px; min-height:44px; }
}

/* --- Sezioni di dettaglio raggiungibili dalle tessere --- */
.detail-section{
  /* l'header è sticky: senza margine la sezione finirebbe sotto di esso */
  scroll-margin-top:100px;
  border-radius:18px;
  padding:10px;
  margin-left:-10px;
  margin-right:-10px;
  transition:background .5s ease;
}

/* Lampeggio breve all'arrivo: dice dove sei atterrato */
.detail-section.is-target{ background:#f0efec; }

.sez-dot{
  display:inline-block;
  width:11px;
  height:11px;
  border-radius:4px;
  margin-right:8px;
  vertical-align:-1px;
  border:1px solid rgba(0,0,0,.12);
}

/* La pastiglia colorata riusa le classi delle tessere, ma senza il loro box */
.sez-dot.tile-total{ background:var(--text-main); }
.sez-dot.tile-empty{ opacity:1; }

.link-btn{
  background:transparent;
  box-shadow:none;
  color:var(--text-soft);
  font-size:12.5px;
  padding:6px 10px;
}

.link-btn:hover{ background:#f0f0f1; }

@media (max-width:820px){
  .detail-section{ scroll-margin-top:16px; }
}

/* --- Telefono: il resoconto resta leggibile --- */
@media (max-width:560px){
  .report{ padding:14px 10px 50px; }
  .tiles{ grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:8px; }
  .tile{ padding:12px 12px 10px; border-radius:13px; }
  .tile-value{ font-size:21px; }
  .tile-label{ font-size:10px; letter-spacing:.4px; }
  .report-table th,
  .report-table td{ padding:9px 10px; font-size:12.5px; }
  .report-table .notes{ max-width:170px; }
  .mode-switch button{ padding:8px 12px; font-size:12.5px; }
  .home-logo{ width:min(280px,80vw); }
  .home-btn{ min-height:60px; font-size:17px; }
  .home-btn-primary{ font-size:19px; }
}

/* Pastiglie colorate nei titoli delle sezioni (stessi colori delle tessere) */
.sez-dot.tile-esito-ok{ background:#b7e59a; }
.sez-dot.tile-esito-promo{ background:var(--promo); }
.sez-dot.tile-esito-miss{ background:#ddd7cf; }
.sez-dot.tile-esito-risp{ background:#e6f2a8; }
.sez-dot.tile-esito-spost{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.sez-dot.tile-esito-richiama{ background:#ffd9a8; }
.sez-dot.tile-esito-nv{ background:#f4ab9c; }
.sez-dot.tile-esito-nr{ background:#cfcac3; }
.sez-dot.tile-promo{ background:var(--promo); }
.sez-dot.tile-qds{ background:#d6e6f5; }
.sez-dot.tile-muted{ background:#f4f4f5; }

/* Etichetta sulla copia creata da uno spostamento: dice da dove arriva */
.ev-spost-tag{
  color:#7a2f4d;
  background:#fbd9e6;
  border-radius:6px;
  padding:0 5px;
  font-weight:800;
}

/* =====================================================================
   CRM (crm.html) — shell con sidebar e viste multiple
   ===================================================================== */

.crm-body{ background:#f3f2ef; height:100%; overflow:hidden; }
.crm-shell{ display:flex; height:100vh; height:100svh; }

/* --- Sidebar --- */
.crm-sidebar{
  flex:0 0 232px; width:232px; background:#fff; border-right:1px solid var(--border-soft);
  display:flex; flex-direction:column; padding:18px 14px; gap:6px; overflow-y:auto;
}
.crm-brand{ display:flex; align-items:center; justify-content:center; padding:6px 8px 14px; }
.crm-brand img{ height:40px; width:auto; }
.crm-nav{ display:flex; flex-direction:column; gap:3px; flex:1; }
.crm-nav-cap{ font-size:10.5px; font-weight:800; letter-spacing:1px; text-transform:uppercase; color:var(--text-soft); margin:14px 8px 4px; }
.crm-nav-item{ text-align:left; background:transparent; box-shadow:none; border-radius:11px; padding:11px 13px; font-size:14px; font-weight:600; color:var(--text-main); }
.crm-nav-item:hover{ background:var(--accent-soft); }
.crm-nav-item.is-active, .crm-nav-item.is-active:hover{ background:#5d8f1f; color:#fff; }
.crm-back{ margin-top:8px; text-align:center; padding:10px; border-radius:11px; font-size:13px; font-weight:600; color:var(--text-soft); text-decoration:none; }
.crm-back:hover{ background:var(--accent-soft); color:var(--text-main); }

/* --- Main --- */
.crm-main{ flex:1; min-width:0; display:flex; flex-direction:column; height:100%; }
.crm-topbar{
  flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px 26px; background:rgba(255,255,255,0.92); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border-soft);
}
.crm-view-title{ font-size:22px; font-weight:800; color:var(--text-main); }
.crm-view-sub{ font-size:13px; color:var(--text-soft); margin-top:2px; }
.crm-topbar-actions{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.crm-period{ display:flex; align-items:center; gap:6px; font-size:13px; color:var(--text-soft); }
.crm-period input{ width:140px; min-height:40px; }
.crm-preset{ display:inline-flex; background:#eceae6; border-radius:11px; padding:3px; gap:3px; }
.crm-preset button{ background:transparent; box-shadow:none; padding:8px 14px; border-radius:9px; font-size:13px; font-weight:700; color:var(--text-soft); }
.crm-preset button:hover{ background:rgba(255,255,255,.5); }
.crm-preset button.is-active{ background:#fff; color:var(--text-main); box-shadow:0 2px 6px rgba(0,0,0,.08); }
.crm-view{ flex:1; overflow-y:auto; padding:24px 26px 60px; }

.crm-section-cap{ font-size:12px; font-weight:800; letter-spacing:1px; text-transform:uppercase; color:var(--text-soft); margin:6px 0 12px; }
.crm-section-cap:not(:first-child){ margin-top:26px; }
.crm-hint{ font-size:12px; color:var(--text-soft); line-height:1.5; margin-top:8px; }
.crm-empty{ padding:26px 14px; text-align:center; color:var(--text-soft); font-size:14px; border:1px dashed var(--border-soft); border-radius:16px; background:#fff; }
.crm-muted{ color:var(--text-soft); }

/* --- Panoramica: cards entrate --- */
.crm-cards{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; }
.crm-card{ border:1px solid var(--border-soft); border-radius:16px; padding:18px 18px 16px; background:#fff; box-shadow:var(--shadow-soft); }
.crm-card-v{ font-size:26px; font-weight:800; color:var(--text-main); line-height:1.1; }
.crm-card-l{ font-size:12.5px; font-weight:700; color:var(--text-main); margin-top:6px; }
.crm-card-note{ font-size:11.5px; color:var(--text-soft); margin-top:3px; }
/* Card neutre: l'accento di colore lo tengono solo il fatturato (verde) e le
   azioni di vendita (rosso), gli unici numeri dove il colore aggiunge senso. */
.crm-card.accent-money{ border-left:4px solid #5d8f1f; } .crm-card.accent-money .crm-card-v{ color:#3f7a1a; }
.crm-card.accent-warn{ border-left:4px solid #d24b3a; } .crm-card.accent-warn .crm-card-v{ color:#c0392b; }

/* mini KPI row */
.crm-mini-row{ display:flex; flex-wrap:wrap; gap:10px; }
.crm-mini{ flex:1 1 120px; border:1px solid var(--border-soft); border-radius:13px; background:#fff; padding:12px 14px; display:flex; flex-direction:column; gap:3px; box-shadow:var(--shadow-soft); }
.crm-mini-v{ font-size:19px; font-weight:800; color:var(--text-main); }
.crm-mini-l{ font-size:11px; font-weight:700; letter-spacing:.3px; text-transform:uppercase; color:var(--text-soft); }
.crm-mini-blue .crm-mini-v{ color:#2f6fe0; } .crm-mini-black .crm-mini-v{ color:#161616; }

/* --- Filtri --- */
.crm-filters{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.crm-filters .pencil-input{ min-height:44px; width:auto; min-width:170px; flex:0 0 auto; }
.crm-filters #cli-search{ flex:1 1 220px; }

/* --- Tabella clienti --- */
.crm-cli-row{ cursor:pointer; }
.crm-cli-row:hover{ background:#f6f8f2 !important; }
.crm-ptlink{ font-size:11px; font-weight:700; color:#5d8f1f; margin-left:6px; opacity:0; transition:opacity .12s; }
.crm-cli-row:hover .crm-ptlink{ opacity:1; }

/* --- Pipeline --- */
.crm-pipeline{ display:flex; gap:14px; overflow-x:auto; padding-bottom:8px; align-items:flex-start; }
.crm-pipe-col{ flex:0 0 230px; width:230px; background:#fff; border:1px solid var(--border-soft); border-radius:14px; overflow:hidden; }
.crm-pipe-head{ display:flex; align-items:center; justify-content:space-between; padding:10px 13px; font-size:12.5px; font-weight:800; color:#fff; }
.crm-pipe-count{ background:rgba(255,255,255,.3); border-radius:999px; padding:1px 8px; font-size:12px; }
.crm-pipe-head.st-grey{ background:#8d8880; } .crm-pipe-head.st-green{ background:#6fb43a; }
.crm-pipe-head.st-amber{ background:#e0942a; } .crm-pipe-head.st-red{ background:#d24b3a; }
.crm-pipe-head.st-orange{ background:#d9720f; } .crm-pipe-head.st-blue{ background:#2f6fe0; }
.crm-pipe-head.st-black{ background:#1c1c1c; }
.crm-pipe-body{ padding:8px; display:flex; flex-direction:column; gap:7px; max-height:62vh; overflow-y:auto; }
.crm-pipe-card{ border:1px solid var(--border-soft); border-radius:10px; padding:9px 10px; cursor:pointer; background:#fff; transition:border-color .12s; }
.crm-pipe-card:hover{ border-color:var(--accent); }
.crm-pipe-name{ display:flex; align-items:center; gap:6px; font-size:13.5px; font-weight:700; color:var(--text-main); }
.crm-pipe-meta{ display:flex; align-items:center; gap:8px; margin-top:5px; font-size:11.5px; color:var(--text-soft); }

/* --- Split (attività / affluenza) --- */
.crm-split{ display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
.crm-split-col{ min-width:0; }

/* --- Barre affluenza --- */
.crm-bars{ display:flex; flex-direction:column; gap:7px; }
.crm-bar-row{ display:flex; align-items:center; gap:10px; }
.crm-bar-lbl{ flex:0 0 46px; font-size:12px; font-weight:700; color:var(--text-soft); text-align:right; }
.crm-bar-lbl-wide{ flex-basis:120px; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-bar{ flex:1; height:16px; background:#ece7e0; border-radius:999px; overflow:hidden; }
.crm-bar-fill{ height:100%; background:#6fb43a; border-radius:999px; }
.crm-bar-val{ flex:0 0 32px; font-size:12px; font-weight:700; color:var(--text-main); }

/* --- Tag / pallini / badge --- */
.crm-pt-tag{ display:inline-flex; align-items:center; font-size:11px; font-weight:800; color:#1f3f5c; background:#d6e6f5; border-radius:7px; padding:2px 8px; letter-spacing:.3px; }
.crm-btn-primary{ background:var(--accent) !important; color:#fff !important; border:none; border-radius:11px; padding:10px 15px; font-size:13.5px; font-weight:700; cursor:pointer; white-space:nowrap; }
.crm-btn-primary:hover{ background:var(--accent-dark) !important; }
.crm-cell-warn{ color:#c0392b; font-weight:800; } .crm-cell-blue{ color:#2f6fe0; font-weight:700; } .crm-cell-black{ color:#1c1c1c; font-weight:700; }
.crm-status-dot{ display:inline-block; width:12px; height:12px; border-radius:50%; flex:0 0 auto; box-shadow:0 0 0 2px rgba(0,0,0,.05); vertical-align:-1px; margin-right:2px; }
.dot-blue{ background:#2f6fe0; } .dot-black{ background:#161616; } .dot-active{ background:#cfc9c1; }
.crm-constancy{ display:inline-flex; align-items:center; gap:3px; }
.crm-dot{ width:8px; height:8px; border-radius:50%; }
.crm-prog{ display:flex; flex-direction:column; gap:4px; }
.crm-prog-bar{ height:8px; border-radius:999px; background:#ece7e0; overflow:hidden; }
.crm-prog-fill{ height:100%; border-radius:999px; background:#6fb43a; } .crm-prog-fill.full{ background:#2f6fe0; }
.crm-prog-txt{ font-size:11.5px; color:var(--text-soft); font-weight:600; }
.crm-prog-lg{ margin:6px 0 18px; } .crm-prog-lg .crm-prog-bar{ height:11px; }
.crm-nopack{ font-size:12px; color:var(--text-soft); font-style:italic; }
.crm-badge{ display:inline-block; padding:2px 7px; border-radius:6px; font-size:10px; font-weight:800; letter-spacing:.4px; }
.crm-badge-sale{ background:#f7c9c2; color:#a2251a; } .crm-badge-finished{ background:#f7cfae; color:#8a4110; } .crm-badge-half{ background:#f6e2a1; color:#7d6100; }
.crm-badge-promo{ background:var(--promo); color:var(--promo-fg); }
.crm-badge-esito-ok{ background:#b7e59a; } .crm-badge-esito-promo{ background:var(--promo); color:var(--promo-fg); } .crm-badge-esito-miss{ background:#ddd7cf; }
.crm-badge-esito-risp{ background:#e6f2a8; } .crm-badge-esito-spost{ background:#f79cc0; } .crm-badge-esito-richiama{ background:#ffd9a8; }
.crm-badge-esito-nv{ background:#f4ab9c; } .crm-badge-esito-nr{ background:#cfcac3; } .crm-badge-esito-none{ background:#f0f0f1; color:var(--text-soft); }
.crm-badge-app-venuta{ background:#bfe7a0; } .crm-badge-app-non_venuta{ background:#e0ddd8; }
.crm-badge-app-disdetta_nuovo{ background:linear-gradient(180deg,#a9e07f 0%,#a9e07f 50%,#f79cc0 50%,#f79cc0 100%); }
.crm-badge-app-disdetta{ background:#f79cc0; } .crm-badge-app-promo{ background:var(--promo); color:var(--promo-fg); }

/* --- Scheda cliente (modal) --- */
.crm-detail-box{ width:min(96vw, 950px); max-height:94vh; overflow-y:auto; padding:30px 34px; }
.crm-detail-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:14px; }
.crm-detail-name{ font-size:22px; font-weight:800; color:var(--text-main); display:flex; align-items:center; gap:10px; }
.crm-detail-contact{ font-size:13.5px; color:var(--text-soft); margin-top:4px; }
.crm-close{ flex:0 0 auto; }
.crm-detail-alert{ padding:11px 14px; border-radius:12px; font-size:13.5px; margin-bottom:16px; border:1px solid var(--border-soft); }
.crm-alert-sale{ background:#fdecec; border-color:#eab9b2; }
.crm-alert-finished{ background:#ffe6d8; border-color:#eaba97; }
.crm-alert-half{ background:#fff5d9; border-color:#e6d296; }
.crm-detail-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:12px; }
.crm-field{ display:flex; flex-direction:column; gap:6px; }
.crm-field-cap{ font-size:11px; font-weight:800; letter-spacing:.7px; text-transform:uppercase; color:var(--text-soft); }
.crm-detail-actions{ margin-bottom:18px; }
.crm-detail-stats{ display:grid; grid-template-columns:repeat(6,1fr); gap:12px; margin-bottom:16px; }
.crm-stat{ display:flex; flex-direction:column; gap:4px; padding:15px 12px; border:1px solid var(--border-soft); border-radius:13px; background:#fafafa; text-align:center; }
.crm-stat-v{ font-size:19px; font-weight:800; color:var(--text-main); } .crm-stat-warn{ color:#c0392b; }
.crm-stat-l{ font-size:10.5px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; color:var(--text-soft); }
.crm-detail-section{ margin:18px 0; padding-top:16px; border-top:1px solid var(--border-soft); }
.crm-detail-h{ font-size:12px; font-weight:800; letter-spacing:1px; text-transform:uppercase; color:var(--text-soft); margin-bottom:10px; }
.crm-pkgs{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.crm-pkg-row{ display:flex; align-items:center; gap:12px; padding:9px 13px; border:1px solid var(--border-soft); border-radius:11px; background:#fff; font-size:13.5px; }
.crm-pkg-sess{ font-weight:800; color:var(--text-main); } .crm-pkg-price{ font-weight:700; color:#1a6b3f; } .crm-pkg-date{ color:var(--text-soft); }
.crm-pkg-del{ margin-left:auto; background:#f4d9d0; color:#a3341a; border:none; border-radius:8px; padding:4px 9px; cursor:pointer; font-weight:800; }
.crm-pkg-add{ display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:10px; align-items:center; }
.crm-pkg-add .pencil-input{ min-height:46px; }
/* Form scheda cliente: più arioso, celle grandi */
.crm-sheet-form{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px 18px; }
.crm-input-lg{ min-height:54px; font-size:16px; }
.crm-sheet-save{ display:flex; align-items:center; gap:14px; margin-top:16px; flex-wrap:wrap; }
.crm-sheet-save .crm-muted{ font-size:12px; max-width:420px; line-height:1.4; }
.crm-btn-lg{ min-height:52px; padding:0 34px; font-size:15px; }

/* Esito finale CROSS: card chiare e spaziate */
.crm-cross{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.crm-cross-card{ display:flex; flex-direction:column; align-items:flex-start; gap:6px; text-align:left; padding:16px; border:1.5px solid var(--border-soft); border-radius:14px; background:#fff; cursor:pointer; box-shadow:none; }
.crm-cross-card:hover{ border-color:var(--accent); background:#fafafa; }
.crm-cross-dot{ width:16px; height:16px; border-radius:50%; }
.crm-cross-t{ font-size:15px; font-weight:800; color:var(--text-main); }
.crm-cross-s{ font-size:11.5px; color:var(--text-soft); line-height:1.35; }
.crm-cross-card.on-blue{ border-color:#2f6fe0; background:#eaf1fc; }
.crm-cross-card.on-black{ border-color:#161616; background:#f0f0f0; }
.crm-cross-card.on-active{ border-color:#5d8f1f; background:#f0f6e6; }
.crm-detail-cols{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.crm-hist{ display:flex; flex-direction:column; gap:6px; }
.crm-hist-row{ display:flex; align-items:center; gap:8px; font-size:12.5px; flex-wrap:wrap; }
.crm-sess{ display:flex; flex-wrap:wrap; gap:6px; }
.crm-sess-chip{ font-size:12px; padding:4px 9px; border-radius:8px; background:#eef4e6; color:#3a5a1f; font-weight:600; }

/* Badge fine percorso (blu = ricomprato · nero = no) */
.crm-endbadge{ display:inline-block; margin-top:8px; font-size:12px; font-weight:800; padding:4px 11px; border-radius:8px; }
.crm-endbadge.end-blue{ background:#e7effb; color:#2f6fe0; border:1px solid #bcd3f4; }
.crm-endbadge.end-black{ background:#ecebea; color:#161616; border:1px solid #cfcac3; }

/* Calendario presenze: mesi (righe) × giorni 1..31 (colonne), quadretti verdi */
.att-scroll{ overflow-x:auto; border:1px solid var(--border-soft); border-radius:12px; background:#fff; padding:6px 4px; }
.att-table{ border-collapse:collapse; }
.att-table th, .att-table td{ text-align:center; }
.att-table thead th{ font-size:10px; font-weight:700; color:var(--text-soft); padding:4px 0; width:21px; min-width:21px; }
.att-corner{ position:sticky; left:0; background:#fff; z-index:2; }
.att-month{ position:sticky; left:0; background:#fff; z-index:2; text-align:right; padding:0 10px 0 8px; font-size:11.5px; font-weight:700; color:var(--text-main); white-space:nowrap; }
.att-cell{ width:21px; height:21px; padding:2px; }
.att-cell::after{ content:""; display:block; width:15px; height:15px; margin:0 auto; border-radius:3px; }
.att-off::after{ background:#eef0ec; border:1px solid #e2e4df; }
.att-on::after{ background:#5fbf3f; border:1px solid #46a02c; }
.att-today::after{ box-shadow:0 0 0 2px #2f6fe0; }
.att-void{ width:21px; }

/* --- Responsive --- */
@media (max-width: 900px){
  .crm-detail-grid{ grid-template-columns:1fr; }
  .crm-detail-stats{ grid-template-columns:repeat(3,1fr); }
  .crm-detail-cols{ grid-template-columns:1fr; }
  .crm-pkg-add{ grid-template-columns:1fr 1fr; }
  .crm-split{ grid-template-columns:1fr; }
  .crm-sheet-form{ grid-template-columns:1fr 1fr; }
  .crm-cross{ grid-template-columns:1fr; }
}
@media (max-width: 760px){
  .crm-shell{ flex-direction:column; height:auto; }
  .crm-body{ overflow:auto; }
  .crm-sidebar{ flex:none; width:100%; flex-direction:row; overflow-x:auto; padding:10px; align-items:center; gap:6px; border-right:none; border-bottom:1px solid var(--border-soft); }
  .crm-brand{ display:none; } .crm-nav{ flex-direction:row; } .crm-nav-cap{ display:none; }
  .crm-nav-item{ white-space:nowrap; padding:9px 12px; } .crm-back{ display:none; }
  .crm-main{ height:auto; }
  .crm-view{ overflow:visible; padding:16px; }
  .crm-topbar{ flex-direction:column; align-items:stretch; gap:10px; padding:14px 16px; }
  .crm-detail-stats{ grid-template-columns:repeat(2,1fr); }
}


/* =====================================================================
   STAMPA / ESPORTA PDF (resoconto) — layout pulito su carta:
   via i controlli d'interfaccia, tabelle intere senza scroll, colori delle
   tessere/badge conservati, niente sezioni tagliate a metà pagina.
   ===================================================================== */
@media print{
  @page{ margin:12mm; }

  html, body{
    overflow:visible !important;
    height:auto !important;
    background:#fff !important;
  }

  /* Fuori dalla stampa tutto ciò che è interazione */
  .main-header, .toast, .dialog-overlay, .report-filters,
  .link-btn, .header-pdf-btn{ display:none !important; }

  .report{ max-width:none; margin:0; padding:0; }
  .report-title{ font-size:20px; margin-bottom:14px; }
  .report-section{ margin-bottom:18px; }

  /* Tabelle per intero, niente riquadro scorrevole */
  .table-scroll{
    overflow:visible !important;
    border:1px solid var(--border-soft);
    box-shadow:none;
  }
  .report-table{ font-size:11.5px; }
  .report-table th, .report-table td{ padding:6px 8px; }
  .report-table thead th{ position:static; }

  /* Non spezzare a metà pagina blocchi che si leggono insieme */
  .report-section, .detail-section, .tile,
  .report-table tr{ break-inside:avoid; page-break-inside:avoid; }

  /* Conserva i colori di tessere e badge sulla stampa */
  *{
    -webkit-print-color-adjust:exact !important;
    print-color-adjust:exact !important;
  }
}

/* =====================================================================
   CRM — PORTA D'INGRESSO E VISTA RIDOTTA
   ===================================================================== */

/* Schermata della password: copre tutto finché non si entra. Visibile di
   partenza e non nascosta dal foglio di stile: se lo script non partisse, il
   CRM resterebbe chiuso invece di aprirsi vuoto. */
.crm-gate{
  position:fixed; inset:0; z-index:9500;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg-page, #f6f4f1); padding:24px;
}
.crm-gate-box{
  width:100%; max-width:340px;
  display:flex; flex-direction:column; gap:16px;
  background:#fff; border:1px solid var(--border-soft); border-radius:18px;
  padding:28px 24px; box-shadow:0 8px 30px rgba(0,0,0,.07);
}
.crm-gate-logo{ max-width:170px; height:auto; margin:0 auto 4px; }
.crm-gate-field{ display:flex; flex-direction:column; gap:7px; }
.crm-gate-field span{
  font-size:12px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--text-soft);
}
.crm-gate-field input{
  min-height:50px; padding:0 14px; font-size:17px; letter-spacing:.14em;
  border:1px solid var(--border-soft); border-radius:12px; background:#fff;
  color:var(--text-main);
}
.crm-gate-field input:focus{ outline:2px solid var(--accent, #378ADD); outline-offset:1px; }
.crm-gate-err{ font-size:13px; color:#c0392b; font-weight:600; text-align:center; }
.crm-gate-btn{ min-height:50px; border-radius:12px; font-size:15px; }
/* Uscita: deliberatamente rosso e riconoscibile a colpo d'occhio. Serve a
   chiudere in fretta quando ci si alza dalla postazione. */
.crm-exit{
  display:block; width:100%; margin-top:8px;
  min-height:46px; padding:0 14px;
  background:#c0392b; border:1px solid #a5311f; border-radius:11px;
  color:#fff; font:inherit; font-size:14px; font-weight:800; letter-spacing:.08em;
  text-align:center; cursor:pointer;
  box-shadow:0 1px 2px rgba(0,0,0,.12);
  transition:background .15s ease;
}
.crm-exit:hover{ background:#a5311f; }
.crm-exit:focus-visible{ outline:2px solid #c0392b; outline-offset:2px; }

/* Etichetta delle vendite contrassegnate. Compare solo nella vista completa:
   nella ridotta quelle righe non arrivano nemmeno dal database, e l'etichetta
   stessa è tolta dall'interfaccia (.pren-hidden più sotto). */
.pren-badge{
  display:inline-block; padding:2px 7px; border-radius:6px;
  background:#efe7d8; border:1px solid #d9c9a8; color:#7a5f22;
  font-size:10.5px; font-weight:800; letter-spacing:.05em; line-height:1.5;
  white-space:nowrap;
}
.crm-mini-pren .crm-mini-v{ color:#7a5f22; }
.crm-pren-check{ display:flex; align-items:center; min-height:46px; }
.crm-pren-check input{
  width:15px; height:15px; margin:0; cursor:pointer;
  accent-color:var(--text-soft, #8a8f98); opacity:.45; transition:opacity .15s ease;
}
.crm-pren-check:hover input, .crm-pren-check input:checked{ opacity:1; }

/* Vista ridotta: della spunta non resta traccia nell'interfaccia. Chi entra
   con questa password non deve nemmeno intuire che la distinzione esista. */
.pren-hidden .pt-pren,
.pren-hidden .th-pren,
.pren-hidden .td-pren,
.pren-hidden .pren-badge{ display:none !important; }

/* ================= NOTE E COSE DA FARE (05/08/2026) =================
   Il blocco note del centro: una colonna per personal trainer più quella del
   centro, che scorrono in orizzontale come le postazioni dell'agenda. Ogni
   colonna è una pila di righe spuntabili.
   ==================================================================== */

/* Il contatore sul pulsante in alto: quante cose da fare aspettano. */
.notes-badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:19px; height:19px; margin-left:7px; padding:0 5px;
  border-radius:10px; background:var(--accent-dark); color:#fff;
  font-size:11px; font-weight:800; line-height:1;
}

.notes-modal-box{
  width:min(97vw, 1240px); max-height:90vh;
  display:flex; flex-direction:column; gap:14px;
}

.notes-toggle{
  display:flex; align-items:center; gap:7px;
  font-size:13px; color:var(--text-soft); cursor:pointer; user-select:none;
}
.notes-toggle input{ width:15px; height:15px; margin:0; cursor:pointer; accent-color:var(--accent); }

/* Le colonne scorrono in orizzontale: i PT possono essere più di quanti ne
   stiano sullo schermo, e comprimerle renderebbe illeggibile il testo — che è
   l'unica cosa che conta in una nota. */
.notes-board{
  display:flex; gap:12px; align-items:flex-start;
  overflow-x:auto; overflow-y:hidden;
  padding-bottom:8px; min-height:220px;
}

.notes-col{
  flex:0 0 268px; display:flex; flex-direction:column;
  background:#fafafa; border:1px solid var(--border-soft); border-radius:var(--radius-md);
  max-height:64vh;
}

.notes-col-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:11px 13px; border-bottom:1px solid var(--border-soft);
  position:sticky; top:0; background:#f4f4f5;
  border-radius:var(--radius-md) var(--radius-md) 0 0;
}
.notes-col-name{ font-size:13px; font-weight:800; letter-spacing:.03em; text-transform:uppercase; }
.notes-col-count{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:20px; height:20px; padding:0 6px; border-radius:10px;
  background:var(--accent-dark); color:#fff; font-size:11px; font-weight:800;
}
.notes-col-count.zero{ background:#e4e4e7; color:var(--text-soft); }

.notes-col-list{ overflow-y:auto; padding:9px; display:flex; flex-direction:column; gap:7px; }
.notes-empty{ padding:14px 6px; text-align:center; font-size:12.5px; color:var(--text-soft); }

.nota{
  display:grid; grid-template-columns:auto 1fr auto; gap:8px; align-items:start;
  padding:9px 10px; background:#fff;
  border:1px solid var(--border-soft); border-radius:var(--radius-sm);
  box-shadow:0 1px 2px rgba(0,0,0,0.03);
}
/* Le note nate da sole si riconoscono a vista: chi legge deve sapere se può
   cancellarle o se torneranno da sole al prossimo controllo. */
.nota.auto{ border-left:3px solid #6b7f9e; }
.nota.fatta{ opacity:.5; }
.nota.fatta .nota-testo{ text-decoration:line-through; }

.nota-check{ display:flex; align-items:center; padding-top:1px; }
.nota-check input{ width:16px; height:16px; margin:0; cursor:pointer; accent-color:var(--accent-dark); }

.nota-corpo{ cursor:text; min-width:0; }
.nota-testo{ font-size:13px; line-height:1.42; word-break:break-word; }

.nota-meta{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:5px; }
.nota-tag{
  padding:1px 6px; border-radius:5px; background:#e8edf4; color:#3f5573;
  font-size:9.5px; font-weight:800; letter-spacing:.05em;
}
.nota-cliente{ font-size:11px; font-weight:700; color:var(--text-main); }
.nota-data,
.nota-da{ font-size:10.5px; color:var(--text-soft); }

.nota-del{
  padding:0; width:22px; height:22px; line-height:1;
  background:transparent; color:var(--text-soft); font-size:17px; font-weight:700;
  border-radius:6px; opacity:0; transition:opacity .12s ease, background .12s ease;
}
.nota:hover .nota-del{ opacity:1; }
.nota-del:hover{ background:#f2dede; color:#a33; }

.notes-add{ padding:9px; border-top:1px solid var(--border-soft); }
.notes-add-input{
  width:100%; padding:8px 10px; font-size:13px;
  border:1px dashed var(--border-soft); border-radius:var(--radius-sm);
  background:#fff; color:var(--text-main);
}
.notes-add-input::placeholder{ color:var(--text-soft); }
.notes-add-input:focus{ outline:none; border-style:solid; border-color:var(--accent); }
.notes-add-input:disabled{ opacity:.5; }

/* Su schermo stretto la colonna si allarga: il tablet in verticale ne mostra
   una sola per volta, ed è meglio di quattro colonne illeggibili. */
@media (max-width:560px){
  .notes-col{ flex-basis:min(84vw, 300px); max-height:58vh; }
  .notes-modal-box{ padding:16px; }
}

/* Sul telefono il pulsante Note perde la scritta e resta il contatore: nella
   barra in alto lo spazio è già conteso da data, ricerca e clienti. */
@media (max-width:420px){
  #notes-btn{ font-size:0; padding:10px; }
  #notes-btn .notes-badge{ font-size:11px; margin-left:0; }
}

/* ---------- Prima seduta nella scheda cliente (05/08/2026) ---------- */

.cf-first-block{
  margin-top:16px; padding-top:14px; border-top:1px dashed var(--border-soft);
}
.cf-first-grid{
  display:grid; grid-template-columns:1fr 1fr 1.3fr; gap:10px;
}
/* Già fissata: i campi restano leggibili ma non si toccano più. Da qui in poi
   la prima seduta è un appuntamento come gli altri e si sposta dall'agenda. */
.cf-first-block.gia-fissata .cf-first-grid{ opacity:.6; }
.cf-first-block.gia-fissata .crm-hint{ color:var(--text-main); font-weight:600; }

@media (max-width:560px){
  .cf-first-grid{ grid-template-columns:1fr; }
}

/* ================= CROSS TRACCIATO E RATE (05/08/2026) ================= */

.crm-cross-ev{
  border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:14px; margin-bottom:12px; background:#fff;
  border-left:3px solid #c9ccd2;
}
.crm-cross-ev.is-fatto{ border-left-color:#3f8a5c; }
.crm-cross-ev.is-nonfatto{ border-left-color:#b4553f; }

.crm-cross-ev-head{ display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:12px; }
.crm-cross-ev-t{ font-size:14px; font-weight:800; }
.crm-cross-ev-when{ font-size:12px; color:var(--text-soft); }

.crm-cross-ev-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; }
.crm-cross-ev-grid .crm-field-wide{ grid-column:1/-1; }

/* ---- Pagamenti e rate ---- */

.crm-pay-head{ display:grid; grid-template-columns:1fr 2fr auto; gap:10px; align-items:end; margin-bottom:14px; }
.crm-pay-new{ display:grid; grid-template-columns:2fr 1fr 1fr auto; gap:10px; align-items:end; margin-top:12px; }

.crm-rate{ width:100%; border-collapse:collapse; font-size:13px; }
.crm-rate th{
  text-align:left; padding:7px 8px; font-size:11px; letter-spacing:.06em;
  text-transform:uppercase; color:var(--text-soft); border-bottom:1px solid var(--border-soft);
}
.crm-rate td{ padding:5px 8px; border-bottom:1px solid #f0f0f2; }
.crm-rate .num{ text-align:right; }
.crm-rate tfoot td{ padding-top:10px; border-bottom:none; }

/* Pagata: la riga si spegne. In ritardo: si accende. Sono le due cose che il
   titolare cerca guardando il piano, e devono distinguersi senza leggere. */
.crm-rate tr.is-pagata{ opacity:.55; }
.crm-rate tr.is-tardi td{ background:#fdf1ee; }
.crm-rate tr.is-tardi td:first-child{ box-shadow:inset 3px 0 0 #b4553f; }

.crm-rate-in{ padding:5px 7px; font-size:13px; min-height:0; width:100%; }
.crm-rate-eur{ text-align:right; max-width:110px; }
.crm-rate-del{
  padding:0; width:22px; height:22px; line-height:1; background:transparent;
  color:var(--text-soft); font-size:16px; font-weight:700; border-radius:6px;
}
.crm-rate-del:hover{ background:#f2dede; color:#a33; }

@media (max-width:760px){
  .crm-cross-ev-grid,
  .crm-pay-head,
  .crm-pay-new{ grid-template-columns:1fr; }
}
.crm-incassa{ max-width:280px; margin-bottom:12px; }
