/* ==========================================================================
   BOOKING WEBAPP - MODERN & PROFESSIONAL LUXURY DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block');

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 1em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: -0.15em;
}

hr {
  margin-top: 10px;
  margin-bottom: 10px;
}

:root {
  /* Brand Luxury Palette */
  --brand-deep: #0e2319;
  --brand-primary: #153e2d;
  --brand-hover: #1c523c;
  --brand-light: #f1f7f4;
  --brand-glow: rgba(21, 62, 45, 0.12);

  /* Gold / Sartorial Accents */
  --gold-primary: #bda06d;
  --gold-light: #fdfaf3;
  --gold-border: #ede5d3;
  --gold-dark: #82662c;

  /* Neutrals - Warm Light Luxury Atelier Tone */
  --bg-main: #fbfaf8;
  --bg-surface: #ffffff;
  --bg-subtle: #f6f4ee;
  --bg-muted: #e8e4dc;
  --ink-primary: #1c1917;
  --ink-secondary: #44403c;
  --ink-muted: #78716c;
  --border-light: #e8e5de;
  --border-focus: #153e2d;

  /* Feedback Colors - Refined & Soft */
  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-warn: #b45309;
  --color-warn-bg: #fffbeb;
  --color-warn-border: #fef08a;
  --color-danger: #b91c1c;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-brand: 'Cinzel', Georgia, serif;
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Shadows & Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px -2px rgba(15, 36, 26, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 28px -4px rgba(15, 36, 26, 0.07), 0 4px 10px -2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 16px 36px -8px rgba(15, 36, 26, 0.07), 0 4px 12px -2px rgba(0, 0, 0, 0.02);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-ui);
  color: var(--ink-primary);
  background-color: var(--bg-main);
  line-height: 1.5;
}

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

/* Typography Helpers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: var(--ink-primary);
  line-height: 1.25;
}

.muted {
  color: var(--ink-muted);
}

.link {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.link:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

/* Layout Containers */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px;
  width: 100%;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 16px 0;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Grid Systems */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

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

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

.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.row4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 860px) {

  .grid,
  .grid-3,
  .grid-4,
  .row,
  .row3,
  .row4 {
    grid-template-columns: 1fr;
  }
}

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand-primary);
  color: #ffffff;
  /* border: 1px solid transparent; */
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 61, 45, 0.2);
}

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

.btn.secondary {
  background: var(--bg-surface);
  color: var(--ink-secondary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn.secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--ink-primary);
  box-shadow: var(--shadow-md);
}

.btn.danger {
  background: #fff;
  color: var(--color-danger);
  border: 1px solid #fecaca;
}

.btn.danger:hover {
  background: var(--color-danger-bg);
  border-color: #fca5a5;
}

/* Forms & Inputs */
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.form input,
.form textarea,
select,
input[type="date"],
input[type="time"],
input[type="password"],
input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-primary);
  transition: all var(--transition-fast);
  outline: none;
}

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

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

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--brand-light);
  color: var(--brand-primary);
  border: 1px solid rgba(24, 61, 45, 0.15);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.gold {
  background: var(--gold-light);
  color: var(--gold-dark);
  border-color: var(--gold-border);
}

.badge.success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success-border);
}

.badge.danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: #fca5a5;
}

.badge.warning {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}

.badge.blue,
.badge.info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.tab:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
  border-color: #cbd5e1;
}

.tab.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(24, 61, 45, 0.2);
}

/* Modern Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.table th {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--ink-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background-color: var(--bg-subtle);
}

/* Informational Boxes */
.info {
  background: var(--brand-light);
  border: 1px solid rgba(24, 61, 45, 0.15);
  color: var(--brand-deep);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
  font-size: 14px;
}

.success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
  border-radius: var(--radius-md);
  /* padding: 16px; */
  animation: fadeIn 0.3s ease-out;
}

.hidden {
  display: none !important;
}

/* Stat Cards */
.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--brand-light);
  color: var(--brand-primary);
}

.stat-val {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--ink-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ==========================================================================
   FRONTEND BOOKING EXPERIENCE (Calendly / Sartorial Luxury Look)
   ========================================================================== */

.booking-page {
  margin: 0;
  background: var(--bg-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  font-family: var(--font-ui);
}

.booking-shell {
  display: grid;
  /* 2 colonne all'avvio 50/50: la terza (slot) ha larghezza 0 fino a selezione di un giorno */
  grid-template-columns: 1fr 1fr 0;
  transition: grid-template-columns 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 680px;
  width: 100%;
  max-width: 1200px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
  animation: modalPop 0.4s var(--transition-smooth);
}

/* Colonna slot aperta dopo il click su un giorno disponibile */
.booking-shell.slots-open {
  grid-template-columns: 1fr 1fr 340px;
}

/* Left Pane: Brand & Location Summary */
.pane-left {
  background: #fafbfa;
  border-right: 1px solid var(--border-light);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
}

.brand-logo {
  margin-bottom: 12px;
}

.brand-logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.logo-fallback .logo-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid var(--brand-primary);
  background: linear-gradient(135deg, #183d2d 0%, #0f241a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  font-size: 20px;
  font-family: var(--font-brand);
  letter-spacing: 1.5px;
  box-shadow: 0 4px 14px rgba(24, 61, 45, 0.2);
  position: relative;
}

.logo-ring::after {
  content: '✂';
  position: absolute;
  bottom: -4px;
  right: -2px;
  font-size: 14px;
  background: var(--gold-primary);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.company-name {
  font-family: var(--font-brand);
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-top: 14px;
  font-weight: 600;
}

.booking-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--brand-deep);
  margin: 8px 0 16px;
}

.avail-range {
  margin: -8px 0 14px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-primary);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  margin: 6px 0;
  font-weight: 500;
}

.meta-row-mobile {
  display: none;
  align-items: center;
  gap: 0px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  margin: 6px 0;
  font-weight: 500;
}

@media(max-width:768px) {
  .no-mobile {
    display: none;
  }

  .meta-row-mobile {
    display: flex;
    margin-right: 5px;
  }
}




@media(min-width: 769px) {
  .meta-row-mobile {
    display: none;
  }
}

.meta-row .ico {
  color: var(--brand-primary);
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.location-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-light);
}

@media(max-width: 768px) {
  .location-desc {
    display: none;
  }
}

.left-foot {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
}

.left-foot a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.left-foot a:hover {
  color: var(--brand-primary);
}

/* Center Pane: Calendar */
.pane-center {
  padding: 32px 36px;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.pane-heading {
  font-family: var(--font-heading);
  font-size: 20px;
  text-align: center;
  margin-bottom: 12px;
  color: var(--ink-primary);
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 12px 0 16px;
}

.nav-arrow {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-primary);
  transition: all var(--transition-fast);
}

.nav-arrow:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

.nav-arrow:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  transform: none;
}

.month-label {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
  color: var(--ink-primary);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 25px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  flex: 1;
}

.cday {
  padding: 6px 2px;
  border-radius: var(--radius-md);
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: all var(--transition-fast);
}

.cday .dnum {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  position: relative;
  transition: all var(--transition-fast);
}

.cday.clickable {
  cursor: pointer;
}

.cday.clickable:hover .dnum {
  background: var(--brand-light);
  color: var(--brand-primary);
  transform: scale(1.08);
}

.cday.has-slots .dnum {
  background: var(--brand-primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(24, 61, 45, 0.25);
}

.cday.has-slots .dnum::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  border: 2px solid #ffffff;
}

.cday.selected .dnum {
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--gold-primary);
  background: var(--brand-hover);
}

.cday .sub {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--gold-dark);
  margin-top: 3px;
  line-height: 1.15;
  min-height: 18px;
  text-transform: uppercase;
}

.cday.dim {
  opacity: 0;
}

/* Giorni passati con fasce: solo bordo (stesso colore del vecchio fill) */
.cday.past .dnum {
  background: transparent;
  border: 2px solid var(--brand-primary);
  box-shadow: none;
  color: var(--brand-primary);
}

.cday.past .dnum::after {
  content: none;
}

.tz-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.tz-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

/* Right Pane: Slots & Booking Form — nascosto finche' non si clicca un giorno */
.pane-right {
  padding: 32px 24px 24px;
  display: none;
  flex-direction: column;
  background: #ffffff;
  overflow-y: auto;
  max-height: 720px;
  scroll-margin-top: 12px;
  scroll-margin-bottom: 24px;
}

.booking-shell.slots-open .pane-right {
  display: flex;
  animation: paneIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateX(36px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.day-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink-primary);
}

.slots-banner {
  background: var(--gold-light);
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  animation: fadeIn 0.25s ease-out;
}

.slots-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.slot-btn {
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.slot-btn:hover:not(:disabled) {
  border-color: var(--brand-primary);
  background: var(--brand-light);
  transform: translateX(2px);
}

.slot-btn.selected {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(24, 61, 45, 0.2);
}

.slot-btn.booked {
  background: var(--bg-subtle);
  color: var(--ink-muted);
  border-color: var(--border-light);
  cursor: not-allowed;
  opacity: 0.6;
}

.slot-btn.booked .t {
  text-decoration: line-through;
}

.slot-btn.booked .b {
  font-size: 10px;
  color: var(--color-danger);
  font-weight: 700;
  margin-left: 10px;
}

.book-form {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  animation: slideDown 0.3s ease-out;
}

.book-form h4 {
  font-size: 15px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.book-summary {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.55;
  margin: -4px 0 14px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.book-summary .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -2px;
}

.frow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Prefisso internazionale + numero di telefono (form di prenotazione) */
.phone-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 10px;
}

.btn-book {
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(24, 61, 45, 0.25);
  transition: all var(--transition-fast);
}

.btn-book:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.cancel-box {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-light);
  font-size: 13px;
  color: var(--ink-secondary);
}

.cancel-box summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-muted);
}

.cancel-box summary:hover {
  color: var(--ink-primary);
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-primary);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.2s ease;
}

.toast.success {
  border-left: 4px solid var(--color-success);
}

.toast.error {
  border-left: 4px solid var(--color-danger);
}

.toast.info {
  border-left: 4px solid var(--brand-primary);
}

/* ==========================================================================
   ANIMATIONS & SKELETONS
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   ADMIN DASHBOARD LAYOUT (sidebar sinistra + area contenuti)
   ========================================================================== */

/* NOTA: selettore con doppia classe per vincere la specificita' di body.page
   (senza questo il layout restava a colonna e la sidebar copriva i contenuti) */
body.page.admin-page {
  flex-direction: row;
  align-items: stretch;
  background: var(--bg-main);
}

.admin-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-deep) 0%, #0a1a12 100%);
  color: #e6efe9;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 90;
  overflow-y: auto;
  padding: 24px 16px 18px;
  box-shadow: 4px 0 18px rgba(15, 36, 26, 0.18);
}

.side-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 18px;
}

.side-brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-primary);
}

.side-brand-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.side-brand-text {
  min-width: 0;
}

.side-brand-name {
  font-family: var(--font-brand);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #ffffff;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
  font-weight: 500;
}

.side-nav {
  display: flex;
  flex-direction: column;
}

.side-label {
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  font-weight: 700;
  padding: 0 12px;
  margin-bottom: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.side-link .ico {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.side-link .ext {
  margin-left: auto;
  font-size: 11.5px;
  opacity: 0.55;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.side-link.active {
  background: rgba(197, 155, 39, 0.16);
  color: #f6e7b4;
  border-color: rgba(197, 155, 39, 0.45);
  box-shadow: inset 3px 0 0 var(--gold-primary);
}

.side-link-empty {
  opacity: 0.45;
  cursor: default;
  font-weight: 500;
}

/* Sede nascosta: grigio semitrasparente, ancora cliccabile */
.side-link-dim {
  color: rgba(255, 255, 255, 0.42);
  font-style: italic;
  font-weight: 500;
}

.side-link-dim .ico {
  opacity: 0.7;
}

.side-link-dim:hover {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.05);
}

/* Voce di sidebar resa come button (apre il modal "Invito personale") */
button.side-link {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.side-foot a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.side-foot a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

/* Voce attiva nel foot (es. Impostazioni & Azienda) */
.side-foot a.active {
  color: #f6e7b4;
  background: rgba(197, 155, 39, 0.16);
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 26px 30px 44px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.admin-topbar h1 {
  font-size: 24px;
  color: var(--brand-deep);
}

.admin-topbar .sub {
  margin: 4px 0 0;
  font-size: 13.5px;
}

.admin-topbar .top-actions {
  display: flex;
  gap: 10px;
}

/* Desktop: elementi mobile nascosti */
.admin-mobile-header,
.admin-sidebar-backdrop,
.admin-sidebar-close {
  display: none;
}

/* Sidebar responsive: sotto 900px la sidebar è nascosta a sinistra (off-canvas drawer) e si apre con pulsante hamburger */
@media (max-width: 900px) {
  body.page.admin-page {
    flex-direction: column;
    min-height: 100vh;
    position: relative;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  /* Header superiore mobile con pulsante hamburger */
  .admin-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(180deg, var(--brand-deep) 0%, #0a1a12 100%);
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(15, 36, 26, 0.2);
  }

  .admin-burger-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
  }

  .admin-burger-btn:active {
    background: rgba(255, 255, 255, 0.12);
  }

  .admin-burger-btn .material-symbols-outlined {
    font-size: 26px;
  }

  .admin-mobile-title {
    font-family: var(--font-brand);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #f4eee1;
  }

  .admin-mobile-frontend {
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 6px;
  }

  .admin-mobile-frontend .material-symbols-outlined {
    font-size: 22px;
  }

  /* Backdrop scuro */
  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .admin-sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Sidebar a scomparsa sulla sinistra (off-canvas) */
  .admin-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1999;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    padding: 22px 16px 20px;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  /* Pulsante X di chiusura dentro la sidebar */
  .admin-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 2;
  }

  .admin-sidebar-close:active {
    background: rgba(255, 255, 255, 0.25);
  }

  .side-brand-block {
    position: relative;
    padding-right: 36px;
  }

  .admin-main {
    margin-left: 0;
    padding: 20px 16px 36px;
    width: 100%;
  }

  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ==========================================================================
   BACKEND DESIGN SYSTEM — ELEGANT LIGHT THEME & LUXURY FINISH
   ========================================================================== */

body.page.admin-page {
  font-size: 14px;
  background-color: var(--bg-main);
  color: var(--ink-primary);
}

body.page.admin-page .admin-main {
  margin-left: 268px;
  width: calc(100% - 268px);
  padding: 32px 36px 60px;
  max-width: none;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Topbar con respiro ed eleganza */
body.page.admin-page .admin-topbar {
  margin-bottom: 28px;
  padding-bottom: 20px;
  gap: 20px;
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .admin-topbar h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--brand-deep);
}

body.page.admin-page .admin-topbar .sub {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* Card luminose con micro-ombre e angoli smussati */
body.page.admin-page .card {
  padding: 26px 30px;
  margin: 0 0 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 3px 8px rgba(15, 36, 26, 0.02);
  transition: all var(--transition-normal);
}

body.page.admin-page .card:hover {
  box-shadow: 0 4px 14px rgba(15, 36, 26, 0.04);
}

/* KPI / Stat cards */
body.page.admin-page .grid-4 {
  gap: 18px;
}

body.page.admin-page .stat-card {
  padding: 20px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-fast);
}

body.page.admin-page .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 36, 26, 0.05);
  border-color: #dcd6cb;
}

/* Blocchi di sezione con linea separatrice */
body.page.admin-page .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .section-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-deep);
  margin: 0 0 4px;
}

body.page.admin-page .section-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* Pannello formulario interno */
body.page.admin-page .form-panel {
  background: #faf8f5;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px 26px 16px;
  margin-bottom: 28px;
}

/* Sotto-titolo sopra le tabelle */
body.page.admin-page .subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

body.page.admin-page .subbar h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--brand-deep);
}

/* Sotto-tab compatti ed eleganti */
body.page.admin-page .subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

body.page.admin-page .tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  transition: all var(--transition-fast);
}

body.page.admin-page .tab:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
  border-color: #d8d3c8;
}

body.page.admin-page .tab.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(21, 62, 45, 0.2);
}

/* Bottoni Admin: puliti, leggibili e curati */
body.page.admin-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

body.page.admin-page .btn:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(21, 62, 45, 0.18);
}

body.page.admin-page .btn:active {
  transform: translateY(0);
}

body.page.admin-page .btn.secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--ink-secondary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.page.admin-page .btn.secondary:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
  border-color: #d4cfc4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

body.page.admin-page .btn.danger {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: var(--color-danger);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.page.admin-page .btn.danger:hover {
  background: var(--color-danger-bg);
  border-color: #f87171;
  color: #991b1b;
}

body.page.admin-page .btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

body.page.admin-page .btn.xs {
  padding: 5px 11px;
  font-size: 12px;
  gap: 5px;
  border-radius: 5px;
}

/* Form piu' ariosi */
body.page.admin-page .form label {
  margin: 15px 0;
  font-size: 13px;
}

body.page.admin-page .row,
body.page.admin-page .row3,
body.page.admin-page .row4 {
  gap: 16px 20px;
}

body.page.admin-page .form input,
body.page.admin-page .form textarea,
body.page.admin-page select,
body.page.admin-page input[type="date"],
body.page.admin-page input[type="time"],
body.page.admin-page input[type="text"],
body.page.admin-page input[type="email"],
body.page.admin-page input[type="password"] {
  padding: 9px 12px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  border: 1px solid #dcd7cf;
  background: #ffffff;
  color: var(--ink-primary);
  transition: all var(--transition-fast);
}

body.page.admin-page .form input:focus,
body.page.admin-page .form textarea:focus,
body.page.admin-page select:focus,
body.page.admin-page input[type="date"]:focus,
body.page.admin-page input[type="time"]:focus,
body.page.admin-page input[type="text"]:focus,
body.page.admin-page input[type="email"]:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
  outline: none;
}

/* Tabelle leggere con righe ariose */
body.page.admin-page .table {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

body.page.admin-page .table th {
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: #faf8f5;
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .table td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .table tbody tr:hover {
  background: #faf9f6;
}

/* Gruppi fasce orarie (una card per sede/paese) */
body.page.admin-page .loc-group {
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  overflow: visible;
  background: #ffffff;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Separatore tra una tabella di sede e quella successiva */
body.page.admin-page hr.loc-sep {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 18px 0;
}

body.page.admin-page .loc-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .loc-group-head .lg-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-deep);
}

body.page.admin-page .loc-group-head .lg-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 4px;
}

body.page.admin-page .loc-group-head .lg-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Conferma inline "Rimuovi tutte le fasce": esce da destra con movimento smooth */
body.page.admin-page .del-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.page.admin-page .del-all-confirm {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 10px;
  background: var(--color-danger-bg);
  border: 1px solid #fecaca;
  animation: dacIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.page.admin-page .del-all-confirm.dac-out {
  animation: dacOut 0.18s ease-in both;
}

body.page.admin-page .dac-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-danger);
}

@keyframes dacIn {
  from {
    opacity: 0;
    transform: translateX(26px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes dacOut {
  from {
    opacity: 1;
    transform: none;
  }

  to {
    opacity: 0;
    transform: translateX(26px);
  }
}

body.page.admin-page .loc-group .table {
  border: none;
}

body.page.admin-page .loc-group .table td {
  padding: 11px 18px;
}

body.page.admin-page .loc-group .table tbody tr:last-child td {
  border-bottom: none;
}

/* Turni: suddivisione del periodo di permanenza in segmenti (solo admin) */
body.page.admin-page .shifts-box {
  padding: 13px 18px 15px;
  background: #fcfcfb;
  border-bottom: 1px solid var(--border-light);
}

body.page.admin-page .sh-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

body.page.admin-page .sh-head b {
  font-size: 13px;
  color: var(--brand-deep);
}

body.page.admin-page .sh-head .material-symbols-outlined {
  font-size: 16px;
  color: var(--brand-primary);
}

body.page.admin-page .sh-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

body.page.admin-page .sh-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 5px 11px;
  background: var(--brand-light);
  border: 1px solid rgba(24, 61, 45, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--brand-primary);
}

body.page.admin-page .sh-pill .sh-range {
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .sh-ico {
  display: inline-flex;
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

body.page.admin-page .sh-ico:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-primary);
}

body.page.admin-page .sh-ico-del:hover {
  color: var(--color-danger);
}

body.page.admin-page .sh-ico .material-symbols-outlined {
  font-size: 15px;
}

body.page.admin-page .sh-sel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--brand-light);
  border: 1px solid rgba(24, 61, 45, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--brand-primary);
}

body.page.admin-page .sh-sel .sh-sel-count b {
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .sh-sel .muted {
  font-size: 12.5px;
}

body.page.admin-page .sh-th-chk,
body.page.admin-page .sh-chk {
  width: 36px;
  text-align: center;
}

body.page.admin-page .sh-th-chk input[type="checkbox"],
body.page.admin-page .sh-chk input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin: 0;
  vertical-align: middle;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:hover,
body.page.admin-page .sh-chk input[type="checkbox"]:hover {
  border-color: var(--brand-primary);
  transform: scale(1.08);
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:checked,
body.page.admin-page .sh-chk input[type="checkbox"]:checked {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:checked::after,
body.page.admin-page .sh-chk input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4.5px;
  height: 8.5px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:indeterminate {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:indeterminate::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 8px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transform: none;
}

body.page.admin-page .sh-th-chk input[type="checkbox"]:focus-visible,
body.page.admin-page .sh-chk input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page .sh-badge {
  min-width: 20px;
  text-align: center;
  justify-content: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .sh-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
}

/* Colori dei turni (1-5, poi si ripetono) */
body.page.admin-page .sh-b1 {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

body.page.admin-page .sh-b2 {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

body.page.admin-page .sh-b3 {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

body.page.admin-page .sh-b4 {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

body.page.admin-page .sh-b5 {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be1239;
}

/* Nota in fondo */
body.page.admin-page .foot-note {
  font-size: 12.5px;
  margin-top: 14px;
}

/* Riquadro stato: ultimo concluso + in corso + prossimo appuntamento */
body.page.admin-page .nn-card {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #ffffff;
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

body.page.admin-page .nn-panel {
  padding: 20px 26px 22px;
  min-width: 0;
}

body.page.admin-page .nn-panel+.nn-panel {
  border-left: 1px solid var(--border-light);
}

body.page.admin-page .nn-current {
  background: #f6faf7;
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

body.page.admin-page .nn-next {
  box-shadow: inset 3px 0 0 var(--gold-primary);
}

body.page.admin-page .nn-prev {
  box-shadow: inset 3px 0 0 var(--ink-muted);
}

body.page.admin-page .nn-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

body.page.admin-page .nn-dot {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  animation: nnPulse 1.6s ease-in-out infinite;
}

@keyframes nnPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

body.page.admin-page .nn-client {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-deep);
  margin-bottom: 6px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.page.admin-page .nn-client.nn-empty {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-muted);
  font-style: italic;
}

body.page.admin-page .nn-meta {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.8;
}

body.page.admin-page .nn-time {
  font-weight: 700;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .nn-sep {
  color: #cbd5e1;
  margin: 0 4px;
}

/* Note esito: "com'e' andato" l'ultimo appuntamento */
body.page.admin-page .nn-outcome {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

body.page.admin-page .nn-outcome label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

body.page.admin-page .nn-outcome textarea {
  width: 100%;
  min-height: 66px;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink-primary);
}

body.page.admin-page .nn-outcome textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

body.page.admin-page .nn-outcome-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Clienti (clients.php) */
body.page.admin-page .search-bar {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 18px;
}

body.page.admin-page .search-bar>.material-symbols-outlined {
  position: absolute;
  left: 14px;
  font-size: 19px;
  color: var(--ink-muted);
  pointer-events: none;
}

body.page.admin-page .search-bar input {
  width: 100%;
  padding: 10px 14px 10px 44px;
  font-family: var(--font-ui);
  font-size: 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--ink-primary);
  outline: none;
  transition: all var(--transition-fast);
}

body.page.admin-page .search-bar input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page .search-bar input::placeholder {
  color: var(--ink-muted);
}

/* Barra di ricerca: resta fissa in alto quando si scorre la lista clienti.
   Nessun overflow sugli ancestor (.card/.admin-main): sticky arriva alla viewport */
body.page.admin-page .search-bar.sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 10px 0;
  margin-bottom: 8px;
  background: var(--bg-surface);
}

body.page.admin-page .search-bar.sticky.stuck {
  box-shadow: 0 10px 18px -10px rgba(15, 36, 26, 0.35);
}

body.page.admin-page .client-row {
  cursor: pointer;
}

body.page.admin-page .client-row .chev {
  display: inline-flex;
  vertical-align: -6px;
  color: var(--ink-muted);
  transition: transform var(--transition-fast);
}

body.page.admin-page .client-row .chev .material-symbols-outlined {
  font-size: 20px;
}

body.page.admin-page .client-row.open .chev {
  transform: rotate(180deg);
}

body.page.admin-page tr.client-detail td {
  background: var(--bg-subtle);
  padding: 0 16px 14px;
}

body.page.admin-page .client-detail-box {
  border-left: 2px solid var(--brand-primary);
  padding: 8px 0 2px 14px;
}

body.page.admin-page .client-booking {
  font-size: 13.5px;
  color: var(--ink-secondary);
  padding: 6px 0;
  line-height: 1.6;
}

body.page.admin-page .client-booking .cb-date {
  font-weight: 700;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .client-booking .cb-time {
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .client-booking .cb-loc {
  margin-left: 10px;
}

body.page.admin-page .client-booking .cb-loc .material-symbols-outlined {
  font-size: 15px;
  vertical-align: -3px;
  color: var(--ink-muted);
}

body.page.admin-page .client-booking .cb-note {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-style: italic;
}

body.page.admin-page .client-booking .cb-note .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -2px;
  font-style: normal;
}

@media (max-width: 900px) {
  body.page.admin-page .nn-card {
    grid-template-columns: 1fr;
  }

  body.page.admin-page .nn-panel+.nn-panel {
    border-left: none;
    border-top: 1px solid var(--border-light);
  }
}

/* Editing inline tabella sedi */
body.page.admin-page td[data-field] {
  cursor: text;
}

body.page.admin-page td[data-field]:hover {
  background: #f5f5f4;
}

body.page.admin-page .cell-editing {
  width: 100%;
  padding: 7px 9px;
  font-size: 13.5px;
  font-family: var(--font-ui);
  border: 1px solid var(--brand-primary);
  background: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page textarea.cell-editing {
  resize: vertical;
  min-height: 64px;
}

/* Riga di aggiunta sedi */
body.page.admin-page tr.add-row td {
  background: var(--bg-subtle);
  border-top: 2px solid var(--border-light);
  padding-top: 14px;
  padding-bottom: 14px;
}

body.page.admin-page tr.add-row input,
body.page.admin-page tr.add-row select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font-ui);
  color: var(--ink-primary);
  background: #ffffff;
  border: 1px solid #d6d6d2;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body.page.admin-page tr.add-row input::placeholder {
  color: #9ca3af;
  font-style: italic;
}

body.page.admin-page tr.add-row input:focus,
body.page.admin-page tr.add-row select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page tr.add-row .btn {
  white-space: nowrap;
}

/* Riga vuota fasce orarie: semi trasparente, opaca al hover */
body.page.admin-page #availGroups tr.add-row {
  opacity: 0.2;
  transition: opacity var(--transition-fast);
}

body.page.admin-page #availGroups tr.add-row:hover,
body.page.admin-page #availGroups tr.add-row:focus-within {
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ========================================================================== */

@media (max-width: 1060px) {
  .booking-shell {
    grid-template-columns: 1fr 1fr 0;
    max-width: 100%;
  }

  .booking-shell.slots-open {
    grid-template-columns: 1fr 1fr 300px;
  }
}

@media (max-width: 920px) {
  .booking-page {
    padding: 12px 8px;
    align-items: flex-start;
  }

  .booking-shell,
  .booking-shell.slots-open {
    grid-template-columns: 1fr;
    min-height: auto;
    border-radius: var(--radius-lg);
  }

  .pane-left {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 24px 20px;
  }

  .pane-center {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 24px 20px;
  }

  .pane-right {
    padding: 24px 20px;
    max-height: none;
  }

  .cal-grid {
    gap: 2px;
  }

  .cday {
    min-height: 56px;
  }

  .frow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .month-label {
    min-width: 120px;
    font-size: 15px;
  }

  .cday .dnum {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
}

/* ---------- Modal (es. Invito personale in clients.php) ---------- */
body.page.admin-page .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(24, 22, 18, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.page.admin-page .modal-card {
  background: #ffffff;
  width: min(660px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: 0 24px 60px rgba(15, 36, 26, 0.2);
  animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

body.page.admin-page .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

body.page.admin-page .modal-head h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  color: var(--brand-deep);
}

body.page.admin-page .modal-head .muted {
  margin: 5px 0 0;
  font-size: 12.5px;
}

body.page.admin-page .modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

body.page.admin-page .modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

body.page.admin-page .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body.page.admin-page .icon-btn .material-symbols-outlined {
  font-size: 19px;
}

body.page.admin-page .icon-btn:hover {
  color: var(--ink-primary);
  background: rgba(15, 36, 26, 0.06);
  border-color: var(--border-light);
}

body.page.admin-page .row-actions {
  text-align: right;
  white-space: nowrap;
}

/* Modal: invito personale */
body.page.admin-page .inv-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

body.page.admin-page .inv-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

body.page.admin-page .inv-field select {
  width: 100%;
  padding: 9px 10px;
  font-size: 13.5px;
  background: #ffffff;
  border: 1px solid #dcd7cf;
  border-radius: var(--radius-sm);
}

body.page.admin-page .inv-field select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page .inv-field input,
body.page.admin-page .inv-field textarea {
  width: 100%;
  padding: 9px 10px;
  font-size: 13.5px;
  font-family: inherit;
  background: #ffffff;
  border: 1px solid #dcd7cf;
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}

body.page.admin-page .inv-field input:focus,
body.page.admin-page .inv-field textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page .inv-field-name {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-light);
}

body.page.admin-page .inv-namehint {
  margin: 6px 0 0;
  font-size: 11.5px;
}

body.page.admin-page .inv-dates-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
}

body.page.admin-page .inv-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 184px;
  overflow: auto;
  padding: 11px;
  background: #faf8f5;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
}

body.page.admin-page .inv-dates .muted {
  margin: 0;
  font-size: 12.5px;
}

body.page.admin-page .inv-chip {
  position: relative;
  display: inline-flex;
}

body.page.admin-page .inv-chip-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

body.page.admin-page .inv-chip-face {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 11px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  transition: all 0.15s ease;
}

body.page.admin-page .inv-chip-face b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

body.page.admin-page .inv-chip-face em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-muted);
}

body.page.admin-page .inv-chip-input:checked+.inv-chip-face {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-deep);
}

body.page.admin-page .inv-chip-input:checked+.inv-chip-face em {
  color: var(--brand-primary);
}

body.page.admin-page .inv-chip-input:focus-visible+.inv-chip-face {
  box-shadow: 0 0 0 3px var(--brand-glow);
}

body.page.admin-page .inv-linkbox {
  margin-top: 16px;
  padding: 13px 15px;
  background: var(--brand-light);
  border: 1px solid rgba(21, 62, 45, 0.15);
  border-radius: var(--radius-sm);
}

body.page.admin-page .inv-linkbox label {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

body.page.admin-page .inv-linkrow {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}

body.page.admin-page .inv-linkrow input {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  padding: 9px 10px;
  background: #ffffff;
  border: 1px solid #dcd7cf;
  border-radius: var(--radius-sm);
}

body.page.admin-page .inv-linkhint {
  margin: 9px 0 0;
  font-size: 12px;
}

@media(max-width:768px) {
  .muted {
    font-size: unset;
    margin: 0;
    line-height: auto;
  }
}

/* ==========================================================================
   CALENDAR & APPOINTMENTS HISTORY VIEW
   ========================================================================== */

.cal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-month-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-deep);
  min-width: 200px;
  text-align: center;
}

.cal-view-toggles {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  gap: 2px;
}

.cal-view-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.cal-view-btn:hover {
  color: var(--ink-primary);
}

.cal-view-btn.active {
  background: #ffffff;
  color: var(--brand-deep);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cal-month-grid {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.cal-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #faf8f5;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

.cal-weekday {
  padding: 10px 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day-cell {
  min-height: 110px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 6px 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-fast);
  position: relative;
}

.cal-day-cell:nth-child(7n) {
  border-right: none;
}

.cal-day-cell.other-month {
  background: #fbfaf8;
  opacity: 0.45;
}

.cal-day-cell.is-today {
  background: #fdfaf3;
}

.cal-day-cell.is-today .cal-day-num {
  background: var(--brand-primary);
  color: #ffffff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.cal-day-num {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.cal-day-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}

.cal-events-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 110px;
}

.cal-event-item {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1.25;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cal-event-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cal-event-item.pending {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.cal-event-item.confirmed {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.cal-event-item.cancelled {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  opacity: 0.65;
  text-decoration: line-through;
}

.cal-event-item .time {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.cal-event-item .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .cal-month-title {
    font-size: 17px;
    min-width: 150px;
  }
  .cal-day-cell {
    min-height: 75px;
    padding: 4px 4px;
  }
  .cal-event-item {
    font-size: 10px;
    padding: 2px 4px;
  }
}

/* ==========================================================================
   DROPDOWN UNIFICATO AZIONI APPUNTAMENTO (appointments.php)
   ========================================================================== */
body.page.admin-page .loc-group .table {
  overflow: visible;
}

.booking-actions-wrap {
  position: relative;
  display: inline-block;
  text-align: right;
}

.booking-actions-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-deep, #153e2d);
  background: #ffffff;
  border: 1px solid var(--border-light, #dcd7cf);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.booking-actions-btn .chev {
  font-size: 17px;
  transition: transform 0.2s ease;
  color: var(--ink-muted, #718096);
}

.booking-actions-btn:hover {
  background: var(--bg-subtle, #f7f5f1);
  border-color: var(--brand-primary, #1f5f43);
  color: var(--brand-primary, #1f5f43);
}

.booking-actions-wrap.is-open .booking-actions-btn {
  background: var(--brand-primary, #1f5f43);
  color: #ffffff;
  border-color: var(--brand-primary, #1f5f43);
  box-shadow: 0 2px 6px rgba(31, 95, 67, 0.25);
}

.booking-actions-wrap.is-open .booking-actions-btn .chev {
  transform: rotate(180deg);
  color: #ffffff;
}

.booking-actions-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  min-width: 185px;
  background: #ffffff;
  border: 1px solid #dcd7cf;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(15, 36, 26, 0.15), 0 3px 8px rgba(0, 0, 0, 0.05);
  padding: 6px 0;
  z-index: 1000;
  text-align: left;
}

.booking-actions-wrap.is-open .booking-actions-dropdown {
  display: block;
  animation: fadeInDown 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.booking-actions-wrap.drop-up .booking-actions-dropdown {
  top: auto;
  bottom: calc(100% + 5px);
  animation: fadeInUp 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-primary, #1b2420);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.action-dropdown-item span.material-symbols-outlined {
  font-size: 18px;
  color: var(--ink-muted, #718096);
  transition: color 0.12s ease;
}

.action-dropdown-item:hover {
  background: #f7f5f1;
  color: var(--brand-deep, #153e2d);
}

.action-dropdown-item.item-confirm {
  color: #1e7e34;
  font-weight: 600;
}
.action-dropdown-item.item-confirm span.material-symbols-outlined {
  color: #1e7e34;
}
.action-dropdown-item.item-confirm:hover {
  background: #edf7ee;
}

.action-dropdown-item.item-wa span.material-symbols-outlined {
  color: #25D366;
}
.action-dropdown-item.item-wa:hover {
  background: #f0faf4;
}

.action-dropdown-divider {
  height: 1px;
  background: var(--border-light, #e5e2dc);
  margin: 5px 0;
}

.action-dropdown-item.item-cancel {
  color: #b02a1e;
}
.action-dropdown-item.item-cancel span.material-symbols-outlined {
  color: #b02a1e;
}
.action-dropdown-item.item-cancel:hover {
  background: #fdf2f2;
}

/* ==========================================================================
   MOBILE & SMARTPHONE RESPONSIVENESS OVERHAUL (100% RESPONSIVE)
   ========================================================================== */

/* Universal table responsive container */
.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 95, 67, 0.3) transparent;
}

.table-responsive::-webkit-scrollbar {
  height: 5px;
}
.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-subtle, #f5f3ef);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cfc9be;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary, #1f5f43);
}

/* Base protection: no page horizontal stretching on viewport */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 900px) {
  /* Admin layout containment */
  body.page.admin-page {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    min-height: 100vh;
  }

  body.page.admin-page .admin-main {
    margin-left: 0 !important;
    padding: 16px 12px 50px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  body.page.admin-page .card {
    padding: 16px 12px !important;
    margin-bottom: 16px !important;
    border-radius: var(--radius-md) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }

  /* Locations / appointments group card */
  body.page.admin-page .loc-group {
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 16px !important;
    border-radius: var(--radius-md) !important;
  }

  body.page.admin-page .loc-group-head {
    padding: 12px 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  body.page.admin-page .loc-group-head .lg-actions {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Responsive Tables on mobile: keep data intact and scrollable sideways */
  body.page.admin-page .table {
    min-width: 620px;
    font-size: 13px !important;
  }

  body.page.admin-page .table th {
    padding: 10px 12px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }

  body.page.admin-page .table td {
    padding: 10px 12px !important;
    font-size: 12.5px !important;
    white-space: nowrap !important;
  }

  /* Fallback: any table inside card or loc-group scrolls cleanly */
  body.page.admin-page .card > .table,
  body.page.admin-page .loc-group > .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Topbar */
  body.page.admin-page .admin-topbar {
    margin-bottom: 18px !important;
    padding-bottom: 14px !important;
    gap: 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.page.admin-page .admin-topbar h1 {
    font-size: 21px !important;
    line-height: 1.25 !important;
  }

  body.page.admin-page .admin-topbar .sub {
    font-size: 12.5px !important;
    line-height: 1.4 !important;
  }

  body.page.admin-page .admin-topbar .top-actions {
    width: 100% !important;
  }

  body.page.admin-page .admin-topbar .top-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Section heads and filters */
  body.page.admin-page .section-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  body.page.admin-page .section-head > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  body.page.admin-page .section-head > div:last-child select,
  body.page.admin-page .section-head > div:last-child input,
  body.page.admin-page .section-head > div:last-child button,
  body.page.admin-page .section-head > div:last-child .btn {
    flex: 1 1 auto;
    font-size: 12.5px !important;
  }

  /* Shifts box in admin.php */
  body.page.admin-page .shifts-box {
    padding: 10px 12px !important;
  }
  body.page.admin-page .sh-head {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  body.page.admin-page .sh-sel {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* Search bar in clients.php */
  body.page.admin-page .search-bar {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  body.page.admin-page .search-bar input {
    font-size: 13.5px !important;
  }

  /* KPI / Stat cards */
  body.page.admin-page .grid-4 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  body.page.admin-page .stat-card {
    padding: 12px 14px !important;
  }
  body.page.admin-page .stat-num {
    font-size: 22px !important;
  }

  /* Modals */
  body.page.admin-page .modal-backdrop {
    padding: 12px !important;
  }
  body.page.admin-page .modal-card {
    width: 100% !important;
    max-height: 92vh !important;
    border-radius: var(--radius-md) !important;
  }
  body.page.admin-page .inv-grid2 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Calendar page responsive adjustments */
  .cal-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .cal-controls > div {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .cal-controls select,
  .cal-controls input {
    flex: 1 1 auto;
  }
  .cal-view-toggles {
    width: 100% !important;
    display: flex !important;
  }
  .cal-view-toggles .cal-view-btn {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Frontend container & cards */
  .container {
    max-width: 100% !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 600px) {
  /* Single-column KPI on very small devices */
  body.page.admin-page .grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Calendar day cells on mobile phones */
  .cal-weekdays-row {
    font-size: 10.5px !important;
  }
  .cal-weekday {
    padding: 6px 1px !important;
  }
  .cal-day-cell {
    min-height: 56px !important;
    padding: 3px 2px !important;
  }
  .cal-day-num {
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }
  .cal-event-item {
    font-size: 9.5px !important;
    padding: 2px 3px !important;
    line-height: 1.2 !important;
    margin-bottom: 2px !important;
    border-radius: 3px !important;
  }
  .cal-event-item .time {
    font-size: 8.5px !important;
    display: block !important;
  }
}
