/* MiCerebro V7 — capa final de consistencia móvil y contraste. */
:root {
  --mc7-bg: #020711;
  --mc7-surface: #071224;
  --mc7-surface-2: #0b1930;
  --mc7-line: rgba(105, 155, 226, .22);
  --mc7-text: #f3f8ff;
  --mc7-text-2: #c8d6ea;
  --mc7-muted: #8fa0ba;
  --mc7-cyan: #35d8f4;
}

/* Cierra los huecos de contraste que podían quedar por CSS heredado. */
body.nv5,
body.nv5 #root,
body.nv5 .app,
body.nv5 .main,
body.nv5 #page { color: var(--mc7-text); }

body.nv5 .sheet,
body.nv5 .uc-panel,
body.nv5 .mo-panel,
body.nv5 .history-panel,
body.nv5 .cp-dialog,
body.nv5 .ea-sheet,
body.nv5 .mobile-more-panel,
body.nv5 .life-library,
body.nv5 .life-lib-side,
body.nv5 .life-lib-main,
body.nv5 .owner-admin,
body.nv5 .account-onboarding,
body.nv5 .command-palette,
body.nv5 .security-center,
body.nv5 .brain-search-dock,
body.nv5 .brain-wrap,
body.nv5 .brain-wrap-v2 {
  color: var(--mc7-text) !important;
  background-color: var(--mc7-bg) !important;
}

body.nv5 .uc-header,
body.nv5 .uc-actions,
body.nv5 .mo-header,
body.nv5 .history-head,
body.nv5 .sheet .row,
body.nv5 .mobile-more-head,
body.nv5 .life-lib-head {
  color: var(--mc7-text) !important;
  background: rgba(3, 10, 22, .96) !important;
  border-color: var(--mc7-line) !important;
  backdrop-filter: blur(18px) saturate(125%);
}

body.nv5 .uc-card,
body.nv5 .mo-card,
body.nv5 .history-item,
body.nv5 .cp-item,
body.nv5 .ea-card,
body.nv5 .shared-calendar-source,
body.nv5 .owner-user,
body.nv5 .account-api-policy,
body.nv5 .life-lib-item {
  color: var(--mc7-text-2) !important;
  border-color: var(--mc7-line) !important;
  background: linear-gradient(145deg, rgba(12, 25, 48, .96), rgba(5, 13, 28, .96)) !important;
}

body.nv5 .uc-card h1,
body.nv5 .uc-card h2,
body.nv5 .uc-card h3,
body.nv5 .mo-card h1,
body.nv5 .mo-card h2,
body.nv5 .mo-card h3,
body.nv5 .history-item h3,
body.nv5 .owner-user b,
body.nv5 .account-api-policy h2,
body.nv5 .life-lib-item h3,
body.nv5 .sheet h1,
body.nv5 .sheet h2,
body.nv5 .sheet h3 { color: var(--mc7-text) !important; }

body.nv5 p,
body.nv5 li,
body.nv5 .sub,
body.nv5 .note,
body.nv5 .help,
body.nv5 .description { color: inherit; }
body.nv5 .muted,
body.nv5 small { color: var(--mc7-muted) !important; }

body.nv5 input,
body.nv5 textarea,
body.nv5 select {
  color: var(--mc7-text) !important;
  background: #061226 !important;
  border-color: rgba(100, 160, 231, .28) !important;
  caret-color: var(--mc7-cyan);
}
body.nv5 input::placeholder,
body.nv5 textarea::placeholder { color: #7789a8 !important; opacity: 1; }
body.nv5 select option { color: var(--mc7-text) !important; background: #071224 !important; }

body.nv5 button:not(.btn):not(.bottom-nav button),
body.nv5 [role="button"]:not(.bottom-nav button) {
  color: var(--mc7-text-2);
}

body.nv5 .btn.ghost,
body.nv5 .mobile-more-close,
body.nv5 .mobile-more-grid button,
body.nv5 .uc-actions button,
body.nv5 .mo-actions button,
body.nv5 .history-head button,
body.nv5 .sheet .row button {
  color: #e8f2ff !important;
  border-color: rgba(95, 161, 230, .25) !important;
  background: #0a1a32 !important;
}

body.nv5 .btn,
body.nv5 button.primary,
body.nv5 button[type="submit"] {
  color: #fff !important;
}

/* El auditor automático no debe pintar texto oscuro dentro de superficies de tema oscuro. */
body.nv5 .nv-contrast-dark,
body.nv5 .nv-contrast-dark * { color: var(--mc7-text) !important; }

/* ---------- Inicio / NeuroMap móvil ---------- */
.nv-brain-mobile-clean { display: none; }

@media (max-width: 760px) {
  body.nv5 .main {
    padding-inline: 14px !important;
    padding-top: calc(14px + env(safe-area-inset-top)) !important;
  }

  body.nv5 .hero { margin-bottom: 14px; }
  body.nv5 .hero h1 { font-size: clamp(25px, 7.2vw, 32px) !important; line-height: 1.12; }
  body.nv5 .hero .date { margin-top: 7px; font-size: 13px; color: #71829f !important; }

  .nv-dashboard { gap: 12px !important; }
  .nv-dashboard-hero {
    min-height: 360px !important;
    border-radius: 24px !important;
    overflow: hidden !important;
    background:
      radial-gradient(300px 190px at 50% 45%, rgba(16, 117, 145, .08), transparent 76%),
      linear-gradient(155deg, #03101a, #020811 62%, #030713) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.03) !important;
  }
  .nv-dashboard-hero::before {
    opacity: .22 !important;
    mask-image: none !important;
  }
  .nv-dashboard-hero-head {
    top: 15px !important;
    left: 16px !important;
    right: 16px !important;
    align-items: center !important;
  }
  .nv-dashboard-hero-head h2 { font-size: 22px !important; }
  .nv-dashboard-hero-head p { display: none !important; }
  .nv-live-pill {
    min-height: 30px !important;
    max-width: 122px;
    padding-inline: 9px !important;
    overflow: hidden;
    font-size: 9px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* En Inicio solo se muestra el lienzo limpio específico para móvil. */
  .nv-dashboard-hero .nv-brain-preview,
  .nv-dashboard-hero .nv-wire-preview,
  .nv-dashboard-hero .nv-brain-v6-preview { display: none !important; }
  .nv-brain-mobile-clean {
    position: absolute;
    display: block;
    z-index: 2;
    left: 0;
    right: 0;
    top: 58px;
    width: 100%;
    height: calc(100% - 112px);
    touch-action: manipulation;
  }
  .nv-brain-preview-hint { display: none !important; }
  .nv-brain-preview-action {
    left: 50% !important;
    right: auto !important;
    bottom: 13px !important;
    min-width: 148px;
    min-height: 42px !important;
    transform: translateX(-50%);
    font-size: 11px !important;
  }

  .nv-feature-grid { gap: 10px !important; }
  .nv-feature-card {
    min-height: 102px !important;
    padding: 12px !important;
    border-radius: 18px !important;
  }
  .nv-feature-copy b { color: #eff7ff !important; font-size: 12px !important; }
  .nv-feature-copy small { color: #91a2bb !important; font-size: 10px !important; line-height: 1.35; }

  .nv-stats-row { border-color: rgba(100, 150, 221, .18) !important; background: rgba(5, 13, 28, .88) !important; }
  .nv-stat-copy b { color: #f1f7ff !important; }
  .nv-stat-copy small { color: #8495b0 !important; }

  /* NeuroMap completo: ocupa la pantalla útil, sin cabecera heredada duplicada. */
  body.nv5[data-nv-page="cerebro"] .main,
  body.nv5.modo-cerebro .main {
    padding: 0 0 calc(76px + env(safe-area-inset-bottom)) !important;
  }
  body.nv5[data-nv-page="cerebro"] .hero,
  body.nv5.modo-cerebro .hero { display: none !important; }
  body.nv5 .neuromap-shell {
    min-height: calc(var(--nv-safe-vh, 100dvh) - 76px - env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #020a11 !important;
    box-shadow: none !important;
  }
  body.nv5 .neuromap-head {
    min-height: 64px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 7px !important;
    background: rgba(2, 9, 18, .94) !important;
  }
  body.nv5 .neuromap-title h2 { font-size: 18px !important; }
  body.nv5 .neuromap-title p { display: none !important; }
  body.nv5 .neuromap-tools { gap: 5px; }
  body.nv5 .neuromap-tools button {
    min-height: 40px !important;
    padding-inline: 10px !important;
    font-size: 10px !important;
  }
  body.nv5 .neuromap-tools [data-neuro-action="classic"] { display: none !important; }
  body.nv5 .neuromap-stage-wrap {
    min-height: calc(var(--nv-safe-vh, 100dvh) - 140px - env(safe-area-inset-bottom)) !important;
    height: calc(var(--nv-safe-vh, 100dvh) - 140px - env(safe-area-inset-bottom)) !important;
    background: #020a11 !important;
  }
  body.nv5 .neuromap-stage-wrap::before { opacity: .24 !important; mask-image: none !important; }
  body.nv5 .neuromap-stage-wrap::after { opacity: .10 !important; }
  .neuromap-v6-top { top: 8px !important; left: 8px !important; right: 8px !important; }
  .neuromap-v6-crumbs { max-width: calc(100% - 96px) !important; }
  .neuromap-v6-crumbs button { font-size: 9px !important; }
  .neuromap-v6-status { max-width: calc(100% - 112px) !important; }
  .neuromap-v6-status span { display: none !important; }

  /* Navegación: activa con color, no con bloque blanco. */
  body.nv5 .bottom-nav {
    border-color: rgba(101, 151, 220, .22) !important;
    background: rgba(3, 10, 22, .96) !important;
  }
  body.nv5 .bottom-nav button {
    color: #71819d !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  body.nv5 .bottom-nav button.active {
    color: #48d1f6 !important;
    background: rgba(28, 125, 190, .12) !important;
    border: 1px solid rgba(60, 192, 234, .17) !important;
  }

  /* Los modales móviles quedan siempre en tema oscuro, incluidos los headers sticky. */
  body.nv5 .uc-header,
  body.nv5 .uc-actions,
  body.nv5 .sheet .row {
    background: #061226 !important;
  }
}
