/* ================================================================
   QuidBooking Panel — Design Italia (Bootstrap Italia 2.x)
   Palette PA: blu #0066CC | teal #007B6E | verde #008A4B
                arancio #C04C00 | viola #6B48C8 | ardesia #5C6F82
   ================================================================ */

/* ---- Variabili colore ---- */
:root {
  --qb-blue:    #0066CC;
  --qb-teal:    #007B6E;
  --qb-green:   #008A4B;
  --qb-orange:  #C04C00;
  --qb-purple:  #6B48C8;
  --qb-slate:   #5C6F82;
  --qb-dark:    #17324D;
  --qb-bg:      #F5F7FA;
  --bs-primary: #0066CC;
}

.qb-main {
  --bs-warning: #ffc107;
  --bs-warning-rgb: 255, 193, 7;
  --bs-warning-text-emphasis: #664d03;
  --bs-warning-bg-subtle: #fff3cd;
  --bs-warning-border-subtle: #ffecb5;
}

.qb-main .btn-warning {
  --bs-btn-color: #000;
  --bs-btn-bg: #ffc107;
  --bs-btn-border-color: #ffc107;
  --bs-btn-hover-color: #000;
  --bs-btn-hover-bg: #ffca2c;
  --bs-btn-hover-border-color: #ffc720;
  --bs-btn-focus-shadow-rgb: 255, 193, 7;
  --bs-btn-active-color: #000;
  --bs-btn-active-bg: #ffcd39;
  --bs-btn-active-border-color: #ffc720;
}

.qb-main .bg-warning,
.qb-main .text-bg-warning {
  background-color: #ffc107 !important;
  color: #000 !important;
}

.qb-main .table-warning {
  --bs-table-bg: #fff3cd;
  --bs-table-color: #000;
}

html, body, button, input, select, textarea {
  font-family: "Titillium Web", sans-serif !important;
}

/* ================================================================
   TOPBAR — sticky, bianca, compatta
   ================================================================ */
.qb-topbar {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
  height: 56px;
  z-index: 1030;
  padding: 0;
}

.qb-topbar .container-fluid {
  height: 56px;
}

.qb-topbar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.qb-topbar-tenant {
  margin-left: 1.5rem;
}

.qb-topbar-select {
  min-width: 200px;
  max-width: 300px;
  font-size: .85rem;
  border-color: #c5cdd6;
}

.qb-topbar-select:focus {
  border-color: var(--qb-blue);
  box-shadow: 0 0 0 .2rem rgba(0, 102, 204, .15);
}

.qb-topbar-user-btn {
  background: transparent;
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  color: var(--qb-dark);
  padding: .3rem .6rem;
  transition: background .15s, border-color .15s;
}

.qb-topbar-user-btn:hover {
  background: #f0f4f8;
  border-color: #b0bec5;
}

.qb-topbar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  min-width: 220px;
  z-index: 1050;
  overflow: hidden;
}

.qb-topbar-dropdown .dropdown-item {
  font-size: .875rem;
  color: var(--qb-dark);
  text-decoration: none;
  transition: background .12s;
}

.qb-topbar-dropdown .dropdown-item:hover {
  background: #f0f4f8;
}

.qb-topbar-dropdown .dropdown-item.text-danger:hover {
  background: #fef2f2;
}

.qb-topbar-chevron {
  transition: transform .2s ease;
}

.qb-topbar-chevron.open {
  transform: rotate(180deg);
}

[x-cloak] { display: none !important; }

/* ================================================================
   HEADER — login page (vecchio stile, manteniamo per /panel/login)
   ================================================================ */
.quidbooking-header {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 72px;
  padding: 0;
  background: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quidbooking-header-brand {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 18px;
  background-color: #ffffff;
  min-width: 0;
  width: auto;
  max-width: 280px;
  text-align: center;
}

.quidbooking-header-panel {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 32px;
  background-color: #133a7d;
  min-width: 0;
}

.quidbooking-header-panel-inner {
  width: 100%;
}

.quidbooking-logo {
  display: inline-block;
  line-height: 0;
}

.quidbooking-logo-img {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(240px, 55vw);
  margin-inline: auto;
  object-fit: contain;
}

.quidbooking-subtitle {
  color: var(--qb-blue);
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  max-width: 16rem;
}

.quidbooking-user {
  color: #ffffff;
  font-size: 0.9rem;
}

@media (max-width: 767.98px) {
  .quidbooking-header {
    flex-direction: column;
    min-height: 0;
  }
  .quidbooking-header-brand {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 12px 20px;
  }
  .quidbooking-header-panel {
    width: 100%;
    padding: 12px 20px;
    justify-content: center;
  }
  .quidbooking-header-panel-inner.text-end {
    text-align: center !important;
  }
  .quidbooking-logo-img {
    height: 44px;
  }
}

/* Pagina di accesso: card login */
.quidbooking-login-card-brand {
  text-align: center;
  margin-bottom: 1rem;
}

.quidbooking-login-card-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 180px;
  margin: 0 auto 0.5rem;
  object-fit: contain;
}

.quidbooking-login-card-lead {
  font-size: 0.8125rem;
  color: var(--qb-slate);
  margin: 0;
}

/* ================================================================
   SIDEBAR — 3 gruppi con separatore
   ================================================================ */
.qb-sidebar .nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--qb-slate);
  padding: .6rem .75rem .2rem;
  margin-top: .25rem;
}

.qb-sidebar .nav-heading--separator {
  margin-top: .5rem;
  padding-top: .65rem;
  border-top: 1px solid #dee2e6;
}

.qb-sidebar .nav-link {
  border-radius: .25rem;
  padding: .45rem .75rem;
  color: var(--qb-dark);
  font-size: .875rem;
  display: flex;
  align-items: center;
  transition: background .12s, color .12s;
}

.qb-sidebar .nav-link .icon {
  flex-shrink: 0;
  fill: var(--qb-slate);
  transition: fill .12s;
}

.qb-sidebar .nav-link:hover {
  background-color: #EBF3FF;
  color: var(--qb-blue);
}

.qb-sidebar .nav-link:hover .icon {
  fill: var(--qb-blue);
}

.qb-sidebar .nav-link.active {
  background-color: #D6E8FF;
  color: var(--qb-blue);
  font-weight: 600;
}

.qb-sidebar .nav-link.active .icon {
  fill: var(--qb-blue);
}

/* ---- Bottoni primari ---- */
.qb-main .btn-primary,
.qb-sidebar .btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--qb-blue);
  --bs-btn-border-color: var(--qb-blue);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #004f9e;
  --bs-btn-hover-border-color: #004a94;
  --bs-btn-focus-shadow-rgb: 0, 102, 204;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #004a94;
  --bs-btn-active-border-color: #004589;
  font-weight: 600;
}

/* ---- Layout principale: larghezza piena ---- */
.qb-main {
  min-width: 0;
}

/* ---- Titoli nel contenuto ---- */
.qb-main h1, .qb-main .h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--qb-dark);
}
.qb-main h2, .qb-main .h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--qb-dark);
}
.qb-main .card-header h1,
.qb-main .card-header .h5,
.qb-main .card-header h2,
.qb-main .card-header .h6 {
  text-align: left;
}

/* ---- Card con bordo colorato a sinistra ---- */
.qb-card-blue   { border-left: 4px solid var(--qb-blue)   !important; }
.qb-card-teal   { border-left: 4px solid var(--qb-teal)   !important; }
.qb-card-green  { border-left: 4px solid var(--qb-green)  !important; }
.qb-card-orange { border-left: 4px solid var(--qb-orange) !important; }
.qb-card-purple { border-left: 4px solid var(--qb-purple) !important; }
.qb-card-slate  { border-left: 4px solid var(--qb-slate)  !important; }

/* ---- KPI cards (dashboard) ---- */
.qb-kpi {
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  height: 100%;
}
.qb-kpi .qb-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--qb-slate);
}
.qb-kpi .qb-kpi-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--qb-dark);
  margin-top: .25rem;
}

/* ---- Struttura dot indicator ---- */
.qb-struct-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Azioni rapide inline ---- */
.qb-action-btn {
  padding: .15rem .4rem;
  font-size: .8rem;
  line-height: 1.2;
  vertical-align: middle;
}

.qb-action-btn .icon {
  width: 14px;
  height: 14px;
}

/* ---- Badge stato prenotazione ---- */
.qb-badge-pending   { background-color: #FFF3CD; color: #7A4F00; border: 1px solid #FFDA6A; }
.qb-badge-confirmed { background-color: #D1E7DD; color: #0A3622; border: 1px solid #A3CFB8; }
.qb-badge-completed { background-color: #CFF4FC; color: #055160; border: 1px solid #9EEAF9; }
.qb-badge-cancelled { background-color: #F8D7DA; color: #58151C; border: 1px solid #F1AEB5; }
.qb-badge-in-progress { background-color: #D1E7DD; color: #0A3622; border: 1px solid #5FD68B; }

/* ---- Tabelle ---- */
.qb-table thead th {
  background-color: #F0F4F8;
  color: var(--qb-dark);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid #dee2e6;
  padding: .65rem 1rem;
}
.qb-table tbody td {
  padding: .65rem 1rem;
  vertical-align: middle;
  font-size: .9rem;
}
.qb-table tbody tr:hover {
  background-color: #F5F7FA;
}

/* ---- Wizard step badge ---- */
.qb-step-done    { background: var(--qb-green)  !important; color: #fff !important; }
.qb-step-current { background: var(--qb-blue)   !important; color: #fff !important; }
.qb-step-future  { background: #e9ecef !important; color: var(--qb-slate) !important; border: 1px solid #dee2e6; }

/* ---- Footer ---- */
.qb-footer {
  margin-top: 2rem;
  border-top: 1px solid #dbe5f0;
  background: #f7f9fc;
  color: var(--qb-slate);
}

/* ---- Fisarmonica liste gestionali ---- */
.qb-accordion-item {
  border-radius: .5rem;
  background: #fff;
}

.qb-accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: .2rem .3rem;
  border-radius: .5rem;
  border: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
  font-size: .88rem;
  line-height: 1.2;
}

.qb-accordion-summary::-webkit-details-marker {
  display: none;
}

.qb-accordion-summary::after {
  content: "▾";
  margin-left: .45rem;
  font-size: .72rem;
  color: var(--qb-blue);
  transition: transform .2s ease;
}

.qb-accordion-item[open] .qb-accordion-summary::after {
  transform: rotate(180deg);
}

.qb-accordion-item[open] .qb-accordion-summary {
  background: #eaf3ff;
  border-color: #b9d6ff;
}

.qb-accordion-item:not([open]) .qb-accordion-summary:hover {
  background: #f4f8ff;
  border-color: #d3e4ff;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, .08);
}

.qb-accordion-compact .qb-accordion-summary {
  padding: .14rem .3rem;
  min-height: 28px;
}

.qb-accordion-compact[open] > div {
  padding-top: .1rem !important;
}

/* Card aree/uffici/operatori — compatta e colorata */
.entity-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  background: #fff;
}

.entity-card-header {
  background-color: #E8F1FB;
  border-left: 4px solid #0066CC;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.entity-card-title {
  font-family: "Titillium Web", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #0066CC;
}

.entity-card-subtitle {
  font-size: 0.85rem;
  color: #555;
  margin-left: 8px;
}

.entity-card-badge {
  font-size: 0.75rem;
  background-color: #0066CC;
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
}

.entity-card-arrow {
  color: #0066CC;
  font-size: .8rem;
  transition: transform .2s ease;
}

.entity-card-arrow.open {
  transform: rotate(180deg);
}

.entity-card-body {
  padding: 0;
  display: none;
}

.entity-card-body.open {
  padding: 12px 16px;
  display: block;
}

/* ---- Slide-over / overlay ---- */
.qb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1040;
}

.qb-slideout {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 95vw;
  background: #fff;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
}

.qb-slideout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1040;
}

.qb-slideout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.qb-slideout-body {
  padding: 0;
}

.qb-slideout-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
}

.qb-slideout-section:last-child {
  border-bottom: none;
}

.qb-slideout-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.35rem;
}

/* ---- Cursor + row hover for clickable tables ---- */
.cursor-pointer {
  cursor: pointer;
}

tr.cursor-pointer:hover td {
  background-color: #f0f4f8;
}

/* ---- Alpine.js transition helpers ---- */
.translate-x-full {
  transform: translateX(100%);
}

.translate-x-0 {
  transform: translateX(0);
}

/* ---- Modale globale nuovo appuntamento ---- */
.qb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.qb-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}

.qb-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: 12px 12px 0 0;
}

.qb-modal-step-indicator {
  font-size: .75rem;
  color: #6b7280;
}

.qb-modal-steps {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}

.qb-modal-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background .2s;
}

.qb-modal-step-dot.active {
  background: var(--qb-blue);
}

.qb-modal-body {
  padding: 1.25rem;
  flex: 1;
}

.qb-modal-step-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .25rem;
  color: var(--qb-dark);
}

.qb-modal-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-radius: 0 0 12px 12px;
}

/* ---- Mini calendario ---- */
.qb-mini-calendar {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .85rem;
  background: #fafbfc;
}

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

.qb-cal-header {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: #6b7280;
  padding: 4px 0 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.qb-cal-day {
  text-align: center;
  font-size: .8rem;
  padding: 6px 2px 4px;
  border-radius: 8px;
  cursor: default;
  transition: all .15s;
  position: relative;
  min-height: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Disponibile — verde */
.qb-cal-available {
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.qb-cal-available:hover {
  background: #c8e6c9;
  border-color: #4caf50;
  transform: scale(1.05);
}

/* Completo — arancione chiaro */
.qb-cal-full {
  background: #fff3e0;
  color: #bf360c;
  font-weight: 500;
  cursor: not-allowed;
}

/* Chiuso — rosso chiaro */
.qb-cal-closed {
  background: #fce4ec;
  color: #c62828;
  font-weight: 500;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Non disponibile (no fasce orarie) — grigio */
.qb-cal-unavailable {
  background: #f0f0f0;
  color: #bdbdbd;
  cursor: not-allowed;
}

/* Loading — pulsante che lampeggia */
.qb-cal-loading {
  background: #f5f5f5;
  color: #bdbdbd;
  animation: qb-pulse .8s infinite alternate;
}
@keyframes qb-pulse {
  from { opacity: .4; }
  to { opacity: 1; }
}

/* Passato */
.qb-cal-past {
  color: #d1d5db;
  background: transparent;
}

/* Oggi */
.qb-cal-today {
  font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--qb-blue);
}

/* Selezionato */
.qb-cal-selected {
  background: var(--qb-blue) !important;
  color: #fff !important;
  border-color: var(--qb-blue) !important;
  font-weight: 700;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,102,204,0.3);
}

.qb-cal-empty {
  cursor: default;
  background: transparent;
}

/* Badge prenotazioni nel giorno */
.qb-cal-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: .55rem;
  font-weight: 700;
  background: var(--qb-blue);
  color: #fff;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Legenda */
.qb-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.qb-legend-available { background: #c8e6c9; border: 1px solid #4caf50; }
.qb-legend-full { background: #fff3e0; border: 1px solid #ff9800; }
.qb-legend-closed { background: #fce4ec; border: 1px solid #e53935; }
.qb-legend-past { background: #f0f0f0; border: 1px solid #d1d5db; }

/* ---- Griglia slot orari ---- */
.qb-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qb-slot-btn {
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: .85rem;
  cursor: pointer;
  background: #fff;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

/* Slot libero — verde */
.qb-slot-free {
  background: #e8f5e9;
  border-color: #81c784;
  color: #2e7d32;
}
.qb-slot-free:hover {
  background: #c8e6c9;
  border-color: #4caf50;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(76,175,80,0.2);
}

/* Slot selezionato — blu pieno */
.qb-slot-selected {
  background: var(--qb-blue);
  border-color: var(--qb-blue);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,102,204,0.3);
}

.qb-slot-time {
  font-weight: 700;
  font-size: .9rem;
}

.qb-slot-info {
  margin-top: 2px;
}

.qb-slot-spots {
  font-size: .68rem;
  opacity: .8;
}

.qb-slot-few {
  font-size: .68rem;
  font-weight: 700;
  color: #e65100;
}
.qb-slot-selected .qb-slot-few {
  color: #ffe0b2;
}

/* ---- Summary step 4 ---- */
.qb-summary-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.qb-summary-row {
  display: flex;
  justify-content: space-between;
  padding: .5rem .75rem;
  font-size: .875rem;
  border-bottom: 1px solid #f3f4f6;
}

.qb-summary-row:last-child {
  border-bottom: none;
}

.qb-summary-label {
  color: #6b7280;
  font-weight: 500;
}

/* ================================================================
   CALENDARIO SETTIMANA
   ================================================================ */
.qb-cal-week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  border-top: 1px solid #e5e7eb;
  min-width: 900px;
}

.qb-cal-time-col {
  border-right: 1px solid #e5e7eb;
}

.qb-cal-day-col {
  border-right: 1px solid #e5e7eb;
  min-width: 120px;
}

.qb-cal-day-col:last-child {
  border-right: none;
}

.qb-cal-col-header {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 20;
}

.qb-cal-today-col {
  background: #fafbff;
}

.qb-cal-today-header {
  color: var(--qb-blue);
  background: #eef4ff;
}

.qb-cal-time-slot {
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  font-size: .7rem;
  color: #9ca3af;
  border-bottom: 1px solid #f3f4f6;
}

.qb-cal-hour-row {
  height: 60px;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}

.qb-cal-hour-row:hover {
  background: #f0f7ff;
}

.qb-cal-day-body {
  position: relative;
}

/* Fasce disponibilità sfondo — più leggere per non competere con gli eventi */
.qb-cal-avail-bg {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(236,253,245,.4) !important;
  border-left: 2px solid rgba(14,124,123,.15) !important;
  pointer-events: none;
  z-index: 1;
}

/* Base evento */
.qb-cal-event {
  border-radius: 5px !important;
  padding: 4px 7px !important;
  cursor: pointer !important;
  overflow: hidden !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.15) !important;
  transition: transform .1s, box-shadow .1s !important;
  position: absolute;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.4;
}
.qb-cal-event:hover {
  transform: translateX(2px) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
  z-index: 20 !important;
}

/* Evento attivo — blu pieno, testo bianco */
.qb-event-active {
  background: #1D4ED8 !important;
  border-left: 3px solid #1E40AF !important;
  color: #fff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Evento completato — verde scuro */
.qb-event-completed {
  background: #065F46 !important;
  border-left: 3px solid #047857 !important;
  color: #fff !important;
  opacity: .85;
}

/* Evento cancellato — rosso chiaro */
.qb-event-cancelled {
  background: #FEE2E2 !important;
  border-left: 3px solid #EF4444 !important;
  color: #991B1B !important;
  text-decoration: line-through;
  opacity: .7;
}

/* Gerarchia testo dentro l'evento */
.qb-cal-event-time {
  font-size: .7rem !important;
  font-weight: 700 !important;
  opacity: .9;
  display: block;
  margin-bottom: 1px;
}
.qb-cal-event-name {
  font-size: .78rem !important;
  font-weight: 600 !important;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qb-cal-event-service {
  font-size: .68rem !important;
  opacity: .8;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.qb-cal-event-tenant {
  font-size: .65rem;
  opacity: .75;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* Header colonna oggi — evidenziato */
.qb-cal-today-col {
  background: rgba(29,78,216,.03);
}
.qb-cal-today-header {
  color: #1D4ED8;
  background: rgba(29,78,216,.06);
}

/* ================================================================
   STRUTTURA COMUNE — Albero
   ================================================================ */
.qb-struct-sede-row {
  background: #fff;
}

.qb-struct-sede-icon {
  color: #6b7280;
  flex-shrink: 0;
}

.qb-struct-area {
  border-bottom: 1px solid #e5e7eb;
}

.qb-struct-area:last-child {
  border-bottom: none;
}

.qb-struct-area-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .6rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid #f0f0f0;
}

.qb-struct-area-name {
  font-weight: 600;
  font-size: .9rem;
}

.qb-struct-toggle {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.qb-struct-toggle svg {
  transition: transform .2s;
}

.qb-struct-toggle-sm {
  opacity: .7;
}

.qb-struct-office {
  border-bottom: 1px solid #f3f4f6;
  margin-left: 1.5rem;
}

.qb-struct-office:last-child {
  border-bottom: none;
}

.qb-struct-office-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .5rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.qb-struct-office-name {
  font-weight: 500;
  font-size: .85rem;
}

.qb-struct-sede-badge {
  font-size: .72rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 10px;
}

.qb-struct-office-empty,
.qb-struct-service-empty {
  padding: .5rem 2rem;
  font-size: .8rem;
  color: #9ca3af;
  font-style: italic;
}

.qb-struct-service-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .35rem 1rem .35rem 3rem;
  border-bottom: 1px solid #f9fafb;
  font-size: .83rem;
}

.qb-struct-service-row:last-child {
  border-bottom: none;
}

.qb-struct-service-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}

.qb-struct-service-name {
  font-weight: 500;
}

.qb-struct-service-meta {
  color: #9ca3af;
  font-size: .78rem;
}

/* ================================================================
   CALENDARIO MESE
   ================================================================ */
.qb-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid #e5e7eb;
}

.qb-month-header {
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #374151;
  background: #eef2f7;
  padding: 10px 4px;
  border-bottom: 2px solid #d1d5db;
  border-right: 1px solid #d1d5db;
}

.qb-month-header:nth-child(6),
.qb-month-header:nth-child(7) {
  background: #e0e7f1;
  color: #1e40af;
}

.qb-month-header:last-child {
  border-right: none;
}

.qb-month-cell {
  min-height: 85px;
  padding: 6px 8px;
  border-bottom: 1px solid #d1d5db;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  transition: background .15s;
  position: relative;
}

.qb-month-weekend {
  background: #f0f4fa;
}

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

.qb-month-cell:hover {
  background: #e0edff;
}

.qb-month-other {
  background: #f5f5f5;
  opacity: .4;
}

.qb-month-today {
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2.5px #2563eb;
}

.qb-month-today .qb-month-day-number {
  color: #1d4ed8;
  font-weight: 800;
  font-size: .95rem;
}

.qb-month-past {
  background: #f9fafb;
}

.qb-month-day-number {
  font-size: .9rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.qb-month-weekend .qb-month-day-number {
  color: #4338ca;
}

.qb-month-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.qb-month-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.qb-badge-active {
  background: #2563eb;
  color: #fff;
}

.qb-badge-done {
  background: #059669;
  color: #fff;
}

.qb-badge-cancel {
  background: #dc2626;
  color: #fff;
}

.qb-month-booking-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .1s;
  font-size: .85rem;
}

.qb-month-booking-row:last-child {
  border-bottom: none;
}

.qb-month-booking-row:hover {
  background: #f0f7ff;
}

.qb-month-booking-time {
  font-weight: 700;
  font-size: .78rem;
  color: #374151;
  white-space: nowrap;
  min-width: 75px;
}

.qb-month-booking-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.qb-dot-active {
  background: #2563eb;
}

.qb-dot-done {
  background: #16a34a;
}

.qb-dot-cancel {
  background: #dc2626;
}

@media (max-width: 767.98px) {
  .qb-month-cell {
    min-height: 52px;
    padding: 4px;
  }
  .qb-month-day-number {
    font-size: .72rem;
  }
  .qb-month-badge {
    font-size: .6rem;
    min-width: 16px;
    height: 16px;
  }
}

/* ---- Topbar responsive ---- */
@media (max-width: 767.98px) {
  .qb-topbar {
    height: auto;
    min-height: 48px;
  }
  .qb-topbar .container-fluid {
    height: auto;
    flex-wrap: wrap;
    gap: .5rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
  }
  .qb-topbar-logo {
    height: 26px;
  }
}
