/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #16202b;
  --text-soft: #5a6472;
  --text-faint: #8993a1;
  --accent: #1f5f4f;
  --accent-strong: #163f35;
  --accent-soft: #e4efec;
  --danger: #b3392c;
  --danger-soft: #fbe9e6;
  --warn: #9a6b12;
  --warn-soft: #fbf1de;
  --ok: #1f5f4f;
  --gold: #b08a3e;
  --info: #3f6fb0;
  --info-soft: #e8eef7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, .06);
  --shadow-md: 0 6px 20px rgba(16, 24, 32, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 32, .14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 72px;
  --ad-color: #b3392c;
  --ad-bg: #fdeceb;
  --ad-border: #f3b9b3;
}

[data-theme="dark"], :root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #10151b;
    --surface: #171d25;
    --surface-2: #1d242d;
    --border: #2a323d;
    --text: #eef1f4;
    --text-soft: #a9b3c0;
    --text-faint: #737f8c;
    --accent: #4fae95;
    --accent-strong: #6fc4ac;
    --accent-soft: #16352c;
    --danger: #e2695a;
    --danger-soft: #3a1f1c;
    --warn: #d9a94c;
    --warn-soft: #3a2f18;
    --ok: #4fae95;
    --gold: #d3ac66;
    --info: #6fa3d8;
    --info-soft: #1b2c3f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .5);
    --ad-bg: #3a1f1c;
    --ad-border: #6b332c;
  }
}
:root[data-theme="dark"] {
  --bg: #10151b;
  --surface: #171d25;
  --surface-2: #1d242d;
  --border: #2a323d;
  --text: #eef1f4;
  --text-soft: #a9b3c0;
  --text-faint: #737f8c;
  --accent: #4fae95;
  --accent-strong: #6fc4ac;
  --accent-soft: #16352c;
  --danger: #e2695a;
  --danger-soft: #3a1f1c;
  --warn: #d9a94c;
  --warn-soft: #3a2f18;
  --ok: #4fae95;
  --gold: #d3ac66;
  --info: #6fa3d8;
  --info-soft: #1b2c3f;
  --ad-bg: #3a1f1c;
  --ad-border: #6b332c;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-family: var(--serif); font-weight: 600; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.container-narrow { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section-head { max-width: 640px; margin-bottom: clamp(2rem, 5vw, 3rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: .8rem;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--text-soft); max-width: 60ch; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); font-size: .88rem; }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .96rem; white-space: nowrap;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s var(--ease-out), opacity .2s var(--ease-out);
  border: 1px solid transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { color: var(--text-soft); padding-inline: .6rem; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem 1rem; font-size: .86rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: clamp(1.25rem, 2.5vw, 1.75rem); }

.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field label { font-size: .88rem; font-weight: 600; color: var(--text-soft); }
.field input, .field select, .field textarea {
  font: inherit; padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: border-color .2s var(--ease-out);
  width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .8rem; }
.field-hint { font-size: .8rem; color: var(--text-faint); }
.field-error { font-size: .8rem; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 100px;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-gold { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.badge-demo { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.pill-nav { display: flex; gap: .4rem; background: var(--surface-2); padding: .3rem; border-radius: 100px; border: 1px solid var(--border); }
.pill-nav button {
  padding: .55rem 1.1rem; border-radius: 100px; font-weight: 600; font-size: .88rem; color: var(--text-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.pill-nav button.is-active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }

.toast-region { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: .5rem; align-items: center; width: min(92vw, 420px); }
.toast {
  background: var(--text); color: var(--bg); padding: .8rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .9rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: .6rem;
  animation: toastIn .3s var(--ease-out);
}
.toast.is-error { background: var(--danger); color: #fff; }
.toast.is-ok { background: var(--accent-strong); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

dialog.modal { border: none; border-radius: var(--radius-lg); padding: 0; background: var(--surface); box-shadow: var(--shadow-lg); width: min(92vw, 480px); color: var(--text); }
dialog.modal::backdrop { background: rgba(10, 14, 18, .55); backdrop-filter: blur(2px); }
.modal-pad { padding: clamp(1.5rem, 4vw, 2rem); }
.modal-close { position: absolute; top: .9rem; right: .9rem; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-soft); }
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* =============================================================
   6. Ad slots — clearly labelled placeholders, never real ads
   ============================================================= */
.ad-slot {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, var(--ad-bg), var(--ad-bg) 10px, color-mix(in srgb, var(--ad-bg) 60%, transparent) 10px, color-mix(in srgb, var(--ad-bg) 60%, transparent) 20px);
  border: 1.5px dashed var(--ad-border);
  border-radius: var(--radius-sm);
  color: var(--ad-color);
  font-family: var(--mono); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  overflow: hidden;
}
.ad-slot::after { content: attr(data-ad-size); position: absolute; bottom: 6px; right: 10px; font-size: .62rem; letter-spacing: .04em; opacity: .7; text-transform: none; font-family: var(--sans); font-weight: 500; }
.ad-slot-banner { width: 100%; min-height: 100px; font-size: 1rem; margin-block: 2rem; }
.ad-slot-inline { width: 100%; min-height: 90px; font-size: .92rem; margin-block: 1.5rem; }
.ad-slot-square { width: 100%; max-width: 300px; aspect-ratio: 1/1; margin-inline: auto; font-size: .9rem; }

.ad-corner {
  position: fixed; bottom: 1.1rem; right: 1.1rem; z-index: 700;
  width: 220px; padding: .9rem 1rem 1rem;
  background: var(--surface); border: 1.5px dashed var(--ad-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: adCornerIn .4s var(--ease-out);
}
@keyframes adCornerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ad-corner-label { font-family: var(--mono); font-weight: 700; letter-spacing: .08em; color: var(--ad-color); font-size: .78rem; text-transform: uppercase; margin-bottom: .3rem; }
.ad-corner-body { font-size: .82rem; color: var(--text-soft); }
.ad-corner-close { position: absolute; top: .5rem; right: .5rem; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.ad-corner-close:hover { background: var(--surface-2); color: var(--text); }

.ad-popup-backdrop { position: fixed; inset: 0; background: rgba(10,14,18,.5); z-index: 950; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fadeIn .2s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ad-popup { position: relative; width: min(92vw, 420px); background: var(--surface); border: 1.5px dashed var(--ad-border); border-radius: var(--radius-lg); padding: 2.5rem 1.5rem 1.75rem; text-align: center; box-shadow: var(--shadow-lg); }
.ad-popup .ad-corner-close { top: .7rem; right: .7rem; }
.ad-popup-mark { font-family: var(--mono); font-weight: 800; letter-spacing: .12em; color: var(--ad-color); font-size: 1.3rem; text-transform: uppercase; margin-bottom: .6rem; }

/* =============================================================
   7. Sections — marketing (index.html)
   ============================================================= */
.demo-banner {
  background: var(--warn-soft); color: var(--warn); text-align: center;
  font-size: .84rem; font-weight: 600; padding: .55rem 1rem;
}
.nav {
  position: sticky; top: 0; z-index: 500;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; font-family: var(--serif); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 800; font-size: .95rem; }
.nav-links { display: none; align-items: center; gap: 1.75rem; font-size: .92rem; font-weight: 600; color: var(--text-soft); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: .7rem; }
@media (min-width: 800px) { .nav-links { display: flex; } }

.hero { padding-block: clamp(3.5rem, 9vw, 7rem) clamp(2rem, 6vw, 4rem); }
.hero-grid { display: grid; gap: 3rem; align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.05fr .95fr; } }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-trust { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .85rem; color: var(--text-faint); }
.hero-trust span { display: inline-flex; align-items: center; gap: .4rem; }

.mock-dash { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 1.25rem; }
.mock-dash-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.mock-dash-top .dots { display: flex; gap: 6px; }
.mock-dash-top .dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.mock-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
.mock-kpi { background: var(--surface-2); border-radius: var(--radius-sm); padding: .75rem; }
.mock-kpi .n { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.mock-kpi .l { font-size: .72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.mock-bars { display: flex; align-items: flex-end; gap: .5rem; height: 110px; background: var(--surface-2); border-radius: var(--radius-sm); padding: .8rem; }
.mock-bars i { flex: 1; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); opacity: .85; }

.steps { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step-card { padding: 1.5rem; }
.step-num { font-family: var(--serif); font-size: 2rem; color: var(--accent); margin-bottom: .6rem; }

.compare-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-card { padding: 1.5rem; position: relative; }
.compare-card.is-before { border-color: var(--danger-soft); }
.compare-card.is-after { border-color: var(--accent-soft); background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-soft) 35%, var(--surface))); }
.compare-tag { display: inline-block; margin-bottom: .9rem; }
.compare-row { display: flex; justify-content: space-between; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.compare-row:last-child { border-bottom: none; }
.messy-list { display: flex; flex-direction: column; gap: .5rem; font-family: var(--mono); font-size: .82rem; color: var(--text-soft); }
.messy-list li { display: flex; justify-content: space-between; padding: .4rem .6rem; background: var(--surface-2); border-radius: 6px; opacity: .8; }
.messy-list li:nth-child(2) { transform: rotate(-0.6deg); }
.messy-list li:nth-child(3) { transform: rotate(0.4deg); }
.caption { text-align: center; font-size: .82rem; color: var(--text-faint); margin-top: 1rem; }

.pricing-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); max-width: 780px; margin-inline: auto; } }
.price-card { padding: 2rem; display: flex; flex-direction: column; gap: 1.2rem; position: relative; }
.price-card.is-pro { border-color: var(--accent); box-shadow: var(--shadow-md); }
.price-card-badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); }
.price-name { font-size: 1.1rem; font-weight: 700; }
.price-amount { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; }
.price-amount span { font-family: var(--sans); font-size: 1rem; font-weight: 500; color: var(--text-faint); }
.price-list { display: flex; flex-direction: column; gap: .65rem; font-size: .92rem; }
.price-list li { display: flex; align-items: flex-start; gap: .55rem; }
.price-list svg { flex-shrink: 0; margin-top: .15rem; color: var(--accent); }
.price-legal { font-size: .76rem; color: var(--text-faint); text-align: center; margin-top: 1.5rem; }

.tips-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .tips-grid { grid-template-columns: repeat(3, 1fr); } }
.tip-card { padding: 1.4rem; }
.tip-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; margin-bottom: .8rem; }

.faq-item { border-bottom: 1px solid var(--border); }
.faq-q { width: 100%; text-align: left; padding: 1.1rem 0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.faq-q svg { transition: transform .25s var(--ease-out); flex-shrink: 0; }
.faq-item.is-open .faq-q svg { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s var(--ease-out); color: var(--text-soft); font-size: .92rem; }
.faq-item.is-open .faq-a { max-height: 200px; padding-bottom: 1.1rem; }

.cta-band { background: var(--accent); color: #fff; border-radius: var(--radius-lg); padding: clamp(2.2rem, 5vw, 3.5rem); text-align: center; }
.cta-band h2, .cta-band p { color: #fff; }
.cta-band .btn-secondary { background: #fff; color: var(--accent-strong); border-color: transparent; }

.footer { border-top: 1px solid var(--border); padding-block: 3rem 2rem; margin-top: 2rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h4 { font-family: var(--sans); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: .9rem; }
.footer-col ul { display: flex; flex-direction: column; gap: .6rem; font-size: .9rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-size: .82rem; color: var(--text-faint); }

/* =============================================================
   8. App shell (app.html, cuenta.html)
   ============================================================= */
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-nav { height: var(--header-h); border-bottom: 1px solid var(--border); background: var(--surface); }
.app-nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.app-nav-right { display: flex; align-items: center; gap: .8rem; }
.plan-pill { display: flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--border); font-size: .82rem; font-weight: 700; }
.account-menu { position: relative; }
.account-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .88rem; }
.account-dropdown { position: absolute; right: 0; top: 48px; width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .5rem; display: none; flex-direction: column; gap: .1rem; }
.account-dropdown.is-open { display: flex; }
.account-dropdown a, .account-dropdown button { width: 100%; text-align: left; padding: .6rem .7rem; border-radius: 8px; font-size: .88rem; }
.account-dropdown a:hover, .account-dropdown button:hover { background: var(--surface-2); }

.app-main { flex: 1; padding-block: 2rem 3rem; }
.app-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.demo-flag { display: inline-flex; align-items: center; gap: .4rem; }

.kpi-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.5rem; }
@media (min-width: 720px) { .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card { padding: 1.1rem 1.25rem; min-width: 0; }
.kpi-label { font-size: .78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
.kpi-value { font-family: var(--serif); font-size: 1.55rem; font-weight: 700; overflow-wrap: break-word; }
@media (max-width: 480px) { .kpi-value { font-size: 1.2rem; } }
.kpi-value.is-over { color: var(--danger); }
.kpi-value.is-good { color: var(--accent); }
.kpi-sub { font-size: .78rem; color: var(--text-faint); margin-top: .3rem; }
.kpi-sub.is-over { color: var(--danger); }
.kpi-sub.is-good { color: var(--accent); }

.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }

.form-list { display: flex; flex-direction: column; gap: .6rem; }
.form-list-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; gap: .5rem; align-items: center; }
.form-list-row-ingreso { grid-template-columns: minmax(0, 1fr) 88px 92px 100px auto; }
.form-list-row input, .form-list-row select { font: inherit; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; min-width: 0; }
.row-remove { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.row-remove:hover { background: var(--danger-soft); color: var(--danger); }
.limit-note { font-size: .8rem; color: var(--text-faint); margin-top: .5rem; }

.subcat-block { margin: -.15rem 0 .6rem; }
.subcat-toggle { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text-faint); font-weight: 600; padding: .3rem 0; }
.subcat-toggle:hover { color: var(--accent); }
.subcat-panel { margin: .4rem 0 0 .3rem; padding: .6rem .7rem; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px dashed var(--border); display: flex; flex-direction: column; gap: .4rem; }
.subcat-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; gap: .4rem; align-items: center; }
.form-list-row input[data-campo="monto"][readonly] { background: var(--surface-2); color: var(--text-soft); cursor: not-allowed; font-weight: 700; }
.subcat-row input { font: inherit; padding: .4rem .6rem; font-size: .85rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; min-width: 0; }
.row-remove-sm { width: 26px; height: 26px; border-radius: 6px; }

.selector-mes-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.selector-mes-head select { font: inherit; padding: .5rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-weight: 700; }
.mes-strip { display: flex; gap: .4rem; overflow-x: auto; padding: 4px 2px .2rem; }
.mes-btn {
  position: relative; flex: 0 0 auto; padding: .55rem .9rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: .86rem; color: var(--text-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
  overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.mes-btn:hover { border-color: var(--accent); }
.mes-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mes-dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); z-index: 1; }
.mes-btn.is-active .mes-dot { background: #fff; }
.mes-btn.is-seleccionado { background: var(--accent-soft); border-color: var(--accent-strong); color: var(--accent-strong); }
.mes-btn.is-seleccionado::before {
  content: "✓"; position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; z-index: 1;
}
.mes-btn::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: rgba(255, 255, 255, .35); pointer-events: none;
}
.mes-btn.is-presionando::after { animation: mesPulsacion 3s linear forwards; }
@keyframes mesPulsacion { from { width: 0%; } to { width: 100%; } }

.table-simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table-simple th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.table-simple td { padding: .65rem .6rem; border-bottom: 1px solid var(--border); }
.table-simple tr:last-child td { border-bottom: none; }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .5rem; }
.table-scroll { overflow-x: auto; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-faint); font-size: .92rem; }

.tabbar { display: flex; gap: .3rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabbar button { padding: .8rem 1.1rem; font-weight: 600; font-size: .92rem; color: var(--text-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabbar button.is-active { color: var(--accent-strong); border-color: var(--accent); }
.view { display: none; }
.view.is-active { display: block; }

.chart-wrap { padding: 1.25rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; margin-top: 1rem; font-size: .84rem; }
.chart-legend li { display: flex; align-items: center; gap: .45rem; color: var(--text-soft); }
.bar-compare { display: flex; flex-direction: column; gap: .9rem; }
.bar-compare-row .lbl { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: .35rem; }
.bar-track { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--accent); transition: width .5s var(--ease-out); }
.bar-fill.is-over { background: var(--danger); }
.bar-budget-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .5; }

.upsell-list { display: flex; flex-direction: column; gap: .6rem; margin: 1.1rem 0; }
.upsell-list li { display: flex; gap: .6rem; font-size: .9rem; align-items: flex-start; }
.upsell-list svg { color: var(--accent); flex-shrink: 0; margin-top: .1rem; }

.fake-card { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; background: var(--surface-2); font-family: var(--mono); letter-spacing: .04em; color: var(--text-soft); margin: 1rem 0; }

.tip-of-day { display: flex; gap: .9rem; align-items: flex-start; padding: 1.25rem; }
.tip-of-day .tip-icon { flex-shrink: 0; }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 400px; padding: clamp(1.75rem, 4vw, 2.25rem); }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-foot { text-align: center; margin-top: 1.2rem; font-size: .9rem; color: var(--text-soft); }

.legal h2 { margin-top: 2rem; margin-bottom: .8rem; font-size: 1.3rem; }
.legal p, .legal li { color: var(--text-soft); margin-bottom: .8rem; }
.legal ul { list-style: disc; padding-left: 1.4rem; }
.legal li { list-style: disc; }

/* =============================================================
   8b. App shell (sidebar) + Resumen (dashboard principal)
   ============================================================= */
.app-shell-body { min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar-toggle-mobile {
  display: none; position: fixed; top: .9rem; left: .9rem; z-index: 40;
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  align-items: center; justify-content: center; box-shadow: var(--shadow-md);
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 29; }
.sidebar-backdrop[hidden] { display: none; }

.sidebar {
  flex: 0 0 232px; width: 232px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.1rem .9rem; gap: 1.4rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { padding: 0 .4rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; }
.sidebar-footer { display: flex; flex-direction: column; gap: .2rem; margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--border); }
.sidebar-link {
  display: flex; align-items: center; gap: .8rem; padding: .65rem .75rem; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 600; font-size: .92rem; white-space: nowrap; width: 100%; text-align: left;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-icon { flex-shrink: 0; }
.sidebar-link.is-active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.sidebar-link.is-active .sidebar-icon { color: var(--accent); }
.sidebar-label { overflow: hidden; text-overflow: ellipsis; }

.app-shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shell-header {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  padding: 1.25rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--border); background: var(--surface);
}
.shell-header-right { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.mes-select-header {
  font: inherit; font-weight: 700; padding: .55rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.container-fluid { padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem; width: 100%; }

/* Modo privacidad: botón del encabezado + capa que cubre importes guardados en formularios */
.privacy-toggle {
  display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem; min-height: 40px;
  border-radius: 100px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-soft); font-weight: 600; font-size: .85rem; white-space: nowrap;
}
.privacy-toggle:hover { border-color: var(--accent); color: var(--text); }
.privacy-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-strong); color: var(--accent-strong); }
.privacy-toggle svg { flex-shrink: 0; }
@media (max-width: 719px) { .privacy-toggle-label { display: none; } .privacy-toggle { padding: .55rem; } }

.monto-wrap { position: relative; }
/* Capa puramente visual (no interactiva): mientras la privacidad global esté activa, cubre el
   campo y el input queda deshabilitado — hay que apagar la privacidad para editarlo. */
.monto-privacidad-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none;
  display: flex; align-items: center; padding: 0 .9rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); font: inherit; font-weight: 700;
}
.monto-wrap input:disabled { cursor: not-allowed; }

.kpi-row-4 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-bottom: 1.25rem; }
@media (min-width: 560px) { .kpi-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpi-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card-2 { padding: 1.1rem 1.2rem; display: flex; align-items: flex-start; gap: .9rem; min-width: 0; }
.kpi-card-2-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.kpi-icon-accent { background: var(--accent-soft); color: var(--accent-strong); }
.kpi-icon-danger { background: var(--danger-soft); color: var(--danger); }

.grid-dashboard, .grid-dashboard-3 { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); margin-top: 1.25rem; }
@media (min-width: 960px) { .grid-dashboard, .grid-dashboard-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.span-2 { grid-column: span 2; }

.chart-legend-full { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; font-size: .86rem; }
.chart-legend-full li { display: flex; align-items: center; gap: .5rem; color: var(--text-soft); }
.chart-legend-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.chart-legend-pct { color: var(--text-faint); }
.chart-legend-monto { font-weight: 600; min-width: 5.5rem; text-align: right; }

.bar-fill.is-good { background: var(--accent); }
.bar-fill.is-warn { background: var(--warn); }
.fila-total td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }

.insight-card { border-left: 3px solid var(--border); }
.insight-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-soft); }
.insight-card.insight-good { border-left-color: var(--accent); }
.insight-card.insight-good .insight-icon { background: var(--accent-soft); color: var(--accent-strong); }
.insight-card.insight-warn { border-left-color: var(--warn); }
.insight-card.insight-warn .insight-icon { background: var(--warn-soft); color: var(--warn); }
.insight-card.insight-over { border-left-color: var(--danger); }
.insight-card.insight-over .insight-icon { background: var(--danger-soft); color: var(--danger); }

/* Deudas */
.acciones-deuda { display: flex; flex-wrap: wrap; gap: .3rem; }
.sim-resultado-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: .9rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.sim-resultado-grid > div { display: flex; flex-direction: column; gap: .1rem; }
.sim-resultado-grid .faint { font-size: .76rem; }
.sim-resultado-grid strong { font-size: 1.05rem; }
.sim-resultado-grid strong.is-good { color: var(--accent); }
.linea-tiempo-fila { margin-bottom: 1.6rem; }
.linea-tiempo-cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.linea-tiempo-track { position: relative; height: 6px; border-radius: 999px; background: var(--surface-2); margin: 0 7px; }
.linea-tiempo-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 999px; }
.linea-tiempo-azul .linea-tiempo-fill { background: var(--info); }
.linea-tiempo-verde .linea-tiempo-fill { background: var(--accent); }
.linea-tiempo-resto { position: absolute; top: 50%; right: -7px; height: 0; border-top: 2px dashed var(--border); transform: translateY(-50%); }
.linea-tiempo-punto {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 0 0 3px var(--surface);
}
.linea-tiempo-azul .linea-tiempo-punto { background: var(--info); }
.linea-tiempo-verde .linea-tiempo-punto { background: var(--accent); }
.linea-tiempo-badge {
  position: absolute; right: 0; top: 0; display: inline-block; padding: .25rem .6rem;
  border: 1px dashed var(--accent); border-radius: 999px; color: var(--accent); font-size: .76rem; font-weight: 700; white-space: nowrap;
}
@media (max-width: 719px) { .sim-resultado-grid { grid-template-columns: minmax(0, 1fr); } .linea-tiempo-badge { position: static; display: inline-block; margin-top: .5rem; } }

.metas-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.meta-card .sim-resultado-grid { background: var(--bg); }
/* El icono nativo del selector de mes es oscuro por defecto y se pierde sobre el fondo oscuro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #simular-mes-abono::-webkit-calendar-picker-indicator { filter: invert(1); }
}
:root[data-theme="dark"] #simular-mes-abono::-webkit-calendar-picker-indicator { filter: invert(1); }

.proximamente { text-align: center; padding: 3rem 1.5rem; color: var(--text-faint); }
.proximamente svg { color: var(--text-faint); margin-bottom: .3rem; }

/* Movimientos: encabezado propio, KPIs de 3 y gráfica de cascada */
.view-header { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; }
.kpi-row-3 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-bottom: 1.25rem; }
@media (min-width: 560px) { .kpi-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpi-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cascada-head { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.info-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: .3rem;
  border-radius: 50%; background: var(--surface-2); color: var(--text-faint); font-size: .72rem; font-style: italic; font-weight: 700;
  vertical-align: middle; cursor: help;
}
.info-icon-btn:hover { background: var(--accent-soft); color: var(--accent-strong); }
.cascada-comparacion { font-size: .84rem; font-weight: 600; color: var(--text-soft); }
.cascada-comparacion.is-good { color: var(--accent); }
.cascada-comparacion.is-over { color: var(--danger); }
.cascada-comparacion.faint { color: var(--text-faint); font-weight: 500; }
#cascada-agrupar { display: inline-flex; margin-bottom: 1rem; }
.cascada-scroll { overflow-x: auto; padding-bottom: .3rem; }
#cascada-canvas-wrap { position: relative; height: 320px; min-width: 100%; }

/* Tablet: sidebar se colapsa a solo íconos */
@media (min-width: 720px) and (max-width: 1099px) {
  .sidebar { flex-basis: 76px; width: 76px; padding-inline: .6rem; }
  .sidebar-label { display: none; }
  .sidebar-link { justify-content: center; padding: .7rem; }
  .sidebar-brand .sidebar-label { display: none; }
}

/* Móvil: la barra lateral se convierte en un cajón (drawer) con botón hamburguesa */
@media (max-width: 719px) {
  .sidebar-toggle-mobile { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30; flex-basis: 240px; width: 240px;
    transform: translateX(-100%); transition: transform .25s var(--ease-out); box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app-shell { display: block; }
  .app-shell-main { min-height: 100vh; }
  .shell-header { padding-left: 3.6rem; }
  .grid-dashboard-3 .span-2, .grid-dashboard .span-2 { grid-column: span 1; }
}

/* =============================================================
   9. Responsive breakpoints reference
   ============================================================= */
@media (max-width: 539px) {
  .form-list-row-ingreso {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "nombre nombre" "tipo regularidad" "monto remove";
  }
  .form-list-row-ingreso input[data-campo="nombre"] { grid-area: nombre; }
  .form-list-row-ingreso select[data-campo="tipo"] { grid-area: tipo; }
  .form-list-row-ingreso select[data-campo="regularidad"] { grid-area: regularidad; }
  .form-list-row-ingreso input[data-campo="monto"] { grid-area: monto; }
  .form-list-row-ingreso .row-remove { grid-area: remove; width: 100%; }

  .nav-inner { gap: .4rem; }
  .brand { font-size: .95rem; gap: .4rem; }
  .brand-mark { width: 26px; height: 26px; font-size: .82rem; }
  .nav-actions { gap: .4rem; }
  .nav-actions .btn { padding: .55rem .8rem; font-size: .82rem; }
}
@media (min-width: 540px) { }
@media (min-width: 720px) { }
@media (min-width: 960px) { }
@media (min-width: 1280px) { }

/* =============================================================
   10. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-corner, .toast { animation: none; }
}
