/* ==========================================================================
   CIMA — Radar de Patrimonio, Inversiones y Retiro (Powered by AQ-INVEST)
   Identidad Visual Propia: Verde Bosque (#0E3A2F) · Marfil (#F7F5EE) · Menta (#10B981)
   Web Desktop + Mobile PWA Responsive
   ========================================================================== */

:root {
  --bg: #F7F5EE;
  --bg-soft: #EFECE2;
  --surface: #FFFFFF;
  --forest: #0E3A2F;
  --forest-2: #145041;
  --forest-deep: #08241D;
  --mint: #10B981;
  --mint-bright: #34D399;
  --mint-soft: rgba(16, 185, 129, 0.12);
  --danger: #C2410C;
  --danger-soft: rgba(194, 65, 12, 0.11);
  --warn: #B45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --ink: #0F231D;
  --muted: #526A61;
  --dim: #7C9289;
  --border: rgba(14, 58, 47, 0.12);
  --border-strong: rgba(14, 58, 47, 0.22);
  --shadow: 0 8px 26px rgba(14, 58, 47, 0.06);
  --radius: 18px;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #091713;
  --bg-soft: #10241E;
  --surface: #122922;
  --forest: #0B2E25;
  --forest-2: #14473A;
  --forest-deep: #061813;
  --mint: #34D399;
  --mint-bright: #6EE7B7;
  --mint-soft: rgba(52, 211, 153, 0.15);
  --danger: #FB923C;
  --danger-soft: rgba(251, 146, 60, 0.16);
  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --ink: #F2EFE6;
  --muted: #9AB2A9;
  --dim: #6E8A80;
  --border: rgba(110, 231, 183, 0.14);
  --border-strong: rgba(110, 231, 183, 0.26);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
button, input, select { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* Onboarding */
.onb-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.15), transparent 50%), var(--bg);
}
.onb-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
}
.onb-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.onb-brand img { width: 48px; height: 48px; border-radius: 14px; }
.onb-title { font-family: var(--font-serif); font-size: 32px; font-weight: 600; margin: 0 0 8px; line-height: 1.12; letter-spacing: -0.02em; }
.onb-sub { font-size: 14.5px; color: var(--muted); margin: 0 0 22px; line-height: 1.55; }

/* Main Frame (Desktop Sidebar + Mobile Bottom Bar) */
.cima-frame { display: flex; min-height: 100vh; }
.sidenav {
  width: 262px;
  background: linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #F4F2EA;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.sidenav-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; cursor: pointer; }
.sidenav-brand img { width: 38px; height: 38px; border-radius: 11px; }
.sidenav-brand h1 { font-family: var(--font-serif); font-size: 22px; margin: 0; line-height: 1; font-weight: 600; letter-spacing: -0.01em; }
.powered { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.72; display: block; margin-top: 3px; }
.powered strong { color: var(--mint-bright); font-weight: 700; }

.nav-list { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: rgba(244, 242, 234, 0.78);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-btn.on { background: rgba(52, 211, 153, 0.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.25); }
.nav-btn .ico { font-size: 17px; width: 22px; text-align: center; }

.sidenav-cta { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.sidenav-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); display: flex; flex-direction: column; gap: 6px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 245, 238, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 13px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
[data-theme="dark"] .topbar { background: rgba(9, 23, 19, 0.9); }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.mobile-logo { display: none; width: 32px; height: 32px; border-radius: 9px; }
.page-title { font-family: var(--font-serif); font-size: 22px; font-weight: 600; margin: 0; line-height: 1.1; }
.page-sub { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.content {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 22px 26px 80px;
}

/* Hero Patrimonio Neto */
.hero-wealth {
  background: radial-gradient(circle at top right, rgba(52, 211, 153, 0.22), transparent 55%), linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #F7F5EE;
  border-radius: 22px;
  padding: 26px 28px;
  margin-bottom: 18px;
  box-shadow: 0 16px 38px rgba(14, 58, 47, 0.2);
}
.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mint-bright);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-net {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 50px);
  font-weight: 600;
  margin: 6px 0 4px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.18);
  color: #A7F3D0;
  margin-bottom: 18px;
}
.hero-delta.neg { background: rgba(251, 146, 60, 0.2); color: #FDBA74; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.h-stat small { display: block; font-size: 11px; color: rgba(247, 245, 238, 0.68); margin-bottom: 2px; }
.h-stat strong { font-size: 17px; font-weight: 700; color: #fff; }

/* Grid & Cards */
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.grid-2 .card, .grid-equal .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-family: var(--font-serif); font-size: 19px; font-weight: 600; margin: 0; }
.hint { font-size: 12.5px; color: var(--muted); }

/* Buttons & Pills */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 12px;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, opacity .15s, background .15s;
}
.btn:hover { opacity: 0.93; transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-forest { background: var(--forest); color: #F7F5EE; }
.btn-mint { background: linear-gradient(135deg, #10B981, #059669); color: #fff; }
.btn-soft { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn-wide { width: 100%; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
}
.pill.ok { background: var(--mint-soft); color: var(--forest-2); }
[data-theme="dark"] .pill.ok { color: var(--mint-bright); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.pro { background: var(--forest); color: var(--mint-bright); cursor: pointer; border: none; padding: 5px 11px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 15px;
}

/* Segmented Controls & Chips */
.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }

/* Lists & Rows */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.item-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}
.item-name { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12px; color: var(--muted); }
.item-right { text-align: right; flex-shrink: 0; }
.item-val { font-size: 15px; font-weight: 800; color: var(--ink); }
.item-val.liab { color: var(--danger); }
.item-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.text-btn { background: none; border: none; color: var(--forest-2); font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 4px; }
[data-theme="dark"] .text-btn { color: var(--mint-bright); }
.text-btn.del { color: var(--danger); }

/* Progress / Allocation Bars */
.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 8px; }
.track { height: 9px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.track > span { display: block; height: 100%; border-radius: 999px; }

/* Donut Layout */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 170px; display: grid; gap: 8px; }
.legend li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.legend-l { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Currency Exposure Pills */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.fx-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
}
.fx-box strong { display: block; font-size: 16px; margin-top: 2px; }

/* Freedom Simulator */
.sim-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.sim-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-mini {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.kpi-mini small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-mini strong { display: block; font-family: var(--font-serif); font-size: 22px; margin-top: 4px; color: var(--ink); }

/* Demo Banner & Lock Box */
.demo-bar {
  background: var(--mint-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.lock-box {
  background: linear-gradient(135deg, rgba(14, 58, 47, 0.06), rgba(16, 185, 129, 0.08));
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}

/* Forms & Modals */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.input, .select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input[type="range"] { width: 100%; accent-color: var(--mint); cursor: pointer; }

.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 22, 18, 0.56);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--font-serif); font-size: 22px; margin: 0; }
.close-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--ink); cursor: pointer; font-weight: 700; }

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.plan-opt {
  position: relative;
  border: 2px solid var(--border);
  background: var(--bg);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.plan-opt.on { border-color: var(--mint); background: var(--mint-soft); }
.plan-ribbon {
  position: absolute;
  top: -10px;
  right: 10px;
  background: var(--forest);
  color: var(--mint-bright);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Mobile Bottom Nav */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
}
.bnav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.bnav-btn .ico { font-size: 18px; }
.bnav-btn.on { color: var(--forest); }
[data-theme="dark"] .bnav-btn.on { color: var(--mint-bright); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--forest-deep);
  color: #F7F5EE;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  max-width: 92vw;
  text-align: center;
}

@media (max-width: 960px) {
  .sidenav { display: none; }
  .mobile-logo { display: block; }
  .bottom-nav { display: grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 14px 96px; }
  .hero-wealth { padding: 20px 18px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-equal, .sim-grid { grid-template-columns: 1fr; }
  .sim-kpis { grid-template-columns: 1fr; }
  .toast { bottom: 78px; }
}
