/* ===================================================
   FISIO CLINIC — DESIGN SYSTEM v2
   A professional, modern medical UI with depth,
   glassmorphism, and smooth micro-interactions.
=================================================== */

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

/* ===== DESIGN TOKENS ===== */
:root {
  --sidebar-width: 256px;
  --topbar-h: 62px;

  /* Sidebar */
  --sidebar-bg: #232B6E;
  --sidebar-border: rgba(255,255,255,0.055);
  --sidebar-hover: rgba(99,102,241,0.1);
  --sidebar-active-bg: rgba(99,102,241,0.18);
  --sidebar-active-border: #6366f1;

  /* Surface */
  --bg: #f0f4ff;
  --bg-2: #e8eef8;
  --card-bg: #ffffff;
  --card-hover-bg: #fdfeff;

  /* Text */
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-xmuted: #94a3b8;

  /* Border */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Brand */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-darker: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(99,102,241,0.3);

  /* Semantic */
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-glow: rgba(16,185,129,0.3);
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-glow: rgba(239,68,68,0.3);
  --info: #06b6d4;
  --info-light: #ecfeff;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Multi-layer shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.04), 0 1px 6px rgba(0,0,0,0.03);
  --shadow:     0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(99,102,241,0.06), 0 8px 24px rgba(0,0,0,0.04);
  --shadow-md:  0 2px 8px rgba(0,0,0,0.06), 0 8px 28px rgba(99,102,241,0.08), 0 20px 40px rgba(0,0,0,0.05);
  --shadow-lg:  0 4px 12px rgba(0,0,0,0.08), 0 20px 48px rgba(0,0,0,0.12);
  --shadow-primary: 0 4px 20px rgba(99,102,241,0.4);
  --shadow-success: 0 4px 20px rgba(16,185,129,0.4);
  --shadow-danger:  0 4px 20px rgba(239,68,68,0.4);

  /* Transitions */
  --t: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(99,102,241,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139,92,246,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: radial-gradient(120% 55% at 30% 0%, rgba(99,102,241,.55), transparent 60%), var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--t), width var(--t);
  overflow: hidden;
  /* Multi-layer sidebar depth */
  box-shadow: 4px 0 24px rgba(0,0,0,0.15), 1px 0 0 var(--sidebar-border);
}


.sidebar.collapsed {
  width: 0;
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  position: relative;
}

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(99,102,241,0.5);
  flex-shrink: 0;
  position: relative;
}

.brand-icon::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
  pointer-events: none;
}

.brand-name {
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.4px;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; }

.nav-section {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  padding: 18px 20px 5px;
}

.nav-item { margin: 1px 10px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 9px;
  color: rgba(255,255,255,0.92) !important;
  text-decoration: none;
  font-size: 0.855rem;
  font-weight: 500;
  transition: background var(--t), color var(--t), transform var(--t), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t);
}

.nav-link:hover {
  color: #fff !important;
  background: var(--sidebar-hover);
  box-shadow: 0 2px 10px rgba(99,102,241,0.25);
  transform: translateX(2px);
}

.nav-link.active {
  color: #fff !important;
  background: var(--sidebar-active-bg);
  box-shadow: 0 2px 14px rgba(99,102,241,0.35);
}

.nav-link.active::before {
  transform: scaleX(1);
}

.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.75;
  flex-shrink: 0;
  transition: opacity var(--t), color var(--t);
}

.nav-link:hover i,
.nav-link.active i { opacity: 1; color: var(--primary); }

/* ===== COLOR CIRCLE PICKER ===== */
.color-circle-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 4px;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: transform var(--t), outline var(--t), box-shadow var(--t);
  outline: 3px solid transparent;
  outline-offset: 2px;
}

.color-dot:hover {
  transform: scale(1.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.color-dot.selected {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== AJUSTES SUBMENU ===== */
.settings-toggle { cursor: pointer; }

.nav-toggle-arrow {
  margin-left: auto;
  font-size: 0.7rem !important;
  width: auto !important;
  opacity: 0.5 !important;
  transition: transform var(--t), opacity var(--t) !important;
}

.settings-toggle[aria-expanded="true"] .nav-toggle-arrow {
  transform: rotate(180deg);
  opacity: 0.9 !important;
}

.nav-submenu {
  list-style: none;
  padding: 2px 0 4px;
  margin: 0;
}

.nav-submenu .nav-item { margin: 1px 10px 1px 22px; }

.nav-submenu .nav-link {
  font-size: 0.82rem;
  padding: 7px 12px;
}

.nav-submenu .nav-link i {
  font-size: 0.8rem;
  width: 16px;
}

.metodo-pago-btn { border-radius: 20px !important; font-size: 0.8rem; padding: 4px 12px; }
.metodo-pago-btn.active-metodo { background: #6366f1 !important; border-color: #6366f1 !important; color: #fff !important; }

/* Colores extra para notificaciones */
.bg-orange-subtle { background-color: #fff3e0 !important; }
.text-orange { color: #e65100 !important; }
.bg-purple-subtle { background-color: #ede7f6 !important; }
.text-purple { color: #6366f1 !important; }

.sidebar-footer {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
}

.adapta-brand-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity var(--t);
}
.adapta-brand-link:hover { opacity: 0.9; }

.adapta-logo {
  width: 100%;
  max-width: 80px;
  height: auto;
  filter: brightness(0) invert(1);
}

.adapta-label {
  color: rgba(255,255,255,0.5);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t);
  position: relative;
}

.main-wrapper.full-width { margin-left: 0; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky; top: 0; z-index: 500;
  box-shadow: 0 1px 0 rgba(226,232,240,0.6), 0 4px 20px rgba(0,0,0,0.04);
}

.sidebar-toggle {
  color: var(--text-muted) !important;
  padding: 7px !important;
  border: none !important;
  background: none !important;
  display: flex !important;
  font-size: 1rem;
  border-radius: 8px !important;
  transition: background var(--t), color var(--t) !important;
}
.sidebar-toggle:hover {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.topbar-breadcrumb {
  font-size: 0.845rem;
  color: var(--text-muted);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

/* Fichaje de jornada en el navbar */
.navclock {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 5px 5px 14px;
  border-radius: 999px;
  background: var(--success-light);
  border: 1px solid rgba(16,185,129,0.28);
}
.navclock-dot {
  width: 8px; height: 8px; flex: none;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 var(--success-glow);
  animation: navclock-pulse 2s infinite;
}
@keyframes navclock-pulse {
  0%   { box-shadow: 0 0 0 0 var(--success-glow); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.navclock-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: .3px;
  color: #065f46;
}
.navclock-out-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 0.92rem;
  cursor: pointer;
  transition: background var(--t), transform .1s;
}
.navclock-out-btn:hover { background: var(--danger); color: #fff; }
.navclock-out-btn:active { transform: scale(0.94); }
.navclock-in-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(16,185,129,0.35);
  background: var(--success-light);
  color: #065f46;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--t), color var(--t), transform .1s;
}
.navclock-in-btn:hover { background: var(--success); color: #fff; }
.navclock-in-btn:active { transform: scale(0.96); }

.topbar-user {
  display: flex; align-items: center; gap: 9px;
  background: none; border: none;
  color: var(--text);
  font-size: 0.855rem; font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background var(--t);
}
.topbar-user:hover { background: var(--bg); }

/* Campana de notificaciones */
.topbar-notif-btn { color: var(--text-muted); border-radius: 10px; transition: background var(--t); }
.topbar-notif-btn:hover { background: var(--bg) !important; }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: #ef4444; color: #fff;
  font-size: 0.62rem; font-weight: 700;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}
.notif-dropdown { box-shadow: 0 8px 24px rgba(0,0,0,.12); border-radius: 12px !important; }
.notif-header { background: var(--bg); border-radius: 12px 12px 0 0; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: default; transition: background var(--t); }
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.85rem; }
.notif-item .notif-title { font-size: 0.83rem; font-weight: 600; }
.notif-item .notif-body  { font-size: 0.77rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.notif-item .notif-time  { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.notif-dismiss-btn {
  border: none; background: transparent; color: var(--text-muted);
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; opacity: 0; transition: opacity var(--t), background var(--t), color var(--t);
}
.notif-item:hover .notif-dismiss-btn { opacity: 1; }
.notif-dismiss-btn:hover { background: var(--success-light); color: var(--success); }
.notif-dismiss-btn:disabled { opacity: 0.4; }

.user-avatar-top {
  width: 33px; height: 33px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.72rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

/* ===== CONTENT AREA ===== */
.content-area {
  flex: 1;
  padding: 28px 28px 48px;
  position: relative;
}

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

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.035em;
}

/* ===== FLASH MESSAGES ===== */
.flash-container { margin-bottom: 22px; }

.alert {
  border-radius: var(--radius-sm) !important;
  border-width: 0 0 0 4px !important;
  font-size: 0.875rem;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s var(--t-spring) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: var(--success-light); border-color: var(--success) !important; color: #065f46; }
.alert-danger,
.alert-error   { background: var(--danger-light); border-color: var(--danger) !important; color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: var(--warning) !important; color: #92400e; }
.alert-info    { background: var(--info-light); border-color: var(--info) !important; color: #164e63; }

/* ===== CARDS ===== */
.card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--card-bg);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}

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

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbff;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Lift cards on hover for interactive ones */
a.card, .card-lift {
  text-decoration: none !important;
  cursor: pointer;
}
a.card:hover, .card-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99,102,241,0.2);
}

/* ===== STAT CARDS ===== */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform var(--t-spring), box-shadow var(--t);
}

a.stat-card {
  text-decoration: none !important;
  cursor: pointer;
}
a.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* Gradient shine overlay */
.stat-card::after {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 65%);
  pointer-events: none;
}

/* Geometric background shape */
.stat-card::before {
  content: '';
  position: absolute;
  bottom: -20px; right: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  opacity: 0.12;
  transition: transform var(--t-spring);
}
a.stat-card:hover::before { transform: scale(1.15); }

.stat-blue {
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  border-color: #bfdbfe;
}
.stat-blue::before { background: #3b82f6; }
.stat-blue .stat-icon { color: #2563eb; background: rgba(59,130,246,0.15); }
.stat-blue .stat-value { color: #1d4ed8; }

.stat-indigo {
  background: linear-gradient(135deg, #e0e7ff 0%, #eef2ff 100%);
  border-color: #c7d2fe;
}
.stat-indigo::before { background: #6366f1; }
.stat-indigo .stat-icon { color: var(--primary); background: rgba(99,102,241,0.15); }
.stat-indigo .stat-value { color: var(--primary-dark); }

.stat-purple {
  background: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 100%);
  border-color: #ddd6fe;
}
.stat-purple::before { background: #8b5cf6; }
.stat-purple .stat-icon { color: #7c3aed; background: rgba(139,92,246,0.15); }
.stat-purple .stat-value { color: #6d28d9; }

.stat-amber {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
  border-color: #fde68a;
}
.stat-amber::before { background: #f59e0b; }
.stat-amber .stat-icon { color: #d97706; background: rgba(245,158,11,0.15); }
.stat-amber .stat-value { color: #b45309; }

.stat-emerald {
  background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%);
  border-color: #a7f3d0;
}
.stat-emerald::before { background: #10b981; }
.stat-emerald .stat-icon { color: #059669; background: rgba(16,185,129,0.15); }
.stat-emerald .stat-value { color: #047857; }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
}
.stat-body { flex: 1; }
.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; font-weight: 500; }
.stat-icon-sm {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}

/* ===== TABLES ===== */
.table {
  --bs-table-hover-bg: #fafbff;
  font-size: 0.875rem;
}

.table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-xmuted);
  padding: 11px 16px;
  border-bottom: 2px solid var(--border) !important;
  background: #fafbff;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--t);
}

.table tbody tr {
  transition: background var(--t);
}

.table tbody tr:hover td {
  background: #fafbff;
}

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

.table-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.7rem; font-weight: 700;
  flex-shrink: 0;
}

/* ===== BADGES ===== */
.badge-status {
  font-size: 0.69rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.01em;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #cffafe; color: #164e63; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

.badge-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.employee-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: middle; }

/* Bootstrap badge overrides */
.badge.bg-success-subtle   { background: #dcfce7 !important; color: #15803d !important; }
.badge.bg-danger-subtle    { background: #fee2e2 !important; color: #b91c1c !important; }
.badge.bg-warning-subtle   { background: #fef9c3 !important; color: #a16207 !important; }
.badge.bg-secondary-subtle { background: #f1f5f9 !important; color: #475569 !important; }
.badge.bg-info-subtle      { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.bg-primary-subtle   { background: #eef2ff !important; color: #4338ca !important; }

/* ===== BUTTONS ===== */
.btn {
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.855rem;
  transition: all var(--t);
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

/* Ripple on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.2);
  opacity: 0;
  transition: opacity 0.15s;
}
.btn:active::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-dark) 100%);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, #059669 0%, var(--success) 100%);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  border-color: transparent;
  box-shadow: var(--shadow-success);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, var(--danger) 100%);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}
.btn-danger:hover {
  box-shadow: var(--shadow-danger);
  transform: translateY(-1px);
}

.btn-outline-primary {
  border-color: #c7d2fe;
  color: var(--primary-dark);
  background: var(--primary-light);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-secondary);
  background: white;
}
.btn-outline-secondary:hover {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-outline-danger {
  border-color: #fecaca;
  color: var(--danger);
  background: var(--danger-light);
}
.btn-outline-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  box-shadow: var(--shadow-danger);
  transform: translateY(-1px);
}

.btn-ghost {
  background: none; border: none; color: var(--text-muted);
  padding: 6px 9px;
  border-radius: 8px;
  transition: background var(--t), color var(--t);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ===== FORMS ===== */
.form-control, .form-select {
  border-radius: 9px;
  border-color: var(--border);
  font-size: 0.875rem;
  background: white;
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  padding: 9px 13px;
}

.form-control:focus, .form-select:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3.5px rgba(99,102,241,0.14);
  background: white;
  outline: none;
}

.form-control:hover:not(:focus), .form-select:hover:not(:focus) {
  border-color: var(--border-strong);
}

.form-label {
  font-size: 0.835rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.form-check-input:checked {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

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

.input-group > .form-control, .input-group > .form-select {
  border-radius: 0;
}
.input-group > :first-child { border-radius: 9px 0 0 9px; }
.input-group > :last-child  { border-radius: 0 9px 9px 0; }
.input-group-text {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Nav tabs */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 4px;
}
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 14px;
  font-size: 0.855rem;
  font-weight: 600;
  color: var(--text-muted) !important;
  border-radius: 9px 9px 0 0 !important;
  background: none;
  transition: color var(--t), border-color var(--t), background var(--t);
}
.nav-tabs .nav-link:hover {
  color: var(--text) !important;
  background: var(--bg) !important;
  border-color: transparent !important;
  transform: none;
}
.nav-tabs .nav-link.active {
  color: var(--primary-dark) !important;
  border-bottom-color: var(--primary) !important;
  background: none !important;
}

/* Nav pills (used inside modals/cards, not sidebar) */
.nav-pills .nav-link {
  color: var(--text-secondary) !important;
  background: transparent;
  border-radius: 8px !important;
  padding: 8px 16px;
  font-size: 0.855rem;
  font-weight: 600;
  transition: color var(--t), background var(--t) !important;
  transform: none !important;
}
.nav-pills .nav-link:hover {
  color: var(--text) !important;
  background: rgba(99,102,241,0.08) !important;
  transform: none !important;
}
.nav-pills .nav-link.active {
  color: white !important;
  background: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.nav-pills .nav-link i { color: inherit !important; opacity: 0.8; }
.nav-pills .nav-link.active i,
.nav-pills .nav-link:hover i { color: inherit !important; opacity: 1; }

/* ===== MODALS ===== */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbff;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-body { padding: 22px; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: #fafbff;
  gap: 8px;
}

.modal-backdrop.show { backdrop-filter: blur(4px); background: rgba(15,23,42,0.5); }

/* Modal animation */
.modal.fade .modal-dialog {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  transform: translateY(-20px) scale(0.98);
}
.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* ===== DROPDOWNS ===== */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  padding: 6px;
  animation: dropIn 0.15s var(--t) both;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.855rem;
  transition: background var(--t), color var(--t);
  font-weight: 500;
}
.dropdown-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.dropdown-item.text-danger:hover { background: var(--danger-light); color: var(--danger); }

/* ===== AUTH ===== */
.auth-body {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  min-height: 100vh;
}
.auth-wrapper { display: flex; min-height: 100vh; width: 100%; }
.auth-left {
  flex: 1;
  background: linear-gradient(135deg, #0b0f1e 0%, #1e1b4b 40%, #4f46e5 80%, #7c3aed 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
  max-width: 45%;
  position: relative;
  overflow: hidden;
}
.auth-left::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 60%);
  pointer-events: none;
}
.auth-left-content { color: white; max-width: 400px; position: relative; z-index: 1; text-align: center; }
.auth-logo-img {
  width: 220px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 32px;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.35));
}
.auth-left-content h2 { font-size: 1.7rem; font-weight: 900; margin-bottom: 14px; letter-spacing: -0.02em; line-height: 1.2; }
.auth-left-content p { font-size: 1rem; opacity: 0.75; margin-bottom: 0; }
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-form-container { width: 100%; max-width: 420px; }
.auth-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.04em; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }
.auth-icon-circle {
  width: 60px; height: 60px;
  background: var(--primary-light); color: var(--primary);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.2);
}

/* ===== PATIENT DETAIL ===== */
.patient-card-info { border-radius: var(--radius); }

.patient-avatar-lg {
  width: 76px; height: 76px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 1.5rem; font-weight: 800;
  margin: 0 auto;
  box-shadow: 0 8px 20px rgba(99,102,241,0.35);
}

.patient-info-list { display: flex; flex-direction: column; gap: 10px; }
.info-item {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.855rem;
}
.info-item i { width: 16px; margin-top: 2px; color: var(--text-muted); }

.mini-stat {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg) 0%, #eef2ff 100%);
  border-radius: var(--radius-sm);
  border: 1px solid #e0e7ff;
}
.mini-stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; }
.mini-stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ===== PATIENT LIST ===== */
.patient-list { list-style: none; margin: 0; padding: 0; }
.patient-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #f8fafc;
  transition: background var(--t);
}
.patient-item:last-child { border-bottom: none; }
.patient-item:hover { background: #fafbff; }

.patient-avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.72rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.patient-info { flex: 1; min-width: 0; }
.patient-name { font-weight: 600; font-size: 0.875rem; color: var(--text); text-decoration: none; }
.patient-name:hover { color: var(--primary); }
.patient-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ===== SEGUIMIENTOS ===== */
.seguimientos-section {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.seguimientos-header { }
.seguimientos-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
}
.btn-xs-add {
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
  text-decoration: none;
  transition: background var(--t), color var(--t);
}
.btn-xs-add:hover { background: var(--primary); color: #fff; }

.seguimientos-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.seg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid #6366f1;
  background: #f5f3ff;
  color: #4f46e5;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), color var(--t), transform var(--t);
  white-space: nowrap;
}
.seg-chip:hover {
  background: #6366f1;
  color: #fff;
  transform: translateY(-1px);
}
.seg-chip-num {
  font-weight: 700;
  font-size: .7rem;
  background: #6366f1;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
}
.seg-chip:hover .seg-chip-num { background: rgba(255,255,255,0.3); }
.seg-chip-date { font-weight: 600; }
.seg-chip-title {
  color: inherit;
  opacity: .8;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seg-chip-icon { font-size: .65rem; opacity: .6; }

/* ===== CLINICAL TIMELINE ===== */
.clinical-timeline { position: relative; padding-left: 30px; }

.clinical-timeline::before {
  content: '';
  position: absolute; left: 9px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), #8b5cf6, rgba(139,92,246,0.15));
  border-radius: 2px;
}

.timeline-item { position: relative; margin-bottom: 24px; }

.timeline-dot {
  position: absolute; left: -24px; top: 10px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12), 0 2px 6px rgba(99,102,241,0.25);
  transition: transform var(--t-spring);
}
.timeline-item:hover .timeline-dot { transform: scale(1.2); }

.timeline-dot-zones {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239,68,68,0.12), 0 2px 6px rgba(239,68,68,0.25);
}

.timeline-content {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t);
}
.timeline-item:hover .timeline-content {
  box-shadow: var(--shadow);
  border-color: #c7d2fe;
}

.timeline-header { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.timeline-date { color: var(--primary); font-weight: 700; }

.timeline-field {
  background: #f8fafc;
  border-radius: var(--radius-xs);
  padding: 9px 13px;
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid #f1f5f9;
}
.timeline-field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-xmuted);
  margin-bottom: 5px;
}
.timeline-field-obs { background: #fffcf0; border-color: #fef3c7; }

.clinical-field-content { font-size: 0.9rem; line-height: 1.6; }
.clinical-field-content p { margin-bottom: 0.5rem; }
.clinical-field-content ul, .clinical-field-content ol { padding-left: 1.25rem; margin-bottom: 0.5rem; }

/* ===== BONO CARDS ===== */
.bono-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.bono-item:last-child { border-bottom: none; }
.bono-item.bono-warning { background: #fffbeb; }
.bono-type { font-weight: 600; font-size: 0.8rem; }
.bono-count { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.bono-expiry { font-size: 0.7rem; }

.bono-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: white;
  transition: box-shadow var(--t);
}
.bono-card:hover { box-shadow: var(--shadow); }
.bono-card-inactive { opacity: 0.5; }
.bono-card-type { font-weight: 700; font-size: 0.95rem; }
.bono-card-date { font-size: 0.75rem; }

/* Bono template cards */
.bono-template-card {
  transition: transform var(--t-spring), box-shadow var(--t);
}
.bono-template-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ===== EMPLOYEE CARDS ===== */
.emp-card {
  transition: transform var(--t-spring), box-shadow var(--t);
  border-left-width: 4px !important;
}
.emp-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.employee-inactive { opacity: 0.55; }

.emp-avatar {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.emp-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.emp-contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  text-decoration: none;
  transition: color var(--t), background var(--t), border-color var(--t);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-contact-chip i { font-size: 0.68rem; color: var(--text-muted); flex-shrink: 0; }
.emp-contact-chip:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}
.emp-contact-chip:hover i { color: var(--primary); }

/* ===== PILATES ===== */
.pilates-card {
  transition: transform var(--t-spring), box-shadow var(--t);
}
.pilates-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-list li { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; }
.info-list li i { width: 16px; color: var(--text-muted); }

/* ===== EMPTY STATES ===== */
.empty-state {
  padding: 52px 20px;
  text-align: center;
}
.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.5;
}

/* ===== PROGRESS BARS ===== */
.progress {
  border-radius: 20px;
  overflow: hidden;
  background: #f1f5f9;
}
.progress-bar {
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== PAGINATION ===== */
.page-link {
  border-radius: 8px !important;
  border-color: var(--border) !important;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.855rem;
  transition: all var(--t);
}
.page-link:hover { background: var(--primary-light) !important; color: var(--primary-dark) !important; }
.page-item.active .page-link {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  box-shadow: var(--shadow-primary);
}

/* ===== FILTER BUTTONS ===== */
.filter-emp-btn {
  border-radius: 20px !important;
  border-width: 2px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  padding: 5px 14px !important;
  transition: all var(--t-spring) !important;
}
.filter-emp-btn.active {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  color: white !important;
  box-shadow: var(--shadow-primary);
}

/* ===== FULLCALENDAR CUSTOM ===== */
.fc { font-family: 'Inter', inherit; font-size: 0.875rem; }
.fc .fc-toolbar-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.03em; }
.fc .fc-button {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  letter-spacing: 0 !important;
  text-transform: capitalize;
  box-shadow: none !important;
  transition: all var(--t) !important;
}
.fc .fc-button:hover {
  background: var(--primary-darker) !important;
  box-shadow: var(--shadow-primary) !important;
}
.fc .fc-button-active {
  background: var(--primary-darker) !important;
}
.fc .fc-event {
  border-radius: 7px !important;
  border: none !important;
  font-size: 0.78rem; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12) !important;
  transition: transform var(--t), box-shadow var(--t) !important;
}
.fc .fc-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18) !important;
  z-index: 5;
}
.fc .fc-daygrid-day-number { font-weight: 700; color: var(--text); font-size: 0.8rem; }
.fc .fc-col-header-cell-cushion { font-weight: 700; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.fc-theme-standard td, .fc-theme-standard th { border-color: #f1f5f9 !important; }
.fc .fc-timegrid-slot { height: 40px; }
.fc .fc-timegrid-now-indicator-line { border-color: var(--danger) !important; border-width: 2px !important; }
.fc .fc-timegrid-now-indicator-arrow { border-top-color: var(--danger) !important; border-bottom-color: var(--danger) !important; }

/* ===== BODY DIAGRAM (PRESERVE EXISTING) ===== */
.body-diagram-wrapper {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.bd-controls, .bd-controls-readonly {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.bd-control-group { display: flex; align-items: center; gap: 8px; }
.bd-control-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.bd-diagrams-container {
  display: flex; min-height: 600px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; position: relative;
  overflow: hidden; user-select: none; touch-action: none;
}
.bd-viewport {
  flex: 1; position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
  display: flex; justify-content: center; align-items: flex-start; padding-top: 20px;
}
.bd-viewport:last-child { border-right: none; }
.bd-view-panel {
  position: relative; width: 280px;
  aspect-ratio: 704 / 1494;
  transition: transform 0.1s ease-out; transform-origin: center top; flex-shrink: 0;
}
.bd-panel-label { display: none; }
.bd-zoom-controls { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 10; }
.bd-zoom-btn {
  width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text);
  box-shadow: var(--shadow-xs);
}
.bd-zoom-btn:hover { background: #f1f5f9; }
.bd-svg { width: 100%; height: 100%; display: block; cursor: crosshair; overflow: visible; }
.bd-img-muscle, .bd-img-bone { display: none; pointer-events: none; }
.bd-mode-muscle .bd-img-muscle { display: block; }
.bd-mode-bone .bd-img-bone { display: block; }

/* ── Coloración anatómica de los paths (el cuerpo ES el SVG) ── */
.bd-svg { background: #f5f0eb; border-radius: 8px; }
/* Paths estructurales (codos) */
.bd-zone-static path { fill: #b85c4f; stroke: #7a3a2e; stroke-width: 0.08; pointer-events: none; }
/* Modo músculo: color anatómico rojo-pardo */
.bd-mode-muscle .bd-zone path { fill: #C4685A; stroke: #8B3A2E; stroke-width: 0.08; transition: fill .3s; }
/* Modo hueso: crema / gris claro */
.bd-mode-bone .bd-zone path { fill: #D8CCBC; stroke: #A09078; stroke-width: 0.08; transition: fill .3s; }
/* Zonas activas (highlight) */
.bd-mode-muscle .bd-zone.bd-zone-muscle path { fill: #f59e0b; stroke: #b45309; }
.bd-mode-bone   .bd-zone.bd-zone-bone   path { fill: #0ea5e9; stroke: #0369a1; }
/* Las zonas resaltadas en el modo contrario también se ven */
.bd-mode-bone   .bd-zone.bd-zone-muscle path { fill: #fcd34d; stroke: #b45309; }
.bd-mode-muscle .bd-zone.bd-zone-bone   path { fill: #7dd3fc; stroke: #0369a1; }
/* Zona clicable: feedback visual al hover */
.bd-zone.bd-zone-muscle:hover path,
.bd-zone.bd-zone-bone:hover path { opacity: 0.75; }
.readonly .bd-svg { cursor: default; }
.bd-region { fill: transparent; stroke: transparent; transition: fill 0.15s ease, stroke 0.15s ease; cursor: pointer; }
.bd-region:hover { fill: rgba(99,102,241,0.15); stroke: rgba(99,102,241,0.4); stroke-width: 1; }
.readonly .bd-region { cursor: default; }
.readonly .bd-region:hover { fill: transparent; stroke: transparent; }
.bd-label { fill: #1e293b; font-family: inherit; font-size: 6px; pointer-events: none; user-select: none; font-weight: 700; opacity: 0; transition: opacity 0.15s; paint-order: stroke; stroke: #ffffff; stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; }
.bd-region:hover + .bd-label, .bd-region.bd-selected + .bd-label { opacity: 1; }
.bd-tooltip-bg { fill: #1e293b; opacity: 0.95; }
.bd-tooltip-text { fill: white; font-size: 7px; font-weight: 600; pointer-events: none; }
/* Halo difuso (solo para pins manuales sin zona SVG) */
.bd-highlight { opacity: 0.22; pointer-events: none; filter: blur(9px); transition: opacity .25s; }
.bd-highlight-muscle { fill: #f59e0b; }
.bd-highlight-bone   { fill: #0ea5e9; }

/* Highlight preciso de zona muscular/ósea (path SVG del overlay) */
.bd-zone { fill: transparent; pointer-events: none; transition: fill .35s ease, opacity .35s ease; }
.bd-zone-muscle { fill: rgba(245, 158, 11, 0.42); }
.bd-zone-bone   { fill: rgba(14, 165, 233, 0.42); }
/* Evita que el overlay SVG capture eventos de clic */
.bd-zone-overlay { pointer-events: none; overflow: visible; }

.bd-pin { fill: #f59e0b; stroke: #ffffff; stroke-width: 0.15; filter: drop-shadow(0 0.2px 0.5px rgba(0,0,0,0.4)); transition: transform 0.2s ease, fill 0.2s ease; cursor: pointer; }
.bd-pin:hover { transform: scale(1.3); fill: #d97706; }
.bd-pin-bone { fill: #0ea5e9; }
.bd-pin-bone:hover { fill: #0284c7; }
/* font-size NO se pone en CSS — lo controla el atributo SVG font-size="1.4" en JS (unidades de usuario) */
.bd-pin-label { fill: #1e293b; font-weight: 700; paint-order: stroke; stroke: #ffffff; stroke-width: 0.3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.bd-pin-label-antecedente { fill: #7c5cd6; }
.bd-chip-antecedente { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; padding: 1px 6px; border-radius: 10px; font-size: 0.66rem; font-weight: 700; background: #ede9fe; color: #6d28d9; }
.bd-chip-mode-muscle { border-left: 4px solid #f59e0b !important; }
.bd-chip-mode-bone { border-left: 4px solid #0ea5e9 !important; }
.bd-chip strong { color: var(--primary); margin-right: 4px; }
.bd-chip-front { border-left: 3px solid #3b82f6; }
.bd-chip-back { border-left: 3px solid #6366f1; }
.bd-modal { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.4); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.bd-modal.active { display: flex; }
.bd-modal-content { background: white; border-radius: 12px; width: 100%; max-width: 320px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); overflow: hidden; animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes modalPop { from { transform: scale(0.9) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.bd-modal-header { padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; font-weight: 600; color: #1e293b; }
.bd-modal-close { margin-left: auto; background: none; border: none; font-size: 1.5rem; line-height: 1; color: #94a3b8; cursor: pointer; }
.bd-modal-body { padding: 16px; }
.bd-modal-footer { padding: 12px 16px; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 10px; }
.bd-tag-suggestion:hover { background: var(--primary) !important; color: white !important; }
.bd-selected-header { font-size: 0.82rem; margin-bottom: 8px; display: flex; align-items: center; }
.bd-count-badge { background: #e2e8f0; color: var(--text-muted); border-radius: 20px; font-size: 0.7rem; font-weight: 700; padding: 1px 8px; }
.bd-count-badge.bd-count-active { background: #fee2e2; color: #991b1b; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: flex-start; }
.bd-view-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; align-self: center; margin-right: 2px; }
.bd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; line-height: 1.4; }
.bd-chip-front { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.bd-chip-back  { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.bd-chip-remove { background: none; border: none; padding: 0 0 0 2px; cursor: pointer; font-size: 0.9rem; line-height: 1; opacity: 0.55; color: inherit; }
.bd-chip-remove:hover { opacity: 1; }
#bd_pin_obs { resize: none; overflow: hidden; min-height: 38px; line-height: 1.5; transition: height 0.1s ease; }
.clinical-body-zones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.zone-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.zone-badge-front { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.zone-badge-back  { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.zone-badge-bone  { background: #f0fdf4 !important; color: #15803d !important; border: 1px solid #86efac !important; }
.zone-label-title { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); align-self: center; }
.zone-region-name { font-weight: 600; }
.bd-record-viewer { border: 1px dashed #c7d2fe; border-radius: 10px; background: #f8fafc; padding: 12px; }

/* ===== ANIMATION UTILITIES ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50%       { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-in { animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.animate-in-delay-1 { animation-delay: 0.05s; }
.animate-in-delay-2 { animation-delay: 0.10s; }
.animate-in-delay-3 { animation-delay: 0.15s; }
.animate-in-delay-4 { animation-delay: 0.20s; }

/* Stagger children animations */
.stagger-children > * { animation: fadeInUp 0.4s cubic-bezier(0.4,0,0.2,1) both; }
.stagger-children > *:nth-child(1) { animation-delay: 0.00s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.18s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.36s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.42s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.show { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.25); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex !important; }
  .content-area { padding: 20px 16px 40px; }
  body::before { display: none; }
}

@media (max-width: 575px) {
  .stat-value { font-size: 1.5rem; }
  .page-title { font-size: 1.25rem; }
  .content-area { padding: 16px 12px 40px; }
}

/* ===== Center-screen team ALERT overlay (works app-wide) ===== */
.alert-overlay {
  position: fixed; inset: 0; z-index: 20000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.2s ease;
}
.alert-overlay.in { opacity: 1; }
.alert-box {
  width: min(92vw, 460px);
  background: #fff;
  border-radius: 22px;
  padding: 30px 28px 24px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  transform: scale(0.85) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-top: 6px solid #ef4444;
}
.alert-overlay.in .alert-box { transform: scale(1) translateY(0); }
.alert-icon {
  width: 70px; height: 70px; margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff; font-size: 1.9rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(239,68,68,0.45);
  animation: alertPulse 1.4s ease-in-out infinite;
}
@keyframes alertPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(239,68,68,0.45); }
  50%      { box-shadow: 0 8px 24px rgba(239,68,68,0.45), 0 0 0 12px rgba(239,68,68,0.12); }
}
.alert-kicker {
  font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: #ef4444; margin-bottom: 8px;
}
.alert-body {
  font-size: 1.18rem; font-weight: 700; color: #0f172a; line-height: 1.45;
  margin-bottom: 12px; white-space: pre-wrap; word-break: break-word;
}
.alert-from { font-size: 0.84rem; color: #64748b; font-weight: 600; margin-bottom: 20px; }
.alert-ok {
  border: none; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff;
  font-weight: 800; font-size: 0.95rem; padding: 12px 34px; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: transform 0.15s, filter 0.15s;
}
.alert-ok:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ===== Patient detail — Resumen ficha ===== */
.summary-field { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface-2, #f7f9fc); border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); height: 100%; }
.summary-field > i { color: var(--primary); font-size: 1rem; margin-top: 3px; width: 18px; text-align: center; flex-shrink: 0; }
.summary-field .min-w-0 { min-width: 0; }
.sf-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.sf-value { font-weight: 600; color: var(--text); font-size: 0.92rem; }
.summary-notes { background: var(--warning-light, #fffbeb); border: 1px solid #fde68a; border-radius: var(--radius-sm, 10px); padding: 12px 14px; color: var(--text-secondary); font-size: 0.9rem; }
.bono-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: var(--primary-light, #eef2ff); color: var(--primary-dark, #4338ca); font-size: 0.8rem; font-weight: 600; border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }
.bono-chip-warning { background: var(--warning-light, #fffbeb); color: #b45309; border-color: #fcd34d; }

/* ===== Patient detail — Citas pasadas vs futuras ===== */
.appt-group-title { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 12px; display: flex; align-items: center; }
.appt-group-future { color: var(--success, #10b981); }
.appt-group-past { color: var(--text-muted, #64748b); }
.appt-count { margin-left: 8px; font-size: 0.72rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: currentColor; }
.appt-group-future .appt-count { color: #fff; background: var(--success, #10b981); }
.appt-group-past .appt-count { color: #fff; background: var(--text-muted, #94a3b8); }
.appt-table td.appt-accent { padding: 0; width: 6px; }
.appt-row.appt-future td.appt-accent { background: var(--success, #10b981); }
.appt-row.appt-future { background: color-mix(in srgb, var(--success, #10b981) 6%, transparent); }
.appt-row.appt-future:hover { background: color-mix(in srgb, var(--success, #10b981) 12%, transparent) !important; }
.appt-row.appt-past td.appt-accent { background: #d7dde7; }
.appt-row.appt-past { color: var(--text-muted, #64748b); }
.appt-row.appt-past td.fw-semibold { font-weight: 600 !important; opacity: .85; }

/* ===== Historial — vista maestro / detalle ===== */
.hx-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }

/* Lista de consultas (maestro) */
.hx-list { display: flex; flex-direction: column; gap: 8px; max-height: 72vh; overflow-y: auto; padding-right: 4px; }
.hx-list-head { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 2px 4px 4px; position: sticky; top: 0; background: var(--card-bg, #fff); z-index: 1; }
.hx-item { text-align: left; border: 1px solid var(--border); background: var(--surface, #fff); border-radius: var(--radius-sm, 12px); padding: 12px 14px; cursor: pointer; transition: all var(--t, .18s); position: relative; }
.hx-item::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; transition: background var(--t, .18s); }
.hx-item:hover { border-color: var(--primary); background: var(--primary-light, #eef2ff); }
.hx-item.active { border-color: var(--primary); background: var(--primary-light, #eef2ff); box-shadow: 0 4px 14px var(--primary-glow, rgba(99,102,241,.18)); }
.hx-item.active::before { background: var(--primary); }
.hx-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.hx-item-date { font-weight: 600; font-size: 0.72rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.hx-item-date i { color: var(--primary); font-size: 0.72rem; }
.hx-item-ics { display: inline-flex; align-items: center; gap: 6px; }
.hx-ic { color: var(--text-muted); font-size: 0.78rem; }
.hx-item-seg { font-size: 0.66rem; font-weight: 800; background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 7px; }
.hx-item-diag { font-size: 0.98rem; font-weight: 700; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hx-item-emp { margin-top: 6px; font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* Panel de detalle */
.hx-detail { min-width: 0; }
.hx-panel { display: none; }
.hx-panel.active { display: block; animation: hxFade .2s ease; }
@keyframes hxFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hx-panel-inner { border: 1px solid var(--border); border-radius: var(--radius, 14px); padding: 20px 22px; background: var(--surface, #fff); box-shadow: var(--shadow-sm); }
.hx-panel-inner .timeline-header { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.hx-panel-inner .timeline-date { font-size: 1.05rem; font-weight: 800; }

@media (max-width: 991px) {
  .hx-layout { grid-template-columns: 1fr; }
  .hx-list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 6px; }
  .hx-list-head { display: none; }
  .hx-item { min-width: 220px; flex-shrink: 0; }
}

/* ===== Seguimientos — timeline en línea (sin popup) ===== */
.seg-timeline { position: relative; padding-left: 6px; }
.seg-timeline::before { content: ''; position: absolute; left: 12px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--primary, #6366f1), var(--border, #e2e8f0)); border-radius: 2px; }
.seg-card { position: relative; padding-left: 34px; margin-bottom: 14px; }
.seg-card:last-child { margin-bottom: 0; }
.seg-card-dot { position: absolute; left: 6px; top: 16px; width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 3px solid var(--primary, #6366f1); box-shadow: 0 0 0 4px var(--primary-light, #eef2ff); }
.seg-card-box { border: 1px solid var(--border); border-radius: var(--radius, 14px); background: var(--surface, #fff); box-shadow: var(--shadow-xs); overflow: hidden; }
.seg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 16px; background: var(--surface-2, #f7f9fc); border-bottom: 1px solid var(--border); }
.seg-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.seg-card-badge { font-size: 0.74rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5)); border-radius: 8px; padding: 3px 9px; flex-shrink: 0; }
.seg-card-date { font-weight: 700; color: var(--text); font-size: 0.86rem; }
.seg-card-date i { color: var(--primary); }
.seg-card-title { font-weight: 600; color: var(--text-secondary); font-size: 0.88rem; padding-left: 10px; border-left: 2px solid var(--border); }
.seg-card-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.seg-card-content { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.seg-field-label { display: block; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 4px; }
.seg-card-content .clinical-field-content { font-size: 0.95rem; line-height: 1.55; }

/* ===== Barra de guardado flotante =====
   Aparece cuando el botón "Guardar" real del formulario sale de la
   vista, para que siempre esté a mano sin tener que hacer scroll. */
.floating-save-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1030;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .25s ease, transform .3s cubic-bezier(.22,1,.36,1);
}
.floating-save-bar.is-shown { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.floating-save-bar { display: flex; align-items: center; gap: 10px; }
.floating-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--primary-dark, #4f46e5);
  background: #fff;
  border: 1px solid rgba(99,102,241,.25);
  box-shadow: 0 4px 16px rgba(15,23,42,.12);
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease;
}
.floating-back-btn:hover { transform: translateY(-2px); color: var(--primary-dark, #4f46e5); box-shadow: 0 6px 20px rgba(15,23,42,.16); }
.floating-back-btn:active { transform: translateY(0) scale(.97); }
.floating-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
  box-shadow: var(--shadow-primary, 0 4px 20px rgba(99,102,241,.4)), 0 2px 8px rgba(15,23,42,.08);
  cursor: pointer;
  opacity: .93;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, filter .15s, opacity .18s;
}
.floating-save-btn:hover { opacity: 1; transform: translateY(-2px); filter: brightness(1.05); }
.floating-save-btn:active { transform: translateY(0) scale(.97); }
.floating-save-btn:disabled, .floating-save-btn.is-saving { opacity: .7; cursor: default; transform: none; }
@media (max-width: 576px) {
  .floating-save-bar { bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; transform: translateY(14px); }
  .floating-save-bar.is-shown { transform: translateY(0); }
  .floating-save-btn { padding: 12px 22px; font-size: 0.86rem; }
  .floating-back-btn { padding: 12px 16px; font-size: 0.86rem; }
  .floating-back-btn span { display: none; }   /* en móvil solo la flecha */
}
@media (prefers-reduced-motion: reduce) {
  .floating-save-bar, .floating-save-btn, .floating-back-btn { transition: opacity .15s linear !important; transform: none !important; }
}

/* ===== Anamnesis (Primera Visita) — campos, usados tanto en la página
   completa como en el modal de autoguardado ===== */
.fv-section {
  border-left: 4px solid #6366f1;
  border-radius: 0 .5rem .5rem 0;
  background: #fafafa;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.fv-section .fv-label {
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6366f1;
  margin-bottom: .35rem;
}
.fv-section textarea {
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: .375rem;
  resize: vertical;
  min-height: 90px;
  font-size: .9rem;
  width: 100%;
  padding: .5rem .75rem;
  font-family: inherit;
}
.fv-section textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* Versión compacta dentro del modal de Anamnesis, para minimizar el scroll */
#anamnesisModal .fv-section {
  padding: .55rem .8rem;
  margin-bottom: 0;
}
#anamnesisModal .fv-label {
  font-size: .68rem;
  margin-bottom: .2rem;
}
#anamnesisModal .fv-section textarea {
  min-height: 52px;
  padding: .35rem .55rem;
  font-size: .85rem;
}

/* ===== FIRMA DIGITALIZADA (empleado) ===== */
.sig-method-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sig-method-title i { color: var(--primary); }

.sig-pad {
  position: relative;
  width: 100%;
  height: 170px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 100%);
  background-color: var(--bg-2);
  cursor: crosshair;
  touch-action: none;
  transition: border-color var(--t), background-color var(--t);
}
.sig-pad:hover { border-color: var(--primary); }
.sig-pad::after {
  content: '';
  position: absolute;
  left: 8%; right: 8%; bottom: 30px;
  border-bottom: 1.5px dashed var(--border);
  pointer-events: none;
}
.sig-pad-hint {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  pointer-events: none;
  letter-spacing: .03em;
}

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

.sig-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 170px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  cursor: pointer;
  text-align: center;
  padding: 16px;
  transition: border-color var(--t), background-color var(--t);
}
.sig-upload-zone:hover { border-color: var(--primary); }
.sig-upload-zone.has-file { border-style: solid; border-color: var(--primary); }
.sig-upload-zone i { font-size: 1.6rem; color: var(--primary); }
.sig-upload-zone .sig-upload-text { font-size: .82rem; color: var(--text-muted); }
.sig-upload-zone .sig-upload-filename { font-size: .82rem; font-weight: 600; color: var(--text); word-break: break-all; }
.sig-upload-zone input[type="file"] { display: none; }

.sig-divider-v {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 0 auto;
}
.sig-divider-h {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 18px 0;
}
.sig-divider-h::before, .sig-divider-h::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sig-preview-box {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  flex-wrap: wrap;
}
.sig-preview-box img {
  max-width: 260px;
  max-height: 90px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.sig-preview-meta { flex: 1; min-width: 180px; }
.sig-preview-meta .sig-status {
  font-size: .78rem;
  font-weight: 700;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

/* ── "settings-section" cards — usadas en Ajustes de clínica y en el
   panel de superadmin (mismo componente visual, dos secciones) ──────────── */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.settings-section-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: #fafbfe;
}
.settings-section-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; flex-shrink: 0;
}
.settings-section-title { font-weight: 800; font-size: 1rem; color: var(--text); }
.settings-section-sub   { font-size: .8rem; color: var(--text-muted); margin-top: 1px; }
.settings-section-body  { padding: 22px; }
.save-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: #fafbfe;
}
