/**
 * AniLovet Web – Sistema de diseño (Parte V ANALISIS_MODULO_CLINICO)
 * Tema claro/oscuro, layout 3 columnas estilo WhatsApp Desktop.
 */
:root {
  /* Light theme (default) */
  --sidebar-icon: #3a3d42;
  --sidebar-icon-muted: #5f6368;
  --sidebar-icon-hover: #1a1d21;
  --surface-primary: #FAFBFC;
  --surface-secondary: #F0F2F5;
  --surface-sidebar: #F7F8FA;
  --surface-elevated: #FFFFFF;
  --border-subtle: #E4E6EB;
  --border-strong: #D0D3D9;
  --text-primary: #1C1E21;
  --text-secondary: #65676B;
  --text-tertiary: #8A8D91;
  /* Marca AniLovet (logo naranja / origami) */
  --brand-primary: #EA580C;
  --brand-hover: #C2410C;
  --brand-muted: #FFEDD5;
  --accent-blue: #F97316;
  --accent-green: #31A24C;
  --accent-amber: #E6A23C;
  --accent-red: #D93025;
  --overlay: rgba(0, 0, 0, 0.45);
  /* Campos de formulario (pestaña General, etc.): en claro igual que tarjeta */
  --surface-input: var(--surface-elevated);
  /* Botones de acción (Guardar, Cancelar, Editar…): azul tipo chip / pestaña */
  --btn-blue-solid-top: #3b82f6;
  --btn-blue-solid-bottom: #2563eb;
  --btn-blue-solid-border: #1d4ed8;
  --btn-blue-soft-bg: color-mix(in srgb, #2563eb 13%, var(--surface-elevated));
  --btn-blue-soft-bg-hover: color-mix(in srgb, #2563eb 22%, var(--surface-elevated));
  --btn-blue-soft-border: color-mix(in srgb, #2563eb 40%, var(--border-subtle));
  --btn-blue-soft-text: #1d4ed8;
  --btn-blue-ghost-bg: color-mix(in srgb, #2563eb 9%, var(--surface-elevated));
  --btn-blue-ghost-border: color-mix(in srgb, #2563eb 32%, var(--border-subtle));
  /* Descartar / Cerrar: chip gris neutro */
  --btn-muted-text: #4b5563;
  --btn-muted-bg: color-mix(in srgb, var(--text-secondary) 10%, var(--surface-elevated));
  --btn-muted-bg-hover: color-mix(in srgb, var(--text-secondary) 18%, var(--surface-elevated));
  --btn-muted-border: color-mix(in srgb, var(--text-tertiary) 45%, var(--border-subtle));
}

[data-theme="dark"] {
  --sidebar-icon: #9ca8b0;
  --sidebar-icon-muted: #6a757c;
  --sidebar-icon-hover: #e4e9ec;
  /* rail < lista < lienzo; --surface-elevated: cabecera, pestañas, modales, ítem activo, tarjetas de registro y campos de detalle */
  --surface-primary: #121212;
  --surface-secondary: #161618;
  --surface-sidebar: #060607;
  --surface-elevated: #151515;
  --border-subtle: #2a2a2a;
  --border-strong: #3a3a3a;
  --text-primary: #eaeaea;
  --text-secondary: #949494;
  --text-tertiary: #6a6a6a;
  --brand-primary: #FB923C;
  --brand-hover: #FDBA74;
  --brand-muted: #422006;
  --accent-blue: #FB923C;
  --accent-green: #3FB950;
  --accent-amber: #D29922;
  --accent-red: #F85149;
  --overlay: rgba(0, 0, 0, 0.68);
  /* Por debajo de --surface-elevated para inputs sobre bloques de detalle */
  --surface-input: #0c0c0c;
  --btn-blue-solid-top: #3b82f6;
  --btn-blue-solid-bottom: #2563eb;
  --btn-blue-solid-border: #60a5fa;
  --btn-blue-soft-bg: color-mix(in srgb, #3b82f6 18%, var(--surface-elevated));
  --btn-blue-soft-bg-hover: color-mix(in srgb, #3b82f6 28%, var(--surface-elevated));
  --btn-blue-soft-border: color-mix(in srgb, #60a5fa 42%, var(--border-subtle));
  --btn-blue-soft-text: #93c5fd;
  --btn-blue-ghost-bg: color-mix(in srgb, #3b82f6 12%, var(--surface-elevated));
  --btn-blue-ghost-border: color-mix(in srgb, #60a5fa 35%, var(--border-subtle));
  --btn-muted-text: #b4bcc8;
  --btn-muted-bg: color-mix(in srgb, var(--text-secondary) 14%, var(--surface-elevated));
  --btn-muted-bg-hover: color-mix(in srgb, var(--text-secondary) 24%, var(--surface-elevated));
  --btn-muted-border: color-mix(in srgb, var(--text-tertiary) 50%, var(--border-subtle));
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Source Sans 3', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface-primary);
  -webkit-font-smoothing: antialiased;
}
#root { min-height: 100vh; }

/* Typography */
.typo-display { font-size: 28px; font-weight: 600; line-height: 1.25; }
.typo-h1 { font-size: 22px; font-weight: 600; line-height: 1.3; }
.typo-h2 { font-size: 17px; font-weight: 600; line-height: 1.35; }
.typo-body { font-size: 15px; font-weight: 400; line-height: 1.5; }
.typo-body-small { font-size: 13px; font-weight: 400; line-height: 1.4; color: var(--text-secondary); }
.typo-caption { font-size: 12px; font-weight: 400; line-height: 1.33; color: var(--text-tertiary); }
.typo-overline { font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: 0.5px; color: var(--text-secondary); }

/* Spacing: 4px base */
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

/* Buttons — píldora reconocible; primario relleno azul, secundario/ghost chip con borde y velo translúcido */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background-color 160ms ease-out,
    color 160ms ease-out,
    border-color 160ms ease-out,
    box-shadow 160ms ease-out,
    filter 160ms ease-out;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}
/* Primario: azul sólido + brillo interno (excepto login Google y destructivo) */
.btn-primary:not(.login-google):not(.btn-danger) {
  color: #ffffff;
  background: linear-gradient(180deg, var(--btn-blue-solid-top) 0%, var(--btn-blue-solid-bottom) 100%);
  border-color: var(--btn-blue-solid-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 2px color-mix(in srgb, var(--btn-blue-solid-bottom) 28%, transparent);
}
.btn-primary:not(.login-google):not(.btn-danger):hover:not(:disabled) {
  color: #ffffff;
  filter: brightness(1.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 6px color-mix(in srgb, var(--btn-blue-solid-bottom) 35%, transparent);
}
.btn-primary:not(.login-google):not(.btn-danger):focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--btn-blue-solid-top) 55%, transparent);
}
/* Neutro: descartar cambios, cerrar sin abortar flujo rojo */
.btn-muted {
  color: var(--btn-muted-text);
  background: var(--btn-muted-bg);
  border-color: var(--btn-muted-border);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
[data-theme="dark"] .btn-muted {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-muted:hover:not(:disabled) {
  color: var(--btn-muted-text);
  background: var(--btn-muted-bg-hover);
  border-color: var(--border-strong);
}
.btn-muted:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--text-secondary) 45%, transparent);
}
[data-theme="dark"] .btn-muted:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--text-secondary) 40%, transparent);
}
/* Secundario: chip azul translúcido (Guardar, invitar, acciones principales no destructivas) */
.btn-secondary {
  color: var(--btn-blue-soft-text);
  background: var(--btn-blue-soft-bg);
  border-color: var(--btn-blue-soft-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
[data-theme="dark"] .btn-secondary {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover:not(:disabled) {
  color: var(--btn-blue-soft-text);
  background: var(--btn-blue-soft-bg-hover);
  border-color: color-mix(in srgb, var(--btn-blue-solid-top) 55%, var(--border-subtle));
}
.btn-secondary:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--btn-blue-solid-top) 45%, transparent);
}
[data-theme="dark"] .btn-secondary:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--btn-blue-solid-top) 50%, transparent);
}
/* Ghost: más ligero pero sigue leyéndose como control (Editar en tablas, etc.) */
.btn-ghost {
  color: var(--btn-blue-soft-text);
  background: var(--btn-blue-ghost-bg);
  border-color: var(--btn-blue-ghost-border);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
[data-theme="dark"] .btn-ghost {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--btn-blue-soft-text);
  background: var(--btn-blue-soft-bg-hover);
  border-color: var(--btn-blue-soft-border);
}
.btn-ghost:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--btn-blue-solid-top) 40%, transparent);
}
/* Login: Google — contraste alto (texto blanco sobre naranja profundo; logo multicolor sobre chip blanco) */
.btn-primary.login-google {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 10px;
  color: #ffffff;
  background: #c2410c;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary.login-google:hover:not(:disabled) {
  background: #9a3412;
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.18);
}
.btn-primary.login-google:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px rgba(234, 88, 12, 0.55);
}
[data-theme="dark"] .btn-primary.login-google {
  background: #ea580c;
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .btn-primary.login-google:hover:not(:disabled) {
  background: #f97316;
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .btn-primary.login-google:focus-visible {
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px rgba(251, 146, 60, 0.55);
}
/* Acción destructiva en modal: relleno rojo sólido (base secondary o primary + btn-danger) */
.btn-primary.btn-danger,
.btn-secondary.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: color-mix(in srgb, #000 22%, var(--accent-red));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 1px 2px color-mix(in srgb, var(--accent-red) 35%, transparent);
}
.btn-primary.btn-danger:hover:not(:disabled),
.btn-secondary.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
  color: #fff;
}
.btn-secondary.btn-danger:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--accent-red) 50%, transparent);
}
.btn-icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sidebar-icon);
}
.btn-icon:hover:not(:disabled) {
  color: var(--sidebar-icon-hover);
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-muted);
}

/* Inputs */
.input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.input.readonly-system-id {
  cursor: default;
  opacity: 0.95;
  color: var(--text-secondary);
}
[data-theme="dark"] .input.readonly-system-id {
  background: #141414;
  color: #a3a3a3;
  border-color: var(--border-strong);
}
.input:disabled {
  cursor: not-allowed;
  opacity: 0.9;
  color: var(--text-secondary);
  background: var(--surface-secondary);
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-muted);
}
/* Textareas en modales (paciente, registro, cita): solo redimensionar altura */
textarea.input {
  resize: vertical;
  max-width: 100%;
  min-width: 0;
}

/* Pages: full-screen centered (login, select-group) */
.page-standalone {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface-primary);
}
.page-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-elevated);
  border-radius: 12px;
  box-shadow: 0 2px 12px var(--overlay);
  padding: 32px;
  border: 1px solid var(--border-subtle);
}

/* Login — landing coherente con clínica (marca, confianza, apps) */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 40px);
  background: var(--surface-primary);
  overflow-x: hidden;
}
/* Tema: mismo comportamiento sol/luna que la barra lateral de la clínica */
.login-theme-toggle {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 20;
  width: 44px;
  min-width: 44px;
  height: 44px;
  color: var(--sidebar-icon);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 14px color-mix(in srgb, var(--text-primary) 8%, transparent);
}
.login-theme-toggle:hover:not(:disabled) {
  color: var(--sidebar-icon-hover);
  background: color-mix(in srgb, var(--text-primary) 5%, var(--surface-elevated));
}
.login-theme-toggle .sidebar-icon {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}
.login-theme-toggle .theme-icon-sun {
  display: none;
}
.login-theme-toggle .theme-icon-moon {
  display: block;
}
[data-theme="dark"] .login-theme-toggle .theme-icon-moon {
  display: none;
}
[data-theme="dark"] .login-theme-toggle .theme-icon-sun {
  display: block;
}
.login-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 15% 10%, color-mix(in srgb, var(--brand-primary) 12%, transparent), transparent 55%),
    radial-gradient(ellipse 100% 70% at 90% 85%, color-mix(in srgb, var(--brand-muted) 50%, transparent), transparent 50%),
    linear-gradient(180deg, var(--surface-primary) 0%, var(--surface-secondary) 100%);
}
[data-theme="dark"] .login-backdrop {
  background:
    radial-gradient(ellipse 120% 80% at 15% 10%, color-mix(in srgb, var(--brand-primary) 18%, transparent), transparent 55%),
    radial-gradient(ellipse 100% 70% at 90% 80%, color-mix(in srgb, var(--brand-muted) 35%, transparent), transparent 50%),
    linear-gradient(180deg, var(--surface-primary) 0%, #0a0a0a 100%);
}
.login-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1040px;
}
.login-inner {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 380px);
  gap: clamp(28px, 5vw, 56px);
  align-items: stretch;
}
@media (max-width: 880px) {
  .login-inner {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
    align-items: start;
  }
}
.login-brand {
  padding-top: 8px;
  min-width: 0;
}
.login-brand-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--brand-primary) 22%, transparent);
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
}
.login-kicker {
  margin: 0 0 4px;
  color: var(--brand-primary);
  letter-spacing: 0.06em;
}
.login-brand-title {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.login-lede {
  margin: 0 0 20px;
  color: var(--text-primary);
  max-width: 52ch;
}
.login-lede strong {
  font-weight: 600;
  color: var(--text-primary);
}
.login-scope-note {
  margin: 0 0 22px;
  max-width: 52ch;
  padding: 16px 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-elevated) 82%, var(--brand-muted));
  border: 1px solid var(--border-subtle);
}
[data-theme="dark"] .login-scope-note {
  background: color-mix(in srgb, var(--surface-elevated) 88%, var(--brand-muted));
}
.login-scope-note-title {
  margin: 0 0 10px;
  color: var(--brand-primary);
  letter-spacing: 0.06em;
}
.login-scope-note-text {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}
.login-scope-note-text strong {
  color: var(--text-primary);
  font-weight: 600;
}
.login-feature-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 52ch;
}
.login-feature-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.login-feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand-muted) 55%, var(--surface-elevated));
  color: var(--brand-primary);
  border: 1px solid var(--border-subtle);
}
[data-theme="dark"] .login-feature-icon {
  background: color-mix(in srgb, var(--brand-muted) 40%, var(--surface-elevated));
}
/* Testimonio promocional (mismas fotos y textos que la web corporativa) */
.login-testimonial {
  margin: 0;
  max-width: 52ch;
}
.login-testimonial-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-elevated) 88%, var(--brand-muted));
  border: 1px solid var(--border-subtle);
}
[data-theme="dark"] .login-testimonial-inner {
  background: var(--surface-elevated);
}
.login-testimonial-avatar {
  width: 80px;
  height: 80px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}
.login-testimonial-quote {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 14px;
  line-height: 1.55;
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
}
@media (max-width: 480px) {
  .login-testimonial-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}
.login-card {
  width: 100%;
  min-width: 0;
  background: var(--surface-elevated);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 32px);
  border: 1px solid var(--border-subtle);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text-primary) 4%, transparent),
    0 16px 48px -12px color-mix(in srgb, var(--text-primary) 12%, transparent);
}
@media (min-width: 881px) {
  .login-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    align-self: stretch;
  }
}
[data-theme="dark"] .login-card {
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 6%, transparent),
    0 24px 56px -16px rgba(0, 0, 0, 0.55);
}
.login-card-top {
  flex-shrink: 0;
}
.login-card-apps {
  flex-shrink: 0;
}
@media (min-width: 881px) {
  .login-card-apps {
    margin-top: auto;
    padding-top: 12px;
  }
}
.login-card-title {
  margin: 0 0 8px;
  text-align: center;
}
.login-card-sub {
  margin: 0 0 12px;
  text-align: center;
  color: var(--text-secondary);
}
.login-card-hint {
  margin: 0 0 20px;
  text-align: center;
  color: var(--text-tertiary);
  line-height: 1.45;
}
.login-card-hint strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.login-google {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
}
.login-google img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  padding: 4px;
  box-sizing: content-box;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}
[data-theme="dark"] .login-google img {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 18px;
  color: var(--text-tertiary);
}
.login-card-apps .login-divider {
  margin-top: 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.login-divider-text {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-tertiary);
}
.login-apps-label {
  margin: 0 0 14px;
  text-align: center;
  color: var(--text-secondary);
}
.login-apps-row {
  justify-content: stretch;
  margin-bottom: 12px;
}
.login-apps-row .subscription-store-btn {
  flex: 1;
  min-width: 140px;
}
.login-apps-note {
  margin: 0;
  text-align: center;
  color: var(--text-tertiary);
  max-width: none;
}
.login-footer-note {
  margin: clamp(28px, 5vw, 40px) auto 0;
  max-width: 42rem;
  text-align: center;
  color: var(--text-tertiary);
  line-height: 1.45;
}
.login-faq-link-wrap {
  margin: clamp(16px, 3vw, 24px) auto 0;
  max-width: 42rem;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.45;
}
.login-faq-link {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}
.login-faq-link:hover {
  text-decoration: underline;
  color: var(--brand-hover);
}
.login-faq-link:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Página FAQ (standalone faq.html) */
.faq-page-shell {
  align-items: flex-start;
  padding-top: max(72px, env(safe-area-inset-top, 0px));
  padding-bottom: clamp(32px, 6vw, 48px);
}
.faq-main {
  padding-top: 0;
}
.faq-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto 20px;
  max-width: 640px;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
}
button.faq-back-link {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  text-align: left;
}
.faq-back-link:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}
.faq-back-link:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
  border-radius: 4px;
}
.faq-article {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  background: var(--surface-elevated);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--border-subtle);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text-primary) 4%, transparent),
    0 16px 48px -12px color-mix(in srgb, var(--text-primary) 12%, transparent);
}
[data-theme="dark"] .faq-article {
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 6%, transparent),
    0 24px 56px -16px rgba(0, 0, 0, 0.55);
}
.faq-article > h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
.faq-article > .faq-lede {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.faq-toc {
  margin: 0 0 28px;
  padding: 16px 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-secondary) 65%, var(--surface-elevated));
  border: 1px solid var(--border-subtle);
}
.faq-toc-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.faq-toc ul {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.faq-toc li {
  margin-bottom: 6px;
}
.faq-toc li:last-child {
  margin-bottom: 0;
}
.faq-toc a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}
.faq-toc a:hover {
  text-decoration: underline;
  color: var(--brand-hover);
}
.faq-section {
  margin-bottom: 28px;
}
.faq-section:last-child {
  margin-bottom: 0;
}
.faq-section h2 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}
.faq-subheading {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}
.faq-section p,
.faq-section li {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.faq-section p:last-child {
  margin-bottom: 0;
}
.faq-section ul {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}
.faq-section li:last-child {
  margin-bottom: 0;
}
.faq-plan-table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}
.faq-plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface-elevated);
}
.faq-plan-table th,
.faq-plan-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.faq-plan-table th {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface-secondary) 70%, var(--surface-elevated));
}
.faq-plan-table tr:last-child td {
  border-bottom: none;
}
.faq-note {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.faq-note a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}
.faq-note a:hover {
  text-decoration: underline;
  color: var(--brand-hover);
}
.faq-article .faq-outro {
  margin-top: 28px;
  margin-bottom: 0;
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
}
.faq-article .faq-outro a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}
.faq-article .faq-outro a:hover {
  text-decoration: underline;
  color: var(--brand-hover);
}

/* Select group */
.select-group-list { list-style: none; margin: 0; padding: 0; }
.select-group-list li {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 150ms ease-out;
  border: 1px solid transparent;
}
.select-group-list li:hover { background: var(--surface-secondary); }
.select-group-list li.selected {
  background: color-mix(in srgb, var(--brand-muted) 70%, var(--surface-elevated));
  border-color: var(--brand-primary);
  box-shadow: inset 3px 0 0 var(--brand-primary);
}
.select-group-list .name { font-weight: 600; }
.select-group-list .role { font-size: 13px; color: var(--text-secondary); }
.modal-group-list { max-height: 280px; overflow-y: auto; }

/* Layout 3 columnas (clinic) */
.clinic-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.clinic-sidebar {
  width: 60px;
  flex-shrink: 0;
  background: var(--surface-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
}
[data-theme="dark"] .clinic-sidebar {
  border-right-color: rgba(255, 255, 255, 0.045);
}
.clinic-sidebar .btn-icon.sidebar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
  background: transparent;
}
.clinic-sidebar .btn-icon.sidebar-nav-btn:hover,
.clinic-sidebar .btn-icon.sidebar-nav-btn:focus-visible {
  color: var(--sidebar-icon-hover);
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.clinic-sidebar .btn-icon.sidebar-nav-btn .sidebar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}
/* Mayor especificidad que .sidebar-icon (display:block), para no mostrar luna y sol a la vez */
.clinic-sidebar .btn-icon.sidebar-nav-btn.theme-toggle .theme-icon-sun {
  display: none;
}
.clinic-sidebar .btn-icon.sidebar-nav-btn.theme-toggle .theme-icon-moon {
  display: block;
}
[data-theme="dark"] .clinic-sidebar .btn-icon.sidebar-nav-btn.theme-toggle .theme-icon-moon {
  display: none;
}
[data-theme="dark"] .clinic-sidebar .btn-icon.sidebar-nav-btn.theme-toggle .theme-icon-sun {
  display: block;
}
.clinic-list-col {
  /* +20% respecto a 280/320 para más espacio en lista de pacientes */
  width: 336px;
  min-width: 336px;
  max-width: 384px;
  display: flex;
  flex-direction: column;
  background: var(--surface-secondary);
  border-right: 1px solid var(--border-subtle);
}
.clinic-list-col .search-wrap { padding: 12px; }
.clinic-list-col .list-wrap { flex: 1; overflow-y: auto; }
.clinic-detail-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface-primary);
  min-width: 0;
}
.patient-home-root {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.patient-detail-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.patient-home-inner {
  padding: 20px 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.patient-home-today {
  margin-bottom: 24px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, var(--border-subtle));
  background: linear-gradient(
    152deg,
    color-mix(in srgb, var(--brand-primary) 10%, var(--surface-elevated)) 0%,
    var(--surface-elevated) 52%,
    color-mix(in srgb, var(--brand-primary) 5%, var(--surface-elevated)) 100%
  );
  overflow: hidden;
}
.patient-home-today-inner {
  position: relative;
  padding: 18px 20px 20px 24px;
}
.patient-home-today-inner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(
    180deg,
    var(--brand-primary) 0%,
    color-mix(in srgb, var(--brand-primary) 45%, var(--surface-elevated)) 100%
  );
}
.patient-home-today-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.patient-home-today-refresh-btn {
  flex-shrink: 0;
  margin-left: auto;
}
.patient-home-today-refresh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.patient-home-today-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-primary) 14%, var(--surface-elevated));
  color: var(--brand-primary);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent);
}
.patient-home-today-icon svg {
  display: block;
}
.patient-home-today-head-text {
  flex: 1;
  min-width: 0;
}
.patient-home-today-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.patient-home-today-date-line {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: capitalize;
  line-height: 1.35;
}
.patient-home-today-body {
  padding-left: 0;
}
.patient-home-today-loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}
.patient-home-today-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border-subtle);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  flex-shrink: 0;
  animation: patient-home-today-spin 0.75s linear infinite;
}
@keyframes patient-home-today-spin {
  to {
    transform: rotate(360deg);
  }
}
.patient-home-today-loading-text {
  margin: 0;
  color: var(--text-secondary);
}
.patient-home-today-empty-msg,
.patient-home-today-error-msg {
  margin: 0;
  line-height: 1.45;
  color: var(--text-secondary);
}
.patient-home-today-error-msg {
  color: color-mix(in srgb, var(--accent-amber) 85%, var(--text-primary));
}
.patient-home-today-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: flex-start;
}
.patient-home-today-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;
  padding: 6px 4px;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
  border-radius: 12px;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}
.patient-home-today-item:hover {
  background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
}
.patient-home-today-item:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.patient-home-today-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, var(--brand-primary) 28%, var(--border-subtle));
  box-shadow: 0 2px 10px color-mix(in srgb, #000 10%, transparent);
}
/* Cita aún no pasada: anillo naranja estilo “activo” (Messenger). */
.patient-home-today-avatar.patient-home-today-avatar--upcoming {
  border-color: transparent;
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px #ff9500,
    0 2px 12px color-mix(in srgb, #ff9500 35%, transparent);
}
.patient-home-today-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.patient-home-today-avatar-placeholder {
  font-size: 34px;
  line-height: 1;
}
.patient-home-today-name {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
}
.patient-home-today-time {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.date-field-locale-hint {
  font-weight: 400;
  opacity: 0.72;
}
.date-parts-row-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* Orden visual: año → mes → día (mismo orden en DOM que en dateParts.js) */
.date-parts-row-inner .date-part-year {
  flex: 0 0 5.5rem;
  min-width: 4.5rem;
}
.date-parts-row-inner .date-part-month {
  flex: 1 1 9rem;
  min-width: 7rem;
}
.date-parts-row-inner .date-part-day {
  flex: 0 0 4.5rem;
  min-width: 3.5rem;
}
.detail-field-date-parts-wrap.date-parts-mount {
  width: 100%;
  max-width: 100%;
}
.record-next-datetime-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 4px;
}
.record-next-date-parts-grow {
  flex: 1 1 220px;
  min-width: 0;
}
.record-next-time-field {
  flex: 0 0 auto;
}
.record-next-time-field .input {
  min-width: 7.5rem;
}
input[type='date'][lang='es'],
input.detail-field-input[type='date'][lang='es'] {
  font-variant-numeric: tabular-nums;
}

.patient-home-header {
  margin-bottom: 20px;
}
.patient-home-title {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.25;
}
.patient-home-subtitle {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.4;
}
.patient-home-empty-wrap {
  padding: 32px 0;
  text-align: center;
}
.patient-home-empty {
  margin: 0;
  color: var(--text-tertiary);
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.patient-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  isolation: isolate;
}
@media (min-width: 640px) {
  .patient-home-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
}
@media (min-width: 1100px) {
  .patient-home-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }
}
.patient-home-card {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-elevated);
  cursor: pointer;
  transition: border-color 0.18s ease, outline-color 0.18s ease;
  text-align: left;
  outline: 2px solid transparent;
  outline-offset: -1px;
}
.patient-home-card:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 42%, var(--border-subtle));
  outline-color: color-mix(in srgb, var(--brand-primary) 55%, transparent);
}
.patient-home-card:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
}
.patient-home-card-visual {
  aspect-ratio: 4 / 3;
  background: var(--brand-muted);
  position: relative;
  overflow: hidden;
}
.patient-home-card-photo-zoom {
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  transition: transform 0.24s ease;
}
.patient-home-card:hover .patient-home-card-photo-zoom {
  transform: translate3d(0, 0, 0) scale(1.14);
}
@media (prefers-reduced-motion: reduce) {
  .patient-home-card-photo-zoom {
    transition: none;
  }
  .patient-home-card:hover .patient-home-card-photo-zoom {
    transform: translate3d(0, 0, 0) scale(1);
  }
}
.patient-home-card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  mix-blend-mode: normal;
}
.patient-home-card-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  line-height: 1;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--brand-primary) 12%, var(--brand-muted)) 0%,
    var(--brand-muted) 100%
  );
}
.patient-home-card-body {
  padding: 12px 14px 14px;
}
.patient-home-card-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.patient-home-card-meta {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Fila nombre + PDF a la derecha (misma altura que raza / tutor) */
.patient-home-card-subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-height: 0;
}
.patient-home-card-meta-col {
  flex: 1;
  min-width: 0;
}
.patient-home-card-meta-col .patient-home-card-meta {
  margin-top: 0;
}
.patient-home-card-meta-col .patient-home-card-meta + .patient-home-card-meta {
  margin-top: 2px;
}
.patient-home-card-pdf-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: 5px;
}
.patient-home-card-body > .patient-home-card-meta--muted {
  margin-top: 4px;
}
.patient-home-card-meta--muted {
  color: var(--text-tertiary);
  font-size: 12px;
}
.patient-home-card-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-list-home-btn {
  flex-shrink: 0;
}
.patient-list-home-btn.is-active {
  background: color-mix(in srgb, var(--brand-primary) 14%, var(--surface-elevated));
  border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--border-strong));
  color: var(--brand-primary);
}
.patient-list-home-btn.is-active:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand-primary) 20%, var(--surface-elevated));
  color: var(--brand-primary);
}
.clinic-members-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-groups-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-dashboard-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-calendar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-settings-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-subscriptions-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* min-height: 0: sin esto, el flex no encoge y el contenido largo se corta abajo (overflow:hidden del padre). */
  min-height: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-finance-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
.clinic-owners-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-primary);
}
/* La columna del dashboard solo debe ocupar espacio en ese módulo (openDashboardModule quita .hidden). */
.clinic-layout:not([data-module="dashboard"]) .clinic-dashboard-col {
  display: none !important;
}
.clinic-layout:not([data-module="calendar"]) .clinic-calendar-col {
  display: none !important;
}
.clinic-layout:not([data-module="settings"]) .clinic-settings-col {
  display: none !important;
}
.clinic-layout:not([data-module="subscriptions"]) .clinic-subscriptions-col {
  display: none !important;
}
.clinic-layout:not([data-module="finance"]) .clinic-finance-col {
  display: none !important;
}
.clinic-layout:not([data-module="owners"]) .clinic-owners-col {
  display: none !important;
}
.clinic-layout[data-module="members"] .clinic-list-col,
.clinic-layout[data-module="members"] .clinic-detail-col,
.clinic-layout[data-module="groups"] .clinic-list-col,
.clinic-layout[data-module="groups"] .clinic-detail-col,
.clinic-layout[data-module="groups"] .clinic-members-col,
.clinic-layout[data-module="dashboard"] .clinic-list-col,
.clinic-layout[data-module="dashboard"] .clinic-detail-col,
.clinic-layout[data-module="dashboard"] .clinic-members-col,
.clinic-layout[data-module="dashboard"] .clinic-groups-col,
.clinic-layout[data-module="calendar"] .clinic-list-col,
.clinic-layout[data-module="calendar"] .clinic-detail-col,
.clinic-layout[data-module="calendar"] .clinic-members-col,
.clinic-layout[data-module="calendar"] .clinic-groups-col,
.clinic-layout[data-module="calendar"] .clinic-dashboard-col,
.clinic-layout[data-module="settings"] .clinic-list-col,
.clinic-layout[data-module="settings"] .clinic-detail-col,
.clinic-layout[data-module="settings"] .clinic-members-col,
.clinic-layout[data-module="settings"] .clinic-groups-col,
.clinic-layout[data-module="settings"] .clinic-dashboard-col,
.clinic-layout[data-module="settings"] .clinic-calendar-col,
.clinic-layout[data-module="subscriptions"] .clinic-list-col,
.clinic-layout[data-module="subscriptions"] .clinic-detail-col,
.clinic-layout[data-module="subscriptions"] .clinic-members-col,
.clinic-layout[data-module="subscriptions"] .clinic-groups-col,
.clinic-layout[data-module="subscriptions"] .clinic-dashboard-col,
.clinic-layout[data-module="subscriptions"] .clinic-calendar-col,
.clinic-layout[data-module="subscriptions"] .clinic-settings-col,
.clinic-layout[data-module="subscriptions"] .clinic-finance-col {
  display: none;
}
.clinic-layout[data-module="subscriptions"] .clinic-owners-col {
  display: none;
}
.clinic-layout[data-module="finance"] .clinic-list-col,
.clinic-layout[data-module="finance"] .clinic-detail-col,
.clinic-layout[data-module="finance"] .clinic-members-col,
.clinic-layout[data-module="finance"] .clinic-groups-col,
.clinic-layout[data-module="finance"] .clinic-dashboard-col,
.clinic-layout[data-module="finance"] .clinic-calendar-col,
.clinic-layout[data-module="finance"] .clinic-settings-col,
.clinic-layout[data-module="finance"] .clinic-subscriptions-col {
  display: none;
}
.clinic-layout[data-module="finance"] .clinic-owners-col {
  display: none;
}
.clinic-layout[data-module="finance"] .clinic-finance-col {
  display: flex !important;
}
.clinic-layout[data-module="owners"] .clinic-list-col,
.clinic-layout[data-module="owners"] .clinic-detail-col,
.clinic-layout[data-module="owners"] .clinic-members-col,
.clinic-layout[data-module="owners"] .clinic-groups-col,
.clinic-layout[data-module="owners"] .clinic-dashboard-col,
.clinic-layout[data-module="owners"] .clinic-calendar-col,
.clinic-layout[data-module="owners"] .clinic-settings-col,
.clinic-layout[data-module="owners"] .clinic-subscriptions-col,
.clinic-layout[data-module="owners"] .clinic-finance-col {
  display: none;
}
.clinic-layout[data-module="owners"] .clinic-owners-col {
  display: flex !important;
}
.clinic-layout[data-module="members"] .clinic-members-col {
  display: flex !important;
}
.clinic-layout[data-module="groups"] .clinic-groups-col {
  display: flex !important;
}
.clinic-layout[data-module="dashboard"] .clinic-dashboard-col {
  display: flex !important;
}
.clinic-layout[data-module="calendar"] .clinic-calendar-col {
  display: flex !important;
}
.clinic-layout[data-module="settings"] .clinic-settings-col {
  display: flex !important;
}
.clinic-layout[data-module="subscriptions"] .clinic-subscriptions-col {
  display: flex !important;
}

/* Módulo tutores / clientes (columna principal) */
.owners-module-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.owners-module-head {
  padding: 24px 24px 0;
  flex-shrink: 0;
}
.owners-module-head .typo-h2 {
  margin: 0 0 6px;
}
.owners-module-lede {
  margin: 0 0 14px;
  color: var(--text-secondary);
}
.owners-module-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.owners-module-toolbar .input {
  flex: 1;
  min-width: 180px;
}
.owners-module-loading {
  padding: 8px 24px 0;
}
.owners-module-root {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 28px;
}
.owners-module-row .owners-module-row-main {
  flex: 1;
  min-width: 0;
}
.owners-module-row-actions {
  flex-shrink: 0;
  padding-top: 2px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Finanzas del grupo (ingresos / gastos) */
.finance-module-root {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 32px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.finance-header {
  margin-bottom: 20px;
  width: 100%;
  max-width: none;
}
.finance-body {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}
.finance-form-grid {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 10px 16px;
  align-items: center;
  margin-top: 8px;
}
@media (max-width: 640px) {
  .finance-form-grid {
    grid-template-columns: 1fr;
  }
}
.finance-form-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.finance-list-title {
  margin: 24px 0 12px;
  font-size: 1.1rem;
}
.finance-income-toolbar,
.finance-expense-toolbar {
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.finance-income-list-toolbar,
.finance-expense-list-toolbar {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-elevated));
}
.finance-income-list-filter-row,
.finance-expense-list-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.finance-income-list-filter-row .input,
.finance-expense-list-filter-row .input {
  min-width: 100px;
  max-width: 160px;
}
.finance-income-list-hint,
.finance-expense-list-hint {
  margin: 10px 0 0;
  color: var(--text-tertiary);
}
.finance-income-list-totals,
.finance-expense-list-totals {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
}
.finance-income-list-totals-label,
.finance-expense-list-totals-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 8px;
}
.finance-income-list-totals-value,
.finance-expense-list-totals-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.finance-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}
.finance-cell-desc {
  max-width: 220px;
  word-break: break-word;
}
.finance-cell-actions {
  white-space: nowrap;
}

/* Finanzas — cobros por día (vista compacta tipo lista) */
.finance-panel-daily {
  margin-top: 4px;
  width: 100%;
  max-width: 560px;
}
.finance-daily-lede {
  margin: 0 0 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.finance-daily-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.finance-daily-year-nav {
  min-width: 40px;
  padding: 8px 10px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 10px;
}
.finance-daily-year-select {
  min-width: 100px;
  max-width: 140px;
  font-weight: 700;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
}
.finance-daily-range {
  margin: 0 0 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}
.finance-daily-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.finance-daily-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.finance-daily-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.finance-daily-dot--col {
  background: #15803d;
  box-shadow: 0 0 0 1px color-mix(in srgb, #15803d 35%, transparent);
}
.finance-daily-dot--rec {
  background: #c2410c;
  box-shadow: 0 0 0 1px color-mix(in srgb, #c2410c 35%, transparent);
}
.finance-daily-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.finance-daily-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}
.finance-daily-month-card {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 88%, var(--surface-elevated));
  overflow: hidden;
}
.finance-daily-month-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, #15803d 10%, var(--surface-elevated));
  border-bottom: 1px solid var(--border-subtle);
}
.finance-daily-month-title {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}
.finance-daily-month-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.finance-daily-month-empty {
  margin: 0;
  padding: 10px 12px 12px;
  color: var(--text-tertiary);
}
.finance-daily-day-list {
  padding: 4px 0 6px;
}
.finance-daily-day-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid color-mix(in srgb, var(--border-subtle) 70%, transparent);
}
.finance-daily-day-row:first-child {
  border-top: none;
}
.finance-daily-day-row--tappable {
  cursor: pointer;
  border-radius: 8px;
  margin: 2px -4px;
  padding-left: 16px;
  padding-right: 16px;
  transition: background 0.12s ease;
}
.finance-daily-day-row--tappable:hover {
  background: color-mix(in srgb, var(--surface-hover, #f4f4f5) 85%, transparent);
}
.finance-daily-day-row--tappable:focus-visible {
  outline: 2px solid var(--brand-primary, #15803d);
  outline-offset: 2px;
}
[data-theme="dark"] .finance-daily-day-row--tappable:hover {
  background: color-mix(in srgb, var(--surface-hover) 60%, transparent);
}
.finance-daily-detail-empty {
  margin: 0;
  color: var(--text-tertiary);
}
.finance-daily-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(58vh, 440px);
  overflow-y: auto;
}
.finance-daily-detail-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 70%, transparent);
}
.finance-daily-detail-item:last-child {
  border-bottom: none;
}
.finance-daily-detail-item-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.finance-daily-detail-desc {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}
.finance-daily-detail-patient-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  line-height: 1.35;
}
.finance-daily-detail-patient-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.finance-daily-detail-patient-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  word-break: break-word;
}
[data-theme="dark"] .finance-daily-detail-patient-name {
  color: var(--text-primary);
}
.finance-daily-detail-meta {
  color: var(--text-tertiary);
}
.finance-daily-detail-item-amts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.finance-daily-day-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  flex: 1;
}
.finance-daily-day-amts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.finance-daily-num {
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.finance-daily-num--col {
  color: #166534;
}
.finance-daily-num--rec {
  color: #c2410c;
  font-size: 0.84rem;
}
[data-theme="dark"] .finance-daily-num--col {
  color: #4ade80;
}
[data-theme="dark"] .finance-daily-num--rec {
  color: #fb923c;
}
[data-theme="dark"] .finance-daily-month-head {
  background: color-mix(in srgb, #15803d 16%, var(--surface-elevated));
}
[data-theme="dark"] .finance-daily-dot--col {
  background: #4ade80;
}
[data-theme="dark"] .finance-daily-dot--rec {
  background: #fb923c;
}
.finance-daily-footnote {
  margin: 14px 0 0;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* Finanzas — resumen (gráficas por mes) */
.finance-module-root .inner-tabs.finance-inner-tabs {
  margin: 0 0 16px 0;
  flex-wrap: wrap;
  max-width: 100%;
}
.finance-panel-summary {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.finance-summary-intro {
  margin: 0 0 14px;
  color: var(--text-secondary);
}
.finance-summary-filter {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-elevated));
}
.finance-summary-filter-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  align-items: center;
}
@media (min-width: 800px) {
  .finance-summary-filter-row {
    grid-template-columns: auto 1fr auto 1fr auto 1fr;
  }
}
.finance-summary-error {
  margin: 10px 0 0;
  color: var(--danger, #c62828);
}
.finance-summary-loading {
  margin: 10px 0 0;
  color: var(--text-secondary);
}
.finance-summary-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.finance-kpi {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.finance-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.finance-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.finance-kpi--income .finance-kpi-value {
  color: color-mix(in srgb, #2e7d32 88%, var(--text-primary));
}
.finance-kpi--expense .finance-kpi-value {
  color: color-mix(in srgb, #c62828 88%, var(--text-primary));
}
.finance-kpi--balance.finance-kpi--pos .finance-kpi-value {
  color: color-mix(in srgb, #2e7d32 88%, var(--text-primary));
}
.finance-kpi--balance.finance-kpi--neg .finance-kpi-value {
  color: color-mix(in srgb, #c62828 88%, var(--text-primary));
}
.finance-summary-charts-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}
.finance-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}
.finance-chart-doughnut-hint {
  margin: 0 0 10px;
  color: var(--text-secondary);
}
.finance-chart-card--doughnut .finance-chart-container--doughnut {
  position: relative;
  min-height: 280px;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}
.finance-chart-card {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  padding: 14px 12px 12px;
  min-height: 220px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.finance-chart-card--chartjs {
  min-height: 0;
}
.finance-chart-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.finance-chart-empty {
  margin: auto 0;
  text-align: center;
  color: var(--text-tertiary);
}
/* Misma idea que `.chart-container` en `backend-stripe/public/admin/index.html` */
.finance-chart-container {
  position: relative;
  flex: 1;
  min-height: 220px;
  width: 100%;
  min-width: 0;
}
@media (max-width: 640px) {
  .finance-chart-container {
    min-height: 200px;
  }
}

/* Módulo suscripción (portal): ancho completo de la columna clínica */
.subscription-module-root {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 32px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.subscription-module-inner {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.subscription-module-header {
  margin-bottom: 20px;
}
.subscription-header-user {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  min-width: 0;
}
.subscription-header-photo-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
}
.subscription-header-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.subscription-header-user-info {
  min-width: 0;
  flex: 1;
}
.subscription-header-user-name {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
.subscription-header-user-email,
.subscription-header-user-placeholder {
  margin: 0;
  color: var(--text-secondary);
}
.subscription-module-header .typo-h1 {
  margin: 0 0 8px;
}
.subscription-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.subscription-card-ok {
  border-left: 3px solid var(--accent-green);
}
.subscription-card-error {
  border-left: 3px solid var(--accent-red);
}
.subscription-card-muted {
  opacity: 0.95;
}
.subscription-card-tester-expired {
  border-left: 3px solid var(--accent-amber);
  background: color-mix(in srgb, var(--accent-amber) 6%, var(--surface-elevated));
}
.subscription-card-danger {
  border-left: 3px solid var(--accent-red);
  background: color-mix(in srgb, var(--accent-red) 7%, var(--surface-elevated));
}
.subscription-tester-expired-lead {
  margin-top: 0;
  color: var(--text-primary);
}
.subscription-tester-dl {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 120px) 1fr;
  gap: 6px 14px;
  align-items: start;
}
.subscription-tester-dl dt {
  margin: 0;
  color: var(--text-tertiary);
  font-weight: 500;
}
.subscription-tester-dl dd {
  margin: 0;
  min-width: 0;
}
.subscription-tester-footnote {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.subscription-tester-footnote a {
  color: var(--brand-primary);
  font-weight: 500;
}
.subscription-tester-footnote a:hover {
  color: var(--brand-hover);
}
@media (max-width: 480px) {
  .subscription-tester-dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .subscription-tester-dl dt {
    margin-top: 8px;
  }
  .subscription-tester-dl dt:first-of-type {
    margin-top: 0;
  }
}
.subscription-plan-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.subscription-plan-row:last-of-type {
  border-bottom: none;
}
.subscription-links-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.subscription-pay-link {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.subscription-footnote {
  margin-top: 8px;
  width: 100%;
  max-width: none;
}

.subscription-intro-crossplatform strong {
  font-weight: 600;
  color: var(--brand-primary);
}

.subscription-stores-footer {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}
.subscription-stores-footer-title {
  margin: 0 0 14px;
  color: var(--text-secondary);
}
.subscription-stores-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}
.subscription-store-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
}
.subscription-store-btn:hover {
  background: var(--surface-secondary);
  border-color: var(--border-strong);
  color: var(--text-primary);
  text-decoration: none;
}
.subscription-store-btn .subscription-store-icon {
  flex-shrink: 0;
  opacity: 0.92;
}
.subscription-store-btn--disabled,
.subscription-store-btn--disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface-secondary);
  border-color: var(--border-subtle);
  color: var(--text-tertiary);
}
.subscription-stores-footer-note {
  margin: 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.subscription-legal-footer {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}
.subscription-legal-footer-title {
  margin: 0 0 14px;
  color: var(--text-secondary);
}
.subscription-legal-links {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  align-items: center;
}
.subscription-legal-links a {
  color: var(--brand-primary);
  text-decoration: none;
  font-size: 14px;
}
.subscription-legal-links a:hover {
  text-decoration: underline;
  color: var(--brand-hover);
}
.subscription-support-block {
  margin: 0;
  line-height: 1.5;
  color: var(--text-primary);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.subscription-support-email {
  font-weight: 600;
  color: var(--brand-primary);
  word-break: break-all;
}
.subscription-support-email:hover {
  color: var(--brand-hover);
}

.subscription-page-footer .subscription-card-danger {
  margin-top: 28px;
  text-align: left;
}

@media (max-width: 480px) {
  .subscription-stores-row {
    flex-direction: column;
    align-items: stretch;
  }
  .subscription-store-btn {
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }
}

.subscription-card-pricing-table {
  width: 100%;
  max-width: none;
}
.subscription-pricing-table-host {
  margin-top: 12px;
  min-height: 320px;
  width: 100%;
}
.subscription-pricing-table-host stripe-pricing-table {
  display: block;
  width: 100%;
  max-width: none;
}

/*
 * La tabla de precios de Stripe va en iframe con fondo claro y no hereda data-theme.
 * Invertimos colores solo en modo oscuro del sitio (sin tocar si usas idDark nativo en JS).
 */
[data-theme="dark"] .subscription-pricing-table-host:not(.subscription-pricing-table-host--stripe-native-dark) {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-subtle);
}
[data-theme="dark"]
  .subscription-pricing-table-host:not(.subscription-pricing-table-host--stripe-native-dark)
  stripe-pricing-table {
  filter: invert(1) hue-rotate(180deg) brightness(1.03) contrast(1.02);
}

.clinic-sidebar .btn-icon.sidebar-nav-btn.is-active {
  background: var(--brand-muted);
  color: var(--brand-primary);
}
.clinic-sidebar .btn-icon.sidebar-nav-btn.is-active:hover {
  color: var(--brand-hover);
}
.clinic-detail-col .header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  flex-shrink: 0;
}
.header-patient-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-patient-back {
  flex-shrink: 0;
  align-self: center;
}
.header-patient-back-icon {
  display: block;
  pointer-events: none;
}
.header-patient-photo-wrap {
  flex-shrink: 0;
}
.header-patient-photo-wrap.hidden { display: none !important; }
/* Foto ~40% del tamaño anterior (56px → 22px) para header más compacto */
.header-patient-photo {
  width: calc(56px * 0.4);
  height: calc(56px * 0.4);
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-muted);
  display: block;
}
.header-patient-info {
  min-width: 0;
  flex: 1;
}
.clinic-detail-col .header .header-patient-info .typo-h1 {
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 2px;
}
.clinic-detail-col .header .header-patient-info .typo-body-small {
  margin: 0;
  line-height: 1.35;
  font-size: 13px;
}
.clinic-detail-col .tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  flex-shrink: 0;
}
.clinic-detail-col .tab {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}
.clinic-detail-col .tab:hover { color: var(--text-primary); }
.clinic-detail-col .tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }
.clinic-detail-col .content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
}
/* Paneles del detalle: ocupan la altura disponible; PDF y General delegan scroll al hijo */
.clinic-detail-col .content > [id^='panel-'] {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#panel-general.detail-general,
#panel-pdf.detail-pdf-panel,
#panel-map.detail-map-panel {
  overflow: hidden;
}
#panel-general #detail-general-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
#panel-general .cta-new-record {
  flex-shrink: 0;
}
#panel-records,
#panel-appointments,
#panel-finance {
  overflow-y: auto;
}

/* Patient list item */
.patient-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 16px;
  flex-wrap: nowrap;
}
.patient-list-toolbar .patient-list-toolbar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}
.patient-list-add-btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  justify-content: flex-start;
  padding-left: 10px;
  padding-right: 12px;
}
.patient-list-add-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.patient-list-refresh-btn {
  flex-shrink: 0;
}
.patient-list-refresh-btn.is-loading:disabled {
  opacity: 1;
  cursor: wait;
}
.patient-list-refresh-spinner {
  display: block;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 2.5px solid var(--border-subtle);
  border-top-color: var(--btn-blue-soft-text);
  border-radius: 50%;
  animation: patient-list-refresh-spin 0.72s linear infinite;
}
[data-theme="dark"] .patient-list-refresh-spinner {
  border-color: var(--border-strong);
  border-top-color: var(--btn-blue-soft-text);
}
@keyframes patient-list-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.patient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 150ms ease-out;
  border-left: 3px solid transparent;
}
.patient-item:hover { background: var(--surface-primary); }
.patient-item.selected { background: var(--surface-elevated); border-left-color: var(--brand-primary); }
.patient-item .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-muted);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.patient-item .avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.patient-item .info {
  min-width: 0;
  flex: 1;
}
.patient-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-item .meta { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Detail panel: patient photo */
.detail-patient-photo-wrap {
  margin-bottom: 20px;
}
.detail-patient-photo {
  display: block;
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Detail panel empty / general */
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  text-align: center;
  padding: 24px;
}
.detail-general-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
/* Foto + etapas de vida en una sola tarjeta a ancho completo */
.detail-general-photo-life-stage-row {
  grid-column: 1 / -1;
  margin-top: 5px;
}
.detail-general-photo-life-stage-row.detail-card-field {
  min-height: auto;
}
.detail-general-notas-row {
  grid-column: 1 / -1;
}
.detail-general-notas-row.detail-card-field {
  min-height: auto;
}
.detail-general-photo-notes-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 14px;
  align-items: start;
}
.detail-general-photo-notes-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* Columna de foto: aire lateral (doble respecto al ajuste muy compacto anterior) */
.detail-general-photo-notes-col-photo {
  align-items: center;
  text-align: center;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding-inline: 32px;
}
.detail-general-photo-notes-col-photo .field-label {
  width: 100%;
  text-align: center;
}
.detail-general-photo-notes-col-photo .field-value {
  display: flex;
  justify-content: center;
  width: max-content;
  max-width: 100%;
}
.detail-general-photo-notes-col-life-stage .field-value {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.detail-general-life-stage-cell {
  width: 100%;
  min-width: 0;
}
.detail-life-stage-mount--in-photo-row {
  margin: 0 !important;
  width: 100%;
}
.detail-life-stage-placeholder {
  margin: 0 auto;
  max-width: 22rem;
  text-align: center;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  padding: 20px 10px;
}
.detail-life-stage-placeholder strong {
  color: var(--text-primary, #1a1a1a);
  font-weight: 600;
}
[data-theme='dark'] .detail-life-stage-placeholder {
  color: var(--text-secondary, #aaa);
}
[data-theme='dark'] .detail-life-stage-placeholder strong {
  color: var(--text-primary, #f0f0f0);
}
.detail-field-textarea-notas-bottom {
  width: 100%;
  box-sizing: border-box;
  min-height: 140px;
  resize: vertical;
}
.detail-readonly-photo-wrap {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-secondary);
  border: 3px solid var(--surface-elevated);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 1px color-mix(in srgb, var(--border-subtle) 80%, transparent);
  flex-shrink: 0;
}
[data-theme="dark"] .detail-readonly-photo-wrap {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 0 0 1px var(--border-subtle);
}
.detail-readonly-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.detail-readonly-photo-wrap--zoom {
  cursor: zoom-in;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.detail-readonly-photo-wrap--zoom:hover {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 45%, var(--border-subtle));
}
.detail-readonly-photo-wrap--zoom:focus {
  outline: none;
}
.detail-readonly-photo-wrap--zoom:focus-visible {
  box-shadow: 0 0 0 3px var(--brand-muted);
}
.detail-readonly-photo-empty {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.detail-readonly-notas {
  white-space: pre-wrap;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
}
.detail-general-photo-notes-col-photo .inline-patient-photo-block {
  align-items: center;
  height: auto;
  width: auto;
  max-width: none;
  margin-inline: 0;
}
.detail-general-photo-notes-col-photo .inline-patient-photo-actions {
  justify-content: center;
  width: 100%;
}
.detail-general .field {
  margin-bottom: 0;
}
.detail-card-field {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 84px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.detail-card-field:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}
.detail-card-field-accent {
  border-left: 3px solid var(--brand-primary);
  background: color-mix(in srgb, var(--brand-muted) 28%, var(--surface-elevated));
}
.detail-general .field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.detail-general .field-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.detail-general-fields .field-value {
  word-break: break-word;
}
.detail-field-input {
  width: 100%;
  border: 1px solid var(--border-subtle);
  background: var(--surface-input);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}
[data-theme="dark"] .detail-field-input {
  border-color: var(--border-strong);
  color-scheme: dark;
}
.detail-field-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-muted) 60%, transparent);
}
.detail-field-input-invalid {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-red) 16%, transparent);
}
.detail-field-textarea,
textarea.detail-field-input {
  resize: vertical;
  min-height: 72px;
  max-width: 100%;
  min-width: 0;
}
.detail-field-inline-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-field-inline-unit .detail-field-input {
  flex: 1;
}
.detail-field-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.detail-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
}
.ios-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.ios-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.ios-switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background-color 180ms ease;
}
.ios-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease;
}
.ios-switch input:checked + .ios-switch-track {
  background: var(--brand-primary);
}
.ios-switch input:checked + .ios-switch-track .ios-switch-thumb {
  transform: translateX(18px);
}
.ios-switch input:focus-visible + .ios-switch-track {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-muted) 65%, transparent);
}
.ios-switch-label {
  font-size: 14px;
  color: var(--text-primary);
}
.anilovet-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  padding: 4px 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.anilovet-toggle-row .ios-switch-label {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  justify-self: start;
}
.anilovet-toggle-row > .ios-switch {
  justify-self: end;
}
/* .form-grid label { display:block } rompía el interruptor iOS (label.ios-switch) */
.form-grid label.ios-switch {
  display: inline-flex !important;
  align-items: center;
  margin-bottom: 0;
  position: relative;
  flex-shrink: 0;
}
.form-grid .ios-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.detail-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.detail-inline-errors {
  margin-top: 10px;
  color: var(--accent-red);
  font-size: 13px;
  font-weight: 500;
}
.detail-inline-errors-list {
  margin: 0;
  padding-left: 18px;
}
.detail-inline-errors-list li + li {
  margin-top: 4px;
}
@media (max-width: 1120px) {
  .detail-general-fields {
    grid-template-columns: 1fr;
  }
  .detail-general-photo-notes-inner {
    grid-template-columns: 1fr;
  }
  .detail-general-photo-notes-col-photo {
    justify-self: center;
  }
}
.cta-new-record { margin-top: 24px; }

/* Finanzas: resumen por mes + pagos realizados */
.finance-section { margin-bottom: 8px; }
.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.finance-table th,
.finance-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.finance-table th { color: var(--text-secondary); font-weight: 600; }
.finance-table .finance-num { text-align: right; white-space: nowrap; }
.finance-payments .finance-table td { vertical-align: top; }

/* Citas del paciente (pestaña): lista por estado */
.patient-appointments-hint {
  margin: 0 0 16px;
  color: var(--text-tertiary);
}
.patient-appointments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.patient-appointment-row {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  background: var(--surface-elevated);
}
.patient-appointment-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 6px;
}
.patient-appointment-datetime {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.patient-appointment-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text-tertiary) 6%, transparent);
  color: var(--text-secondary);
}
.patient-appointment-motivo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.patient-appointment-notas {
  margin-top: 8px;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.patient-appointment-row--pendiente {
  border-left-color: var(--accent-amber);
  background: color-mix(in srgb, var(--accent-amber) 2%, var(--surface-elevated));
}
.patient-appointment-row--pendiente .patient-appointment-badge {
  background: color-mix(in srgb, var(--accent-amber) 7%, transparent);
  color: var(--accent-amber);
}
.patient-appointment-row--confirmada {
  border-left-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 2.5%, var(--surface-elevated));
}
.patient-appointment-row--confirmada .patient-appointment-badge {
  background: color-mix(in srgb, var(--brand-primary) 7%, transparent);
  color: var(--brand-primary);
}
.patient-appointment-row--completada {
  border-left-color: var(--accent-green);
  background: color-mix(in srgb, var(--accent-green) 2%, var(--surface-elevated));
}
.patient-appointment-row--completada .patient-appointment-badge {
  background: color-mix(in srgb, var(--accent-green) 6%, transparent);
  color: var(--accent-green);
}
.patient-appointment-row--cancelada {
  border-left-color: var(--accent-red);
  background: color-mix(in srgb, var(--accent-red) 2%, var(--surface-elevated));
}
.patient-appointment-row--cancelada .patient-appointment-badge {
  background: color-mix(in srgb, var(--accent-red) 6%, transparent);
  color: var(--accent-red);
}
.patient-appointment-row--cancelada .patient-appointment-motivo {
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-tertiary) 60%, transparent);
}
.patient-appointment-row--default {
  border-left-color: var(--border-strong);
}
.patient-appointment-row--default .patient-appointment-badge {
  background: color-mix(in srgb, var(--text-tertiary) 5%, transparent);
  color: var(--text-tertiary);
}

/* Calendario grupal (sidebar): días con citas y chips por paciente */
.group-calendar-root {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.group-calendar-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: min(360px, 55vh);
  padding: 24px 20px;
  text-align: center;
}
.group-calendar-loading-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.group-calendar-loading-icon {
  color: var(--brand-primary);
  opacity: 0.92;
  animation: group-calendar-icon-pulse 1.6s ease-in-out infinite;
}
@keyframes group-calendar-icon-pulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
.group-calendar-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--brand-primary) 22%, var(--border-subtle));
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: group-calendar-spin 0.75s linear infinite;
}
@keyframes group-calendar-spin {
  to { transform: rotate(360deg); }
}
.group-calendar-loading-text {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 280px;
  line-height: 1.45;
}
.group-cal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.group-cal-header h1 { margin: 0 0 4px; font-size: 1.35rem; }
.group-cal-header .typo-caption { margin: 0; color: var(--text-tertiary); }
.group-cal-grid-wrap { margin-bottom: 8px; }
.group-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  font-size: 12px;
}
.group-cal-dow {
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 0;
  font-size: 11px;
}
.group-cal-day {
  min-height: 76px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  padding: 5px 5px 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 3px;
  text-align: left;
  box-sizing: border-box;
}
.group-cal-day--blank {
  background: transparent;
  border-color: transparent;
  cursor: default;
  min-height: 0;
  padding: 0;
}
.group-cal-day:hover:not(.group-cal-day--blank):not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}
.group-cal-day--other-month { opacity: 0.38; }
.group-cal-day--today { box-shadow: inset 0 0 0 1px var(--brand-primary); }
.group-cal-day--selected { box-shadow: 0 0 0 2px var(--brand-primary); }
.group-cal-day--has:not(.group-cal-day--other-month) {
  background: color-mix(in srgb, var(--brand-primary) 8%, var(--surface-elevated));
}
.group-cal-day-num { font-weight: 700; font-size: 13px; line-height: 1.2; }
.group-cal-day-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  justify-content: flex-end;
}
.group-cal-chip {
  font-size: 9px;
  line-height: 1.2;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 500;
}
.group-cal-chip--0 { background: color-mix(in srgb, #2563eb 28%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--1 { background: color-mix(in srgb, #7c3aed 28%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--2 { background: color-mix(in srgb, #db2777 24%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--3 { background: color-mix(in srgb, #059669 26%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--4 { background: color-mix(in srgb, #d97706 28%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--5 { background: color-mix(in srgb, #0891b2 28%, var(--surface-secondary)); color: var(--text-primary); }
.group-cal-chip--more {
  background: var(--surface-secondary);
  color: var(--text-tertiary);
  font-weight: 600;
}
.group-cal-detail {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.group-cal-detail h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; }
.group-cal-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 14px;
  align-items: start;
  padding: 10px 12px;
  background: var(--surface-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 4px solid var(--brand-primary);
}
.group-cal-row--0 { border-left-color: #2563eb; }
.group-cal-row--1 { border-left-color: #7c3aed; }
.group-cal-row--2 { border-left-color: #db2777; }
.group-cal-row--3 { border-left-color: #059669; }
.group-cal-row--4 { border-left-color: #d97706; }
.group-cal-row--5 { border-left-color: #0891b2; }
.group-cal-row-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.group-cal-row-main { min-width: 0; }
.group-cal-row-patient { font-weight: 600; margin-bottom: 2px; }
.group-cal-row-motivo { font-size: 13px; color: var(--text-secondary); }
.group-cal-row-actions { align-self: center; }

/* Theme toggle */
.theme-toggle {
  margin-top: auto;
  padding-top: 12px;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1000;
  animation: fadeIn 150ms ease-out;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 150ms ease-out;
}
/* Por encima de .modal.modal-stacked (lista / editor de tutores, z-index 12000) */
#modal-confirm.modal {
  z-index: 12100;
}
.modal.hidden { display: none !important; }
.modal-backdrop.hidden { display: none !important; }
.modal-content {
  background: var(--surface-elevated);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px var(--overlay);
}
.modal-confirm-title {
  margin: 0 0 12px;
  font-size: 20px;
}
.modal-confirm-title.hidden { display: none !important; }
/* Paciente y registro médico: ~40% más anchos, respetando el ancho de pantalla */
.modal-content-wide {
  max-width: min(728px, 95vw);
}
.modal-content-scrollable {
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-content-scrollable .modal-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.modal-content-scrollable .modal-actions {
  flex-shrink: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Recorte foto paciente (General): misma lógica que Flutter PatientPhotoService */
.modal-patient-photo-crop-content {
  max-width: min(400px, 95vw);
}
.patient-photo-crop-intro {
  margin: 0 0 12px;
  color: var(--text-secondary);
}
.patient-photo-crop-viewport {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  height: auto;
  margin: 0 auto 12px;
  overflow: hidden;
  background: #0a0a0a;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  cursor: grab;
  touch-action: none;
}
.patient-photo-crop-viewport:active {
  cursor: grabbing;
}
.patient-photo-crop-img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
}
.patient-photo-crop-zoom-label {
  display: block;
  margin-bottom: 4px;
}
.patient-photo-crop-zoom {
  width: 100%;
  margin-bottom: 4px;
}

/* Autocompletado dueño (modal paciente): lista de dueños únicos del grupo */
.owner-autocomplete-wrap {
  position: relative;
  width: 100%;
}
.owner-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--overlay);
}
.owner-suggestions-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.owner-suggestions-item:hover,
.owner-suggestions-item:focus {
  background: var(--surface-secondary);
  outline: none;
}
.owner-suggestions-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}
/* Pestaña General: lista por encima de siguientes campos */
.detail-general-fields .owner-autocomplete-wrap .owner-suggestions {
  z-index: 80;
}
.detail-general-fields .detail-card-field:has(.patient-owner-readonly-card) {
  overflow: visible;
}

/* Tutor solo lectura (modal / ficha) + modales apilados lista/editor */
.modal.modal-stacked {
  z-index: 12000;
}
.patient-owner-readonly-card {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: color-mix(in srgb, var(--text-primary) 4%, var(--surface-primary));
}
.patient-owner-readonly-muted {
  color: var(--text-tertiary);
  margin: 0;
}
.patient-owner-readonly-name {
  font-weight: 600;
  margin: 0 0 6px;
  font-size: 15px;
}
.patient-owner-readonly-line {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.patient-owner-readonly-legacy {
  color: var(--brand-primary);
  margin: 0 0 8px;
}
.patient-owner-readonly-grid .patient-owner-readonly-card {
  grid-column: 1 / -1;
}
/* Aire lateral en el popup de tutores (lista y búsqueda alineadas) */
#modal-owners-picker .modal-body > #input-owners-picker-search {
  width: calc(100% - 20px);
  max-width: 100%;
  margin-inline: 10px;
  box-sizing: border-box;
}
#modal-owners-picker .modal-body > #owners-picker-loading {
  margin-inline: 10px;
}
#modal-owners-picker .modal-body > .typo-body-small:last-child {
  margin-inline: 10px;
}
.owners-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
  padding-inline: 10px;
  box-sizing: border-box;
}
.owners-picker-row-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.owners-picker-row-wrap.owners-module-row {
  align-items: flex-start;
}
.owners-picker-row-wrap.owners-module-row .owners-row-user-ico {
  margin-top: 3px;
}
.owners-row-user-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand-primary) 14%, var(--surface-elevated));
  color: var(--text-secondary);
  border: 1px solid color-mix(in srgb, var(--border-subtle) 80%, transparent);
  box-sizing: border-box;
}
.owners-row-user-ico svg {
  display: block;
}
.owner-patients-list-scroll {
  margin-top: 12px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 4px 2px 12px;
  box-sizing: border-box;
}
.owner-patients-modal-row {
  justify-content: flex-start;
}
.owner-patients-empty {
  margin: 8px 0 0;
  color: var(--text-tertiary);
  line-height: 1.45;
}
.owners-picker-row-wrap--selected {
  padding: 2px;
  border-radius: 10px;
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}
.owners-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-elevated);
  cursor: pointer;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: inherit;
}
.owners-picker-row:hover {
  background: var(--surface-secondary);
}
/* Filas pares: mismo tono base con variación mínima (lista tutores popup + coherencia visual) */
.owners-picker-list > .owners-picker-row-wrap:nth-child(even) .owners-picker-row {
  background: color-mix(in srgb, var(--surface-elevated) 99.6%, var(--border-subtle));
}
.owners-picker-list > .owners-picker-row-wrap:nth-child(even) .owners-picker-row:hover {
  background: var(--surface-secondary);
}
/* Lista tutores (módulo columna): banda muy suave en filas pares */
#owners-module-root > .owners-picker-row-wrap {
  padding: 6px 10px;
  border-radius: 10px;
  box-sizing: border-box;
}
#owners-module-root > .owners-picker-row-wrap:nth-child(even) {
  background: color-mix(in srgb, var(--surface-elevated) 99.6%, var(--border-subtle));
}
.owners-picker-row-main {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.owners-picker-row-title {
  font-weight: 600;
  font-size: 15px;
}
.owners-picker-row-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.owners-picker-row-edit {
  flex-shrink: 0;
}

/* Foto paciente (General, edición): avatar grande + FAB estilo perfil (Google/Meta) */
.inline-patient-photo-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  width: 100%;
  max-width: 240px;
  margin-inline: auto;
}
.inline-patient-photo-avatar-wrap {
  position: relative;
  width: 148px;
  height: 148px;
  flex-shrink: 0;
}
.inline-patient-photo-preview-box {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-secondary) 92%, var(--text-tertiary)) 0%,
    var(--surface-secondary) 100%
  );
  border: 3px solid var(--surface-elevated);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.1),
    0 0 0 1px color-mix(in srgb, var(--border-subtle) 75%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
[data-theme="dark"] .inline-patient-photo-preview-box {
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.45),
    0 0 0 1px var(--border-subtle);
}
.inline-patient-photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.inline-patient-photo-preview-img:not(.hidden) {
  cursor: zoom-in;
}
.inline-patient-photo-preview-img.hidden {
  display: none !important;
}
.inline-patient-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  color: var(--text-tertiary);
  pointer-events: none;
}
.inline-patient-photo-placeholder-icon {
  flex-shrink: 0;
  opacity: 0.55;
  color: var(--text-tertiary);
}
.inline-patient-photo-placeholder-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
}
.inline-patient-photo-fab {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #1a73e8;
  background: var(--surface-elevated);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.12),
    0 0 0 1px var(--border-subtle),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
[data-theme="dark"] .inline-patient-photo-fab {
  color: #8ab4f8;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 0 1px var(--border-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.inline-patient-photo-fab:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.16),
    0 0 0 1px color-mix(in srgb, #1a73e8 35%, var(--border-subtle)),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
[data-theme="dark"] .inline-patient-photo-fab:hover:not(:disabled) {
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, #8ab4f8 40%, var(--border-strong)),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.inline-patient-photo-fab:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, #1a73e8 45%, transparent),
    0 2px 8px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .inline-patient-photo-fab:focus-visible {
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, #8ab4f8 50%, transparent),
    0 2px 10px rgba(0, 0, 0, 0.5);
}
.inline-patient-photo-fab-icon {
  flex-shrink: 0;
  pointer-events: none;
}
.inline-patient-photo-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.inline-patient-photo-remove-link {
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-red, #b91c1c);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.inline-patient-photo-remove-link:hover:not(:disabled) {
  text-decoration: underline;
  background: color-mix(in srgb, var(--accent-red, #b91c1c) 8%, transparent);
}
.inline-patient-photo-remove-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-red, #b91c1c) 35%, transparent);
  border-radius: 8px;
}
.inline-patient-photo-remove-link.hidden {
  display: none !important;
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 16px;
  min-width: 0;
}
.form-grid-cols2 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 400px) {
  .form-grid-cols2 { grid-template-columns: 1fr; }
}
.form-grid label { display: block; margin-bottom: 2px; }
.form-section-label {
  margin-top: 20px;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-weight: 600;
}
.form-section-label:first-of-type { margin-top: 0; }

.record-modal-linked {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}
.record-modal-linked-block {
  margin-top: 10px;
}
.record-modal-linked-block:first-of-type { margin-top: 0; }
.record-modal-linked-list {
  margin: 8px 0 0 1rem;
  padding: 0;
  color: var(--text-secondary);
}
.record-modal-linked-list li { margin-bottom: 6px; }
.record-modal-linked-income strong,
.record-modal-linked-appt strong {
  color: var(--text-primary);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input-row .input { flex: 1; min-width: 0; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; }

/* Color mucosas: cuadros con nombre (key guardado, value en español) */
.mucous-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.mucous-color-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 0;
  border: 2px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-elevated);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mucous-color-box:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.mucous-color-box.selected {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-muted);
}
.mucous-color-swatch {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 6px 6px 0 0;
}
.mucous-color-label {
  display: block;
  padding: 6px 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 999px;
}
/* Peligro en línea: chip rojo translúcido (confirm modal usa .btn-primary.btn-danger = relleno sólido) */
.btn-danger:not(.btn-primary) {
  background: color-mix(in srgb, var(--accent-red) 12%, var(--surface-elevated));
  color: var(--accent-red);
  border: 1px solid color-mix(in srgb, var(--accent-red) 40%, var(--border-subtle));
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
[data-theme="dark"] .btn-danger:not(.btn-primary) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-danger:not(.btn-primary):hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-red) 22%, var(--surface-elevated));
  color: var(--accent-red);
  border-color: color-mix(in srgb, var(--accent-red) 55%, var(--border-subtle));
}
.btn-danger:not(.btn-primary):focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--accent-red) 45%, transparent);
}
/* Calendario grupal: flechas mes */
.appointments-nav-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}
.dropdown-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--overlay);
  z-index: 100;
  padding: 4px 0;
}
.dropdown-panel.hidden { display: none !important; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 150ms;
}
.dropdown-item:hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.dropdown-item-danger { color: var(--accent-red); }

.dropdown-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border-subtle, var(--border-color, rgba(128, 128, 128, 0.25)));
  border: 0;
}

.records-panel-toolbar {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Icono auto_awesome (Material), alineado con Flutter Icons.auto_awesome */
.btn-with-ai-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.btn-with-ai-icon .icon-ai-auto-awesome {
  flex-shrink: 0;
}

.btn-with-pdf-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.btn-with-pdf-icon .icon-picture-as-pdf {
  flex-shrink: 0;
}

/* Pestaña PDF: PDF.js (canvas, ajuste al ancho + zoom) con iframe como respaldo */
.detail-pdf-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.detail-pdf-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.detail-pdf-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  row-gap: 10px;
}
/* Mismo interruptor iOS que en formularios (paciente / registro) */
.detail-pdf-include-photos-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.detail-pdf-include-photos-wrap .ios-switch-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
  white-space: nowrap;
}
.detail-pdf-include-photos-wrap .ios-switch {
  flex-shrink: 0;
}
.detail-pdf-hint {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
  max-width: 42rem;
}
/* Zoom en la misma fila que Descargar / Actualizar / Abrir (continuidad con los botones) */
.detail-pdf-zoom-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border-subtle);
}
.detail-pdf-zoom-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
#detail-pdf-zoom-range {
  flex: 0 0 auto;
  width: 120px;
  max-width: 120px;
  min-width: 0;
  accent-color: var(--brand-primary);
}
.detail-pdf-zoom-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 3.25em;
  font-variant-numeric: tabular-nums;
}
.detail-pdf-canvas-scroll {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  z-index: 3;
  background: var(--surface-secondary);
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}
.detail-pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
  min-width: min-content;
}
.detail-pdf-page-wrap {
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
[data-theme='dark'] .detail-pdf-page-wrap {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}
.detail-pdf-viewer-host {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-secondary);
}

/* Pestaña Mapa: tutor (Leaflet + OSM) */
.detail-map-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.detail-map-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.detail-map-lede {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 40rem;
}
.detail-map-external-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.detail-patient-map {
  width: 100%;
  flex: 1 1 0;
  min-height: 200px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--surface-secondary);
  z-index: 0;
}
.detail-patient-map .leaflet-container {
  font-family: inherit;
  z-index: 0;
}
.detail-map-coords {
  margin: 0;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.detail-pdf-empty {
  margin: 0;
  padding: 28px 20px;
  max-width: 22rem;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.5;
}
.detail-pdf-loading {
  padding: 24px;
}
.detail-pdf-loading-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.detail-pdf-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: detailPdfSpin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes detailPdfSpin {
  to {
    transform: rotate(360deg);
  }
}
.detail-pdf-error {
  padding: 24px 20px;
  max-width: 26rem;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.45;
}
.detail-pdf-error strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.detail-pdf-iframe {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: var(--surface-elevated);
  z-index: 2;
}
.detail-pdf-icon {
  flex-shrink: 0;
  display: block;
}

/* Registro médico: más aire entre subsecciones del modal */
.record-modal-body .record-modal-grid-main {
  gap: 14px;
}
.record-modal-ai-field {
  margin-bottom: 14px;
}
.record-modal-ai-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.record-modal-ai-field-head .typo-caption {
  margin: 0;
}
.record-modal-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.record-modal-photos {
  margin-top: 22px;
  padding: 20px 0 26px;
  border-top: 1px solid var(--border-subtle, rgba(128, 128, 128, 0.22));
  border-bottom: 1px solid var(--border-subtle, rgba(128, 128, 128, 0.12));
}
.record-modal-photos .record-modal-subsection-title {
  margin: 0 0 14px;
  padding: 0;
}
.record-modal-photos-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 16px;
}
.record-modal-photos-hint {
  margin: 0;
  flex: 1;
  min-width: 180px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.record-modal-body > .form-section-label.record-modal-subsection-title {
  margin-top: 28px;
  margin-bottom: 14px;
  padding-top: 4px;
}
.record-modal-body .record-modal-grid-vitals {
  gap: 14px;
}
#modal-record #wrap-anilovet-inline-income:not(.hidden) {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle, rgba(128, 128, 128, 0.22));
}
.record-modal-photos-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.record-modal-photo-tile {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle, rgba(128, 128, 128, 0.25));
  background: var(--surface-secondary, rgba(0, 0, 0, 0.04));
}
.record-modal-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.record-modal-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}
.record-modal-photo-remove:hover {
  background: rgba(0, 0, 0, 0.72);
}
#btn-record-photos-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-ai-analysis-body {
  max-height: min(70vh, 520px);
  overflow-y: auto;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}
.modal-ai-analysis-body .ai-result-section {
  margin-bottom: 14px;
}
.modal-ai-analysis-body .ai-result-section h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, var(--muted-foreground, #666));
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.modal-ai-analysis-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.modal-ai-analysis-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid color-mix(in srgb, var(--brand-primary) 25%, transparent);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: modal-ai-spin 0.85s linear infinite;
}
@keyframes modal-ai-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modulo miembros */
.members-module-root {
  padding: 24px;
  overflow-y: auto;
}
.members-header {
  margin-bottom: 16px;
}
.members-header .typo-h1 {
  margin: 0 0 4px;
}
.members-header .typo-body-small {
  margin: 0;
}
.members-search-row {
  margin-top: 10px;
}
.members-alert {
  margin-top: 10px;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
}
.members-alert-success {
  background: color-mix(in srgb, var(--accent-green) 14%, var(--surface-elevated));
  border-color: color-mix(in srgb, var(--accent-green) 30%, var(--border-subtle));
}
.members-alert-error {
  background: color-mix(in srgb, var(--accent-red) 12%, var(--surface-elevated));
  border-color: color-mix(in srgb, var(--accent-red) 30%, var(--border-subtle));
}
.members-alert-info {
  background: var(--surface-secondary);
}
.members-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.members-card .typo-h2 {
  margin: 0 0 12px;
}
.members-invite-row {
  display: flex;
  gap: 8px;
}
.members-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.members-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.members-item:last-child {
  border-bottom: none;
}
.members-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.members-item-main {
  min-width: 0;
}
.members-item-title {
  font-weight: 600;
  word-break: break-word;
}
.members-item-meta {
  color: var(--text-secondary);
  font-size: 13px;
}
.members-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--brand-muted);
  color: var(--brand-primary);
}
.members-badge-muted {
  background: var(--surface-secondary);
  color: var(--text-secondary);
}
.members-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}
.members-pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}
.members-permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

/* Modulo grupos */
.groups-module-root {
  padding: 24px;
  overflow-y: auto;
}

/* Modulo configuracion */
.settings-module-root {
  padding: 24px;
  overflow-y: auto;
}
.settings-module-root .inner-tabs,
.finance-module-root .inner-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 80%, var(--surface-elevated));
}
.settings-module-root .inner-tab,
.finance-module-root .inner-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}
.finance-module-root .inner-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.finance-inner-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}
.finance-inner-tab-svg {
  display: block;
}
.settings-module-root .inner-tab:hover,
.finance-module-root .inner-tab:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--surface-elevated) 75%, var(--brand-muted));
}
.settings-module-root .inner-tab.active,
.finance-module-root .inner-tab.active {
  color: var(--brand-primary);
  border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border-subtle));
  background: color-mix(in srgb, var(--brand-muted) 55%, var(--surface-elevated));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-primary) 18%, transparent) inset;
}
.settings-module-root .btn.btn-sm:not(.btn-icon) {
  min-height: 34px;
  padding: 0 12px;
}
.settings-file-name {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 84%, var(--surface-elevated));
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
  max-width: min(100%, 420px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-financial-combo-intro {
  margin: 0 0 12px;
  color: var(--text-secondary);
}
.settings-financial-combo-intro strong {
  font-weight: 600;
  color: var(--text-primary);
}
.settings-combo-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-tertiary);
  font-size: 11px;
}
.groups-header {
  margin-bottom: 16px;
}
.groups-header .typo-h1 {
  margin: 0 0 4px;
}
.groups-header .typo-body-small {
  margin: 0;
}
.groups-search-row {
  margin-top: 10px;
}
.groups-alert {
  margin-top: 10px;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
}
.groups-alert-success { background: color-mix(in srgb, var(--accent-green) 14%, var(--surface-elevated)); }
.groups-alert-error { background: color-mix(in srgb, var(--accent-red) 12%, var(--surface-elevated)); }
.groups-alert-info { background: var(--surface-secondary); }

/* Configuración: avisos por pestaña, con cierre */
.settings-section-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 14px;
}
.settings-module-root .dashboard-card > .settings-section-alert {
  margin-top: 0;
}
.settings-section-alert-text {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}
.settings-section-alert-dismiss {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -4px -6px -4px 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.settings-section-alert-dismiss:hover {
  background: color-mix(in srgb, var(--text-primary) 14%, transparent);
  color: var(--text-primary);
}
.settings-section-alert-dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-muted);
}
.settings-backup-sections > .groups-alert {
  margin-top: 0;
}
.settings-backup-permission-alert {
  margin-bottom: 0;
}

.settings-license-wrap .settings-license-intro,
.settings-license-wrap .settings-license-note {
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.5;
}
.settings-license-wrap .settings-license-hint {
  margin-top: 12px;
}
.settings-license-wrap .settings-license-session {
  margin-top: 10px;
}
.settings-license-wrap .settings-license-plan {
  margin-top: 8px;
}
.settings-license-wrap .settings-license-multi-warn {
  margin-top: 12px;
}
.settings-license-wrap .settings-license-owner {
  margin-top: 12px;
}
.settings-license-wrap .settings-license-form {
  margin-top: 10px;
  max-width: 520px;
}
.settings-license-wrap .settings-license-clear-hint {
  margin-top: 8px;
}
.settings-license-wrap .settings-license-actions {
  margin-top: 12px;
}

.groups-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}
.groups-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.groups-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.groups-item:last-child { border-bottom: none; }
.groups-item-active {
  background: color-mix(in srgb, var(--brand-muted) 45%, transparent);
  border-left: 3px solid var(--brand-primary);
  padding-left: 10px;
  border-radius: 8px;
}
.groups-item-main { min-width: 0; }
.groups-item-title { font-weight: 600; word-break: break-word; }
.groups-item-meta { color: var(--text-secondary); font-size: 13px; }
.groups-item-actions { display: flex; gap: 8px; }
.groups-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--brand-muted);
  color: var(--brand-primary);
}

/* Dashboard */
.dashboard-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.dashboard-alert {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--border-subtle);
}
.dashboard-alert--info {
  background: var(--surface-secondary);
  color: var(--text-primary);
}
.dashboard-alert--warning {
  background: color-mix(in srgb, var(--accent-amber) 16%, var(--surface-elevated));
  color: var(--text-primary);
}
.dashboard-module-root {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-header-text {
  min-width: 0;
  flex: 1;
}
.dashboard-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 4px;
}
.dashboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.dashboard-brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 10px;
}
.dashboard-title-row .typo-h1 {
  margin: 0;
}
.dashboard-brand .typo-h1 {
  line-height: 1.15;
}
.dashboard-header .typo-body-small { margin: 0; }
.dashboard-header-loading {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.dashboard-circular-progress {
  display: block;
}
.dashboard-circular-progress-track {
  stroke: var(--border-subtle);
}
.dashboard-circular-progress-arc {
  stroke: var(--brand-primary);
  transition: stroke-dashoffset 320ms cubic-bezier(0.33, 1, 0.68, 1);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--brand-primary) 30%, transparent));
}

.dashboard-promo {
  position: relative;
  margin: 0 0 36px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, var(--border-subtle));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--brand-primary) 9%, var(--surface-elevated)) 0%,
    var(--surface-elevated) 48%,
    color-mix(in srgb, var(--brand-primary) 5%, var(--surface-elevated)) 100%
  );
  /* Sombra neutra contenida: sin halo de color que sobresalga del card */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.dashboard-promo-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(
    180deg,
    var(--brand-primary) 0%,
    color-mix(in srgb, var(--brand-primary) 55%, var(--surface-elevated)) 100%
  );
  border-radius: 14px 0 0 14px;
}
.dashboard-promo-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 18px 22px;
}
.dashboard-promo-icon-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-primary) 16%, var(--surface-elevated));
  color: var(--brand-primary);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent);
}
.dashboard-promo-icon-wrap .dashboard-inline-icon {
  width: 22px;
  height: 22px;
}
.dashboard-promo-copy {
  flex: 1;
  min-width: 0;
}
.dashboard-promo-lead {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.dashboard-promo-lead strong {
  font-weight: 700;
  color: color-mix(in srgb, var(--brand-primary) 85%, var(--text-primary));
}
.dashboard-promo-sub {
  margin: 10px 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.dashboard-promo-sub strong {
  font-weight: 600;
  color: color-mix(in srgb, var(--brand-primary) 78%, var(--text-primary));
}

.dashboard-progress-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
.dashboard-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--brand-primary) 50%, var(--surface-elevated)) 0%,
    var(--brand-primary) 50%,
    color-mix(in srgb, var(--brand-primary) 82%, #1a0a00) 100%
  );
  box-shadow: none;
  transition: width 320ms cubic-bezier(0.33, 1, 0.68, 1);
}

.dashboard-grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-kpi {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-elevated);
}
.dashboard-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.dashboard-kpi-icon-wrap {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--surface-elevated));
  color: var(--brand-primary);
}
.dashboard-kpi-icon-wrap .dashboard-inline-icon {
  width: 18px;
  height: 18px;
}
.dashboard-kpi-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.dashboard-kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.dashboard-kpi--with-icon .dashboard-kpi-value {
  padding-left: 46px;
}
.dashboard-inline-icon {
  display: block;
  flex-shrink: 0;
}
.dashboard-card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.dashboard-card-icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--surface-elevated));
  color: var(--brand-primary);
}
.dashboard-card-icon-wrap .dashboard-inline-icon {
  width: 20px;
  height: 20px;
}
.dashboard-card-title-row .typo-h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  padding-top: 2px;
}
.dashboard-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.dashboard-card--auth {
  width: 100%;
  margin-bottom: 16px;
}
.subscription-stores-footer + .dashboard-card--auth {
  margin-top: 16px;
}
.dashboard-auth-intro {
  margin: 0 0 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.dashboard-auth-row {
  margin-bottom: 14px;
}
.dashboard-auth-row:last-child {
  margin-bottom: 0;
}
.dashboard-auth-row-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.dashboard-auth-row-label {
  font-size: 13px;
  font-weight: 600;
}
.dashboard-auth-row-bar {
  margin-bottom: 2px;
}
.dashboard-auth-row-meta {
  margin: 4px 0 0;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.dashboard-auth-fill--muted {
  background: var(--border-subtle) !important;
  box-shadow: none !important;
}
.dashboard-card {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-elevated);
}
.dashboard-card-pending {
  margin: 0;
  color: var(--text-tertiary);
}
.dashboard-card .typo-h2 {
  margin: 0 0 10px;
}
/* Pestaña Configuración → Backups: separación entre las tres tarjetas */
.settings-backup-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Bloques Exportar / Restaurar dentro de la primera tarjeta de backups */
.settings-backup-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.settings-backup-action-card {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 16px 16px;
  background: color-mix(in srgb, var(--surface-secondary) 65%, var(--surface-elevated));
}
.settings-backup-action-card--restore {
  border-color: color-mix(in srgb, var(--accent-red) 22%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-red) 4%, var(--surface-elevated));
}
.settings-backup-action-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.settings-backup-action-hint {
  margin: 0 0 12px;
  color: var(--text-tertiary);
  line-height: 1.45;
  max-width: 52ch;
}
.settings-backup-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.settings-module-root .btn-backup-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}
.settings-module-root .btn-backup-cta:hover:not(:disabled) {
  background: var(--brand-hover);
  color: #fff;
  transform: translateY(-1px);
}
.settings-module-root .btn-backup-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-elevated), 0 0 0 4px var(--brand-muted);
}
.settings-module-root .btn-backup-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  color: var(--text-primary);
}
.settings-module-root .btn-backup-muted:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-primary) 5%, var(--surface-elevated));
  border-color: color-mix(in srgb, var(--text-secondary) 35%, var(--border-subtle));
}
.settings-module-root .btn-backup-muted:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-muted);
}
.settings-file-name--backup {
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  border-radius: 10px;
  line-height: 1.35;
  padding: 8px 12px;
}
@media (max-width: 520px) {
  .settings-backup-btn-row .btn-backup-cta,
  .settings-backup-btn-row .btn-backup-muted,
  .settings-backup-btn-row .btn-primary.btn-danger {
    width: 100%;
    justify-content: center;
  }
}

/* Resumen del grupo (backups): tabla legible */
.settings-backup-summary-intro {
  margin: 0 0 12px;
  color: var(--text-tertiary);
  line-height: 1.45;
  max-width: 56ch;
}
.settings-backup-summary-empty {
  margin: 0;
  color: var(--text-tertiary);
}
.settings-backup-summary-scroll {
  overflow-x: auto;
  margin: 0 -2px;
  padding: 2px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-secondary) 55%, var(--surface-elevated));
}
.settings-backup-summary-table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.35;
}
.settings-backup-summary-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--surface-elevated) 92%, var(--surface-secondary));
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--border-subtle) 80%, transparent);
}
/* Encabezados numéricos alineados con el cuerpo (derecha) */
.settings-backup-summary-table thead th.settings-backup-summary-num {
  text-align: right;
}
.settings-backup-summary-table tbody tr {
  transition: background-color 120ms ease;
}
.settings-backup-summary-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--text-primary) 2.5%, transparent);
}
.settings-backup-summary-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-muted) 28%, var(--surface-elevated));
}
.settings-backup-summary-table tbody td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-backup-summary-table tbody tr:last-child td {
  border-bottom: none;
}
.settings-backup-summary-entity {
  min-width: 160px;
}
.settings-backup-summary-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-backup-summary-slug {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  word-break: break-all;
}
.settings-backup-summary-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-primary);
}
.settings-backup-summary-num--muted {
  color: var(--text-secondary);
}
.settings-backup-summary-num--total strong {
  font-weight: 700;
  color: var(--brand-primary);
}
.settings-backup-summary-foot th,
.settings-backup-summary-foot td {
  padding: 12px;
  border-top: 2px solid var(--border-subtle);
  background: color-mix(in srgb, var(--brand-muted) 18%, var(--surface-elevated));
}
.settings-backup-summary-foot th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-backup-summary-foot td.settings-backup-summary-num {
  text-align: right;
}
@media (max-width: 480px) {
  .settings-backup-summary-slug {
    font-size: 10px;
  }
}
.dashboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.dashboard-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.dashboard-list li:last-child { border-bottom: none; }
.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 740px) {
  .members-permissions-grid {
    grid-template-columns: 1fr;
  }
}

/* Pestaña Registros: items iguales a la app Flutter */
.records-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.record-card {
  padding: 14px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.record-card--interactive {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.record-card--interactive:hover {
  border-color: color-mix(in srgb, var(--btn-blue-soft-text) 35%, var(--border-subtle));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.record-card--interactive:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--btn-blue-solid-top) 45%, var(--border-subtle));
  box-shadow:
    0 0 0 2px var(--surface-elevated),
    0 0 0 4px color-mix(in srgb, var(--btn-blue-solid-top) 40%, transparent);
}
.record-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 8px;
}
.record-type-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  line-height: 1.2;
}
.record-card-fecha {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.record-card-fecha-icon,
.record-card-vet-icon,
.record-card-meds-icon,
.record-card-next-icon {
  opacity: 0.85;
  font-size: 12px;
}
.record-card-vet {
  font-size: 12px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.record-card-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 6em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.record-card-meds {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}
.record-card-meds .record-card-meds-icon { flex-shrink: 0; }
.record-card-meds-clamp {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-width: 0;
}
.record-card-vitals {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
}
.record-card-next {
  font-size: 13px;
  color: var(--brand-primary);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.record-card-imagenes {
  margin-top: 12px;
}
.record-card-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.record-card-thumb {
  width: 95px;
  height: 95px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.record-card-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px var(--overlay);
}
.record-card-diagnosis {
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.record-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.record-card-actions-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}
.record-card-actions .btn-sm {
  min-height: 30px;
  padding: 0 9px;
  font-size: 13px;
}

/* Modal ver registro completo (solo lectura) */
.record-view-modal-body {
  min-height: 80px;
}
.record-view-root {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.record-view-loading {
  margin: 12px 0;
  color: var(--text-secondary);
}
.record-view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 4px;
}
.record-view-header-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.record-view-system-id {
  margin: 0 0 8px;
  word-break: break-all;
}
.record-view-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.record-view-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.record-view-paragraph {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.record-view-vitals-line {
  margin: 0;
  line-height: 1.5;
}
.record-view-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.record-view-photo-thumb {
  width: 100%;
  height: 112px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.record-view-photo-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.record-view-photo-hint {
  margin: 8px 0 0;
}
.record-view-income-amount {
  margin: 0 0 4px;
}

/* Popup imagen a tamaño completo (por encima de modales .modal z-index 1001) */
.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  box-sizing: border-box;
}
.image-viewer-overlay.hidden {
  display: none !important;
}
.image-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface-elevated);
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.image-viewer-close:hover {
  background: var(--surface-secondary);
}
.image-viewer-prev,
.image-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--surface-elevated);
  color: var(--text-primary);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, opacity 0.15s;
  z-index: 2;
}
.image-viewer-prev:hover,
.image-viewer-next:hover {
  background: var(--surface-secondary);
}
.image-viewer-prev {
  left: 16px;
}
.image-viewer-next {
  right: 16px;
}
.image-viewer-prev.hidden,
.image-viewer-next.hidden {
  display: none !important;
}
.image-viewer-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 2;
}
.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  z-index: 1;
}

/* Etapas de vida (General del paciente) */
.detail-life-stage-mount {
  margin: 0 0 12px;
}
.detail-life-stage-mount.hidden {
  display: none !important;
  margin: 0;
}
.life-stage-widget {
  border-radius: 12px;
  border: 1px solid var(--ls-border, rgba(0, 0, 0, 0.12));
  background: var(--ls-surface, rgba(0, 137, 123, 0.06));
  overflow: hidden;
}
/* Dentro de la tarjeta General: sin marco propio ni cabecera duplicada */
.life-stage-widget--embedded {
  border: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.life-stage-widget--embedded .life-stage-widget__body {
  padding: 0;
}
.life-stage-widget--embedded .life-stage-widget__legend {
  margin-top: 8px;
  font-size: 0.78rem;
}
.life-stage-widget--embedded .life-stage-widget__summary {
  margin-top: 8px;
  font-size: 0.8rem;
}
.life-stage-widget--embedded .life-stage-widget__nodata,
.life-stage-widget__err--embedded {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary, #666);
  line-height: 1.4;
}
.life-stage-widget--loading.life-stage-widget--embedded {
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 0.82rem;
  color: var(--text-secondary, #666);
  gap: 8px;
}
.life-stage-widget--loading.life-stage-widget--embedded .life-stage-widget__spinner {
  width: 16px;
  height: 16px;
}
.life-stage-widget__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px 8px;
  background: var(--ls-header, rgba(0, 137, 123, 0.1));
  border-bottom: 1px solid var(--ls-border, rgba(0, 0, 0, 0.08));
  color: var(--text-primary, #1a1a1a);
}
.life-stage-widget__head-icon {
  display: flex;
  color: var(--ls-accent, #00897b);
  flex-shrink: 0;
}
.life-stage-widget__title {
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
  min-width: 0;
}
.life-stage-widget__species {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ls-accent, #00897b);
}
.life-stage-widget__body {
  padding: 12px 14px 14px;
}
.life-stage-widget__track {
  position: relative;
  height: 80px;
  margin-bottom: 4px;
  --ls-progress: 0%;
}
.life-stage-widget__track-tools {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
}
.life-stage-bar-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary, #666);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.life-stage-bar-mode-btn:hover {
  background: var(--surface-secondary, rgba(0, 0, 0, 0.06));
  color: var(--text-primary, #111);
}
.life-stage-bar-mode-btn:focus-visible {
  outline: 2px solid var(--brand-muted, #00897b);
  outline-offset: 2px;
}
.life-stage-bar-mode-icon {
  display: block;
  flex-shrink: 0;
}
.life-stage-widget__bar-slot {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  height: 40px;
}
.life-stage-widget__bar--gradient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
  box-sizing: border-box;
  /* background-image: linear-gradient(...) va en style inline (lifeStageWidget.js) */
  background-color: rgba(0, 0, 0, 0.05);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
[data-theme="dark"] .life-stage-widget__bar--gradient {
  background-color: rgba(255, 255, 255, 0.06);
}
.life-stage-widget__bar--segments {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: row;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
  overflow: hidden;
  box-sizing: border-box;
}
.life-stage-widget__track--segmented .life-stage-widget__bar--gradient {
  display: none !important;
}
.life-stage-widget__track--segmented .life-stage-widget__bar--segments {
  display: flex !important;
}
.life-stage-widget__seg--first {
  border-radius: 7px 0 0 7px;
}
.life-stage-widget__seg--last {
  border-radius: 0 7px 7px 0;
}
.life-stage-widget__laser {
  position: absolute;
  left: var(--ls-progress);
  top: 14px;
  width: 2px;
  height: 55px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    rgba(211, 47, 47, 0.95) 0%,
    rgba(211, 47, 47, 0.45) 100%
  );
  box-shadow: 0 0 6px rgba(211, 47, 47, 0.55);
  pointer-events: none;
  z-index: 2;
  animation: life-stage-laser-pulse 0.8s ease-in-out infinite alternate;
}
.life-stage-widget__heart {
  position: absolute;
  left: var(--ls-progress);
  top: 2px;
  transform: translateX(-50%);
  color: #c62828;
  z-index: 3;
  pointer-events: none;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}
.life-stage-widget__heart-pulse {
  display: flex;
  transform-origin: 50% 100%;
  animation: life-stage-heartbeat 0.8s ease-in-out infinite alternate;
}
@keyframes life-stage-heartbeat {
  from {
    transform: scale(0.95);
  }
  to {
    transform: scale(1.1);
  }
}
@keyframes life-stage-laser-pulse {
  from {
    opacity: 0.72;
    box-shadow: 0 0 3px rgba(211, 47, 47, 0.45);
  }
  to {
    opacity: 1;
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.85);
  }
}
.life-stage-widget__legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary, #444);
}
.life-stage-widget__legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}
.life-stage-widget__legend-item--current {
  font-weight: 600;
  color: var(--text-primary, #111);
}
.life-stage-widget__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 3px;
}
.life-stage-widget__summary {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary, #555);
  line-height: 1.45;
}
.life-stage-widget__nodata,
.life-stage-widget__err {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  line-height: 1.4;
}
.life-stage-widget--loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  border-radius: 12px;
  border: 1px dashed var(--border-subtle, rgba(0, 0, 0, 0.15));
  background: var(--surface-secondary, rgba(0, 0, 0, 0.03));
}
.life-stage-widget__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-subtle, #ccc);
  border-top-color: var(--ls-accent, #00897b);
  border-radius: 50%;
  animation: life-stage-spin 0.7s linear infinite;
}
@keyframes life-stage-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Hidden */
.hidden { display: none !important; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in { animation: fadeIn 200ms ease-out; }
