/* ==========================================================================
   KAIRO STUDIO IA — DARK BARBER STUDIO DESIGN SYSTEM (styles.css)
   Eslogan: "Kairo no solo agenda… llega en el momento exacto."
   Tema: Carbón Profundo (#0b0d12) + Dorado Ámbar (#f59e0b) + Esmeralda (#10b981)
   ========================================================================== */

:root {
  --bg-main: #0b0d12;
  --bg-card: rgba(20, 24, 34, 0.88);
  --bg-card-hover: rgba(28, 34, 48, 0.95);
  --bg-surface: #151923;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.4);

  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --cyan-500: #06b6d4;
  --cyan-400: #22d3ee;
  --purple-500: #a855f7;
  --rose-500: #f43f5e;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 12% 15%, rgba(245, 158, 11, 0.09) 0%, transparent 40%),
    radial-gradient(circle at 88% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  -webkit-font-smoothing: antialiased;
}

/* ================= LOGIN SCREEN ================= */
.auth-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 36px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(245, 158, 11, 0.12);
}

.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.08));
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
}

.auth-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-slogan {
  text-align: center;
  color: var(--gold-400);
  font-size: 12.5px;
  font-style: italic;
  font-weight: 600;
  margin: 6px 0 22px;
}

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

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

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(11, 13, 18, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: #fff;
  color-scheme: dark;
  font-family: var(--font);
  font-size: 14px;
  transition: 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.btn-gold {
  width: 100%;
  padding: 13px 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0d12;
  font-weight: 800;
  font-size: 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

.quick-login-pills {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.quick-login-title {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-pills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pill-demo-user {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: 0.2s;
}

.pill-demo-user:hover {
  border-color: var(--gold-500);
  color: #fff;
  background: rgba(245, 158, 11, 0.1);
}

/* ================= MAIN STUDIO LAYOUT ================= */
.studio-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* TOP HEADER */
.studio-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.05));
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.brand-title {
  font-size: 16.5px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
}

.kairo-tag {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--border-gold);
  color: var(--gold-400);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.brand-slogan {
  font-size: 11px;
  color: var(--gold-400);
  font-style: italic;
}

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

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--emerald-400);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 20px;
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-400);
  box-shadow: 0 0 10px var(--emerald-400);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.btn-outline:hover {
  border-color: var(--gold-500);
  background: rgba(245, 158, 11, 0.1);
}

/* ================= BARBER CHAIR SELECTOR & QUICK ACTIONS ================= */
.control-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.chair-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chair-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
}

.chair-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(245, 158, 11, 0.08));
  border-color: var(--gold-500);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.chair-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.25);
  color: var(--gold-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.quick-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-action {
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.btn-action.walkin {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--emerald-400);
}

.btn-action.walkin:hover {
  background: rgba(16, 185, 129, 0.28);
}

.btn-action.pausa {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--gold-400);
}

.btn-action.new-appt {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0d12;
  font-weight: 800;
}

/* ================= 4 KPI CARDS (SIN EXCESOS) ================= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-val {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin: 8px 0 4px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ================= LIVE CHAIRS SWIMLANE (3 COLUMNAS POR BARBERO) ================= */
.chairs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.chairs-grid.single-chair {
  grid-template-columns: 1fr;
}

.chair-column {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chair-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.barber-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.barber-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--border-gold);
  color: var(--gold-400);
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.barber-name {
  font-size: 16px;
  font-weight: 800;
}

.barber-spec {
  font-size: 11px;
  color: var(--text-secondary);
}

.barber-stats-pill {
  text-align: right;
}

.barber-earnings {
  font-size: 14px;
  font-weight: 800;
  color: var(--emerald-400);
  display: block;
}

.barber-cuts-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* TARJETA DE CITA EN LA SILLA */
.slot-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--gold-500);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: 0.2s;
}

.slot-card.colorimetria {
  border-left-color: var(--purple-500);
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.08), transparent);
}

.slot-card.completada {
  border-left-color: var(--emerald-500);
  opacity: 0.72;
}

.slot-card.pausa {
  border-left-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slot-time {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-400);
}

.slot-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.slot-badge.dur-60 {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-400);
}

.slot-badge.dur-120 {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
}

.slot-client {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.slot-service {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slot-price {
  font-weight: 800;
  color: var(--emerald-400);
}

.slot-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.btn-mini {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  text-decoration: none;
  transition: 0.15s;
}

.btn-mini:hover {
  color: #fff;
  border-color: var(--gold-500);
}

.btn-mini.done {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--emerald-400);
}

.btn-mini.cancel {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

/* ================= RADAR KAIRO 18 DÍAS & DIRECTORIO ================= */
.bottom-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.radar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radar-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.radar-days {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--border-gold);
  color: var(--gold-400);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  z-index: 999;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #141822;
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.75);
}

.modal-box.modal-box-wide {
  max-width: 580px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 22px;
}

.modal-sticky-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-flex-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.modal-scroll-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: calc(100vh - 210px);
  max-height: calc(100dvh - 210px);
  padding-right: 6px;
}

.modal-scroll-body::-webkit-scrollbar,
.modal-box::-webkit-scrollbar {
  width: 6px;
}

.modal-scroll-body::-webkit-scrollbar-track,
.modal-box::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.modal-scroll-body::-webkit-scrollbar-thumb,
.modal-box::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.45);
  border-radius: 8px;
}

.modal-sticky-footer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.barb-grid-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 10px;
  margin-bottom: 10px;
  align-items: end;
}

.barb-grid-row-contact {
  display: grid;
  grid-template-columns: 195px 1fr;
  gap: 10px;
  margin-bottom: 10px;
  align-items: end;
}

.barb-grid-row .form-group label,
.barb-grid-row-contact .form-group label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CAMPO DE CONTRASEÑA CON OJITO (MOSTRAR / OCULTAR) */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap .form-input {
  padding-right: 44px;
}

.btn-pass-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.18s;
}

.btn-pass-eye:hover {
  color: var(--gold-400);
  background: rgba(245, 158, 11, 0.14);
  border-color: var(--border-gold);
}

.btn-pass-eye.is-visible {
  color: var(--gold-400);
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--gold-500);
}

@media (max-width: 768px) {
  .modal-backdrop {
    padding: 10px;
    align-items: flex-start;
  }
  .modal-box {
    padding: 16px;
    max-height: calc(100dvh - 20px);
    margin: auto 0;
  }
  .modal-box.modal-box-wide {
    padding: 16px;
  }
  .modal-scroll-body {
    max-height: calc(100dvh - 185px);
  }
  .barb-grid-row {
    grid-template-columns: 1fr 115px;
  }
  .barb-grid-row-contact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .barb-grid-row {
    grid-template-columns: 1fr;
  }
}

.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #141822;
  border: 1px solid var(--gold-500);
  color: #fff;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 1200;
}

/* ================= CÁPSULA DE FECHA Y SELECTOR DÍA / SEMANA ================= */
.date-control-capsule {
  display: inline-flex;
  align-items: center;
  background: #141822;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.btn-nav-arrow {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.btn-nav-arrow:hover {
  color: var(--gold-400);
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--border-gold);
}

.date-input-dark {
  background: transparent;
  border: none;
  color: #f8fafc;
  color-scheme: dark;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.date-input-dark:focus {
  outline: none;
  background: rgba(245, 158, 11, 0.08);
}

.view-toggle-group {
  display: inline-flex;
  align-items: center;
  background: #141822;
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.btn-view-mode {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-view-mode:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.btn-view-mode.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0d12;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

/* ================= VISTA SEMANAL (LUNES A SÁBADO) ================= */
.week-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.week-day-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 290px;
}

.week-day-col.is-selected {
  border-color: var(--gold-500);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.14);
}

.week-day-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.week-day-header:hover .week-day-name {
  color: var(--gold-400);
}

.week-day-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.week-day-meta {
  font-size: 11px;
  color: var(--emerald-400);
  font-weight: 700;
  margin-top: 4px;
}

.week-slot-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold-500);
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}

.week-slot-card.colorimetria {
  border-left-color: var(--purple-500);
}

.week-slot-card.completada {
  border-left-color: var(--emerald-500);
  opacity: 0.75;
}

@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .chairs-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ================= RESPONSIVE MOBILE (iPhone 17 Pro Max & Android 6"+) ================= */
@media (max-width: 768px) {
  .studio-container {
    padding: 12px 12px calc(32px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  /* Evita auto-zoom en iOS Safari al tocar inputs/selects */
  .form-input,
  .form-select {
    font-size: 16px;
    padding: 11px 12px;
  }

  .auth-card {
    padding: 26px 20px;
    border-radius: 18px;
  }

  /* ENCABEZADO MÓVIL ESTRUCTURADO */
  .studio-header {
    padding: 14px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .brand-wrap {
    width: 100%;
    gap: 10px;
  }

  .brand-badge {
    width: 40px;
    height: 40px;
    font-size: 20px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 16px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .brand-slogan {
    font-size: 11.5px;
    line-height: 1.35;
    margin-top: 2px;
  }

  .header-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }

  .live-pill {
    grid-column: 1 / -1;
    order: 3;
    justify-content: center;
    width: 100%;
    padding: 6px 12px;
    font-size: 11.5px;
  }

  .date-control-capsule {
    grid-column: 1 / -1;
    order: 2;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    gap: 3px;
  }

  .btn-nav-arrow {
    width: 34px;
    height: 36px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .date-input-dark {
    flex: 1;
    text-align: center;
    font-size: 13.5px;
    min-width: 0;
    padding: 5px 2px;
  }

  #btn-today,
  .date-control-capsule #btn-view-week {
    height: 36px;
    padding: 0 10px !important;
    font-size: 12px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .view-toggle-group {
    grid-column: 1 / -1;
    order: 1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 4px;
    gap: 4px;
  }

  .view-toggle-group .btn-view-mode {
    width: 100%;
    text-align: center;
    padding: 9px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  #btn-open-config {
    grid-column: 1 / 2;
    order: 4;
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #btn-refresh {
    grid-column: 2 / 3;
    order: 5;
    padding: 10px 14px;
    font-size: 14px;
  }

  #btn-logout {
    grid-column: 3 / 4;
    order: 6;
    padding: 10px 14px;
    font-size: 12.5px;
  }

  /* SELECTOR DE SILLAS (2x2) Y ACCIONES RÁPIDAS */
  .control-bar {
    padding: 12px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .chair-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .chair-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .quick-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .btn-action {
    width: 100%;
    justify-content: center;
    padding: 11px 10px;
    font-size: 12px;
    text-align: center;
  }

  .btn-action.new-appt {
    grid-column: 1 / -1;
    padding: 12px 14px;
    font-size: 13.5px;
  }

  /* 4 KPIs EN GRILLA 2x2 COMPACTA */
  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi-box {
    padding: 14px;
  }

  .kpi-val {
    font-size: 21px;
    margin: 6px 0 3px;
    word-break: break-word;
  }

  .kpi-label {
    font-size: 11.5px;
  }

  .kpi-sub {
    font-size: 10.5px;
    line-height: 1.3;
  }

  /* COLUMNAS DE SILLA Y TARJETAS TÁCTILES */
  .chair-column {
    padding: 14px;
    gap: 12px;
  }

  .slot-card {
    padding: 12px;
  }

  .slot-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 6px;
  }

  .slot-actions .btn-mini {
    width: 100%;
    text-align: center;
    padding: 8px 10px;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* VISTA SEMANAL EN MÓVIL */
  .week-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .week-day-col {
    min-height: auto;
    padding: 14px;
  }

  .week-slot-card .btn-mini {
    padding: 6px 10px !important;
    font-size: 11.5px !important;
  }

  /* PANELES INFERIORES (RADAR & CATÁLOGO) */
  .panel-card {
    padding: 14px;
  }

  .radar-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .radar-item > div:last-child {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  /* MODALES TIPO BOTTOM-SHEET CON SCROLL SEGURO */
  .modal-backdrop {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-box {
    max-width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px;
    border-radius: 18px 18px 14px 14px;
  }

  .toast-box {
    left: 14px;
    right: 14px;
    bottom: 16px;
    text-align: center;
  }
}

/* ================= MÓDULO FINANCIERO & LIQUIDACIÓN DE COMISIONES ================= */
.finance-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.finance-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.finance-period-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #10131c;
  border: 1px solid var(--border-subtle);
  padding: 5px;
  border-radius: 12px;
}

.btn-fin-period {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-fin-period:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.btn-fin-period.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.1));
  border-color: var(--gold-500);
  color: var(--gold-400);
  font-weight: 800;
}

.finance-controls-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fin-select-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #10131c;
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.fin-select-group select {
  background: transparent;
  border: none;
  color: var(--gold-400);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  color-scheme: dark;
}

.fin-select-group select:focus {
  outline: none;
}

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

.fin-period-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
}

.fin-period-card.is-active-period {
  border-color: var(--gold-500);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.12), rgba(20, 24, 34, 0.92));
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.14);
}

.fin-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.fin-card-amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--emerald-400);
  margin: 8px 0 6px;
}

.fin-card-split {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 7px;
  margin-top: 4px;
}

.finance-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-x: auto;
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.finance-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.finance-table td {
  padding: 14px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.finance-table tr.total-row td {
  background: rgba(245, 158, 11, 0.08);
  border-top: 2px solid var(--border-gold);
  border-bottom: none;
  font-weight: 800;
  font-size: 14.5px;
}

.progress-bar-bg {
  width: 100%;
  max-width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 5px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--emerald-400));
  border-radius: 99px;
}

.finance-ledger-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 1024px) {
  .finance-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .finance-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .fin-period-card {
    padding: 12px 13px;
  }
  .fin-card-top {
    font-size: 10.5px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .fin-card-amount {
    font-size: 19px;
    margin: 6px 0 4px;
  }
  .fin-card-split {
    flex-direction: column;
    gap: 3px;
    font-size: 10.5px;
  }
  .finance-toolbar {
    padding: 14px;
  }
  .finance-period-pills {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .finance-controls-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .fin-select-group {
    justify-content: space-between;
    width: 100%;
  }
  .finance-table-wrap {
    padding: 14px;
    overflow-x: visible;
  }
  .finance-table {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .finance-table thead {
    display: none;
  }
  .finance-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .finance-table tr {
    display: flex;
    flex-direction: column;
    background: rgba(15, 18, 26, 0.82);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px;
    gap: 6px;
  }
  .finance-table tr.total-row {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid var(--border-gold);
  }
  .finance-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: right;
    font-size: 13px;
  }
  .finance-table td:last-child {
    border-bottom: none;
  }
  .finance-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: left;
    flex-shrink: 0;
  }
  .finance-table tr:not(.total-row) td:first-child {
    justify-content: flex-start;
    text-align: left;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .finance-table tr:not(.total-row) td:first-child::before {
    display: none;
  }
  .finance-table td .fin-select-group {
    width: auto;
    max-width: 62%;
  }
  .finance-table td .fin-silla-comision-select {
    font-size: 12px;
    width: 100%;
  }
  .progress-bar-bg {
    margin-left: auto;
  }
}

/* ================= MENÚ DE 3 PUNTOS (⋮) Y CONTROL DE AVISOS RADAR 18D ================= */
.radar-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-dots-menu {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}

.btn-dots-menu:hover {
  color: var(--gold-400);
  border-color: var(--gold-500);
  background: rgba(245, 158, 11, 0.12);
}

.radar-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 255px;
  background: #141824;
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.radar-dropdown-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-400);
  padding: 6px 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2px;
}

.radar-dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}

.radar-dropdown-item:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-400);
}

.radar-dropdown-item.danger {
  color: #fb7185;
}

.radar-dropdown-item.danger:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
}

.radar-item.is-muted {
  border-left: 3px solid var(--text-muted);
  background: rgba(15, 18, 26, 0.55);
}

.radar-item.is-muted > div:first-child {
  opacity: 0.62;
}




