/* ==========================================================================
   ¿DÓNDE ESTÁ MI RNM? — SISTEMA VISUAL FINTECH PREMIUM
   Tokens, Layout Compartido, Componentes Base y Responsive
   ========================================================================== */

:root {
  /* --- Paleta Cromática --- */
  --canvas: #F6F8FC;             /* Fondo general de la aplicación */
  --surface: #FFFFFF;            /* Superficies, tarjetas, paneles */
  --surface-alt: #F8FAFC;        /* Superficie sutil / hover ligero */
  --surface-raised: #FFFFFF;     /* Modales y flotantes */

  --brand: #155EEF;              /* Azul principal de acción */
  --brand-hover: #0C44C7;        /* Hover para acción principal */
  --brand-soft: #EFF6FF;         /* Azul muy claro para fondos de acento */
  --brand-line: #B2CCFF;         /* Borde de acento azul */

  --navy: #102A56;               /* Azul marino profundo (marca y seriedad) */
  --navy-dark: #0A1B38;          /* Fondo lateral / elementos profundos */

  --text-main: #182230;          /* Texto principal de alto contraste */
  --text-muted: #667085;         /* Texto secundario y metadatos */
  --text-subtle: #98A2B3;        /* Placeholders y deshabilitados */

  --line: #E4E7EC;               /* Bordes generales y separadores */
  --line-strong: #D0D5DD;        /* Bordes de formularios e inputs */

  /* --- Colores Semánticos de Estado --- */
  --success: #067647;            /* Verde accesible */
  --success-soft: #ECFDF3;
  --success-line: #A6F4C5;

  --warning: #B54708;            /* Ámbar accesible */
  --warning-soft: #FFFAEB;
  --warning-line: #FEDF89;

  --danger: #B42318;             /* Rojo accesible */
  --danger-soft: #FEF3F2;
  --danger-line: #FECDCA;

  --info: #026AA2;
  --info-soft: #F0F9FF;
  --info-line: #B9E6FE;

  /* --- Geometría y Elevación --- */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --control-h: 50px;             /* Altura estándar de botones e inputs */
  --sidebar-w: 260px;            /* Ancho de la barra lateral en escritorio */
  --header-h: 70px;              /* Altura de cabecera superior */
  --bottom-nav-h: 64px;          /* Altura barra inferior móvil */

  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 42, 86, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 42, 86, 0.10);
  --shadow-float: 0 20px 48px rgba(16, 42, 86, 0.18);

  /* --- Tipografía --- */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Reseteo y Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--canvas);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Estructura Global (App Shell) --- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--canvas);
}

/* --- Barra Lateral (Desktop) --- */
.app-sidebar {
  width: var(--sidebar-w);
  background-color: var(--navy);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  box-shadow: 2px 0 12px rgba(10, 27, 56, 0.15);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(21, 94, 239, 0.35);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.2;
}

.brand-badge {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93C5FD;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #D0D5DD;
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(21, 94, 239, 0.3);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-badge-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: #2E90FA;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info-text {
  min-width: 0;
  flex: 1;
}

.user-email-text {
  font-size: 0.82rem;
  color: #F2F4F7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* --- Contenedor Principal de Contenido --- */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* --- Cabecera Superior (Desktop & Móvil) --- */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.header-title-box h1 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.header-title-box p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Área de Vista / Contenido --- */
.app-content {
  flex: 1;
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* --- Barra de Navegación Inferior (Móvil) --- */
.app-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 45;
  box-shadow: 0 -4px 16px rgba(16, 42, 86, 0.08);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  stroke-width: 1.8;
}

.bottom-nav-item.active {
  color: var(--brand);
  font-weight: 700;
}

/* --- Tarjetas y Superficies --- */
.tarjeta, .panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.tarjeta:hover {
  box-shadow: var(--shadow-lg);
  border-color: #D1E0FF;
}

/* --- Cabecera de Página (PageHeader) --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header-text h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.page-header-text p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* --- Botones --- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background-color: var(--brand);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

button:hover, .btn:hover {
  background-color: var(--brand-hover);
  box-shadow: var(--shadow-md);
}

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

button:disabled, .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.sec, .btn-sec {
  background-color: var(--surface);
  color: var(--brand);
  border-color: var(--brand-line);
  box-shadow: none;
}

button.sec:hover, .btn-sec:hover {
  background-color: var(--brand-soft);
  border-color: var(--brand);
}

button.danger, .btn-danger {
  background-color: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
  box-shadow: none;
}

button.danger:hover, .btn-danger:hover {
  background-color: var(--danger);
  color: #FFFFFF;
}

button.google {
  width: 100%;
  background: #FFFFFF;
  color: #1F2A37;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

button.google:hover {
  background: var(--surface-alt);
  border-color: #9CA3AF;
}

.btn-enlace {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: #25D366;
  color: #053315;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}

.btn-enlace:hover {
  background: #1EBE5D;
}

/* --- Formularios y Campos (FormField) --- */
.form-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #344054;
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 14px;
  font-size: 0.98rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.14);
}

.campo-mp {
  min-height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  display: flex;
  align-items: center;
}

.campo-mp iframe {
  height: 46px !important;
  width: 100% !important;
}

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

.check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Badges e Insignias de Estado (StatusBadge) --- */
.insignia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-line);
}

.insignia.ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}

.insignia.vigila {
  background: var(--brand-soft);
  color: #1849A9;
  border-color: var(--brand-line);
}

.insignia.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}

/* --- Cajas de Resultado y Explicación --- */
.res {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 5px solid var(--warning);
  background: var(--warning-soft);
}

.res.ok {
  border-color: var(--success);
  background: var(--success-soft);
}

.res.mal {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.res h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
}

.res p {
  margin: 4px 0;
  font-size: 0.92rem;
  color: #344054;
}

/* --- Mensajes de Feedback --- */
.msg {
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--danger);
  min-height: 1.3em;
}

.msg.bien {
  color: var(--success);
}

/* --- Diálogos Modales --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 42, 86, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-caja {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-float);
  outline: none;
}

.modal .cerrar {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  font-size: 1.4rem;
  line-height: 1;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal .cerrar:hover {
  background: var(--line);
  color: var(--text-main);
}

/* --- Utilidades --- */
.oculto {
  display: none !important;
}

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

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pie {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pie a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

/* --- Cuadrícula de Planes --- */
.planes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.plan {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.plan:hover {
  border-color: var(--brand-line);
  background: var(--surface-alt);
}

.plan.sel {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand);
}

.plan b {
  font-size: 1.05rem;
  font-weight: 700;
}

.plan .precio {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand);
}

.plan small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan small.ahorro {
  color: var(--success);
  font-weight: 700;
}

.plan small.mejor {
  color: var(--brand);
  font-weight: 700;
}

/* --- Adaptación Responsive --- */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-main {
    margin-left: 0;
  }

  .app-bottom-nav {
    display: flex;
  }

  .app-content {
    padding: 20px 16px calc(var(--bottom-nav-h) + 36px);
  }

  .app-header {
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .fila {
    flex-direction: column;
    align-items: stretch;
  }

  .acciones button, .acciones .btn {
    width: 100%;
  }

  .tarjeta, .panel-card {
    padding: 18px;
  }

  .planes {
    grid-template-columns: 1fr;
  }
}

/* --- Componentes Entrega 2: Dashboard, Seguimiento y Timeline --- */

/* Hero Dominante del Dashboard (Tarjeta Principal de Estado) */
.dashboard-hero {
  background: var(--surface);
  border: 1px solid #D1E0FF;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 8px 24px rgba(16, 42, 86, 0.08);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  background: var(--brand);
}

.dashboard-hero.status-ok::before {
  background: var(--success);
}

.dashboard-hero.status-mal::before {
  background: var(--danger);
}

.dashboard-hero.status-aviso::before {
  background: var(--warning);
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}

.hero-rnm-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.hero-state-box {
  margin: 16px 0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.hero-state-box h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.hero-state-box p {
  margin: 4px 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.hero-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hero-timestamp {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Tarjeta Siguiente Paso Recomendado */
.next-step-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 100%);
  border: 1px solid #B2CCFF;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.next-step-content h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #102A56;
}

.next-step-content p {
  margin: 0;
  font-size: 0.9rem;
  color: #344054;
}

/* Cuadrícula de Accesos Rápidos */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.quick-action-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.quick-action-card:hover {
  border-color: #B2CCFF;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-icon svg {
  width: 22px;
  height: 22px;
}

.quick-action-text b {
  display: block;
  font-size: 0.94rem;
  color: var(--navy);
  margin-bottom: 2px;
}

.quick-action-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Píldoras de Filtro para Mis RNM */
.filter-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pill {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: #B2CCFF;
  color: var(--brand);
}

.filter-pill.active {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(21, 94, 239, 0.25);
}

/* Línea de Tiempo (RnmTimeline) */
.timeline {
  position: relative;
  padding-left: 28px;
  margin: 20px 0;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 9px;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  margin-bottom: 22px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.timeline-dot.ok {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.timeline-dot.mal {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.timeline-content {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.timeline-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.timeline-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
}

.timeline-desc {
  font-size: 0.88rem;
  color: #475467;
  margin: 0;
}

/* Estado Vacío (EmptyState) */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}

.empty-state-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.empty-state p {
  max-width: 440px;
  margin: 0 auto 20px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Stepper para proceso por etapas (Pantallas 9, 10 y 11) */
.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.stepper-step.active {
  color: var(--brand);
  font-weight: 700;
}

.stepper-step.completed {
  color: var(--success);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.stepper-step.active .step-num {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.stepper-step.completed .step-num {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 12px;
}

/* Tarjeta de Confirmación de Datos (Pantalla 10) */
.review-summary-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
}

.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

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

.review-row b {
  color: var(--navy);
  font-family: monospace, sans-serif;
  font-size: 1.05rem;
}

/* Items del Historial de Consultas (Pantalla 12) */
.history-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.history-card:hover {
  border-color: #B2CCFF;
  box-shadow: var(--shadow-md);
}

.history-rnm {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Soporte de Accesibilidad: Movimiento Reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Corrección móvil: la cabecera no debe solaparse (Planes y Mis datos ya están en la navegación inferior) --- */
@media (max-width: 640px) {
  .header-title-box { min-width: 0; flex: 1; }
  .header-title-box h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-title-box p { display: none; }
  .header-actions { flex: none; }
  .header-actions #btn-planes, .header-actions #btn-datos { display: none; }
}

/* --- Accesibilidad: foco visible al navegar con teclado --- */
button:focus-visible, a:focus-visible, .nav-item:focus-visible, .bottom-nav-item:focus-visible,
.quick-action-card:focus-visible, .filter-pill:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(21, 94, 239, 0.55);
  outline-offset: 2px;
}

/* --- Resumen: filas compactas de RNM y preguntas plegables --- */
.fila-rnm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fila-rnm:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.fila-rnm:focus-visible { outline: 3px solid rgba(21, 94, 239, 0.55); outline-offset: 2px; }
.fila-rnm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fila-rnm-info b { font-size: 1.02rem; color: var(--navy); letter-spacing: 0.02em; }
.fila-rnm-info span { font-size: 0.86rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-rnm-flecha { font-size: 1.4rem; color: var(--text-subtle); line-height: 1; }

.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq details:last-child { border-bottom: none; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--text-main); padding: 10px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 12px; color: var(--text-muted); font-size: 0.92rem; }

/* --- Historial plegable en el detalle del RNM --- */
.historial summary { cursor: pointer; font-weight: 700; color: var(--navy); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.historial summary::-webkit-details-marker { display: none; }
.historial summary::after { content: "+"; color: var(--brand); font-weight: 700; font-size: 1.2rem; }
.historial[open] summary::after { content: "–"; }
.historial .timeline { margin: 16px 0 0; }

/* ==========================================================================
   POPUPS: modal base, diálogo de confirmación y pantalla de pago
   ========================================================================== */
.modal { animation: modal-fondo 0.18s ease-out; }
.modal-caja { animation: modal-entra 0.22s cubic-bezier(0.16, 1, 0.3, 1); padding: 28px; }
@keyframes modal-fondo { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-entra { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal .cerrar { z-index: 2; width: 38px; height: 38px; }
.modal .cerrar:focus-visible { outline: 3px solid rgba(21, 94, 239, 0.55); outline-offset: 2px; }
#modal-planes .modal-caja { max-width: 560px; padding-top: 24px; }
#modal-planes .modal-caja > #cartel { margin-top: 4px; }

/* En celular los popups suben desde abajo, como en las apps de pago */
@media (max-width: 640px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-caja { max-width: none; border-radius: 22px 22px 0 0; max-height: 94vh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px)); animation: modal-sube 0.26s cubic-bezier(0.16, 1, 0.3, 1); }
  .modal-caja::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: -8px auto 14px; }
  #modal-confirmar { align-items: center; padding: 16px; }
  #modal-confirmar .modal-caja { border-radius: var(--radius-lg); animation: modal-entra 0.22s ease-out; }
  #modal-confirmar .modal-caja::before { display: none; }
  #modal-confirmar .acciones button { width: 100%; }
}
@keyframes modal-sube { from { transform: translateY(100%); } to { transform: none; } }

/* Diálogo de confirmación */
#modal-confirmar .modal-caja { text-align: center; padding: 28px 24px 22px; }
#modal-confirmar .modal-caja::after { content: none; }
#confirm-titulo { font-size: 1.15rem; margin: 0 0 8px; }
#modal-confirmar .acciones { justify-content: center !important; margin-top: 8px; }
#modal-confirmar .acciones button { min-width: 130px; }

/* Pantalla de pago (plan -> forma de pago -> código) */
.pay { display: block; }
.pay-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 40px 14px 0; }
.pay-top button { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.pay-paso { display: inline-block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--brand); margin: 0 0 6px; }
.pay-top .pay-paso { margin: 0; }
.pay-titulo { margin: 0 0 6px; font-size: 1.35rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.pay-sub { margin: 18px 0 8px; font-size: 0.85rem; font-weight: 700; color: #344054; }
.pay-nota { margin: 12px 0 0; font-size: 0.84rem; color: var(--text-muted); line-height: 1.45; }
.pay-resumen { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 18px; margin: 12px 0 4px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--brand-soft), #FFFFFF); border: 1px solid var(--brand-line); }
.pay-resumen b { display: block; color: var(--navy); font-size: 1rem; }
.pay-resumen span { font-size: 0.82rem; color: var(--text-muted); }
.pay-precio { text-align: right; flex-shrink: 0; }
.pay-precio b { font-size: 1.45rem; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }
.pay-precio span { display: block; }

.metodos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metodo { flex-direction: column; gap: 2px; padding: 14px 8px; min-height: 0; background: var(--surface); color: var(--text-main); border: 2px solid var(--line); box-shadow: none; text-align: center; white-space: normal; }
.metodo:hover { background: var(--surface-alt); border-color: var(--brand-line); box-shadow: none; }
.metodo svg { width: 26px; height: 26px; color: var(--text-muted); margin-bottom: 4px; }
.metodo b { font-size: 0.95rem; }
.metodo small { font-size: 0.74rem; font-weight: 500; color: var(--text-muted); }
.metodo.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.metodo.sel svg { color: var(--brand); }
.metodo:focus-visible { outline: 3px solid rgba(21, 94, 239, 0.55); outline-offset: 2px; }

.pay-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-alt); }
.pay-panel label { margin-top: 12px; }
.pay-panel label:first-child { margin-top: 0; }
.pay-boton { width: 100%; margin-top: 16px; min-height: 52px; font-size: 1rem; }
.pay-seguro { margin: 16px 0 0; font-size: 0.8rem; color: var(--text-muted); text-align: center; }

.pix-qr { display: flex; justify-content: center; margin: 16px 0 6px; }
.pix-qr img { width: 210px; height: 210px; padding: 10px; background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); image-rendering: pixelated; }
.pay-pasos { margin: 14px 0 6px; padding-left: 20px; font-size: 0.88rem; color: #344054; line-height: 1.6; }
.copiar-fila { display: flex; gap: 8px; }
.copiar-fila input { flex: 1; min-width: 0; font-family: monospace, sans-serif; font-size: 0.82rem; background: var(--surface-alt); }
.copiar-fila button { flex-shrink: 0; padding: 0 18px; }
a.pay-boton { text-decoration: none; }

.pay-espera { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; padding: 12px; border-radius: var(--radius-sm); background: var(--warning-soft); border: 1px solid var(--warning-line); color: var(--warning); font-size: 0.86rem; font-weight: 600; }
.punto { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: pulso 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes pulso { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }

.pay-centro { text-align: center; padding: 8px 0 4px; }
.pay-centro .acciones { justify-content: center; }
.pay-icono { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--warning-soft); color: var(--warning); }
.pay-icono .punto { width: 18px; height: 18px; }
.pay-icono.ok { background: var(--success-soft); color: var(--success); animation: modal-entra 0.35s ease-out; }
.pay-icono svg { width: 34px; height: 34px; }

@media (max-width: 420px) {
  .metodos { gap: 8px; }
  .metodo { padding: 12px 4px; }
  .pix-qr img { width: 180px; height: 180px; }
}
@media (prefers-reduced-motion: reduce) { .punto { animation: none; } }

@media (max-width: 640px) {
  .planes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .plan { padding: 14px 12px; }
  .plan .precio { font-size: 1.05rem; }
  .plan small.separado { display: none; }
  .pay-titulo { font-size: 1.2rem; }
}
@media (max-width: 640px) { .pay-panel .fila { flex-direction: row; align-items: flex-start; } }

/* ==========================================================================
   TARJETAS MÁS COMPACTAS + estado por color en las filas de RNM
   ========================================================================== */
.tarjeta, .panel-card { padding: 16px 18px; margin-bottom: 12px; border-radius: var(--radius-md); }
.tarjeta h2 { font-size: 1.2rem; margin: 0 0 4px; }
.tarjeta h3 { font-size: 1.02rem; }
.res { margin-top: 10px; padding: 12px 14px; }
.res h3 { font-size: 0.98rem; margin-bottom: 4px; }
.res p { margin: 3px 0; font-size: 0.88rem; }
.page-header { margin-bottom: 14px; }
.page-header-text h2 { font-size: 1.25rem; }
.app-content { padding-top: 20px; }
.app-header { height: 60px; }
.next-step-card { padding: 12px 16px; margin-bottom: 16px; gap: 14px; }
.next-step-content h3 { font-size: 0.98rem; }
.review-summary-card { padding: 12px 16px; margin: 10px 0; }
.review-row { padding: 8px 0; }
.empty-state { padding: 28px 20px; margin: 12px 0; }
.empty-state-icon { width: 48px; height: 48px; margin-bottom: 10px; }
.history-card { padding: 12px 16px; margin-bottom: 8px; }
.fila-rnm { padding: 11px 14px; margin-bottom: 8px; border-left: 4px solid var(--warning); }
.fila-rnm.tono-ok { border-left-color: var(--success); }
.fila-rnm.tono-mal { border-left-color: var(--danger); }
.fila-rnm.tono-aviso { border-left-color: var(--warning); }
.fila-rnm-info span { font-size: 0.84rem; }
.insignia { padding: 3px 10px; font-size: 0.74rem; }
.filter-pills { margin-bottom: 12px; }
.timeline-content { padding: 9px 12px; }
.timeline-item { margin-bottom: 12px; }
@media (max-width: 640px) {
  .tarjeta, .panel-card { padding: 14px; }
  .app-content { padding: 14px 14px calc(var(--bottom-nav-h) + 28px); }
  .fila-rnm-info span { white-space: normal; }
}
.saludo-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ==========================================================================
   CAPA PROFESIONAL v2: jerarquía, ritmo y detalle (sobrescribe lo anterior)
   ========================================================================== */
:root {
  --canvas: #F4F6FA;
  --line: #E6EAF2;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 8px rgba(16, 42, 86, 0.06);
  --shadow-lg: 0 8px 24px rgba(16, 42, 86, 0.09);
}
html, body { font-feature-settings: "tnum" 1, "cv11" 1; letter-spacing: -0.003em; }
h1, h2, h3, h4 { letter-spacing: -0.015em; }

/* Barra lateral */
.app-sidebar { background: linear-gradient(180deg, #12306A 0%, #0C2147 100%); box-shadow: none; border-right: 1px solid rgba(255, 255, 255, 0.04); }
.sidebar-brand { padding: 20px 18px; }
.brand-icon { background: linear-gradient(135deg, #3B82F6, #155EEF); box-shadow: 0 6px 14px rgba(21, 94, 239, 0.4); border-radius: 10px; }
.brand-title { font-size: 0.98rem; }
.nav-item { padding: 10px 12px; border-radius: 10px; color: #C7D2E6; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); }
.nav-item.active { background: rgba(255, 255, 255, 0.12); color: #FFFFFF; box-shadow: inset 3px 0 0 #60A5FA; }
.nav-item.active svg { color: #93C5FD; }
.user-badge-sidebar { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.06); }

/* Cabecera */
.app-header { background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(160%) blur(10px); box-shadow: none; border-bottom: 1px solid var(--line); }
.header-title-box h1 { font-size: 1.1rem; font-weight: 700; }

/* Superficies */
.tarjeta, .panel-card { border-color: var(--line); box-shadow: var(--shadow-sm); transition: none; }
.tarjeta:hover { box-shadow: var(--shadow-sm); border-color: var(--line); }

/* Botones */
button, .btn { border-radius: 10px; letter-spacing: 0; }
button:not(.sec):not(.danger):not(.google):not(.plan):not(.metodo):not(.filter-pill):not(.nav-item):not(.bottom-nav-item):not(.cerrar), .btn:not(.sec):not(.danger) {
  background-image: linear-gradient(180deg, #2F6FF2, #155EEF);
  box-shadow: 0 1px 2px rgba(16, 42, 86, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
button:not(.sec):not(.danger):not(.google):not(.plan):not(.metodo):not(.filter-pill):not(.nav-item):not(.bottom-nav-item):not(.cerrar):hover, .btn:not(.sec):not(.danger):hover { background-image: linear-gradient(180deg, #2A66E0, #0C44C7); }
button.sec { box-shadow: var(--shadow-sm); }

/* Resumen numérico del Inicio */

/* Filas de RNM */
.fila-rnm { gap: 14px; padding: 12px 14px; border-left-width: 1px; border-left-color: var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.fila-rnm.tono-ok, .fila-rnm.tono-mal, .fila-rnm.tono-aviso { border-left-color: var(--line); }
.fila-rnm:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.fila-icono { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--warning-soft); color: var(--warning); }
.fila-icono svg { width: 20px; height: 20px; }
.fila-icono.tono-ok { background: var(--success-soft); color: var(--success); }
.fila-icono.tono-mal { background: var(--danger-soft); color: var(--danger); }
.fila-rnm-info b { font-size: 0.98rem; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.fila-rnm-info span { font-size: 0.83rem; }

/* Tarjeta "qué puedes hacer ahora" */
.next-step-card { background: var(--surface); border: 1px solid var(--brand-line); box-shadow: var(--shadow-sm); border-left: 4px solid var(--brand); }

/* Saludo */
.saludo-fila h2 { font-size: 1.3rem; letter-spacing: -0.02em; }

/* Detalle e historial */
.res { border-left-width: 4px; border-radius: var(--radius-md); }
.timeline-content { background: var(--surface); }
.history-card { border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }

/* Insignias más sobrias */
.insignia { font-weight: 600; letter-spacing: 0; padding: 3px 10px; }

/* Formularios */
input[type="text"], select { border-radius: 10px; min-height: 46px; }
.check { border-radius: 10px; }

/* Popups */
.modal { background: rgba(10, 27, 56, 0.55); }
.modal-caja { border-radius: 18px; box-shadow: 0 24px 60px rgba(10, 27, 56, 0.3); }
.pay-resumen { background: var(--brand-soft); border-color: var(--brand-line); }
.metodo { border-radius: 12px; }

@media (max-width: 640px) {
  .app-header { background: #FFFFFF; }
}

/* Aviso de revisión semanal */
.nota-semanal { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 14px 0 4px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--radius-md); }
.nota-semanal svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--brand); margin-top: 1px; }
.nota-semanal p { margin: 0; font-size: 0.86rem; line-height: 1.45; color: #1D3A7A; }
.nota-semanal b { color: var(--navy); }

/* Aviso: activar plan tras la primera consulta */
.aviso-plan { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0 0 16px; background: var(--warning-soft); border: 1px solid var(--warning-line); border-left: 4px solid var(--warning); border-radius: var(--radius-md); }
.aviso-plan > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--warning); margin-top: 1px; }
.aviso-plan p { margin: 0 0 10px; font-size: 0.9rem; line-height: 1.45; color: #5A2E06; }
.aviso-plan b { color: #3E1F04; }
.aviso-plan button { min-height: 40px; font-size: 0.9rem; }

/* Popup de planes: tarjetas que no se desbordan y botón visible sin desplazarse */
.plan { white-space: normal; padding: 12px 14px; gap: 2px; min-height: 0; }
.plan small { white-space: normal; }
.planes { margin: 12px 0 4px; }
#cartel .pay > .acciones { margin-top: 12px; }
#cartel .pay > .acciones button { flex: 1 1 auto; }
