/* ═══════════════════════════════════════════════════════════════
   SCHEDULER ADMIN — Design System v3  "Digital Health"
   Aesthetic: Swiss Medical Precision · Electric Indigo · Clinical Air
   Fonts: Outfit (numbers/display) · DM Sans (body) · JetBrains Mono
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Base surfaces */
  --bg:       #F4F7FA;
  --surface:  #FFFFFF;
  --surface2: #F0F4F8;
  --surface3: #E8EDF3;

  /* Borders */
  --border:        #E2E8F0;
  --border-strong: #CBD5E1;

  /* Accent — Índigo Eléctrico */
  --accent:        #4F46E5;
  --accent-hover:  #4338CA;
  --accent-dim:    #EEF2FF;
  --accent-border: #C7D2FE;
  --purple:        #7C3AED;

  /* State colors */
  --green:         #10B981;
  --green-dim:     #D1FAE5;
  --green-border:  #A7F3D0;

  --yellow:        #F59E0B;
  --yellow-dim:    #FEF3C7;
  --yellow-border: #FDE68A;

  --red:           #DC2626;
  --red-dim:       #FEE2E2;
  --red-border:    #FECACA;

  /* Typography */
  --text:       #1E293B;
  --text-muted: #475569;
  --text-dim:   #94A3B8;

  /* Tokens */
  --radius:     10px;
  --font:       'DM Sans', system-ui, sans-serif;
  --font-num:   'Outfit', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lift: 0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.14), 0 4px 14px rgba(0,0,0,0.07);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideToast {
  from { transform: translateY(70px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

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

/* ── Body — subtle dot grid texture ─────────────────────────── */
body {
  background-color: var(--bg);
  background-image: radial-gradient(circle, #D1D9E6 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--accent) 0%, var(--purple) 100%) 1;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Header ──────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(87, 208, 173, 0.45)) drop-shadow(0 1px 2px rgba(0,0,0,0.12));
}

.header-title h1 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}
.header-title p {
  font-size: 11px;
  color: var(--text-dim);
}

.header-right { display: flex; align-items: center; gap: 8px; }

/* ── Stream indicator ────────────────────────────────────────── */
.stream-indicator {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.1px;
  transition: all 0.3s ease;
}
.stream-indicator.connected {
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid var(--green-border);
}
.stream-indicator.disconnected {
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:hover   { opacity: 0.88; }
.btn:active  { opacity: 0.72; transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
  opacity: 1;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.38);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); opacity: 1; border-color: var(--border-strong); }

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.btn-warning {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid var(--yellow-border);
}
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Layout ──────────────────────────────────────────────────── */
.page {
  padding: 28px 28px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Date nav ────────────────────────────────────────────────── */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.date-nav h2 {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  text-transform: capitalize;
  letter-spacing: -0.4px;
  color: var(--text);
}
.date-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.date-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.date-input::-webkit-calendar-picker-indicator { opacity: 0.45; cursor: pointer; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  animation: fadeSlideUp 0.4s ease both;
}
.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.09s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card:nth-child(4) { animation-delay: 0.19s; }
.stat-card:nth-child(5) { animation-delay: 0.24s; }

.stat-card:hover {
  box-shadow: var(--shadow-lift);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* Colored top strip per status */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}
.stat-card.blue::after   { background: linear-gradient(90deg, var(--accent), var(--purple)); }
.stat-card.green::after  { background: var(--green); }
.stat-card.yellow::after { background: var(--yellow); }
.stat-card.red::after    { background: var(--red); }
.stat-card.purple::after { background: linear-gradient(90deg, var(--purple), var(--accent)); }

.stat-icon {
  font-size: 18px;
  margin-bottom: 8px;
  display: block;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stat-value {
  font-family: var(--font-num);
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2.5px;
  color: var(--text);
  margin: 4px 0 2px;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Section header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

/* ── Filters — segmented control ─────────────────────────────── */
.filters {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-btn {
  padding: 5px 13px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-btn:hover { color: var(--text-muted); }
.filter-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 1px var(--border);
  color: var(--accent);
  font-weight: 700;
}

/* ── Appointment list ────────────────────────────────────────── */
.appt-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.appt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px 14px 22px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.appt-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 4px; height: 100%;
  background: var(--border-strong);
  transition: background 0.15s;
}
.appt-card:hover,
.appt-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
  outline: none;
}

/* Status left borders */
.appt-card[data-status="booked"]::before    { background: var(--accent); }
.appt-card[data-status="completed"]::before { background: var(--green); }
.appt-card[data-status="no_show"]::before   { background: var(--yellow); }
.appt-card[data-status="cancelled"]::before { background: var(--red); }

.appt-time { text-align: center; }
.appt-time .time {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}
.appt-time .end-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}

.appt-info { display: flex; flex-direction: column; gap: 3px; }
.appt-patient {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.appt-service { font-size: 12px; color: var(--text-muted); }
.appt-professional { font-size: 11px; color: var(--text-dim); }

.appt-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-booked {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}
.badge-completed {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}
.badge-no_show {
  background: var(--yellow-dim);
  color: var(--yellow);
  border-color: var(--yellow-border);
}
.badge-cancelled {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red-border);
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 48px;
  gap: 8px;
  color: var(--text-dim);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon { font-size: 32px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box { transform: translateY(16px) scale(0.98); transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}
.modal-header p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--surface2);
}

/* ── Detail sections ─────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 500px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-label {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.detail-value { font-size: 13.5px; font-weight: 500; color: var(--text); }
.detail-value.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── Chat history ────────────────────────────────────────────── */
.chat-history { display: flex; flex-direction: column; gap: 10px; }
.chat-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 84%;
}
.chat-msg.user      { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.assistant { align-self: flex-start; }

.chat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 2px;
}
.chat-msg.user .chat-avatar {
  background: linear-gradient(135deg, var(--accent), var(--purple));
}
.chat-msg.assistant .chat-avatar {
  background: var(--surface2);
  border: 1px solid var(--border);
}

.chat-bubble {
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  color: var(--text);
}
.chat-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  text-align: right;
}

/* ── Loading ─────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dim);
  gap: 10px;
  font-size: 13px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 11px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 999;
  transform: translateY(70px);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(.16,1,.3,1), opacity 0.24s;
  max-width: 300px;
  line-height: 1.4;
  color: var(--text);
}
#toast.show    { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green-border); color: var(--green); background: var(--green-dim); }
#toast.error   { border-color: var(--red-border);   color: var(--red);   background: var(--red-dim); }

/* ── Main tabs ───────────────────────────────────────────────── */
.main-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.main-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 10px 18px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0;
  margin-bottom: -1px;
  position: relative;
}
.main-tab:hover { color: var(--text-muted); }
.main-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Professionals list ──────────────────────────────────────── */
.prof-list { display: flex; flex-direction: column; gap: 8px; }

.prof-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-card);
}
.prof-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.prof-avatar {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.prof-info { flex: 1; min-width: 0; }
.prof-name { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; color: var(--text); }
.prof-specialty { color: var(--text-muted); font-size: 12.5px; }
.prof-schedule-summary { color: var(--text-dim); font-size: 11px; margin-top: 3px; }
.prof-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Schedule editor ─────────────────────────────────────────── */
.modal-wide { max-width: 680px; }

.schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.schedule-day {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.schedule-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.day-name { font-weight: 600; font-size: 12.5px; flex: 1; color: var(--text); }
.day-toggle {
  position: relative;
  width: 34px;
  height: 18px;
  cursor: pointer;
}
.day-toggle input { opacity: 0; width: 0; height: 0; }
.day-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border-radius: 20px;
  transition: background 0.2s;
}
.day-toggle input:checked + .day-toggle-track { background: var(--accent); }
.day-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.day-toggle input:checked ~ .day-toggle-thumb { left: 18px; }

.slots-container { display: flex; flex-direction: column; gap: 5px; }
.slot-row { display: flex; align-items: center; gap: 8px; }
.slot-row input[type="time"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  width: 88px;
  font-family: var(--mono);
  transition: border-color 0.15s;
}
.slot-row input[type="time"]:focus { outline: none; border-color: var(--accent); }
.slot-sep { color: var(--text-dim); font-size: 11px; }
.slot-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.slot-remove:hover { color: var(--red); background: var(--red-dim); }
.add-slot-btn {
  background: none;
  border: 1px dashed var(--border-strong);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11px;
  margin-top: 4px;
  width: 100%;
  font-family: var(--font);
  transition: border-color 0.15s, color 0.15s;
}
.add-slot-btn:hover { border-color: var(--accent); color: var(--accent); }

.services-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
}
.service-name { flex: 1; font-size: 13px; font-weight: 500; }
.service-meta { color: var(--text-dim); font-size: 11px; white-space: nowrap; }

.section-divider {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prof-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-row input,
.form-row select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-row input:focus,
.form-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-row select { cursor: pointer; }

/* ── WhatsApp tab ────────────────────────────────────────────── */
.wa-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-card);
}
.wa-status-icon { font-size: 28px; flex-shrink: 0; }
.wa-status-info { flex: 1; }
.wa-status-title { font-weight: 700; font-size: 15px; margin-bottom: 3px; color: var(--text); }
.wa-status-sub   { color: var(--text-muted); font-size: 12.5px; }
.wa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.wa-status-badge.connected {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}
.wa-status-badge.disconnected {
  background: var(--surface3);
  color: var(--text-dim);
  border-color: var(--border);
}

.wa-connect-form { margin-top: 4px; }

/* Embedded Signup */
.btn-meta-signup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #1877F2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-meta-signup:hover   { background: #166fe5; }
.btn-meta-signup:disabled { opacity: .6; cursor: not-allowed; }

.wa-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: 12px;
}
.wa-divider::before,
.wa-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.wa-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 4px; }
.wa-step  { display: flex; gap: 14px; align-items: flex-start; }
.wa-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: var(--font-num);
}
.wa-step-body { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.wa-step-body strong { color: var(--text); display: block; margin-bottom: 2px; font-weight: 600; }
.wa-step-body code {
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.wa-info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  max-width: 580px;
  box-shadow: var(--shadow-sm);
}
.wa-field-row  { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.wa-field-label {
  font-size: 11.5px;
  color: var(--text-dim);
  width: 150px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.wa-field-value {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 6px;
  word-break: break-all;
  border: 1px solid var(--accent-border);
}

/* ── Login overlay ───────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  background-image: radial-gradient(circle, #D1D9E6 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.login-overlay.visible { opacity: 1; pointer-events: all; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.4s ease both;
}
.login-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(87, 208, 173, 0.50)) drop-shadow(0 2px 4px rgba(0,0,0,0.10));
}
.login-title {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.4px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin: 6px 0 28px;
}
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-field input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.login-error {
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
  text-align: center;
}
.login-btn {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  width: 100%;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.32);
  letter-spacing: 0.1px;
}
.login-btn:hover  { opacity: 0.92; box-shadow: 0 6px 20px rgba(79, 70, 229, 0.42); transform: translateY(-1px); }
.login-btn:active { opacity: 0.75; transform: translateY(0); }
.login-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.login-forgot {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
}
.login-forgot a {
  color: var(--text-muted);
  text-decoration: none;
}
.login-forgot a:hover { color: var(--accent); text-decoration: underline; }
.login-success {
  font-size: 12px;
  color: var(--green, #22c55e);
  min-height: 16px;
  text-align: center;
  background: var(--green-dim, #f0fdf4);
  border: 1px solid var(--green-border, #bbf7d0);
  border-radius: 6px;
  padding: 8px 12px;
}

/* ── Calendar view ───────────────────────────────────────────── */
.cal-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.cal-view-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.cal-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}
.cal-legend-dot.booked    { background: var(--accent); }
.cal-legend-dot.completed { background: var(--green); }
.cal-legend-dot.no_show   { background: var(--yellow); }
.cal-legend-dot.cancelled { background: var(--text-dim); }

.cal-view-filters select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* FullCalendar overrides */
#fc-container {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}
#fc-container .fc {
  font-family: var(--font);
  font-size: 13px;
}
#fc-container .fc-toolbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}
#fc-container .fc-button {
  background: var(--surface-raised, #f1f5f9);
  border: 1px solid var(--border) !important;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px !important;
  box-shadow: none !important;
  transition: background 0.15s;
}
#fc-container .fc-button:hover { background: var(--border); }
#fc-container .fc-button-primary:not(.fc-button-active) { background: var(--surface-raised, #f1f5f9); }
#fc-container .fc-button-active,
#fc-container .fc-button-primary.fc-button-active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
#fc-container .fc-col-header-cell {
  background: var(--surface-raised, #f8fafc);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#fc-container .fc-daygrid-day-number {
  color: var(--text-muted);
  font-size: 12px;
}
#fc-container .fc-day-today { background: rgba(79,142,247,0.06) !important; }
#fc-container .fc-day-today .fc-daygrid-day-number { color: var(--accent); font-weight: 700; }
#fc-container .fc-event {
  border: none !important;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
#fc-container .fc-event.status-booked    { background: var(--accent);   color: #fff; }
#fc-container .fc-event.status-completed { background: var(--green);    color: #fff; }
#fc-container .fc-event.status-no_show   { background: #D97706;         color: #fff; }
#fc-container .fc-event.status-cancelled { background: var(--text-dim); color: #fff; }
#fc-container .fc-timegrid-slot { height: 36px; }
#fc-container .fc-list-event:hover td { background: var(--surface-raised, #f1f5f9) !important; cursor: pointer; }
#fc-container .fc-list-event-title a { color: var(--text); text-decoration: none; }
#fc-container .fc-list-day-cushion { background: var(--surface-raised, #f8fafc) !important; }
#fc-container .fc-theme-standard td,
#fc-container .fc-theme-standard th { border-color: var(--border); }
#fc-container .fc-scrollgrid { border-color: var(--border) !important; }

/* ── Top banners ─────────────────────────────────────────────── */
#top-banners { display: flex; flex-direction: column; gap: 0; }
.top-banner {
  padding: 10px 24px;
  font-size: 13px;
  text-align: center;
}
.top-banner.banner-info    { background: #dbeafe; color: #1e40af; border-bottom: 1px solid #bfdbfe; }
.top-banner.banner-warning { background: #fef9c3; color: #854d0e; border-bottom: 1px solid #fde68a; }
.top-banner.banner-danger  { background: #fee2e2; color: #991b1b; border-bottom: 1px solid #fecaca; }

/* ── WhatsApp templates ──────────────────────────────────────── */
.tmpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.tmpl-info { flex: 1; min-width: 0; }
.tmpl-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; font-family: var(--mono); }
.tmpl-body-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
  margin-bottom: 6px;
}
.tmpl-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tmpl-status.APPROVED  { background: #dcfce7; color: #15803d; }
.tmpl-status.PENDING   { background: #fef9c3; color: #a16207; }
.tmpl-status.REJECTED  { background: #fee2e2; color: #b91c1c; }
.tmpl-status.PAUSED    { background: #f1f5f9; color: #64748b; }
.tmpl-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
#tmpl-body { font-family: var(--mono); font-size: 13px; resize: vertical; }

/* ── Handoffs banner ─────────────────────────────────────────── */
#handoffs-banner {
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 22px;
}
.handoffs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 12px;
}
.handoffs-badge {
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: var(--font-num);
}
.handoffs-list { display: flex; flex-direction: column; gap: 6px; }
.handoff-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid var(--red-border);
  box-shadow: var(--shadow-sm);
}
.handoff-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.handoff-name  { font-weight: 700; font-size: 13px; color: var(--text); }
.handoff-phone { font-size: 12px; color: var(--text-muted); }
.handoff-channel { font-size: 11.5px; color: var(--text-dim); }
.handoff-time  { font-size: 11px; color: var(--text-dim); }

/* ── Pending banner (modo supervisado) ──────────────────────── */
#pending-banner {
  background: #fef9ec;
  border: 1px solid #f5c842;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 22px;
}
#pending-banner .handoffs-header { color: #a07a00; }
#pending-banner .handoffs-badge  { background: #f5c842; color: #333; }
#pending-banner .handoff-item    { border-color: #f5c842; }

/* ── Toggle switch ───────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border); border-radius: 24px; transition: 0.2s;
}
.toggle-slider:before {
  position: absolute; content: ''; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Fechas bloqueadas ───────────────────────────────────────── */
.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 24px;
}
.blocked-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-card);
}
.blocked-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}
.blocked-icon { font-size: 18px; flex-shrink: 0; }
.blocked-info { flex: 1; min-width: 0; }
.blocked-dates { font-size: 13.5px; font-weight: 600; color: var(--text); }
.blocked-reason { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 16px; }
  header { padding: 0 16px; height: 52px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 40px; }

  .appt-card { grid-template-columns: 60px 1fr; padding-left: 18px; }
  .appt-badge { display: none; }

  .date-nav { flex-wrap: wrap; }
  .date-nav h2 { order: -1; width: 100%; font-size: 15px; }

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

  .main-tabs { overflow-x: auto; scrollbar-width: none; }
  .main-tabs::-webkit-scrollbar { display: none; }
  .main-tab  { font-size: 12px; padding: 9px 12px; white-space: nowrap; }

  .filters { flex-wrap: wrap; }

  .login-card { padding: 32px 24px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Clientes ─────────────────────────────────────────────────────────────── */
.client-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.client-name { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.client-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.client-id   { font-size: 11px; color: var(--text-dim); }

.modal-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 90%;
  max-height: 88vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.modal-box .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title  { font-weight: 700; font-size: 15px; }
.modal-box .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted); }
.modal-box .modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px 22px; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.form-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); margin-bottom: 10px;
}

/* servicios */
.service-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.service-row .svc-name     { flex: 1; }
.service-row .svc-duration { width: 80px; }

/* horario */
.cl-schedule-grid { display: flex; flex-direction: column; gap: 8px; }
.schedule-row  { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.schedule-check { display: flex; align-items: center; gap: 6px; width: 110px; color: var(--text-muted); }
.schedule-row input[type="time"] { background: var(--surface3); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); font-size: 13px; }

/* credenciales */
.cred-row   { display: flex; align-items: center; gap: 12px; background: var(--surface3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.cred-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); width: 80px; flex-shrink: 0; }
.cred-value { font-family: monospace; font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: .04em; }

/* ── Tab Configuración ── */
.config-section       { margin-bottom: 28px; }
.config-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 12px; }
.config-card          { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; max-width: 520px; }

/* ── Editor de servicios del profesional ── */
.prof-svc-header { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; padding: 0 2px; }
.prof-svc-col-name  { flex: 1; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.prof-svc-col-dur   { width: 75px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); text-align: center; }
.prof-svc-col-price { width: 90px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); text-align: center; }
.prof-svc-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.prof-svc-row .svc-name     { flex: 1; }
.prof-svc-row .svc-duration { width: 75px; text-align: center; }
.prof-svc-row .svc-price    { width: 90px; text-align: center; }
.prof-svc-row .svc-remove   { flex-shrink: 0; }
