/* ============================================================
   EXPEDIENTE CLÍNICO — Blue Design System
   OKLCH. Navy sidebar. Calm blue accent. Daily medical use.
   ============================================================ */

:root {
  /* ── Backgrounds ── richer, more depth */
  --bg:               oklch(95.8% 0.014 242);
  --surface:          oklch(99.2% 0.006 242);
  --surface-raised:   oklch(100% 0.002 242);
  --border:           oklch(87% 0.018 240);
  --border-subtle:    oklch(91.5% 0.012 240);

  /* ── Text ── */
  --text:             oklch(16% 0.026 250);
  --text-2:           oklch(34% 0.022 248);
  --muted:            oklch(52% 0.015 248);
  --placeholder:      oklch(63% 0.011 248);

  /* ── Navy Sidebar ── deeper, richer */
  --sidebar:          oklch(18% 0.058 252);
  --sidebar-deep:     oklch(14% 0.050 252);
  --sidebar-txt:      oklch(66% 0.022 240);
  --sidebar-hover:    oklch(26% 0.066 248);
  --sidebar-active:   oklch(35% 0.115 245);
  --sidebar-active-t: oklch(94% 0.050 225);
  --brand:            oklch(78% 0.168 212);

  /* ── Blue Accent ── more saturated, richer */
  --blue:             oklch(50% 0.238 255);
  --blue-dark:        oklch(42% 0.222 255);
  --blue-light:       oklch(63% 0.185 252);
  --blue-tint:        oklch(95% 0.045 250);
  --blue-tint-2:      oklch(90% 0.080 250);

  /* ── Teal — clinical secondary ── */
  --teal:             oklch(57% 0.178 196);
  --teal-dark:        oklch(47% 0.168 196);
  --teal-tint:        oklch(95.5% 0.038 196);
  --teal-tint-2:      oklch(90% 0.062 196);

  /* ── Semantic ── */
  --danger:           oklch(54% 0.205 24);
  --danger-tint:      oklch(97% 0.026 24);
  --danger-border:    oklch(85% 0.075 24);
  --success:          oklch(52% 0.148 148);
  --success-tint:     oklch(96% 0.032 148);
  --warning:          oklch(70% 0.162 72);
  --warning-tint:     oklch(97% 0.030 72);

  /* ── Sizing ── */
  --r-xs:    6px;
  --r-sm:    9px;
  --r:       13px;
  --r-lg:    18px;
  --r-xl:    24px;
  --sidebar-w: 256px;

  /* ── Shadows ── layered, blue-tinted ── */
  --shadow-xs: 0 1px 3px oklch(18% 0.04 252 / 9%);
  --shadow-sm: 0 2px 4px oklch(18% 0.04 252 / 7%), 0 6px 20px oklch(18% 0.04 252 / 6%);
  --shadow-md: 0 4px 8px oklch(18% 0.04 252 / 8%), 0 14px 36px oklch(18% 0.04 252 / 10%);
  --shadow-lg: 0 8px 16px oklch(18% 0.04 252 / 10%), 0 24px 56px oklch(18% 0.04 252 / 14%);

  /* ── Transitions ── */
  --t-fast:   0.12s ease;
  --t:        0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--blue-dark); }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }

/* ============================================================
   SKIP LINK (accessibility)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--blue);
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: oklch(30% 0.04 248) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.015em;
  border-bottom: 1px solid oklch(28% 0.038 248);
  flex-shrink: 0;
}

.sidebar-brand i { font-size: 1.4rem; flex-shrink: 0; }

.sidebar-section-label {
  padding: 16px 16px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: oklch(42% 0.02 248);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--sidebar-txt);
  font-size: 0.875rem;
  font-weight: 450;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
  cursor: pointer;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: oklch(86% 0.014 240);
  text-decoration: none;
}

.sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-t);
  font-weight: 580;
}

.sidebar .nav-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.sidebar .nav-link i {
  font-size: 1rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.sidebar .nav-link.child {
  padding-left: 38px;
  font-size: 0.845rem;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid oklch(28% 0.038 248);
  font-size: 0.75rem;
  color: oklch(40% 0.014 248);
  flex-shrink: 0;
}

/* ── Main content area ── */
.content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.topbar-info { min-width: 0; }

.topbar-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.2;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.845rem;
  color: var(--text-2);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.user-badge i { color: var(--blue); font-size: 1rem; }

/* ── Page body ── */
.page-body {
  flex: 1;
  padding: 26px 28px 36px;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-header p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ============================================================
   PANELS & CARDS
   ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 22px 24px;
}

.panel-sm { padding: 16px 18px; }

.panel-title {
  font-size: 0.92rem;
  font-weight: 660;
  color: var(--text);
  margin: 0 0 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.panel-title i { color: var(--muted); font-size: 0.9rem; }

.panel-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 660;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i { color: var(--muted); }

/* Bootstrap card overrides */
.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border-subtle);
  --bs-card-border-radius: var(--r-lg);
  box-shadow: none;
}
.card.border-0 { border: 1px solid var(--border-subtle) !important; }
.card-body { padding: 22px 24px; }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 16px 0;
}

/* ============================================================
   METRIC CARDS
   ============================================================ */

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  transition: border-color var(--t), box-shadow var(--t);
}

.metric-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: var(--blue-tint);
  color: var(--blue);
}

.metric-icon.success { background: var(--success-tint); color: var(--success); }
.metric-icon.danger  { background: var(--danger-tint);  color: var(--danger); }
.metric-icon.warning { background: var(--warning-tint); color: var(--warning); }
.metric-icon.neutral { background: var(--border-subtle); color: var(--muted); }

.metric-body { min-width: 0; }

.metric-label {
  font-size: 0.73rem;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 740;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.025em;
}

.metric-note {
  font-size: 0.77rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table {
  font-size: 0.875rem;
  color: var(--text);
  margin: 0;
}

.table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border) !important;
  border-top: none;
  padding: 10px 14px;
  white-space: nowrap;
  background: transparent;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle) !important;
  border-top: none;
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none !important; }

.table-hover tbody tr {
  transition: background var(--t-fast);
}

.table-hover tbody tr:hover td {
  background: var(--blue-tint);
}

/* ── Badges ── */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.4;
}

.badge-active {
  composes: badge-pill;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--success-tint);
  color: var(--success);
}

.badge-active::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-inactive {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--border-subtle);
  color: var(--muted);
}

.badge-role {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 650;
  background: var(--blue-tint);
  color: var(--blue-dark);
  margin-right: 3px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 550;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), opacity var(--t-fast);
  cursor: pointer;
}

.btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: oklch(99% 0.003 248);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: oklch(99% 0.003 248);
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px oklch(55% 0.195 248 / 22%);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline-secondary {
  color: var(--text-2);
  border: 1px solid var(--border);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--border-subtle);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline-danger {
  color: var(--danger);
  border: 1px solid oklch(84% 0.075 22);
  background: transparent;
  font-size: 0.82rem;
  min-height: 34px;
  padding: 4px 13px;
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-sm { min-height: 32px; font-size: 0.82rem; padding: 4px 12px; }

/* ============================================================
   FORMS
   ============================================================ */

.form-label {
  font-size: 0.83rem;
  font-weight: 620;
  color: var(--text-2);
  margin-bottom: 5px;
  display: block;
}

.required-mark {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  padding: 10px 13px;
  min-height: 44px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}

.form-control::placeholder { color: var(--placeholder); }

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(55% 0.195 248 / 14%);
  background: var(--surface);
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-image: none;
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px oklch(55% 0.190 22 / 14%);
}

.form-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

.input-group {
  display: flex;
}

.input-group-text {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.9rem;
  transition: border-color var(--t-fast);
}

.input-group .input-group-text:first-child {
  border-right: none;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.input-group .form-control:last-child {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.input-group .form-control:not(:last-child) {
  border-right: none;
  border-radius: 0;
}

.input-group:focus-within .input-group-text {
  border-color: var(--blue);
}

/* Password toggle */
.password-wrap {
  position: relative;
  display: flex;
}

.password-wrap .form-control {
  padding-right: 44px;
  border-radius: var(--r-sm);
}

.password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: color var(--t-fast);
}

.password-toggle:hover { color: var(--blue); }
.password-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r-sm); }

/* Validation */
.field-validation-valid { display: none !important; }

.field-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
  align-items: center;
  gap: 4px;
}

.field-validation-error.field-error {
  display: flex;
}

.field-error::before {
  content: '\f33a';
  font-family: 'bootstrap-icons';
  font-size: 0.75rem;
  flex-shrink: 0;
}

.text-danger { color: var(--danger) !important; font-size: 0.8rem; }

.validation-summary-errors {
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  color: oklch(38% 0.16 22);
  font-size: 0.845rem;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.validation-summary-errors ul { margin: 0; padding: 0 0 0 18px; }

/* ============================================================
   ALERTS
   ============================================================ */

.alert-info-custom {
  background: var(--blue-tint);
  border: 1px solid var(--blue-tint-2);
  border-radius: var(--r-sm);
  color: var(--blue-dark);
  font-size: 0.865rem;
  padding: 11px 15px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.alert-info-custom i { margin-top: 1px; flex-shrink: 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2.4rem;
  opacity: 0.35;
  display: block;
  margin-bottom: 14px;
}

.empty-state-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}

.empty-state-sub {
  font-size: 0.83rem;
  color: var(--muted);
  max-width: 280px;
  margin: 0 auto;
}

/* ============================================================
   FEATURE LIST (module items on dashboard)
   ============================================================ */

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.feature-item:hover {
  background: var(--blue-tint);
  border-color: oklch(89% 0.05 245);
}

.feature-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--success-tint);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.feature-item-title {
  font-size: 0.845rem;
  font-weight: 620;
  color: var(--text);
  line-height: 1.2;
}

.feature-item-sub {
  font-size: 0.77rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ============================================================
   STAT ROW (inline key-value)
   ============================================================ */

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  font-size: 0.855rem;
}

.stat-row + .stat-row { border-top: 1px solid var(--border-subtle); }

.stat-label { color: var(--muted); }

.stat-value { font-weight: 600; color: var(--text); }

/* ============================================================
   ERROR / UTILITY PAGES
   ============================================================ */

.centered-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 40px 20px;
}

.error-panel {
  max-width: 400px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: 44px 36px;
}

.error-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--danger-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 22px;
  font-size: 1.9rem;
  color: var(--danger);
}

.error-icon-wrap.info {
  background: var(--blue-tint);
  color: var(--blue);
}

.error-icon-wrap.success {
  background: var(--success-tint);
  color: var(--success);
}

.error-title {
  font-size: 1.3rem;
  font-weight: 720;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.error-sub {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 26px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   AUTH PAGES (Login, Forgot, Reset)
   ============================================================ */

.auth-shell {
  min-height: 100dvh;
  display: flex;
  background: var(--bg);
}

/* Left panel */
.auth-side {
  width: 420px;
  flex-shrink: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 40px 44px;
  position: relative;
  overflow: hidden;
}

/* Subtle geometric decoration */
.auth-side::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: oklch(28% 0.055 248);
  pointer-events: none;
}

.auth-side::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: oklch(24% 0.050 248);
  pointer-events: none;
}

.auth-side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 720;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.auth-side-brand i { font-size: 1.6rem; }

.auth-side-logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  object-fit: contain;
}

.auth-side-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.auth-side-heading {
  font-size: 1.75rem;
  font-weight: 740;
  color: oklch(95% 0.008 242);
  line-height: 1.22;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.auth-side-sub {
  font-size: 0.88rem;
  color: oklch(55% 0.014 242);
  line-height: 1.65;
  margin-bottom: 28px;
}

.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.845rem;
  color: oklch(58% 0.016 240);
}

.auth-feature i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: oklch(32% 0.07 238);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: oklch(70% 0.12 220);
  flex-shrink: 0;
}

.auth-side-footer {
  font-size: 0.75rem;
  color: oklch(38% 0.012 248);
  position: relative;
  z-index: 1;
}

/* Right / form side */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.auth-form-wrap {
  width: 100%;
  max-width: 368px;
}

.auth-form-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 6px;
}

.auth-form-title {
  font-size: 1.45rem;
  font-weight: 740;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  line-height: 1.2;
}

.auth-form-sub {
  font-size: 0.855rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.auth-form-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
}

@media (max-width: 900px) {
  .auth-side { width: 340px; padding: 36px 32px; }
  .auth-side-heading { font-size: 1.45rem; }
}

@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    inset: auto;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 8px 10px; }
  .app-shell { flex-direction: column; }
  .content { margin-left: 0; width: 100%; }
  .page-body { padding: 16px; }
  .auth-side { display: none; }
  .auth-main { padding: 32px 20px; }
  .topbar { padding: 0 16px; height: 52px; }
  .page-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   MAIN SHELL — No sidebar, full-width topbar
   ============================================================ */

.main-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Top navigation bar ── */
.main-topbar {
  background: var(--sidebar);
  height: 58px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.topbar-divider {
  width: 1px;
  height: 18px;
  background: oklch(34% 0.04 248);
  margin: 0 10px;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--brand);
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: -0.015em;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-brand i { font-size: 1.35rem; }

.topbar-logo-icon {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Nombre / switcher de clínica en topbar ── */
.topbar-clinic-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: oklch(68% 0.018 242);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-clinic-name i { opacity: 0.7; }

.btn-clinic-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: oklch(27% 0.04 248);
  border: 1px solid oklch(34% 0.04 248);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  font-size: 0.82rem;
  font-weight: 500;
  color: oklch(72% 0.016 242);
  cursor: pointer;
  white-space: nowrap;
  max-width: 200px;
  transition: background 0.15s;
}
.btn-clinic-switch:hover,
.btn-clinic-switch:focus-visible { background: oklch(32% 0.04 248); }
.btn-clinic-switch::after { display: none !important; } /* quita el caret de BS */

.clinic-switch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.clinic-switch-chevron {
  font-size: 0.65rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.topbar-clinic-switcher .dropdown-menu {
  min-width: 220px;
}
.topbar-clinic-switcher .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}
.topbar-clinic-switcher .dropdown-item.active {
  background: var(--brand-bg, #eff6ff);
  color: var(--brand, #2563eb);
  font-weight: 600;
}

/* ── Selector de clínica (vista SeleccionarClinica) ── */
.clinic-selector-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.clinic-selector-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--surface-1, #fff);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: var(--r-md, 10px);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  color: inherit;
}
.clinic-selector-card:hover,
.clinic-selector-card:focus-visible {
  border-color: var(--brand, #2563eb);
  box-shadow: 0 0 0 3px oklch(60% 0.18 248 / 0.12);
  background: var(--brand-bg, #eff6ff);
  outline: none;
}

.clinic-selector-card.clinic-card-gracia {
  border-color: #f59e0b;
}
.clinic-selector-card.clinic-card-gracia:hover {
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgb(245 158 11 / 0.12);
}

.clinic-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-bg, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--brand, #2563eb);
  flex-shrink: 0;
}

.clinic-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.clinic-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clinic-card-warn {
  font-size: 0.76rem;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 4px;
}

.clinic-card-arrow {
  color: var(--muted, #94a3b8);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: oklch(72% 0.016 242);
  font-weight: 500;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  background: oklch(27% 0.04 248);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip i { color: var(--brand); flex-shrink: 0; }
.user-chip-photo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid oklch(45% 0.06 248);
}

.btn-topbar-exit {
  display: flex;
  align-items: center;
  gap: 5px;
  color: oklch(60% 0.015 248);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid oklch(30% 0.035 248);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
  min-height: 34px;
}

.btn-topbar-exit:hover {
  background: oklch(28% 0.04 248);
  color: oklch(85% 0.01 248);
  text-decoration: none;
}

/* Back button in topbar (non-home pages) — left-side, subtle */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: oklch(62% 0.015 242);
  font-size: 0.80rem;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  min-height: 32px;
}

.back-btn i { font-size: 0.85rem; }

.back-btn:hover {
  background: oklch(27% 0.04 248);
  color: oklch(84% 0.012 240);
  text-decoration: none;
}

.back-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── In-page back / cancel navigation button ── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: 0.83rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
  min-height: 34px;
  line-height: 1.4;
}

.btn-back i {
  font-size: 0.82rem;
  color: var(--muted);
}

.btn-back:hover {
  background: var(--surface);
  border-color: oklch(76% 0.012 242);
  color: var(--text);
  text-decoration: none;
}

.btn-back:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Main content area ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HOME — Welcome banner
   ============================================================ */

.home-banner {
  background: var(--sidebar);
  padding: 22px 32px 20px;
  border-bottom: 1px solid oklch(26% 0.040 248);
}

.home-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-greeting {
  font-size: 1.25rem;
  font-weight: 700;
  color: oklch(94% 0.010 242);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.home-greeting strong { color: var(--brand); }

.home-date {
  font-size: 0.8rem;
  color: oklch(50% 0.014 248);
  margin-top: 3px;
  text-transform: capitalize;
}

.home-banner-icon {
  font-size: 2.5rem;
  color: oklch(30% 0.055 248);
  line-height: 1;
  display: none; /* decorative, hide on smaller screens */
}

@media (min-width: 768px) {
  .home-banner-icon { display: block; }
}

/* ── Body container ── */
.home-body {
  flex: 1;
  padding: 28px 32px 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Section label ── */
.modules-label {
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── No modules state ── */
.no-modules {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.no-modules i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
  opacity: 0.35;
}

/* ============================================================
   MODULE TILES
   ============================================================ */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.module-tile {
  border-radius: 16px;
  padding: 24px 20px 20px;
  min-height: 160px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  color: white;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  user-select: none;
  border: none;
  text-decoration: none;
  text-align: left;
}

/* Subtle inner shine overlay */
.module-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.10) 0%, transparent 60%);
  pointer-events: none;
}

.module-tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px oklch(0% 0 0 / 28%);
  filter: brightness(1.08);
  color: white;
  text-decoration: none;
}

.module-tile:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}

.module-tile:focus-visible {
  outline: 3px solid white;
  outline-offset: 3px;
}

/* Decorative large circle in top-right */
.module-tile::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.tile-icon {
  font-size: 2.4rem;
  opacity: 0.92;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.tile-body {
  margin-top: auto;
  position: relative;
  z-index: 1;
  padding-top: 18px;
}

.tile-title {
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: rgba(255,255,255,0.97);
}

.tile-sub {
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 3px;
  line-height: 1.35;
}

.tile-arrow {
  position: absolute;
  bottom: 18px;
  right: 18px;
  font-size: 0.85rem;
  opacity: 0.55;
  transition: transform 0.15s ease, opacity 0.15s ease;
  z-index: 1;
}

.module-tile:hover .tile-arrow {
  opacity: 0.9;
  transform: translateX(3px);
}

/* Child tiles — slightly smaller */
.module-tile-child {
  min-height: 130px;
  border-radius: 13px;
  padding: 20px 18px 18px;
}

.module-tile-child .tile-icon { font-size: 2rem; }
.module-tile-child .tile-title { font-size: 0.88rem; }

/* ── Sub-module header ── */
.submodule-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.submodule-title {
  font-size: 1.15rem;
  font-weight: 720;
  color: var(--text);
  letter-spacing: -0.015em;
  margin: 0;
}

.back-btn-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 580;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid oklch(85% 0.05 248);
  background: var(--blue-tint);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.back-btn-home:hover {
  background: var(--blue-tint-2);
  border-color: oklch(75% 0.09 248);
  color: var(--blue-dark);
}

.back-btn-home:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Non-home pages: inner page layout ── */
.inner-page {
  flex: 1;
  padding: 28px 32px 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   RESPONSIVE — TILES
   ============================================================ */

@media (max-width: 1100px) {
  .home-body { padding: 24px 24px 36px; }
  .inner-page { padding: 24px 24px 36px; }
  .home-banner { padding: 20px 24px 18px; }
}

@media (max-width: 768px) {
  .main-topbar { padding: 0 16px; height: 52px; }
  .topbar-brand span { display: none; }
  .back-btn span { display: none; }
  .user-chip span { display: none; }
  .home-body { padding: 18px 16px 32px; }
  .inner-page { padding: 18px 16px 32px; }
  .home-banner { padding: 18px 16px 16px; }
  .home-greeting { font-size: 1.05rem; }
  .module-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .module-tile { min-height: 130px; padding: 18px 14px 14px; }
  .tile-icon { font-size: 1.9rem; }
  .tile-title { font-size: 0.82rem; }
}

@media (max-width: 400px) {
  .module-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   FORM SELECT (Bootstrap override)
   ============================================================ */

.form-select {
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  padding: 10px 36px 10px 13px;
  min-height: 44px;
  color: var(--text);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(55% 0.195 248 / 14%);
  outline: none;
}

.form-check-input {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--blue);
  flex-shrink: 0;
}

/* ============================================================
   FIELDSET / LEGEND — Form sections
   ============================================================ */

.form-section {
  border: none;
  padding: 0;
  margin: 0 0 28px;
}

.form-section legend {
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 0;
  float: none;
  width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

/* ── Form grids ── */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
}

.form-group { display: flex; flex-direction: column; }

.form-group--wide  { grid-column: span 2; }
.form-group--full  { grid-column: 1 / -1; }

.form-label.required::after {
  content: ' *';
  color: var(--danger);
  font-weight: 700;
}

.field-help {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.875rem;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px 0;
}

.check-label--lg {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text);
  gap: 10px;
  padding: 6px 0;
}

/* ============================================================
   TABS
   ============================================================ */

.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 560;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.tab-btn:hover { color: var(--text-2); background: var(--bg); }

.tab-btn.tab-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 640;
}

.tab-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r-xs); }

.tab-btn--link { text-decoration: none; color: inherit; }
.tab-btn--link:hover { text-decoration: none; }

/* ============================================================
   PATIENT FORM LAYOUT
   ============================================================ */

.form-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Photo aside ── */
.form-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 78px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.photo-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.photo-preview {
  width: 110px;
  height: 130px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 3rem;
  color: var(--placeholder);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-btn { width: 100%; justify-content: center; }

.expediente-card {
  background: var(--blue-tint);
  border: 1px solid oklch(88% 0.055 245);
  border-radius: var(--r);
  padding: 14px 16px;
  text-align: center;
}

.expediente-pending {
  background: var(--bg);
  border-color: var(--border-subtle);
}

.expediente-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.expediente-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.expediente-pending .expediente-value { color: var(--muted); font-weight: 500; }

.aside-info-card {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r);
  padding: 11px 14px;
}

.aside-info-label {
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.aside-info-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  line-height: 1.35;
  word-break: break-word;
}

/* ── Form main ── */
.form-main {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 24px 26px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

/* ============================================================
   ALERT BARS
   ============================================================ */

.alert-success-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--success-tint);
  border: 1px solid oklch(82% 0.080 152);
  border-radius: var(--r-sm);
  color: oklch(34% 0.12 152);
  font-size: 0.875rem;
  font-weight: 560;
  padding: 11px 16px;
  margin-bottom: 18px;
}

.alert-error-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  color: oklch(38% 0.16 22);
  font-size: 0.875rem;
  font-weight: 560;
  padding: 11px 16px;
  margin-bottom: 18px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.input-icon-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 380px;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.input-icon-wrap .form-control {
  padding-left: 34px;
}

/* ============================================================
   TABLE UTILITIES
   ============================================================ */

.col-actions {
  width: 96px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--blue-tint-2);
  border: 1px solid oklch(85% 0.065 248);
  color: var(--blue);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  text-decoration: none;
  touch-action: manipulation;
}

.btn-icon:hover {
  background: var(--blue-tint-2);
  border-color: var(--blue-light);
  color: var(--blue-dark);
  box-shadow: 0 2px 8px oklch(50% 0.22 255 / 18%);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-icon:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.btn-icon-danger {
  background: var(--danger-tint);
  border-color: oklch(88% 0.065 22);
  color: var(--danger);
}

.btn-icon-danger:hover {
  background: oklch(95% 0.040 22);
  border-color: oklch(78% 0.105 22);
  color: oklch(45% 0.190 22);
  box-shadow: 0 2px 8px oklch(54% 0.205 24 / 18%);
  transform: translateY(-1px);
}

.btn-icon-danger:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-icon-danger:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* ── Btn-icon: success (verde — activar) ── */
.btn-icon-success {
  background: oklch(96% 0.040 145);
  border-color: oklch(83% 0.080 145);
  color: oklch(38% 0.145 145);
}
.btn-icon-success:hover {
  background: oklch(92% 0.065 145);
  border-color: oklch(72% 0.130 145);
  color: oklch(30% 0.165 145);
  box-shadow: 0 2px 8px oklch(44% 0.150 145 / 18%);
  transform: translateY(-1px);
}
.btn-icon-success:active  { transform: translateY(0); box-shadow: none; }
.btn-icon-success:focus-visible { outline: 2px solid oklch(50% 0.165 145); outline-offset: 2px; }

/* ── Btn-icon: warning (ámbar — desactivar) ── */
.btn-icon-warning {
  background: oklch(97% 0.038 75);
  border-color: oklch(85% 0.090 75);
  color: oklch(42% 0.130 72);
}
.btn-icon-warning:hover {
  background: oklch(93% 0.060 75);
  border-color: oklch(74% 0.140 74);
  color: oklch(34% 0.150 70);
  box-shadow: 0 2px 8px oklch(55% 0.140 72 / 18%);
  transform: translateY(-1px);
}
.btn-icon-warning:active  { transform: translateY(0); box-shadow: none; }
.btn-icon-warning:focus-visible { outline: 2px solid oklch(55% 0.140 72); outline-offset: 2px; }

.badge-exp {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 680;
  background: var(--blue-tint-2);
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.text-mono {
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
  font-size: 0.825rem;
}

/* ============================================================
   SPINNER (submit loading)
   ============================================================ */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  cursor: pointer;
  min-height: 32px;
  transition: background var(--t-fast), color var(--t-fast);
}

.btn-ghost:hover { background: var(--bg); color: var(--text-2); }

.text-muted { color: var(--muted) !important; }

/* ============================================================
   RESPONSIVE — PATIENT FORM
   ============================================================ */

@media (max-width: 900px) {
  .form-layout {
    grid-template-columns: 1fr;
  }
  .form-aside {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .photo-card { flex-direction: row; text-align: left; gap: 14px; padding: 14px; width: auto; flex: 1; min-width: 240px; }
  .expediente-card { flex: 1; min-width: 180px; }
}

@media (max-width: 640px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .form-group--wide { grid-column: span 1; }
  .form-main { padding: 18px 16px; }
}

@media (max-width: 480px) {
  .search-bar { flex-direction: column; align-items: stretch; }
  .input-icon-wrap { max-width: 100%; }
}

/* ============================================================
   PATIENT LIST — enriched table
   ============================================================ */

.pac-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.pac-list-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 3px;
}

.pac-list-count {
  font-size: 0.855rem;
  color: var(--muted);
  margin: 0;
}

.pac-list-count strong { color: var(--text-2); font-weight: 650; }

/* ── Search bar ── */
.pac-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.pac-search-wrap {
  position: relative;
  flex: 1;
}

.pac-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.pac-search-input {
  padding-left: 38px;
  padding-right: 36px;
  height: 42px;
  font-size: 0.9rem;
}

.pac-search-clear {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: color var(--t-fast), background var(--t-fast);
}

.pac-search-clear:hover { color: var(--danger); background: var(--danger-tint); }

/* ── Table container ── */
.pac-list {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* ── Table ── */
.pac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  color: var(--text);
}

.pac-table thead tr {
  background: oklch(97.5% 0.007 248);
  border-bottom: 1.5px solid var(--border);
}

.pac-table thead th {
  padding: 11px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}

.pac-row td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.pac-row:last-child td { border-bottom: none; }

.pac-row {
  transition: background 0.1s ease;
}

.pac-row:hover td { background: var(--blue-tint); }

/* ── Patient identity cell ── */
.pac-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 220px;
}

.pac-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  user-select: none;
}

/* Sex-based avatar colors — all low-saturation, calm */
.pac-avatar--h {
  background: oklch(91% 0.038 230);
  color: oklch(34% 0.095 230);
}

.pac-avatar--m {
  background: oklch(92% 0.032 358);
  color: oklch(38% 0.085 358);
}

.pac-avatar--x {
  background: oklch(91% 0.010 248);
  color: oklch(40% 0.018 248);
}

.pac-avatar--photo {
  object-fit: cover;
  display: block;
}

.pac-identity-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pac-name {
  font-weight: 650;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.pac-curp-small {
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── Demographic cell ── */
.pac-demograficos {
  font-size: 0.845rem;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Muted cells (phone, date) ── */
.pac-cell-muted {
  color: var(--text-2);
  font-size: 0.845rem;
}

.pac-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Institution badge ── */
.badge-inst {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.03em;
  background: var(--blue-tint-2);
  color: var(--blue-dark);
  white-space: nowrap;
}

/* ============================================================
   FORM — 2-column grid variant
   ============================================================ */

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}

/* ============================================================
   FORM — Responsable / alert section
   ============================================================ */

.form-section--alert:not([hidden]) {
  background: oklch(97.5% 0.022 72);
  border: 1px solid oklch(87% 0.062 72);
  border-radius: var(--r);
  padding: 18px 20px;
}

.form-section--alert:not([hidden]) legend {
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: oklch(48% 0.100 72);
  border-bottom-color: oklch(85% 0.068 72);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

/* ============================================================
   FORM — Sticky save bar
   ============================================================ */

.form-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  margin: 8px -20px 0;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.btn-save {
  min-width: 160px;
  font-size: 0.9rem;
  font-weight: 650;
}

/* ============================================================
   RESPONSIVE — PATIENT LIST
   ============================================================ */

/* Semantic column-hiding classes — used in thead th and tbody td */
@media (max-width: 1100px) {
  .col-hide-lg { display: none; }
}

@media (max-width: 900px) {
  .col-hide-md { display: none; }
  .pac-name { max-width: 180px; }
}

@media (max-width: 600px) {
  .col-hide-sm { display: none; }
  .pac-search   { flex-direction: column; }
  .pac-list-header { flex-wrap: wrap; }
  .pac-curp-small  { display: none; }
}

/* ============================================================
   PAGINATION BAR
   ============================================================ */

.pac-list:has(+ .pac-pagination) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.pac-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-top: 1.5px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.pac-pag-info {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pac-pag-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pac-pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.pac-pag-btn:hover {
  background: var(--blue-tint);
  color: var(--blue-dark);
  border-color: var(--blue-tint-2);
  text-decoration: none;
}

.pac-pag-btn--active {
  background: var(--blue);
  color: oklch(99% 0.005 240);
  border-color: var(--blue);
  font-weight: 650;
}

.pac-pag-btn--active:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: oklch(99% 0.005 240);
}

.pac-pag-btn--disabled {
  color: var(--border);
  cursor: default;
  pointer-events: none;
}

.pac-pag-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 32px;
  font-size: 0.8rem;
  color: var(--muted);
  user-select: none;
}

.pac-pag-size {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pac-pag-size-lbl {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.pac-pag-size-sel {
  height: 30px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7a99' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.pac-pag-size-sel:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(55% 0.22 255 / 15%);
}

@media (max-width: 600px) {
  .pac-pagination {
    flex-direction: column;
    align-items: center;
  }
  .pac-pag-info { order: 3; }
  .pac-pag-controls { order: 1; }
  .pac-pag-size { order: 2; }
  .pac-pag-btn { min-width: 36px; height: 36px; }
}

@media (max-width: 700px) {
  .pac-search   { flex-direction: column; }
  .pac-list-header { flex-wrap: wrap; }
  .form-grid-2  { grid-template-columns: 1fr; }
  .form-actions-bar { margin: 8px -16px -18px; padding: 12px 16px; }
}

/* ============================================================
   PATIENT FORM — New layout (pac-form-* / pf-*)
   ============================================================ */

/* ── Page header ── */
.pac-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.pac-form-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 4px;
}

.pac-form-header p {
  font-size: 0.845rem;
  color: var(--muted);
  margin: 0;
}

.pac-form-exp-top {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── Two-column layout: aside + form ── */
.pac-form-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Aside column ── */
.pac-form-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 78px;
}

/* ── Key-value summary card below photo ── */
.pac-aside-summary {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r);
  padding: 4px 14px;
}

.pac-aside-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 0;
}

.pac-aside-row + .pac-aside-row {
  border-top: 1px solid var(--border-subtle);
}

.pac-aside-lbl {
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pac-aside-val {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.pac-aside-exp {
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
  color: var(--blue-dark);
  font-size: 0.875rem;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

/* ── Form main panel ── */
.pac-form-main {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 20px 20px 0;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

/* ── pf-section: card-like labeled fieldset ── */
.pf-section {
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--blue);
  border-radius: var(--r);
  padding: 0;
  margin: 0 0 14px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.pf-section legend {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue-dark);
  padding: 8px 14px;
  margin-bottom: 0;
  width: 100%;
  background: var(--blue-tint);
  border-bottom: 1px solid oklch(89% 0.070 250);
  float: none;
  display: block;
  line-height: 1.4;
}

.pf-section > .pf-grid { padding: 14px 14px 12px; }

/* ── Teal variant — clinical / health fields ── */
.pf-section--teal { border-top-color: var(--teal); }
.pf-section--teal legend {
  color: var(--teal-dark);
  background: var(--teal-tint);
  border-bottom-color: oklch(87% 0.065 196);
}

/* ── Vital variant — blood type ── */
.pf-section--vital { border-top-color: var(--danger); }
.pf-section--vital legend {
  color: oklch(40% 0.185 24);
  background: var(--danger-tint);
  border-bottom-color: oklch(88% 0.055 24);
}

/* ── Legal capacity variant — always visible ── */
.pf-section--legal {
  border-top-color: oklch(56% 0.155 278);
}

.pf-section--legal legend {
  color: oklch(38% 0.148 278);
  background: oklch(96% 0.038 278);
  border-bottom-color: oklch(88% 0.058 278);
}

/* ── Alert variant — responsable/tutor (conditional) ── */
.pf-section--alert:not([hidden]) {
  border-color: oklch(87% 0.065 72);
  border-top-color: var(--warning);
  background: oklch(98.5% 0.014 72);
}

.pf-section--alert:not([hidden]) legend {
  color: oklch(40% 0.110 72);
  background: oklch(94% 0.042 72);
  border-bottom: 1px solid oklch(85% 0.068 72);
}

/* ── pf-label: compact field label ── */
.pf-label {
  font-size: 0.78rem;
  font-weight: 620;
  color: var(--text-2);
  margin-bottom: 4px;
  display: block;
}

.pf-label.required::after {
  content: ' *';
  color: var(--danger);
  font-weight: 700;
}

/* ── pf-input / pf-select: 36px compact controls ── */
.pf-input {
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-size: 0.875rem;
  padding: 7px 11px;
  min-height: 36px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
  font-family: inherit;
}

.pf-input::placeholder { color: var(--placeholder); }

.pf-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(55% 0.195 248 / 12%);
  background: var(--surface);
  outline: none;
}

.pf-input.is-invalid { border-color: var(--danger); }
.pf-input.text-uppercase { text-transform: uppercase; }
.pf-input--readonly {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  color: var(--text-2);
  cursor: default;
  pointer-events: none;
  border-color: var(--border-subtle);
}

.pf-select {
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-size: 0.875rem;
  padding: 7px 30px 7px 11px;
  min-height: 36px;
  color: var(--text);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.pf-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px oklch(55% 0.195 248 / 12%);
  outline: none;
}

/* ── pf-grid: responsive field grids ── */
.pf-grid { display: grid; gap: 10px 14px; }

.pf-grid-1 { grid-template-columns: 1fr; }
.pf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.pf-grid-4 { grid-template-columns: repeat(4, 1fr); }

.pf-span-1  { grid-column: span 1; }
.pf-span-2  { grid-column: span 2; }
.pf-span-all { grid-column: 1 / -1; }

/* ── pf-row-2: two pf-sections side by side ── */
.pf-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* ============================================================
   RESPONSIVE — PATIENT FORM (pac-form layout)
   ============================================================ */

@media (max-width: 1100px) {
  .pac-form-layout { grid-template-columns: 190px 1fr; gap: 16px; }
  .pf-grid-4       { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .pac-form-layout  { grid-template-columns: 1fr; }
  .pac-form-aside   { position: static; flex-direction: row; flex-wrap: wrap; }
  .photo-card       { flex-direction: row; text-align: left; gap: 14px; padding: 14px; flex: 1; min-width: 240px; }
  .pac-aside-summary { flex: 1; min-width: 200px; flex-direction: row; flex-wrap: wrap; padding: 4px 10px; }
  .pac-aside-row    { flex: 1; min-width: 120px; border-top: none; padding: 5px 4px; }
  .pf-row-2         { grid-template-columns: 1fr; }
  .pf-grid-4        { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .pf-grid-2, .pf-grid-4 { grid-template-columns: 1fr; }
  .pf-span-2  { grid-column: span 1; }
  .pac-form-main    { padding: 16px 16px 0; }
  .form-actions-bar { margin: 8px -16px 0; padding: 12px 16px; border-radius: 0; }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9000;
  max-width: 380px;
  width: calc(100vw - 40px);
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px 13px 16px;
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: all;
  opacity: 0;
  transform: translateX(16px);
}

.app-toast--in  { animation: toast-in  0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.app-toast--out { animation: toast-out 0.18s ease-in forwards; }

@keyframes toast-in  { to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.app-toast--success {
  background: oklch(98% 0.020 152);
  border: 1px solid oklch(80% 0.090 152);
  color: oklch(28% 0.125 152);
}

.app-toast--error {
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  color: oklch(34% 0.165 22);
}

.app-toast--warning {
  background: oklch(97.5% 0.022 72);
  border: 1px solid oklch(87% 0.062 72);
  color: oklch(38% 0.100 72);
}

.app-toast--info {
  background: var(--blue-tint);
  border: 1px solid var(--blue-tint-2);
  color: var(--blue-dark);
}

.app-toast > i:first-child { font-size: 1rem; flex-shrink: 0; }

.app-toast-msg { flex: 1; }

.app-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: 0.45;
  padding: 4px 5px;
  border-radius: var(--r-xs);
  transition: opacity var(--t-fast), background var(--t-fast);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 1;
}

.app-toast-close:hover { opacity: 1; background: oklch(0% 0 0 / 8%); }

@media (max-width: 500px) {
  .toast-container { top: 12px; right: 12px; left: 12px; max-width: none; width: auto; }
}

/* ============================================================
   CONFIRMATION MODAL
   ============================================================ */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: oklch(8% 0.015 248 / 45%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8500;
  padding: 20px;
  animation: overlay-fade-in 0.16s ease;
}

@keyframes overlay-fade-in { from { opacity: 0; } to { opacity: 1; } }

.confirm-dialog {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-md), 0 20px 60px oklch(0% 0 0 / 18%);
  text-align: center;
  animation: dialog-pop-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialog-pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--border-subtle);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 18px;
}

.confirm-icon--danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.confirm-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 7px;
  letter-spacing: -0.01em;
}

.confirm-msg {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 24px;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── Danger button (used by confirm modal) ── */
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: oklch(99% 0.003 22);
  font-weight: 600;
}

.btn-danger:hover:not(:disabled) {
  background: oklch(48% 0.185 22);
  border-color: oklch(48% 0.185 22);
  color: oklch(99% 0.003 22);
}

.btn-danger:focus-visible {
  box-shadow: 0 0 0 3px oklch(55% 0.190 22 / 22%);
}

/* ============================================================
   MÓDULO AGENDA — CITAS MÉDICAS
   ============================================================ */

/* ── Barra de filtros ── */
.cita-filtros {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.cita-filtros-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.cita-filtro-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}

.cita-filtro-lbl {
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cita-filtro-btns {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding-bottom: 0;
}

/* ── Badges de estatus ── */
.cita-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cita-badge--prog {
  background: var(--blue-tint-2);
  color: var(--blue-dark);
}

.cita-badge--conf {
  background: var(--teal-tint-2);
  color: var(--teal-dark);
}

.cita-badge--enc {
  background: oklch(92% 0.068 145);
  color: oklch(34% 0.120 145);
}

.cita-badge--comp {
  background: oklch(90% 0.080 148);
  color: oklch(30% 0.130 148);
}

.cita-badge--canc {
  background: var(--danger-tint);
  color: oklch(42% 0.185 22);
}

.cita-badge--nsp {
  background: var(--warning-tint);
  color: oklch(40% 0.120 72);
}

/* ── Responsive filtros ── */
@media (max-width: 700px) {
  .cita-filtros-grid { flex-direction: column; }
  .cita-filtro-item  { min-width: 100%; }
  .cita-filtro-btns  { flex-direction: row; width: 100%; }
}

/* ── Día de la semana badge ── */
.badge-dia {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-xs);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-dia--lab {
  background: var(--blue-tint-2);
  color: oklch(32% 0.175 255);
  border: 1px solid oklch(85% 0.065 248);
}
.badge-dia--fin {
  background: oklch(96% 0.030 22);
  color: oklch(42% 0.135 22);
  border: 1px solid oklch(88% 0.065 22);
}

/* ── Fila inactiva ── */
.row-inactiva {
  opacity: .6;
}
.row-inactiva:hover {
  opacity: .85;
}

/* ── Panel formulario colapsable (Relaciones / Horarios) ── */
.admin-panel-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px oklch(20% 0.02 240 / 6%);
}
.admin-panel-form-inner {
  padding: 20px 24px 24px;
}
.admin-panel-form-title {
  font-size: .95rem;
  font-weight: 650;
  color: var(--text-1);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-panel-form-title i {
  color: var(--blue);
  font-size: 1.05rem;
}

/* ══════════════════════════════════════════════════════════════
   AGENDA — barra de estadísticas
══════════════════════════════════════════════════════════════ */
.agenda-stats-bar {
  display: flex;
  gap: 14px;
  margin: 20px 0 4px;
  flex-wrap: wrap;
}
.agenda-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  flex: 1;
  min-width: 150px;
}
.agenda-stat--blue {
  background: var(--blue-tint-2);
  border-color: oklch(87% 0.060 248);
}
.agenda-stat--teal {
  background: var(--teal-tint-2);
  border-color: oklch(87% 0.055 185);
}
.agenda-stat--amber {
  background: oklch(97% 0.036 75);
  border-color: oklch(88% 0.075 72);
}
.agenda-stat-icon {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
}
.agenda-stat--blue  .agenda-stat-icon { color: var(--blue); }
.agenda-stat--teal  .agenda-stat-icon { color: var(--teal-dark); }
.agenda-stat--amber .agenda-stat-icon { color: oklch(46% 0.155 68); }
.agenda-stat-body   { display: flex; flex-direction: column; }
.agenda-stat-num {
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.02em;
}
.agenda-stat--blue  .agenda-stat-num { color: oklch(32% 0.175 255); }
.agenda-stat--teal  .agenda-stat-num { color: var(--teal-dark); }
.agenda-stat--amber .agenda-stat-num { color: oklch(40% 0.150 68); }
.agenda-stat-lbl {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════
   AGENDA — tabs de vista
══════════════════════════════════════════════════════════════ */
.agenda-vista-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.agenda-vista-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: .875rem;
  font-weight: 550;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color .15s, background .15s;
}
.agenda-vista-tab:hover {
  color: var(--text-1);
  background: var(--surface-raised);
}
.agenda-vista-tab.active {
  color: var(--blue);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  font-weight: 650;
}

/* ══════════════════════════════════════════════════════════════
   AGENDA — navegación semana / mes
══════════════════════════════════════════════════════════════ */
.agenda-semana-nav,
.agenda-cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.agenda-nav-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.agenda-semana-rango,
.agenda-cal-titulo {
  font-size: .95rem;
  font-weight: 650;
  color: var(--text-1);
  min-width: 210px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   AGENDA — vista semana
══════════════════════════════════════════════════════════════ */
.agenda-semana {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agenda-semana-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .875rem;
  padding: 24px 0;
}
.agenda-dia-bloque {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.agenda-dia-bloque--hoy {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.agenda-dia-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}
.agenda-dia-nombre {
  font-size: .8rem;
  font-weight: 650;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  min-width: 60px;
}
.agenda-dia-num {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--text-1);
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.agenda-dia-num--hoy {
  background: var(--blue);
  color: #fff;
}
.agenda-dia-mes {
  font-size: .78rem;
  color: var(--muted);
}
.agenda-dia-count {
  margin-left: auto;
  background: var(--blue-tint-2);
  color: oklch(32% 0.175 255);
  border: 1px solid oklch(85% 0.065 248);
  font-size: .72rem;
  font-weight: 650;
  padding: 1px 8px;
  border-radius: 99px;
}
.agenda-dia-empty {
  padding: 12px 16px;
  font-size: .825rem;
  color: var(--muted);
  font-style: italic;
}
.semana-cita {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.semana-cita:last-child { border-bottom: none; }
.semana-cita-hora {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 3px;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.semana-cita-body { flex: 1; min-width: 0; }
.semana-cita-pac {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.semana-cita-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.semana-cita-actions {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  align-items: flex-start;
}

/* ══════════════════════════════════════════════════════════════
   AGENDA — vista mes (calendario)
══════════════════════════════════════════════════════════════ */
.agenda-calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.agenda-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day-header {
  padding: 8px 4px;
  text-align: center;
  font-size: .72rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-height: 90px;
  padding: 6px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  position: relative;
  transition: background .15s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell--vacia { background: oklch(98% 0.004 240); }
.cal-cell.today { background: var(--blue-tint-2); }
.cal-cell.has-appts { background: oklch(97.5% 0.010 248); }
.cal-cell.today.has-appts { background: oklch(94% 0.030 248); }
.cal-cell.has-appts:hover { background: oklch(94% 0.030 248); }
.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 4px;
}
.cal-cell.today .cal-day-num {
  background: var(--blue);
  color: #fff;
}
.cal-appts { display: flex; flex-direction: column; gap: 3px; }
.cal-appt-chip {
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  background: oklch(32% 0.175 255);
  color: #fff;
  white-space: nowrap;
  text-align: center;
}
.cal-appt-chip--pend {
  background: oklch(46% 0.155 68);
}

/* ── Responsive agenda ── */
@media (max-width: 600px) {
  .agenda-stats-bar { gap: 8px; }
  .agenda-stat { padding: 10px 14px; gap: 10px; min-width: 120px; }
  .agenda-stat-num { font-size: 1.4rem; }
  .agenda-vista-tab { padding: 7px 12px; font-size: .8rem; }
  .agenda-cal-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-cell { min-height: 60px; padding: 4px; }
  .cal-day-num { font-size: .7rem; width: 20px; height: 20px; }
  .cal-appt-chip { font-size: .6rem; }
  .semana-cita-hora { min-width: 70px; }
}

/* ============================================================
   PATIENT LIST — Card layout (doctor-optimized)
   ============================================================ */

.pac-avatar--lg {
  width: 40px;
  height: 40px;
  font-size: .82rem;
  font-weight: 750;
  flex-shrink: 0;
}

.pac-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.pac-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
  position: relative;
}
.pac-card:last-child { border-bottom: none; }
.pac-card:hover { background: var(--blue-tint); }

.pac-card-avatar { flex-shrink: 0; }

.pac-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pac-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pac-card-name {
  font-size: .92rem;
  font-weight: 680;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.pac-card-exp {
  font-size: .70rem;
  flex-shrink: 0;
}

.pac-card-curp {
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
  font-size: .69rem;
  color: var(--muted);
  letter-spacing: .03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.pac-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  min-width: 0;
}

.pac-meta-sep {
  color: var(--muted);
  font-size: .68rem;
  opacity: .5;
  flex-shrink: 0;
  user-select: none;
}

.pac-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .75rem;
  color: var(--text-2);
  white-space: nowrap;
}
.pac-card-chip i { font-size: .68rem; color: var(--muted); }

.pac-card-chip--demo {
  color: var(--blue-dark);
  font-weight: 600;
}
.pac-card-chip--demo i { color: var(--blue); }

.pac-card-actions {
  flex-shrink: 0;
}

.pac-card-date {
  font-size: .70rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

/* ── Pagination after cards ── */
.pac-cards-grid:has(+ .pac-pagination) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

/* ── Responsive card ── */
@media (max-width: 900px) {
  .pac-card-name { max-width: 200px; }
}

@media (max-width: 640px) {
  .pac-card { gap: 8px; padding: 8px 12px; }
  .pac-card-name { font-size: .86rem; max-width: 150px; }
  .pac-card-curp { display: none; }
  .pac-meta-sep:first-of-type { display: none; }
}

/* ── /Pacientes: móvil — solo nombre completo + acciones ── */
/* Foto, expediente, edad, celular pasan a segundo término en pantallas pequeñas. */
@media (max-width: 600px) {
  /* Ocultar elementos secundarios */
  .pac-card-avatar  { display: none; }
  .pac-card-meta    { display: none; }
  .pac-card-exp     { display: none; }   /* número de expediente en name-row */

  /* Reorden: nombre completo a la izquierda, acciones a la derecha */
  .pac-card-body    { order: -1; }       /* body sube antes de actions en el flex */
  .pac-card-actions { flex-shrink: 0; }

  /* Nombre: ancho completo, wrap en lugar de ellipsis */
  .pac-card-name {
    max-width: none;
    white-space: normal;
    font-size: .875rem;
    line-height: 1.35;
  }
}

/* ============================================================
   NETWORK OFFLINE TOAST (global — todas las páginas)
   ============================================================ */
.net-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 4px 20px oklch(14% 0.04 252 / 35%);
  transition: transform .22s ease-out, opacity .18s ease-out;
  pointer-events: none;
  white-space: nowrap;
  font-family: inherit;
  max-width: calc(100vw - 32px);
}
.net-toast.net-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.net-toast--offline {
  background: oklch(34% 0.12 48);
  color: oklch(97% 0.04 72);
  border: 1px solid oklch(44% 0.16 48);
}
.net-toast--online {
  background: oklch(38% 0.11 152);
  color: oklch(97% 0.04 152);
  border: 1px solid oklch(48% 0.14 152);
}
.net-toast i { font-size: 1rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   CITAS HOY — card layout on mobile (≤600px)
   Transforms the appointments table into stacked cards so the
   patient name is always visible and there is no horizontal clip.
══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Make table elements behave as block/grid containers */
  .citas-hoy-list .pac-table,
  .citas-hoy-list .pac-table tbody { display: block; }

  .citas-hoy-list .pac-table thead { display: none; }

  /* Each row becomes a 2-column grid card */
  .citas-hoy-list .pac-table tbody tr.pac-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    padding: 12px 14px;
    gap: 5px 8px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .citas-hoy-list .pac-table tbody tr.pac-row:last-child { border-bottom: none; }
  .citas-hoy-list .pac-table tbody tr.pac-row td {
    padding: 0;
    border: none;
    vertical-align: unset;
  }

  /* ── td 1: col-actions → row 3, full width ── */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(1) {
    grid-column: 1 / -1;
    grid-row: 3;
    width: auto;       /* reset the 96px fixed width */
  }

  /* ── td 2: folio → hidden (secondary info, saves space) ── */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(2) { display: none; }

  /* ── td 3: fecha/hora → row 2, full width ── */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  /* ── td 4: paciente → row 1, left column ── (PRINCIPAL) ── */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(4) {
    grid-column: 1;
    grid-row: 1;
    overflow: hidden;
    min-width: 0;
  }

  /* ── td 5 / col-hide-sm: already hidden at ≤600px by existing rule ── */

  /* ── td 7: estatus → row 1, right column ── */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(7) {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  /* Fix: remove min-width so identity doesn't overflow grid cell */
  .citas-hoy-list .pac-identity { min-width: 0; gap: 8px; }

  /* Fix: patient name — use all available space, truncate with ellipsis */
  .citas-hoy-list .pac-identity .pac-name {
    max-width: none;
    font-size: .875rem;
  }

  /* Show time info in the fecha/hora cell (overrides global hide at ≤600px) */
  .citas-hoy-list .pac-table tbody tr.pac-row td:nth-child(3) .pac-curp-small {
    display: block;
  }

  /* Action buttons wrap to multiple lines if many buttons */
  .citas-hoy-list .row-actions { flex-wrap: wrap; gap: 4px; }
}
