/* Enlace visible solo al navegar con teclado. */
.mv7-skip-link {
  position: fixed;
  z-index: 1000001;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  transform: translateY(-160%);
  border-radius: 10px;
  background: #1d1d1f;
  color: #fff;
  font: 600 14px / 1.4 var(--v2-font, sans-serif);
  text-decoration: none;
}

.mv7-skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid #0066cc;
  outline-offset: 3px;
}

.mv7-cashflow-empty {
  display: none;
}

@media (min-width: 769px) {
  :root[data-resolved-theme='light'] {
    --v2-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', sans-serif;
    --v2-warm-base: #f5f6f7;
    --v2-warm-surface: #fff;
    --v2-warm-soft: #f1f3f4;
    --v2-canvas: #f5f6f7;
    --v2-sidebar: #fbfcfd;
    --v2-surface: #fff;
    --v2-surface-raised: #fff;
    --v2-surface-hover: #f1f3f4;
    --v2-line: rgba(45, 52, 58, 0.12);
    --v2-line-strong: rgba(45, 52, 58, 0.2);
    --v2-text: #1d1f22;
    --v2-muted: #505963;
    --v2-dim: #626c75;
    --v2-green-bright: #23764b;
    --v2-glass-fill: rgba(255, 255, 255, 0.82);
    --v2-glass-fill-strong: rgba(255, 255, 255, 0.94);
    --v2-glass-edge: rgba(45, 52, 58, 0.13);
    --v2-glass-shine: rgba(255, 255, 255, 0.97);
    --v2-desktop-card-shadow: 0 1px 2px rgba(20, 32, 28, 0.035), 0 8px 22px rgba(20, 32, 28, 0.045);
  }

  :root[data-resolved-theme='light'][data-accent='blue'] {
    --v2-green-bright: #1849a9;
  }

  :root[data-resolved-theme='light'][data-accent='purple'] {
    --v2-green-bright: #5925a9;
  }

  :root[data-resolved-theme='light'][data-accent='amber'] {
    --v2-green-bright: #7a2e0e;
  }

  :root[data-resolved-theme='light'][data-accent='coral'] {
    --v2-green-bright: #a6333e;
  }

  /* La misma estructura para todas las vistas, incluido Inicio. */
  :root[data-resolved-theme='light'] body,
  :root[data-resolved-theme='light'] body[data-v2-view='overview'] {
    background: var(--v2-canvas);
  }

  :root[data-resolved-theme='light'] body .mv7-app,
  :root[data-resolved-theme='light'] body[data-v2-view='overview'] .mv7-app {
    border-color: var(--v2-line);
    background: rgba(255, 255, 255, 0.56);
    box-shadow: none;
  }

  :root[data-resolved-theme='light'] body .mv7-workspace,
  :root[data-resolved-theme='light'] body[data-v2-view='overview'] .mv7-workspace {
    background: linear-gradient(180deg, #fafbfa, var(--v2-canvas) 42rem);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light'] body .mv7-sidebar,
  :root[data-resolved-theme='light'] body[data-v2-view='overview'] .mv7-sidebar {
    border-right: 1px solid var(--v2-line);
    background: rgba(250, 252, 251, 0.94);
    box-shadow: 10px 0 28px -28px rgba(20, 32, 28, 0.24);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
  }

  :root[data-resolved-theme='light'] body .mv7-topbar,
  :root[data-resolved-theme='light'] body[data-v2-view='overview'] .mv7-topbar {
    border-bottom: 1px solid var(--v2-line);
    background: rgba(251, 252, 251, 0.88);
    box-shadow: 0 10px 26px -28px rgba(20, 32, 28, 0.32);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
  }

  :root[data-resolved-theme='light'] .mv7-page-identity h1 {
    color: var(--v2-text);
    font-weight: 700;
    letter-spacing: -0.03em;
  }

  :root[data-resolved-theme='light'] .mv7-nav h2 {
    color: var(--v2-dim);
    font-size: var(--v2-text-sm);
    font-weight: 600;
  }

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

  :root[data-resolved-theme='light'] .mv7-nav-item {
    min-height: 40px;
    font-size: var(--v2-text-sm);
  }

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

  :root[data-resolved-theme='light'] :is(.mv7-nav-item, .mv7-settings-nav-item).is-active {
    background: color-mix(in srgb, var(--v2-green) 11%, #fff);
    color: var(--v2-green-bright);
  }

  :root[data-resolved-theme='light']
    :is(.mv7-search, .mv7-icon-button, .mv7-period-control, .mv7-page-icon) {
    border-color: var(--v2-line);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 1px 2px rgba(20, 32, 28, 0.045);
  }

  :root[data-resolved-theme='light']
    body
    :is(
      .mv7-tx-summary,
      .mv7-tx-ledger,
      .mv7-tx-inspector,
      .mv7-settings-nav,
      .mv7-settings-context-card,
      .mv7-settings-card,
      .mv7-profile-editor-card,
      .mv7-profile-preview-card,
      .mv7-category-table-card
    ) {
    border-color: var(--v2-line);
    background: #fff;
    box-shadow: var(--v2-desktop-card-shadow);
  }

  :root[data-resolved-theme='light']
    body
    :is(.mv7-welcome-card, .mv7-metric, .mv7-panel, .mv7-overview-insight) {
    border-color: var(--v2-line);
    box-shadow: var(--v2-desktop-card-shadow);
  }

  /* El contenido usa superficies estables; el vidrio queda en la navegación. */
  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    :is(.mv7-metric, .mv7-panel, .mv7-overview-insight) {
    background: #fff;
    box-shadow: var(--v2-desktop-card-shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light'] body[data-v2-view='overview'] #overview-view #widget-cashflow {
    background: #fff;
    box-shadow: var(--v2-desktop-card-shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    :is(.mv7-metric, .mv7-panel)::before {
    opacity: 0;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    :is(.mv7-chart-wrap, .mv7-panel-stats, .mv7-account-total) {
    border-color: var(--v2-line);
    background: #f8faf9;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    :is(.mv7-chart-wrap, .mv7-panel-stats) {
    border-color: var(--v2-line);
    background: #f8faf9;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light']
    body
    :is(
      .mv7-calendar-side-card,
      .mv7-recurring-side-card,
      .mv7-networth-ratio,
      .mv7-debt-summary,
      .mv7-debt-month,
      .mv7-debt-desktop-rail
    ) {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Acciones primarias con contraste suficiente para texto blanco. */
  :root[data-resolved-theme='light'] body .mv7-primary-button {
    border-color: color-mix(in srgb, var(--v2-green-bright) 85%, #000);
    background: var(--v2-green-bright);
    color: #fff;
  }

  /* El foco se distingue tanto sobre cristal como sobre tarjetas blancas. */
  :root[data-resolved-theme='light']
    body
    :is(a, button, input, select, textarea, summary, [role='button'], [tabindex]):focus-visible {
    outline: 3px solid #0066cc !important;
    outline-offset: 3px;
  }

  :root[data-resolved-theme='light']
    body
    :is(.mv7-search, .mv7-settings-search, .mv7-tx-search):focus-within {
    border-color: #0066cc !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2) !important;
  }

  :root[data-resolved-theme='light']
    body
    :is(.mv7-search, .mv7-settings-search, .mv7-tx-search)
    input:focus-visible {
    outline: none !important;
  }

  :root[data-resolved-theme='light'] body :is(button, a, input, select, textarea) {
    scroll-margin: 16px;
  }

  /* Datos: la línea, los ejes y las claves siguen siendo legibles sobre blanco. */
  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-chart-line {
    stroke: #167854;
    stroke-width: 3.4;
    filter: none;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow.is-trend-down
    .mv7-chart-line {
    stroke: #a55a10;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-chart-flow {
    opacity: 0.22;
    filter: none;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    :is(.mv7-chart-axis, .mv7-chart-footer) {
    color: #58636b;
    font-size: 12px;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-grid-lines
    path {
    stroke: rgba(42, 60, 55, 0.16);
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-legend
    :is(.is-up, .is-down, .is-flat)
    i {
    box-shadow: none;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-legend
    .is-down
    i {
    border-radius: 2px;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow
    .mv7-legend
    .is-flat
    i {
    border: 1px solid #657178;
    background: transparent;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow.is-empty
    .mv7-chart-wrap {
    min-height: 235px;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow.is-empty
    .mv7-main-chart {
    height: 190px;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow.is-empty
    :is(.mv7-main-chart, .mv7-chart-axis) {
    visibility: hidden;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-cashflow.is-empty
    .mv7-cashflow-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: min(290px, calc(100% - 40px));
    margin: 0;
    transform: translate(-50%, -50%);
    color: var(--v2-muted);
    font-size: var(--v2-text-sm);
    line-height: 1.5;
    text-align: center;
  }

  /* El estado vacío no ocupa toda la altura del gráfico vecino. */
  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-activity
    .mv7-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #overview-view
    #widget-activity
    .mv7-panel-header
    p {
    overflow: visible;
    white-space: normal;
    line-height: 1.35;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #widget-activity:has(.mv7-empty-activity) {
    align-self: start;
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #widget-activity
    .mv7-empty-activity {
    display: block;
    padding: 18px 20px 22px;
    color: var(--v2-muted);
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #widget-activity
    .mv7-empty-activity
    strong {
    display: block;
    color: var(--v2-text);
    font-size: var(--v2-text-body);
  }

  :root[data-resolved-theme='light']
    body[data-v2-view='overview']
    #widget-activity
    .mv7-empty-activity
    p {
    margin: 7px 0 0;
    color: var(--v2-muted);
    font-size: var(--v2-text-sm);
    line-height: 1.5;
  }

  /* Mismo nivel de superficie para las secciones con composición propia. */
  :root[data-resolved-theme='light']
    body
    :is(
      .mv7-calendar-landing,
      .mv7-calendar-horizon,
      .mv7-calendar-side-card,
      .mv7-calendar-runway,
      .mv7-recurring-kpis article,
      .mv7-recurring-side-card,
      .mv7-orbit-analysis,
      .mv7-recurring-simulator,
      .mv7-networth-section,
      .mv7-networth-ratio,
      .mv7-debt-hero,
      .mv7-debt-summary,
      .mv7-debt-month,
      .mv7-debt-desktop-rail
    ) {
    border-color: var(--v2-line);
    box-shadow: var(--v2-desktop-card-shadow);
  }
}

@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
  :root[data-resolved-theme='light']
    body
    :is(
      button,
      a,
      .mv7-metric,
      .mv7-panel,
      .mv7-nav-item,
      .mv7-settings-nav-item,
      .mv7-chart-line,
      .mv7-chart-flow,
      .mv7-chart-area,
      .mv7-transaction-row
    ) {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 769px) and (prefers-contrast: more) {
  :root[data-resolved-theme='light'] {
    --v2-line: rgba(29, 31, 34, 0.32);
    --v2-line-strong: rgba(29, 31, 34, 0.48);
    --v2-muted: #343b42;
    --v2-dim: #424a51;
    --v2-desktop-card-shadow: none;
  }

  :root[data-resolved-theme='light'] body :is(.mv7-sidebar, .mv7-topbar) {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  :root[data-resolved-theme='light'] body :is(.mv7-nav-item, .mv7-settings-nav-item).is-active {
    box-shadow: inset 0 0 0 2px var(--v2-green-bright);
  }
}

@media (min-width: 769px) and (prefers-reduced-transparency: reduce) {
  :root[data-resolved-theme='light'] body :is(.mv7-sidebar, .mv7-topbar) {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* El reflujo a 200 % usa la disposición compacta: mantener legibles sus datos. */
@media (max-width: 768px) {
  :root[data-resolved-theme='light'] .mv7-networth-mobile-ledgers {
    grid-template-columns: minmax(0, 1fr);
  }

  :root[data-resolved-theme='light']
    :is(
      .mv7-networth-mobile-hero-copy > button,
      .mv7-networth-mobile-hero-copy > span,
      .mv7-networth-mobile-hero-copy > small,
      .mv7-networth-mobile-hero-totals dt,
      .mv7-networth-mobile-hero-totals dd,
      .mv7-networth-mobile-distribution-empty,
      .mv7-networth-mobile-ledger > header strong,
      .mv7-networth-mobile-ledger-row > strong,
      .mv7-networth-mobile-ledger-row > span:not(.mv7-networth-mobile-row-icon),
      .mv7-networth-mobile-ledger > button:last-child,
      .mv7-networth-mobile-ledger-empty,
      .mv7-networth-mobile-evolution-card dt,
      .mv7-networth-mobile-evolution-card dd,
      .mv7-networth-mobile-evolution-card small,
      .mv7-calendar-mobile-weekdays span
    ) {
    font-size: 12px;
    line-height: 1.4;
  }

  :root[data-resolved-theme='light'] .mv7-networth-mobile-evolution-axis span,
  :root[data-resolved-theme='light'] .mv7-networth-mobile-evolution-months span {
    font-size: 10px;
  }
}

/* Colores de datos: separar el tono de texto del acento decorativo. */
:root[data-resolved-theme='light'] .mv7-networth-mobile-reference {
  --netm-green: var(--v2-green-bright);
}

:root[data-resolved-theme='light'] #streak-view {
  --streakm-muted: #526070;
}

:root[data-resolved-theme='light'] [id^='settings-mobile-'][id$='-value'] {
  color: var(--v2-muted);
}

:root[data-resolved-theme='light']
  :is(
    #current-date,
    #income-change,
    #tx-mobile-summary-trend,
    #calendar-mobile-income,
    #calendar-mobile-balance,
    #recurring-core-monthly,
    #recurring-potential,
    #recurring-week-total,
    #networth-view .mv7-eyebrow,
    #recurring-view .mv7-recurring-kpis .is-ring,
    #community-view #community-trending-list a i
  ) {
  color: var(--v2-green-bright);
}

:root[data-resolved-theme='light'] #recurring-mobile-active,
:root[data-resolved-theme='light'] #community-view .mv7-community-post-body em {
  color: #195f3e;
}

:root[data-resolved-theme='light'] #overview-view .mv7-change b {
  color: var(--v2-green-bright);
}

:root[data-resolved-theme='light'] :is(#calendar-income-total, #calendar-desktop-day-income) {
  color: #23764b;
}

:root[data-resolved-theme='light'] :is(#calendar-expense-total, #calendar-desktop-day-expense) {
  color: #8a4907;
}

:root[data-resolved-theme='light'] :is(#calendar-margin-total, #calendar-desktop-day-balance) {
  color: #17617a;
}

:root[data-resolved-theme='light'] #calendar-view .mv7-calendar-day.is-today > strong {
  background: #2165b7;
  color: #fff;
}

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

:root[data-resolved-theme='light'] body .mv7-primary-button,
:root[data-resolved-theme='light'] body .mv7-backup-card #settings-export {
  background: var(--v2-green-bright);
  color: #fff;
}

@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
  :root[data-resolved-theme='light']:not(.mv7-view-transitioning)
    body
    .mv7-view-entering:not(#overview-view) {
    animation: mv7-light-view-enter 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  :root[data-resolved-theme='light'].mv7-view-transitioning
    #main-content
    > [id$='-view']:not([hidden]) {
    view-transition-name: mv7-content;
  }

  ::view-transition-group(mv7-content) {
    animation-duration: 0s;
  }

  ::view-transition-old(mv7-content) {
    animation: mv7-light-view-out 120ms cubic-bezier(0.4, 0, 0.8, 0.4) both;
  }

  ::view-transition-new(mv7-content) {
    animation: mv7-light-view-in 250ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  :root[data-resolved-theme='light'].mv7-settings-transitioning
    #settings-view
    [data-settings-panel]:not([hidden]) {
    view-transition-name: mv7-settings-panel;
  }

  ::view-transition-group(mv7-settings-panel) {
    animation-duration: 0s;
  }

  ::view-transition-old(mv7-settings-panel) {
    animation: mv7-light-view-out 120ms cubic-bezier(0.4, 0, 0.8, 0.4) both;
  }

  ::view-transition-new(mv7-settings-panel) {
    animation: mv7-light-view-in 250ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  :root[data-resolved-theme='light']
    #overview-view.is-entering
    :is(
      .mv7-section-heading,
      .mv7-metric,
      .mv7-cashflow-panel,
      .mv7-accounts-panel,
      .mv7-activity-panel
    ) {
    animation-duration: 320ms;
    animation-delay: 0ms;
  }

  :root[data-resolved-theme='light'] #overview-view.is-entering .mv7-metric:nth-child(2) {
    animation-delay: 30ms;
  }

  :root[data-resolved-theme='light'] #overview-view.is-entering .mv7-metric:nth-child(3) {
    animation-delay: 60ms;
  }

  :root[data-resolved-theme='light']
    #overview-view.is-entering
    :is(.mv7-cashflow-panel, .mv7-accounts-panel, .mv7-activity-panel) {
    animation-delay: 80ms;
  }

  :root[data-resolved-theme='light'] #overview-view.is-entering #widget-cashflow {
    animation-duration: 320ms;
    animation-delay: 80ms;
  }

  :root[data-resolved-theme='light']
    #overview-view
    .mv7-transaction-list.is-entering
    .mv7-transaction-row {
    animation-duration: 320ms;
    animation-delay: calc(80ms + var(--activity-index, 0) * 24ms);
  }

  :root[data-resolved-theme='light'] #overview-view .mv7-chart-line.is-drawing,
  :root[data-resolved-theme='light'] #overview-view .mv7-spark-line.is-drawing {
    animation-duration: 480ms;
    animation-delay: 0ms;
  }

  :root[data-resolved-theme='light'] #overview-view.is-entering .mv7-chart-point {
    animation-duration: 280ms;
    animation-delay: 360ms;
  }

  @keyframes mv7-light-view-enter {
    from {
      opacity: 0.65;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes mv7-light-view-out {
    to {
      opacity: 0;
      transform: translateY(-6px);
    }
  }

  @keyframes mv7-light-view-in {
    from {
      opacity: 0.72;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
