/* Mentor Libertad · Apps
   Layout: single centered column (max 1080px), sticky slim header, tools as "panels" with
   inputs on the left and results on the right on desktop, stacked on mobile.
   Light (cream) by default; dark via the corner switch (html[data-theme="dark"]). */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f2e9dd;
  --line: #e3dacb;
  --fg: #141210;
  --muted: #5f5a52;
  --faint: #857f75;
  --accent: #f7931a;
  --accent-text: #b35f00;
  --accent-ink: #1a0f00;
  --fiat: #2f6fdb;
  --gold: #b8920f;
  --bad: #c93a3a;
  --good: #1f8a55;
  --shadow: 0 1px 2px rgba(20, 18, 16, .06), 0 6px 18px rgba(20, 18, 16, .06);
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --line: #2a2a2f;
  --fg: #f3f0ea;
  --muted: #a3a09a;
  --faint: #6f6c68;
  --accent-text: #f7931a;
  --fiat: #5b8def;
  --gold: #e8d44d;
  --bad: #ef5f5f;
  --good: #4fc98a;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent-text); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; }

/* Header */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-family: var(--font-display); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; font-size: 14px; font-family: var(--font-body); }
.brand small { color: var(--muted); font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 13px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }

/* Hero */
.hero { padding-block: 48px 28px; }
.eyebrow { font-family: var(--font-data); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 14px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 48px); line-height: 1.08; letter-spacing: -.01em; margin: 0 0 16px; text-wrap: balance; max-width: 20ch; }
h1 em { font-style: normal; color: var(--accent-text); }
h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 3vw, 26px); line-height: 1.2; margin: 0 0 8px; text-wrap: balance; }
h3 { font-size: 15px; margin: 0; font-weight: 700; }
.lede { color: var(--muted); font-size: 18px; max-width: 62ch; margin: 0; }

/* Tool panel */
.panel { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .panel { grid-template-columns: minmax(0, 1fr); } }
.controls { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 16px; }
@media (min-width: 861px) { .controls { position: sticky; top: 76px; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hint { font-size: 12px; line-height: 1.45; color: var(--faint); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; min-width: 0; font: 600 16px/1.2 var(--font-data); color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { font: 700 14px var(--font-body); color: var(--muted); background: transparent; border: 0; border-radius: 6px; padding: 8px 6px; cursor: pointer; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 600 13px var(--font-body); color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); }

/* Results */
.results { display: grid; gap: 20px; min-width: 0; }
.verdict { box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.verdict p { margin: 0; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.4; text-wrap: pretty; }
.verdict strong { font-family: var(--font-data); font-weight: 600; color: var(--fg); white-space: nowrap; }
.verdict .hot { color: var(--accent-text); }
.verdict .neg { color: var(--bad); }
.verdict .pos { color: var(--good); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 480px) { .kpis, .kpis.four { grid-template-columns: minmax(0, 1fr); } }
.kpi { background: var(--surface); padding: 16px 18px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.kpi .k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font: 600 22px/1.2 var(--font-data); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .s { font-size: 13px; color: var(--faint); }
.v.pos { color: var(--good); } .v.neg { color: var(--bad); } .v.hot { color: var(--accent-text); }

.card { box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head p { margin: 0; color: var(--muted); font-size: 14px; }
.chart-box { position: relative; height: 320px; }
@media (max-width: 560px) { .chart-box { height: 260px; } }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

/* Compare cards (cash / gold / bitcoin) */
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .compare { grid-template-columns: minmax(0, 1fr); } }
.cmp { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 6px; align-content: start; position: relative; overflow: hidden; }
.cmp::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--line)); }
.cmp .name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.cmp .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cmp .big { font: 600 22px/1.2 var(--font-data); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cmp .mult { font: 600 14px var(--font-data); }
.cmp .note { font-size: 13px; color: var(--muted); }

.section { padding-block: 36px 8px; }
.section > .lede { margin-bottom: 18px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
td { font-family: var(--font-data); }
td input[type="number"] { width: 88px; padding: 7px 8px; font-size: 14px; text-align: right; }
tfoot td { font-weight: 700; color: var(--fg); border-bottom: 0; }

/* CTA */
.cta { margin-block: 40px 24px; border: 1px solid var(--accent); border-radius: var(--r); padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--surface); }
@media (max-width: 700px) { .cta { grid-template-columns: minmax(0, 1fr); } }
.cta p { margin: 6px 0 0; color: var(--muted); max-width: 58ch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 800 15px var(--font-body); color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 999px; padding: 14px 22px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--fg); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.links { display: flex; gap: 10px; flex-wrap: wrap; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 32px; padding-block: 24px 40px; color: var(--faint); font-size: 13px; }
.foot p { margin: 0 0 8px; max-width: 80ch; }
.live { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--font-data); color: var(--muted); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live.on::before { background: var(--good); }

/* Hub */
.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-block: 8px 24px; }
@media (max-width: 860px) { .apps { grid-template-columns: minmax(0, 1fr); } }
.app { display: grid; gap: 12px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; color: var(--fg); text-decoration: none; transition: border-color .15s, transform .15s; }
.app:hover { border-color: var(--accent); transform: translateY(-2px); }
.app svg { width: 100%; height: 90px; display: block; }
.app .tag { font: 600 11px var(--font-data); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.app h2 { font-size: 20px; margin: 0; }
.app p { margin: 0; color: var(--muted); font-size: 15px; }
.app .go { font-weight: 800; color: var(--accent-text); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .app { transition: none; } .app:hover { transform: none; } }

.formula { font: 500 14px var(--font-data); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: nowrap; color: var(--fg); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Theme switch (corner) */
.theme-toggle { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; padding: 0; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: block; } .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
