/* iAnoia Invest — brand tokens from branding/iAnoia-Manual-Marca.pdf */
:root {
  --brand: #8244e0;
  --brand-soft: #ece5fb;
  --brand-mid: #b8a9f0;
  --accent: #ea6905;
  --accent-soft: #fdeee3;
  --world: #8244e0;
  --gold: #d9a21b;
  --bg: #f2f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #2b2b33;
  --text-soft: #55555f;
  --line: #d0d9e3;
  --line-strong: #9aa6b5;
  --pos: #12805c;
  --neg: #c4320a;
  --warn-bg: #fff4d6;
  --warn-text: #6b4b00;
  --err-bg: #fde7e3;
  --ok-bg: #e2f5ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 6px 20px rgba(20, 20, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #a57cf0;
    --brand-soft: #2a2140;
    --brand-mid: #6a54a8;
    --accent: #f5893a;
    --accent-soft: #3a2616;
    --world: #a57cf0;
    --gold: #e5b73b;
    --bg: #121218;
    --surface: #1c1c25;
    --surface-2: #23232e;
    --text: #ececf2;
    --text-soft: #a8a8b8;
    --line: #33333f;
    --line-strong: #5d5d6e;
    --pos: #3fc18f;
    --neg: #ff7a59;
    --warn-bg: #3a3014;
    --warn-text: #f3d98a;
    --err-bg: #3d1d17;
    --ok-bg: #163126;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #a57cf0; --brand-soft: #2a2140; --brand-mid: #6a54a8; --accent: #f5893a; --accent-soft: #3a2616;
  --world: #a57cf0; --gold: #e5b73b; --bg: #121218; --surface: #1c1c25; --surface-2: #23232e; --text: #ececf2;
  --text-soft: #a8a8b8; --line: #33333f; --line-strong: #5d5d6e; --pos: #3fc18f; --neg: #ff7a59;
  --warn-bg: #3a3014; --warn-text: #f3d98a; --err-bg: #3d1d17; --ok-bg: #163126; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
img { max-width: 100%; }
.muted { color: var(--text-soft); }
.small { font-size: .87rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hl { color: var(--accent); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ layout */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand span { font-weight: 400; color: var(--brand); }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text-soft); font-weight: 500; }
.topnav a:hover, .topnav a[aria-current] { background: var(--brand-soft); color: var(--brand); }
.foot { padding: 20px 16px 28px; text-align: center; font-size: .8rem; color: var(--text-soft); max-width: 900px; margin: 0 auto; }
.foot p { margin: 4px 0; }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .kpis + .grid-2 { margin-top: 16px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); color: #fff; }
.btn-danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: progress; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: var(--neg); font-size: .85rem; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form label small { font-weight: 400; }
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form label.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; min-height: 44px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--brand-mid); outline-offset: 2px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .row-3 { grid-template-columns: 1fr; } }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .95rem; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-ok { background: var(--ok-bg); }
.alert-info { background: var(--brand-soft); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
.alert-error { background: var(--err-bg); }

/* ------------------------------------------------------------------ auth */
.auth-wrap { width: 100%; max-width: 440px; margin: 0 auto; padding: 40px 16px; }
.auth-card { background: var(--surface); border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 1.2rem; margin-bottom: 18px; }
.auth-brand b { color: var(--brand); font-weight: 600; }
.auth-links { text-align: center; font-size: .92rem; margin: 14px 0 0; }

/* ------------------------------------------------------------------ dashboard */
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.dash-head h1 { margin: 0; }
.dash-head p { margin: 2px 0 0; font-size: .85rem; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-soft); padding: 10px 14px;
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; min-height: 44px;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 2px; min-width: 0; }
.kpi span { font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.kpi b { font-size: 1.45rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { font-size: .8rem; color: var(--text-soft); }
.kpi-main { background: var(--brand); color: #fff; }
.kpi-main span, .kpi-main small { color: rgba(255, 255, 255, .85); }
.kpi-world { border-top: 4px solid var(--world); }
.kpi-oro { border-top: 4px solid var(--gold); }

.ratio-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.ratio-line > div { display: grid; }
.ratio-line span { font-size: .8rem; font-weight: 600; }
.big { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .big { font-size: 1.2rem; } }

.gauge { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; padding-top: 12px; }
.gauge .seg { background: var(--surface-2); border-radius: 6px; padding: 8px 4px; text-align: center; display: grid; font-size: .78rem; border: 1px solid var(--line); min-width: 0; }
.gauge .seg b { font-size: .85rem; }
.gauge .seg small { color: var(--text-soft); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gauge .seg.is-active { background: var(--brand-soft); border-color: var(--brand); }
.gauge .seg-6 { border-top: 4px solid #12805c; }
.gauge .seg-5 { border-top: 4px solid #5aa36f; }
.gauge .seg-4 { border-top: 4px solid #a0b84d; }
.gauge .seg-3 { border-top: 4px solid #d9a21b; }
.gauge .seg-2 { border-top: 4px solid #ea6905; }
.gauge .seg-1 { border-top: 4px solid #c4320a; }
.gauge .marker { position: absolute; top: 0; width: 0; height: 0; transform: translateX(-50%); border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 11px solid var(--text); }
@media (max-width: 480px) { .gauge .seg small { display: none; } }

.chart-box { position: relative; height: 300px; }
.chart-sm { height: 240px; }
.empty-msg { text-align: center; }

.steps { padding-left: 0; list-style: none; display: grid; gap: 12px; margin: 0 0 16px; }
.steps li { background: var(--surface-2); border-left: 4px solid var(--brand); padding: 12px 14px; border-radius: 8px; }
.steps li:first-child { border-left-color: var(--gold); }
.calc-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.calc-meta div { display: grid; font-size: .85rem; }
.calc-meta span { color: var(--text-soft); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.table th { font-size: .78rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: .03em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.sim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.sim-grid label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.sim-grid label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.sim-grid output { color: var(--brand); font-weight: 700; margin-left: 4px; }
input[type=range] { width: 100%; accent-color: var(--brand); min-height: 32px; }
.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.scenarios .card { margin: 0; }
@media (max-width: 820px) { .scenarios { grid-template-columns: 1fr; } }
.scen h3 small { color: var(--text-soft); font-weight: 400; }
.scen-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.scen-row b { font-variant-numeric: tabular-nums; }
.hl-row b { color: var(--accent); font-size: 1.15rem; }
.scen-base { outline: 2px solid var(--brand); }

/* ------------------------------------------------------------------ dialogs & toast */
.dialog { border: 0; border-radius: 18px; padding: 24px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(15, 15, 30, .55); }
.dlg-close { position: absolute; top: 10px; right: 12px; }
.dlg-close button { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--text-soft); width: 40px; height: 40px; }
.dialog h2 { padding-right: 40px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); background: var(--text); color: var(--surface); font-weight: 500; }
.toast-error { background: var(--neg); color: #fff; }

/* ------------------------------------------------------------------ settings */
.settings { max-width: 720px; margin: 0 auto; }
.danger-zone { border: 1px solid var(--neg); }

/* ------------------------------------------------------------------ landing */
.landing-main { width: 100%; }
.lp-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; margin: 0 auto; padding: 14px 16px; }
.lp-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lp-nav > a:not(.btn) { color: var(--text-soft); text-decoration: none; padding: 8px 10px; font-weight: 500; }
.lp-nav > a:not(.btn):hover { color: var(--brand); }
@media (max-width: 720px) { .lp-nav > a:not(.btn) { display: none; } .lp-nav .btn { padding: 8px 12px; } }
.lp-hero { max-width: 1180px; margin: 0 auto; padding: 40px 16px 48px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; align-items: center; }
@media (max-width: 880px) { .lp-hero { grid-template-columns: 1fr; padding-top: 16px; } }
.lp-hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.02em; margin-bottom: .4em; }
.lead { font-size: 1.15rem; color: var(--text-soft); max-width: 40em; }
.lead b { color: var(--text); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0 0 8px; }
.lp-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 10px; }
.lp-live { margin: 0; }
.lp-live-ratio { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.lp-live-ratio b { font-size: 3.2rem; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1; }
.lp-live-ratio span { color: var(--text-soft); font-size: .9rem; }
.lp-live-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.lp-live-row span { color: var(--text-soft); }
.lp-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin: 14px 0 10px; }
.lp-bar .w { background: var(--world); }
.lp-bar .o { background: var(--gold); }
.lp-sec { max-width: 1180px; margin: 0 auto; padding: 48px 16px; }
.lp-sec > h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 20px; }
.lp-alt { max-width: none; background: var(--surface); }
.lp-alt > * { max-width: 1148px; margin-left: auto; margin-right: auto; }
.lp-alt .card { background: var(--surface-2); box-shadow: none; }
.lp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.lp-cards .card { margin: 0; }
.lp-cards p { margin: 0; color: var(--text-soft); }
.lp-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 880px) { .lp-2col { grid-template-columns: 1fr; } }
.lp-list { padding-left: 20px; display: grid; gap: 10px; margin: 0; }
.lp-tramos .table td, .lp-tramos .table th { white-space: normal; }
.lp-tramos tr.is-now td { background: var(--brand-soft); font-weight: 700; }
.lp-steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 12px; max-width: 860px; }
.lp-steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 60px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.lp-steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.lp-risk { border-left: 6px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); margin: 24px auto; max-width: 1148px; }
.lp-faq { display: grid; gap: 10px; max-width: 860px; }
.lp-faq details { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; }
.lp-faq summary { font-weight: 600; cursor: pointer; }
.lp-faq p { margin: 10px 0 0; color: var(--text-soft); }
.lp-final { text-align: center; }
.lp-final p { max-width: 640px; margin: 0 auto; color: var(--text-soft); }
.lp-final .lp-cta { justify-content: center; }
.lp-video video { width: 100%; max-width: 900px; border-radius: var(--radius); display: block; background: #000; }

@media (max-width: 420px) {
  .topbar { padding: 8px 12px; }
  .brand { font-size: 1rem; }
  .brand img { width: 22px; height: auto; }
  .topnav a { padding: 6px 8px; }
  .lp-top .brand span { display: none; }
}
