:root {
  --bg: #000000;
  --bg2: #0d0d0d;
  --bg3: #1a1a1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface2: rgba(255, 255, 255, 0.08);
  --ink: #ffffff;
  --muted: #888888;
  --muted2: #555555;
  --line: rgba(255, 255, 255, 0.06);
  --green: #9cffc7;
  --green-soft: rgba(156, 255, 199, 0.12);
  --red: #ff6b5d;
  --red-soft: rgba(255, 107, 93, 0.14);
  --amber: #f2c94c;
  --amber-soft: rgba(242, 201, 76, 0.12);
  /* Bordes de color, sombras y botón principal: cada tema tiene los suyos */
  --green-line: rgba(156, 255, 199, 0.26);
  --green-line-strong: rgba(156, 255, 199, 0.5);
  --red-line: rgba(255, 107, 93, 0.4);
  --amber-line: rgba(242, 201, 76, 0.35);
  --hero-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  --card-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  --inset: rgba(0, 0, 0, 0.14);
  --cta-from: #9cffc7;
  --cta-to: #6ee7a0;
  --cta-ink: #000000;
  /* Brillo de fondo según la salud financiera y colores del gráfico "a dónde va tu plata" */
  --tint-good: rgba(156, 255, 199, 0.16);
  --tint-warn: rgba(242, 201, 76, 0.17);
  --tint-bad: rgba(255, 107, 93, 0.2);
  --flow-1: #9cffc7;
  --flow-2: #7cc4ff;
  --flow-3: #f2c94c;
  --flow-4: #c9a2ff;
  --flow-5: #8a8f98;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ☀️ Tema claro: fondo gris muy suave, tarjetas blancas y acentos oscuros que se lean
   sobre blanco (contraste ≥ 4.5:1). */
[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f5f7;
  --bg2: #ffffff;
  --bg3: #eceef1;
  --ink: #101318;
  --muted: #4b5563;
  --muted2: #5d6470;
  --line: rgba(16, 19, 24, 0.1);
  --surface: rgba(16, 19, 24, 0.035);
  --surface2: rgba(16, 19, 24, 0.065);
  --green: #0b7a43;
  --green-soft: rgba(11, 122, 67, 0.09);
  --red: #c0392b;
  --red-soft: rgba(192, 57, 43, 0.09);
  --amber: #a05a00;
  --amber-soft: rgba(201, 138, 0, 0.12);
  --green-line: rgba(11, 122, 67, 0.28);
  --green-line-strong: rgba(11, 122, 67, 0.5);
  --red-line: rgba(192, 57, 43, 0.35);
  --amber-line: rgba(160, 90, 0, 0.32);
  --shadow: 0 1px 2px rgba(16, 19, 24, 0.05), 0 8px 24px rgba(16, 19, 24, 0.06);
  --hero-shadow: 0 1px 2px rgba(16, 19, 24, 0.04), 0 10px 30px rgba(16, 19, 24, 0.07);
  --card-shadow: 0 1px 2px rgba(16, 19, 24, 0.04), 0 8px 24px rgba(16, 19, 24, 0.06);
  --inset: rgba(16, 19, 24, 0.035);
  --cta-from: #12924f;
  --cta-to: #0b7a43;
  --cta-ink: #ffffff;
  --tint-good: rgba(11, 122, 67, 0.1);
  --tint-warn: rgba(201, 138, 0, 0.13);
  --tint-bad: rgba(192, 57, 43, 0.12);
  --flow-1: #0b7a43;
  --flow-2: #1f6fd1;
  --flow-3: #b07800;
  --flow-4: #7b4fd6;
  --flow-5: #6b7280;
}

[dir='rtl'] .topbar {
  flex-direction: row-reverse;
}
[dir='rtl'] .topbar-nav {
  justify-content: flex-start;
}
[dir='rtl'] .entry-row {
  flex-direction: row-reverse;
}
[dir='rtl'] .sim-runway-shift {
  direction: rtl;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  transition:
    background var(--transition),
    color var(--transition);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}

::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--muted2);
  border-radius: 4px;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  transition: background var(--transition);
  max-width: 480px;
  margin: 0 auto;
  padding: 0 12px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 10px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  transition:
    background var(--transition),
    border-color var(--transition);
  min-height: 52px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.brand-name {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: var(--ink);
  transition: color var(--transition);
}
/* ═══ 🔷 LOGO ═══
   El logo es una máscara: toma el color del texto (blanco en oscuro, negro en claro). */
.logo-wordmark {
  display: inline-block;
  height: 1em;
  aspect-ratio: 640 / 108;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask: url('/img/logo-quinex.png') center / contain no-repeat;
  mask: url('/img/logo-quinex.png') center / contain no-repeat;
}

.topbar-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: flex-end;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 32px;
  touch-action: manipulation;
}
.tab-btn:hover {
  color: var(--ink);
  background: var(--surface);
}
.tab-btn.active {
  color: var(--ink);
  background: var(--surface2);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tab-content {
  display: none;
  padding: 0 0 20px;
  animation: fadeInUp 0.3s ease both;
}
.tab-content.active {
  display: block;
}

.telemetry-hero {
  padding: 18px 16px 16px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% -25%, var(--green-soft), transparent 60%), var(--bg2);
  box-shadow: var(--hero-shadow);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.telemetry-hero[data-state='critical'] {
  border-color: var(--red-line);
  background: radial-gradient(circle at 50% -25%, var(--red-soft), transparent 60%), var(--bg2);
}
.telemetry-hero[data-state='free'],
.telemetry-hero[data-state='stable'] {
  border-color: var(--green-line);
}
.telemetry-hero[data-state='tight'] {
  border-color: var(--amber-line);
  background: radial-gradient(circle at 50% -25%, var(--amber-soft), transparent 60%), var(--bg2);
}
.hero-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 330px;
  margin: 0 auto 7px;
}
.runway-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.runway-status.neutral {
  color: var(--muted);
}
.runway-status.free {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-line);
}
.runway-status.stable {
  color: var(--green);
}
.runway-status.tight {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-line);
}
.runway-status.critical {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red-line);
}
.bank-badge {
  display: none;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.bank-badge.bank-connected {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-line);
}
.bank-badge.bank-imported {
  color: var(--ink);
  background: var(--surface2);
}
.bank-badge.bank-manual {
  color: var(--muted);
  background: transparent;
}
.telemetry-label-small {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
}
.telemetry-label-big {
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 4px;
}
.telemetry-number-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 2px;
}
.telemetry-big {
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color var(--transition);
  animation: countUp 0.6s ease both;
}
.telemetry-unit {
  font-size: 18px;
  color: var(--muted2);
  font-weight: 400;
}
.telemetry-description {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.telemetry-sentence {
  color: var(--muted);
  font-size: 12px;
  max-width: 100%;
  margin: 4px auto 8px;
  line-height: 1.5;
  padding: 0 4px;
}
.telemetry-subline {
  color: var(--muted);
  font-size: 11px;
  margin: -4px auto 8px;
  line-height: 1.5;
  padding: 0 4px;
}
.telemetry-subline strong {
  color: var(--ink);
  font-weight: 700;
}
/* 🎯 Meta de runway y botón para compartir */
.telemetry-goal {
  margin: 8px auto 0;
  max-width: 420px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.telemetry-goal.hidden,
.share-runway-btn.hidden {
  display: none;
}
.share-runway-btn {
  margin: 14px auto 0;
  font-size: 13px;
}
.share-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
}
.share-status:empty {
  display: none;
}

.telemetry-bar-wrap {
  max-width: 260px;
  margin: 12px auto 0;
  height: 5px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.telemetry-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--green);
  width: 0%;
  transition:
    width 0.8s ease,
    background 0.4s;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all var(--transition);
  cursor: default;
  animation: fadeInUp 0.4s ease both;
  min-height: 78px;
  position: relative;
}
.stat-card:nth-child(2) {
  animation-delay: 0.06s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.12s;
}
.stat-card:hover {
  border-color: var(--muted2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 8px;
  letter-spacing: 0.8px;
  color: var(--muted2);
  font-weight: 600;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: color var(--transition);
  word-break: break-all;
}
.stat-detail {
  display: block;
  margin-top: 5px;
  color: var(--muted2);
  font-size: 9px;
  line-height: 1.35;
}
.safe-card {
  border-color: var(--green-line);
  background: linear-gradient(135deg, var(--green-soft), var(--bg2) 62%);
}

.advisor-section {
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.advisor-section:empty {
  display: none;
}
.advisor-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--amber);
  font-size: 12px;
  color: var(--ink);
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease both;
}
.advisor-alert:hover {
  background: var(--surface2);
}
.advisor-alert.good {
  border-left-color: var(--green);
}
.advisor-alert.warning {
  border-left-color: var(--amber);
}
.advisor-alert.critical {
  border-left-color: var(--red);
}
.advisor-alert.info {
  border-left-color: var(--muted);
}
.advisor-alert .alert-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.advisor-alert .alert-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.advisor-alert .alert-title {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.advisor-alert .alert-message {
  font-size: 12px;
  color: var(--ink);
}

.sim-section {
  padding: 6px 0 14px;
}
/* 📆 Pagos fijos y próximo ingreso */
.upcoming-section {
  padding: 10px 4px;
}
.upcoming-section.hidden {
  display: none;
}
.upcoming-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upcoming-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.upcoming-head .section-eyebrow {
  margin-bottom: 0;
}
.upcoming-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.upcoming-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.upcoming-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.upcoming-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.upcoming-row:last-child {
  border-bottom: none;
}
.upcoming-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upcoming-date {
  color: var(--muted);
  font-size: 12px;
}
.upcoming-amount {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.upcoming-more,
.upcoming-empty {
  font-size: 12px;
  color: var(--muted);
  padding-top: 6px;
}
.upcoming-empty.hidden,
.income-line.hidden,
#fixedBlock.hidden {
  display: none;
}
.income-line {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
#fixedBlock.hidden + .income-line {
  border-top: none;
  padding-top: 0;
}

.sim-card {
  background: linear-gradient(145deg, var(--surface2), var(--bg2) 44%);
  border: 1px solid var(--green-line);
  border-radius: var(--radius-lg);
  padding: 18px;
  max-width: 100%;
  transition: all var(--transition);
  box-shadow: var(--card-shadow);
}
.sim-card:hover {
  border-color: var(--green-line-strong);
}
.sim-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.section-eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 1.4px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sim-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.sim-hint {
  font-size: 10px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 4px 7px;
  white-space: nowrap;
}
.sim-copy {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 0 0 12px;
}
.sim-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  margin-bottom: 10px;
  transition: all var(--transition);
}
.sim-input-wrap:focus-within {
  border-color: var(--muted);
  box-shadow: 0 0 0 3px var(--surface2);
}
.sim-currency {
  font-size: 14px;
  color: var(--muted2);
  margin-right: 4px;
  font-weight: 400;
}
.sim-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 700;
  width: 100%;
  padding: 8px 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sim-input::placeholder {
  color: var(--muted2);
  opacity: 0.3;
}

.sim-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0 2px;
}
.sim-cost {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.sim-cost-num {
  font-size: 24px;
  font-weight: 900;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.sim-cost-num.zero {
  color: var(--muted2);
}
.sim-cost-num.danger {
  color: var(--red);
}
.sim-cost-label {
  font-size: 11px;
  color: var(--muted2);
}

.sim-verdict {
  display: flex;
  align-items: center;
  gap: 6px;
}
.verdict-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted2);
  flex-shrink: 0;
  transition: background 0.3s;
}
.verdict-dot.safe {
  background: var(--green);
}
.verdict-dot.caution {
  background: var(--amber);
}
.verdict-dot.danger {
  background: var(--red);
}
#verdictText {
  font-size: 12px;
  color: var(--muted);
}

.sim-runway-shift {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted2);
  padding: 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
}
.shift-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.shift-item strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.shift-after {
  text-align: right;
}
.shift-arrow {
  font-size: 14px;
  color: var(--muted2);
}
.shift-impact {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}
.shift-impact.safe {
  color: var(--green);
}
.shift-impact.caution {
  color: var(--amber);
}
.shift-impact.danger {
  color: var(--red);
}

.moves-section {
  padding: 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--ink);
}

.fast-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.type-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.type-btn {
  background: var(--bg);
  color: var(--ink);
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  min-height: 40px;
}
.type-btn.active {
  background: var(--bg3);
  color: var(--ink);
}
/* El botón elegido se nota: rojo para gasto, verde para ingreso */
.type-btn.active[data-type='expense'] {
  background: var(--red-soft);
  color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red-line);
}
.type-btn.active[data-type='income'] {
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green-line);
}
.type-btn:not(.active) {
  color: var(--muted);
}
.type-btn:hover {
  background: var(--bg3);
}

.entry-amount-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  transition: all var(--transition);
}
.entry-amount-wrap:focus-within {
  border-color: var(--muted);
  box-shadow: 0 0 0 3px var(--surface2);
}
.entry-currency {
  color: var(--muted2);
  font-size: 14px;
  margin-right: 4px;
}
.entry-amount {
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  padding: 10px 0;
  color: var(--ink);
  min-height: 44px;
}

.entry-row {
  display: flex;
  gap: 8px;
}
.entry-row .entry-cat {
  flex: 1;
}
.entry-cat {
  background: var(--bg) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 30px 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-height: 44px;
}
.entry-cat:focus {
  border-color: var(--muted);
  box-shadow: 0 0 0 3px var(--surface2);
}
.entry-cat option {
  background: var(--bg) !important;
  color: var(--ink) !important;
}

.entry-btn {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 20px;
}

.adv-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.adv-details summary {
  font-size: 12px;
  color: var(--muted2);
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  min-height: 32px;
}
.adv-details summary:hover {
  color: var(--ink);
}
.adv-details summary::-webkit-details-marker {
  display: none;
}
.adv-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.entry-desc,
.entry-date {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  min-height: 40px;
  width: 100%;
}
.entry-desc:focus,
.entry-date:focus {
  border-color: var(--muted);
  box-shadow: 0 0 0 3px var(--surface2);
}

.action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.action-row .btn-ghost {
  font-size: 10px;
  padding: 4px 10px;
  min-height: 30px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 10px 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;
}
.btn-primary:hover {
  transform: scale(0.98);
  opacity: 0.9;
}
.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 16px;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 40px;
}
.btn-ghost:hover {
  border-color: var(--muted);
  color: var(--ink);
  transform: scale(0.98);
}
.btn-sm {
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 6px;
  min-height: 32px;
}
.btn-danger-sm {
  background: transparent;
  border: 1px solid var(--red-soft);
  color: var(--red);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 36px;
}
.btn-danger-sm:hover {
  background: var(--red-soft);
  transform: scale(0.98);
}
.btn-secondary-sm {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 36px;
}
.btn-secondary-sm:hover {
  background: var(--surface2);
  border-color: var(--muted);
}

.history-section {
  padding: 16px 0;
}
.history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.history-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  width: 100%;
}
.history-controls input,
.history-controls select {
  background: var(--bg) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 24px 4px 8px;
  font-size: 11px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  cursor: pointer;
  min-height: 32px;
  flex: 1;
  min-width: 60px;
}
.history-controls input::placeholder {
  color: var(--muted2);
  opacity: 0.6;
}
.history-controls select option {
  background: var(--bg) !important;
  color: var(--ink) !important;
}
.count-pill {
  background: var(--surface);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
}

.table-wrap {
  overflow-x: visible;
}
.move-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.move-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
}
.move-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
  font-size: 12px;
}
.move-table tr:hover td {
  background: var(--surface);
}
.move-table .col-date {
  width: 16%;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.move-table .col-type {
  width: 14%;
}
.move-table .col-category {
  width: 16%;
  font-weight: 500;
  font-size: 11px;
}
.move-table .col-desc {
  width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.move-table .col-amount {
  width: 22%;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  padding-right: 16px;
}
.move-table .col-actions {
  width: 12%;
  text-align: center;
}
.type-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}
.type-badge.income {
  background: var(--green-soft);
  color: var(--green);
}
.type-badge.expense {
  background: var(--red-soft);
  color: var(--red);
}

.action-group {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}
.action-btn {
  background: transparent;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  min-height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.action-btn .btn-label {
  font-size: 9px;
  font-weight: 500;
}
.action-btn:hover {
  color: var(--ink);
  background: var(--surface);
}
.action-btn.edit-btn:hover {
  color: var(--amber);
  background: var(--amber-soft);
}
.action-btn.delete-btn:hover {
  color: var(--red);
  background: var(--red-soft);
}

.empty-msg {
  color: var(--muted2);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}
.empty-msg .empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}
.empty-msg .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.config-section {
  padding: 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.config-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.config-group select,
.config-group input {
  background: var(--bg) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  min-height: 40px;
}
.config-group select option {
  background: var(--bg) !important;
  color: var(--ink) !important;
}

/* ═══ ⚙️ AJUSTES EN TARJETAS ═══ */
.settings-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}
.settings-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* ✨ QuineX Pro (próximamente) */
.pro-card {
  border-color: var(--green-line);
}
.pro-features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
}
.pro-price {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--green);
}
.pro-founder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--green-soft);
  border: 1px solid var(--green-line);
}
.pro-founder-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.pro-founder-btn {
  align-self: flex-start;
  text-decoration: none;
}
.settings-email {
  font-size: 13px;
  color: var(--ink);
  margin: 0;
  overflow-wrap: anywhere;
}
.settings-status {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.settings-status:empty {
  display: none;
}
#accountSignedOut,
#authSignedIn {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#accountSignedOut.hidden,
#authSignedIn.hidden,
.danger-row.hidden {
  display: none;
}
.config-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.theme-switch button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.theme-switch button[aria-checked='true'] {
  border-color: var(--green);
  color: var(--ink);
  background: var(--surface2);
}
.config-actions a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  min-height: 40px;
  text-decoration: none;
}
.config-actions a:hover {
  background: var(--surface2);
  color: var(--ink);
}
.danger-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.danger-row + .danger-row {
  padding-top: 10px;
  border-top: 1px solid var(--red-soft);
}

/* Zona peligrosa de Configuración (reiniciar datos del dispositivo) */
.config-danger {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--red-soft);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.config-danger-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.config-danger .btn-danger-sm {
  min-height: 44px;
  padding: 8px 18px;
}
.config-danger-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.config-version {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.config-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.config-actions button {
  text-align: start;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  min-height: 40px;
}
.config-actions button:hover {
  background: var(--surface2);
  border-color: var(--muted);
  color: var(--ink);
}

.edit-modal,
.reset-modal,
.shortcuts-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.reset-modal {
  z-index: 400;
}

.shortcuts-modal {
  z-index: 500;
}
.edit-modal.open,
.reset-modal.open,
.shortcuts-modal.open {
  display: flex;
}

.edit-modal .modal-content,
.reset-modal .modal-content,
.shortcuts-modal .modal-content {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.edit-modal .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.edit-modal .form-group {
  margin-bottom: 10px;
}
.edit-modal .form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.edit-modal .form-group input,
.edit-modal .form-group select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  min-height: 40px;
}
.edit-modal .modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.edit-modal .modal-actions .btn-primary,
.edit-modal .modal-actions .btn-ghost {
  flex: 1;
  min-height: 40px;
}

.reset-modal .modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 6px;
}
.reset-modal .modal-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.reset-modal .modal-actions {
  display: flex;
  gap: 10px;
}
.reset-modal .modal-actions .btn-danger-sm,
.reset-modal .modal-actions .btn-secondary-sm {
  flex: 1;
  min-height: 44px;
  font-size: 14px;
}

.shortcuts-modal .modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  text-align: center;
}
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.shortcut-row:last-child {
  border-bottom: none;
}
.shortcut-desc {
  color: var(--muted);
}
.shortcut-key {
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  min-width: 28px;
  text-align: center;
}

.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.ob-card {
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  animation: fadeInUp 0.6s ease both;
}
.ob-logo {
  display: inline-grid;
  place-items: center;
  font-size: 26px;
  color: var(--ink);
}
.ob-headline {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
}
.ob-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Botón flotante de opinión (💬) */
.feedback-fab-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  z-index: 50;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.feedback-fab-btn:hover {
  border-color: var(--muted);
  color: var(--ink);
  transform: scale(1.05);
}

/* Opciones de inicio y formulario de inicio rápido (30 segundos) */
.ob-choices,
.ob-quick {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ob-choices button,
.ob-quick button {
  width: 100%;
  white-space: normal;
  line-height: 1.3;
}
.ob-quick {
  text-align: start;
}
.ob-quick.hidden {
  display: none;
}
.ob-quick label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ob-quick input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 4px;
}
.ob-quick input:focus {
  border-color: var(--ink);
  outline: none;
}
.ob-quick-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.ob-quick-error {
  font-size: 13px;
  color: var(--red);
  min-height: 0;
}
.ob-quick-error:empty {
  display: none;
}

.onboarding-tour {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  z-index: 200;
  max-height: 70vh;
  overflow-y: auto;
}
.onboarding-tour.hidden {
  display: none;
}
.onboarding-tour .tour-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.onboarding-tour .tour-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.onboarding-tour .tour-item:last-child {
  border-bottom: none;
}
.onboarding-tour .tour-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.onboarding-tour .tour-text {
  font-size: 13px;
  color: var(--muted);
}
.onboarding-tour .tour-text strong {
  color: var(--ink);
}
.onboarding-tour .tour-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.onboarding-tour .tour-actions .btn-primary {
  flex: 1;
  min-height: 36px;
  font-size: 13px;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--muted2);
  color: var(--muted2);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  background: transparent;
  margin-left: 6px;
  flex-shrink: 0;
}
.info-icon:hover {
  border-color: var(--muted);
  color: var(--ink);
}
.info-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 50;
}
.info-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  width: max-content;
  max-width: min(260px, 80vw);
  z-index: 999;
  box-shadow: var(--shadow);
  pointer-events: none;
  text-align: center;
  line-height: 1.5;
  /* No hereda las mayúsculas espaciadas de la etiqueta de la tarjeta */
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.info-icon-wrapper:hover .info-tooltip {
  display: block;
}
.info-icon-wrapper.tap-show .info-tooltip {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.pop {
  animation: pop 0.35s ease both;
}

.hidden {
  display: none !important;
}

/* ═══ 🎨 BRILLO SEGÚN LA SALUD FINANCIERA ═══
   render() pone body[data-health] = free | stable | tight | critical | neutral.
   Un resplandor suave arriba de la pantalla dice cómo vas sin leer nada. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(150% 70% at 50% -8%, var(--tint, transparent), transparent 75%),
    radial-gradient(130% 45% at 50% 108%, var(--tint, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.9s ease;
}
body[data-health='free'],
body[data-health='stable'] {
  --tint: var(--tint-good);
}
body[data-health='tight'] {
  --tint: var(--tint-warn);
}
body[data-health='critical'] {
  --tint: var(--tint-bad);
}
body[data-health='free']::before,
body[data-health='stable']::before,
body[data-health='tight']::before,
body[data-health='critical']::before {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  body::before {
    transition: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ═══ ⚡ ANOTAR RÁPIDO ═══ */
.quick-add-section {
  padding: 10px 4px 2px;
}
.quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}
.quick-add:focus-within {
  border-color: var(--green-line-strong);
  box-shadow:
    0 0 0 3px var(--green-soft),
    var(--card-shadow);
}
/* El recuadro entero muestra el foco: el campo no lleva borde ni contorno propio */
.quick-add-section .quick-add input.quick-add-input,
.quick-add-section .quick-add input.quick-add-input:focus,
.quick-add-section .quick-add input.quick-add-input:focus-visible {
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
}
.quick-add-icon {
  font-size: 15px;
}
.quick-add-input {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.quick-add-input::placeholder {
  color: var(--muted);
}
.quick-add-kbd {
  display: none; /* solo en computador (abajo) */
}
.quick-add-btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  color: var(--cta-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.quick-add-btn:focus-visible,
.quick-undo:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.quick-add-status {
  min-height: 1.4em;
  margin: 6px 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.quick-add-status.ok {
  color: var(--green);
}
/* Monto inválido en Movimientos */
.entry-error {
  margin: 8px 2px 0;
  font-size: 13px;
  color: var(--red);
}
.entry-error:empty {
  display: none;
}
.quick-add-status.error {
  color: var(--red);
}
.quick-undo {
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ═══ 🌊 A DÓNDE VA TU PLATA ═══ */
.flow-section {
  padding: 10px 4px;
}
.flow-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--card-shadow);
}
.flow-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.flow-head .section-eyebrow {
  margin-bottom: 0;
}
.flow-period {
  font-size: 11px;
  color: var(--muted);
}
.flow-compare {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-row-total {
  display: grid;
  grid-template-columns: minmax(64px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
}
.flow-total-label {
  font-size: 12px;
  color: var(--muted);
}
.flow-total-value {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.flow-track {
  height: 12px;
  border-radius: 99px;
  background: var(--surface);
  overflow: hidden;
}
.flow-fill,
.flow-split {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}
.flow-fill-in {
  background: var(--green);
}
.flow-split {
  display: flex;
  overflow: hidden;
}
.flow-seg {
  height: 100%;
}
.flow-seg + .flow-seg {
  border-inline-start: 2px solid var(--bg2);
}
.flow-c1 {
  background: var(--flow-1);
}
.flow-c2 {
  background: var(--flow-2);
}
.flow-c3 {
  background: var(--flow-3);
}
.flow-c4 {
  background: var(--flow-4);
}
.flow-c5 {
  background: var(--flow-5);
}
.flow-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flow-item {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.flow-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.flow-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-pct {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.flow-amount {
  font-variant-numeric: tabular-nums;
}
.flow-net {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.flow-net.good {
  color: var(--green);
}
.flow-net.bad {
  color: var(--red);
}
@media (prefers-reduced-motion: reduce) {
  .flow-fill,
  .flow-split {
    transition: none;
  }
}

/* ═══ ⏳ CARGA INICIAL ═══ */
/* Aviso flotante mientras se lee un extracto en PDF */
.import-busy {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg2);
  color: var(--ink);
  box-shadow: var(--card-shadow);
  font-size: 14px;
  font-weight: 600;
}
.boot-loader {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}
.boot-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--muted2);
  border-top-color: var(--green);
  animation: bootSpin 0.8s linear infinite;
}
@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}
.w-full {
  width: 100%;
}

@supports (padding: max(0px)) {
  .app {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

@media (max-width: 380px) {
  .brand-name {
    font-size: 12px;
  }
  .tab-btn {
    font-size: 10px;
    padding: 3px 8px;
  }
  .stat-value {
    font-size: 12px;
  }
  .telemetry-big {
    font-size: 42px;
  }
  .move-table .col-date {
    font-size: 9px;
  }
  .move-table .col-amount {
    font-size: 10px;
  }
  .move-table .col-desc {
    font-size: 9px;
  }
  .action-btn {
    font-size: 10px;
    padding: 2px 4px;
    min-height: 22px;
    min-width: 22px;
  }
  .action-btn .btn-label {
    font-size: 7px;
  }
  .move-table .col-actions {
    width: 16%;
  }
}
@media (min-width: 768px) {
  .app {
    max-width: 600px;
  }
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ 📄 IMPORTAR EXTRACTO ═══ */
.import-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg2);
}
.import-card-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 4px;
}
.import-card-hint,
.import-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 10px;
  display: block;
}
.import-result {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--green);
  min-height: 1em;
}
.edit-modal .import-modal-content {
  max-width: 560px;
}
.import-privacy {
  font-size: 11px;
}
.import-summary {
  font-weight: 700;
  font-size: 13px;
  margin: 8px 0;
}
.import-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  margin: 8px 0 12px;
  cursor: pointer;
}
.import-check input,
.import-row input[type='checkbox'] {
  /* La regla global quita la apariencia a todos los inputs; aquí se recupera la casilla */
  -webkit-appearance: checkbox;
  appearance: auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--green);
  flex-shrink: 0;
  cursor: pointer;
}
.import-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.import-row {
  display: grid;
  grid-template-columns: auto 74px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.import-row:last-child {
  border-bottom: none;
}
.import-row.unselected {
  opacity: 0.45;
}
.import-row-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.import-row-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-row-cat {
  display: block;
  color: var(--muted);
  font-size: 10px;
  /* La descripción se corta con "…"; la categoría y "¿Transferencia?" pueden bajar de línea */
  white-space: normal;
}
.import-cat-select {
  margin-top: 4px;
  max-width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: pointer;
}
.import-cat-select option {
  background: var(--bg);
  color: var(--ink);
}
.config-hint {
  font-size: 11px;
  color: var(--muted);
}
.config-hint {
  display: block;
}
.config-email.hidden {
  display: none;
}
.config-email-check {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
}
.config-email-check strong {
  display: block;
  margin-bottom: 2px;
}
.import-row-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.import-row-amount.income {
  color: var(--green);
}
.import-badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--amber);
  font-size: 9px;
  font-weight: 700;
}
.import-status {
  color: var(--red);
  font-size: 12px;
  min-height: 1em;
  margin: 0 0 8px;
}

/* ═══ ⚖️ ENLACES LEGALES ═══ */
.legal-links,
.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.legal-links {
  margin-top: 16px;
}
.app-footer {
  padding: 24px 0 72px;
}
.legal-links a,
.app-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-links a:hover,
.app-footer a:hover {
  color: var(--ink);
}

/* ═══ 📣 REDES SOCIALES (pie de página) ═══ */
.social-links {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  color: var(--muted);
}

/* ═══ 💬 OPINIONES ═══ */
.feedback-faces {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 14px 0 4px;
}
.feedback-face {
  flex: 1;
  font-size: 28px;
  line-height: 1;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  filter: grayscale(0.6);
  transition:
    transform 0.15s,
    filter 0.15s,
    border-color 0.15s;
}
.feedback-face:hover {
  filter: none;
  transform: translateY(-2px);
}
.feedback-face.selected {
  filter: none;
  border-color: var(--green);
  background: var(--green-soft);
}
.feedback-face-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.5em;
  margin-bottom: 8px;
}
.feedback-message {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}
.feedback-status {
  min-height: 1.4em;
  margin: 8px 0;
  font-size: 12px;
}
.feedback-status.ok {
  color: var(--green);
}
.feedback-status.error {
  color: var(--red);
}
.footer-link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

.footer-link-btn:hover {
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════
   📱 TELÉFONO (≤ 600 px)
   - Pestañas en una barra inferior (como una app nativa)
   - Historial en tarjetas en vez de tabla
   - Botones de al menos 44 px y campos de 16 px (iOS no hace zoom al tocarlos)
   - Zonas seguras del iPhone (muesca y barra de inicio)
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bottom-nav-h: 60px;
}
@media (max-width: 600px) {
  .app {
    min-height: 100dvh;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  }

  /* ── Barra superior: logo + cuenta + reiniciar ── */
  .topbar {
    padding: calc(8px + env(safe-area-inset-top)) 0 8px;
    justify-content: space-between;
  }
  .brand-name {
    font-size: 14px;
  }
  .topbar-actions {
    gap: 8px;
  }
  .topbar-actions button {
    min-height: 40px;
    padding: 0 14px !important;
    font-size: 13px !important;
  }

  /* ── Pestañas abajo ── */
  .topbar-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 4px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
      max(8px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: var(--bottom-nav-h);
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tab-btn::before {
    content: '';
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: var(--tab-icon) center / contain no-repeat;
    mask: var(--tab-icon) center / contain no-repeat;
  }
  .tab-btn.active {
    background: transparent;
    color: var(--green);
  }
  .tab-btn[data-tab='home'] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
  }
  .tab-btn[data-tab='moves'] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E");
  }
  .tab-btn[data-tab='history'] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3.5 6h.01M3.5 12h.01M3.5 18h.01'/%3E%3C/svg%3E");
  }
  .tab-btn[data-tab='config'] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E");
  }

  /* En el teléfono el botón flotante taparía montos: la opinión se envía desde
     Ajustes o el pie de página */
  .feedback-fab-btn {
    display: none;
  }
  /* Los atajos de teclado no aplican en pantallas táctiles */
  .app-footer {
    padding: 20px 0 88px;
    flex-wrap: wrap;
    row-gap: 4px;
    font-size: 12px;
  }
  .app-footer a,
  .app-footer .footer-link-btn,
  .legal-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    font-size: 12px;
  }

  /* ── Tarjetas de resumen: dos arriba y el límite seguro a todo lo ancho ── */
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .stats-row .stat-card:nth-child(3) {
    grid-column: 1 / -1;
    min-height: 0;
  }
  .stat-card {
    padding: 10px 12px;
    min-height: 72px;
  }

  /* ── Campos: 16 px evita el zoom automático de iOS ── */
  input:not([type='checkbox']):not([type='radio']),
  select,
  textarea {
    font-size: 16px !important;
  }
  .history-controls input,
  .history-controls select,
  .config-group select,
  .entry-cat,
  .entry-desc,
  .entry-date,
  .edit-modal .form-group input,
  .edit-modal .form-group select {
    min-height: 44px;
  }

  /* ── Botones del tamaño del dedo ── */
  .btn-sm,
  .action-row .btn-ghost,
  .quick-add-btn,
  .quick-undo {
    min-height: 44px;
  }
  .adv-details summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .info-icon {
    position: relative;
  }
  .info-icon::after {
    /* Área táctil invisible de 44 × 44 alrededor del ícono ⓘ */
    content: '';
    position: absolute;
    inset: -13px;
  }

  /* ── Historial en tarjetas ── */
  .history-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .history-controls input {
    grid-column: 1 / -1;
    background-image: none;
    padding-right: 12px;
  }
  .history-controls select {
    min-width: 0;
  }
  .move-table,
  .move-table tbody {
    display: block;
    table-layout: auto;
  }
  .move-table thead {
    display: none;
  }
  .move-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'cat amount'
      'desc amount'
      'meta actions';
    column-gap: 12px;
    row-gap: 2px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
  }
  .move-table td {
    display: block;
    width: auto !important;
    padding: 0 !important;
    border: none;
    background: none !important;
  }
  .move-table .col-category {
    grid-area: cat;
    font-size: 14px;
    font-weight: 600;
  }
  .move-table .col-desc {
    grid-area: desc;
    font-size: 13px;
  }
  .move-table .col-amount {
    grid-area: amount;
    align-self: center;
    font-size: 15px;
    text-align: end;
  }
  .move-table .col-date {
    grid-area: meta;
    align-self: center;
    font-size: 12px;
  }
  .move-table .col-type {
    grid-area: meta;
    justify-self: start;
    align-self: center;
    margin-inline-start: 92px;
  }
  .type-badge {
    font-size: 11px;
    padding: 2px 8px;
  }
  .move-table .col-actions {
    grid-area: actions;
    justify-self: end;
  }
  .action-btn {
    min-height: 40px;
    min-width: 40px;
    font-size: 16px;
  }

  /* ── Modales: aprovechan el ancho y no se esconden tras la barra de iOS ── */
  .edit-modal,
  .reset-modal,
  .shortcuts-modal {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }
  .edit-modal .modal-content,
  .reset-modal .modal-content,
  .shortcuts-modal .modal-content {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 18px 16px;
  }
  .modal-actions button {
    min-height: 48px;
  }
  .import-row {
    grid-template-columns: auto 70px minmax(0, 1fr) auto;
    padding: 10px;
  }
  /* Importar: una sola zona de scroll (el modal) y el botón para terminar siempre a la vista */
  .import-list {
    max-height: none;
    overflow: visible;
  }
  .import-modal-content .modal-actions {
    position: sticky;
    bottom: -18px;
    margin: 0 -16px -18px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--bg2);
    border-top: 1px solid var(--line);
  }
  /* Casillas y botones del tamaño del dedo (≥ 44 px de zona táctil) */
  .import-check input,
  .import-row input[type='checkbox'] {
    width: 22px;
    height: 22px;
  }
  .info-icon {
    position: relative;
  }
  .info-icon::after {
    content: '';
    position: absolute;
    inset: -13px;
  }
  .btn-ghost,
  .type-btn {
    min-height: 44px;
  }

  /* ── Historial: búsqueda y categoría a todo lo ancho; tipo y periodo lado a lado ── */
  .history-controls #filterCategory {
    grid-column: 1 / -1;
    order: 1;
  }
  .history-controls #filterType {
    order: 2;
  }
  .history-controls #filterPeriod {
    order: 3;
  }

  /* ── Texto mínimo legible (11 px) ── */
  .telemetry-label-small,
  .stat-label,
  .alert-title,
  .count-pill,
  .runway-status,
  .bank-badge,
  #safeToSpendDetail,
  .trend-description,
  #trendDescription,
  .action-row .btn-ghost,
  .import-row-cat,
  .import-badge,
  .section-eyebrow,
  .sim-hint,
  #shiftImpact {
    font-size: 11px !important;
  }
  .import-row {
    cursor: pointer;
  }
  #tourGotItBtn,
  .config-actions button,
  .config-actions a {
    min-height: 44px;
  }
  .onboarding-tour {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* Con el teclado táctil no hay "hover": evita estados pegados al tocar */
@media (hover: none) {
  .stat-card:hover,
  .tab-btn:hover,
  .action-btn:hover {
    background: inherit;
  }
}

/* Borrar cuenta (dentro del modal de cuenta) */
.account-delete-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.account-delete-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.account-delete-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.account-delete-status:empty {
  display: none;
}

/* 📱 Selector de categoría al importar: del tamaño del dedo y sin zoom de iOS */
@media (max-width: 600px) {
  .import-cat-select {
    min-height: 40px;
    font-size: 16px;
    padding: 6px 8px;
  }
}

/* 🔑 Cambiar contraseña (modal de cuenta) */
.account-password-btn {
  width: 100%;
  margin-top: 10px;
}
.account-password-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-password-form.hidden {
  display: none;
}
.account-password-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.account-password-form input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 16px;
  color: var(--ink);
  min-height: 44px;
}
.account-password-form input:focus {
  border-color: var(--green);
  outline: none;
}

/* 🏦 Botón principal de Inicio (conectar banco / importar extracto) */
.connect-bank-btn {
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  color: var(--cta-ink);
  font-weight: 800;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ☀️ Tema claro: tarjetas blancas con un borde y una sombra suaves para separarlas del fondo */
[data-theme='light'] .stat-card,
[data-theme='light'] .advisor-alert,
[data-theme='light'] .upcoming-card,
[data-theme='light'] .settings-card,
[data-theme='light'] .import-card,
[data-theme='light'] .history-section .table-wrap {
  box-shadow: var(--card-shadow);
}
@media (max-width: 600px) {
  /* Barra inferior blanca en el tema claro, para que se distinga del fondo */
  [data-theme='light'] .topbar-nav {
    background: color-mix(in srgb, var(--bg2) 96%, transparent);
    box-shadow: 0 -4px 16px rgba(16, 19, 24, 0.05);
  }
}

/* ═══ 🖥️ INICIO EN DOS COLUMNAS ═══
   En el HTML el inicio está en .home-left (runway, consejos, simulador) y .home-right
   (anotar, números, tendencia, banco, pagos fijos, a dónde va tu plata).
   Hasta 1023 px esas columnas no existen (display: contents) y "order" deja el orden de siempre. */
.home-grid {
  display: flex;
  flex-direction: column;
}
.home-left,
.home-right {
  display: contents;
}
.home-hero {
  order: 1;
}
.home-quick {
  order: 2;
}
.home-stats {
  order: 3;
}
.home-trend {
  order: 4;
}
.home-bank {
  order: 5;
}
.home-advisor {
  order: 6;
}
.home-upcoming {
  order: 7;
}
.home-flow {
  order: 8;
}
.home-sim {
  order: 9;
}

/* ═══ 🖥️ COMPUTADOR (≥ 1024 px) ═══
   Solo diseño: no toca cálculos ni lo que se ve en teléfono. */
@media (min-width: 1024px) {
  .app {
    /* 144 px = espacio a cada lado para que el botón 💬 (fijo abajo a la derecha) no tape montos */
    max-width: min(1200px, calc(100vw - 144px));
    padding: 0 24px;
  }

  /* Inicio y Ajustes: la misma columna de antes (600 px con 12 px a cada lado = 576 px),
     centrada. Movimientos e Historial sí usan el ancho del computador. */
  #tab-home,
  #tab-config {
    max-width: 576px;
    margin-inline: auto;
  }

  /* Estilo tablero (principio de Musk: un número manda y el espacio respira).
     El espacio extra del computador agranda el runway; no agrega bloques. */
  .telemetry-hero {
    margin-top: 16px;
    padding: 40px 32px 32px;
  }
  .telemetry-big {
    font-size: 112px;
    letter-spacing: -0.02em;
  }
  .telemetry-unit {
    font-size: 24px;
  }
  .telemetry-description,
  .telemetry-sentence {
    font-size: 14px;
  }
  .home-grid > *,
  .home-left > *,
  .home-right > * {
    margin-bottom: 8px;
  }

  /* Anotar rápido: la tecla Q lo abre desde cualquier parte */
  .quick-add-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    flex: none;
  }
  .quick-add:focus-within .quick-add-kbd {
    display: none;
  }

  /* Historial: una tabla de 1200 px separa demasiado fecha y monto */
  .history-section {
    max-width: 960px;
    margin-inline: auto;
  }

  /* Anotar movimientos: un formulario de 1200 px de ancho se ve perdido */
  .moves-section {
    max-width: 720px;
    margin-inline: auto;
  }

  /* Bienvenida: tarjeta centrada abajo, no una franja de lado a lado */
  .onboarding-tour {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(560px, calc(100vw - 48px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
  }
  .onboarding-tour .tour-actions .btn-primary {
    flex: 0 1 auto;
    margin-inline-start: auto;
    padding-inline: 24px;
  }
}
