:root {
  --bg: #0c0d10;
  --card: #17191d;
  --card2: #1e2126;
  --txt: #f2f4f7;
  --dim: #8b93a0;
  --green: #1fbf7a;
  --green-bg: #0f2e24;
  --red: #f26d6d;
  --accent: #f0977c;
  --accent-soft: #3a2822;
  --line: #262a31;
}

* { margin: 0; box-sizing: border-box; }
html { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.dim { color: var(--dim); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ── login ─────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid #22262d;
  border-radius: 20px; padding: 34px 26px;
}
.login-logo {
  width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 14px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.login-brand { text-align: center; font-size: 21px; font-weight: 800; }
.login-sub { text-align: center; color: var(--dim); font-size: 13px; margin: 4px 0 24px; }

.lfield { margin-bottom: 14px; }
.lfield label { display: block; color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.lfield input {
  width: 100%; background: var(--card2); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 12px;
  font-size: 15px; font-family: inherit; outline: none;
}
.lfield input:focus { border-color: var(--accent); }
#loginCode { letter-spacing: 6px; text-align: center; font-size: 20px; font-weight: 700; }

.lbtn {
  width: 100%; background: var(--accent); color: #2a1409; border: none;
  border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 800;
  cursor: pointer; font-family: inherit;
}
.lbtn:disabled { opacity: .6; cursor: default; }

.login-info {
  background: var(--green-bg); color: var(--green);
  border-radius: 10px; padding: 10px 12px;
  font-size: 12.5px; line-height: 1.45; margin-bottom: 16px;
}
.login-msg {
  min-height: 18px; text-align: center; font-size: 12.5px;
  margin-top: 12px; color: var(--red);
}
.login-msg.ok { color: var(--green); }
.linklike {
  background: none; border: none; color: var(--dim); font-size: 12.5px;
  cursor: pointer; display: block; margin: 12px auto 0; font-family: inherit;
}
.linklike:hover { color: var(--txt); }

/* ── shell / sidebar ───────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 236px;
  background: #101216; border-right: 1px solid #22262d;
  display: flex; flex-direction: column; padding: 22px 14px; z-index: 10;
}
.side-brand {
  display: flex; gap: 12px; align-items: center;
  padding: 0 6px 20px; border-bottom: 1px solid #22262d; margin-bottom: 14px;
}
.side-logo {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.side-name { font-weight: 800; font-size: 15px; }
.side-sub { color: var(--dim); font-size: 11.5px; margin-top: 1px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.snav {
  display: flex; align-items: center; gap: 11px;
  background: none; border: none; color: var(--dim);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 12px; border-radius: 11px; cursor: pointer; text-align: left;
}
.snav:hover { background: var(--card); color: var(--txt); }
.snav.active { background: var(--accent-soft); color: var(--accent); }
.snav span { font-size: 16px; width: 22px; text-align: center; }

.side-foot {
  color: var(--dim); font-size: 11px; line-height: 1.5;
  padding: 14px 6px 0; border-top: 1px solid #22262d;
}

.main { margin-left: 236px; padding: 28px 30px 60px; max-width: 980px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head p { margin-top: 4px; font-size: 13.5px; color: var(--dim); }

.local-banner {
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 12px; padding: 10px 14px;
  font-size: 12.5px; font-weight: 600; margin-bottom: 16px;
}

/* ── tarjetas ──────────────────────────── */
.card {
  background: var(--card); border: 1px solid #22262d;
  border-radius: 18px; padding: 20px; margin-bottom: 16px;
}
.card-title {
  font-size: 12px; font-weight: 700; letter-spacing: .8px;
  color: var(--dim); text-transform: uppercase; margin-bottom: 12px;
}
.card-title.pos { color: var(--green); }
.card-title.neg { color: var(--red); }
.card-sub { color: var(--dim); font-size: 13px; margin-top: -6px; margin-bottom: 12px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.stat {
  background: var(--card); border: 1px solid #22262d;
  border-radius: 16px; padding: 18px 12px; text-align: center;
}
.stat b { display: block; font-size: 23px; font-weight: 800; margin-bottom: 5px; }
.stat span { color: var(--dim); font-size: 11.5px; }

.quote-banner {
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 14px; color: var(--accent);
  font-size: 13.5px; font-weight: 600; font-style: italic;
  transition: opacity .25s;
}
.quote-banner.q-fade { opacity: 0; }

/* ── gráfico equity ────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-dasharray: 4 5; stroke-width: 1; }
.chart .area { fill: rgba(240, 151, 124, .10); }
.chart .line {
  fill: none; stroke: var(--accent); stroke-width: 2.4;
  stroke-linejoin: round; stroke-linecap: round;
}
.chart .cdot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart text { fill: var(--dim); font-size: 11px; font-family: inherit; }
.chart-empty { font-size: 12.5px; color: var(--dim); padding: 20px 0; text-align: center; }
.chart-legend { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--dim); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo .card { margin-bottom: 0; }
.duo b.big { display: block; font-size: 24px; font-weight: 800; margin-bottom: 3px; }
.duo .dim { font-size: 12.5px; }

/* ── formulario progreso ───────────────── */
.field { margin-top: 14px; }
.field label { display: block; color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 11px 12px;
  font-size: 15px; font-family: inherit; outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }

.plan-toggle { display: flex; gap: 8px; }
.plan-chip {
  flex: 1; background: var(--card2); border: 1px solid var(--line);
  color: var(--dim); border-radius: 10px; padding: 11px;
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.plan-chip.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent);
}

.save {
  width: 100%; margin-top: 18px; border: none; cursor: pointer;
  background: var(--accent); color: #2a1409; font-weight: 800;
  border-radius: 12px; padding: 14px; font-size: 15px; font-family: inherit;
}
.save:disabled { opacity: .6; cursor: default; }
.fmsg {
  min-height: 18px; text-align: center; font-size: 12.5px;
  margin-top: 10px; color: var(--green);
}
.fmsg.err { color: var(--red); }

/* ── tabla registro ────────────────────── */
.table-wrap { overflow-x: auto; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 460px; }
.log-table th {
  color: var(--dim); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  text-align: left; padding: 8px 10px; border-bottom: 1px solid #2a2f37;
}
.log-table td { padding: 10px; border-bottom: 1px solid #22262d; vertical-align: top; }
.log-table tr:last-child td { border-bottom: none; }
.t-pct { font-weight: 700; }
.t-note { color: var(--dim); font-size: 12px; max-width: 240px; line-height: 1.4; }
.log-empty { color: var(--dim); font-size: 13px; padding: 8px 0; }

/* ── calculadora ───────────────────────── */
.calc-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.calc-inputs .field { margin-top: 0; }
.calc-line { font-size: 14px; color: var(--dim); margin: 16px 0 12px; }
.calc-line b { color: var(--txt); }
.mile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mile-card {
  background: var(--card2); border-radius: 12px;
  padding: 13px 8px; text-align: center;
}
.mile-card span { display: block; color: var(--dim); font-size: 11px; margin-bottom: 4px; }
.mile-card b { color: var(--accent); font-size: 15px; }
.mile-card.final { grid-column: 1 / -1; background: var(--accent-soft); }
.mile-card.final b { font-size: 19px; }
.calc-total { text-align: center; margin-top: 14px; font-size: 13px; color: var(--dim); }
.calc-total b { color: var(--green); }
.calc-total span { font-size: 12px; }
.fineprint {
  color: var(--dim); font-size: 11.5px; font-style: italic;
  text-align: center; margin-top: 16px;
}

/* ── academia ──────────────────────────── */
.book-cat {
  color: var(--accent); font-size: 12px; font-weight: 800;
  letter-spacing: 1.5px; margin: 22px 0 10px; text-transform: uppercase;
}
.book-card {
  background: var(--card); border: 1px solid #22262d;
  border-radius: 16px; padding: 16px; margin-bottom: 10px;
}
.book-head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
}
.book-title { font-weight: 700; font-size: 15px; }
.lang-badge {
  background: var(--card2); border-radius: 999px;
  padding: 3px 10px; font-size: 11px; color: var(--dim);
  white-space: nowrap; flex: 0 0 auto;
}
.book-author { color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.book-why { font-size: 13px; margin-top: 8px; line-height: 1.45; }
.book-link {
  display: inline-block; margin-top: 10px; color: var(--accent);
  font-size: 12.5px; font-weight: 700; text-decoration: none;
}
.book-link:hover { text-decoration: underline; }

/* ── perfil ────────────────────────────── */
.pf-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 13px 0; border-bottom: 1px solid #22262d; font-size: 14px;
}
.pf-row:last-of-type { border-bottom: none; }
.pf-row span { color: var(--dim); font-size: 12.5px; }
.pf-row b { font-weight: 600; text-align: right; }
.logout {
  width: 100%; margin-top: 18px; cursor: pointer;
  background: #33201f; color: var(--red); border: 1px solid #4a2a28;
  border-radius: 12px; padding: 13px; font-size: 14px;
  font-weight: 700; font-family: inherit;
}
.logout:hover { background: #3d2423; }

/* ── bottom nav (móvil) ────────────────── */
.bottomnav { display: none; }

@media (max-width: 767px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 14px 96px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .duo { grid-template-columns: 1fr; }
  .mile-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-inputs { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .page-head h1 { font-size: 21px; }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: #101216; border-top: 1px solid #22262d;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 20;
  }
  .bnav {
    flex: 1; background: none; border: none; color: var(--dim);
    font-size: 10.5px; padding: 6px 2px; cursor: pointer; font-family: inherit;
  }
  .bnav.active { color: var(--accent); }
  .bnav-ico { display: block; font-size: 17px; margin-bottom: 2px; }
}
