/* ═══════════════════════════════════════════════════════════════
   LuviApp — Design System
   Beauty SaaS · Multi-tenant · PWA
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Poppins:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ── */
:root {
  /* Palette Light */
  --rose: #F2B5C0;
  --rose-deep: #E8889A;
  --rose-soft: #FADADD;
  --lavender: #D8D4F0;
  --lavender-d: #A89EDB;
  --nude: #F5E6DA;
  --nude-deep: #E0C8B5;
  --cream: #FFF8F5;
  --cream-mid: #FDF0EC;

  /* Neutrals Light */
  --bg: #FFF8F5;
  --bg-card: #FFFFFF;
  --bg-hover: #FDF0EC;
  --border: rgba(232, 136, 154, 0.2);
  --border-mid: rgba(232, 136, 154, 0.35);
  --text-prime: #2D1B20;
  --text-body: #5C3D47;
  --text-muted: #A07B88;
  --text-faint: #C9A8B2;

  /* Semantic */
  --success: #7ECBA1;
  --warning: #F5C97A;
  --danger: #F28B82;
  --info: #7BB8E8;

  /* Elevations */
  --shadow-sm: 0 1px 4px rgba(45, 27, 32, 0.06), 0 0 0 1px rgba(232, 136, 154, 0.08);
  --shadow-md: 0 4px 16px rgba(45, 27, 32, 0.10), 0 0 0 1px rgba(232, 136, 154, 0.10);
  --shadow-lg: 0 8px 32px rgba(45, 27, 32, 0.14), 0 0 0 1px rgba(232, 136, 154, 0.12);
  --shadow-xl: 0 20px 60px rgba(45, 27, 32, 0.18);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 36px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-mid: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --max-w: 1440px;
}

[data-theme="dark"] {
  --bg: #1A0E12;
  --bg-card: #251318;
  --bg-hover: #2E191E;
  --border: rgba(242, 181, 192, 0.12);
  --border-mid: rgba(242, 181, 192, 0.22);
  --text-prime: #FAF0F2;
  --text-body: #E0C0CA;
  --text-muted: #C08898;
  --text-faint: #7A4D58;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(242, 181, 192, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(242, 181, 192, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(242, 181, 192, 0.10);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);

  --rose-soft: rgba(242, 181, 192, 0.12);
  --nude: rgba(229, 172, 138, 0.12);
  --lavender: rgba(216, 212, 240, 0.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100%;
  overflow-x: hidden;
  transition: background var(--t-mid), color var(--t-mid);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5 {
  font-family: 'Playfair Display', serif;
  color: var(--text-prime);
  line-height: 1.25;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
}

h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
}

h4 {
  font-size: clamp(1rem, 2vw, 1.25rem);
}

p {
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  color: var(--text-body);
}

.font-serif {
  font-family: 'Playfair Display', serif;
}

.font-sans {
  font-family: 'Poppins', sans-serif;
}

.text-italic {
  font-style: italic;
}

/* ── Utility Classes ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

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

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--r-full);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  transition: all var(--t-fast);
  white-space: nowrap;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rose-deep) 0%, #C56B7F 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(232, 136, 154, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(232, 136, 154, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--rose-deep);
  border: 1.5px solid var(--border-mid);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--rose-soft);
  border-color: var(--rose-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-body);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover {
  background: var(--bg-hover);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--rose-deep);
  border-color: var(--border-mid);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(242, 139, 130, 0.35);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: all var(--t-mid);
}

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

.card-sm {
  padding: 1rem;
  border-radius: var(--r-md);
}

.card-glass {
  background: rgba(255, 248, 245, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .card-glass {
  background: rgba(37, 19, 24, 0.8);
  border: 1px solid rgba(242, 181, 192, 0.1);
}

/* ── Badges / Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(126, 203, 161, 0.15);
  color: #3D8B62;
  border: 1px solid rgba(126, 203, 161, 0.3);
}

.badge-warning {
  background: rgba(245, 201, 122, 0.15);
  color: #9B6F00;
  border: 1px solid rgba(245, 201, 122, 0.3);
}

.badge-danger {
  background: rgba(242, 139, 130, 0.15);
  color: #C0392B;
  border: 1px solid rgba(242, 139, 130, 0.3);
}

.badge-info {
  background: rgba(123, 184, 232, 0.15);
  color: #1A6FA0;
  border: 1px solid rgba(123, 184, 232, 0.3);
}

.badge-rose {
  background: var(--rose-soft);
  color: var(--rose-deep);
  border: 1px solid var(--border-mid);
}

.badge-lavender {
  background: var(--lavender);
  color: var(--lavender-d);
  border: 1px solid rgba(168, 158, 219, 0.3);
}

[data-theme="dark"] .badge-success {
  color: var(--success);
}

[data-theme="dark"] .badge-warning {
  color: var(--warning);
}

[data-theme="dark"] .badge-danger {
  color: var(--danger);
}

[data-theme="dark"] .badge-info {
  color: var(--info);
}

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-prime);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-prime);
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--rose-deep);
  box-shadow: 0 0 0 3px rgba(232, 136, 154, 0.15);
}

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input-icon {
  position: relative;
}

.form-input-icon .form-input {
  padding-left: 2.75rem;
}

.form-input-icon .icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 1.1rem;
  height: 1.1rem;
}

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

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Sidebar Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--t-mid), width var(--t-mid);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Texto de los nav-items: animación al colapsar */
.nav-item-text {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--t-mid), max-width var(--t-mid);
  max-width: 200px;
  opacity: 1;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
}

/* ── Resto de estilos del Sidebar ── */
.sidebar-logo {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
  overflow: hidden;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: none;
}

.sidebar-logo .logo-icon img,
.sidebar-logo .logo-icon-img,
.logo-icon-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
}

.sidebar-logo .logo-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-logo .logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-prime);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo .logo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 0.75rem 0.75rem 0.375rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-prime);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(232, 136, 154, 0.15) 0%, rgba(168, 158, 219, 0.1) 100%);
  color: var(--rose-deep);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--rose-deep);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--rose-deep);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast);
}

.user-card:hover {
  background: var(--bg-hover);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--rose) 0%, var(--lavender-d) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

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

.user-info .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-prime);
}

.user-info .user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left var(--t-mid);
}

/* ══════════════════════════════════════════════════════
   PROTECCIÓN SIDEBAR TOGGLE — nunca se bloquea
   ui-lock.js puede deshabilitar botones durante la carga.
   Este selector asegura que #sidebarToggle SIEMPRE
   sea clicable, sin importar el estado de la app.
   ══════════════════════════════════════════════════════ */
#sidebarToggle,
#sidebarToggle:disabled,
[data-no-lock],
[data-no-lock]:disabled {
  pointer-events: auto !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-prime);
  flex: 1;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  padding: 0.4rem 1rem;
  min-width: clamp(180px, 20vw, 280px);
  transition: border-color var(--t-fast);
}

.topbar-search:focus-within {
  border-color: var(--rose-deep);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--text-prime);
  width: 100%;
}

.topbar-search input::placeholder {
  color: var(--text-faint);
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: clamp(1rem, 3vw, 2rem);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.page-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: all var(--t-mid);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.03) 100%);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-info .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.stat-info .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-prime);
  font-family: 'Playfair Display', serif;
  line-height: 1;
}

.stat-info .stat-change {
  font-size: 0.75rem;
  margin-top: 0.375rem;
}

.stat-change.up {
  color: var(--success);
}

.stat-change.down {
  color: var(--danger);
}

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

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon.rose {
  background: var(--rose-soft);
  color: var(--rose-deep);
}

.stat-icon.lavender {
  background: var(--lavender);
  color: var(--lavender-d);
}

.stat-icon.nude {
  background: var(--nude);
  color: #C4956A;
}

.stat-icon.success {
  background: rgba(126, 203, 161, 0.15);
  color: var(--success);
}

/* ── Calendar ── */
.fc {
  --fc-border-color: var(--border);
  --fc-button-bg-color: var(--rose-deep);
  --fc-button-border-color: var(--rose-deep);
  --fc-button-hover-bg-color: #C56B7F;
  --fc-button-active-bg-color: #C56B7F;
  --fc-today-bg-color: rgba(232, 136, 154, 0.07);
  --fc-event-bg-color: var(--rose-deep);
  --fc-event-border-color: var(--rose-deep);
  --fc-page-bg-color: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
}

.fc .fc-toolbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-prime);
}

.fc .fc-col-header-cell-cushion {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fc .fc-daygrid-day-number {
  font-size: 0.85rem;
  color: var(--text-body);
}

.fc .fc-button {
  border-radius: var(--r-sm) !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
}

.fc .fc-event {
  border-radius: var(--r-xs) !important;
  padding: 2px 6px !important;
  font-size: 0.78rem !important;
  cursor: pointer;
}

.event-confirmed {
  background: linear-gradient(90deg, #7ECBA1, #5BB88A) !important;
  border-color: #5BB88A !important;
}

.event-pending {
  background: linear-gradient(90deg, var(--rose), var(--rose-deep)) !important;
  border-color: var(--rose-deep) !important;
}

.event-blocked {
  background: linear-gradient(90deg, #9E9E9E, #757575) !important;
  border-color: #757575 !important;
}

.fc-event-title {
  font-weight: 500;
}

/* ── Appointment Card ── */
.appointment-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
  cursor: pointer;
}

.appointment-item:hover {
  border-color: var(--rose-deep);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

.appt-time {
  text-align: center;
  min-width: 56px;
}

.appt-time .time {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-prime);
}

.appt-time .ampm {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.appt-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

.appt-info {
  flex: 1;
  min-width: 0;
}

.appt-client {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-prime);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-service {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.appt-duration {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.appt-status {
  flex-shrink: 0;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  transform: scale(0.92) translateY(20px);
  transition: transform var(--t-mid);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 340px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: toastIn var(--t-mid) ease forwards;
}

.toast.removing {
  animation: toastOut var(--t-fast) ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--info);
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-prime);
}

.toast-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Loading ── */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--rose-deep);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

/* ── Theme Toggle ── */
.theme-toggle {
  width: 44px;
  height: 24px;
  background: var(--border-mid);
  border-radius: var(--r-full);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast);
  border: none;
}

.theme-toggle.active {
  background: var(--rose-deep);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--t-fast);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.active::after {
  transform: translateX(20px);
}

/* ── Loyalty Badge ── */
.loyalty-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, rgba(245, 201, 122, 0.15) 0%, rgba(232, 136, 154, 0.12) 100%);
  border: 1.5px solid rgba(245, 201, 122, 0.4);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--text-prime);
}

.loyalty-alert .loyalty-icon {
  font-size: 1.3rem;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-hover);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-body);
  vertical-align: middle;
}

/* ── Avatar Group ── */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -10px;
  border: 2px solid var(--bg-card);
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-hover);
  padding: 0.25rem;
  border-radius: var(--r-md);
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--t-fast);
  text-align: center;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--rose-deep);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

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

/* ── Charts ── */
.chart-wrap {
  position: relative;
  height: 220px;
}

/* ── Progress ── */
.progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-deep), var(--lavender-d));
  border-radius: var(--r-full);
  transition: width 0.6s ease;
}

/* ── Color Dots ── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green {
  background: var(--success);
}

.dot-red {
  background: var(--danger);
}

.dot-yellow {
  background: var(--warning);
}

.dot-rose {
  background: var(--rose-deep);
}

/* ── Scrollbar Global ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ── Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.animate-fade {
  animation: fadeIn var(--t-mid) ease both;
}

.animate-up {
  animation: slideUp var(--t-mid) ease both;
}

.animate-pulse {
  animation: pulse 2s ease infinite;
}

/* Staggered children */
.stagger>* {
  animation: slideUp var(--t-mid) ease both;
}

.stagger>*:nth-child(1) {
  animation-delay: 0ms;
}

.stagger>*:nth-child(2) {
  animation-delay: 60ms;
}

.stagger>*:nth-child(3) {
  animation-delay: 120ms;
}

.stagger>*:nth-child(4) {
  animation-delay: 180ms;
}

.stagger>*:nth-child(5) {
  animation-delay: 240ms;
}

.stagger>*:nth-child(6) {
  animation-delay: 300ms;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — Sistema de Sidebar adaptativo
   ══════════════════════════════════════════════════════

   LÓGICA:
   • > 768px  → sidebar FIJO, visible. Hamburger lo COLAPSA
               (solo iconos, 72px) o lo EXPANDE (260px).
               .main-content se ajusta con margin-left.
   • ≤ 768px  → sidebar OCULTO por defecto (translateX -100%).
               Hamburger lo ABRE como drawer + overlay oscuro.
               .main-content ocupa 100% del ancho.
   ══════════════════════════════════════════════════════ */

/* ── Variables del sidebar mini (iconos solos) ── */
:root {
  --sidebar-mini: 72px;
}

/* ══════════════════════════════════════
   TV grande (≥ 1920px)
   ══════════════════════════════════════ */
@media (min-width: 1920px) {
  :root { --sidebar-w: 300px; }

  .stats-grid { grid-template-columns: repeat(5, 1fr); }
  .page-content { padding: 2.5rem 3rem; }
  .stat-info .stat-value { font-size: 2.2rem; }
}

/* ══════════════════════════════════════
   Tablet (≤ 1024px)
   ══════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════
   ESCRITORIO / TABLET > 768px
   Sidebar colapsable (iconos ↔ texto)
   ══════════════════════════════════════ */
@media (min-width: 769px) {

  /* Estado COLAPSADO: solo iconos */
  .sidebar.collapsed {
    width: var(--sidebar-mini);
  }

  /* El contenido se desplaza según el ancho del sidebar */
  .sidebar.collapsed + .sidebar-overlay + .main-content,
  .sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-mini);
  }

  /* Ocultar textos cuando está colapsado */
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .logo-sub,
  .sidebar.collapsed .nav-section-label,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .sidebar-footer .user-info,
  .sidebar.collapsed .sidebar-footer .user-role,
  .sidebar.collapsed .sidebar-footer span {
    display: none;
  }

  /* Nav items: solo icono centrado */
  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
    gap: 0;
    overflow: hidden;
  }
  /* Ocultar el texto del nav-item (nodo de texto directo) */
  .sidebar.collapsed .nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  /* Ocultar texto con clase .nav-item-text si existe */
  .sidebar.collapsed .nav-item-text {
    max-width: 0;
    opacity: 0;
  }
  /* Fallback: ocultar nodos de texto directos usando font-size 0 en el item
     pero preservando el tamaño del SVG mediante font-size explícito */
  .sidebar.collapsed .nav-item {
    font-size: 0;
  }
  .sidebar.collapsed .nav-item svg {
    font-size: 1rem; /* reset para el SVG */
  }
  /* Tooltip al hover en modo colapsado */
  .sidebar.collapsed .nav-item {
    position: relative;
  }

  /* Logo centrado */
  .sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 1.25rem 0;
    gap: 0;
  }
  .sidebar.collapsed .sidebar-logo img {
    margin: 0 auto;
  }

  /* Footer: avatar centrado */
  .sidebar.collapsed .sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .sidebar.collapsed .user-card {
    justify-content: center;
    padding: 0.5rem;
  }
  .sidebar.collapsed .theme-toggle-row {
    display: none;
  }
}

/* ══════════════════════════════════════
   MÓVIL (≤ 768px)
   Sidebar tipo drawer desde la izquierda
   ══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar: OCULTO por defecto, desliza como drawer */
  .sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    box-shadow: var(--shadow-xl);
    z-index: 300;
    transition: transform var(--t-mid);
  }

  /* Sidebar ABIERTO */
  .sidebar.open {
    transform: translateX(0);
  }

  /* Contenido principal: ocupa TODO el ancho */
  .main-content {
    margin-left: 0 !important;
    transition: none;
  }

  /* Grids → 1 columna */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  /* Topbar compacto */
  .topbar {
    padding: 0 1rem;
  }

  .topbar-search {
    display: none;
  }

  /* Stats: 2 columnas en móvil */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Espacio para el bottom-nav fijo */
  .page-content {
    padding: 1rem;
    padding-bottom: 5.5rem;
  }

  /* Modales más compactos */
  .modal {
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 95vh;
    margin-top: auto;
  }

  /* Bottom nav VISIBLE en móvil */
  .bottom-nav {
    display: block;
  }

  /* Overlay oscuro detrás del sidebar */
  .sidebar-overlay {
    z-index: 299;
  }

  .sidebar-overlay.open {
    display: block;
  }
}

/* ══════════════════════════════════════
   Móvil pequeño (≤ 480px)
   ══════════════════════════════════════ */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card { padding: 1rem; }
  .stat-info .stat-value { font-size: 1.4rem; }
  h1 { font-size: 1.5rem; }
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAV — Estilo app móvil
   Solo visible en ≤ 768px
   Estructura: Inicio | Agenda | [+Agendar] | Clientas | Finanzas
   ══════════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 0.375rem 0.25rem env(safe-area-inset-bottom, 0.5rem);
  z-index: 90;
  box-shadow: 0 -2px 20px rgba(45, 27, 32, 0.08);
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

/* Item normal */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.375rem 0.25rem;
  color: var(--text-faint);
  font-size: 0.62rem;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  transition: color var(--t-fast), transform var(--t-fast);
  cursor: pointer;
  flex: 1;
  border: none;
  background: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
  transition: transform var(--t-fast);
}

.bottom-nav-item:active svg {
  transform: scale(0.88);
}

/* Estado activo */
.bottom-nav-item.active {
  color: var(--rose-deep);
}

.bottom-nav-item.active svg {
  stroke-width: 2.25;
}

/* Puntito indicador bajo el ícono activo */
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose-deep);
}

/* ── Botón central CTA (Agendar) ── */
.bottom-nav-item.bottom-nav-cta {
  flex: 0 0 auto;
  padding: 0 0.5rem;
  position: relative;
  top: -10px;
  gap: 0.2rem;
  color: var(--text-muted);
}

.bottom-nav-item.bottom-nav-cta::after {
  display: none;
}

.bottom-nav-cta-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-deep) 0%, #C56B7F 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(232, 136, 154, 0.55);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.bottom-nav-item.bottom-nav-cta:active .bottom-nav-cta-circle {
  transform: scale(0.91);
  box-shadow: 0 2px 8px rgba(232, 136, 154, 0.35);
}

.bottom-nav-cta-circle svg {
  width: 26px;
  height: 26px;
  stroke: #fff !important;
  stroke-width: 2.5;
  color: #fff;
}

.bottom-nav-item.bottom-nav-cta .bottom-nav-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
}


/* ══════════════════════════════════════
   SIDEBAR OVERLAY (base, fuera de @media)
   ══════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 299;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ── Realtime indicator ── */
.realtime-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(126, 203, 161, 0.6);
  animation: realtimePulse 2s ease infinite;
}

@keyframes realtimePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 203, 161, 0.6);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(126, 203, 161, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(126, 203, 161, 0);
  }
}

/* ===============================
   🔒 GLOBAL LOADER PROFESIONAL
================================= */

.global-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

.global-loader.active {
  display: flex;
}

.gl-box {
  background: white;
  padding: 1.5rem 2rem;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.gl-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid #f0f0f0;
  border-top: 4px solid #d63384;
  animation: gl-spin 0.7s linear infinite;
}

@keyframes gl-spin {
  to {
    transform: rotate(360deg);
  }
}

.gl-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}