/* ==========================================================================
   ROYALDOG - APPLE iOS HUMAN INTERFACE GUIDELINES (HIG) DESIGN SYSTEM
   Progettato con estetica nativa Apple iOS 17/18, Mobile-First,
   Vetro smerigliato (Frosted Glass), Controlli Segmentati Capsule,
   Schede Inset Grouped, Fogli Modali con Grabber, e Tinta Primaria Magenta.
   ========================================================================== */

:root {
  /* ==========================================================================
     PALETTE IDENTITÀ ROYALDOG & COLORI DI SISTEMA iOS (Armonizzati)
     ========================================================================== */
  /* Colore Principale: MAGENTA RoyalDog (iOS System Tint) */
  --primary: #e7007f;
  --primary-hover: #c8006d;
  --primary-active: #b80065;
  --primary-light: #fdf2f8;
  --primary-border: rgba(231, 0, 127, 0.22);
  --primary-glow: rgba(231, 0, 127, 0.28);
  --magenta: #e7007f;
  --magenta-dark: #c8006d;

  /* Bordeaux RoyalDog (Dettagli, titoli e identità secondaria) */
  --bordeaux: #6e252c;
  --bordeaux-hover: #581d23;
  --bordeaux-light: #fbf5f5;
  --primary-dark: #6e252c;

  /* Sfumature Apple iOS con accento Magenta */
  --gradient-header: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(253, 242, 248, 0.85) 100%);
  --gradient-primary: linear-gradient(135deg, #f43f8e 0%, #e7007f 100%);
  --gradient-primary-hover: linear-gradient(135deg, #e11d75 0%, #c8006d 100%);
  --gradient-selection: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);

  /* Superfici e Sfondi di Sistema Apple iOS (Inset Grouped Style) */
  --bg-page: #f2f2f7;                 /* iOS systemGroupedBackground: grigio caldo nativo */
  --bg-card: #ffffff;                 /* iOS secondarySystemGroupedBackground: bianco puro */
  --bg-card-subtle: #f8f8fa;          /* iOS tertiarySystemGroupedBackground */
  --bg-segmented: rgba(118, 118, 128, 0.12); /* Traccia per UISegmentedControl */
  --bg-translucent-bar: rgba(255, 255, 255, 0.85);
  --bg-translucent-sheet: rgba(255, 255, 255, 0.96);

  /* Tipografia & Etichette iOS (SF Pro / Inter) */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", -apple-system-subheadline, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text-main: #1c1c1e;               /* iOS label: nero profondo ad alto contrasto */
  --text-secondary: #636366;          /* iOS secondaryLabel */
  --text-muted: #8e8e93;              /* iOS tertiaryLabel */
  --text-placeholder: #c7c7cc;

  /* Linee di Separazione Apple iOS (Hairline 0.5px) */
  --border-hairline: rgba(60, 60, 67, 0.14);
  --border-subtle: rgba(60, 60, 67, 0.08);
  --border-input: rgba(60, 60, 67, 0.22);
  --border-focus: #e7007f;

  /* Ombre di Sistema Apple iOS (Profondità morbida e diffusa) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.09), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-ios-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0.5px 1px rgba(0, 0, 0, 0.04);
  --shadow-ios-btn: 0 4px 14px rgba(231, 0, 127, 0.28);
  --shadow-ios-segmented: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-ios-sheet: 0 -10px 30px rgba(0, 0, 0, 0.15);

  /* Raggi di Curvatura Apple iOS (Curve continue) */
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 14px;                  /* Raggio standard celle e schede iOS */
  --radius-lg: 18px;
  --radius-sheet: 22px;               /* Angoli arrotondati fogli modali iOS */
  --radius-full: 9999px;              /* Capsule / Pill */

  /* Colori Semantici iOS armonizzati */
  --success: #34c759;                 /* iOS systemGreen */
  --success-light: #e8f9ed;
  --warning: #ff9500;                 /* iOS systemOrange */
  --warning-light: #fff7eb;
  --warning-border: #ffd599;
  --amber-dark: #b25e00;
  --danger: #ff3b30;                  /* iOS systemRed */
  --danger-light: #feebe9;
  --danger-border: #fca5a5;
  --secondary: #5856d6;               /* iOS systemPurple */
  --secondary-light: #f3f0fc;

  /* Appuntamenti Salvati in Agenda (Blu iOS) */
  --appt-bg: #eff6ff;
  --appt-border: #bfdbfe;
  --appt-border-left: #2563eb;
  --appt-text-time: #1e3a8a;
  --appt-text-dog: #0f172a;
  --appt-shadow: rgba(37, 99, 235, 0.12);

  /* Impegni Personali Bloccanti */
  --commitment-bg: #f8fafc;
  --commitment-border: #cbd5e1;
  --commitment-border-left: #475569;
  --commitment-text: #1e293b;
  --commitment-badge-bg: #334155;

  /* Dimensioni fisse di navigazione */
  --nav-height: 62px;
}

/* ==========================================================================
   RESET & REGOLE BASE GLOBALI (Look & Feel Apple iOS)
   ========================================================================== */

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

html, body {
  width: 100%;
  height: 100%;
  background-color: #0b1329; /* Sfondo scuro elegante sul desktop per valorizzare il mockup iPhone */
  font-family: var(--font-family);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 15px;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ==========================================================================
   MOCKUP HARDWARE APPLE iPHONE SU DESKTOP (Pixel 9a / iPhone Switcher)
   ========================================================================== */

.desktop-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(30, 41, 59, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 12.5px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

.desktop-toolbar span {
  font-weight: 600;
  margin-right: 6px;
  color: #cbd5e1;
}

.device-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.device-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.app-viewport-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding-top: 56px;
  padding-bottom: 24px;
}

/* Telaio Smartphone iOS */
.mobile-frame {
  width: 100%;
  max-width: 412px;
  min-height: calc(100vh - 80px);
  background-color: var(--bg-page);
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 10px #1e293b, 0 0 0 12px #334155;
  border-radius: 46px;
  transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dynamic Island / Sensore Apple iOS */
.phone-speaker-notch {
  width: 100px;
  height: 24px;
  background: #000000;
  border-radius: 20px;
  margin: 10px auto 4px auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 120;
}

.phone-speaker-notch::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0d1b2a;
  border: 1px solid #1e293b;
}

/* Quando l'utente visualizza da vero smartphone */
@media (max-width: 600px) {
  body {
    background-color: var(--bg-page);
  }
  
  .desktop-toolbar {
    display: none !important;
  }
  
  .app-viewport-wrapper {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .mobile-frame {
    max-width: 100% !important;
    min-height: 100vh;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  
  .phone-speaker-notch {
    display: none;
  }
}

/* ==========================================================================
   APPLE iOS NAVIGATION BAR (Header in Vetro Smerigliato / Translucent)
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-translucent-bar);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 0.5px solid var(--border-hairline);
  padding: 8px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.header-mascot-img {
  height: 44px;
  width: auto;
  max-width: 48px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(231, 0, 127, 0.2));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.header-mascot-img:active {
  transform: scale(0.94);
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.header-text-logo-img {
  height: 36px;
  max-width: 150px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.04));
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.header-right .brand-badge {
  font-size: 11px;
  background: rgba(231, 0, 127, 0.09);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: -0.1px;
  white-space: nowrap;
}

/* ==========================================================================
   AREA CONTENUTO PRINCIPALE (Scorrimento Inerziale Nativo iOS)
   ========================================================================== */

.app-content {
  flex: 1;
  padding: 14px 14px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 24px) 14px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   APPLE iOS BOTTOM TAB BAR (Barra Fissa in Vetro Smerigliato con Tinta Magenta)
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 412px;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-translucent-bar);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-top: 0.5px solid var(--border-hairline);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  z-index: 200;
  padding: 0 4px env(safe-area-inset-bottom, 0px) 4px;
  box-shadow: 0 -0.5px 3px rgba(0, 0, 0, 0.02);
  border-bottom-left-radius: 46px;
  border-bottom-right-radius: 46px;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .bottom-nav {
    max-width: 100% !important;
    border-radius: 0 !important;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  width: 25%;
  height: 100%;
  min-height: 48px;
  min-width: 44px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  padding: 5px 2px;
  gap: 3px;
  box-sizing: border-box;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 1.9px;
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.18s ease;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.1px;
  transition: color 0.15s ease, font-weight 0.15s ease;
}

/* Stato Attivo Tab iOS: Tinta Magenta RoyalDog */
.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-label {
  font-weight: 700;
  color: var(--primary);
}

.nav-item.active .nav-svg {
  stroke: var(--primary);
  transform: translateY(-1px);
}

/* Pulsante Tab Prenota */
.nav-item-book {
  position: static;
  color: var(--text-muted);
}

.nav-item-book.active {
  color: var(--primary);
}

.nav-item-book.active .nav-svg {
  stroke: var(--primary);
}

/* ==========================================================================
   APPLE iOS SEGMENTED CONTROL (UISegmentedControl Capsule Switcher)
   Usato per 'Lista Giorno', 'Griglia Giorno', 'Griglia Settimana' e i Toggle
   ========================================================================== */

.view-mode-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-segmented);
  padding: 3px;
  border-radius: 11px;
  margin-bottom: 14px;
  gap: 3px;
  border: none;
}

.view-tab-btn {
  flex: 1;
  min-height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 11.5px;
  letter-spacing: -0.2px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.2;
}

.view-tab-btn:hover {
  color: var(--text-main);
}

.view-tab-btn:active {
  transform: scale(0.97);
}

/* Segmento Attivo iOS: Capsula Bianca Elevata */
.view-tab-btn.active {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  box-shadow: var(--shadow-ios-segmented);
}

/* ==========================================================================
   DATE SELECTOR BAR (Barra Selettore Data stile Inset Grouped)
   ========================================================================== */

.date-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: var(--shadow-ios-card);
  border: 0.5px solid var(--border-hairline);
}

.date-nav-btn {
  background: rgba(118, 118, 128, 0.08);
  border: none;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.date-nav-btn:active {
  background: rgba(118, 118, 128, 0.18);
  transform: scale(0.92);
}

.date-center-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.date-day-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: capitalize;
  letter-spacing: -0.2px;
}

.date-full-label {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-today-shortcut {
  font-size: 11px;
  background: rgba(231, 0, 127, 0.09);
  color: var(--primary);
  border: none;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  margin-top: 3px;
  transition: all 0.15s ease;
}

.btn-today-shortcut:active {
  transform: scale(0.94);
  background: rgba(231, 0, 127, 0.18);
}

/* ==========================================================================
   SCHEDE APPUNTAMENTO & IMPEGNO (iOS Inset Grouped Cards)
   ========================================================================== */

.appointment-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-bottom: 12px;
  border: 0.5px solid var(--border-hairline);
  border-left: 4.5px solid var(--primary);
  box-shadow: var(--shadow-ios-card);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.appointment-card:active {
  transform: scale(0.99);
}

.appointment-card.has-overlap {
  border: 0.5px solid var(--warning-border);
  border-left: 4.5px solid var(--warning);
  background: #fffdfa;
}

/* Card Impegno Personale Bloccante */
.commitment-card {
  background: var(--commitment-bg);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-bottom: 12px;
  border: 0.5px solid var(--commitment-border);
  border-left: 4.5px solid var(--commitment-border-left);
  box-shadow: var(--shadow-ios-card);
  position: relative;
  transition: transform 0.15s ease;
}

.commitment-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.commitment-time-pill {
  font-size: 16px;
  font-weight: 800;
  color: var(--commitment-text);
  letter-spacing: -0.3px;
}

.commitment-duration-tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(118, 118, 128, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  margin-left: 6px;
}

.commitment-type-tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--commitment-badge-bg);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.commitment-type-tag.non-blocking {
  background: #64748b;
}

.btn-compact-comm {
  height: 24px;
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  background: #ffffff;
  color: var(--text-secondary);
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-compact-comm:active {
  transform: scale(0.94);
  background: rgba(118, 118, 128, 0.12);
}

.commitment-title-headline {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 6px 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.commitment-notes-box {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin: 6px 0 8px 0;
}

.overlap-warning-banner {
  background: var(--warning-light);
  color: var(--amber-dark);
  border: 0.5px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.appt-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.appt-time-pill {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--bordeaux);
  letter-spacing: -0.3px;
}

.appt-duration-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(118, 118, 128, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  margin-left: 6px;
}

.appt-dog-headline {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.appt-dog-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.appt-dog-breed {
  font-size: 13px;
  color: var(--text-secondary);
}

.appt-client-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Badges trattamenti e mantello stile iOS Pill */
.appt-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.badge-treatment {
  background: rgba(231, 0, 127, 0.08);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--primary-border);
}

.badge-coat {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
}

.badge-coat-valutare {
  background: rgba(118, 118, 128, 0.1);
  color: var(--text-secondary);
}

.badge-coat-senzanodi {
  background: var(--success-light);
  color: var(--success);
}

.badge-coat-nodi {
  background: var(--warning-light);
  color: var(--amber-dark);
}

.badge-coat-infeltrito {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 700;
}

.permanent-notes-callout {
  background: #fffbeb;
  border-left: 3.5px solid #f59e0b;
  padding: 7px 10px;
  font-size: 12px;
  color: #92400e;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.appointment-specific-note {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 8px;
  background: rgba(118, 118, 128, 0.06);
  padding: 5px 8px;
  border-radius: var(--radius-xs);
}

/* Barra delle azioni rapide (Chiama, WhatsApp, Modifica) */
.appt-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 0.5px solid var(--border-hairline);
  padding-top: 9px;
  margin-top: 4px;
}

.btn-action {
  flex: 1;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-action:active {
  transform: scale(0.96);
}

.btn-call {
  background: var(--success-light);
  color: #15803d;
  border: 0.5px solid rgba(22, 163, 74, 0.2);
}

.btn-call:active {
  background: #dcfce7;
}

.btn-whatsapp {
  background: #ecfdf5;
  color: #047857;
  border: 0.5px solid rgba(4, 120, 87, 0.2);
}

.btn-whatsapp:active {
  background: #d1fae5;
}

.btn-edit {
  background: rgba(118, 118, 128, 0.1);
  color: var(--text-main);
}

.btn-edit:active {
  background: rgba(118, 118, 128, 0.18);
}

/* ==========================================================================
   GRIGLIA SETTIMANALE A 5 COLONNE (Martedì - Sabato)
   ========================================================================== */

.week-grid-container {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-hairline);
  overflow: hidden;
  box-shadow: var(--shadow-ios-card);
  position: relative;
}

.week-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card-subtle);
  border-bottom: 0.5px solid var(--border-hairline);
}

.week-nav-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.week-nav-range {
  font-size: 13px;
  font-weight: 700;
  color: var(--bordeaux);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
  padding: 0 4px;
}

.week-nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-week-toggle-closed {
  height: 30px;
  font-size: 11px;
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  color: var(--text-secondary);
  padding: 0 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-week-toggle-closed:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-week-toggle-closed:active {
  transform: scale(0.95);
}

.btn-week-toggle-closed.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.week-grid-scroll-container {
  display: flex;
  flex-direction: column;
  position: relative;
  height: 520px;
  max-height: calc(100vh - 270px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

.week-grid-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 35;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-hairline);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.week-time-gutter-header {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  border-right: 1px solid var(--border-hairline);
  background: transparent;
  flex-shrink: 0;
}

.week-days-columns-header {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

.week-col-header {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 2px;
  text-align: center;
  border-right: 1px solid var(--border-hairline);
  user-select: none;
  background: transparent;
}

.week-col-header:last-child {
  border-right: none;
}

.week-col-header.is-today {
  background: rgba(231, 0, 127, 0.08) !important;
}

.week-col-header.is-today .week-header-dayname,
.week-col-header.is-today .week-header-daynum {
  color: var(--primary) !important;
  font-weight: 800;
}

.week-header-dayname {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.week-header-daynum {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.week-header-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.week-grid-body-content {
  display: flex;
  position: relative;
  background: #ffffff;
}

.week-time-gutter {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  border-right: 1px solid var(--border-hairline);
  position: relative;
  background: var(--bg-card-subtle);
  flex-shrink: 0;
  user-select: none;
}

.week-hour-tick {
  position: absolute;
  left: 0;
  right: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 0 2px;
  white-space: nowrap;
}

.week-columns-wrapper {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  position: relative;
}

.week-hour-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(60, 60, 67, 0.08);
  pointer-events: none;
}

.week-half-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(60, 60, 67, 0.05);
  pointer-events: none;
}

.week-day-column {
  flex: 1 1 0;
  min-width: 0;
  border-right: 1px solid var(--border-hairline);
  position: relative;
  background: #ffffff;
}

.week-day-column:last-child {
  border-right: none;
}

.week-day-column.is-today {
  background: rgba(231, 0, 127, 0.02);
}

.week-lunch-break-overlay {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(254, 243, 199, 0.35);
  border-top: 1px dashed rgba(245, 158, 11, 0.4);
  border-bottom: 1px dashed rgba(245, 158, 11, 0.4);
  pointer-events: none;
  z-index: 10;
}

.week-closed-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(241, 245, 249, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
}

.week-closed-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--border-hairline);
  transform: rotate(-90deg);
}

.week-slot-hit-target {
  position: absolute;
  left: 0;
  right: 0;
  cursor: pointer;
  z-index: 12;
}

.week-slot-hit-target:hover {
  background: rgba(231, 0, 127, 0.08);
}

.week-grid-appt, .week-appt-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--appt-bg);
  border: 0.5px solid var(--appt-border);
  border-left: 3.5px solid var(--appt-border-left);
  border-radius: var(--radius-xs);
  padding: 2px 4px;
  cursor: pointer;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 1px 3px var(--appt-shadow);
  transition: transform 0.1s ease;
}

.week-grid-appt:hover, .week-appt-block:hover {
  transform: scale(1.02);
  z-index: 24;
}

.week-grid-appt-time, .week-appt-block-time {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--appt-text-time);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-grid-appt-client, .week-appt-block-client {
  font-size: 9px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-grid-appt-dog, .week-appt-block-dog {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--appt-text-dog);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-grid-appt-endtime, .week-appt-block-endtime {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-appt-pill-starttime {
  font-size: 12px;
  font-weight: 800;
  color: var(--appt-text-time, #1e3a8a);
  line-height: 1.2;
}

.grid-appt-pill-client {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  margin-top: 2px;
}

.grid-appt-pill-dog {
  font-size: 12px;
  font-weight: 600;
  color: var(--appt-text-dog, #0f172a);
  line-height: 1.2;
  margin-top: 2px;
}

.grid-appt-pill-endtime {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
  margin-top: 2px;
}

.week-grid-commitment, .week-commitment-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--commitment-bg);
  border: 0.5px solid var(--commitment-border);
  border-left: 3.5px solid var(--commitment-border-left);
  border-radius: var(--radius-xs);
  padding: 2px 4px;
  cursor: pointer;
  overflow: hidden;
  z-index: 20;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease;
}

.week-grid-commitment:hover, .week-commitment-block:hover {
  transform: scale(1.02);
  z-index: 24;
}

.week-grid-comm-time, .week-commitment-block-time {
  font-size: 10px;
  font-weight: 800;
  color: var(--commitment-text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-grid-comm-title, .week-commitment-block-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--commitment-text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   PICKER MODE & PROVVISORIA (Magenta RoyalDog distintivo)
   ========================================================================== */

.picker-top-banner {
  background: var(--gradient-primary);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: var(--shadow-ios-btn);
}

.picker-top-banner-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.picker-top-banner-sub {
  font-size: 11.5px;
  opacity: 0.95;
  color: #ffffff;
}

.picker-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-cancel-picker {
  font-size: 11px;
  font-weight: 700;
  background: #ffffff;
  border: none;
  color: var(--danger);
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-cancel-picker:active {
  transform: scale(0.95);
  background: #fee2e2;
}

.btn-goto-date-picker {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.15s ease;
}

.btn-week-nav-arrow {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--bordeaux);
  cursor: pointer;
  transition: all 0.15s ease;
  flex: none;
}

.btn-week-nav-arrow:active {
  transform: scale(0.94);
  background: var(--primary-light);
}

.picker-preview-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: rgba(231, 0, 127, 0.18);
  border: 2px dashed var(--primary);
  border-left: 4.5px solid var(--primary);
  border-radius: var(--radius-xs);
  z-index: 25;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2px 4px;
  box-shadow: 0 2px 8px var(--primary-glow);
  animation: pulse-border 1.5s infinite;
}

.picker-preview-block .preview-time-text {
  font-size: 11px;
  font-weight: 800;
  color: #831843;
  line-height: 1.1;
  text-align: center;
}

.picker-preview-block .preview-status-text {
  font-size: 9.5px;
  font-weight: 700;
  color: #9d174d;
  line-height: 1.1;
  margin-top: 1px;
  text-align: center;
}

@keyframes pulse-border {
  0% { opacity: 0.88; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.005); }
  100% { opacity: 0.88; transform: scale(1); }
}

.week-col-header.is-selected-day {
  background: var(--primary-light) !important;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.week-col-header.is-selected-day .week-header-dayname,
.week-col-header.is-selected-day .week-header-daynum {
  color: var(--primary) !important;
  font-weight: 800;
}

.week-day-column.is-selected-day {
  background: rgba(231, 0, 127, 0.045);
}

.btn-goto-date {
  font-size: 11.5px;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid var(--primary);
  color: var(--bordeaux);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-goto-date:active {
  transform: scale(0.95);
  background: var(--primary-light);
}

/* ==========================================================================
   APPLE iOS BOTTOM SHEET MODALS (Fogli Modali con Grabber Bar e Vetro)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #ffffff;
  width: 100%;
  max-width: 412px;
  max-height: 92vh;
  border-top-left-radius: var(--radius-sheet);
  border-top-right-radius: var(--radius-sheet);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-ios-sheet);
  position: relative;
}

/* iOS Sheet Grabber Bar Indicatore */
.modal-dialog::before {
  content: '';
  display: block;
  width: 36px;
  height: 5px;
  border-radius: 2.5px;
  background: rgba(60, 60, 67, 0.3);
  margin: 8px auto 4px auto;
  flex-shrink: 0;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}

@media (max-width: 600px) {
  .modal-dialog {
    max-width: 100% !important;
  }
}

.modal-header {
  padding: 8px 16px 10px 16px;
  border-bottom: 0.5px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--bordeaux);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Tasto 'Esci senza salvare' in alto a destra stile iOS Red Pill Button */
.btn-modal-exit-danger {
  background: var(--danger);
  border: none;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.28);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1.2;
}

.btn-modal-exit-danger:active {
  transform: scale(0.94);
  background: #d32f2f;
}

@media (max-width: 360px) {
  .btn-exit-extra-text {
    display: none;
  }
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 110px;
  background: var(--bg-page);
  -webkit-overflow-scrolling: touch;
}

/* Toggle Tipo Prenotazione: Appuntamento Cane vs Impegno Personale */
.booking-type-toggle {
  display: flex;
  background: var(--bg-segmented);
  padding: 3px;
  border-radius: 11px;
  margin-bottom: 14px;
  border: none;
  gap: 3px;
}

.booking-type-btn {
  flex: 1;
  min-height: 36px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.booking-type-btn.active {
  background: #ffffff;
  color: var(--bordeaux);
  font-weight: 700;
  box-shadow: var(--shadow-ios-segmented);
}

.booking-type-btn[data-type="commitment"].active {
  color: var(--commitment-text);
}

.commitment-overlap-alert {
  background: var(--danger-light);
  border: 0.5px solid var(--danger-border);
  border-left: 4.5px solid var(--danger);
  color: #991b1b;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

/* ==========================================================================
   FORM CONTROLS & INPUTS (Stile Nativo Apple iOS)
   ========================================================================== */

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

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.1px;
}

.form-label .required-star {
  color: var(--danger);
  margin-left: 2px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  font-family: inherit;
  font-size: 15px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-border);
}

.form-textarea {
  min-height: 72px;
  resize: vertical;
}

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

.form-row > * {
  flex: 1;
}

/* Durate Rapide stile iOS Capsule */
.duration-selector-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.duration-pill {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.duration-pill:active {
  transform: scale(0.95);
}

.duration-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Checkbox Trattamenti */
.treatments-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.treatment-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  min-height: 46px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.treatment-checkbox-label:active {
  background: var(--primary-light);
  transform: scale(0.98);
}

.treatment-checkbox-label input[type="checkbox"] {
  width: 19px;
  height: 19px;
  accent-color: var(--primary);
}

/* Scelta Stato Mantello */
.coat-radios-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.coat-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  min-height: 46px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.coat-radio-label:active {
  transform: scale(0.98);
}

.coat-radio-label.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--bordeaux);
  font-weight: 700;
}

.coat-radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.reference-history-box {
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.ref-history-title {
  font-weight: 700;
  color: var(--bordeaux);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ref-history-copy-btn {
  background: rgba(118, 118, 128, 0.1);
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  margin-top: 6px;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.ref-history-copy-btn:active {
  background: rgba(118, 118, 128, 0.2);
  transform: scale(0.94);
}

.phone-duplicate-banner {
  background: #eff6ff;
  border: 0.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: #1e40af;
}

.btn-select-existing-match {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

/* Modal Footer Sticky */
.modal-footer {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.btn-submit-main, .btn-submit-booking, #btn-cm-submit {
  width: 100%;
  min-height: 48px;
  background: var(--gradient-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-ios-btn);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}

.btn-submit-main:active, .btn-submit-booking:active, #btn-cm-submit:active {
  transform: scale(0.98);
}

.btn-submit-main:disabled, .btn-submit-booking:disabled, #btn-cm-submit:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-cancel-appt {
  width: 100%;
  min-height: 42px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cancel-appt:active {
  background: var(--danger-light);
  transform: scale(0.98);
}

/* ==========================================================================
   ANAGRAFICA CLIENTI, CANI & RUBRICA (iOS Inset Grouped)
   ========================================================================== */

.clients-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.clients-header-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.btn-add-client-top {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--primary-glow);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-add-client-top:hover {
  background: var(--primary-hover);
}

.btn-add-client-top:active {
  transform: scale(0.95);
}

/* Card e controlli gestione Cani nel Modal Cliente */
.client-dog-card-box {
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 13px;
  margin-bottom: 12px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.client-dog-card-box:focus-within {
  border-color: var(--primary);
}

.client-dog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--border-hairline);
}

.client-dog-card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-remove-dog {
  background: var(--danger-light);
  border: none;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-remove-dog:active {
  background: #fecaca;
  transform: scale(0.94);
}

.btn-add-dog-dashed {
  width: 100%;
  background: #ffffff;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.btn-add-dog-dashed:hover {
  background: var(--primary-light);
}

.btn-add-dog-dashed:active {
  transform: scale(0.98);
}

/* Autocomplete Razze Cani Europee */
.breed-autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.breed-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1060;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}

.breed-dropdown-menu.open {
  display: block;
}

.breed-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.06);
}

.breed-dropdown-item:last-child {
  border-bottom: none;
}

.breed-dropdown-item:hover,
.breed-dropdown-item:active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.breed-item-icon {
  font-size: 13px;
  opacity: 0.8;
}

.breed-item-name {
  font-weight: 500;
  flex: 1;
}

.breed-dropdown-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

/* ==========================================================================
   BADGE QUALITÀ CLIENTE (0 - 10 con Gradiente Discreto Apple HIG)
   ========================================================================== */

.client-rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 800;
  border: 1px solid;
  line-height: 1;
  user-select: none;
  letter-spacing: -0.2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.rating-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}

.btn-rating-step {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
  background: rgba(118, 118, 128, 0.08);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-rating-step:active {
  background: rgba(118, 118, 128, 0.18);
  transform: scale(0.92);
}

.rating-range-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

.booking-rating-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}

.btn-rating-step-sm {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
  background: rgba(118, 118, 128, 0.08);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.1s ease;
}

.btn-rating-step-sm:active {
  transform: scale(0.9);
  background: rgba(118, 118, 128, 0.2);
}

/* Tasto Storico nelle schede cliente */
.btn-action.btn-history {
  background: rgba(118, 118, 128, 0.09);
  color: var(--text-main);
  border: 0.5px solid var(--border-hairline);
}

.btn-action.btn-history:active {
  background: rgba(118, 118, 128, 0.18);
}

/* ==========================================================================
   MODAL STORICO APPUNTAMENTI CLIENTE & PAGATO (€)
   ========================================================================== */

.history-appt-card {
  background: #ffffff;
  border: 0.5px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.history-appt-card.expanded {
  border-color: var(--primary);
  box-shadow: 0 2px 10px var(--primary-border);
}

.history-appt-header {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #ffffff;
  user-select: none;
}

.history-appt-card.expanded .history-appt-header {
  background: var(--primary-light);
}

.history-appt-date-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.history-appt-time-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.history-appt-chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-appt-card.expanded .history-appt-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.history-appt-details {
  display: none;
  padding: 12px;
  border-top: 0.5px solid var(--border-hairline);
  background: #ffffff;
}

.history-appt-card.expanded .history-appt-details {
  display: block;
}

.history-treatment-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(0, 122, 255, 0.08);
  color: #007aff;
  border: 0.5px solid rgba(0, 122, 255, 0.2);
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
}

.history-notes-box {
  background: #fffbeb;
  border: 0.5px solid #fef08a;
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 12px;
  color: #92400e;
}

.history-paid-pill {
  font-size: 11px;
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-weight: 700;
}

/* ==========================================================================
   STATI VUOTI E UTILITY
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state-subtitle {
  font-size: 13px;
  max-width: 260px;
  margin: 0 auto;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(231, 0, 127, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 0.6s linear infinite;
}

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

/* Indicatore Barra Home per simulatore iPhone su PC */
.ios-home-indicator {
  width: 134px;
  height: 5px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  margin: 8px auto 6px auto;
  pointer-events: none;
}

/* ==========================================================================
   BARRA DI STATO RETE E SINCRONIZZAZIONE OFFLINE (APPLE iOS HIG)
   ========================================================================== */

.sync-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--border-hairline);
  font-size: 11.5px;
  min-height: 32px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99;
}

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.sync-status-bar.status-offline .sync-dot {
  background: #f59e0b;
}

.sync-status-bar.status-syncing .sync-dot {
  background: var(--primary);
  animation: pulse-sync 1s infinite;
}

.sync-status-bar.status-pending_ops .sync-dot {
  background: #f97316;
}

.sync-status-bar.status-conflict .sync-dot {
  background: var(--danger);
  animation: pulse-sync 0.8s infinite;
}

.sync-status-bar.status-error .sync-dot {
  background: var(--danger);
}

@keyframes pulse-sync {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.btn-sync-action {
  background: #ffffff;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(231, 0, 127, 0.12);
  transition: all 0.15s ease;
}

.btn-sync-action:active {
  background: var(--primary);
  color: #ffffff;
  transform: scale(0.95);
}

/* ==========================================================================
   BADGE E TRATTAMENTO GRAFICO APPUNTAMENTI LOCALI NON ANCORA CONFERMATI
   ========================================================================== */

/* Distinzione grafica netta che non si affida unicamente ai colori */
.appointment-card.is-pending-sync,
.grid-appointment.is-pending-sync,
.week-appointment-cell.is-pending-sync,
.week-appt-block.is-pending-sync {
  border: 2px dashed #f59e0b !important;
  background: #fffbeb !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.18) !important;
}

.badge-unsynced-local {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   BANNER AVVISO DATA FUORI PERIODO SCARICATO OFFLINE
   ========================================================================== */

.offline-out-of-range-card {
  margin: 20px 14px;
  padding: 20px 16px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1.5px solid #fcd34d;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
  text-align: center;
}

.offline-out-of-range-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.offline-out-of-range-title {
  font-size: 15px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 6px;
}

.offline-out-of-range-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.offline-out-of-range-window {
  display: inline-block;
  background: #fef3c7;
  color: #78350f;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #fde68a;
}

/* ==========================================================================
   STILI GOOGLE CALENDAR & TASKS (SOLA LETTURA, AGENDA & OVERLAP MODAL)
   ========================================================================== */

.week-google-block {
  position: absolute;
  left: 2px;
  right: 2px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 3.5px solid #16a34a;
  border-radius: 5px;
  padding: 3px 5px;
  z-index: 2;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
}

.week-google-block:active {
  transform: scale(0.97);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
}

.week-google-allday-pill {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 3px solid #16a34a;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 8.5px;
  font-weight: 700;
  color: #15803d;
  z-index: 3;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-event-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.google-event-card:active {
  transform: scale(0.98);
}

.google-tasks-banner {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.modal-google-overlap-alert {
  animation: slideDown 0.2s ease-out;
}

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   MENU SOTTOSEZIONI IMPOSTAZIONI (SUB-NAVIGATION TABS)
   ========================================================================== */

.settings-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.settings-subnav::-webkit-scrollbar {
  display: none;
}

.settings-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-subnav-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.settings-subnav-btn:active {
  transform: scale(0.97);
}

.settings-subnav-btn.active {
  background: var(--primary-dark);
  color: #ffffff;
  border-color: var(--primary-dark);
  box-shadow: 0 3px 8px rgba(30, 41, 59, 0.2);
}

.settings-subnav-btn.active svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.settings-subsection {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.settings-subsection.active {
  display: block;
}

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

