/* ════════════════════════════════════════════════════════════════════════════
   Paleta SELLADA de Cirene CACES · DESIGN.md §3.1 (founder 2026-06-07).
   Cobalt PROPIO (no lavender admin, no One-Medical paciente). Override de los
   tokens del sistema, ambos temas. Fuente ÚNICA — extraído del inline de cada
   pantalla (APRUEBA-COBALT-EXTRACT-2026-06-08) para no duplicar hex sellados.
   ════════════════════════════════════════════════════════════════════════════ */
@import url("/aprueba-mobile-targets.css?v=20260705-onboarding-skip-1");
@import url("/aprueba-builder-a11y.css?v=20260705-armar-a11y-1");
@import url("/aprueba-internal-a11y.css?v=20260705-summary-falladas-1");

html[data-theme="light"] {
  /* V10: secundarios al gris frío de Linear light (#6B6F76) y borde .08 — coherente con dark */
  --bg-page: #f7f8f8 !important;
  --bg-surface: #ffffff !important;
  --bg-elevated: #ffffff !important;
  --text-primary: #0e0f12;
  --text-secondary: #6b6f76;
  --text-tertiary: #62666d;
  --accent: #2563eb !important;
  --accent-hover: #1d4ed8 !important;
  --accent-text: #1d4ed8 !important;
  --accent-subtle: rgba(37, 99, 235, 0.1) !important;
  --border: rgba(0, 0, 0, 0.08) !important;
  --brand-bg: #2563eb !important;
  --btn-primary-bg: #2563eb !important;
  --velandra-mark-top: #60a5fa !important;
  --velandra-mark-left: #1d4ed8 !important;
  --velandra-mark-right: #2563eb !important;
}
html[data-theme="dark"] {
  /* V10 (founder: "el modo oscuro no es Linear level, clarito está") — MEDIDO: era gris
     NEUTRO; realineado a la paleta Linear azul-fría sellada en DESIGN.md (landing dark). */
  --bg-page: #08090a !important;
  --bg-surface: #0e0f12 !important;
  --bg-elevated: #1a1b1e !important;
  --text-primary: #f7f8f8 !important;
  --text-secondary: #8a8f98 !important;
  --text-tertiary: #78808a !important;
  --accent: #2563eb !important;
  --accent-hover: #3b82f6 !important;
  --accent-text: #93c5fd !important;
  --accent-subtle: rgba(37, 99, 235, 0.16) !important;
  --border: rgba(255, 255, 255, 0.08) !important;
  --brand-bg: #2563eb !important;
  --btn-primary-bg: #2563eb !important;
  --velandra-mark-top: #60a5fa !important;
  --velandra-mark-left: #1d4ed8 !important;
  --velandra-mark-right: #2563eb !important;
}
html[data-theme="light"] .miday-doctor-item__chip.mat-chip[data-band="none"] {
  color: #4f5661;
}

html[data-theme="light"] .ar-app .qty button.is-locked {
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
  color: #5f6368 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .ar-app .qty button.is-locked {
  background: #1a1b1e !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #cbd5e1 !important;
  opacity: 1 !important;
}

/* Menú de cuenta — popover anclado al chip del footer del sidebar (patrón Velandra
   Clínica admin · reusa .ar-shell-user-popover/.dropdown-item de shell-ds02.css).
   Override de posición: el sidebar de Aprueba está expandido (240px), no es el rail
   colapsado de 64px del admin → anclar el popover al chip, no al borde de 64px. */
#ar-user-menu.ar-shell-user-popover {
  left: 12px;
  bottom: 64px;
  min-width: calc(var(--ar-sidebar-w, 240px) - 24px);
  max-width: calc(var(--ar-sidebar-w, 240px) - 24px);
  z-index: 140;
}
#ar-user-menu .ar-shell-popover__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ar-user-menu .dropdown-item.is-logout {
  color: var(--danger);
}

/* ── Breadcrumbs del shell (SHELL-DISCIPLINE 2026-06-10): link + separador · compartido por todas las vistas ── */
.ar-crumbs .ar-crumb--sep {
  color: var(--text-tertiary);
  padding: 0 2px;
}
.ar-crumbs a.ar-crumb {
  color: var(--text-tertiary);
  text-decoration: none;
}
.ar-crumbs a.ar-crumb:hover {
  color: var(--text-secondary);
}
.ar-app .ar-crumbs a.ar-crumb {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
html[data-theme="dark"] .ar-app .ar-sb__tenant-sub,
html[data-theme="dark"] .ar-app .ar-crumbs a.ar-crumb {
  color: var(--text-secondary);
}

/* ── Controles internos Aprueba: el shell compartido es denso; en móvil las CTAs
   principales no deben caer por debajo de un objetivo táctil usable. ── */
.ar-app .ar-topbar__btn {
  height: 32px;
  min-height: 32px;
}
.ar-app .ar-sb__collapse {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
.ar-app .btn-min,
.ar-app .btn-sm,
.ar-app .miday-section__link {
  min-height: 32px;
}
.ar-app .btn-min {
  padding: 6px 11px;
}
.ar-app .btn-sm,
.ar-app .miday-section__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Candado del salto natural (PAID-NATURAL-JUMP 2026-06-10): valor pago visible-pero-bloqueado ── */
.lockstat {
  position: relative;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  text-decoration: none;
}
.lockstat:hover {
  color: var(--accent-text);
}
.lockstat__lbl {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--accent-text);
  text-decoration: none;
}
.lockstat__lbl:hover {
  text-decoration: underline;
}
.lockstat-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -9px 0;
  border-radius: 6px;
  color: var(--accent-text);
  vertical-align: middle;
  transform: translateY(-1px);
}

/* ── Momento de desbloqueo post-compra (PRO-FELT 2026-06-10): la diferencia se siente, sin confetti ── */
.ap-unlock {
  position: relative;
  background: var(--accent-subtle);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
.ap-unlock__close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.ap-unlock__close:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 7%, transparent);
}
.ap-unlock__t {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.ap-unlock__d {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 3px 0 10px;
}
.ap-unlock__list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ap-unlock__list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text-primary);
}
.ap-unlock__list svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent-text);
}
.ap-unlock__cta {
  display: inline-flex;
}

/* ── ANIMACIONES DEL SHELL · gramática Linear MEDIDA (linear.app 2026-06-10:
   tokens --speed-quickTransition .1s / --speed-regularTransition .25s;
   computed nav: color/background .1–.16s ease-out-quad cubic-bezier(.25,.46,.45,.94)).
   Capa Aprueba-only: NO toca shell-ds02.css (compartido con el admin clínico). ── */
:root {
  --ap-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.ar-sb__nav a {
  transition:
    background-color 0.12s var(--ap-ease),
    color 0.12s var(--ap-ease);
}
.ar-app {
  transition: grid-template-columns 0.2s var(--ap-ease);
}
.bottom-nav-item {
  transition: color 0.1s var(--ap-ease);
}
.bottom-nav-item > span {
  line-height: 1.25;
  min-height: 16px;
}
html[data-theme="dark"] .bottom-nav-item.active,
html[data-theme="dark"] .bottom-nav-item.active svg,
html[data-theme="dark"] .bottom-nav-item:hover,
html[data-theme="dark"] .bottom-nav-item:focus-visible {
  color: var(--accent-text);
}
/* Popover de cuenta: pop de entrada (origin = el chip, abre hacia arriba) */
.ar-shell-user-popover {
  transform-origin: bottom left;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition:
    opacity 0.16s var(--ap-ease),
    transform 0.16s var(--ap-ease);
}
.ar-shell-user-popover.show {
  opacity: 1;
  transform: none;
}
/* Chip del plan en el popover: para el free es la puerta al paso de pago */
.ar-shell-popover__chip a {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 500;
}
.ar-shell-popover__chip a:hover {
  text-decoration: underline;
}

/* View transitions off: the cross-fade read as global breathing. */
@view-transition {
  navigation: none;
}
.ar-sb {
  view-transition-name: ap-sidebar;
}
.bottom-nav {
  view-transition-name: ap-bottomnav;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .ar-shell-user-popover,
  .ar-sb__nav a,
  .ar-app,
  .bottom-nav-item {
    transition: none;
  }
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(ap-sidebar),
  ::view-transition-new(ap-sidebar),
  ::view-transition-old(ap-bottomnav),
  ::view-transition-new(ap-bottomnav) {
    animation: none;
  }
}

@media (max-width: 640px) {
  body:has(.bottom-nav) {
    --ar-app-h: calc(100dvh - 59px - env(safe-area-inset-bottom, 0px));
  }
  .ar-app[data-drawer="true"] .ar-sb {
    z-index: 120;
  }
  .ar-drawer-toggle.is-drawer-floating {
    position: fixed;
    top: 10px;
    left: 16px;
    z-index: 130;
  }
}

/* ── BUSCADOR ⌘K · APRUEBA-SEARCH-UI (GET /api/search landed 0881120b1) ──
   Registro Linear: overlay top-aligned, grupos Materias/Temas/Preguntas,
   navegable por teclado. Benchmark medido 2026-06-11: UWorld "advanced search"
   en My Notebook/banco · la búsqueda es staple del sector. */
.ap-search {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 15vh 16px 16px;
  background: color-mix(in srgb, var(--text-primary) 28%, transparent);
}
.ap-search[hidden] {
  display: none;
}
.ap-search__panel {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(
    --shadow-lg,
    0 16px 48px color-mix(in srgb, var(--text-primary) 18%, transparent)
  );
  overflow: hidden;
  transform-origin: top center;
  opacity: 0;
  transform: translateY(-4px) scale(0.99);
  transition:
    opacity 0.16s var(--ap-ease),
    transform 0.16s var(--ap-ease);
}
.ap-search.is-open .ap-search__panel {
  opacity: 1;
  transform: none;
}
.ap-search__input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 15px 18px;
  font: inherit;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}
.ap-search__input::placeholder {
  color: var(--text-tertiary);
}
.ap-search__results {
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px;
}
.ap-search__group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 10px 12px 4px;
}
.ap-search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
}
.ap-search__item svg {
  flex: none;
  color: var(--text-tertiary);
}
.ap-search__item.is-active,
.ap-search__item:hover {
  background: color-mix(in srgb, var(--text-primary) 5%, transparent);
}
.ap-search__item .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-search__item .ctx {
  font-size: 12px;
  color: var(--text-tertiary);
  flex: none;
}
.ap-search__item .cnt {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  flex: none;
}
.ap-search__empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.ap-search__foot {
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.ap-search__foot kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}
/* trigger en el sidebar (inyectado por JS — un solo lugar, no 6 páginas) */
.ar-sb__searchbtn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% - 24px);
  margin: 2px 12px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-page);
  color: var(--text-tertiary);
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  transition:
    border-color 0.12s var(--ap-ease),
    color 0.12s var(--ap-ease);
}
.ar-sb__searchbtn:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.ar-sb__searchbtn kbd {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}
.ar-app[data-collapsed="true"] .ar-sb__searchbtn {
  display: none;
}
@media (max-width: 639px) {
  .ap-search {
    padding-top: 8vh;
  }
  .ar-sb__searchbtn kbd {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ap-search__panel {
    transition: none;
  }
}
@media (max-width: 640px) {
  .set-sub {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 8px 14px !important;
    padding: 15px 16px 18px !important;
  }
  .set-sub__icon {
    grid-column: 1 !important;
  }
  .set-sub__main {
    grid-column: 2 !important;
    width: 100% !important;
  }
  .set-sub__meta {
    flex-wrap: wrap;
    gap: 6px 8px;
    line-height: 1.4;
  }
  .set-sub__meta span:last-child {
    flex: 1 1 100%;
    min-width: 0;
  }
  .set-sub [data-sub-manage],
  .set-sub [data-sub-upgrade] {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 44px;
  }
}
/* Loading skeletons stay static to avoid global breathing. */
.ap-pulse {
  animation: none !important;
  opacity: 1 !important;
}
.ap-skeleton-line {
  display: inline-block;
  height: 12px;
  background-color: color-mix(in srgb, var(--text-primary) 8%, transparent);
  border-radius: 4px;
  vertical-align: middle;
  width: 100%;
}
.ap-skeleton-line--short {
  width: 40%;
}
.ap-skeleton-line--medium {
  width: 70%;
}
.ap-skeleton-line--circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--text-primary) 8%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qb-think,
.qb-think path,
.qb-think circle {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.setup-caces-toggle .caces-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.setup-caces-toggle .caces-slider {
  transition: background-color 0.2s;
}
.setup-caces-toggle .caces-switch input:focus + .caces-slider,
.setup-caces-toggle .caces-switch input:focus-visible + .caces-slider {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
body .ob-skip a {
  min-height: 44px;
}
/* Cirene CACES no tiene paywalls ni checkout. */
.qb-paywall,
[data-billing-upgrade],
.set-sub__upgrade {
  display: none !important;
}
