/*
 * BOB SKIN V2 · la piel (2026-10-19).
 *
 *   BOB APP (app.css: layout y comportamiento) → Bob UI (bob-ui.css: primitivos)
 *   → BOB SKIN (este archivo: cómo se ve TODO) → tokens (bob-theme.css)
 *
 * Solo presentación: ninguna regla cambia qué hay en el DOM, qué hace un
 * botón ni cuándo se muestra algo. Carga la última a propósito: gana a
 * app.css con la misma especificidad, así que aquí no hay `!important` ni
 * selectores artificiales. Los movimientos salen SIEMPRE de los tokens de
 * motion (tres duraciones, tres curvas) y nunca gobiernan la lógica: el
 * estado cambia primero y la animación solo lo presenta.
 */

/* ═══════════════════════════════════════════════════════════════════════
   0 · BASE y tipografía
   ═══════════════════════════════════════════════════════════════════════ */
body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: -0.005em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tipografía: una jerarquía (título de página · sección · tarjeta · cuerpo · secundario · pie). */
.modal-title,
.gate-title,
.bob-pasos-nombre {
  letter-spacing: -0.02em;
}

.settings-heading,
.metric-label,
.bob-pasos-indice,
.context-menu-title,
.overview-section-title .metric-label,
.bob-settings-grupo {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.settings-hint,
.gate-hint,
.overview-hint,
.overview-section-hint {
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   1 · MOTION · utilidades comunes (leídas por todas las superficies)
   ═══════════════════════════════════════════════════════════════════════ */
@keyframes bob-enter {
  from { opacity: 0; transform: translateY(var(--motion-shift-y)); }
  to { opacity: 1; transform: none; }
}

@keyframes bob-enter-forward {
  from { opacity: 0; transform: translateX(var(--motion-shift-x)); }
  to { opacity: 1; transform: none; }
}

@keyframes bob-enter-back {
  from { opacity: 0; transform: translateX(calc(var(--motion-shift-x) * -1)); }
  to { opacity: 1; transform: none; }
}

@keyframes bob-pop {
  from { opacity: 0; transform: scale(0.98) translateY(2px); }
  to { opacity: 1; transform: none; }
}

@keyframes bob-fade {
  from { opacity: 0; }
}

@keyframes bob-fade-out {
  to { opacity: 0; }
}

@keyframes bob-leave {
  to { opacity: 0; transform: translateY(var(--motion-shift-y)); }
}

/* ═══════════════════════════════════════════════════════════════════════
   2 · SHELL GLOBAL · barra, selector de producto, contexto, estado
   ═══════════════════════════════════════════════════════════════════════ */
.bob {
  --bob-bar-height: 66px;
}

html.is-desktop .bob {
  --bob-bar-height: 64px;
}

.bob-bar {
  align-items: center;
  padding-bottom: 0;
}

/* Nivel 2 · Finance | Passwords: un control segmentado, una sola pieza. */
.product-switch {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.product-switch-option {
  width: auto;
  min-width: 112px;
  height: 36px;
  flex-direction: row;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
  box-shadow: none;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.product-switch-option .vault-option-icon svg {
  width: 16px;
  height: 16px;
}

.product-switch-option:hover {
  border-color: transparent;
  background: var(--row-hover);
  color: var(--ink);
}

.product-switch-option.is-active,
.product-switch-option[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 22, 20, 0.06), 0 0 0 1px color-mix(in srgb, var(--vault) 14%, transparent);
}

.product-switch-option.is-active .vault-option-icon,
.product-switch-option[aria-selected="true"] .vault-option-icon {
  color: var(--vault);
}

.product-switch-option:focus-visible {
  outline-offset: 1px;
}

/* Nivel 1 · el contexto: una píldora con su cara y su NOMBRE (Personal | el grupo). */
.context-avatar {
  height: 38px;
  gap: 8px;
  padding: 3px 10px 3px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.context-avatar:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.context-avatar-label {
  max-width: 180px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-avatar-chevron {
  color: var(--subtle);
}

.context-face {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 13px;
}

.context-face.is-group {
  background: color-mix(in srgb, var(--tone, var(--accent)) 14%, var(--surface));
  color: color-mix(in srgb, var(--tone, var(--accent)) 80%, var(--ink));
}

.context-menu {
  min-width: 260px;
  padding: 6px;
}

.context-menu-item {
  min-height: 36px;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 8px;
}

.context-menu-item .context-face {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.context-menu-item[aria-checked="true"] {
  background: var(--surface-muted);
}

/* Estado (sincronización) y candado, a la derecha: discretos, misma altura. */
.bob-bar-end .bob-sync,
.bob-bar-end .lock-button {
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

/* Cambio de módulo (Finance ⇄ Passwords): el nuevo entra con una elevación mínima. */
[data-module-root]:not([hidden]) {
  animation: bob-enter var(--motion-base) var(--ease-enter) both;
}

/* ═══════════════════════════════════════════════════════════════════════
   3 · NAVEGACIÓN DE PRODUCTO · barra de pestañas (categorías) y bóveda
   ═══════════════════════════════════════════════════════════════════════ */
.topbar {
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}

.tabbar,
.topbar-button {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.tabbar {
  padding: 3px;
  border-radius: 12px;
}

.tab {
  height: 34px;
  border-radius: 9px;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), padding var(--motion-base) var(--ease-standard);
}

.topbar-button {
  height: 40px;
  border-radius: 10px;
  color: var(--ink-soft);
}

.topbar-button:hover,
.topbar-button[aria-expanded="true"] {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

/* La bóveda, solo cuando hay varias: un segmento pegado a la navegación central. */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-vault[aria-hidden="true"] {
  display: none;
}

.topbar-vault .vault-switcher {
  display: inline-flex;
  height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.topbar-vault .vault-switcher:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.topbar-vault .vault-switcher-icon {
  color: var(--accent);
}

.topbar-vault .vault-switcher-shared {
  color: var(--subtle);
}

.topbar-vault .vault-switcher-chevron {
  color: var(--subtle);
}

/* ═══════════════════════════════════════════════════════════════════════
   4 · SISTEMA DE BOTONES · una altura, un radio, cinco variantes
   ═══════════════════════════════════════════════════════════════════════ */
.bob-ui-button {
  height: 36px;
  gap: 7px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 560;
  box-shadow: 0 1px 1px rgba(23, 22, 20, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.bob-ui-button:active:not(:disabled) {
  transform: translateY(0.5px);
  box-shadow: none;
}

.bob-ui-button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ring);
}

.bob-ui-button[data-variant="ghost"],
.bob-ui-button[data-variant="outline"],
.bob-ui-button[data-variant="secondary"],
.bob-ui-button[data-variant="destructive"] {
  box-shadow: none;
}

.bob-ui-button[data-variant="outline"] {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.bob-ui-button[data-variant="outline"]:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--row-hover);
}

.bob-ui-button[data-variant="secondary"] {
  background: var(--surface-muted);
}

.bob-ui-button[data-variant="secondary"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ink) 9%, var(--surface));
}

.bob-ui-button[data-variant="ghost"] {
  color: var(--ink-soft);
}

.bob-ui-button.gate-submit {
  height: var(--control-h-lg);
  /* Nunca una «barra fina»: aunque faltara el token, el botón mide lo que el control grande. */
  min-height: var(--control-h-lg, 42px);
  font-size: 14px;
  font-weight: 600;
}

.bob-ui-button.gate-secondary {
  height: var(--control-h);
}

/* Botones de icono: un sistema (ajustes, más, cerrar, chevrón, copiar, papelera…). */
.icon-button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.icon-button.small {
  width: 28px;
  height: 28px;
}

.icon-button:hover {
  background: var(--row-hover);
  color: var(--ink);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

/* Enlaces de texto (la puerta: «Volver», «He olvidado…»). */
.text-link,
.gate-link {
  border-radius: 6px;
  color: var(--accent);
  font-weight: 520;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.text-link:hover,
.gate-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   5 · SISTEMA DE CAMPOS · input, select, textarea, etiqueta, ayuda, error
   ═══════════════════════════════════════════════════════════════════════ */
.bob-ui-input,
.bob-ui-select,
.bob-ui-textarea,
.input,
.select,
.textarea {
  border-color: var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

.bob-ui-input,
.bob-ui-select,
.input,
.select {
  height: var(--control-h);
  padding-inline: 12px;
  font-size: 14px;
}

.bob-ui-input::placeholder,
.bob-ui-textarea::placeholder,
.input::placeholder,
.textarea::placeholder {
  color: var(--subtle);
}

.bob-ui-input:hover:not(:disabled):not(:focus),
.bob-ui-textarea:hover:not(:disabled):not(:focus),
.input:hover:not(:disabled):not(:focus),
.textarea:hover:not(:disabled):not(:focus) {
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line-strong));
}

.bob-ui-input:focus,
.bob-ui-input:focus-visible,
.bob-ui-select:focus,
.bob-ui-select:focus-visible,
.bob-ui-textarea:focus,
.bob-ui-textarea:focus-visible,
.input:focus,
.input:focus-visible,
.select:focus,
.select:focus-visible,
.textarea:focus,
.textarea:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.bob-ui-input[aria-invalid="true"],
.input[aria-invalid="true"],
.bob-ui-textarea[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}

.bob-ui-input:disabled,
.input:disabled,
.bob-ui-select:disabled,
.select:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  box-shadow: none;
}

.gate-field > span:first-child,
.settings-row label > span:first-child {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 560;
}

.gate-field {
  gap: 7px;
}

.gate-form {
  gap: 14px;
}

/* Error y aviso: una franja con su color, misma forma. */
.gate-error,
.bob-ui-alert[data-variant="destructive"] {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line));
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
  animation: bob-enter var(--motion-fast) var(--ease-enter) both;
}

.gate-note,
.security-status {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: var(--radius-md);
}

.gate-warning {
  border-radius: var(--radius-md);
}

/* ═══════════════════════════════════════════════════════════════════════
   6 · LA PUERTA (login · alta · nuevo dispositivo · recuperación · Kits · MFA)
   Fondo blanco, contenido centrado, formulario directamente sobre el fondo:
   sin tarjeta exterior, sin «modal flotante». Los controles conservan sus
   propios bordes y estados. El DOM es UNO para la web y el Escritorio
   (PuertaShell.js), también en registro.mybob.dev: nada de `.card` aquí
   (su `overflow: hidden` recortaba el anillo de foco en la web).
   ═══════════════════════════════════════════════════════════════════════ */
.bob-gate {
  gap: 14px;
  padding: 56px 20px 40px;
  background: var(--surface);
}

body:has(> #app > .bob-gate),
body:has(.bob-gate) {
  background: var(--surface);
}

.gate-card {
  width: min(100%, 440px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: bob-enter var(--motion-slow) var(--ease-enter) both;
}

.bob-gate.is-leaving .gate-card {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--motion-base) var(--ease-exit), transform var(--motion-base) var(--ease-exit);
}

/* Los pasos del registro (ocho) necesitan un poco más de sitio. */
.bob-gate:has(.gate-form[data-paso]) .gate-card,
.bob-gate:has(.gate-stepper) .gate-card {
  width: min(100%, 460px);
}

.gate-brand {
  width: 44px;
  height: 44px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(23, 22, 20, 0.08), 0 8px 20px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}

.gate-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.2;
}

.gate-lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.gate-footnote {
  margin: 0;
  color: var(--subtle);
  font-size: 12.5px;
}

.gate-stepper .bob-pasos-nombre {
  font-size: 20px;
  font-weight: 640;
}

/* Cada paso entra desde el lado hacia el que se avanza; muy leve, nunca un carrusel. */
.bob-pasos-cuerpo > *,
.gate-body > * {
  animation: bob-enter-forward var(--motion-base) var(--ease-enter) both;
}

.bob-pasos-cuerpo[data-direccion="atras"] > * {
  animation-name: bob-enter-back;
}

/* El indicador de progreso se mueve con el paso. */
.bob-pasos-puntos {
  gap: 5px;
  margin: 4px 0 14px;
}

.bob-pasos-puntos li {
  height: 3px;
  transition: background-color var(--motion-base) var(--ease-standard);
}

/* Opciones (elegir edición, planes) y bloques (Kits) como tarjetas suaves. */
.gate-option,
.dos-llaves-bloque,
.gate-kit-completo {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

.gate-option:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.gate-check {
  border-radius: var(--radius-md);
}

/* Compacto en el móvil: márgenes cortos, nada se desborda. */
@media (max-width: 480px) {
  .bob-gate {
    padding: 36px 18px 28px;
  }

  .gate-title {
    font-size: 22px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   7 · MODAL · fondo, panel, cabecera, cierre
   ═══════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  padding: 24px 16px;
  background: rgba(23, 22, 20, 0.28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: bob-fade var(--motion-fast) var(--ease-standard) both;
}

/*
 * ESCRITORIO · LA ✕ QUE NO CERRABA (2026-10-19, reproducido). `.bob-bar` y el
 * `.topbar` de Finance son la barra de título arrastrable de la ventana
 * (`-webkit-app-region: drag`, hasta ~134 px desde arriba). Electron decide
 * las zonas de arrastre por los elementos que las declaran, NO por lo que
 * haya encima: una modal centrada en una ventana baja ponía la ✕ a ~100 px,
 * dentro de esa zona, y el clic real de ratón movía la ventana en vez de
 * llegar al botón (pulsar fuera, más abajo, sí cerraba). Lo que flota sobre
 * la app se declara NO arrastrable, completo.
 */
html.is-desktop .modal-backdrop,
html.is-desktop .popover,
html.is-desktop .toast-region,
html.is-desktop .tooltip {
  -webkit-app-region: no-drag;
}

.modal {
  border-color: var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: bob-pop var(--motion-base) var(--ease-enter) both;
}

.modal-backdrop.is-leaving {
  animation: bob-fade-out var(--motion-fast) var(--ease-exit) both;
}

.modal-header {
  align-items: center;
  padding: 18px 16px 14px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-title {
  font-size: 16px;
  font-weight: 640;
}

.modal-subtitle {
  margin-top: 1px;
  font-size: 13px;
}

/* La ✕: objetivo cómodo, estados claros. */
.modal-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--row-hover);
  color: var(--ink);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-close:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px var(--ring);
}

.modal-body {
  padding: 16px 22px 22px;
}

.modal-footer {
  gap: 8px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════
   8 · POPOVERS, MENÚS, TOOLTIP
   ═══════════════════════════════════════════════════════════════════════ */
.popover {
  padding: 5px;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: bob-pop var(--motion-fast) var(--ease-enter) both;
}

.menu-item {
  min-height: 34px;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13.5px;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.menu-item:hover:not(:disabled):not([aria-disabled="true"]),
.menu-item:focus-visible {
  background: var(--row-hover);
}

.menu-item.danger,
.menu-item[data-tone="danger"] {
  color: var(--danger);
}

.menu-item.danger:hover:not(:disabled),
.menu-item[data-tone="danger"]:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

.menu-divider {
  margin: 4px -5px;
}

.tooltip {
  border-radius: 7px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   9 · TOASTS · neutro (el de siempre) y cuatro tonos
   ═══════════════════════════════════════════════════════════════════════ */
.toast {
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: bob-enter var(--motion-base) var(--ease-enter) both;
}

.toast.is-leaving {
  animation: bob-leave var(--motion-fast) var(--ease-exit) both;
}

.toast[data-tone="success"] { background: var(--accent); color: var(--accent-ink); }
.toast[data-tone="error"] { background: var(--danger); color: #fff; }
.toast[data-tone="warning"] { background: var(--warning); color: #fff; }
.toast[data-tone="info"] { background: var(--info); color: #fff; }

.toast-action {
  border-radius: 7px;
  transition: background-color var(--motion-fast) var(--ease-standard);
}

/* ═══════════════════════════════════════════════════════════════════════
   10 · CONFIGURACIÓN · contenedor, cabecera, barra lateral, secciones
   ═══════════════════════════════════════════════════════════════════════ */
.bob-settings-modal {
  width: min(900px, 100%);
  border-radius: var(--radius-xl);
}

.bob-settings-modal .modal-header {
  padding: 16px 14px 14px 22px;
}

.bob-settings {
  grid-template-columns: 232px minmax(0, 1fr);
  height: min(640px, 74vh);
}

/* Barra lateral: superficie apagada, ítems de 34 px, el elegido en blanco con línea. */
.bob-settings-nav {
  gap: 1px;
  padding: 12px 10px;
  border-right: 1px solid var(--line-soft);
  background: var(--surface-muted);
}

.bob-settings-grupo {
  margin: 10px 10px 4px;
}

.bob-settings-grupo:first-child {
  margin-top: 2px;
}

.bob-settings-tab {
  min-height: 34px;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.bob-settings-tab .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.bob-settings-tab:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

.bob-settings-tab[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.bob-settings-tab[aria-selected="true"] .icon {
  color: var(--accent);
}

.bob-settings-tab:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -1px;
}

/* Contenido: aire, cabecera de sección discreta, filas cómodas. */
.bob-settings-panes {
  padding: 22px 26px 26px;
}

/* Al cambiar de sección, el panel nuevo entra (el estado cambia antes; esto solo lo presenta). */
.bob-settings-pane:not([hidden]) {
  animation: bob-enter var(--motion-base) var(--ease-enter) both;
}

.settings {
  gap: 24px;
}

.settings-heading {
  margin: 0 0 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-row {
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.settings-title {
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.settings-title .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.settings-hint {
  font-size: 13px;
  line-height: 1.45;
}

.settings-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* Ventana estrecha: secciones arriba en una fila. */
@media (max-width: 720px) {
  .bob-settings-nav {
    gap: 4px;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .bob-settings-grupo {
    display: none;
  }

  .bob-settings-panes {
    padding: 16px 16px 20px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   11 · GRUPOS · lista → detalle → Miembros / Bóvedas / Configuración
   ═══════════════════════════════════════════════════════════════════════ */
/* Sin grupos: un estado vacío (icono, titular, una línea, las dos acciones). */
.family-intro {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 6px 0 12px;
  padding: 36px 24px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.family-intro::before {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--surface) center / 20px no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231f6b55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>");
  box-shadow: var(--shadow-sm);
}

.family-intro + .family-actions,
.family-intro ~ .family-actions {
  justify-content: center;
  margin: -4px 0 14px;
  padding: 0 0 18px;
}

/* Tarjetas de grupo: claramente pulsables. */
.family-cards {
  gap: 10px;
}

.family-card {
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

.family-card:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.family-card:hover .family-card-chevron {
  color: var(--ink);
  transform: translateX(2px);
}

.family-card-chevron {
  transition: color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.family-card-tile {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.family-card-name {
  font-size: 14px;
}

.family-card-role {
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 560;
}

/* Detalle: migas, cabecera moderna, pestañas de línea. */
.family-crumbs {
  margin: 0 0 10px;
}

.family-head {
  align-items: center;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line-soft);
}

.family-head .settings-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.family-head .settings-title .icon {
  width: 20px;
  height: 20px;
}

.family-tabs > [role="tablist"] {
  gap: 2px;
  margin: 8px 0 14px;
}

.family-tabs [role="tab"] {
  position: relative;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-weight: 540;
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

.family-tabs [role="tab"]:hover {
  background: var(--row-hover);
  color: var(--ink);
}

.family-tabs [role="tab"][aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.family-tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: -1px;
  left: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  animation: bob-fade var(--motion-base) var(--ease-standard) both;
}

.family-tabs [role="tabpanel"]:not([hidden]) {
  animation: bob-enter var(--motion-base) var(--ease-enter) both;
}

/* Miembros: avatar · nombre · rol · acciones. */
.vault-member-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vault-member-list > li,
.family-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* Bóvedas: Finance y Passwords aparte, cada bóveda una fila/tarjeta. */
.family-vaults-module-title {
  margin: 14px 0 6px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.family-vault-access {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.family-vault-access + .family-vault-access {
  margin-top: 6px;
}

.family-vault-icon {
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════
   12 · FINANCE · métricas, General, próximos pagos, próximos meses, tabla
   ═══════════════════════════════════════════════════════════════════════ */
.page {
  padding-top: 36px;
}

/* Métricas: tarjetas diseñadas (etiqueta arriba, cifra grande, acción secundaria). */
.metrics {
  width: min(680px, 100%);
  gap: 10px;
  margin-bottom: 32px;
}

.metric {
  align-items: flex-start;
  gap: 6px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric > .metric-value {
  order: 2;
  font-size: 24px;
  font-weight: 640;
  letter-spacing: -0.025em;
}

.metric > .metric-label {
  order: 1;
}

.metric > .metric-action {
  order: 3;
  margin-top: 2px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 540;
}

/* General: la lista en una superficie con filas altas y jerarquía de importes. */
.overview {
  gap: 28px;
}

.overview-list {
  padding: 4px;
}

.overview-row {
  min-height: 56px;
  gap: 14px;
  border-radius: 10px;
  transition: background-color var(--motion-fast) var(--ease-standard);
}

.overview-row:hover {
  background: var(--row-hover);
}

.overview-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.overview-name {
  font-size: 14px;
  font-weight: 560;
}

.overview-amount {
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.overview-share {
  font-size: 12.5px;
}

.overview-section-title {
  padding: 0 2px 2px;
}

/* Próximos pagos: fecha · nombre · categoría · cuándo · importe. */
.payments-list {
  padding: 4px;
}

.payment-row {
  min-height: 52px;
  border-radius: 10px;
  transition: background-color var(--motion-fast) var(--ease-standard);
}

.payment-row:hover {
  background: var(--row-hover);
}

.payment-date {
  color: var(--ink-soft);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.payment-amount {
  font-weight: 620;
  letter-spacing: -0.01em;
}

/* Próximos meses: mismas cifras, columnas con su barra. */
.forecast {
  border-color: var(--line);
}

.forecast-month {
  padding: 12px 14px 12px;
}

.forecast-label {
  font-weight: 560;
}

.forecast-amount {
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -0.015em;
}

.forecast-bar {
  border-radius: 999px;
  background: var(--line-soft);
}

.forecast-bar > span {
  border-radius: 999px;
  background: var(--accent);
  transition: width var(--motion-slow) var(--ease-standard);
}

/* Superficies (la tabla y la lista de General). */
.surface {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* AG Grid: solo tema (cabecera, bordes, hover, selección), ninguna lógica. */
.table-surface .ag-header {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.table-surface .ag-header-cell-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.table-surface .ag-row {
  border-color: var(--line-soft);
}

.table-surface .ag-row-hover::before,
.table-surface .ag-row-hover {
  background: var(--row-hover);
}

.table-surface .ag-row-selected::before,
.table-surface .ag-row-selected {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

/* ═══════════════════════════════════════════════════════════════════════
   13 · PASSWORDS · paneles, lista, búsqueda, detalle, estados vacíos
   ═══════════════════════════════════════════════════════════════════════ */
.pw-preview-notice {
  border: 1px solid color-mix(in srgb, var(--warning) 26%, var(--line));
  background: var(--warning-soft);
  color: color-mix(in srgb, var(--warning) 72%, var(--ink));
}

.pw-pane {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.pw-list-pane {
  background: var(--surface);
}

.pw-list-head {
  padding: 16px 14px 12px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.pw-list-titles strong {
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.pw-search {
  margin: 10px 10px 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.pw-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

.pw-list {
  padding: 6px;
}

.pw-list-item {
  min-height: 52px;
  border-radius: 10px;
  transition: background-color var(--motion-fast) var(--ease-standard);
}

.pw-list-item:hover {
  background: var(--row-hover);
}

.pw-list-item[aria-selected="true"] {
  background: var(--accent-soft);
}

.pw-list-item .bob-tile {
  border-radius: 10px;
}

/* Detalle vacío: no una gran superficie en blanco, sino un estado con intención. */
.pw-empty,
.pw-placeholder {
  gap: 8px;
  color: var(--muted);
}

.pw-placeholder {
  align-content: center;
  padding: 48px 32px;
}

.pw-placeholder > svg,
.pw-empty > svg {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.pw-placeholder p,
.pw-empty p {
  max-width: 320px;
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.pw-detail-pane:not(:empty) > * {
  animation: bob-enter var(--motion-base) var(--ease-enter) both;
}

/* ═══════════════════════════════════════════════════════════════════════
   14 · TARJETAS, CHIPS, ESTADOS VACÍOS, INTERRUPTORES
   ═══════════════════════════════════════════════════════════════════════ */
.bob-ui-card,
.card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.bob-ui-badge,
.badge {
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 580;
}

.bob-tile {
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════
   15 · RESPONSIVE · 1440 · 1280 · 1024 · 820 · 390 (auth)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .metrics {
    width: min(100%, 720px);
  }
}

@media (max-width: 820px) {
  .product-switch-option {
    min-width: 0;
    padding: 0 12px;
  }

  .context-avatar-label {
    max-width: 120px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bob-settings-modal {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .bob {
    --bob-bar-height: 60px;
  }

  .product-switch-option {
    height: 34px;
    gap: 6px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .context-avatar-label {
    display: none;
  }

  .context-avatar {
    padding-right: 7px;
  }

  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   16 · SIN MOVIMIENTO · la interfaz entera sigue igual de usable
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .bob-pasos-cuerpo > *,
  .gate-body > *,
  .gate-card,
  [data-module-root]:not([hidden]),
  .bob-settings-pane:not([hidden]),
  .family-tabs [role="tabpanel"]:not([hidden]),
  .pw-detail-pane:not(:empty) > *,
  .modal,
  .modal-backdrop,
  .popover,
  .toast,
  .gate-error {
    animation: none;
  }

  .family-card:hover,
  .icon-button:active,
  .bob-ui-button:active:not(:disabled),
  .modal-close:active {
    transform: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   17 · AJUSTES FINOS (tras la primera comparación before/after)
   ═══════════════════════════════════════════════════════════════════════ */
/* Las acciones de una fila de ajustes: contorno discreto, no texto suelto. */
.settings-actions .bob-ui-button[data-variant="ghost"],
.settings-row > .bob-ui-button[data-variant="ghost"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.settings-actions .bob-ui-button[data-variant="ghost"]:hover:not(:disabled),
.settings-row > .bob-ui-button[data-variant="ghost"]:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--row-hover);
  color: var(--ink);
}

/* Los enlaces secundarios de la puerta, juntos y con el mismo ritmo. */
.gate-actions-row,
.gate-crear-cuenta {
  margin-top: 4px;
}

.gate-form + .gate-link,
.gate-form ~ .gate-link,
.gate-form ~ .gate-actions-row {
  justify-self: center;
  margin-top: 6px;
}

/* Grupos · el pie del estado vacío, como una nota centrada. */
.family-empty {
  margin: -2px 0 0;
  color: var(--subtle);
  font-size: 12.5px;
  text-align: center;
}

/* Passwords · el detalle vacío: una zona con intención dentro del panel. */
.pw-detail-pane:has(> .pw-placeholder) {
  background: var(--surface-muted);
  box-shadow: none;
}

.pw-placeholder {
  margin: auto;
  padding: 40px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex: 0 0 auto;
}

/* Passwords · detalle: lectura y edición reservan el MISMO sitio (inline-edit.mjs mide los rectángulos). */
.pw-detail-pane .bob-ui-button {
  height: 32px;
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
}

.pw-detail-pane .icon-button {
  width: 30px;
  height: 30px;
}

.pw-detail-pane .icon-button.small {
  width: 26px;
  height: 26px;
}
