.cal-skeleton {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.cal-skeleton-bar {
  height: 48px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: calShimmer 1.5s ease infinite;
  border-radius: var(--radius-sm, 10px);
}

/* ─── Floating Action Button ─── */
.cal-fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transform: scale(0.6) translateY(20px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.cal-fab.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.cal-fab:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.cal-fab:active { transform: scale(0.95); }

@media (max-width: 720px) {
  .cal-fab {
    right: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
  }
}
@media (min-width: 721px) {
  .cal-fab { display: none; }
}

/* ─── Mobile filter dropdown ─── */
.cal-filter-dropdown {
  position: relative;
  display: none;
}
@media (max-width: 768px) {
  .cal-list-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ─── Bottom sheet modal on mobile ─── */
@media (max-width: 768px) {
  .modal-overlay-bottom-sheet {
    align-items: flex-end;
    padding: 0;
  }
  .modal-overlay-bottom-sheet .modal-panel {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: modalSheetIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    display: flex;
    flex-direction: column;
  }
  .modal-overlay-bottom-sheet.closing .modal-panel {
    animation: modalSheetOut 0.25s ease forwards;
  }
  .modal-sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    margin: 8px auto -4px;
  }
  .modal-overlay-bottom-sheet .modal-header {
    padding: 16px 18px 12px;
  }
  .modal-overlay-bottom-sheet .modal-body {
    padding: 12px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
  }
  .modal-overlay-bottom-sheet .modal-footer {
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
  }
}

@keyframes modalSheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes modalSheetOut {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@media (max-width: 768px) {
  .cal-status-bar-mobile .status-chip,
  .cal-status-bar-mobile .status-chip-clear {
    display: none;
  }
  .cal-filter-dropdown {
    display: block;
    margin-left: auto;
  }
  .cal-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 12px;
    background: rgba(201, 169, 110, 0.1);
    border: 1px solid rgba(201, 169, 110, 0.25);
    color: var(--gold-light);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
  }
  .cal-filter-trigger[aria-expanded="true"] {
    background: rgba(201, 169, 110, 0.18);
    border-color: rgba(201, 169, 110, 0.4);
  }
  .cal-filter-trigger-chev {
    transition: transform 0.2s ease;
  }
  .cal-filter-trigger[aria-expanded="true"] .cal-filter-trigger-chev {
    transform: rotate(180deg);
  }
  .cal-filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    min-width: 200px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .cal-filter-menu[hidden] { display: none; }
  .cal-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 12px;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
  }
  .cal-filter-option:hover,
  .cal-filter-option[aria-selected="true"] {
    background: rgba(201, 169, 110, 0.12);
  }
  .cal-filter-option .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }
}

/* ─── Sticky calendar header on mobile ─── */
@media (max-width: 768px) {
  #calendar .calendar-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(180deg, var(--bg) 80%, transparent);
    padding-bottom: 12px;
    margin-bottom: 12px;
    backdrop-filter: blur(8px);
  }
  .calendar-nav-btn {
    width: 40px !important;
    height: 40px !important;
  }
  .calendar-title {
    font-size: 16px;
    min-width: unset;
    flex: 1 1 auto;
    text-align: center;
  }
  #cal-today {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ─── Day view: enhanced now indicator ─── */
.cal-now-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
}
.cal-now-line {
  flex: 1;
  height: 2px;
  background: var(--danger);
  box-shadow: 0 0 8px rgba(229, 115, 115, 0.5);
}
.cal-now-dot {
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px rgba(229, 115, 115, 0.6);
}
.cal-now-label {
  position: absolute;
  right: 6px;
  top: -10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--danger);
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(229, 115, 115, 0.3);
}

/* ─── Day view: mobile hint ─── */
@media (max-width: 768px) {
  .calendar-day-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 0;
    letter-spacing: 0.04em;
  }
}

/* ─── Month view: count badge per day ─── */
.cal-day-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  background: rgba(201, 169, 110, 0.18);
  color: var(--gold-light);
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  line-height: 1;
}
.cal-month-cell {
  position: relative;
}

/* ─── Mobile month view: more compact cells ─── */
@media (max-width: 768px) {
  .cal-month-cell {
    min-height: 70px;
    padding: 4px;
  }
  .cal-day-number {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
  }
  .cal-month-appointment {
    font-size: 10px;
    padding: 2px 4px;
    line-height: 1.3;
  }
  .cal-month-appointment-time {
    font-weight: 600;
    opacity: 0.9 !important;
  }
  .cal-month-more {
    font-size: 10px;
  }
  .calendar-status-bar {
    flex-wrap: wrap;
  }
  .calendar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .view-switcher {
    width: 100%;
    justify-content: center;
  }
  .view-switcher-btn {
    flex: 1;
    min-height: 40px;
  }
  #cal-new-btn {
    display: none; /* replaced by FAB on mobile */
  }
}

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

.cal-view-entering {
  animation: calViewFade 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.calendar-nav-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: grid;
  place-items: center;
  min-width: unset;
  border-radius: 50% !important;
}

.calendar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 220px;
  text-align: center;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.view-switcher {
  display: flex;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 100px;
  overflow: hidden;
  min-height: 42px;
}

.view-switcher-btn {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-height: 40px;
}

.view-switcher-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  border-radius: 100px;
}

.view-switcher-btn:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

#cal-new-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-status-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.calendar-grid-container {
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  min-height: 36px;
  appearance: none;
  position: relative;
}

.status-chip .chip-icon {
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
}

.status-chip strong {
  font-weight: 600;
}

.status-chip.scheduled {
  background: var(--status-scheduled-bg);
  color: var(--status-scheduled);
  border-color: rgba(201, 169, 110, 0.15);
}

.status-chip.completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
  border-color: rgba(129, 199, 132, 0.15);
}

.status-chip.cancelled {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled);
  border-color: rgba(107, 102, 94, 0.15);
}

.status-chip.no_show {
  background: var(--status-no_show-bg);
  color: var(--status-no_show);
  border-color: rgba(229, 115, 115, 0.15);
}

.status-chip.rescheduled {
  background: var(--status-rescheduled-bg);
  color: var(--status-rescheduled);
  border-color: rgba(255, 183, 77, 0.15);
}

.status-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.status-chip.active.scheduled {
  background: rgba(201, 169, 110, 0.18);
  border-color: rgba(201, 169, 110, 0.4);
  box-shadow: 0 0 12px rgba(201, 169, 110, 0.15);
}

.status-chip.active.completed {
  background: rgba(129, 199, 132, 0.18);
  border-color: rgba(129, 199, 132, 0.4);
  box-shadow: 0 0 12px rgba(129, 199, 132, 0.15);
}

.status-chip.active.cancelled {
  background: rgba(107, 102, 94, 0.18);
  border-color: rgba(107, 102, 94, 0.4);
}

.status-chip.active.no_show {
  background: rgba(229, 115, 115, 0.18);
  border-color: rgba(229, 115, 115, 0.4);
  box-shadow: 0 0 12px rgba(229, 115, 115, 0.15);
}

.status-chip.active.rescheduled {
  background: rgba(255, 183, 77, 0.18);
  border-color: rgba(255, 183, 77, 0.4);
  box-shadow: 0 0 12px rgba(255, 183, 77, 0.15);
}

/* ─── Month View ─── */

.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-month-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.cal-month-header-cell {
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-right: 1px solid rgba(255,255,255,0.04);
}

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

.cal-month-cell {
  min-height: 110px;
  padding: 8px;
  border-right: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

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

.cal-month-cell:hover {
  background: rgba(255,255,255,0.02);
}

.cal-month-cell.other-month {
  background: rgba(255,255,255,0.01);
}

.cal-month-cell.other-month .cal-day-number {
  color: var(--text-muted);
  opacity: 0.5;
}

.cal-month-cell.today {
  background: rgba(201, 169, 110, 0.05);
  border-color: rgba(201, 169, 110, 0.15);
}

.cal-month-cell.weekend {
  background: rgba(255,255,255,0.01);
}

.cal-day-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-day-number.today-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  font-weight: 600;
}

.cal-month-cell.today .cal-day-number {
  color: var(--gold);
}

.cal-appointments-in-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-month-appointment {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border-left: 3px solid;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--transition);
  max-width: 100%;
}

.cal-month-appointment:hover {
  transform: translateX(2px);
  filter: brightness(1.2);
}

.cal-month-more {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 4px;
  cursor: pointer;
}

.cal-month-more:hover {
  color: var(--gold);
}

.dragging {
  opacity: 0.5;
}

.cal-drop-target {
  background: rgba(201, 169, 110, 0.08) !important;
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
}

/* ─── Week/Day View ─── */

.cal-time-grid {
  display: grid;
  position: relative;
}

.cal-week-layout {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-week-scroll {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-week-scroll .cal-week-layout {
  border: 0;
  border-radius: 0;
}

.cal-day-layout {
  display: grid;
  grid-template-columns: 60px 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-week-header {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}

.cal-week-header-day {
  padding: 12px 8px;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.04);
}

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

.cal-week-day-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.cal-week-day-number {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-secondary);
  margin-top: 4px;
}

.cal-week-header-day.today .cal-week-day-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  margin: 4px auto 0;
  font-size: 16px;
}

.cal-week-header-day.selected:not(.today) .cal-week-day-number {
  color: var(--gold-light);
}

.cal-week-header-spacer {
  border-right: 1px solid var(--border);
}

.cal-time-label {
  padding: 0 8px;
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--text-muted);
  transform: translateY(-6px);
  border-right: 1px solid var(--border);
}

.cal-time-slot {
  height: 30px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-right: 1px solid rgba(255,255,255,0.04);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cal-time-slot:hover {
  background: rgba(255,255,255,0.015);
}

.cal-time-slot:nth-child(2n) {
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

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

.cal-appointment-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  border-left: 3px solid;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  transition: var(--transition);
  min-height: 24px;
}

.cal-appointment-block:hover {
  transform: scale(1.02);
  z-index: 5;
  filter: brightness(1.1);
}

.cal-appointment-block .appt-time {
  font-size: 10px;
  opacity: 0.8;
}

.cal-appointment-block .appt-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-appointment-block .appt-client {
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Day view time column */
.cal-day-time-col {
  display: flex;
  flex-direction: column;
}

.cal-day-appointment-area {
  position: relative;
}

/* ─── List View ─── */

.cal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-list-group-header {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  padding: 16px 0 8px;
  border-bottom: 1px solid rgba(201, 169, 110, 0.15);
  margin-top: 8px;
}

.cal-list-group-header:first-child {
  margin-top: 0;
}

.cal-list-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  cursor: pointer;
  transition: var(--transition);
}

.cal-list-card:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.04);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.cal-list-card-time {
  min-width: 70px;
  text-align: center;
}

.cal-list-card-time .time {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.cal-list-card-time .duration {
  font-size: 11px;
  color: var(--text-muted);
}

.cal-list-card-time .time-period {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-top: -2px;
}

/* ─── List view: visual state (past/future/today) ─── */
.cal-list-group-header.is-today {
  color: var(--gold);
  font-size: 13px;
}
.cal-list-group-header.is-past {
  color: var(--text-muted);
  opacity: 0.7;
}
.cal-list-card.is-past {
  opacity: 0.65;
}
.cal-list-card.is-future {
  background: linear-gradient(90deg, rgba(201, 169, 110, 0.06), transparent 40%);
}

@media (max-width: 768px) {
  .cal-list-group-header {
    font-size: 13px;
    padding: 14px 4px 8px;
    margin-top: 6px;
  }
  .cal-list-card {
    padding: 14px 12px;
    gap: 12px;
  }
  .cal-list-card-info {
    min-width: 0;
  }
  .cal-list-card-title {
    font-size: 15px;
  }
  .cal-list-card-status {
    padding: 3px 8px;
    font-size: 10px;
  }
}

.cal-list-card-info {
  flex: 1;
  min-width: 0;
}

.cal-list-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-list-card-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-list-card-status {
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Modal ─── */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalOverlayIn 0.25s ease forwards;
}

.modal-overlay.closing {
  animation: modalOverlayOut 0.2s ease forwards;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-panel {
  background: var(--bg-elevated, #111113);
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: modalPanelIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-overlay.closing .modal-panel {
  animation: modalPanelOut 0.2s ease forwards;
}

@keyframes modalPanelIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
}

.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer .btn-danger {
  margin-right: auto;
  background: transparent;
  border: 1px solid rgba(229, 115, 115, 0.3);
  color: var(--danger);
  border-radius: 100px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.modal-footer .btn-danger:hover {
  background: rgba(229, 115, 115, 0.1);
  border-color: rgba(229, 115, 115, 0.5);
}

.modal-status-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 24px 4px;
}

.modal-status-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.modal-status-btn:hover {
  background: rgba(255,255,255,0.03);
}

.modal-status-btn.active {
  border-color: currentColor;
  font-weight: 600;
}

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

.form-row-single {
  display: grid;
  grid-template-columns: 1fr;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
}

.client-combobox {
  position: relative;
}

.client-combobox-trigger {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.client-combobox-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-combobox.open .client-combobox-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12);
}

.client-combobox-menu {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg-elevated, #111113);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.client-combobox.open .client-combobox-menu {
  display: block;
}

#client-combobox-search {
  width: 100%;
  margin-bottom: 8px;
}

.client-combobox-options {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-combobox-option {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  cursor: pointer;
}

.client-combobox-option:hover,
.client-combobox-option.selected {
  background: rgba(201, 169, 110, 0.12);
}

.client-combobox-option small {
  color: var(--text-muted);
  font-size: 12px;
}

.client-combobox-empty {
  padding: 12px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Confirm Dialog ─── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalOverlayIn 0.2s ease forwards;
}

.confirm-panel {
  background: var(--bg-elevated, #111113);
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: modalPanelIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}
.confirm-icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(229, 115, 115, 0.3);
}
.confirm-icon-warning {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(255, 183, 77, 0.3);
}
.confirm-icon-info {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid rgba(100, 181, 246, 0.3);
}

.confirm-panel h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.confirm-panel p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-actions .secondary {
  min-width: 100px;
}

.confirm-actions .btn-confirm-danger {
  min-width: 100px;
  background: linear-gradient(135deg, #e57373, #c62828);
  color: white;
  border: 0;
  border-radius: 100px;
  padding: 10px 24px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.confirm-actions .btn-confirm-danger:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.confirm-actions .btn-confirm-warning {
  min-width: 100px;
  background: linear-gradient(135deg, #ffb74d, #c67c30);
  color: #0a0a0b;
  border: 0;
  border-radius: 100px;
  padding: 10px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.confirm-actions .btn-confirm-info {
  min-width: 100px;
  background: linear-gradient(135deg, #64b5f6, #1976d2);
  color: white;
  border: 0;
  border-radius: 100px;
  padding: 10px 24px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

/* ─── Toast ─── */

.cal-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  display: none;
}

/* ─── Empty State ─── */

.cal-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--text-muted);
  animation: calViewFade 0.5s ease;
}

.cal-empty-state-icon {
  font-size: 48px;
  opacity: 0.3;
}

.cal-empty-state-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-secondary);
}

.cal-empty-state-text {
  font-size: 14px;
  text-align: center;
  max-width: 300px;
  line-height: 1.6;
}

/* ─── Responsive ─── */

@media (max-width: 1024px) {
  .calendar-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .view-switcher {
    flex: 1;
    overflow-x: auto;
  }

  .cal-month-cell {
    min-height: 80px;
    padding: 4px;
  }

  .cal-month-appointment {
    font-size: 10px;
    padding: 1px 4px;
  }
}

@media (max-width: 768px) {
  .calendar-grid-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .calendar-title {
    font-size: 16px;
    min-width: unset;
    flex: 1 1 auto;
  }

  .view-switcher-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .status-chip {
    padding: 4px 10px;
    font-size: 11px;
  }

  .cal-week-header,
  .cal-week-layout {
    grid-template-columns: 44px repeat(7, minmax(88px, 1fr));
    min-width: 660px;
  }

  .cal-week-scroll .cal-week-header,
  .cal-week-scroll .cal-week-layout {
    min-width: 660px;
  }

  .cal-day-layout {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .cal-time-label {
    font-size: 10px;
    padding: 0 4px;
  }

  .cal-month-cell {
    min-height: 60px;
  }

  .cal-month-appointment {
    display: none;
  }

  .cal-month-more {
    display: none;
  }

  .cal-month-cell.show-dots .cal-appointments-in-cell {
    display: flex;
    flex-direction: row;
    gap: 3px;
    margin-top: 4px;
  }

  .cal-month-cell.show-dots .cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  .modal-panel {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-footer .primary,
  .modal-footer .secondary,
  .modal-footer .btn-danger {
    min-height: 44px;
  }
}

/* Scroll hint for week view on small screens */
@media (max-width: 768px) {
  .calendar-week-hint {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 0;
    letter-spacing: 0.04em;
  }
}
.calendar-week-hint { display: none; }

@media (max-width: 560px) {
  .calendar-header,
  .calendar-nav,
  .calendar-actions {
    width: 100%;
  }

  .calendar-nav {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
  }

  #cal-today {
    grid-column: 1 / -1;
    width: 100%;
  }

  .calendar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .view-switcher {
    width: 100%;
  }

  .view-switcher-btn {
    flex: 1 0 auto;
  }

  #cal-new-btn {
    width: 100%;
    justify-content: center;
  }

  .calendar-status-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-chip {
    justify-content: center;
  }

  .cal-month-header,
  .cal-month-grid {
    min-width: 308px;
  }

  .cal-week-header,
  .cal-week-layout {
    grid-template-columns: 40px repeat(7, minmax(86px, 1fr));
    min-width: 642px;
  }

  .cal-week-scroll .cal-week-header,
  .cal-week-scroll .cal-week-layout {
    min-width: 642px;
  }

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

  .modal-overlay {
    align-items: stretch;
    padding: 0;
    place-items: stretch;
  }

  .modal-panel {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .modal-header {
    padding: 18px 16px 0;
  }

  .modal-status-bar {
    padding: 0 16px 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(17, 17, 19, 0.96);
    border-top: 1px solid var(--border);
  }

  .modal-footer .btn-danger {
    grid-column: 1 / -1;
    margin-right: 0;
  }

  .modal-footer .primary,
  .modal-footer .secondary,
  .modal-footer .btn-danger {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }

  .client-combobox-options {
    max-height: 180px;
  }

  .confirm-overlay {
    padding: 14px;
  }

  .confirm-panel {
    padding: 24px 18px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions .secondary,
  .confirm-actions .btn-confirm-danger {
    width: 100%;
    min-height: 44px;
  }

  .cal-list-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .calendar-header {
    gap: 10px;
    margin-bottom: 14px;
  }
  .calendar-nav {
    gap: 6px;
  }
  .calendar-title {
    font-size: 15px;
  }
  .calendar-nav-btn {
    width: 36px !important;
    height: 36px !important;
  }
  #cal-today {
    padding: 7px 12px;
    font-size: 12px;
  }
  .view-switcher {
    min-height: 38px;
  }
  .view-switcher-btn {
    padding: 5px 10px;
    font-size: 11.5px;
    min-height: 36px;
  }
  .calendar-status-bar {
    gap: 6px;
    margin-bottom: 14px;
  }
  .status-chip {
    padding: 4px 8px;
    font-size: 10.5px;
    min-height: 32px;
    gap: 4px;
  }
  .status-chip strong {
    font-size: 10.5px;
  }
  .cal-month-cell {
    min-height: 52px;
    padding: 3px;
  }
  .cal-day-number {
    font-size: 12px;
  }
  .cal-day-number.today-number {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .cal-month-header-cell {
    padding: 8px 4px;
    font-size: 10px;
  }
  .cal-list-card {
    padding: 12px 10px;
    gap: 6px;
  }
  .cal-list-card-time .time {
    font-size: 14px;
  }
  .cal-list-card-title {
    font-size: 14px;
  }
  .cal-list-group-header {
    font-size: 12px;
    padding: 12px 2px 6px;
  }
  .cal-fab {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
  }
  .modal-header {
    padding: 14px 14px 0;
  }
  .modal-header h2 {
    font-size: 18px;
  }
  .modal-body {
    padding: 14px;
    gap: 12px;
  }
  .modal-footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .modal-status-bar {
    padding: 0 14px 4px;
  }
  .modal-status-btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  .confirm-panel {
    padding: 20px 14px;
  }
  .confirm-panel h3 {
    font-size: 16px;
  }
  .confirm-panel p {
    font-size: 13px;
  }
  .confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .cal-empty-state {
    padding: 50px 16px;
  }
  .cal-empty-state-icon {
    font-size: 36px;
  }
  .cal-empty-state-title {
    font-size: 16px;
  }
  .cal-empty-state-text {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .calendar-title {
    font-size: 14px;
  }
  .calendar-nav-btn {
    width: 32px !important;
    height: 32px !important;
  }
  .view-switcher-btn {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 34px;
  }
  .status-chip {
    padding: 3px 6px;
    font-size: 10px;
    min-height: 28px;
  }
  .cal-month-cell {
    min-height: 46px;
    padding: 2px;
  }
  .cal-day-number {
    font-size: 11px;
  }
  .cal-month-header-cell {
    font-size: 9px;
    padding: 6px 2px;
  }
  .cal-list-card {
    padding: 10px 8px;
  }
  .cal-list-card-time .time {
    font-size: 13px;
  }
  .cal-list-card-title {
    font-size: 13px;
  }
  .cal-list-card-detail {
    font-size: 11px;
  }
  .cal-list-card-status {
    font-size: 10px;
    padding: 2px 8px;
  }
  .cal-fab {
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
  }
  .modal-header h2 {
    font-size: 17px;
  }
  .modal-body {
    padding: 12px;
    gap: 10px;
  }
  .modal-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }
  .confirm-panel {
    padding: 18px 12px;
  }
  .confirm-panel h3 {
    font-size: 15px;
  }
  .confirm-panel p {
    font-size: 12.5px;
    margin-bottom: 18px;
  }
  .confirm-actions {
    gap: 8px;
  }
}

/* Late mobile calendar overrides: keep week/day sizing after desktop base rules. */
@media (max-width: 768px) {
  .cal-day-layout,
  .cal-week-scroll {
    --cal-mobile-hour-height: 44px;
    --cal-mobile-slot-height: 22px;
    max-height: clamp(320px, calc(100dvh - 420px), 460px);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .cal-day-layout {
    grid-template-columns: 44px minmax(0, 1fr);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .cal-week-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cal-week-scroll .cal-week-header,
  .cal-week-scroll .cal-week-layout {
    grid-template-columns: 44px repeat(7, minmax(96px, 1fr));
    min-width: 716px;
  }

  .cal-week-scroll .cal-week-header {
    position: sticky;
    top: 0;
    z-index: 8;
    background: rgba(17, 17, 19, 0.96);
    backdrop-filter: blur(8px);
  }

  .cal-week-layout {
    overflow: visible;
  }

  .cal-week-layout > .cal-day-time-col,
  .cal-week-header-spacer {
    position: sticky;
    left: 0;
    z-index: 9;
    background: rgba(17, 17, 19, 0.98);
  }

  .cal-week-header-day {
    padding: 8px 4px;
  }

  .cal-week-day-name {
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .cal-week-day-number {
    font-size: 18px;
    margin-top: 2px;
  }

  .cal-week-header-day.today .cal-week-day-number {
    width: 30px;
    height: 30px;
    font-size: 14px;
    margin-top: 2px;
  }

  .cal-time-label {
    height: var(--cal-mobile-hour-height);
    padding: 2px 5px 0 0;
    font-size: 10px;
    line-height: 1;
    transform: none;
  }

  .cal-time-slot {
    height: var(--cal-mobile-slot-height);
    min-height: var(--cal-mobile-slot-height);
  }

  .cal-appointment-block {
    left: 4px;
    right: 4px;
    padding: 3px 6px;
  }

  .cal-week-layout .cal-appointment-block .appt-client {
    display: none;
  }

  .cal-week-layout .cal-appointment-block .appt-title {
    font-size: 11px;
  }

  .calendar-week-hint {
    display: block;
  }
}

/* ─── Modal Notification Toggles ─── */
.modal-notification-section {
  margin-top: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
}

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

.modal-notification-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.modal-notification-toggles {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  flex: 1 1 190px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--divider-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 14px;
  color: var(--text-secondary);
}

.toggle-row > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}

.mini-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  flex: 0 0 auto;
  margin-left: auto;
}

.mini-toggle input[type="checkbox"] {
  display: none;
}

.mini-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 100px;
  transition: background 0.3s ease;
}

.mini-toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.3s ease;
}

.mini-toggle input:checked + .mini-toggle-switch {
  background: rgba(201, 169, 110, 0.3);
}

.mini-toggle input:checked + .mini-toggle-switch::after {
  transform: translateX(16px);
  background: var(--gold);
}

.modal-notification-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-template-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}

.modal-template-link:hover,
.modal-template-link:focus-visible {
  color: var(--gold);
  font-weight: 500;
  text-decoration: underline;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .modal-notification-section {
    padding: 12px;
  }
  .modal-notification-title {
    font-size: 12px;
  }
  .modal-notification-toggles {
    gap: 6px;
  }
  .toggle-row {
    flex: 1 1 100%;
    min-height: 36px;
    padding: 7px 8px;
    font-size: 13px;
    gap: 8px;
  }
  .modal-notification-hint {
    font-size: 11px;
  }
  .client-combobox-trigger {
    padding: 8px 10px;
    font-size: 13px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .modal-notification-section {
    padding: 10px;
  }
  .toggle-row {
    padding: 6px;
    font-size: 12.5px;
  }
  .mini-toggle-switch {
    width: 32px;
    height: 18px;
  }
  .mini-toggle-switch::after {
    width: 12px;
    height: 12px;
  }
  .mini-toggle input:checked + .mini-toggle-switch::after {
    transform: translateX(14px);
  }
}
