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

:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --bg-main: #F4F6FB;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-dark: #0F172A;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --primary-color: #7D6EEF;
  --primary-dark: #5C4EB7;
  --primary-light: #F0EEFD;
  --primary-gradient: linear-gradient(135deg, #8B7CF8 0%, #7D6EEF 50%, #5B47E0 100%);
  --accent-gradient: linear-gradient(135deg, #F43F5E 0%, #E11D48 100%);
  --gold-glow: rgba(125, 110, 239, 0.25);
  --accent-color: #EC4899;
  --accent-light: #FDF2F8;
  --success-color: #10B981;
  --success-light: #ECFDF5;
  --warning-color: #F59E0B;
  --warning-light: #FFFBEB;
  --error-color: #EF4444;
  --error-light: #FEF2F2;
  /* Estados de cita (agenda, semana y leyenda). Fondos oscuros porque el
     texto va en blanco encima: verificados >=5:1 para el titulo. */
  --apt-accepted: #065F46;
  --apt-requested: #92400E;
  --apt-ended: #334155;
  --apt-canceled: #4B5563;
  --apt-no-show: #B91C1C;
  --apt-unanswered: #5C4EB7;
  --apt-hatch: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 5px, rgba(255, 255, 255, 0) 5px 11px);

  /* Gráficos de reportes. Rampa secuencial del violeta de marca: monotónica
     de claro a oscuro, los cinco pasos por encima del suelo ordinal de 2:1.
     La categórica (violeta, naranja, aqua) pasa las cinco comprobaciones con
     todos los pares: peor ΔE con daltonismo 9,2 · visión normal 27,6. */
  --viz-1: #aea8ff;
  --viz-2: #958cff;
  --viz-3: #7e6ff0;
  --viz-4: #685acb;
  --viz-5: #5245a7;
  --viz-serie-1: #7D6EEF;
  --viz-serie-2: #eb6834;
  --viz-serie-3: #1baf7a;
  --viz-grid: #ECEDF1;

  --border-color: #E2E8F0;
  --border-light: #F1F5F9;
  --glass-border: rgba(255, 255, 255, 0.7);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 10px 25px -5px rgba(125, 110, 239, 0.07), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 35px -10px rgba(125, 110, 239, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.04);
  --shadow-premium: 0 25px 50px -12px rgba(99, 102, 241, 0.18);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  --sidebar-width: 280px;
  /* Altura de la barra superior en escritorio. En pantallas estrechas la barra
     se envuelve en dos filas y la variable se redefine en los media queries
     correspondientes: todos los paneles usan calc(var(--app-height) - var(--topbar-height) - N). */
  --topbar-height: 72px;
  /* Altura de referencia de la aplicación. El literal '100vh' es la altura del
     viewport "grande" en los navegadores móviles, así que la barra de direcciones
     recorta los paneles de altura fija; se sustituye por la unidad dinámica
     cuando el navegador la soporta (@supports más abajo). */
  --app-height: 100vh;
}

@supports (height: 100dvh) {
  :root { --app-height: 100dvh; }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body.pro-app {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(125, 110, 239, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.03) 0px, transparent 50%);
  color: var(--text-primary);
  display: flex;
  height: var(--app-height);
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.02);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  overflow: hidden;
}

.brand-name {
  font-family: var(--font-title, 'Outfit', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  letter-spacing: 0.01em;
  transition: var(--transition-smooth);
}

.logo-img-large {
  width: 130px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(125, 110, 239, 0.15));
  transition: var(--transition-smooth);
}

.logo-img-mini {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: none;
  transition: var(--transition-smooth);
}

.sidebar-collapse-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-collapse-btn:hover {
  background: var(--primary-gradient);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(125, 110, 239, 0.4);
  transform: scale(1.05);
}

.sidebar-collapse-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.nav-group { margin-bottom: 24px; }

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.3px;
  margin-bottom: 10px;
  padding-left: 12px;
  white-space: nowrap;
  transition: opacity 0.2s ease, height 0.2s ease;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
  margin-bottom: 4px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
  transform: translateX(4px);
}

.nav-link.active {
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(125, 110, 239, 0.35);
  transform: translateX(0);
}

.nav-link.active::before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: auto !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 4px !important;
  height: 50% !important;
  background-color: #FFFFFF !important;
  border-radius: 4px 0 0 4px !important;
  pointer-events: none;
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.nav-link:hover .nav-icon {
  transform: scale(1.1);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-secondary);
  transition: var(--transition-smooth);
}

.user-profile-summary {
  width: 100%;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

/* =========================================================
   SIDEBAR COLLAPSED STYLES (Desktop / Laptop / Tablet > 768px)
   ========================================================= */
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    width: 80px;
  }

  body.sidebar-collapsed .sidebar-header {
    padding: 14px 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: auto;
  }

  body.sidebar-collapsed .brand-logo {
    justify-content: center;
    align-items: center;
  }

  body.sidebar-collapsed .brand-name {
    display: none !important;
  }

  body.sidebar-collapsed .logo-img-large {
    display: none !important;
  }

  body.sidebar-collapsed .logo-img-mini {
    display: block !important;
    width: 32px;
    height: 32px;
  }

  body.sidebar-collapsed .sidebar-collapse-btn {
    width: 32px;
    height: 32px;
  }

  body.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  body.sidebar-collapsed .nav-label {
    display: none !important;
  }

  body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
    margin: 4px 6px;
  }

  body.sidebar-collapsed .nav-link span {
    display: none !important;
  }

  body.sidebar-collapsed .nav-link:hover {
    transform: scale(1.08);
  }

  /* Hover Tooltip when Sidebar is Collapsed */
  body.sidebar-collapsed .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 78px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-dark);
    color: #FFFFFF;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4);
    pointer-events: none;
    animation: fadeInTooltip 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  body.sidebar-collapsed .sidebar-footer {
    padding: 12px 6px;
  }

  body.sidebar-collapsed .user-info {
    display: none !important;
  }

  body.sidebar-collapsed .user-profile-summary {
    justify-content: center;
    padding: 6px;
  }

  body.sidebar-collapsed .sidebar-logout-btn {
    justify-content: center;
    padding: 10px 0;
  }

  body.sidebar-collapsed .sidebar-logout-btn span {
    display: none !important;
  }
}

.user-profile-summary:hover {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.avatar-mini {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(125, 110, 239, 0.25);
}

.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.top-bar {
  height: var(--topbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 90;
}

.view-title-container h1 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.view-title-container p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
  font-weight: 500;
}

.top-bar-actions { display: flex; gap: 12px; align-items: center; }

.branch-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 40px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.branch-selector-wrapper:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(125, 110, 239, 0.12);
}

.branch-selector-icon {
  width: 17px;
  height: 17px;
  color: var(--primary-color);
  flex-shrink: 0;
}

.branch-selector {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 170px;
  padding: 4px 0;
}

.branch-selector option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.content-wrapper {
  flex: 1;
  padding: 30px 32px;
  overflow-y: auto;
  background-color: transparent;
}

.content-wrapper::-webkit-scrollbar { width: 6px; }
.content-wrapper::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 6px; }

/* Bloqueo del scroll de fondo mientras hay un modal abierto.
   La clase la gestiona initModalUX() en app.js. */
body.modal-open .content-wrapper { overflow: hidden; }

.view-section { display: none; }
.view-section.active {
  display: block;
  animation: fadeInView 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* =========================================================
   STATISTICS CARDS (Dashboard Overview Grid)
   ========================================================= */
/* ===== DASH HERO ===== */


/* ===== KPI ROW ===== */


.dash-kpi-icon.revenue { background: var(--success-light); color: var(--success-color); }
.dash-kpi-icon.appointments { background: var(--primary-light); color: var(--primary-color); }
.dash-kpi-icon.occupation { background: var(--warning-light); color: var(--warning-color); }
.dash-kpi-icon.clients { background: var(--accent-light); color: var(--accent-color); }
.dash-kpi-icon.alerts { background: var(--error-light); color: var(--error-color); }


.spark-bar {
  width: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
  transition: height 0.4s ease;
  display: block;
}

/* ===== KPI CARDS (estructura rica) ===== */


.dash-kpi-bar-fill.primary { background: var(--primary-gradient); }
.dash-kpi-bar-fill.warning { background: var(--warning-color); }
.dash-kpi-bar-fill.danger { background: var(--accent-gradient); }


.dash-kpi-seg.pending { background: var(--warning-color); }
.dash-kpi-seg.confirmed { background: var(--primary-color); }
.dash-kpi-seg.done { background: var(--success-color); }
.dash-kpi-seg.cancel { background: var(--error-color); }


.dash-kpi-break-dot.primary { background: var(--primary-color); }
.dash-kpi-break-dot.pending,
.dash-kpi-break-dot.warning { background: var(--warning-color); }
.dash-kpi-break-dot.done { background: var(--success-color); }
.dash-kpi-break-dot.confirmed { background: var(--primary-color); }
.dash-kpi-break-dot.cancel { background: var(--error-color); }
.dash-kpi-break-dot.info { background: var(--accent-color); }


/* ===== MAIN GRID ===== */


.dash-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}


.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px 22px;
}

.dash-card-header h3 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-card-body {
  padding: 0 22px 20px 22px;
  flex: 1;
}

/* ===== CHART TABS ===== */

.dash-tab {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-body);
}

.dash-tab.active {
  background: var(--bg-primary);
  color: var(--primary-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dash-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* ===== BAR CHART ===== */
.dash-bar-chart {
  position: relative;
  margin-top: 4px;
}

.dash-bar-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0;
  height: 190px;
  position: relative;
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chart-bar-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 100%;
  padding: 0 6px;
}

.chart-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, #C4B5FD 0%, #8B7CF8 100%);
  border-radius: 8px 8px 4px 4px;
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
}

.chart-bar--today {
  background: var(--primary-gradient);
  box-shadow: 0 4px 12px rgba(125, 110, 239, 0.35);
}

.chart-bar--many {
  max-width: 18px;
  border-radius: 4px 4px 3px 3px;
}

.chart-bar-value {
  font-size: 9px;
  font-weight: 700;
  color: var(--bg-primary);
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.chart-bar:hover .chart-bar-value { opacity: 1; }
.chart-bar--today .chart-bar-value { opacity: 1; }

.chart-col-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== CHART SUMMARY ===== */
.dash-chart-summary {
  display: flex;
  gap: 32px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.dash-chart-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-chart-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dash-chart-summary-value {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== TIMELINE ===== */


.dash-timeline-bullet.accepted { background: var(--success-color); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.dash-timeline-bullet.requested { background: var(--warning-color); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.dash-timeline-bullet.no_show { background: var(--error-color); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }


.dash-status-pill.accepted { background: var(--success-light); color: var(--success-color); }
.dash-status-pill.requested { background: var(--warning-light); color: var(--warning-color); }
.dash-status-pill.ended { background: var(--bg-tertiary); color: var(--text-secondary); }
.dash-status-pill.no_show { background: var(--error-light); color: var(--error-color); }

/* ===== EMPTY STATE ===== */


/* ===== DASHBOARD MESSAGES ===== */


/* ===== REPORTS VIEW ===== */
.reports-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.reports-period-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 3px;
}

.reports-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.reports-chart-grid {
  grid-template-columns: 1.4fr 0.6fr;
  margin-bottom: 24px;
}

.reports-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.reports-services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-service-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-service-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-service-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-service-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.report-service-bar-track {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.report-service-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== OCCUPATION PANEL ===== */


.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  transition: var(--transition-smooth);
  font-family: var(--font-body);
  white-space: nowrap;
  letter-spacing: -0.1px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(125, 110, 239, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(125, 110, 239, 0.5);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.btn-secondary:hover {
  background-color: #E2DEFE;
  transform: translateY(-1px);
}

/* El rojo de marca sobre su propio fondo claro daba 3,4:1. El tono 700
   mantiene el mismo botón suave y llega a 5,9:1. */
.btn-danger {
  background-color: var(--error-light);
  color: #B91C1C;
  font-weight: 600;
}
.btn-danger:hover {
  background-color: #FEE2E2;
  transform: translateY(-1px);
}

/* Variante sólida para cuando destruir ES la acción principal del paso,
   como la confirmación de cancelar, rechazar o marcar no asistió. */
.btn-danger-solid {
  background-color: #B91C1C;
  color: #ffffff;
  font-weight: 700;
}
.btn-danger-solid:hover {
  background-color: #991B1B;
  transform: translateY(-1px);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--error-color);
  border: 1px solid var(--error-color);
  font-weight: 600;
}
.btn-danger-outline:hover {
  background-color: var(--error-light);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success-light);
  color: var(--success-color);
  font-weight: 600;
}
.btn-success:hover {
  background-color: #D1FAE5;
  transform: translateY(-1px);
}

.btn-warning {
  background-color: var(--warning-light);
  color: var(--warning-color);
  font-weight: 600;
}
.btn-warning:hover {
  background-color: #FEF3C7;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-xs); }

/* Botones de acción del modal Detalle de Cita */
.apt-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}
.apt-action-btn {
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  white-space: nowrap;
}
.apt-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.apt-action--accept {
  background: var(--success-light);
  color: var(--success-color);
  border-color: rgba(16, 185, 129, 0.2);
}
.apt-action--accept:hover {
  background: #D1FAE5;
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.apt-action--complete {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(125, 110, 239, 0.2);
}
.apt-action--complete:hover {
  background: #E2DEFE;
  border-color: rgba(125, 110, 239, 0.35);
  transform: translateY(-1px);
}

.apt-action--noshow {
  background: var(--warning-light);
  color: var(--warning-color);
  border-color: rgba(245, 158, 11, 0.2);
}
.apt-action--noshow:hover {
  background: #FEF3C7;
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.apt-action--cancel {
  background: var(--error-light);
  color: var(--error-color);
  border-color: rgba(239, 68, 68, 0.2);
}
.apt-action--cancel:hover {
  background: #FEE2E2;
  border-color: rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* Rechazar una solicitud: misma familia visual que cancelar, pero diferenciado
   del flujo de cancelación posterior a la confirmación. */
.apt-action--reject {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.apt-action--reject:hover {
  background: var(--error-light);
  color: var(--error-color);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-icon svg { width: 18px; height: 18px; }

.icon-sm { width: 18px; height: 18px; }

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.stat-icon-wrapper svg { width: 22px; height: 22px; }
.stat-icon-wrapper.purple { background: var(--primary-light); color: var(--primary-color); }
.stat-icon-wrapper.green { background: var(--success-light); color: var(--success-color); }
.stat-icon-wrapper.amber { background: var(--warning-light); color: var(--warning-color); }
.stat-icon-wrapper.pink { background: var(--accent-light); color: var(--accent-color); }

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

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

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card-body { padding: 22px; }

.timeline-list { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 8px;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.timeline-item:hover {
  background: var(--bg-secondary);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-color);
  min-width: 56px;
  padding-top: 2px;
  font-family: var(--font-title);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(125, 110, 239, 0.2);
}

.timeline-dot.accepted { background: var(--success-color); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.timeline-dot.requested { background: var(--warning-color); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.timeline-dot.canceled { background: var(--error-color); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

.timeline-content { flex: 1; min-width: 0; }
.timeline-content h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; color: var(--text-primary); }
.timeline-content p { font-size: 12.5px; color: var(--text-muted); }
.timeline-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-secondary); align-items: center; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.status-badge.accepted { background: var(--success-light); color: var(--success-color); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.requested { background: var(--warning-light); color: var(--warning-color); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-badge.ended { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.status-badge.canceled { background: var(--error-light); color: var(--error-color); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge.rejected { background: var(--error-light); color: var(--error-color); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge.unanswered { background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border-color); }
.status-badge.no_show { background: var(--error-light); color: var(--error-color); border: 1px solid rgba(239, 68, 68, 0.2); }

.agenda-container { display: flex; gap: 24px; height: calc(var(--app-height) - var(--topbar-height) - 120px); }

.agenda-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agenda-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.agenda-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.agenda-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-date-picker-wrap {
  position: relative;
  display: inline-block;
}

.agenda-date-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  color: var(--text-primary);
  font-family: inherit;
}

.agenda-date-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-color);
}

.agenda-date-trigger .agenda-calendar-icon {
  width: 17px;
  height: 17px;
  color: var(--primary-color);
  flex-shrink: 0;
}

.agenda-date-trigger h2 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  min-width: 170px;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.2;
}

.agenda-date-trigger .agenda-chevron-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.agenda-date-picker-wrap.open .agenda-chevron-icon {
  transform: rotate(180deg);
  color: var(--primary-color);
}

.agenda-date-picker-wrap.open .agenda-date-trigger {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(125, 110, 239, 0.15);
}

.agenda-calendar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: 92vw;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
  padding: 16px;
  animation: calFadeIn 0.15s ease-out;
}

@keyframes calFadeIn {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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

.cal-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-select {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.cal-select:focus {
  border-color: var(--primary-color);
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.cal-nav-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.cal-nav-btn svg {
  width: 14px;
  height: 14px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

.cal-day-btn {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  padding: 0;
}

.cal-day-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.cal-day-btn.other-month {
  color: var(--text-muted);
  opacity: 0.35;
}

.cal-day-btn.today {
  font-weight: 800;
  color: var(--primary-color);
  border-color: rgba(125, 110, 239, 0.4);
}

.cal-day-btn.selected {
  background: var(--primary-color) !important;
  color: #fff !important;
  font-weight: 700;
  border-color: var(--primary-color);
}

.cal-day-btn.has-appts:not(.selected)::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #10B981;
}

.cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
}

.agenda-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.agenda-nav-btn:hover { background: var(--primary-light); border-color: var(--primary-color); }
.agenda-nav-btn svg { width: 16px; height: 16px; stroke: var(--text-secondary); }

.agenda-view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.agenda-view-toggle button {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  font-family: var(--font-body);
}

.agenda-view-toggle button.active {
  background: var(--primary-color);
  color: #FFFFFF;
}

.staff-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.staff-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.staff-chip:hover { border-color: var(--primary-color); }
.staff-chip.active { background: var(--primary-color); color: #FFFFFF; border-color: var(--primary-color); }
.staff-chip img { width: 20px; height: 20px; border-radius: var(--radius-full); object-fit: cover; }

/* ===== VISTA DE DÍA (columnas por profesional) ===== */
.agenda-day {
  display: flex;
  flex-direction: column;
  height: calc(var(--app-height) - var(--topbar-height) - 230px);
  min-height: 480px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-y: auto;
  position: relative;
}

.agenda-day::-webkit-scrollbar { width: 6px; }
.agenda-day::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }

.agenda-day-head {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg-primary);
}

.agenda-day-corner {
  width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.agenda-pro-head {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-right: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.agenda-pro-head:last-child { border-right: none; }

.agenda-pro-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--pro-color);
}

.agenda-pro-meta { display: flex; flex-direction: column; min-width: 0; }
.agenda-pro-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-pro-count { font-size: 11px; color: var(--text-muted); }

.agenda-day-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.timeline-labels {
  width: 60px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  background: var(--bg-secondary);
  position: sticky;
  left: 0;
  z-index: 6;
}

.timeline-hour-label {
  width: 60px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px 0 12px;
  text-align: right;
  flex-shrink: 0;
  box-sizing: border-box;
}

.agenda-pro-col {
  flex: 1;
  min-width: 0;
  position: relative;
  border-right: 1px solid var(--border-light);
}

.agenda-pro-col:last-child { border-right: none; }

.agenda-pro-hour-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.timeline-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border-light);
}

.appointment-block {
  position: absolute;
  padding: 8px 12px;
  border-radius: 0;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  z-index: 5;
  overflow: hidden;
  color: #fff;
  border: none;
  box-sizing: border-box;
}

.agenda-pro-col .appointment-block { padding: 6px 8px; min-height: 26px; }

.appointment-block:hover { transform: translateX(2px); box-shadow: var(--shadow-md); filter: brightness(1.08); }

/* Escala de estados de cita.
   Los tonos claros de marca (#10B981, #F59E0B) daban 2,1-2,6:1 con texto
   blanco; estos fondos se verificaron a >=5:1 para el titulo y >=4,5:1 para
   la linea secundaria. Los dos estados sin resolver llevan ademas un rayado,
   y la cita cancelada un tachado, para que el estado no dependa solo del
   color: a un metro del mostrador y con deuteranopia el patron si se lee. */
.appointment-block.status-accepted,
.week-appt-card.status-accepted,
.agenda-legend-swatch.status-accepted { background: var(--apt-accepted); }

.appointment-block.status-requested,
.week-appt-card.status-requested,
.agenda-legend-swatch.status-requested { background: var(--apt-hatch), var(--apt-requested); }

.appointment-block.status-unanswered,
.week-appt-card.status-unanswered,
.agenda-legend-swatch.status-unanswered { background: var(--apt-hatch), var(--apt-unanswered); }

.appointment-block.status-ended,
.week-appt-card.status-ended,
.agenda-legend-swatch.status-ended { background: var(--apt-ended); }

.appointment-block.status-canceled,
.week-appt-card.status-canceled,
.agenda-legend-swatch.status-canceled { background: var(--apt-canceled); }

.appointment-block.status-no_show,
.week-appt-card.status-no_show,
.agenda-legend-swatch.status-no_show { background: var(--apt-no-show); }

.appointment-block.status-canceled .apt-title,
.week-appt-card.status-canceled .apt-title { text-decoration: line-through; text-decoration-thickness: 1px; }

.appointment-block .apt-title {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.25;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.appointment-block .apt-detail {
  font-size: 11px;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Densidad por altura real del bloque: una cita de 30 min no tiene sitio para
   tres lineas, asi que en vez de recortarlas a media palabra se decide que
   cabe. La clase la pone renderDayView a partir de los pixeles calculados. */
.appointment-block.apt-tight { padding: 3px 8px; }
.appointment-block.apt-tight .apt-title { -webkit-line-clamp: 1; margin-bottom: 1px; }
.appointment-block.apt-tight .apt-detail--address { display: none; }

.appointment-block.apt-compact { padding: 3px 8px; }
.appointment-block.apt-compact .apt-title { -webkit-line-clamp: 1; margin-bottom: 0; }
.appointment-block.apt-compact .apt-detail { display: none; }

/* En bloque corto el boton de accion (34px) era mas alto que la fila de texto
   y empujaba el contenido fuera de la caja: la segunda linea se cortaba por la
   mitad. Se saca del flujo y el titulo reserva su hueco, asi no lo tapa. */
.appointment-block.apt-tight .apt-header-row,
.appointment-block.apt-compact .apt-header-row { min-height: 0; }

.appointment-block.apt-tight .apt-header-row > .apt-quick-end-btn,
.appointment-block.apt-tight .apt-header-row > .apt-quick-actions,
.appointment-block.apt-tight .apt-header-row > .apt-ended-badge,
.appointment-block.apt-compact .apt-header-row > .apt-quick-end-btn,
.appointment-block.apt-compact .apt-header-row > .apt-quick-actions,
.appointment-block.apt-compact .apt-header-row > .apt-ended-badge {
  position: absolute;
  top: 3px;
  right: 5px;
}

.appointment-block.apt-tight .apt-quick-end-btn,
.appointment-block.apt-tight .apt-quick-actions .apt-quick-end-btn,
.appointment-block.apt-tight .apt-quick-reject-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
}

.appointment-block.apt-compact .apt-quick-end-btn,
.appointment-block.apt-compact .apt-quick-actions .apt-quick-end-btn,
.appointment-block.apt-compact .apt-quick-reject-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
}

.appointment-block.apt-tight .apt-title { padding-right: 32px; }
.appointment-block.apt-compact .apt-title { padding-right: 26px; }
.appointment-block.apt-tight:has(.apt-quick-actions) .apt-title { padding-right: 62px; }
.appointment-block.apt-compact:has(.apt-quick-actions) .apt-title { padding-right: 48px; }
.appointment-block.apt-tight:has(.apt-ended-badge) .apt-title,
.appointment-block.apt-compact:has(.apt-ended-badge) .apt-title { padding-right: 74px; }

/* Quick Actions & Badges en Agenda */
.appointment-block .apt-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 18px;
}

.appointment-block .apt-header-row .apt-title {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.apt-quick-end-btn {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  border-radius: var(--radius-full);
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  z-index: 2;
}

.apt-quick-end-btn:hover {
  background: #ffffff;
  color: #059669;
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.apt-quick-end-btn svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
}

/* Acciones rápidas de estado sobre el propio bloque de la agenda:
   aceptar y rechazar sin abrir el modal de detalle. */
.apt-quick-reject-btn {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  z-index: 2;
}

.apt-quick-reject-btn:hover {
  background: var(--error-color);
  border-color: var(--error-color);
  color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.apt-quick-reject-btn svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
}

.apt-quick-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.apt-modality-badge {
  font-size: 10px;
  margin-right: 3px;
  opacity: 0.9;
}

/* Dirección del servicio a domicilio dentro del bloque de agenda. */
.apt-detail--address {
  font-size: 11px;
  opacity: 1;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 1px;
}

.apt-ended-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
  border-radius: var(--radius-full);
  padding: 1px 5px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.apt-ended-badge svg {
  width: 9px;
  height: 9px;
  stroke: #34d399;
}

.apt-ended-badge-text {
  white-space: nowrap;
}

/* Leyenda de estados de la agenda. Cinco colores sin leyenda obligaban a
   memorizar que el gris pizarra significa "ya se hizo". */
.agenda-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.agenda-legend-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 2px;
}

.agenda-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.agenda-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.agenda-legend-item.is-struck .agenda-legend-label { text-decoration: line-through; }

@media (max-width: 900px) {
  .agenda-legend { gap: 6px 12px; padding: 8px 10px; }
}

/* Contenedor de las columnas de profesional: soporta la linea de hora actual,
   que cruza toda la rejilla, y fija la altura real del dia. */
.agenda-day-cols {
  display: flex;
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Franjas en las que ese profesional no atiende. Antes todo el blanco parecia
   igual de libre y el error solo aparecia al intentar guardar la cita. */
.agenda-offhours {
  position: absolute;
  left: 0;
  right: 0;
  background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.10) 0 6px, rgba(100, 116, 139, 0.04) 6px 12px);
  pointer-events: none;
  z-index: 1;
}

.agenda-offhours--full {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
  background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.14) 0 6px, rgba(100, 116, 139, 0.06) 6px 12px);
}

.agenda-offhours-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  position: sticky;
  top: 24px;
}

.agenda-pro-col.is-unavailable { cursor: not-allowed; }

/* Hueco libre: pulsar la columna abre la cita con profesional, fecha y hora
   ya resueltos. */
.agenda-pro-col { cursor: copy; }
.agenda-pro-col .appointment-block { cursor: pointer; }

/* Linea de hora actual. Sin ella no habia forma de saber donde estas parado
   en el dia. */
.agenda-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--error-color);
  pointer-events: none;
  z-index: 8;
}

.agenda-now-label {
  position: absolute;
  left: 8px;
  top: -9px;
  background: var(--error-color);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   HOY — PANTALLA DE MOSTRADOR
   Lista, no rejilla: la rejilla temporal es trabajo de la Agenda. Esta
   pantalla se lee de un vistazo, de pie y con alguien delante.
   ========================================================================== */

.today-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

.today-head-date {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  margin: 0;
}

.today-head-now {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 3px 0 0;
  font-variant-numeric: tabular-nums;
}

.today-head-side {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.today-head-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Única cifra de negocio que sobrevive en el mostrador, y solo cuando cruza
   el umbral de depósito: lleva a donde se puede hacer algo con ella. */
.today-loss {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.today-loss:hover { background: #FEE2E2; border-color: #FCA5A5; }
.today-loss svg { width: 15px; height: 15px; flex-shrink: 0; }

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.today-stream-head,
.today-pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.today-stream-head h2,
.today-pending-head h2 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.today-pending-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 700;
}

.today-stream {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.today-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.today-row:last-child { border-bottom: none; }
.today-row:hover { background: var(--bg-secondary); }

.today-row-time {
  width: 58px;
  flex-shrink: 0;
  text-align: right;
}

.today-row-hour {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.today-row-dur {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

.today-row-body { flex: 1; min-width: 0; }

.today-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-row-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-row-home {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.today-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* La cita en curso es el único acento de la corriente. */
.today-row--appt.is-now { background: var(--primary-light); }

.today-row--appt.is-now:hover { background: #E8E4FC; }

/* El hueco libre se lee como espacio disponible, no como otra fila llena. */
.today-row--free {
  background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.05) 0 6px, rgba(100, 116, 139, 0) 6px 12px);
}

.today-row--free .today-row-title { font-weight: 600; color: var(--text-secondary); }
.today-row--free:hover { background: var(--primary-light); }
.today-row--free:hover .today-row-title { color: var(--primary-dark); }

.today-book {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-dark);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  white-space: nowrap;
}

.today-row--free:hover .today-book { background: var(--primary-color); color: #fff; }

.today-status {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  white-space: nowrap;
}

.today-status--now { background: var(--primary-dark); }
.today-status.status-accepted { background: var(--apt-accepted); }
.today-status.status-requested { background: var(--apt-requested); }
.today-status.status-ended { background: var(--apt-ended); }
.today-status.status-unanswered { background: var(--apt-unanswered); }
.today-status.status-no_show { background: var(--apt-no-show); }
.today-status.status-canceled { background: var(--apt-canceled); }

/* Las acciones rápidas nacieron sobre bloques de color saturado; aquí viven
   sobre fondo claro y hay que devolverles el contraste. */
.today-row-side .apt-quick-end-btn,
.today-row-side .apt-quick-reject-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.today-row-side .apt-quick-end-btn:hover {
  background: var(--apt-accepted);
  border-color: var(--apt-accepted);
  color: #fff;
  transform: none;
}

.today-row-side .apt-quick-reject-btn:hover {
  background: var(--apt-no-show);
  border-color: var(--apt-no-show);
  color: #fff;
  transform: none;
}

.today-row-side .apt-quick-end-btn svg,
.today-row-side .apt-quick-reject-btn svg { width: 14px; height: 14px; }

.today-row-side .apt-ended-badge {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 8px;
}

.today-row-side .apt-ended-badge svg { stroke: var(--apt-accepted); }

/* Columna de pendientes */
.today-pending {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.today-pend-group + .today-pend-group { margin-top: 16px; }

.today-pend-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.today-pend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
}

.today-pend-item:last-child { border-bottom: none; }
.today-pend-item--link { cursor: pointer; }
.today-pend-item--link:hover .today-pend-name { color: var(--primary-dark); }

.today-pend-body { min-width: 0; }

.today-pend-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-pend-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 1px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-pend-more {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

.today-empty {
  padding: 28px 16px;
  text-align: center;
}

.today-empty-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.today-empty-note {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

/* El mostrador de un salón es a menudo una tablet: aquí sí funciona, porque
   es una lista y no una rejilla de cinco columnas. */
@media (max-width: 1100px) {
  .today-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .today-header { align-items: flex-start; }
  .today-row { padding: 10px 12px; gap: 10px; }
  .today-row-time { width: 50px; }
  .today-row-side { flex-direction: column; align-items: flex-end; gap: 6px; }
}

/* ===== VISTA DE SEMANA (lista compacta por día) ===== */
.week-grid {
  display: grid;
  /* 1fr tiene un minimo implicito de auto: el contenido de las celdas ensancha
     la rejilla mas alla del contenedor y jueves a domingo quedaban fuera de la
     pantalla, tras un scroll horizontal que nada anunciaba. minmax(0, 1fr)
     obliga a las siete columnas a repartirse el ancho disponible. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  align-items: start;
}

.week-grid-wrapper {
  height: calc(var(--app-height) - var(--topbar-height) - 230px);
  min-height: 480px;
  overflow-y: auto;
  border-radius: var(--radius-md);
}

.week-grid-wrapper::-webkit-scrollbar { width: 6px; }
.week-grid-wrapper::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }

.week-header-cell {
  min-width: 0;
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.week-header-cell.today { color: var(--primary-color); }
.week-header-cell .day-number { font-family: var(--font-title); font-size: 18px; font-weight: 800; display: block; }
.week-header-cell .day-name { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }

.week-cell {
  padding: 8px;
  border-right: 1px solid var(--border-light);
  min-width: 0;
}

.week-cell:last-child { border-right: none; }

.week-day-list { display: flex; flex-direction: column; gap: 6px; }

.week-appt-card {
  /* En vertical: con siete columnas repartiendo el ancho, la disposicion en
     fila dejaba al titulo unos 60px y lo partia a media palabra. */
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 0;
  color: #fff;
  background: #64748B;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.week-appt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 20px;
}

.week-appt-card:hover { transform: translateX(2px); box-shadow: var(--shadow-md); filter: brightness(1.08); }

.week-appt-card.status-accepted { background: var(--success-color); }
.week-appt-card.status-requested { background: var(--warning-color); }
.week-appt-card.status-canceled { background: #6B7280; }
.week-appt-card.status-ended { background: #334155; border-left: 3px solid #10B981; }
.week-appt-card.status-no_show { background: var(--error-color); }

.week-appt-time { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.92); flex-shrink: 0; padding-top: 1px; }

.week-appt-body { min-width: 0; flex: 1; }
.week-appt-body .apt-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: break-word;
}
.week-appt-body .apt-detail { font-size: 10px; color: rgba(255, 255, 255, 0.92); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.week-appt-staff { display: flex; align-items: center; gap: 4px; font-size: 10px; color: rgba(255, 255, 255, 0.9); margin-top: 2px; }
.week-appt-staff img { width: 14px; height: 14px; border-radius: 50%; object-fit: cover; }

.week-appt-action {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-left: 4px;
}

.week-empty { font-size: 11px; color: var(--text-muted); text-align: center; padding: 12px 0; }

.services-container { display: flex; flex-direction: column; gap: 28px; }

.category-block { margin-bottom: 4px; }

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0 16px;
}

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

.category-icon-box {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-icon-box img { width: 20px; height: 20px; }

.category-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.category-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.category-toggle {
  display: flex;
  align-items: center;
  margin-left: 4px;
  cursor: pointer;
}

.category-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--primary-light);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.category-add-btn:hover { border-color: var(--primary-color); }
.category-add-btn svg { width: 13px; height: 13px; }

.category-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--bg-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.category-manage-item:hover { border-color: var(--primary-color); }
.category-manage-item:last-child { margin-bottom: 0; }
.category-manage-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.category-block--inactive .category-icon-box { opacity: 0.45; filter: grayscale(50%); }
.category-block--inactive .category-header h3 { color: var(--text-muted); }
.category-block--inactive .svc-grid { opacity: 0.55; }

.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 28px;
}

/* Placeholder visual del servicio (no tiene foto): ícono de categoría */
.portfolio-card-image--icon {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-tertiary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-card-image--icon img { width: 72px; height: 72px; opacity: 0.9; }

.portfolio-card--inactive { opacity: 0.75; }
.portfolio-card--inactive .portfolio-card-image > img { filter: grayscale(50%); }

.portfolio-card-body-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.portfolio-card-body-top .portfolio-card-category { margin-bottom: 0; }

.portfolio-card-toggle { display: flex; align-items: center; }

.portfolio-card-meta { display: inline-flex; align-items: center; gap: 4px; }
.portfolio-card-meta svg { width: 13px; height: 13px; stroke: var(--text-muted); }

.portfolio-card-price { font-weight: 700; color: var(--primary-color); font-size: 13px; }

.toggle-switch {
  position: relative;
  width: 38px;
  height: 20px;
  display: inline-block;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  border-radius: 20px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider { background-color: var(--primary-color); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.45; cursor: not-allowed; }
.toggle-switch input:disabled + .toggle-slider:before { background-color: var(--text-muted); }

.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* =========================================================
   SELECCION DE SERVICIOS EN MODAL DE PERSONAL
   ========================================================= */
.service-selection-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}

.service-category-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-category-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-color);
}

.service-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.service-checkbox-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  transition: var(--transition-smooth);
  user-select: none;
}

.service-checkbox-card:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.service-checkbox-card input[type="checkbox"] {
  accent-color: var(--primary-color);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.service-checkbox-info {
  display: flex;
  flex-direction: column;
}

.service-checkbox-name {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.service-checkbox-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.staff-services-enabled {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

/* Chips de días de asistencia del personal */
.staff-day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.staff-day-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.staff-day-chip.is-active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.staff-day-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.enabled-service-pill {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

/* =========================================================
   STAFF SUB-NAVIGATION & MONITOREO COMPENSACIONES
   ========================================================= */
.staff-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}

.staff-tab-bar {
  display: flex;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  border: 1px solid var(--border-color);
}

.staff-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-body);
}

.staff-nav-tab svg { width: 16px; height: 16px; }

.staff-nav-tab.active {
  background: var(--bg-primary);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.monitoreo-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.monitoreo-period-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monitoreo-period-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.monitoreo-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.monitoreo-toggle-btn .toggle-icon {
  width: 15px;
  height: 15px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.monitoreo-toggle-btn.collapsed .toggle-icon {
  transform: rotate(-180deg);
}

.monitoreo-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-bottom 0.25s ease;
  max-height: 500px;
  opacity: 1;
  overflow: hidden;
}

.monitoreo-summary-grid.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: none !important;
  pointer-events: none;
}

.monitoreo-summary-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.summary-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card-icon svg { width: 20px; height: 20px; }
.monitoreo-summary-card.purple .summary-card-icon { background: var(--primary-light); color: var(--primary-color); }
.monitoreo-summary-card.amber .summary-card-icon { background: var(--warning-light); color: var(--warning-color); }
.monitoreo-summary-card.green .summary-card-icon { background: var(--success-light); color: var(--success-color); }
.monitoreo-summary-card.pink .summary-card-icon { background: var(--accent-light); color: var(--accent-color); }

.summary-card-info {
  display: flex;
  flex-direction: column;
}

.summary-card-value {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.summary-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.monitoreo-staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
  width: 100%;
}

.monitoreo-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.monitoreo-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(125, 110, 239, 0.4);
}

.monitoreo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.monitoreo-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monitoreo-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.monitoreo-user-info h4 {
  font-family: var(--font-title);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

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

.contract-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.contract-badge.comision { background: var(--primary-light); color: var(--primary-color); }
.contract-badge.sueldo_comision { background: var(--success-light); color: var(--success-color); }
.contract-badge.alquiler_silla { background: var(--warning-light); color: var(--warning-color); }

.monitoreo-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.monitoreo-metric-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-box-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-box-value {
  font-size: 14px;
  font-weight: 700;
}

.metric-box-value.positive { color: var(--success-color); }
.metric-box-value.amber { color: var(--warning-color); }
.metric-box-value.purple { color: var(--primary-color); }

.metric-box-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.occ-mini-bar {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
}

.occ-mini-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 4px;
}

.monitoreo-tasks-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-micro-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.task-badges-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-count-badge {
  font-size: 11.5px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.task-empty-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

.monitoreo-compensation-box {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(125, 110, 239, 0.2);
}

.compensation-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comp-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-dark);
}

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

.comp-total-amount {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-dark);
}

.monitoreo-card-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}

/* =========================================================
   MONITOREO CARD DESPLEGABLE & TABLA DE TRABAJOS
   ========================================================= */
.monitoreo-detail-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.monitoreo-detail-toggle-btn .toggle-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.monitoreo-detail-toggle-btn.expanded .toggle-icon {
  transform: rotate(-180deg);
}

.monitoreo-card-collapsible {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.monitoreo-card-collapsible.expanded {
  max-height: 900px;
  opacity: 1;
  margin-top: 14px;
  border-top: 1px dashed var(--border-color);
  padding-top: 14px;
}

.monitoreo-work-detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.work-detail-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.work-detail-table-wrapper {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  width: 100%;
  box-sizing: border-box;
}

.monitoreo-work-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.monitoreo-work-table th {
  padding: 8px 10px;
  text-align: left;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.monitoreo-work-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

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

.work-time-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.detail-status-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.detail-status-pill.positive {
  background: var(--success-light);
  color: var(--success-color);
}

.detail-status-pill.amber {
  background: var(--warning-light);
  color: var(--warning-color);
}

.staff-card-pro {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.staff-card-pro:hover { box-shadow: var(--shadow-md); border-color: var(--primary-color); }

.staff-main-info { display: flex; gap: 14px; align-items: center; }

.staff-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.staff-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

.staff-details h4 { font-family: var(--font-title); font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.title-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.staff-specialties {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.specialty-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.staff-hours-summary {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.staff-hours-summary strong { color: var(--text-primary); }

.staff-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.staff-branch-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--primary-color);
  font-weight: 500;
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  padding: 2px 8px;
  border-radius: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.status-dot.active { background: var(--success-color); }
.status-dot.inactive { background: var(--text-muted); }
.status-dot.vacation { background: var(--warning-color); }

.customers-layout { display: flex; gap: 24px; height: calc(var(--app-height) - var(--topbar-height) - 120px); }

.customers-list-panel {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customers-search-bar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.search-input-wrapper svg { width: 16px; height: 16px; stroke: var(--text-muted); flex-shrink: 0; }

.search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
}

.customer-tag-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.tag-filter-chip {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tag-filter-chip:hover { border-color: var(--primary-color); }
.tag-filter-chip.active { background: var(--primary-color); color: #FFFFFF; border-color: var(--primary-color); }

.customers-scroll {
  flex: 1;
  overflow-y: auto;
}

.customers-scroll::-webkit-scrollbar { width: 4px; }
.customers-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.customer-list-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition-smooth);
  align-items: center;
}

.customer-list-item:hover { background: var(--primary-light); }
.customer-list-item.selected { background: var(--primary-light); border-left: 3px solid var(--primary-color); }

.customer-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary-color);
  flex-shrink: 0;
}

.customer-list-info { flex: 1; min-width: 0; }
.customer-list-info h4 { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-list-info p { font-size: 11.5px; color: var(--text-muted); }

.customer-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.customer-tag.vip { background: #FEF3C7; color: #D97706; }
.customer-tag.recurrente { background: var(--success-light); color: var(--success-color); }
.customer-tag.nuevo { background: var(--primary-light); color: var(--primary-color); }
.customer-tag.inactivo { background: var(--bg-tertiary); color: var(--text-muted); }

.customer-detail-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.customer-detail-panel::-webkit-scrollbar { width: 6px; }
.customer-detail-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }

.customer-detail-header {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.customer-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
}

.customer-detail-info { flex: 1; }
.customer-detail-info h2 { font-family: var(--font-title); font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.customer-detail-info .contact-line { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }

.customer-stats-row {
  display: flex;
  gap: 24px;
  margin-top: 12px;
}

.customer-stat {
  display: flex;
  flex-direction: column;
}

.customer-stat .stat-num { font-family: var(--font-title); font-size: 20px; font-weight: 800; color: var(--primary-color); }
.customer-stat .stat-lbl { font-size: 11px; color: var(--text-muted); }

.customer-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.detail-section-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
  overflow: hidden;
}

.detail-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.detail-section-header h3 {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section-header h3 svg { width: 18px; height: 18px; stroke: var(--primary-color); }

.detail-section-body { padding: 16px 20px; }

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

.info-item label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 4px; }
.info-item span { font-size: 13px; font-weight: 500; }

.notes-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  resize: vertical;
  background: var(--bg-secondary);
}

.notes-textarea:focus { outline: none; border-color: var(--primary-color); }

.visit-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.visit-history-item:last-child { border-bottom: none; }
.visit-history-item .visit-service { font-size: 13px; font-weight: 500; }
.visit-history-item .visit-date { font-size: 12px; color: var(--text-muted); }
.visit-history-item .visit-price { font-size: 13px; font-weight: 700; }

.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; height: calc(var(--app-height) - var(--topbar-height) - 120px); }

.pos-main { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }

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

.pos-summary-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  text-align: center;
}

.pos-summary-card .pos-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.pos-summary-card .pos-value { font-family: var(--font-title); font-size: 24px; font-weight: 800; margin-top: 4px; }

/* Tarjetas de resumen en días anteriores (historial) */
.pos-summary-card--past {
  background: var(--bg-secondary);
  border-style: dashed;
  opacity: 0.85;
}
.pos-summary-card--past .pos-label { color: var(--text-secondary); }

/* Botón "Hoy" activo en la barra de navegación de fecha */
.pos-today-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.pos-today-btn.active:hover {
  background: var(--primary-dark, #6B5DD3);
  border-color: var(--primary-dark, #6B5DD3);
  color: #fff;
}

/* Filas de transacciones de días anteriores */
.transactions-table .past-day-row td {
  color: var(--text-secondary);
}
.transactions-table .past-day-row td:first-child::before {
  content: ' Histórico · ';
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-right: 4px;
  opacity: 0.8;
}

.transactions-table-container {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  flex: 1;
}

.transactions-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Siete columnas no caben en los 530px que el layout deja a 1280: sin un
   ancho mínimo la fila se apilaba hasta 160px de alto. El contenedor ya
   tiene overflow-x, así que es mejor desplazar que triturar. */
.transactions-table { width: 100%; min-width: 620px; border-collapse: collapse; }

.transactions-table th, .transactions-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.transactions-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  background: var(--bg-secondary);
}

.transactions-table tr:hover td { background: rgba(125, 110, 239, 0.02); }

.payment-method-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.payment-method-badge.efectivo { background: var(--success-light); color: var(--success-color); }
.payment-method-badge.tarjeta { background: var(--primary-light); color: var(--primary-color); }
.payment-method-badge.transferencia { background: var(--warning-light); color: var(--warning-color); }
.payment-method-badge.pago_movil { background: rgba(13, 148, 136, 0.14); color: #0D9488; }
.payment-method-badge.binance { background: rgba(240, 185, 11, 0.18); color: #B45309; }
.payment-method-badge.zelle { background: rgba(59, 130, 246, 0.15); color: #2563EB; }

.apt-payment-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.apt-payment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.apt-payment-header h3 { font-size: 14px; margin: 0; }

.pos-sidebar-panel {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.pos-sidebar-header h3 { font-family: var(--font-title); font-size: 16px; font-weight: 700; }

.pos-sidebar-body { padding: 20px; flex: 1; overflow-y: auto; }

/* Iniciales cuando el usuario aún no ha cargado su foto. */
.avatar-mini-initials {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ===== MI CUENTA ===== */

.account-me {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.me-session { margin: 0; }

.me-session > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.me-session > div:last-child { border-bottom: none; }
.me-session dt { color: var(--text-secondary); margin: 0; }
.me-session dd { margin: 0; font-weight: 600; color: var(--text-primary); text-align: right; }

/* Las reglas de la contraseña se cumplen a la vista, no se descubren al
   pulsar Guardar. */
.password-rules {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
  padding: 0;
}

.password-rules li {
  position: relative;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.password-rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  transition: var(--transition-smooth);
}

.password-rules li.ok { color: #047857; }

.password-rules li.ok::before {
  background: #047857;
  border-color: #047857;
  box-shadow: inset 0 0 0 2px #fff;
}

@media (max-width: 960px) {
  .account-me { grid-template-columns: minmax(0, 1fr); }
}

/* ===== GRÁFICOS DE REPORTES =====
   Marcas finas, rejilla recesiva de un solo píxel y sin trazos alrededor de
   los rellenos: el hueco de 2px en color de superficie es lo que separa. */

.viz { width: 100%; }

.viz-plot {
  position: relative;
  height: 190px;
  padding-left: 52px;
}

.viz-grid {
  position: absolute;
  inset: 0 0 0 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.viz-grid-line {
  position: relative;
  border-top: 1px solid var(--viz-grid);
}

.viz-y-tick {
  position: absolute;
  right: calc(100% + 8px);
  top: -0.6em;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viz-svg {
  position: absolute;
  inset: 0 0 0 52px;
  width: calc(100% - 52px);
  height: 100%;
  overflow: visible;
}

.viz-labels {
  position: absolute;
  inset: 0 0 0 52px;
  pointer-events: none;
}

.viz-point-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-primary);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.viz-point-label.is-right { transform: translateX(-100%); }
.viz-point-label.is-left { transform: translateX(0); }
.viz-point-label.is-max { color: var(--text-secondary); font-weight: 600; }

.viz-dots { position: absolute; inset: 0 0 0 52px; }

/* El punto lleva anillo de superficie y su área de acierto supera los 24px,
   aunque el punto visible sea de 8. */
.viz-dot {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: 13px 0 -13px -13px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.viz-dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--viz-serie-1);
  box-shadow: 0 0 0 2px var(--bg-primary);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.viz-dot.is-shown::after,
.viz-dot:hover::after,
.viz-dot:focus-visible::after { opacity: 1; }
.viz-dot:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 50%; }

.viz-x-axis {
  position: relative;
  height: 18px;
  margin-left: 52px;
  margin-top: 6px;
}

.viz-x-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Columnas */
/* La barra se cabe a 24px y el resto de la banda es aire. Con pocas columnas
   el grupo se agrupa en lugar de repartirse por 1.300px. */
.viz-cols,
.viz-cols-axis {
  display: flex;
  justify-content: center;
  gap: clamp(2px, calc((100% - var(--n, 8) * 24px) / max(var(--n, 8) - 1, 1)), 64px);
}

.viz-cols {
  position: absolute;
  inset: 0 0 0 52px;
  align-items: flex-end;
}

.viz-col {
  flex: 0 1 24px;
  min-width: 4px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.viz-col-fill {
  display: block;
  width: 100%;
  max-width: 24px;
  height: var(--h);
  min-height: 2px;
  background: var(--c);
  border-radius: 4px 4px 0 0;
  transition: filter 0.12s ease;
}

.viz-col:hover .viz-col-fill { filter: brightness(1.08); }
.viz-col:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 4px; }

.viz-cols-axis {
  margin-left: 52px;
  margin-top: 6px;
}

/* La etiqueta se centra sobre su columna y puede desbordar a los lados: con
   pocas columnas hay sitio de sobra, y recortarla sería peor. */
.viz-col-label {
  flex: 0 1 24px;
  min-width: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: visible;
}

/* Barras horizontales: ranking de nombres largos */
.viz-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 210px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  border-radius: var(--radius-xs);
}

.viz-bar-row:hover { background: var(--bg-secondary); }
.viz-bar-row:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }

.viz-bar-label {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-bar-track {
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.viz-bar-fill {
  display: block;
  height: 100%;
  background: var(--viz-serie-1);
  border-radius: var(--radius-full);
}

.viz-bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Mapa de calor hora × día */
.viz-heat-grid {
  display: grid;
  grid-template-columns: 34px repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
  align-items: center;
}

.viz-heat-col-label,
.viz-heat-row-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.viz-heat-row-label { text-align: left; font-weight: 600; }

.viz-heat-cell {
  /* aspect-ratio:1 sobre columnas anchas daba celdas de 110px y un gráfico de
     700. Lo que importa es leer la fila completa, no el cuadrado. */
  height: 30px;
  border: none;
  padding: 0;
  border-radius: 3px;
  background: var(--c);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.viz-heat-cell:hover { transform: scale(1.12); }
.viz-heat-cell:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }

.viz-heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  justify-content: flex-end;
}

.viz-heat-legend-label { font-size: 11px; color: var(--text-muted); }
.viz-heat-legend-step { width: 16px; height: 10px; border-radius: 2px; }

/* Barra apilada: parte del todo */
.viz-stack {
  display: flex;
  gap: 2px;
  height: 26px;
  margin-bottom: 14px;
}

.viz-stack-seg {
  border: none;
  padding: 0;
  background: var(--c);
  cursor: pointer;
  border-radius: 2px;
  min-width: 3px;
  transition: filter 0.12s ease;
}

.viz-stack-seg:first-child { border-radius: var(--radius-xs) 2px 2px var(--radius-xs); }
.viz-stack-seg:last-child { border-radius: 2px var(--radius-xs) var(--radius-xs) 2px; }
.viz-stack-seg:hover { filter: brightness(1.08); }
.viz-stack-seg:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.viz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.viz-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Tooltip común. Ningún valor vive solo aquí: todos están en las etiquetas,
   el eje o la tabla del informe. */
.viz-tooltip {
  position: fixed;
  z-index: 3000;
  display: none;
  pointer-events: none;
  background: var(--bg-dark);
  color: #fff;
  border-radius: var(--radius-xs);
  padding: 7px 11px;
  box-shadow: var(--shadow-lg);
  max-width: 260px;
}

.viz-tooltip-label {
  display: block;
  font-size: 11.5px;
  opacity: 0.8;
}

.viz-tooltip-value {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .viz-plot { height: 160px; }
  .viz-bar-row { grid-template-columns: minmax(70px, 120px) minmax(0, 1fr) auto; gap: 8px; }
}

/* ===== ATELIER — LISTA ÚNICA ===== */

.atelier-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.atelier-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.atelier-filter:hover { border-color: var(--primary-color); color: var(--primary-dark); }

.atelier-filter.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.atelier-filter-count {
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.75;
}

.atelier-list {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Filas, no tarjetas: el contenido es una línea de texto, y una tarjeta
   estirada por la rejilla dejaba un hueco muerto bajo cada descripción. */
.atelier-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-smooth);
}

.atelier-row:last-child { border-bottom: none; }
.atelier-row:hover { background: var(--bg-secondary); }

.atelier-row-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.atelier-row-icon svg { width: 18px; height: 18px; }
.atelier-icon--supplies { background: var(--primary-light); color: var(--primary-dark); }

.atelier-row-body { flex: 1; min-width: 0; }

.atelier-row-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.atelier-row-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

.atelier-row-cost {
  font-size: 12px;
  font-weight: 700;
  color: #047857;
  font-variant-numeric: tabular-nums;
}

.atelier-row-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 3px 0 0;
}

.atelier-row-use {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

/* Las acciones no compiten con el contenido: aparecen al recorrer la fila
   y quedan accesibles con teclado. */
.atelier-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.atelier-row:hover .atelier-row-actions,
.atelier-row:focus-within .atelier-row-actions { opacity: 1; }

.atelier-empty {
  padding: 34px 16px;
  text-align: center;
}

.atelier-empty p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.atelier-services {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-secondary);
}

.atelier-service-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 640px) {
  .atelier-row-actions { opacity: 1; }
}

/* ===== FOTO DE UN TRABAJO DEL PORTAFOLIO ===== */

.work-photo-uploader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.work-photo-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
}

.work-photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.work-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.work-photo-placeholder svg { width: 34px; height: 34px; }

.work-photo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== FOTO DEL PROFESIONAL ===== */

.staff-avatar-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.staff-avatar-preview {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.staff-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.staff-avatar-placeholder svg { width: 34px; height: 34px; }

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

.staff-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.staff-avatar-actions .field-hint {
  flex-basis: 100%;
  margin: 0;
}

@media (max-width: 560px) {
  .staff-avatar-uploader { flex-direction: column; align-items: flex-start; }
}

/* ===== USUARIOS: EQUIPO QUE ATIENDE vs SOLO ADMINISTRACIÓN ===== */

/* El contenedor era una rejilla de tarjetas; ahora contiene grupos, que se
   apilan. Las tarjetas siguen en rejilla dentro de cada grupo. */
#settings-users-grid {
  display: block;
}

.users-group + .users-group { margin-top: 26px; }

.users-group-head { margin-bottom: 12px; }

.users-group-head h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.users-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.users-group-head p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 3px 0 0;
}

.users-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

/* El puesto en el salón, en la cuenta de quien también atiende. */
.user-staff-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 2px 0 0;
}

/* Personal que atiende y no puede entrar: el caso roto que la pantalla
   antes no mencionaba. */
.users-orphans {
  margin-top: 22px;
  padding: 12px 16px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
}

.users-orphans-title {
  font-size: 13px;
  font-weight: 700;
  color: #92400E;
  margin: 0;
}

.users-orphans-list {
  font-size: 12.5px;
  color: #92400E;
  margin: 4px 0 0;
}

/* Bloque de acceso dentro del alta de personal. */
.staff-access-block {
  margin-top: 6px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* ===== CONFIGURACIÓN — SECCIONES EN BARRA LATERAL =====
   Siete pestañas en una barra horizontal escondían hasta 6 de 7: a 1440px
   "Usuarios y Permisos" quedaba fuera de vista, y el desplazamiento no lo
   anunciaba nada. En vertical caben todas. */
.settings-tabs-container {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.settings-tabs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  position: sticky;
  top: 16px;
  overflow: visible;
}

.settings-tabs-nav .settings-tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.settings-tabs-nav .settings-tab-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.settings-tabs-nav .settings-tab-btn.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.settings-panels { min-width: 0; }

/* Acciones de una sección, alineadas como en el resto de la pantalla. */
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

@media (max-width: 900px) {
  .settings-tabs-container { grid-template-columns: minmax(0, 1fr); }
  .settings-tabs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .settings-tabs-nav .settings-tab-btn { width: auto; }
}

/* ===== MENSAJES ===== */

.ai-toggle-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 3px 0 0;
  max-width: 34ch;
}

/* Aviso antes de escribir, no después: responder a mano apaga la asistente
   en esa conversación. */
.ai-takeover-hint {
  font-size: 12.5px;
  font-weight: 600;
  color: #92400E;
  background: #FFFBEB;
  border-top: 1px solid #FDE68A;
  margin: 0;
  padding: 9px 16px;
}

/* ===== CUENTA Y PLAN ===== */

/* La comparativa de planes, plegada por defecto. */
.account-plans-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.account-plans-toggle:hover { border-color: var(--primary-color); color: var(--primary-dark); }

.account-plans-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.account-plans-toggle.is-open .account-plans-chevron { transform: rotate(180deg); }

.account-plans-panel { margin-top: 16px; }

.account-plans-cycle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.account-plan-saving {
  font-size: 12.5px;
  font-weight: 700;
  color: #047857;
  margin: -4px 0 10px;
}

/* Una factura sin PDF lo dice, en vez de ofrecer un enlace que recarga. */
.account-invoice-pending {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== COBRO LIBRE ===== */

.free-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.7fr) 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.free-item-row input[type="number"] { font-variant-numeric: tabular-nums; }

.label-optional {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 620px) {
  .free-item-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .free-item-row select, .free-item-row input[type="number"] { grid-column: 1; }
}

/* ===== PAGO DIVIDIDO ===== */

.payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.payment-row input { font-variant-numeric: tabular-nums; }
.payment-row-spacer { display: block; }

.payments-balance {
  font-size: 12.5px;
  font-weight: 600;
  margin: 8px 0 0;
}

.payments-balance:empty { display: none; }
.payments-balance[data-state="ok"] { color: #047857; }
.payments-balance[data-state="bad"] { color: #B91C1C; }

.payment-method-badge.mixto {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ===== ANULACIÓN DE COBROS ===== */

/* Solo para lectores de pantalla: la columna de acciones no lleva rótulo
   visible, pero sí necesita nombre. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.transactions-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

.btn-void {
  color: var(--text-secondary);
  padding: 5px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-void:hover { color: #B91C1C; background: var(--error-light); }

/* El cobro anulado se queda a la vista, tachado: borrarlo de la tabla sería
   esconder que ocurrió. */
.txn-voided td { color: var(--text-muted); }
.txn-voided td strong { text-decoration: line-through; }

.txn-reversal td { background: var(--bg-secondary); }
.txn-reversal td strong { color: #B91C1C; }

.txn-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  vertical-align: middle;
}

.txn-reason {
  display: block;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 2px;
}

.void-explain {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 0 0 16px;
}

/* Quitar impuesto: es destructivo, y el hover lo dice. */
.btn-remove-tax { color: var(--text-secondary); }

/* Dentro de una rejilla el botón no hereda ancho del flex: sin tamaño
   explícito el icono se quedaba en un punto de unos pocos píxeles. */
.free-item-row .btn-remove-tax,
.payment-row .btn-remove-tax {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
}
.btn-remove-tax:hover { color: #B91C1C; background: var(--error-light); }

/* ===== COBRO EN EFECTIVO =====
   El importe recibido y el vuelto viven pegados al total: son los dos
   números que se comparan con los billetes en la mano. El vuelto era un
   <input disabled> de 13px, el dato más pequeño de una pantalla que trata
   de dinero. */
.checkout-cash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 200px);
  gap: 14px;
  align-items: start;
  margin-top: 10px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.checkout-cash-input label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.checkout-cash-input input {
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.checkout-bills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.checkout-bill {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.checkout-bill:hover {
  border-color: var(--primary-color);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.checkout-change {
  text-align: right;
  padding: 4px 0 0;
}

.checkout-change-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.checkout-change-value {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.checkout-change[data-state="change"] .checkout-change-value { color: #047857; }
.checkout-change[data-state="short"] .checkout-change-value { color: #B91C1C; }

.checkout-change-short {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #B91C1C;
  margin-top: 4px;
}

.checkout-change-short:empty { display: none; }

@media (max-width: 560px) {
  .checkout-cash { grid-template-columns: minmax(0, 1fr); }
  .checkout-change { text-align: left; }
}

/* ===== ARQUEO DE CAJA ===== */

.field-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 5px 0 0;
  line-height: 1.4;
}

.cash-modal-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 14px 0 0;
}

/* Lo que debería haber, desglosado: quien cuenta necesita ver de dónde sale
   la cifra contra la que compara. */
.cash-expected {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}

.cash-expected-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.cash-expected-row--total {
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.cash-expected-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 10px 0 0;
  line-height: 1.45;
}

/* El descuadre se lee mientras se teclea. */
.cash-variance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-bottom: 4px;
}

.cash-variance-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cash-variance-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cash-variance[data-state="ok"] { background: #ECFDF5; border-color: #A7F3D0; }
.cash-variance[data-state="ok"] .cash-variance-value { color: #047857; }

.cash-variance[data-state="warn"] { background: #FFFBEB; border-color: #FDE68A; }
.cash-variance[data-state="warn"] .cash-variance-value { color: #92400E; }

.cash-variance[data-state="bad"] { background: #FEF2F2; border-color: #FECACA; }
.cash-variance[data-state="bad"] .cash-variance-value { color: #B91C1C; }

/* Estado de caja en el panel lateral del POS. */
.cash-state {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.cash-state--open { color: #047857; }

.cash-state-list { margin: 0; }

.cash-state-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding: 3px 0;
}

.cash-state-list dt { color: var(--text-secondary); margin: 0; }
.cash-state-list dd { margin: 0; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.cash-state-list .is-total {
  margin-top: 5px;
  padding-top: 7px;
  border-top: 1px solid var(--border-color);
  font-size: 13.5px;
}

.cash-state-list .is-total dd { font-weight: 700; }
.cash-state-list .is-ok dd { color: #047857; }
.cash-state-list .is-bad dd { color: #B91C1C; }

.cash-state-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 0;
  line-height: 1.4;
}

/* Banda de solo lectura del POS: ver otro día es legítimo, cobrar en él no.
   El estado se dice donde se mira, no en gris de 12px en el panel lateral. */
.pos-readonly-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
}

.pos-banner-text {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
}

/* El botón de cobrar deshabilitado explica el motivo en vez de fallar luego. */
.pos-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
}

.pos-action-btn:disabled:hover { transform: none; box-shadow: none; }

.pos-charge-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: -4px 0 4px;
  text-align: center;
}

.pos-charge-hint:empty { display: none; }

/* Bloque de estado de caja: clase en lugar de estilos inline para poder
   refluirlo dentro de la barra inferior de "Acciones de Caja" en pantallas
   pequeñas, donde el panel pasa a ser una barra pegada al fondo. */
.pos-cash-status {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.pos-action-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border-color);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pos-action-btn:hover { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-light); }
.pos-action-btn svg { width: 20px; height: 20px; }

.pos-action-btn.open-cash { border-color: var(--success-color); color: var(--success-color); }
.pos-action-btn.open-cash:hover { background: var(--success-light); }
.pos-action-btn.close-cash { border-color: var(--error-color); color: var(--error-color); }
.pos-action-btn.close-cash:hover { background: var(--error-light); }

.ai-mobile-tabs {
  display: none;
}

.ai-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; height: calc(var(--app-height) - var(--topbar-height) - 120px); }

.ai-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-config-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.ai-config-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.ai-config-header h3 { font-family: var(--font-title); font-size: 14px; font-weight: 700; }

.ai-config-body { padding: 16px; }

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

.ai-form-group input, .ai-form-group textarea, .ai-form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.ai-form-group input:focus, .ai-form-group textarea:focus { outline: none; border-color: var(--primary-color); }
.ai-form-group textarea { min-height: 100px; resize: vertical; }

.ai-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.ai-toggle-row:last-child { border-bottom: none; }
.ai-toggle-label { font-size: 13px; font-weight: 500; }

.ai-chat-panel {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header h3 { font-family: var(--font-title); font-size: 16px; font-weight: 700; }

.ai-chat-tabs { display: flex; gap: 4px; }

.ai-chat-tab {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-body);
  color: var(--text-secondary);
}

.ai-chat-tab:hover { border-color: var(--primary-color); }
.ai-chat-tab.active { background: var(--primary-color); color: #FFFFFF; border-color: var(--primary-color); }

.ai-chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.ai-chat-list::-webkit-scrollbar { width: 4px; }
.ai-chat-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.ai-chat-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 4px;
  align-items: center;
}

.ai-chat-item:hover { background: var(--primary-light); }
.ai-chat-item.active { background: var(--primary-light); }

.ai-chat-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary-color);
  flex-shrink: 0;
  overflow: hidden;
}

.ai-chat-item-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ai-chat-item-info { flex: 1; min-width: 0; }
.ai-chat-item-info h4 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-chat-item-info p { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ai-chat-item-meta { flex-shrink: 0; text-align: right; }
.ai-chat-item-meta .time { font-size: 10px; color: var(--text-muted); }

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  margin-top: 4px;
  margin-left: auto;
}

.ai-chat-conversation {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble.customer {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.bot {
  background: var(--primary-light);
  color: var(--text-primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble.business {
  background: var(--primary-color);
  color: #FFFFFF;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble .bubble-sender { font-size: 10px; font-weight: 700; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.chat-bubble .bubble-time { font-size: 10px; opacity: 0.6; margin-top: 4px; text-align: right; }

.ai-chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-secondary);
}

.ai-chat-input-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
}

.ai-chat-input-bar input:focus { border-color: var(--primary-color); }

.ai-chat-input-bar button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.ai-chat-input-bar button:hover { background: var(--primary-dark); }
.ai-chat-input-bar button svg { width: 18px; height: 18px; stroke: #FFFFFF; }

.settings-layout {
  height: calc(var(--app-height) - var(--topbar-height) - 120px);
  overflow-y: auto;
}

.settings-tabs-container {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.settings-tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
  overflow-x: auto;
  scrollbar-width: thin;
}

.settings-tabs-nav::-webkit-scrollbar {
  height: 4px;
}

.settings-tabs-nav::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.settings-tabs-nav::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.settings-tab-btn {
  flex: 1;
  min-width: 180px;
  padding: 16px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.settings-tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.settings-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-primary);
  font-weight: 600;
}

.settings-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.settings-tab-content.active {
  display: block;
}

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

.settings-section {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.settings-section-header {
  padding: 24px 32px 16px;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.settings-section-header h3 {
  margin: 0 0 8px 0;
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-section-header p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.settings-section-body {
  padding: 24px 32px;
}

.settings-save-bar {
  padding: 16px 32px;
  background: transparent;
  border-top: none;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.settings-grid-compact {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.settings-grid-compact .form-group.compact {
  min-width: 0;
}

.settings-grid-compact .checkbox-group {
  flex-direction: column;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-grid .full-width { grid-column: 1 / -1; }

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

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: var(--transition-smooth);
}

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

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

.settings-save-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-secondary);
}

.hours-config-grid {
  display: grid;
  grid-template-columns: 100px 130px 130px 60px;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.hours-config-grid .day-label { font-size: 13px; font-weight: 600; }

.hours-config-grid input[type="time"] {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: var(--font-body);
  background: var(--bg-secondary);
}

.hours-config-grid input[type="time"]:focus { outline: none; border-color: var(--primary-color); }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.module-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.module-toggle-item .module-name {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.module-toggle-item .module-name img { width: 18px; height: 18px; }

.branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.branch-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.branch-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.branch-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.branch-icon-wrapper svg {
  width: 20px;
  height: 20px;
}

.branch-card-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.branch-card-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.branch-card-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.branch-card-details span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.branch-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.branch-status.active {
  background: color-mix(in srgb, var(--success-color) 10%, transparent);
  color: var(--success-color);
}

.branch-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.modal-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border-light);
  animation: scaleUpModal 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal ancho para pantallas grandes (tablets y computadoras) */
@media (min-width: 769px) {
  .modal-lg {
    width: 90%;
    max-width: 900px;
    max-height: 92vh;
  }

  .modal-lg .modal-form-row {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .modal-lg .modal-form-row--tri {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .modal-lg .service-selection-grid {
    max-height: 420px;
  }

  .modal-lg .service-category-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .modal-lg .modal-form-group input,
  .modal-lg .modal-form-group select,
  .modal-lg .modal-form-group textarea {
    padding: 12px 15px;
    font-size: 14px;
  }

  .modal-lg .modal-form-group label {
    font-size: 12.8px;
  }

  .modal-lg .service-checkbox-card {
    padding: 11px 14px;
    font-size: 13px;
  }
}

.modal-lg .modal-header h2 { font-size: 21px; }

@keyframes scaleUpModal {
  from { transform: scale(0.95) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}

.modal-header h2 { font-family: var(--font-title); font-size: 19px; font-weight: 800; color: var(--text-primary); }

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover { background: var(--error-light); border-color: rgba(239, 68, 68, 0.3); transform: rotate(90deg); }
.modal-close-btn svg { width: 16px; height: 16px; stroke: var(--text-secondary); }

.modal-body { padding: 28px; }

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-secondary);
}

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

.modal-form-group input, .modal-form-group select, .modal-form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition-smooth);
}

.modal-form-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  cursor: not-allowed;
  user-select: none;
}

.modal-form-readonly svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.modal-form-readonly--multiline {
  min-height: 56px;
  height: auto;
  line-height: 1.5;
  white-space: pre-wrap;
  display: block;
  font-size: 13px;
}

/* --- Contador de caracteres para inputs/textareas --- */
.char-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.char-count.limit-reached {
  color: var(--error-color, #ef4444);
}


/* --- Uploader de Imagen de Servicio con Vista Previa --- */
.service-img-uploader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.service-img-preview-box {
  width: 100%;
  height: 135px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-color);
  background: var(--bg-tertiary);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.service-img-preview-box:hover {
  border-color: var(--primary-color);
}

.service-img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.service-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.service-img-placeholder svg {
  width: 30px;
  height: 30px;
  opacity: 0.6;
  color: var(--text-muted);
}

.service-img-placeholder span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.service-img-placeholder small {
  font-size: 11px;
  color: var(--text-muted);
}

.service-img-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-img-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-img-file-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}

.service-img-file-btn svg {
  width: 14px;
  height: 14px;
}

.service-img-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* --- Configuración de Reserva y Porcentaje --- */
.service-deposit-card {
  background: linear-gradient(180deg, rgba(125, 110, 239, 0.04) 0%, rgba(125, 110, 239, 0.08) 100%);
  border: 1px solid rgba(125, 110, 239, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 4px;
  margin-bottom: 6px;
}

.service-deposit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.service-deposit-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.service-deposit-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.deposit-tag-recommended {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--warning-light);
  color: var(--warning-color);
  padding: 2px 6px;
  border-radius: 4px;
}

.service-deposit-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.service-deposit-collapse {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(125, 110, 239, 0.25);
}

.deposit-pct-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 130px;
}

.deposit-pct-input-wrap input {
  width: 100%;
  padding-right: 28px;
  font-weight: 700;
  font-size: 14px;
}

.deposit-pct-symbol {
  position: absolute;
  right: 12px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.deposit-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.deposit-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.deposit-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.deposit-chip.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.deposit-calc-box {
  margin-top: 10px;
  background: var(--bg-primary);
  border: 1px solid rgba(125, 110, 239, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.deposit-calc-box svg {
  width: 16px;
  height: 16px;
  color: var(--primary-color);
  flex-shrink: 0;
}

/* Badge en la tarjeta del catálogo */
.portfolio-card-meta-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.portfolio-card-deposit-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.portfolio-card-deposit-badge svg {
  width: 10px;
  height: 10px;
  stroke: #0284c7;
}

.modal-form-group input:focus, .modal-form-group select:focus, .modal-form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(125, 110, 239, 0.15);
  background: var(--bg-primary);
}

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

.appt-customer-field { position: relative; display: flex; align-items: center; }
.appt-customer-field input { padding-right: 36px; }

.appt-customer-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}
.appt-customer-clear svg { width: 13px; height: 13px; }
.appt-customer-clear:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.appt-customer-results {
  margin-top: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  overflow: hidden;
}
.appt-customer-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}
.appt-customer-result:last-child { border-bottom: none; }
.appt-customer-result:hover, .appt-customer-result.is-selected { background: var(--primary-light); }

.appt-customer-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.appt-customer-result-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.appt-customer-result-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-customer-result-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-customer-result-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary-color);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.appt-customer-empty { padding: 10px 12px; font-size: 12px; color: var(--text-muted); }

.appt-customer-selected { margin: 8px 0px 8px 0px; }
.appt-customer-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--primary-color);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}
.appt-customer-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.appt-customer-chip-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.appt-customer-chip-info strong { font-size: 13px; color: var(--text-primary); }
.appt-customer-chip-info span { font-size: 11px; color: var(--text-secondary); }
.appt-customer-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
  transition: var(--transition-smooth);
}
.appt-customer-chip-remove:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.appt-new-customer {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}
.appt-new-customer .modal-form-group { margin-bottom: 10px; }
.appt-new-customer .modal-form-group:last-child { margin-bottom: 10px; }
.appt-new-customer .modal-form-row { margin-bottom: 0; }
.appt-new-customer .btn { margin-top: 2px; }

.appt-new-customer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.required {
  color: var(--error-color);
  font-weight: 700;
}

.modal-form-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

.modal-form-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--primary-color);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state h3 { font-family: var(--font-title); font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 400px; margin: 0 auto; }

.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toast con acción: vive más porque hay que darle tiempo a uno a darse
   cuenta de lo que acaba de hacer. */
.toast-notification--action {
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 7.7s forwards;
  padding-right: 12px;
}

.toast-text { flex: 1; }

.toast-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.toast-action:hover { background: #fff; color: var(--bg-dark); border-color: #fff; }

/* Confirmación de una acción destructiva: nombra lo que se va a destruir. */
.modal-container--sm { max-width: 460px; }

.status-confirm-summary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.status-confirm-client {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.status-confirm-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 3px 0 0;
}

@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(10px); }
}

.view-header-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
  gap: 10px;
}

/* Layout adaptativo clases */
.sidebar-toggle-btn {
  display: none;
}

.ai-chat-split-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .reports-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .reports-chart-grid { grid-template-columns: 1fr; }
  .reports-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  /* El POS pasa a una columna: el panel de "Acciones de Caja" NO puede
     ocultarse, porque contiene el único acceso a Cobrar Servicios y a
     Abrir/Cerrar Caja. Se convierte en una barra pegada al fondo. */
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 16px;
  }
  .pos-main { overflow: visible; }
  .pos-sidebar-panel {
    display: block;
    position: sticky;
    bottom: 0;
    z-index: 30;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  }
  .pos-sidebar-header { display: none; }
  .pos-sidebar-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    overflow: visible;
  }
  .pos-sidebar-body .pos-action-btn {
    width: auto;
    flex: 1 1 150px;
    margin-bottom: 0;
    padding: 12px 10px;
    font-size: 13px;
  }
  .pos-cash-status {
    flex: 1 1 100%;
    margin-top: 0;
    padding-top: 10px;
  }
  .pos-summary-cards { grid-template-columns: repeat(2, 1fr); }
  .ai-layout { grid-template-columns: 1fr; }
  .ai-sidebar { order: 2; }
  .monitoreo-staff-grid { grid-template-columns: 1fr; }
  .customers-layout {
    flex-direction: column;
    height: auto;
  }
  .customers-list-panel { width: 100%; max-height: 400px; }
}

@media (max-width: 900px) {
  /* La barra superior se envuelve en dos filas: los paneles que se dimensionan
     con calc(var(--app-height) - var(--topbar-height) - N) necesitan el alto real,
     no los 72px de escritorio. */
  :root { --topbar-height: 98px; }

  .top-bar {
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 0;
    margin-right: 0;
    flex-shrink: 0;
  }

  .branch-selector-wrapper {
    order: 1;
    flex: 0 1 auto;
    margin-right: 0;
  }

  .top-bar-actions {
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }

  .view-title-container {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    padding-top: 6px;
  }

  .view-title-container h1 {
    font-size: 18px;
  }

  #current-view-subtitle {
    display: none;
  }
}

@media (max-width: 768px) {
  #current-view-subtitle,
  #top-bar-new-appointment {
    display: none;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
  }
  
  .top-bar {
    padding: 5px 14px;
  }

  /* Alto real de la barra superior con el padding reducido de móvil. */
  :root { --topbar-height: 88px; }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 280px;
    height: var(--app-height);
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
  }
  
  .sidebar.sidebar-open {
    left: 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  }

  .content-wrapper {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid-compact { grid-template-columns: 1fr; }
  .modal-form-row { grid-template-columns: 1fr; }
  
  .agenda-container { flex-direction: column; height: auto; }
  .agenda-sidebar { width: 100%; }


  .reports-kpi-row { grid-template-columns: 1fr; }
  .reports-chart-grid { grid-template-columns: 1fr; }
  .reports-bottom-grid { grid-template-columns: 1fr; }


  .week-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
  }
  
  .week-grid {
    min-width: 800px;
    border: none;
    border-radius: 0;
  }

  /* CRM Clientes Adaptativo */
  .customers-layout {
    position: relative;
    display: block;
    height: calc(var(--app-height) - var(--topbar-height) - 40px);
  }
  .customers-list-panel {
    width: 100%;
    max-height: none;
    height: 100%;
  }
  .customer-detail-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 10;
    padding: 0;
  }
  .customers-layout.detail-active .customers-list-panel {
    display: none;
  }
  .customers-layout.detail-active .customer-detail-panel {
    display: block;
    overflow-y: auto;
  }

  /* Centro AI Adaptativo */
  .ai-mobile-tabs {
    display: flex;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    gap: 4px;
  }
  .ai-mobile-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
  }
  .ai-mobile-tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
  }
  .ai-layout {
    grid-template-columns: 1fr;
    height: calc(var(--app-height) - var(--topbar-height) - 100px);
  }
  .ai-sidebar {
    display: none;
  }
  .ai-layout.show-config .ai-sidebar {
    display: flex;
  }
  .ai-layout.show-config .ai-chat-panel {
    display: none;
  }
  .ai-chat-panel.conversation-active .ai-chat-header {
    display: none;
  }
  .ai-back-btn {
    display: inline-flex !important;
  }
  .ai-chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .ai-chat-tabs {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .ai-chat-tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    white-space: nowrap;
  }
  .ai-chat-split-container {
    grid-template-columns: 1fr;
    position: relative;
    height: 100%;
  }
  .ai-chat-list {
    width: 100%;
  }
  .ai-chat-conversation {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 10;
  }
  .ai-chat-panel.conversation-active .ai-chat-list {
    display: none;
  }
  .ai-chat-panel.conversation-active .ai-chat-conversation {
    display: flex;
  }

  /* Redes Sociales Responsivo */
  .social-add-form {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .social-add-form > .form-group {
    flex: 1 1 auto !important;
    align-self: stretch !important;
  }
  .social-add-form button {
    width: 100%;
    margin-top: 8px;
  }

  /* Atelier & Social Items Responsivos a nivel Tablet/Móvil */

  .social-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .social-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-light);
    padding-top: 10px;
    margin-top: 4px;
  }
  .transactions-table {
    min-width: 600px;
  }

  /* Monitoreo & Compensaciones Responsivo en Teléfonos */
  .monitoreo-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .monitoreo-period-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .monitoreo-period-label {
    display: block;
    width: 100%;
    font-size: 13px;
    font-weight: 600;
  }

  .monitoreo-period-selector .filter-chips-row {
    display: flex;
    width: 100%;
    gap: 6px;
    flex-wrap: wrap;
  }

  .monitoreo-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .monitoreo-staff-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    width: 100%;
  }

  .monitoreo-card {
    padding: 14px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .monitoreo-card-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .monitoreo-user-info {
    gap: 10px;
  }

  .monitoreo-avatar {
    width: 42px;
    height: 42px;
  }

  .monitoreo-compensation-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .monitoreo-compensation-box .comp-total-amount {
    align-self: flex-end;
    font-size: 24px;
  }

  .monitoreo-card-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .monitoreo-card-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .monitoreo-metrics-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .work-detail-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .monitoreo-work-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  .monitoreo-work-table th,
  .monitoreo-work-table td {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    padding: 6px 6px !important;
    font-size: 11.5px !important;
  }

  .monitoreo-work-table th:nth-child(1),
  .monitoreo-work-table td:nth-child(1) {
    width: 32%;
  }

  .monitoreo-work-table th:nth-child(2),
  .monitoreo-work-table td:nth-child(2) {
    width: 48%;
  }

  .monitoreo-work-table th:nth-child(3),
  .monitoreo-work-table td:nth-child(3) {
    width: 20%;
    text-align: right;
  }
}

/* La rejilla de horarios mide ~456px: se corrige ya en el punto de corte de
   móvil, no a 500px, para cubrir la banda 501-768px donde desbordaba. */
@media (max-width: 768px) {
  .hours-config-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 6px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
  }
  .hours-config-grid .day-label {
    grid-column: 1;
    grid-row: 1;
    font-size: 14px;
    margin-bottom: 2px;
    align-self: center;
  }
  .hours-config-grid input[type="time"] {
    grid-row: 2;
    width: 100%;
  }
  .hours-config-grid .toggle-switch {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-bottom: 2px;
  }
}

@media (max-width: 500px) {
  .monitoreo-summary-grid {
    grid-template-columns: 1fr;
  }
}


.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.atelier-section {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.atelier-subsection-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.atelier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.atelier-item {
  background: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-smooth);
}

.atelier-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.atelier-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.atelier-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.atelier-item-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--primary-color);
}

.atelier-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.atelier-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  width: 100%;
  word-break: break-word;
}

.atelier-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 4px;
}

.portfolio-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.portfolio-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: var(--transition-smooth);
}

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

.portfolio-card-image {
  position: relative;
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  overflow: hidden;
}

.portfolio-card-image > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-card-edit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.45);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.portfolio-card-edit svg { width: 14px; height: 14px; }

.portfolio-card:hover .portfolio-card-edit { opacity: 1; }

.portfolio-card--disabled {
  opacity: 0.6;
  filter: grayscale(45%);
}

.portfolio-card--disabled .portfolio-card-toggle { pointer-events: none; }
.portfolio-card--disabled .toggle-switch input:checked + .toggle-slider { background-color: var(--border-color); }
.portfolio-card--disabled .toggle-switch input:checked + .toggle-slider:before { transform: translateX(0); }

.portfolio-card-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

.portfolio-card-lock svg { width: 12px; height: 12px; }

.portfolio-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease, background 0.25s ease;
  z-index: 2;
}
.portfolio-card-delete svg { width: 15px; height: 15px; }
.portfolio-card:hover .portfolio-card-delete { opacity: 1; }
.portfolio-card-delete:hover { background: var(--error-color); }

.portfolio-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}
.portfolio-card-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.portfolio-card-rating .portfolio-star { width: 15px; height: 15px; }
.portfolio-card-rating b { font-size: 12px; color: var(--text-primary); }
.portfolio-card-times {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.portfolio-card-times svg { width: 13px; height: 13px; }

.portfolio-card-body {
  padding: 16px;
}

.portfolio-card-category {
  display: inline-block;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.portfolio-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.portfolio-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.portfolio-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.reviews-summary {
  background: var(--bg-primary);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}

.reviews-summary-score {
  text-align: center;
}

.reviews-summary-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 8px;
}

.reviews-summary-stars {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 8px;
}

.reviews-summary-stars svg {
  width: 20px;
  height: 20px;
  fill: #FBBF24;
}

.reviews-summary-count {
  font-size: 13px;
  color: var(--text-muted);
}

.reviews-summary-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
}

.review-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.review-bar-fill {
  height: 100%;
  background: #FBBF24;
  border-radius: var(--radius-full);
}

.review-bar-count {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

.reviews-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-card {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.review-card-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-color);
}

.review-card-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.review-card-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.review-card-rating {
  display: flex;
  gap: 2px;
}

.review-card-rating svg {
  width: 16px;
  height: 16px;
  fill: #FBBF24;
}

.review-card-rating svg.empty {
  fill: var(--border-color);
}

.review-card-service {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.review-card-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.review-card-response {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-color);
  margin-top: 12px;
}

.review-card-response-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.review-card-response-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.review-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-chip.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  margin: 5px 0px;
}

.filter-chip-icon {
  width: 16px;
  height: 16px;
}

.social-add-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.social-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.social-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.social-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.social-item-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.social-item-details {
  flex: 1;
}

.social-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.social-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.social-item-actions {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   USUARIOS Y PERMISOS — Settings tab
   ═══════════════════════════════════════════════════════════════════════════ */

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}

.user-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-inactive {
  opacity: 0.6;
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar span {
  font-weight: 600;
  font-size: 15px;
  color: var(--primary-color);
}

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

.user-card-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.role-admin {
  background: rgba(125, 110, 239, 0.12);
  color: var(--primary-color);
}

.role-manager {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.role-receptionist {
  background: rgba(245, 158, 11, 0.12);
  color: #D97706;
}

.role-professional {
  background: rgba(59, 130, 246, 0.12);
  color: #2563EB;
}

.user-card-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}

.user-card-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-status {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.user-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.user-status.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

.user-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Roles ─────────────────────────────────────────────────────────────── */

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.role-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.role-card-header {
  margin-bottom: 12px;
}

.role-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.role-card-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.role-views-list {
  margin-bottom: 12px;
}

.role-views-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.role-views-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.view-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.role-card-actions {
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPA DE SUCURSALES — Leaflet
   ═══════════════════════════════════════════════════════════════════════════ */

.branch-map-container {
  width: 100%;
  height: 380px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  z-index: 1;
  background: var(--bg-tertiary);
}

.branch-address-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.branch-address-row input {
  flex: 1;
}

.branch-address-row .btn {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.branch-coords-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.branch-coords-display span {
  font-weight: 500;
  white-space: nowrap;
}

.branch-coords-display input {
  width: 110px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--bg-secondary);
  font-size: 13px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

.modal-form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 8px 0;
}

.branch-coords {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.branch-coords--empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Fix: Leaflet necesita que sus panes/z-index respeten el contexto del modal */
.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Logo uploader — Datos del Negocio
   ═══════════════════════════════════════════════════════════════════════════ */
.biz-logo-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.biz-logo-preview {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border-medium);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.biz-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.biz-logo-placeholder {
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
}

.biz-logo-placeholder svg {
  width: 28px;
  height: 28px;
}

.biz-logo-placeholder span {
  font-size: 11px;
}

.biz-logo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.biz-logo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary-color);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}

.biz-logo-upload-btn:hover {
  background: var(--primary-dark, #6B5DD3);
}

.biz-logo-actions .btn-ghost {
  align-self: flex-start;
  font-size: 12px;
}

/* ========================================================================== */
/*  PANTALLA DE AUTENTICACIÓN (login / registro)                               */
/* ========================================================================== */

html:has(#auth-screen:not(.auth-hidden)),
body:has(#auth-screen:not(.auth-hidden)) {
  background-color: #FFFFFF !important;
  background-image: none !important;
  background: #FFFFFF !important;
}

#auth-screen,
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  opacity: 1;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 20px;
}

.auth-overlay.auth-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-container,
.auth-card {
  width: 100%;
  max-width: 520px;
  margin: auto;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0;
  display: block;
}

/* --- Lado formulario (centrado y limpio) --- */
.auth-form-side {
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
}

.auth-form-logo {
  display: block;
  width: auto;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 10px;
}

.auth-form-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-form-header h2 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-form-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-form-mode {
  display: none;
}

.auth-form-mode.active {
  display: block;
  max-width: 100%;
  overflow: hidden;
}

#auth-login,
#auth-verify {
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

#auth-register {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Grid de dos columnas para el registro */
.auth-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.auth-field-full {
  grid-column: 1 / -1;
}

.auth-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-field input,
.auth-field select {
  width: 100%;
  max-width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(125, 110, 239, 0.12);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap input {
  width: 100%;
  padding-right: 42px;
}

.auth-toggle-pass {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.auth-toggle-pass svg {
  width: 18px;
  height: 18px;
}

.auth-toggle-pass:hover {
  color: var(--primary-color);
}

.auth-submit,
#verify-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-forgot-row {
  text-align: right;
  margin-top: -4px;
}

.auth-forgot-link {
  font-size: 13px;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-switch a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-error {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--error-light);
  border: 1px solid var(--error-color);
  border-radius: var(--radius-sm);
  color: var(--error-color);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.auth-error.show {
  display: block;
}

/* --- Pantalla de verificación de código (OTP 6 dígitos) --- */
.auth-verify-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.auth-verify-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  align-self: stretch;
  text-align: center;
}

.auth-otp-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.auth-otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 1;
  min-width: 0;
}

.auth-otp-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(125, 110, 239, 0.12);
}

.auth-otp-input::-webkit-outer-spin-button,
.auth-otp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.auth-otp-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-verify-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
  text-decoration: none;
}

.auth-link-btn:hover {
  text-decoration: underline;
}

/* --- Botón logout en sidebar --- */
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sidebar-logout-btn:hover {
  background: var(--error-light);
  color: var(--error-color);
}

.sidebar-logout-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --- Responsive Auth --- */
@media (max-width: 768px) {
  .auth-overlay {
    padding: 24px 16px;
    align-items: flex-start;
  }

  .auth-container,
  .auth-card {
    max-width: 100%;
    margin: 0 auto;
  }

  .auth-form-side {
    padding: 0;
  }

  .auth-form-logo {
    max-width: 180px;
    margin: 0 auto 10px;
  }

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

  .auth-otp-input {
    width: 40px;
    height: 50px;
    font-size: 20px;
  }

  .auth-otp-container {
    gap: 8px;
  }

  .auth-verify-actions {
    justify-content: center;
  }
}

/* ============================================================
   CUENTA Y PLAN — Suscripción, facturación y método de pago
   ============================================================ */

.account-view {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 8px 0 32px;
}

/* --- Tarjeta resumen del plan actual --- */
.account-current-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(125, 110, 239, 0.08), rgba(125, 110, 239, 0.02));
  border: 1px solid rgba(125, 110, 239, 0.2);
  flex-wrap: wrap;
}

.account-current-plan-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: fit-content;
}

.account-current-plan-left h2 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.account-current-plan-left p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.account-current-plan-right {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.account-billing-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-billing-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.account-billing-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Sección genérica --- */
.account-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-section-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* --- Toggle ciclo mensual/anual --- */
.account-cycle-toggle {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.account-cycle-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.account-cycle-btn.active {
  background: #FFFFFF;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.account-cycle-save {
  color: var(--success-color);
  font-size: 11px;
  font-weight: 700;
  margin-left: 2px;
}

/* --- Grid de tarjetas de planes --- */
.account-plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.account-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  transition: var(--transition-smooth);
}

.account-plan-card.highlight {
  border-color: var(--primary-color);
  border-width: 2px;
  box-shadow: 0 8px 24px -8px rgba(125, 110, 239, 0.25);
}

.account-plan-card.current {
  border-color: var(--success-color);
}

.account-plan-tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 14px;
  border-radius: var(--radius-full);
  background: var(--primary-color);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.account-plan-name {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.account-plan-tagline {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
  min-height: 34px;
}

.account-plan-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 4px 0;
}

.account-plan-price-value {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.account-plan-price-period {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.account-plan-btn {
  width: 100%;
  justify-content: center;
}

.account-plan-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.account-plan-features {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.account-plan-features li.excluded {
  color: var(--text-muted);
  opacity: 0.65;
}

.account-feature-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.account-feature-icon.yes { color: var(--success-color); }
.account-feature-icon.no { color: var(--text-muted); }

/* --- Tarjeta de método de pago --- */
.account-payment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.account-payment-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--bg-dark);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.account-payment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.account-payment-number {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.account-payment-exp {
  font-size: 12px;
  color: var(--text-muted);
}

.account-payment-provider {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Tabla de facturas --- */
.account-invoices-table {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.account-invoices-head,
.account-invoices-row {
  display: grid;
  grid-template-columns: 120px 110px 1fr 100px 110px 90px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.account-invoices-head {
  background: var(--bg-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.account-invoices-row {
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.account-invoices-row:hover {
  background: var(--bg-tertiary);
}

.account-invoice-id {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.account-invoice-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.account-invoice-status.paid {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.account-invoice-status.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.account-invoice-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.account-invoice-link:hover {
  text-decoration: underline;
}

/* --- Zona de peligro --- */
.account-danger-zone {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.02);
}

.account-danger-zone .account-section-header h3 {
  color: var(--error-color);
}

.account-danger-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* --- Aviso de Stripe en modal --- */
.account-stripe-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .account-plans-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* La fila de facturas mide ~601px: mismo criterio, se corrige en el punto de
   corte de móvil y no a 600px, para cubrir la banda 601-768px. */
@media (max-width: 768px) {
  .account-current-plan-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .account-current-plan-right {
    gap: 20px;
  }
  .account-plans-grid {
    grid-template-columns: 1fr;
  }
  .account-invoices-head,
  .account-invoices-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 4px;
  }
}

/* ============================================================
   ADAPTACIÓN TÁCTIL Y AJUSTES MÓVILES
   Bloque final: misma especificidad que las reglas anteriores,
   pero declarado después, de modo que prevalece en cascada sin
   necesidad de !important.
   ============================================================ */

/* --- Elementos que solo se revelaban con hover ---------------------------
   Sin hover (móvil/tablet), el overlay de "Editar" cubría TODA la imagen de
   la tarjeta: invisible pero pulsable, de modo que tocar un servicio abría el
   modal de edición en lugar de seleccionarlo. El botón de borrar del portafolio
   sufría lo mismo. Se convierten en botones compactos siempre visibles y se
   deja libre el resto de la imagen. */
@media (hover: none), (pointer: coarse) {
  .portfolio-card-edit {
    inset: auto;
    top: 10px;
    left: 10px;
    width: auto;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.72);
    opacity: 1;
  }
  .portfolio-card-edit svg { width: 15px; height: 15px; }

  .portfolio-card-delete {
    opacity: 1;
    width: 34px;
    height: 34px;
    background: rgba(15, 23, 42, 0.72);
  }

  /* El valor de cada barra del gráfico solo aparecía con hover. */
  .chart-bar-value { opacity: 1; }

  /* --- Objetivos táctiles: 44px donde no rompe la composición --- */
  .btn-icon,
  .modal-close-btn,
  .cal-nav-btn,
  .agenda-nav-btn,
  .appt-customer-chip-remove { min-width: 44px; min-height: 44px; }

  .cal-day-btn { min-height: 44px; }
  .apt-quick-end-btn { width: 34px; height: 34px; }
  .toggle-switch { width: 44px; height: 24px; }
  .toggle-slider:before { width: 20px; height: 20px; }
  .toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
  .checkbox-label input { width: 20px; height: 20px; }
  .nav-link { padding-top: 13px; padding-bottom: 13px; }
  .tag-filter-chip,
  .filter-chip,
  .staff-chip,
  .dash-tab { padding-top: 9px; padding-bottom: 9px; }
  .btn-sm { min-height: 36px; }
}

/* --- Colapsos y ajustes de móvil que faltaban ---------------------------- */
@media (max-width: 768px) {
  /* Rejillas que nunca colapsaban: detalle de cita y fila de impuestos del cobro. */
  .info-grid { grid-template-columns: 1fr; }
  .tax-row { flex-wrap: wrap; }

  /* Resumen de reseñas: a una columna. */
  .reviews-summary { grid-template-columns: 1fr; gap: 16px; }

  /* Barra de fecha de la agenda: desbordaba ~23px y recortaba "Hoy". */
  .agenda-date-nav { flex-wrap: wrap; }
  .agenda-calendar-dropdown { left: 0; transform: none; }

  /* Barra de acciones de caja (POS) en móvil. */
  .pos-sidebar-body .pos-action-btn {
    flex: 1 1 140px;
    padding: 12px 8px;
    font-size: 12.5px;
  }

  /* Los gráficos de barras de 30/90 días se desplazan en horizontal en lugar
     de ocultar el período. */
  .dash-bar-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
  .dash-bar-chart-bars { height: 150px; }
}

/* ============================================================
   REPORTES — PRIMERA OLA
   Seis familias: Capacidad · Dinero · Clientes · Operación ·
   Calidad · Sedes. Reutiliza tokens y el lenguaje de tarjetas
   del dashboard; añade tablas, deltas y bloques de caja.
   ============================================================ */

/* --- Cabecera: familias + período --- */
.reports-family-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.reports-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.reports-context { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reports-context-title { font-family: var(--font-title); font-size: 16px; font-weight: 700; color: var(--text-primary); }
.reports-context-sub { font-size: 12.5px; color: var(--text-secondary); }
.reports-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- KPIs de reportes --- */
.reports-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.report-kpi {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

/* Nota de un reporte: la recomendación que acompaña a una cifra fuera de rango. */
.report-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

.report-note--alert {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* Fila de KPI embebida dentro de una tarjeta de reporte. */
.reports-kpi-row--inline { margin-bottom: 14px; }

.report-kpi--alert { border-color: rgba(245, 158, 11, 0.45); background: var(--warning-light); }
.report-kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-muted); }
.report-kpi-value { font-family: var(--font-title); font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1.15; }
.report-kpi-sub { font-size: 12.5px; color: var(--text-secondary); }
.report-kpi-delta { margin-top: 2px; }

.report-delta { font-size: 12px; font-weight: 600; }
.report-delta.up { color: var(--success-color); }
.report-delta.down { color: var(--error-color); }
.report-delta.flat { color: var(--text-muted); font-weight: 500; }

/* --- Tarjetas y tablas --- */
.report-card { margin-bottom: 18px; }

.reports-table-wrapper { width: 100%; overflow-x: auto; }
.reports-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reports-table th,
.reports-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.reports-table th {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--bg-secondary);
}
.reports-table tbody tr:hover { background: var(--bg-secondary); }
.reports-table .ta-right,
.reports-table th.ta-right { text-align: right; }

.reports-empty,
.reports-empty-block {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
}
.reports-empty-block h3 { font-family: var(--font-title); font-size: 16px; margin-bottom: 6px; color: var(--text-primary); }
.reports-empty-block p { font-size: 13px; line-height: 1.55; }

/* --- Barras horizontales --- */
.report-bars { display: flex; flex-direction: column; gap: 12px; }
.report-bar-row { display: flex; flex-direction: column; gap: 4px; }
.report-bar-info { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.report-bar-label { color: var(--text-primary); font-weight: 600; }
.report-bar-value { color: var(--text-secondary); }
.report-bar-track { height: 8px; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.report-bar-fill { height: 100%; background: var(--primary-gradient); border-radius: var(--radius-full); }

/* --- Acciones y utilidades --- */
.report-action-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.report-action-link:hover { background: var(--primary-color); color: #FFFFFF; }
.report-muted { color: var(--text-muted); font-size: 12px; }

.report-ok { color: #047857; }
.report-bad { color: #B91C1C; }
.report-cash-reason { font-style: italic; }

/* --- Caja del día --- */
.report-cash-state { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.report-cash-pill {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}
.report-cash-pill.open { background: var(--success-light); color: var(--success-color); }
.report-cash-pill.closed { background: var(--bg-tertiary); color: var(--text-secondary); }
.report-cash-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* --- Antigüedad de cobros --- */
.report-bucket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.report-bucket {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}
.report-bucket-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.report-bucket-value { font-family: var(--font-title); font-size: 20px; font-weight: 800; color: var(--text-primary); }
.report-bucket-sub { font-size: 12px; color: var(--text-secondary); }

/* --- Reportes en móvil --- */
@media (max-width: 900px) {
  .reports-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .reports-kpi-row { grid-template-columns: 1fr; }
  .reports-toolbar { flex-direction: column; align-items: flex-start; }
  .report-bucket-grid { grid-template-columns: 1fr; }

  /* Mismo criterio que la tabla de Monitoreo: sin scroll horizontal, con
     ajuste de contenido y tipografía. */
  .reports-table-wrapper { overflow-x: visible; }
  .reports-table { table-layout: fixed; }
  .reports-table th,
  .reports-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    padding: 8px 6px;
    font-size: 11.5px;
  }
}

/* --- Impresión: solo el reporte --- */
@media print {
  .sidebar,
  .top-bar,
  .reports-header,
  .reports-toolbar,
  .toast-container,
  #modal-container { display: none !important; }
  body.pro-app { height: auto; overflow: visible; display: block; background: #FFFFFF; }
  .content-wrapper { overflow: visible; padding: 0; height: auto; }
  .view-section:not(.active) { display: none !important; }
  .dash-card,
  .report-kpi { box-shadow: none; border-color: #CBD5E1; break-inside: avoid; }
}
