/* Tema claro de Z7V -------------------------------------------------------
   Se carga al final de la cascada porque varias vistas conservan fondos
   oscuros literales de sus composiciones originales. `data-theme` guarda la
   preferencia; `data-resolved-theme` representa lo que se pinta realmente. */

:root[data-resolved-theme='light'] {
  color-scheme: light;
  --v2-warm-base: #faf7f1;
  --v2-warm-surface: #fffdf8;
  --v2-warm-soft: #f7f2ea;
  --v2-canvas: var(--v2-warm-base);
  --v2-sidebar: var(--v2-warm-surface);
  --v2-surface: var(--v2-warm-surface);
  --v2-surface-raised: #fcf9f3;
  --v2-surface-hover: var(--v2-warm-soft);
  --v2-line: rgba(15, 23, 42, 0.1);
  --v2-line-strong: rgba(15, 23, 42, 0.16);
  --v2-text: #172033;
  --v2-muted: #475467;
  --v2-dim: #667085;
  --v2-green: #067647;
  --v2-green-bright: #05603a;
  --v2-green-soft: rgba(8, 127, 91, 0.1);
  --v2-amber: #9a4e06;
  --v2-red: #c4323a;
  --v2-purple: #6938b5;
  --v2-glass-fill: rgba(255, 253, 248, 0.82);
  --v2-glass-fill-strong: rgba(255, 253, 248, 0.94);
  --v2-glass-edge: rgba(15, 23, 42, 0.14);
  --v2-glass-shine: rgba(255, 253, 248, 0.96);
}

:root[data-resolved-theme='light'][data-accent='blue'] {
  --v2-green: #175cd3;
  --v2-green-bright: #1849a9;
  --v2-green-soft: rgba(22, 113, 217, 0.1);
}

:root[data-resolved-theme='light'][data-accent='purple'] {
  --v2-green: #6938b5;
  --v2-green-bright: #5925a9;
  --v2-green-soft: rgba(124, 60, 197, 0.1);
}

:root[data-resolved-theme='light'][data-accent='amber'] {
  --v2-green: #9a4e06;
  --v2-green-bright: #7a2e0e;
  --v2-green-soft: rgba(189, 103, 5, 0.1);
}

/* Marco de la aplicación */
:root[data-resolved-theme='light'] body {
  background:
    radial-gradient(circle at 92% 4%, rgba(42, 126, 235, 0.09), transparent 28rem),
    radial-gradient(circle at 5% 92%, rgba(8, 127, 91, 0.07), transparent 31rem),
    var(--v2-warm-base);
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] body::before {
  background: rgba(42, 126, 235, 0.06);
}

:root[data-resolved-theme='light'] body::after {
  background: rgba(8, 127, 91, 0.05);
}

:root[data-resolved-theme='light'] .mv7-app {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 28px 80px rgba(42, 52, 72, 0.12);
}

:root[data-resolved-theme='light'] .mv7-sidebar {
  border-right-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 12px 0 36px rgba(57, 70, 91, 0.04);
}

:root[data-resolved-theme='light'] .mv7-workspace {
  background:
    radial-gradient(circle at 84% 8%, rgba(42, 126, 235, 0.035), transparent 24rem),
    var(--v2-warm-base);
}

:root[data-resolved-theme='light'] .mv7-topbar {
  border-bottom-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 8px 30px rgba(49, 62, 84, 0.045);
}

:root[data-resolved-theme='light'] :is(.mv7-search, .mv7-icon-button, .mv7-period-control) {
  border-color: var(--v2-line);
  background: rgba(247, 249, 252, 0.96);
  box-shadow: none;
}

:root[data-resolved-theme='light'] .mv7-topbar-login {
  border-color: color-mix(in srgb, var(--v2-green) 34%, transparent);
  background: color-mix(in srgb, var(--v2-green) 10%, var(--v2-warm-surface));
  box-shadow: none;
  color: #087a50;
}

:root[data-resolved-theme='light'] .mv7-topbar-login:hover {
  border-color: color-mix(in srgb, var(--v2-green) 52%, transparent);
  background: color-mix(in srgb, var(--v2-green) 16%, var(--v2-warm-surface));
  color: #056640;
}

:root[data-resolved-theme='light'] :is(.mv7-nav-item, .mv7-sidebar-footer > a):hover {
  background: #f2f6fa;
}

:root[data-resolved-theme='light'] .mv7-nav-item.is-active {
  border-color: color-mix(in srgb, var(--v2-green) 18%, transparent);
  background: color-mix(in srgb, var(--v2-green) 9%, var(--v2-warm-surface));
  color: var(--v2-green-bright);
}

:root[data-resolved-theme='light'] .mv7-sidebar-footer {
  border-top-color: var(--v2-line);
}

:root[data-resolved-theme='light'] .mv7-health-ring {
  background: conic-gradient(var(--v2-green) 72%, #e6ebf0 0);
}

:root[data-resolved-theme='light'] .mv7-health-ring::after {
  background: var(--v2-warm-surface);
}

/* Controles y superficies compartidas */
:root[data-resolved-theme='light'] :is(input, select, textarea) {
  color: var(--v2-text);
  caret-color: var(--v2-green);
}

:root[data-resolved-theme='light'] :is(input, select, textarea)::placeholder {
  color: var(--v2-dim);
}

:root[data-resolved-theme='light'] select option {
  background: var(--v2-warm-surface);
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] :is(input, select, textarea):-webkit-autofill {
  -webkit-text-fill-color: var(--v2-text);
  box-shadow: 0 0 0 1000px #f8fafc inset;
}

:root[data-resolved-theme='light']
  :is(
    .mv7-secondary-button,
    .mv7-text-button,
    .mv7-filter-button,
    .mv7-settings-segments button,
    .mv7-category-filters button
  ) {
  border-color: var(--v2-line-strong);
  background: var(--v2-warm-surface);
  color: var(--v2-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

:root[data-resolved-theme='light'] .mv7-primary-button {
  border-color: color-mix(in srgb, var(--v2-green) 78%, #000);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--v2-green) 84%, white),
    var(--v2-green)
  );
  color: #fff;
  box-shadow: 0 9px 20px color-mix(in srgb, var(--v2-green) 22%, transparent);
}

:root[data-resolved-theme='light'] .mv7-primary-button:hover {
  filter: brightness(0.96);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-secondary-button,
    .mv7-text-button,
    .mv7-filter-button,
    .mv7-category-filters button
  ):hover {
  background: var(--v2-surface-hover);
}

:root[data-resolved-theme='light'] :is(.mv7-dialog, dialog) {
  border-color: var(--v2-line-strong);
  background: var(--v2-warm-surface);
  color: var(--v2-text);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
}

:root[data-resolved-theme='light'] :is(.mv7-dialog, dialog)::backdrop {
  background: rgba(30, 41, 59, 0.38);
}

:root[data-resolved-theme='light'] :is(.mv7-toast, .mv7-notification-toast) {
  border-color: var(--v2-line-strong);
  background: rgba(255, 253, 248, 0.96);
  color: var(--v2-text);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16);
}

/* Inicio */
:root[data-resolved-theme='light']
  :is(.mv7-welcome-card, .mv7-metric, .mv7-panel, .mv7-overview-insight) {
  border-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.9),
    0 12px 34px rgba(43, 55, 77, 0.065);
}

:root[data-resolved-theme='light'] #overview-view :is(.mv7-metric, .mv7-panel) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  background-color: var(--v2-warm-surface);
  box-shadow: 0 12px 34px rgba(43, 55, 77, 0.065);
}

:root[data-resolved-theme='light'] #overview-view :is(.mv7-metric, .mv7-panel)::before {
  background: radial-gradient(130% 90% at 18% -20%, rgba(255, 253, 248, 0.75), transparent 55%);
}

:root[data-resolved-theme='light'] #overview-view .mv7-metric-primary {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--v2-green) 7%, var(--v2-warm-surface)),
    var(--v2-warm-surface) 68%
  );
  background-color: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] #overview-view .mv7-metric-income {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--v2-green) 5%, var(--v2-warm-surface)),
    var(--v2-warm-surface) 68%
  );
  background-color: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] #overview-view .mv7-metric-expense {
  background: linear-gradient(145deg, rgba(242, 153, 74, 0.1), var(--v2-warm-surface) 68%);
  background-color: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] :is(.mv7-chart-wrap, .mv7-panel-stats, .mv7-account-total) {
  border-color: var(--v2-line);
  background: #f8fafc;
}

:root[data-resolved-theme='light'] :is(.mv7-grid-lines path, .mv7-spark-grid) {
  stroke: rgba(15, 23, 42, 0.1);
}

:root[data-resolved-theme='light'] :is(.mv7-account-item, .mv7-transaction-row):hover {
  background: #f3f6f9;
}

:root[data-resolved-theme='light']
  :is(.mv7-overview-budget-track, .mv7-progress-track, .mv7-goals-progress-track) {
  background: #e6ebf0;
}

/* Movimientos */
:root[data-resolved-theme='light'] :is(.mv7-tx-summary, .mv7-tx-ledger, .mv7-tx-inspector) {
  border-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 14px 40px rgba(43, 55, 77, 0.07);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-tx-mini-chart,
    .mv7-tx-ledger-footer,
    .mv7-tx-search,
    .mv7-tx-select,
    .mv7-tx-inspector-block
  ) {
  border-color: var(--v2-line);
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] .mv7-tx-zero-line {
  stroke: rgba(15, 23, 42, 0.13);
}

:root[data-resolved-theme='light'] :is(.mv7-transaction-row, .mv7-tx-row) {
  border-color: var(--v2-line);
}

:root[data-resolved-theme='light'] :is(.mv7-transaction-row, .mv7-tx-row):hover {
  background: #f3f6fa;
}

/* El estado vacío móvil heredaba texto pensado para una tarjeta oscura. */
:root[data-resolved-theme='light'] #transactions-view .mv7-tx-empty {
  color: var(--v2-muted);
}

:root[data-resolved-theme='light'] #transactions-view .mv7-tx-empty strong {
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] #transactions-view .mv7-tx-empty-icon {
  border-color: color-mix(in srgb, var(--v2-green) 24%, transparent);
  background: var(--v2-green-soft);
  color: var(--v2-green-bright);
}

:root[data-resolved-theme='light'] #transactions-view .mv7-tx-empty .mv7-secondary-button {
  border-color: color-mix(in srgb, var(--v2-green) 34%, transparent);
  background: color-mix(in srgb, var(--v2-green) 7%, var(--v2-warm-surface));
  color: var(--v2-green-bright);
}

/* Cuentas */
:root[data-resolved-theme='light'] .mv7-money-map {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      circle at 44% 48%,
      color-mix(in srgb, var(--v2-green) 8%, transparent),
      transparent 20rem
    ),
    var(--v2-warm-surface);
  box-shadow: 0 18px 52px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-money-map > header {
  background: rgba(248, 250, 252, 0.86);
}

:root[data-resolved-theme='light'] .mv7-money-source {
  background:
    radial-gradient(
      circle at 20% 15%,
      color-mix(in srgb, var(--v2-green) 13%, transparent),
      transparent 56%
    ),
    var(--v2-warm-surface);
  box-shadow: 0 16px 38px rgba(43, 55, 77, 0.12);
}

:root[data-resolved-theme='light'] :is(.mv7-money-node, .mv7-account-card) {
  border-color: var(--v2-line-strong);
  background: color-mix(in srgb, var(--account-color, var(--v2-green)) 6%, var(--v2-warm-surface));
  box-shadow: 0 8px 24px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-account-focus {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      circle at 13% 12%,
      var(--account-soft, var(--v2-green-soft)),
      transparent 22rem
    ),
    var(--v2-warm-surface);
  box-shadow: 0 18px 52px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] :is(.mv7-account-focus-insight, .mv7-account-collection) {
  border-color: var(--v2-line);
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] :is(.mv7-accounts-desktop-summary, .mv7-accounts-desktop-panel) {
  border-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 14px 38px rgba(43, 55, 77, 0.07);
}

:root[data-resolved-theme='light'] .mv7-accounts-desktop-row.is-selected {
  background: color-mix(in srgb, var(--account-accent) 6%, var(--v2-warm-surface));
}

:root[data-resolved-theme='light'] :is(.mv7-accounts-row-select, .mv7-accounts-activity-row):hover,
:root[data-resolved-theme='light']
  :is(.mv7-accounts-row-select, .mv7-accounts-activity-row):focus-visible {
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] .mv7-accounts-ring::after {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] .mv7-accounts-quick > div > button {
  border-color: var(--v2-line);
  background: #fbfcfe;
}

:root[data-resolved-theme='light'] .mv7-accounts-quick > div > button:hover,
:root[data-resolved-theme='light'] .mv7-accounts-quick > div > button:focus-visible {
  border-color: color-mix(in srgb, var(--v2-green) 26%, var(--v2-line));
  background: color-mix(in srgb, var(--v2-green) 4%, var(--v2-warm-surface));
}

/* Presupuestos */
:root[data-resolved-theme='light'] .mv7-budget-field {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      circle at 52% 25%,
      color-mix(in srgb, var(--v2-green) 7%, transparent),
      transparent 28rem
    ),
    var(--v2-warm-surface);
  box-shadow: 0 18px 52px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] :is(.mv7-budget-axis-track, .mv7-budget-lane-track) {
  background: rgba(15, 23, 42, 0.14);
}

:root[data-resolved-theme='light'] .mv7-budget-axis-track > i {
  background: rgba(15, 23, 42, 0.2);
}

:root[data-resolved-theme='light']
  :is(.mv7-budget-lane-main:hover, .mv7-budget-lane-main:focus-visible) {
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] :is(.mv7-budget-lane-detail, .mv7-budget-summary-card) {
  background: #f8fafc;
}

:root[data-resolved-theme='light']
  :is(
    .mv7-budget-summary,
    .mv7-budget-categories-card,
    .mv7-budget-rhythm-card,
    .mv7-budget-reserve
  ) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  box-shadow: 0 10px 30px rgba(43, 55, 77, 0.06);
}

:root[data-resolved-theme='light'] .mv7-budget-summary > div > span {
  border-color: var(--v2-line);
  background: #f7f9fc;
}

/* Objetivos */
:root[data-resolved-theme='light'] .mv7-future-scene {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      ellipse at 29% 69%,
      color-mix(in srgb, var(--v2-green) 8%, transparent),
      transparent 24rem
    ),
    radial-gradient(ellipse at 74% 58%, rgba(42, 126, 235, 0.05), transparent 26rem),
    var(--v2-warm-surface);
  box-shadow: 0 18px 54px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-future-scene::before {
  background:
    linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
}

:root[data-resolved-theme='light'] .mv7-future-stage::after {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.16), transparent);
  box-shadow: 0 10px 34px rgba(43, 55, 77, 0.12);
}

:root[data-resolved-theme='light'] .mv7-goal-monolith-shell {
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.68), transparent 38%),
    color-mix(in srgb, var(--goal-color) 7%, var(--v2-warm-surface));
  box-shadow:
    inset 0 0 35px color-mix(in srgb, var(--goal-color) 7%, transparent),
    0 16px 36px rgba(43, 55, 77, 0.14);
}

:root[data-resolved-theme='light'] :is(.mv7-goal-milestones, .mv7-goal-card) {
  background: #f7f9fc;
}

/* Calendario */
:root[data-resolved-theme='light'] :is(.mv7-calendar-landing, .mv7-calendar-horizon) {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      ellipse at 56% 44%,
      color-mix(in srgb, var(--v2-green) 7%, transparent),
      transparent 40%
    ),
    var(--v2-warm-surface);
  box-shadow: 0 18px 52px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-calendar-event {
  border-color: color-mix(in srgb, var(--event-color) 30%, var(--v2-line));
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--event-color) 13%, transparent), transparent),
    var(--v2-warm-surface);
  box-shadow: 0 8px 20px rgba(43, 55, 77, 0.07);
}

:root[data-resolved-theme='light'] .mv7-calendar-event.is-selected {
  background:
    linear-gradient(
      105deg,
      color-mix(in srgb, var(--event-color) 18%, transparent),
      transparent 82%
    ),
    var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] :is(.mv7-calendar-event-toggle, .mv7-calendar-event-delete) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  color: var(--v2-muted);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-calendar-runway,
    .mv7-calendar-upcoming-row
  ) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  box-shadow: 0 10px 30px rgba(43, 55, 77, 0.055);
}

/* Vidrio (ver material-preview.html) en su variante clara — misma idea que
   el resto de la app en modo claro: tokens --v2-glass-* en vez de blanco
   translúcido puro. backdrop-filter queda igual que en la base oscura
   (css/v2-legacy-c.css), solo cambian los colores. */
:root[data-resolved-theme='light']
  :is(
    .mv7-calendar-summary dl > div,
    .mv7-calendar-side-card
  ) {
  border-color: var(--v2-glass-edge);
  background: var(--v2-glass-fill);
  box-shadow:
    inset 0 1px 0 var(--v2-glass-shine),
    0 10px 30px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-calendar-runway::before,
:root[data-resolved-theme='light'] .mv7-calendar-day {
  border-color: var(--v2-line);
}

:root[data-resolved-theme='light'] .mv7-calendar-day.is-outside {
  background: #f5f7fa;
  color: var(--v2-dim);
}

:root[data-resolved-theme='light'] :is(.mv7-calendar-day, .mv7-calendar-scale) {
  color: var(--v2-dim);
}

/* Recurrentes */
:root[data-resolved-theme='light'] :is(.mv7-orbit-analysis, .mv7-recurring-simulator) {
  border-color: var(--v2-line);
  background:
    radial-gradient(circle at 30% 35%, rgba(42, 126, 235, 0.07), transparent 42%),
    var(--v2-warm-surface);
  box-shadow: 0 18px 52px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light']
  :is(.mv7-recurring-kpis article, .mv7-orbit-system, .mv7-recurring-side-card) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  box-shadow: 0 10px 30px rgba(43, 55, 77, 0.06);
}

:root[data-resolved-theme='light'] .mv7-orbit-field::before,
:root[data-resolved-theme='light'] .mv7-orbit-nodes::before {
  border-color: var(--v2-line);
}

:root[data-resolved-theme='light'] .mv7-orbit-core {
  background: radial-gradient(circle, rgba(42, 126, 235, 0.13), #f5f9fd 72%);
  box-shadow: 0 10px 32px rgba(42, 126, 235, 0.12);
}

:root[data-resolved-theme='light'] :is(.mv7-recurring-node, .mv7-recurring-side-card) {
  border-color: var(--v2-line);
  background: color-mix(in srgb, var(--node-color, var(--v2-green)) 6%, var(--v2-warm-surface));
  box-shadow: none;
}

:root[data-resolved-theme='light']
  :is(
    .mv7-orbit-core span,
    .mv7-recurring-node small,
    .mv7-recurring-impact > small,
    .mv7-recurring-projection b
  ) {
  color: var(--v2-muted);
}

/* Patrimonio, inversiones y racha */
:root[data-resolved-theme='light'] #networth-view {
  --nw-copy: var(--v2-text);
  --nw-muted: var(--v2-muted);
  --nw-dim: var(--v2-dim);
  --nw-green: var(--v2-green);
  --nw-coral: var(--v2-red);
}

:root[data-resolved-theme='light'] .mv7-networth-section {
  border-color: var(--v2-line);
  background:
    radial-gradient(
      circle at 58% 30%,
      color-mix(in srgb, var(--v2-green) 8%, transparent),
      transparent 34%
    ),
    var(--v2-warm-surface);
  box-shadow: 0 18px 54px rgba(43, 55, 77, 0.08);
}

:root[data-resolved-theme='light'] .mv7-networth-layer-surface {
  background:
    linear-gradient(
      100deg,
      color-mix(in srgb, var(--layer-tone) 16%, transparent),
      transparent 68%
    ),
    #f9fbfc;
  box-shadow: 0 8px 22px rgba(43, 55, 77, 0.055);
}

:root[data-resolved-theme='light'] .mv7-networth-layer.is-selected .mv7-networth-layer-surface {
  background:
    linear-gradient(
      100deg,
      color-mix(in srgb, var(--layer-tone) 24%, transparent),
      transparent 72%
    ),
    var(--v2-warm-surface);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-networth-ratio,
    .mv7-investments-summary article,
    .mv7-investments-workspace,
    .mv7-investments-card
  ) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  box-shadow: 0 10px 30px rgba(43, 55, 77, 0.06);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-networth-depth-label,
    .mv7-networth-totals dd,
    .mv7-networth-layer-copy span,
    .mv7-networth-layer-detail small,
    .mv7-networth-ratio small
  ) {
  color: var(--v2-muted);
}

:root[data-resolved-theme='light'] :is(.mv7-networth-primary h3, .mv7-networth-measure strong) {
  color: var(--v2-text);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-streak-hero article,
    .mv7-missions-card,
    .mv7-streak-completed,
    .mv7-streak-rail section,
    .mv7-owner-kpis article,
    .mv7-owner-grid > section,
    .mv7-owner-rail > section
  ) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
  box-shadow: 0 10px 30px rgba(43, 55, 77, 0.06);
}

:root[data-resolved-theme='light']
  #streak-view
  :is(
    .mv7-missions-card nav button.is-active,
    .mv7-mission-row > b,
    .mv7-streak-completed p small,
    .mv7-weekly-challenge header,
    .mv7-weekly-challenge > p b
  ) {
  color: var(--v2-purple);
}

:root[data-resolved-theme='light'] #streak-view .mv7-missions-card nav button.is-active {
  border-color: var(--v2-purple);
}

/* Comunidad */
:root[data-resolved-theme='light']
  :is(
    .mv7-community-tabs,
    .mv7-community-composer,
    .mv7-community-post,
    .mv7-community-card,
    .mv7-community-side-card,
    #community-profile-panel
  ) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] .mv7-community-post-body > p {
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] #community-view .mv7-community-tabs button.is-active {
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] .mv7-community-reply p {
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] .mv7-community-check {
  color: #fff;
}

:root[data-resolved-theme='light']
  :is(.mv7-community-toolbar, .mv7-community-feed, .mv7-community-search) {
  border-color: var(--v2-line);
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-community-profile-onboarding,
    .mv7-community-pulse-stats div,
    .mv7-community-progress-card,
    .mv7-community-reply
  ) {
  border-color: var(--v2-line);
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] .mv7-dm-dialog {
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] .mv7-dm-search,
:root[data-resolved-theme='light'] .mv7-dm-composer {
  border-color: var(--v2-line-strong) !important;
  background: #f7f9fc;
}

:root[data-resolved-theme='light'] .mv7-dm-bubble.is-theirs {
  border-color: var(--v2-line) !important;
  background: #f1f4f8 !important;
}

:root[data-resolved-theme='light'] .mv7-dm-bubble.is-mine {
  border-color: color-mix(in srgb, var(--v2-green) 24%, transparent) !important;
  background: color-mix(in srgb, var(--v2-green) 11%, var(--v2-warm-surface)) !important;
}

:root[data-resolved-theme='light'] .mv7-dm-dialog #community-dm-messages {
  background: radial-gradient(circle at 50% 30%, var(--v2-green-soft), transparent 45%);
}

:root[data-resolved-theme='light'] .mv7-dm-profile > i {
  border-color: #fff;
}

/* Ajustes: reproduce la claridad y separación de la referencia. */
:root[data-resolved-theme='light'] .mv7-settings-nav,
:root[data-resolved-theme='light'] .mv7-settings-context-card,
:root[data-resolved-theme='light'] .mv7-settings-card {
  border-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 32px rgba(43, 55, 77, 0.055);
}

:root[data-resolved-theme='light'] .mv7-settings-nav-item {
  color: var(--v2-muted);
}

:root[data-resolved-theme='light'] .mv7-settings-nav-item:hover {
  background: #f2f6fa;
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] .mv7-settings-nav-item.is-active {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--v2-green) 12%, var(--v2-warm-surface)),
    #f4f8fb
  );
  color: var(--v2-green-bright);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-settings-search,
    .mv7-settings-row select,
    .mv7-settings-fields select,
    .mv7-settings-fields input,
    .mv7-category-toolbar input,
    .mv7-category-inspector input,
    .mv7-category-inspector select
  ) {
  border-color: var(--v2-line);
  background: #fbfcfe;
  color: var(--v2-text);
}

:root[data-resolved-theme='light'] .mv7-settings-row {
  border-bottom-color: var(--v2-line);
}

:root[data-resolved-theme='light'] .mv7-backup-card #settings-export {
  color: #fff;
}

:root[data-resolved-theme='light'] .mv7-backup-warning strong {
  color: #7a2e0e;
}

:root[data-resolved-theme='light'] .mv7-settings-mobile-danger-link {
  color: var(--v2-red);
}

:root[data-resolved-theme='light']
  :is(
    .mv7-profile-region-summary,
    .mv7-settings-summary,
    .mv7-backup-inventory,
    .mv7-security-hero,
    .mv7-privacy-section,
    .mv7-notification-preview-stage,
    .mv7-appearance-preview-card,
    .mv7-appearance-budget-preview,
    .mv7-report-option,
    .mv7-how-grid > div,
    .mv7-sync-device,
    .mv7-category-table-card
  ) {
  border-color: var(--v2-line);
  background: #f8fafc;
}

:root[data-resolved-theme='light'] .mv7-profile-region-summary > div + div,
:root[data-resolved-theme='light'] .mv7-category-table-head,
:root[data-resolved-theme='light'] .mv7-category-row {
  border-color: var(--v2-line);
}

:root[data-resolved-theme='light'] .mv7-switch {
  background: #d7dde5;
}

:root[data-resolved-theme='light'] .mv7-switch::after {
  background: var(--v2-warm-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

:root[data-resolved-theme='light'] .mv7-switch:checked {
  background: var(--v2-green);
}

:root[data-resolved-theme='light'] .mv7-theme-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

:root[data-resolved-theme='light'] .mv7-theme-grid button {
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] .mv7-theme-grid button:hover {
  border-color: var(--v2-line-strong);
  background: #f8fafc;
}

.mv7-theme-preview.is-light {
  --preview-bg: #f4f6f8;
  --preview-rail: var(--v2-warm-surface);
  --preview-surface: var(--v2-warm-surface);
  --preview-surface-strong: #e7edf3;
  --preview-line: rgba(15, 23, 42, 0.14);
  --preview-ink: rgba(23, 32, 51, 0.68);
  --preview-accent: #1671d9;
  --preview-accent-soft: rgba(22, 113, 217, 0.15);
}

:root[data-resolved-theme='light'] .mv7-profile-chip.is-active .mv7-profile-chip-avatar {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 5px var(--v2-green);
}

:root[data-resolved-theme='light'] .mv7-profile-progress-ring {
  background:
    radial-gradient(circle, var(--v2-warm-surface) 58%, transparent 60%),
    conic-gradient(var(--v2-green) var(--profile-progress, 180deg), #e4e9ef 0);
}

:root[data-resolved-theme='light'] .mv7-appearance-workspace .mv7-settings-segments {
  margin-bottom: 12px;
}

:root[data-resolved-theme='light'] .mv7-profile-colors button.is-selected {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--v2-text);
}

/* Bloqueo, autenticación y vistas auxiliares */
:root[data-resolved-theme='light'] :is(.mv7-lock-panel, .mv7-auth-card, .mv7-empty-state) {
  border-color: var(--v2-line-strong);
  background: var(--v2-warm-surface);
  color: var(--v2-text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

:root[data-resolved-theme='light'] :is(#app-lock-screen, .mv7-auth-overlay) {
  background: rgba(237, 242, 247, 0.88);
}

/* Perfil dedicado — conserva la jerarquía glass sin introducir superficies
   oscuras cuando el tema claro está activo. */
:root[data-resolved-theme='light'] :is(.mv7-profile-editor-card, .mv7-profile-preview-card) {
  border-color: var(--v2-line);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 16px 42px rgba(43, 55, 77, 0.07);
}

:root[data-resolved-theme='light']
  :is(.mv7-profile-field input, .mv7-profile-field textarea, .mv7-preferences-fields select) {
  border-color: var(--v2-line);
  background: #fbfcfe;
  color: var(--v2-text);
}

:root[data-resolved-theme='light']
  :is(.mv7-profile-field input, .mv7-profile-field textarea, .mv7-preferences-fields select):focus {
  border-color: color-mix(in srgb, var(--v2-green) 44%, #b8c2cf);
  background: var(--v2-warm-surface);
}

:root[data-resolved-theme='light'] .mv7-profile-preview-toggle,
:root[data-resolved-theme='light'] .mv7-profile-photo-stage {
  border-color: var(--v2-line);
  background: #f8fafc;
}

:root[data-resolved-theme='light'] .mv7-profile-avatar-camera {
  border-color: #fff;
  background: var(--v2-warm-surface);
  color: #26313b;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.16);
}

:root[data-resolved-theme='light'] .mv7-profile-email-state {
  background: color-mix(in srgb, var(--v2-green) 8%, var(--v2-warm-surface));
}

:root[data-resolved-theme='light'] body[data-v2-view='profile'] #profile-button {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--v2-green) 13%, transparent);
}

/* Las composiciones móviles tienen overrides oscuros posteriores y muy
   específicos; estas reglas preservan el mismo tema en pantallas pequeñas. */
@media (max-width: 768px) {
  :root[data-resolved-theme='light'] body {
    background: #f4f6f8 !important;
  }

  :root[data-resolved-theme='light'] .mv7-workspace {
    background: #f8fafc !important;
  }

  :root[data-resolved-theme='light'] .mv7-topbar {
    border-bottom-color: var(--v2-line) !important;
    background: rgba(255, 253, 248, 0.9) !important;
    box-shadow: 0 8px 24px rgba(43, 55, 77, 0.07) !important;
  }

  :root[data-resolved-theme='light'] :is(.mv7-menu-button, .mv7-topbar-actions .mv7-icon-button) {
    border-color: var(--v2-line-strong) !important;
    background: rgba(255, 253, 248, 0.94) !important;
    color: var(--v2-text);
    box-shadow: 0 7px 18px rgba(43, 55, 77, 0.09) !important;
  }

  :root[data-resolved-theme='light'] .mv7-sidebar {
    background: var(--v2-warm-surface) !important;
    box-shadow: 18px 0 52px rgba(15, 23, 42, 0.16) !important;
  }

  :root[data-resolved-theme='light'] .mv7-sidebar-scrim {
    background: rgba(30, 41, 59, 0.3);
  }

  :root[data-resolved-theme='light']
    :is(
      .mv7-tx-summary,
      .mv7-tx-ledger,
      .mv7-tx-inspector,
      .mv7-money-map,
      .mv7-budget-field,
      .mv7-future-scene,
      .mv7-calendar-landing,
      .mv7-calendar-horizon,
      .mv7-orbit-analysis,
      .mv7-recurring-simulator,
      .mv7-networth-section
    ) {
    background-color: var(--v2-warm-surface) !important;
    border-color: var(--v2-line) !important;
  }

  :root[data-resolved-theme='light']
    #recurring-view
    :is(.mv7-recurring-kpis article, .mv7-orbit-system, .mv7-recurring-side-card) {
    border-color: var(--v2-line);
    background-color: var(--v2-warm-surface);
    background-image: none;
    box-shadow: 0 10px 30px rgba(43, 55, 77, 0.08);
  }

  :root[data-resolved-theme='light'] #recurring-view .mv7-recurring-kpis article:first-child {
    border-color: rgba(205, 91, 122, 0.22);
    background:
      radial-gradient(circle at 100% 0, rgba(232, 133, 157, 0.1), transparent 9rem),
      var(--v2-warm-surface);
  }

  :root[data-resolved-theme='light'] #recurring-view .mv7-orbit-system {
    background:
      radial-gradient(circle at 16% 0, rgba(228, 131, 154, 0.07), transparent 16rem),
      var(--v2-warm-surface);
  }

  :root[data-resolved-theme='light']
    #transactions-view
    :is(.mv7-tx-search, .mv7-tx-select, .mv7-tx-mobile-list-head, .mv7-tx-list:has(.mv7-tx-empty)) {
    border-color: var(--v2-line);
    background: var(--v2-warm-surface);
    color: var(--v2-text);
    box-shadow: 0 10px 30px rgba(43, 55, 77, 0.07);
  }

  :root[data-resolved-theme='light'] #transactions-view .mv7-tx-search input {
    background: transparent;
    color: var(--v2-text);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] #transactions-view .mv7-tx-type-filter button {
    border-color: var(--v2-line);
    background: var(--v2-warm-surface);
    color: var(--v2-muted);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] #transactions-view .mv7-tx-type-filter button.is-active {
    border-color: color-mix(in srgb, var(--v2-green) 28%, transparent);
    background: var(--v2-green-soft);
    color: var(--v2-green-bright);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] #transactions-view .mv7-tx-summary-item:first-child strong {
    color: #1671d9;
  }

  :root[data-resolved-theme='light'] #transactions-view .mv7-tx-mobile-list-head {
    border-bottom-color: var(--v2-line);
  }

  :root[data-resolved-theme='light']
    #calendar-view
    :is(
      .mv7-calendar-runway,
      .mv7-calendar-upcoming-row
    ) {
    border-color: var(--v2-line);
    background-color: var(--v2-warm-surface);
    background-image: none;
    color: var(--v2-text);
    box-shadow: 0 10px 30px rgba(43, 55, 77, 0.07);
  }

  :root[data-resolved-theme='light']
    #calendar-view
    :is(
      .mv7-calendar-summary dl > div,
      .mv7-calendar-side-card
    ) {
    border-color: var(--v2-glass-edge);
    background: var(--v2-glass-fill);
    color: var(--v2-text);
    box-shadow:
      inset 0 1px 0 var(--v2-glass-shine),
      0 10px 30px rgba(43, 55, 77, 0.09);
  }

  :root[data-resolved-theme='light'] #calendar-view .mv7-calendar-day {
    border-color: var(--v2-line);
    background-color: var(--v2-warm-surface);
    color: var(--v2-muted);
  }

  :root[data-resolved-theme='light'] #calendar-view .mv7-calendar-day.is-outside {
    background: #f5f7fa;
    color: var(--v2-dim);
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='calendar']
    .mv7-calendar-mobile-day.is-outside {
    color: var(--calm-muted);
  }

  :root[data-resolved-theme='light']
    #streak-view
    :is(
      .mv7-streak-hero article,
      .mv7-missions-card,
      .mv7-streak-completed,
      .mv7-streak-rail section
    ) {
    border-color: var(--v2-line);
    background-color: var(--v2-warm-surface);
    background-image: none;
    box-shadow: 0 10px 30px rgba(43, 55, 77, 0.08);
  }

  :root[data-resolved-theme='light'] #streak-view .mv7-streak-current {
    background:
      radial-gradient(circle at 92% 32%, rgba(154, 96, 224, 0.1), transparent 10rem),
      var(--v2-warm-surface);
  }

  :root[data-resolved-theme='light'] #settings-view .mv7-settings-nav {
    border-color: var(--v2-line);
    background: rgba(255, 253, 248, 0.96);
    box-shadow: 0 10px 30px rgba(43, 55, 77, 0.08);
  }

  :root[data-resolved-theme='light'] #settings-view .mv7-settings-card::after {
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.09), transparent);
  }

  :root[data-resolved-theme='light']
    #community-view
    :is(.mv7-community-toolbar, .mv7-community-feed, .mv7-community-mobile-search) {
    border-color: var(--v2-line);
    background: var(--v2-warm-surface);
    color: var(--v2-text);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] #community-view .mv7-community-mobile-search input {
    background: transparent;
    color: var(--v2-text);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] .mv7-mobile-bottom-nav {
    border-color: var(--v2-line);
    background: rgba(255, 253, 248, 0.94);
    box-shadow: 0 -8px 30px rgba(43, 55, 77, 0.09);
  }

  :root[data-resolved-theme='light'] .mv7-dm-dialog:has(#community-dm-thread-view:not([hidden])) {
    background: #f8fafc !important;
  }

  :root[data-resolved-theme='light'] .mv7-dm-dialog #community-dm-thread-view > header {
    background: rgba(255, 253, 248, 0.92) !important;
  }

  :root[data-resolved-theme='light'] .mv7-dm-composer {
    background: rgba(255, 253, 248, 0.96) !important;
    box-shadow: 0 16px 40px rgba(43, 55, 77, 0.15) !important;
  }
}

@container (max-width: 430px) {
  :root[data-resolved-theme='light'] .mv7-theme-grid {
    grid-template-columns: 1fr;
  }
}
