/* ==========================================================================
   Snelens — SISTEMA DE GESTIÓN ÓPTICA
   Licenciado bajo creación de KOERUS
   ========================================================================== */
.lensora-logo-light { display: inline-block; }
.lensora-logo-dark { display: none; }
[data-theme="dark"] .lensora-logo-light { display: none !important; }
[data-theme="dark"] .lensora-logo-dark { display: inline-block !important; }

:root {
  --app-base-font-size: 13.5px;

  /* Neutros Sólidos */
  --bg-app: #f9fafb;
  --bg-surface: #ffffff;
  --bg-subtle: #f3f4f6;
  --bg-sidebar: #090a0f;
  --bg-sidebar-hover: #12151e;
  --bg-sidebar-active: #171b26;

  /* Textos */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-on-dark: #f8fafc;
  --text-muted-dark: #64748b;

  /* Acento Institucional Snelens (Petróleo clínico) */
  --brand-primary: #0f172a;
  --brand-accent: #245a67;
  --brand-accent-hover: #1b4651;
  --brand-accent-subtle: rgba(36, 90, 103, 0.12);
  --brand-button-text: #ffffff;

  --clinical-od: #1d4ed8;
  --clinical-od-bg: #eff6ff;
  --clinical-oi: #4f46e5;
  --clinical-oi-bg: #eef2ff;

  --status-success: #166534;
  --status-success-bg: #f0fdf4;
  --status-warning: #92400e;
  --status-warning-bg: #fffbeb;
  --status-danger: #991b1b;
  --status-danger-bg: #fef2f2;

  /* Líneas Nítidas de 1px */
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-dark: rgba(255, 255, 255, 0.08);

  /* Radios Contenidos */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-pill: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-overlay: 0 16px 36px -8px rgba(0, 0, 0, 0.12);

  --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  --font-body: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;
}

/* ==========================================================================
   TEMA OSCURO (DARK MODE - LINEAR / RAYCAST PALETTE)
   ========================================================================== */
[data-theme="dark"] {
  --bg-app: #080c14;
  --bg-surface: #0f172a;
  --bg-subtle: #192338;
  --bg-sidebar: #05080f;
  --bg-sidebar-hover: #0d1424;
  --bg-sidebar-active: #141f36;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-on-dark: #f8fafc;
  --text-muted-dark: #475569;

  --brand-primary: #f8fafc;
  --brand-accent: #3b8c9f;
  --brand-accent-hover: #4ca3b7;
  --brand-accent-subtle: rgba(59, 140, 159, 0.16);
  --brand-button-text: #ffffff;

  --clinical-od: #60a5fa;
  --clinical-od-bg: rgba(59, 130, 246, 0.14);
  --clinical-oi: #818cf8;
  --clinical-oi-bg: rgba(99, 102, 241, 0.14);

  --status-success: #34d399;
  --status-success-bg: rgba(16, 185, 129, 0.14);
  --status-warning: #fbbf24;
  --status-warning-bg: rgba(245, 158, 11, 0.14);
  --status-danger: #f87171;
  --status-danger-bg: rgba(239, 68, 68, 0.14);

  --border: #1e293b;
  --border-subtle: #192338;
  --border-dark: rgba(255, 255, 255, 0.08);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-overlay: 0 16px 36px -8px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   ESCALAS TIPOGRÁFICAS (FONT SIZE HANDLER)
   ========================================================================== */
html[data-font-size="normal"],
[data-font-size="normal"] {
  --app-base-font-size: 14px;
  font-size: 14px;
  zoom: 1;
}
html[data-font-size="medium"],
[data-font-size="medium"] {
  --app-base-font-size: 16px;
  font-size: 15.5px;
  zoom: 1.08;
}
html[data-font-size="large"],
[data-font-size="large"] {
  --app-base-font-size: 18px;
  font-size: 17.5px;
  zoom: 1.18;
}

[data-font-size="medium"] body {
  font-size: 15.5px;
}
[data-font-size="large"] body {
  font-size: 17.5px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: var(--app-base-font-size, 13.5px);
  transition: background-color 0.22s ease, color 0.22s ease, font-size 0.18s ease;
}

h1, h2, h3, h4, h5, h6, .card-title, .topbar-title, .sidebar-brand-link {
  font-family: var(--font-sans);
  letter-spacing: -0.018em;
}

.tabular-nums, .stat-value, .metric-value, .kpi-number, code, pre, .rx-cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   LAYOUT SHELL (ESPACIO Y ESTRUCTURA)
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid var(--border-dark);
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-dark);
}

.brand-badge {
  width: 32px;
  height: 32px;
  background: #1e2536;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.brand-info h1 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-info span {
  font-size: 10px;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-category {
  font-size: 10px;
  text-transform: uppercase;
  color: #4b5563;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 16px 12px 6px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 120ms ease;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-link.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

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

.tenant-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #11141d;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-xs);
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.tenant-pill strong {
  color: #fff;
  letter-spacing: 0.04em;
}

.clinic-identity {
  font-size: 11.5px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   WORKSPACE & TOPBAR (LIMPIO, MINIMALISTA)
   ========================================================================== */

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

.topbar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-switcher-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.role-switcher-box label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.role-switcher-box select {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
}

.user-profile-info .u-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
}

.user-profile-info .u-role {
  font-size: 10.5px;
  color: var(--text-tertiary);
}

.content-body {
  padding: 36px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.content-body.module-exit {
  opacity: 0;
  transform: translateY(-8px) scale(0.997);
  transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}

/* Content body motion enabled */

/* ==========================================================================
   CARDS & SUPERFICIES (BORDES NÍTIDOS 1PX, ESPACIO NEGATIVO)
   ========================================================================== */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Fila de Métricas (Contraste drástico y limpio) */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.metric-number {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   BOTONES (DIRECTOS, ESTILO LINEAR)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-primary:hover {
  background: #1e293b;
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #d1d5db;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-success {
  background: #15803d;
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

/* ==========================================================================
   FORMULARIOS (LIMPIOS, SIN DISTRACCIONES)
   ========================================================================== */

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

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 120ms ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px var(--brand-accent-subtle);
}

/* ==========================================================================
   TABLAS Y MATRIZ OD/OI (ALTA DENSIDAD, NÚMEROS MONOSPACE)
   ========================================================================== */

.rx-matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12.5px;
}

.rx-matrix-table th {
  padding: 10px 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: transparent;
}

.rx-matrix-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.rx-matrix-table tr:hover td {
  background: var(--bg-subtle);
}

.rx-eye-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.rx-eye-od { background: var(--clinical-od-bg); color: var(--clinical-od); }
.rx-eye-oi { background: var(--clinical-oi-bg); color: var(--clinical-oi); }

.rx-input {
  width: 85px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  padding: 6px;
}

/* Alerta Médica Nítida */
.clinical-alert-banner {
  background: var(--status-danger-bg);
  border: 1px solid #fecaca;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--status-danger);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
}

.badge-emerald { background: var(--status-success-bg); color: var(--status-success); }
.badge-blue    { background: var(--brand-accent-subtle); color: var(--brand-accent); }
.badge-amber   { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-purple  { background: #eef2ff; color: #4338ca; }
.badge-rose    { background: var(--status-danger-bg); color: var(--status-danger); }
.badge-slate   { background: var(--bg-subtle); color: var(--text-secondary); }

/* ==========================================================================
   KANBAN WORKSHOP (LINEAL Y ELEGANTE)
   ========================================================================== */

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  flex: 0 0 270px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.kanban-column-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kanban-cards-container {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.kanban-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: border-color 100ms ease;
}

.kanban-card:hover {
  border-color: #9ca3af;
}

.signature-box {
  border: 1px dashed #d1d5db;
  border-radius: var(--radius-sm);
  background: #fafafa;
  width: 100%;
  height: 120px;
  cursor: crosshair;
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand-info, .menu-category, .nav-link span, .sidebar-footer { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .content-body { padding: 20px 16px; }
}

/* ==========================================================================
   INTERACTIVE DASHBOARD ANIMATIONS & MICRO-INTERACTIONS
   ========================================================================== */

/* Píldoras de filtro instantáneo */
.filter-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-pill {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-pill:hover {
  color: var(--text-primary);
}

.filter-pill.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Barra de progreso de laboratorio animada */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  background-size: 20px 20px;
}

/* Pipeline visual en miniatura */
.pipeline-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   SETTINGS MENU & THEME / FONT SIZE CONTROLS
   ========================================================================== */

/* Botón rápido de Tema y Ajustes en el Topbar */
.topbar-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.topbar-tool-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.topbar-tool-btn svg {
  width: 16px;
  height: 16px;
}

/* Modal / Cajón Flotante de Ajustes */
.settings-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);


  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.settings-modal-card {
  width: 92%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  padding: 24px;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.settings-modal-backdrop.open .settings-modal-card {
  transform: scale(1) translateY(0);
}

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

.settings-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
  padding-bottom: 0;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Selector Segmentado de Tema */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 4px;
}

.segmented-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.segmented-btn:hover {
  color: var(--text-primary);
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Selector de Tamaño de Fuentes */
.font-scale-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 4px;
}

.font-scale-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.font-scale-btn .f-icon {
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}

.font-scale-btn .f-label {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.85;
}

.font-scale-btn:hover {
  color: var(--text-primary);
}

.font-scale-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Previsualización en vivo del tamaño */
.font-preview-box {
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: var(--app-base-font-size, 13.5px);
  color: var(--text-primary);
  line-height: 1.4;
  transition: font-size 0.15s ease;
}

/* Switch de Animación entre Módulos */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--brand-accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* ==========================================================================
   PALETAS DE COLOR DE MARCA (SETTINGS MODAL)
   ========================================================================== */
.brand-color-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}

.swatch-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2.5px var(--c), 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: scale(1.08);
}

.swatch-btn.active::after {
  content: "✓";
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ==========================================================================
   MODAL DE INFORME CLÍNICO DE PROYECCIÓN DE MIOPÍA (ESTILO PROFESIONAL SINTETIZADO)
   ========================================================================== */
.report-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);


  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}

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

.report-modal-container {
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  background: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-modal-backdrop.open .report-modal-container {
  transform: scale(1) translateY(0);
}

.report-modal-toolbar {
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.report-modal-body {
  padding: 24px;
  overflow-y: auto;
  background: #f1f5f9;
}

/* Hoja Clínica del Informe en Formato A4 Ejecutivo */
.myopia-report-sheet {
  background: #ffffff;
  color: #0f172a;
  max-width: 800px;
  margin: 0 auto;
  padding: 36px 42px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  position: relative;
  font-family: var(--font-sans);
  box-sizing: border-box;
}

.myopia-report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2.5px solid var(--brand-accent);
  margin-bottom: 20px;
  gap: 16px;
}

.myopia-report-clinic-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.myopia-report-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.myopia-report-clinic-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--brand-accent);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.myopia-report-clinic-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
  margin-top: 3px;
}

.myopia-report-meta-box {
  text-align: right;
  font-size: 11.5px;
  color: #475569;
}

.myopia-report-meta-box strong {
  color: #0f172a;
}

/* Ficha del Paciente Sintetizada */
.myopia-patient-summary-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 12px;
}

.myopia-patient-summary-grid .item strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 3px;
}

.myopia-patient-summary-grid .item span {
  font-weight: 700;
  color: #0f172a;
}

/* Métricas Clave Sintetizadas a los 18 años */
.myopia-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.myopia-kpi-card {
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.myopia-kpi-card.unmanaged {
  background: #fff5f5;
  border-color: #fecaca;
}

.myopia-kpi-card.managed {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.myopia-kpi-card.benefit {
  background: var(--brand-accent-subtle);
  border-color: var(--brand-accent);
}

.myopia-kpi-card .kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.myopia-kpi-card .kpi-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.1;
  margin-bottom: 4px;
}

.myopia-kpi-card.unmanaged .kpi-label { color: #991b1b; }
.myopia-kpi-card.unmanaged .kpi-value { color: #dc2626; }

.myopia-kpi-card.managed .kpi-label { color: #166534; }
.myopia-kpi-card.managed .kpi-value { color: #059669; }

.myopia-kpi-card.benefit .kpi-label { color: var(--brand-accent); }
.myopia-kpi-card.benefit .kpi-value { color: var(--brand-accent); }

.myopia-kpi-card .kpi-desc {
  font-size: 10.5px;
  color: #64748b;
}

/* Gráfico Sintetizado en el Reporte */
.myopia-report-chart-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px 10px 18px;
  margin-bottom: 20px;
}

.myopia-report-chart-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Tabla Resumen de Hitos Médicos */
.myopia-milestone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-bottom: 20px;
}

.myopia-milestone-table th {
  background: #f1f5f9;
  color: #334155;
  padding: 8px 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.myopia-milestone-table td {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Plan de Acción y Firma */
.myopia-plan-box {
  background: #f8fafc;
  border-left: 3.5px solid var(--brand-accent);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 24px;
  font-size: 11.5px;
  color: #334155;
  line-height: 1.5;
}

.myopia-plan-box strong {
  color: #0f172a;
}

.myopia-signatures-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed #cbd5e1;
}

.myopia-signature-block {
  text-align: center;
  width: 240px;
}

.myopia-signature-line {
  border-top: 1px solid #0f172a;
  margin-bottom: 6px;
}

/* ==========================================================================
   REGLAS EXCLUSIVAS DE IMPRESIÓN (@media print)
   Garantiza que el reporte salga como un documento A4 limpio, sin interfaz
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }

  /* Ocultar toda la interfaz web */
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11.5pt !important;
  }

  .sidebar,
  .topbar,
  .content-body > *:not(#myopiaReportModal),
  .report-modal-toolbar,
  .settings-modal-backdrop,
  #settingsModal,
  .no-print {
    display: none !important;
  }

  .report-modal-backdrop {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    opacity: 1 !important;
  }

  .report-modal-container {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
    background: #ffffff !important;
  }

  .report-modal-body {
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .myopia-report-sheet {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    page-break-after: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .myopia-report-header {
    border-bottom: 2.5pt solid var(--brand-accent) !important;
  }

  .myopia-report-logo-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .myopia-kpi-card {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}




/* Shared operational surfaces (Lintel 120fps High-Craft Edition) */
:root {
  --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;
  --app-base-font-size: 14px;
  --bg-app: #f1f3f7;
  --bg-surface: #ffffff;
  --bg-subtle: #e8ecf2;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: rgba(18, 23, 34, 0.045);
  --bg-sidebar-active: #121722;
  --text-primary: #121722;
  --text-secondary: #5f6878;
  --text-tertiary: #687284;
  --brand-accent: #245a67;
  --brand-accent-subtle: rgba(36, 90, 103, 0.12);
  --border: rgba(18, 23, 34, 0.09);
  --border-subtle: rgba(18, 23, 34, 0.06);
  --border-dark: rgba(18, 23, 34, 0.15);
  --rim: rgba(18, 23, 34, 0.08);
  --radius-md: 18px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 14px 30px -20px rgba(20, 30, 60, 0.14), 0 1px 3px rgba(18, 23, 34, 0.04);
  --shadow-sm: 0 1px 2px rgba(18, 23, 34, 0.05);
  --shadow-hover: 0 18px 36px -18px rgba(20, 30, 60, 0.20), 0 2px 6px rgba(20, 30, 60, 0.06);
  --shadow-subtle: 0 4px 12px -6px rgba(20, 30, 60, 0.08);
  --bg-card: var(--bg-surface);
  --border-hairline: var(--border);
  --rose: #d93f45;
  --emerald: #138a63;
  --amber: #ff8a3d;
  --blue: var(--brand-accent);
  --purple: #65587b;
  --indigo: #2f5bea;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg-app: #0e1117;
  --bg-surface: #171b24;
  --bg-subtle: #1f2532;
  --bg-sidebar: #131720;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: #eef1f6;
  --text-primary: #eef1f6;
  --text-secondary: #a0a8b6;
  --text-tertiary: #8b93a2;
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-dark: rgba(255, 255, 255, 0.15);
  --rim: rgba(255, 255, 255, 0.08);
  --brand-accent-subtle: rgba(113, 146, 255, 0.16);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 16px 34px -20px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 20px 42px -18px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.11);
  color-scheme: dark;
}
[data-font-size="normal"] { --app-base-font-size: 14px; }
[data-font-size="medium"] { --app-base-font-size: 16px; }
[data-font-size="large"] { --app-base-font-size: 18px; }
body { background: var(--bg-app); transition: background-color 200ms ease, color 200ms ease; }
a { color: var(--brand-accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input, textarea { caret-color: var(--brand-accent); }
::selection { background: var(--brand-accent); color: #ffffff; }
:focus-visible { outline: 2px solid var(--brand-accent) !important; outline-offset: 3px; }
button:disabled, .btn:disabled, [aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 10000; padding: 12px 20px; background: var(--bg-surface); border-radius: 12px; }
.skip-link:focus { top: 12px; }
.sidebar { width: 240px; color: var(--text-primary); height: 100dvh; background: var(--bg-sidebar); border-right: 1px solid var(--border); }
.sidebar-header { min-height: 76px; padding: 20px; gap: 10px; }
.brand-info h1 { color: var(--text-primary); letter-spacing: .04em; }
.brand-info span { color: var(--text-secondary); text-transform: none; letter-spacing: 0; font-size: 11px; }
.brand-badge { border: none; border-radius: 10px; }
.sidebar-menu { padding: 10px 12px 20px; gap: 3px; }
.menu-category { color: var(--text-secondary); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 18px 12px 6px; opacity: .75; }
.nav-link { color: var(--text-secondary); min-height: 39px; padding: 8px 13px; font-size: 13.5px; font-weight: 600; border-radius: 999px; transition: background-color 140ms ease, color 140ms ease; }
.nav-link:hover { color: var(--text-primary); background: var(--bg-sidebar-hover); }
.nav-link.active { background: var(--bg-sidebar-active); color: #ffffff !important; box-shadow: 0 4px 12px -4px rgba(18, 23, 34, 0.25); }
[data-theme="dark"] .nav-link.active { color: #121722 !important; }
.nav-icon { flex-shrink: 0; opacity: 1; }
.sidebar-footer { padding: 16px 20px; }
.tenant-pill { background: transparent; color: var(--text-secondary); border: none; padding: 0; }
.tenant-pill strong, .clinic-identity { color: var(--text-primary); }
.clinic-identity { white-space: normal; }
.topbar { min-height: 68px; height: auto; padding: 14px 32px; gap: 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.topbar-title { min-width: 0; }
.topbar-title h2 { font-size: 16.5px; font-weight: 700; line-height: 1.35; letter-spacing: -.015em; }
.topbar-actions { gap: 12px; flex-shrink: 0; }
.topbar-tool-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--bg-surface); border: 1px solid var(--border); transition: transform 150ms cubic-bezier(.22,1,.36,1), background-color 140ms ease; }
.topbar-tool-btn:hover { background: var(--bg-subtle); transform: translate3d(0, -1px, 0); }
.logout-form { margin: 0; }
.content-body { padding: 32px; max-width: 1480px; overflow-wrap: anywhere; position: relative; }
.card { background: var(--bg-surface); border: 1px solid var(--rim); box-shadow: var(--shadow-card); border-radius: 18px; padding: 24px; min-width: 0; position: relative; overflow: hidden; }
.card-header { gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card .card { border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: none; padding: 16px; background: var(--bg-subtle); }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-heading h1 { font-size: clamp(23px, 2.1vw, 29px); line-height: 1.18; letter-spacing: -.025em; font-weight: 800; margin-bottom: 6px; }
.page-heading p { color: var(--text-secondary); font-weight: 500; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { min-height: 38px; padding: 0 17px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); transition: transform 140ms cubic-bezier(.22,1,.36,1), background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.btn-primary { background: var(--brand-accent); border-color: var(--brand-accent); color: white; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-dark); }
.btn-outline:hover { background: var(--bg-subtle); }
.btn-sm { min-height: 32px; padding: 0 13px; font-size: 12px; }
.btn:active { transform: scale(0.98) !important; }
.form-label { color: var(--text-primary); font-size: 12.5px; font-weight: 600; }
.form-control { min-height: 40px; font-size: 14px; border: 1px solid var(--border-dark); border-radius: 10px; background: var(--bg-surface); transition: border-color 140ms ease, box-shadow 140ms ease; }
.form-control::placeholder { color: var(--text-secondary); opacity: .8; }
.form-control:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px var(--brand-accent-subtle); outline: none; }
.form-group { margin-bottom: 20px; }
textarea.form-control { resize: vertical; }
.field-hint { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-accent); width: 16px; height: 16px; cursor: pointer; }
.table-scroll { overflow-x: auto; max-width: 100%; border-radius: 12px; }
.table-scroll:focus { outline-offset: 1px; }
.rx-matrix-table { margin-bottom: 0; min-width: 580px; border-collapse: separate; border-spacing: 0; }
.rx-matrix-table th { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--text-secondary); background: var(--bg-subtle); padding: 11px 14px; }
.rx-matrix-table td { font-size: 13px; padding: 12px 14px; transition: background-color 120ms ease; }
.rx-matrix-table tbody tr:hover td { background: rgba(36, 90, 103, 0.04); }
.rx-input { width: 82px; }
.rx-eye-oi { color: #514b72; background: #efedf5; }
.badge-indigo, .badge-purple { color: #514b72; background: #efedf5; }
.badge { line-height: 1.45; font-size: 11px; border-radius: 999px; font-weight: 700; padding: 3px 10px; }
.metrics-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; border: none; padding-block: 4px; margin-bottom: 26px; }
.metric-tile, .metric-tile-interactive { padding: 18px 20px; background: var(--bg-surface); border: 1px solid var(--rim); border-radius: 18px; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.metric-tile:first-child { padding-left: 20px; }
.metric-tile:last-child { border-right: 1px solid var(--rim); }
.metric-label { text-transform: none; letter-spacing: -.005em; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; }
.metric-number { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.dashboard-grid > .card { margin-bottom: 0; }
.dashboard-section { margin-bottom: 22px; }
.chart-container { position: relative; height: 250px; margin-top: 16px; }
.section-description { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; max-width: 70ch; }
.stage-list { list-style: none; }
.stage-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 11px 0; border-bottom: 1px solid var(--border-subtle); }
.stage-list strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.empty-state { padding: 28px 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; border-bottom: 1px solid var(--border-subtle); text-decoration: none; transition: background-color 140ms ease; }
.order-row:hover { background: var(--bg-subtle); }
.order-row strong { display: block; color: var(--text-primary); font-weight: 700; }
.order-row small { color: var(--text-secondary); }
.filter-tabs { flex-wrap: wrap; background: rgba(18, 23, 34, 0.05); padding: 4px; border-radius: 999px; gap: 4px; }
.filter-pill { min-height: 34px; font-family: inherit; border-radius: 999px; font-weight: 600; transition: background-color 140ms ease, box-shadow 140ms ease; }
.filter-pill.active { background: var(--bg-surface); box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.kanban-board { max-width: 100%; align-items: stretch; gap: 14px; }
.kanban-column { flex-basis: 280px; padding: 14px; border-radius: 18px; background: var(--bg-subtle); border: 1px solid var(--rim); }
.kanban-column-title { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 700; }
.kanban-card { background: var(--bg-surface); border-radius: 14px; border: 1px solid var(--rim); box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: .65; }
.kanban-card[aria-busy="true"] { opacity: .65; cursor: wait; }
.kanban-empty { color: var(--text-secondary); font-size: 12px; padding: 20px 4px; }
.kanban-cards-container:has(.kanban-card) .kanban-empty { display: none; }
.kanban-cards-container.is-drag-over { outline: 2px dashed var(--brand-accent); outline-offset: 3px; }
.kanban-status-select { margin-top: 12px; min-height: 36px; width: 100%; font-size: 12px; border-radius: 10px; }
.notice { border: 1px solid var(--border); background: var(--bg-surface); padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.notice-error { color: var(--status-danger); background: var(--status-danger-bg); }
.notice-success { color: var(--status-success); background: var(--status-success-bg); }
.settings-modal-backdrop, .report-modal-backdrop { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); visibility: hidden; }
.settings-modal-backdrop.open, .report-modal-backdrop.open { visibility: visible; }
.settings-modal-card { max-height: calc(100dvh - 40px); overflow-y: auto; border-radius: 20px; box-shadow: var(--shadow-hover); }
.settings-section-label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 700; }
.swatch-btn { border-radius: 8px; transition: transform 150ms cubic-bezier(.22,1,.36,1); }
.swatch-btn:hover { transform: scale(1.08); }
.swatch-btn.active { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.swatch-btn.active::after { content: none; }
.signature-box { background: #fff; touch-action: none; }
.myopia-plan-box { border-left-width: 2px; }
.progress-bar-fill { background-image: none; transform-origin: left; transition: width 450ms cubic-bezier(.16,1,.3,1); }

.mobile-menu-toggle, .navigation-backdrop { display: none; }
.error-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.error-panel { max-width: 640px; }
.error-panel h1 { font-size: 26px; margin-bottom: 16px; }
.error-panel p { margin-bottom: 20px; color: var(--text-secondary); }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px; background: #f1f4f4; color-scheme: light; }
.login-layout { display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 1040px); background: #fff; border: 1px solid #d8e0e2; border-radius: 12px; overflow: hidden; }
.login-intro { position: relative; min-height: 620px; overflow: hidden; background: #e5f1f5; color: #234751; }
.login-artwork { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.login-brand { position: absolute; top: 32px; left: 32px; display: flex; align-items: center; gap: 12px; font-size: 16px; letter-spacing: .06em; }
.login-form-panel { padding: 56px 48px; align-self: center; min-width: 0; }
.login-form-panel h1 { font-size: 28px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; margin-bottom: 10px; }
.login-description { color: #53636b; margin-bottom: 32px; }
.password-field { position: relative; }
.password-field input { padding-right: 80px; }
.password-field button { position: absolute; right: 8px; top: 4px; height: 32px; border: none; color: #245a67; background: transparent; padding: 0 8px; font-size: 12px; cursor: pointer; }
.login-submit { width: 100%; margin-top: 8px; min-height: 42px; }
.login-help { font-size: 12px; color: #53636b; margin-top: 28px; line-height: 1.7; }
@media (max-width: 1150px) {
  .content-body { padding: 24px; }
  .grid-12 > [style*="grid-column"] { grid-column: span 12 !important; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding-inline: 24px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); visibility: hidden; z-index: 100; transition: transform 180ms ease; }
  .brand-info, .menu-category, .nav-link span, .sidebar-footer { display: block; }
  .mobile-menu-toggle { display: inline-flex; flex-shrink: 0; }
  .sidebar-open .sidebar { transform: none; visibility: visible; }
  .sidebar-open .navigation-backdrop { display: block; position: fixed; inset: 0; background: rgb(15 30 36 / .35); border: none; z-index: 90; }
  .topbar-title { flex: 1; }
  .topbar { gap: 12px; padding: 12px 16px; }
  .topbar-actions { gap: 8px; }
  .content-body { padding: 24px 16px; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0,1fr); }
  .content-body [style*="grid-template-columns"]:not(.myopia-patient-summary-grid) { grid-template-columns: minmax(0,1fr) !important; }
  .content-body .grid-12 { grid-template-columns: minmax(0,1fr); }
  .grid-12 > [style*="grid-column"] { grid-column: auto !important; }
  .card { padding: 20px; }
  .login-layout { grid-template-columns: .9fr 1fr; }
  .login-form-panel { padding: 40px 32px; }
}
@media (max-width: 600px) {
  .user-profile-info { display: none !important; }
  .topbar-title h2 { font-size: 14px; }
  .topbar-actions { gap: 6px; }
  #btnQuickSettings { display: none; }
  .topbar-tool-btn { width: 44px; height: 44px; }
  .btn, .form-control, .kanban-status-select { min-height: 44px; }
  .form-control { font-size: 16px; }
  .page-heading h1 { font-size: 22px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .card { padding: 16px; }
  .card-title { font-size: 14px; }
  .content-body [style*="display:flex"], .content-body [style*="display: flex"] { flex-wrap: wrap; }
  .btn { white-space: normal; text-align: center; }
  .myopia-patient-summary-grid, .myopia-kpi-grid { grid-template-columns: minmax(0,1fr); }
  .myopia-report-sheet { padding: 20px; }
  .myopia-report-header, .myopia-signatures-row { flex-wrap: wrap; }
  .report-modal-body { padding: 12px; }
  .report-modal-toolbar { padding: 12px; flex-wrap: wrap; }
  .login-page { padding: 20px 16px; }
  .login-layout { display: block; }
  .login-intro { min-height: 0; height: 208px; }
  .login-artwork { object-position: 50% 30%; }
  .login-brand { top: 16px; left: 20px; gap: 10px; padding: 8px 10px; border-radius: 6px; background: #f5fafc; font-size: 15px; }
  .login-form-panel { padding: 32px 24px; }
}

@media print {
  .app-layout, .main-wrapper, .content-body { display: block !important; padding: 0 !important; margin: 0 !important; width: 100% !important; }
  .sidebar, .topbar, .skip-link, .navigation-backdrop { display: none !important; }
  .report-modal-backdrop { visibility: visible !important; }
  .myopia-plan-box { border-left-width: 1px; }
}
.btn-primary, .brand-badge { color: var(--brand-button-text, #fff); }
[data-theme="dark"] .btn-outline, [data-theme="dark"] .filter-pill.active, [data-theme="dark"] .kanban-card { background: var(--bg-surface); }
[data-theme="dark"] .badge-blue { color: #acd7e3; }
[data-theme="dark"] .badge-purple, [data-theme="dark"] .badge-indigo { background: #343342; color: #c7c0e2; }
:root { --shadow-elevated: 0 12px 32px rgb(20 40 48 / .15); --brand-primary-border: var(--border); --brand-button-text: #fff; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; padding-block: 8px; border: none; }
.metric-card { min-width: 0; padding: 18px 20px; background: var(--bg-surface); border: 1px solid var(--rim); border-radius: 18px; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.metric-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.command-banner { background: var(--bg-subtle); padding: 16px; border-radius: 14px; }
.hover-underline:hover { text-decoration: underline !important; }
[id^="modal"] { padding: 20px; overflow-y: auto; }
[id^="modal"] > div { max-height: calc(100dvh - 40px); overflow-y: auto; margin: auto; }
@media(max-width:600px) {
  .metrics-grid { gap: 12px; }
  .metric-value { font-size: 24px; }
  [style*="grid-column: span 3"] { grid-column: auto !important; }
  [style*="grid-column: span 2"] { grid-column: auto !important; }
}
.rx-matrix-table th, .rx-matrix-table td { overflow-wrap: normal; word-break: normal; }
.rx-matrix-table th { min-width: 86px; }
.rx-matrix-table td { max-width: 360px; }
.rx-matrix-table.table-empty { min-width: 0; width: 100%; }
.table-empty thead { display: none; }
.table-empty td { max-width: none; }
.content-body :where([style*="color:#10b981"],[style*="color: #10b981"]) { color: var(--status-success) !important; }

/* Motion: 120fps Hardware-Accelerated Transitions */
@keyframes opticFadeInUp { from {opacity:0;transform:translate3d(0, 12px, 0);} to {opacity:1;transform:translate3d(0, 0, 0);} }
.animate-fade-in-up {animation:opticFadeInUp 340ms cubic-bezier(.22,1,.36,1) both;}
.stagger-1 {animation-delay:30ms;}
.stagger-2 {animation-delay:60ms;}
.stagger-3 {animation-delay:90ms;}
.stagger-4 {animation-delay:120ms;}
.card, .metric-tile, .metric-card, .kanban-card {transition:transform 200ms cubic-bezier(.22,1,.36,1),box-shadow 200ms cubic-bezier(.22,1,.36,1),border-color 150ms ease;}
.btn, .topbar-tool-btn {transition:transform 140ms cubic-bezier(.22,1,.36,1),background-color 140ms ease,border-color 140ms ease,box-shadow 140ms ease;}
@media (hover:hover) {
  .content-body .card:hover {transform:translate3d(0, -2px, 0);box-shadow:var(--shadow-hover);}
  :is(.metric-tile,.metric-card):hover {transform:translate3d(0, -2px, 0);box-shadow:var(--shadow-hover);}
  .kanban-card:hover {transform:translate3d(0, -2px, 0);box-shadow:var(--shadow-hover);}
  :is(.btn,.topbar-tool-btn):hover {transform:translate3d(0, -1px, 0);}
}
.btn:active {transform:scale(0.98);}
.settings-modal-backdrop, .report-modal-backdrop {transition:opacity 180ms ease,visibility 0s linear 180ms;}
.settings-modal-backdrop.open, .report-modal-backdrop.open {transition-delay:0s;}
@media print { * {animation:none!important;transition:none!important;} .card {transform:none!important;} }
/* Clinical document capture uses the existing type, color and motion system. */
.signature-settings { max-width: 760px; }
.signature-settings p { max-width: 65ch; }
.signature-preview { display: grid; place-items: center; min-height: 160px; padding: 24px; margin: 24px 0; background: #fff; border: 1px solid var(--border-color, #d7dddc); border-radius: 16px; color: #566562; }
.signature-preview img { display: block; max-width: 100%; max-height: 180px; object-fit: contain; }
.signature-remove { margin-top: 16px; }
.ocr-panel { margin-top: 24px; border-top: 1px solid var(--border-color, #d7dddc); padding-top: 20px; }
.ocr-panel summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.ocr-panel .form-help { max-width: 70ch; margin: 12px 0; }
.ocr-panel > .btn { margin-top: 12px; }
.ocr-panel progress { width: 100%; accent-color: var(--brand-accent); }
.ocr-review-layout { display: grid; grid-template-columns: minmax(160px, .65fr) minmax(0, 1.35fr); gap: 24px; margin: 24px 0; align-items: start; }
.ocr-review-layout img { display: block; max-width: 100%; max-height: 480px; object-fit: contain; background: white; }
.ocr-review-layout > * { min-width: 0; }
.ocr-review-layout h3 { margin: 0 0 12px; }
.ocr-review-layout .rx-matrix-table { min-width: 360px; }
.ocr-review-layout .rx-input { min-width: 76px; }
.ocr-review-layout input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.ocr-review-layout input[type="number"]::-webkit-inner-spin-button, .ocr-review-layout input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ocr-confirm { display: flex; align-items: start; gap: 10px; margin: 16px 0; cursor: pointer; }
.ocr-confirm input { margin-top: 3px; accent-color: var(--brand-accent); }
.ocr-raw { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; padding: 16px; background: var(--bg-subtle); font-size: 13px; border-radius: 12px; }
.myopia-signatures-row { break-inside: avoid; }
@media (max-width: 760px) {
  .ocr-review-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .ocr-review-layout img { max-height: 260px; margin: auto; }
  .ocr-review-layout .rx-matrix-table { min-width: 280px; }
  .ocr-review-layout .rx-input { min-width: 0; width: 64px; padding: 6px; }
  .ocr-review-layout .rx-matrix-table th, .ocr-review-layout .rx-matrix-table td { padding: 8px; }
}

svg { flex-shrink:0; }
.metric-icon { width:42px; height:42px; border-radius: 50%; background: var(--brand-accent-subtle); color: var(--brand-accent); display: grid; place-items: center; overflow:hidden; }
.metric-icon > svg { width:22px; height:22px; max-width:100%; max-height:100%; }
.page-actions { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:24px; }
.page-actions p { margin:0; max-width:65ch; }
.page-actions > .btn { flex:0 0 auto; max-width:100%; white-space:normal; overflow-wrap:normal; text-align:center; }
.page-actions > h2 { flex:1 1 280px; min-width:0; }
.commercial-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:24px; }
.commercial-summary { display:flex; flex-wrap:wrap; gap:24px; padding:20px 24px; margin-bottom:24px; background: var(--bg-surface); border:1px solid var(--rim); border-radius: 20px; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.commercial-summary span { display:grid; gap:6px; }
.commercial-form { margin-top:24px; padding-top:24px; border-top:1px solid var(--border); }
.commercial-form .form-label { margin-top:12px; }
.commercial-log { padding:16px 0; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.commercial-log p { margin:6px 0; }
.commercial-log form { max-width:480px; }
.commercial-log summary { cursor:pointer; margin-top:12px; }
.commercial-price { font-size:32px; font-weight:800; letter-spacing: -.03em; }
.commercial-price span { font-size:14px; font-weight:500; }
.payment-address { overflow-wrap:anywhere; }
.clinical-conditional[hidden] { display:none!important; }
.draft-notice { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:12px 16px; margin-bottom:20px; background:var(--bg-subtle); border:1px solid var(--border); border-radius:14px; font-size:13px; }
@media(max-width:760px) { .commercial-summary { gap:16px; }.page-actions h1 { font-size:22px; }.commercial-tabs .btn { flex:1 1 auto; }.card form input[type="file"] { max-width:100%; } }

/* ==========================================================================
   ARMONIZACIÓN DE COLOR, CONTRASTE Y ALINEACIÓN DE ICONOS
   ========================================================================== */

svg { vertical-align: middle; }

.btn svg,
button svg,
.nav-link svg,
.card-title svg,
.badge svg,
.topbar-tool-btn svg {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.btn svg { width: 16px; height: 16px; }
.btn-sm svg { width: 14px; height: 14px; }

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--brand-accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.badge svg { width: 12px; height: 12px; }

.btn-primary {
  background: var(--brand-accent) !important;
  border-color: var(--brand-accent) !important;
  color: var(--brand-button-text) !important;
}

.btn-primary:hover {
  background: var(--brand-accent) !important;
  border-color: var(--brand-accent) !important;
  color: var(--brand-button-text) !important;
}

[data-theme="dark"] .btn-primary {
  color: var(--brand-button-text) !important;
}

[data-theme="dark"] .btn-primary:hover {
  color: var(--brand-button-text) !important;
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-dark);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.badge-blue {
  background: var(--brand-accent-subtle, rgba(36, 90, 103, 0.14));
  color: var(--brand-accent);
  border: 1px solid var(--brand-accent-subtle, rgba(36, 90, 103, 0.25));
}

.badge-green {
  background: var(--status-success-bg, #dcfce7);
  color: var(--status-success, #138a63);
  border: 1px solid rgba(19, 138, 99, 0.22);
}

/* ==========================================================================
   LINTEL 120FPS MOTION & SKELETON ENGINE (ZERO GPU OVERDRAW)
   ========================================================================== */

/* 1. Lightweight Ambient Mesh Background (Static GPU layer for 120fps scrolling) */
.mesh {
  z-index: -1;
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: 0.75;
}

.mesh i {
  opacity: 0.7;
  border-radius: 50%;
  position: absolute;
}

.mesh__a {
  background: radial-gradient(closest-side, #d8e1fa, transparent);
  width: 58vmax;
  height: 58vmax;
  top: -24vmax;
  left: -18vmax;
}

.mesh__b {
  background: radial-gradient(closest-side, #fbe0cc, transparent);
  width: 52vmax;
  height: 52vmax;
  bottom: -24vmax;
  right: -14vmax;
}

.mesh__c {
  background: radial-gradient(closest-side, #d6ede4, transparent);
  width: 46vmax;
  height: 46vmax;
  bottom: -26vmax;
  left: 28vmax;
}

[data-theme="dark"] .mesh__a {
  background: radial-gradient(closest-side, rgba(47, 91, 234, 0.20), transparent);
}

[data-theme="dark"] .mesh__b {
  background: radial-gradient(closest-side, rgba(255, 138, 61, 0.11), transparent);
}

[data-theme="dark"] .mesh__c {
  background: radial-gradient(closest-side, rgba(19, 138, 99, 0.15), transparent);
}

/* 2. Stage Progress Meter Bars */
.lintel-meter {
  width: 100%;
  height: 6px;
  background: rgba(18, 23, 34, 0.07);
  border-radius: 999px;
  overflow: hidden;
  display: block;
  margin-top: 5px;
}

[data-theme="dark"] .lintel-meter {
  background: rgba(255, 255, 255, 0.09);
}

.lintel-meter__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--brand-accent);
  transform-origin: 0 50%;
}

.lintel-meter__fill--apricot { background: #ff8a3d; }
.lintel-meter__fill--mint { background: #138a63; }
.lintel-meter__fill--cobalt { background: #2f5bea; }

/* 3. Fast, Non-Intrusive Skeleton Shimmer System */
.skeleton,
.lintel-skel-bar {
  background: linear-gradient(
    90deg,
    var(--bg-subtle, #e8ecf2) 20%,
    rgba(255, 255, 255, 0.9) 50%,
    var(--bg-subtle, #e8ecf2) 80%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1s linear infinite;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}

[data-theme="dark"] .skeleton,
[data-theme="dark"] .lintel-skel-bar {
  background: linear-gradient(
    90deg,
    var(--bg-subtle, #1f2532) 20%,
    rgba(255, 255, 255, 0.12) 50%,
    var(--bg-subtle, #1f2532) 80%
  );
  background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.lintel-skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--bg-surface);
  border-radius: inherit;
  padding: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
}

.lintel-skeleton-overlay.is-leaving {
  opacity: 0;
}

.lintel-skel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lintel-skel-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lintel-skel-pill {
  height: 24px;
  width: 78px;
  border-radius: 999px;
}

.lintel-skel-kpi {
  height: 34px;
  width: 55%;
  border-radius: 10px;
}

.lintel-skel-title {
  height: 18px;
  width: 44%;
  border-radius: 8px;
}

.lintel-skel-line {
  height: 13px;
  width: 100%;
  border-radius: 7px;
}

.lintel-skel-line.w-80 { width: 80%; }
.lintel-skel-line.w-65 { width: 65%; }
.lintel-skel-line.w-45 { width: 45%; }

.lintel-skel-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 120px;
  padding-top: 12px;
}

.lintel-skel-chart > i {
  flex: 1;
  border-radius: 8px 8px 4px 4px;
  display: block;
}

.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 6px; width: 100%; }
.skeleton-text.short { width: 45%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.xs { width: 25%; }
.skeleton-title { height: 22px; width: 40%; margin-bottom: 14px; border-radius: 6px; }
.skeleton-circle { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; }
.skeleton-btn { height: 36px; width: 115px; border-radius: 999px; }

.skeleton-card {
  padding: 22px;
  border-radius: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--rim);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-tile {
  padding: 18px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--rim);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-table-row td > div {
  height: 16px;
  border-radius: 6px;
}

/* Modales universales suaves y accesibles */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 34, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--rim);
  border-radius: 24px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

/* ==========================================================================
   POP-UP MODAL: CREAR NUEVO PACIENTE EN CONSULTA (120 FPS SMOOTH)
   ========================================================================== */
.patient-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
}

.patient-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.patient-modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--rim, rgba(255, 255, 255, 0.12));
  border-radius: 20px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.patient-modal-backdrop.open .patient-modal-card {
  transform: scale(1) translateY(0);
}

.patient-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.patient-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-accent-subtle, rgba(37, 99, 235, 0.12));
  color: var(--brand-accent, #2563eb);
}

/* ==========================================================================
   HEALTHCARE OPTIC SAAS — MASTER CONTROL TOWER & NETWORK MAP
   ========================================================================== */

/* Botón discreto en Topbar de Modo Clínica para Super Admin */
.topbar-master-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  border: 1px solid rgba(13, 148, 136, 0.28);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: all 0.18s ease;
}
.topbar-master-switch:hover {
  background: #0d9488;
  color: #ffffff;
  border-color: #0d9488;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}
[data-theme="dark"] .topbar-master-switch {
  background: rgba(45, 212, 191, 0.12);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.3);
}
[data-theme="dark"] .topbar-master-switch:hover {
  background: #0d9488;
  color: #ffffff;
}

/* ==========================================================================
   MASTER SAAS CONSOLE (OPERATE MODE, THEME-AWARE)
   ========================================================================== */
.master-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-primary);
}

.master-sidebar {
  width: 248px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}

.master-sidebar-backdrop {
  display: none;
}

.master-sidebar-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.master-brand-subtitle {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-accent);
  letter-spacing: 0.02em;
  margin-top: 6px;
}

.master-nav {
  padding: 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.master-nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 10px 10px 6px;
}

.master-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.master-nav-item.active {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  font-weight: 600;
}

.master-nav-item:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.master-sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.master-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

.master-impersonate-banner {
  background: var(--status-warning-bg);
  border-bottom: 1px solid var(--border);
  color: var(--status-warning);
  padding: 9px 24px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.master-topbar {
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.master-topbar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.master-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.master-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-accent);
  color: var(--brand-button-text, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.master-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.master-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.master-user-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

.master-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.master-icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.master-icon-btn:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.master-mobile-toggle {
  display: none;
}

.master-content-body {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.master-flash {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
}

.master-flash-success {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.master-flash-error {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

/* Page Header */
.master-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.master-page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.master-page-subtitle {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

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

/* Unified KPI Strip (Single Surface, No Colored Top Bars) */
.master-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.master-kpi-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.master-kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.master-kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.master-kpi-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.master-kpi-sub strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Quick Jump & Filter Toolbar */
.master-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.master-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.master-search-input {
  min-width: 240px;
  min-height: 36px;
  font-size: 13px;
}

.master-select-compact {
  min-height: 36px;
  font-size: 13px;
  min-width: 240px;
}

.master-filter-pills {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 2px;
}

.master-filter-pill {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.master-filter-pill:hover {
  color: var(--text-primary);
}

.master-filter-pill.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Overview Grid */
.master-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.master-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.master-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

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

.master-panel-body {
  padding: 16px 18px;
}

/* Plan Distribution (Clean, No Nested Cards) */
.plan-bar-wrapper {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
  margin: 10px 0 14px;
}

.plan-segment {
  height: 100%;
  transition: width 0.25s ease;
}

.plan-segment.basic { background: var(--clinical-od); }
.plan-segment.pro { background: var(--brand-accent); }
.plan-segment.enterprise { background: var(--status-warning); }

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

.plan-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.plan-breakdown-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.plan-breakdown-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.plan-legend-dot.basic { background: var(--clinical-od); }
.plan-legend-dot.pro { background: var(--brand-accent); }
.plan-legend-dot.enterprise { background: var(--status-warning); }

.plan-breakdown-meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Attention List */
.master-attention-list {
  display: flex;
  flex-direction: column;
}

.master-attention-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.master-attention-row:last-child {
  border-bottom: none;
}

.master-attention-info {
  min-width: 0;
}

.master-attention-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.master-attention-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.master-empty-quiet {
  padding: 20px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Status Badges & Dots */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge-active {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.status-badge-expired {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.status-badge-paused {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.active { background: var(--status-success); }
.status-dot.expired { background: var(--status-warning); }
.status-dot.paused { background: var(--status-danger); }

/* Action Buttons */
.master-action-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.btn-master-action {
  min-height: 34px;
  min-width: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-master-action:hover {
  background: var(--bg-subtle);
}

.btn-master-action:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.btn-master-impersonate {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  border-color: transparent;
}

.btn-master-impersonate:hover {
  background: var(--brand-accent);
  color: var(--brand-button-text, #ffffff);
}

.btn-master-action.btn-icon-only {
  padding: 0;
  width: 34px;
}

.btn-action-pause {
  color: var(--status-warning);
}

.btn-action-activate {
  color: var(--status-success);
}

.btn-action-danger {
  color: var(--status-danger);
}

.btn-action-danger:hover {
  background: var(--status-danger-bg);
  border-color: var(--status-danger);
}

.clinic-tier-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.clinic-tier-tag.pro {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  border-color: transparent;
}

.clinic-tier-tag.enterprise {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border);
}

.master-users-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.master-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.master-user-row:last-child {
  border-bottom: none;
}

.master-user-row-info {
  min-width: 0;
}

.master-user-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.master-user-row-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Master Modals */
.master-modal-card {
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
}

.master-modal-header {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.master-modal-icon {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
}

.master-modal-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.master-modal-subheading {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.master-modal-body {
  padding: 18px;
}

.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Master Form Cards */
.master-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  padding: 20px;
  border-radius: var(--radius-md);
}

.master-form-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

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

.required-mark {
  color: var(--status-danger);
}

/* Master Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.master-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.master-dropdown-menu {
  position: fixed;
  z-index: 1200;
  min-width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-overlay);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.master-dropdown-menu.open {
  display: flex;
}

.master-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.master-dropdown-item:hover {
  background: var(--bg-subtle);
}

.master-dropdown-item.danger {
  color: var(--status-danger);
}

.master-dropdown-item.danger:hover {
  background: var(--status-danger-bg);
}

.master-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.master-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.master-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.master-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.master-table tbody tr:hover td {
  background: var(--bg-subtle);
}

.cell-mono-muted {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tenant-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
}

.tenant-meta {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tenant-slug {
  font-size: 11px;
  color: var(--brand-accent);
  font-family: var(--font-mono);
}

.tenant-admin-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.tenant-admin-user {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tenant-admin-user code {
  color: var(--brand-accent);
}

.tenant-plan-price {
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  margin-top: 4px;
}

.tenant-date {
  font-weight: 600;
  font-size: 12.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.tenant-date-sub {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.tenant-counts-primary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tenant-counts-secondary {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1080px) {
  .master-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .master-kpi-cell:nth-child(2) {
    border-right: none;
  }
  .master-kpi-cell:nth-child(1),
  .master-kpi-cell:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }
  .master-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .master-mobile-toggle {
    display: inline-flex;
  }
  .master-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-overlay);
  }
  .master-sidebar.open {
    transform: translateX(0);
  }
  .master-sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 95;
  }
  .master-topbar {
    padding: 0 16px;
  }
  .master-content-body {
    padding: 16px;
  }
  .master-user-meta {
    display: none;
  }
}

@media (max-width: 600px) {
  .master-kpi-strip {
    grid-template-columns: 1fr;
  }
  .master-kpi-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .master-kpi-cell:last-child {
    border-bottom: none;
  }
  .master-search-input,
  .master-select-compact {
    min-width: 100%;
    width: 100%;
  }
}

/* Reduced Motion Override for Accessibility */
[data-motion="reduced"] :is(.card, .btn, .nav-link, .sidebar, .mesh, .mesh *, .skeleton, .lintel-skel-bar, .animate-fade-in-up) {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  :is(.card, .btn, .nav-link, .sidebar, .mesh, .mesh *, .skeleton, .lintel-skel-bar, .animate-fade-in-up) {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

/* Signature & Stamp Studio (Onboarding + Profile) */
.sig-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.95fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .sig-studio-grid {
    grid-template-columns: 1fr;
  }
}
.sig-step-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.sig-step-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px 0;
}
.sig-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand-accent, #245a67);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  margin-right: 6px;
}
.sig-slider-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 560px) {
  .sig-slider-row {
    grid-template-columns: 1fr;
  }
}
.sig-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.sig-slider-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--brand-accent, #245a67);
}
.sig-upload-zone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-surface, #ffffff);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.sig-upload-zone:hover {
  border-color: var(--brand-accent, #245a67);
}
.sig-doc-window {
  position: sticky;
  top: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #eef2f6;
  padding: 14px;
}
.sig-doc-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.sig-doc-paper {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  padding: 16px 18px 18px;
  color: #0f172a;
}
.sig-doc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--brand-accent, #245a67);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.sig-doc-clinic {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-accent, #245a67);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sig-doc-skeleton-lines {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}
.sig-doc-line {
  height: 7px;
  border-radius: 4px;
  background: #e2e8f0;
}
.sig-doc-sign-wrap {
  display: flex;
  justify-content: flex-end;
}
.sig-doc-sign-block {
  width: 220px;
  text-align: center;
}
.sig-doc-sign-slot {
  width: 220px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 4px;
  border-radius: 6px;
  background: rgba(248, 250, 252, 0.7);
  overflow: hidden;
}
.sig-doc-sign-slot img {
  max-width: 220px;
  max-height: 64px;
  object-fit: contain;
  display: block;
}
.sig-doc-sign-rule {
  border-top: 1.5px solid #111827;
  padding-top: 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #111827;
}
.sig-doc-sign-name {
  font-size: 10.5px;
  font-weight: 700;
  color: #374151;
  margin-top: 2px;
}
.signature-checkerboard {
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-color: #ffffff;
}
.sig-alpha-pill {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
}



