/*! TeLoCalculo — estilos. Tema normal (claro) y oscuro mediante [data-theme]. */

/* ---------- Tokens ---------- */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --text: #1c2333;
  --muted: #5b6479;
  --border: #e1e6f0;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef0ff;
  --brand-text: #3730a3;
  --on-brand: #ffffff;
  --logo-bg: #4f46e5;
  --accent-on-brand: #5eead4;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #a15c07;
  --warn-soft: #fff5e3;
  --err: #c62828;
  --err-soft: #fdecec;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px -12px rgba(16, 24, 40, .12);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 18px;
  --radius-sm: 11px;
  --focus: 0 0 0 3px rgba(79, 70, 229, .35);
  --c-math: #4f46e5;       --c-math-soft: #eceaff;
  --c-finance: #047857;    --c-finance-soft: #e3f6ee;
  --c-work: #b45309;       --c-work-soft: #fff1dc;
  --c-health: #be123c;     --c-health-soft: #ffe8ee;
  --c-everyday: #0369a1;   --c-everyday-soft: #e2f3fc;
  --c-converters: #7c3aed; --c-converters-soft: #f1e9ff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1120;
  --surface: #151a2c;
  --surface-2: #1c2238;
  --text: #e7eaf3;
  --muted: #a4abc2;
  --border: #2a3150;
  --brand: #8b93ff;
  --brand-strong: #a9afff;
  --brand-soft: #222852;
  --brand-text: #c7cbff;
  --on-brand: #0d1120;
  --logo-bg: #5b52f0;
  --ok: #4ade80;
  --ok-soft: #12301f;
  --warn: #fbbf24;
  --warn-soft: #33270d;
  --err: #f87171;
  --err-soft: #3a1717;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -12px rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --focus: 0 0 0 3px rgba(139, 147, 255, .45);
  --c-math: #a5a0ff;       --c-math-soft: #262457;
  --c-finance: #34d399;    --c-finance-soft: #10302a;
  --c-work: #fbbf24;       --c-work-soft: #33270f;
  --c-health: #fb7185;     --c-health-soft: #3a1622;
  --c-everyday: #38bdf8;   --c-everyday-soft: #0f2a3b;
  --c-converters: #c4a5ff; --c-converters-soft: #2b1d4d;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--brand-text); text-underline-offset: .18em; }
:root[data-theme="dark"] a { color: var(--brand-strong); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.icon { display: inline-block; vertical-align: middle; flex: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.no-js .js-only { display: none !important; }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px;
  background: var(--brand); color: var(--on-brand); border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--surface); } }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 750; font-size: 1.2rem; letter-spacing: -.02em; flex: none; }
.logo:hover { text-decoration: none; }
.logo-text b { color: var(--brand); font-weight: 800; }
.logo-mark rect:first-child { fill: var(--logo-bg); }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 8px 12px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.main-nav a:hover, .main-nav a.is-active { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: .9rem; background: var(--surface);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { background: var(--surface-2); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 170px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.lang-menu a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.lang-menu a:hover { background: var(--surface-2); }
.lang-menu a[aria-current] { font-weight: 700; color: var(--brand-text); }
:root[data-theme="dark"] .lang-menu a[aria-current] { color: var(--brand-strong); }
.nav-toggle { display: none; }

@media (max-width: 1020px) {
  .nav-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .js .main-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 10px 16px 16px;
  }
  .js .main-nav.is-open { display: block; }
  .js .main-nav ul { flex-direction: column; }
  .js .main-nav a { padding: 12px 14px; border-radius: 10px; font-size: 1rem; }
  .no-js .header-inner { flex-wrap: wrap; }
  .no-js .main-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 8px; }
}
@media (max-width: 380px) {
  .logo-text { font-size: 1.05rem; }
  .lang-menu summary span { display: none; }
}

/* ---------- Estructura ---------- */
.page { padding-top: 20px; padding-bottom: 40px; }
.page.has-sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 1100px) { .page.has-sidebar { grid-template-columns: minmax(0, 1fr) 290px; } }
.main { min-width: 0; outline: none; }
.sidebar { display: none; }
@media (min-width: 1100px) {
  .sidebar { display: block; }
  .sidebar > * { position: sticky; top: 88px; }
}
.side-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.side-title { font-weight: 700; margin: 0 0 8px; }
.side-list ul { list-style: none; margin: 0; padding: 0; }
.side-list a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 9px; text-decoration: none; color: var(--text); font-size: .93rem; }
.side-list a span { width: 26px; text-align: center; font-weight: 700; font-size: .8rem; color: var(--muted); }
.side-list a:hover { background: var(--surface-2); }
.side-list a[aria-current] { background: var(--brand-soft); color: var(--brand-text); font-weight: 650; }
:root[data-theme="dark"] .side-list a[aria-current] { color: var(--brand-strong); }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 0 14px; padding: 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; opacity: .7; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }

.page-head { margin: 4px 0 22px; }
.page-head .lead { font-size: 1.12rem; color: var(--muted); max-width: 64ch; margin: 0; }
.page-head--home { text-align: center; margin: 18px auto 26px; }
.page-head--home .lead { margin: 0 auto; }
.cat-badge {
  display: inline-block; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; text-decoration: none; background: var(--brand-soft); color: var(--brand-text);
}

/* Colores por categoría */
.cat-math { --c: var(--c-math); --cs: var(--c-math-soft); }
.cat-finance { --c: var(--c-finance); --cs: var(--c-finance-soft); }
.cat-work { --c: var(--c-work); --cs: var(--c-work-soft); }
.cat-health { --c: var(--c-health); --cs: var(--c-health-soft); }
.cat-everyday { --c: var(--c-everyday); --cs: var(--c-everyday-soft); }
.cat-converters { --c: var(--c-converters); --cs: var(--c-converters-soft); }
.cat-badge[class*="cat-"] { background: var(--cs); color: var(--c); }

/* ---------- Caja de herramienta ---------- */
.tool-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 28px;
}
@media (min-width: 720px) { .tool-box { padding: 28px; } }

.fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 18px; }
.field { grid-column: span 6; min-width: 0; margin: 0; padding: 0; border: 0; }
@media (min-width: 640px) {
  .field--half { grid-column: span 3; }
  .field--third { grid-column: span 2; }
}
.field[hidden] { display: none; }
.field > label, .field > legend { display: block; font-weight: 650; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap--short { max-width: 240px; }
input[type="text"], input[type="email"], input[type="search"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 1.02rem; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; font-family: var(--mono); font-size: .95rem; }
.contact-form textarea { font-family: var(--font); font-size: 1rem; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); background: var(--surface); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat;
}
.input-wrap .unit {
  position: absolute; right: 14px; pointer-events: none; color: var(--muted); font-weight: 600; font-size: .92rem;
}
.input-wrap:has(.unit) input { padding-right: 64px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
.hint { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: .88rem; color: var(--err); font-weight: 600; }

.field--seg legend { margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 14px; }
.seg-opt { flex: 1 1 auto; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: block; text-align: center; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: .93rem;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.seg-opt input:checked + span { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .seg-opt input:checked + span { background: var(--brand-soft); color: var(--brand-strong); }
.seg-opt input:focus-visible + span { box-shadow: var(--focus); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.field--check { align-self: end; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); color: var(--on-brand); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn[disabled] { opacity: .65; cursor: progress; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--brand-text); cursor: pointer; font-weight: 600; font-size: .9rem; }
:root[data-theme="dark"] .link-btn { color: var(--brand-strong); }

/* ---------- Resultado ---------- */
.result {
  margin-top: 24px; padding: 20px; border-radius: var(--radius); background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); outline: none; animation: pop .25s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.result-label { display: block; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-text); }
:root[data-theme="dark"] .result-label { color: var(--brand-strong); }
.result-value { display: block; font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.6rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin: 4px 0 2px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); margin: 0; }
.result-rows { display: grid; grid-template-columns: 1fr; gap: 0; margin: 16px 0 0; padding: 0; }
@media (min-width: 640px) { .result-rows { grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.result-rows div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed color-mix(in srgb, var(--brand) 25%, transparent); }
.result-rows dt { color: var(--muted); }
.result-rows dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.result-rows .is-strong dt, .result-rows .is-strong dd { color: var(--text); font-weight: 800; }
.result-note { margin: 14px 0 0; font-size: .92rem; color: var(--muted); }
.result-error { color: var(--err); font-weight: 650; margin: 0; }
.result-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 16px 0 6px; background: var(--surface); }
.result-bar span { display: block; height: 100%; }
.result-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.result-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; margin-top: 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); max-height: 420px; }
.result-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.result-table th, .result-table td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 700; }
/* Escala del IMC de 10 a 40: 18,5 → 28,3 %, 25 → 50 %, 30 → 66,7 % */
.result-scale { position: relative; height: 14px; border-radius: 999px; margin: 18px 0 8px; background: linear-gradient(90deg, #60a5fa 0 28.3%, #34d399 28.3% 50%, #fbbf24 50% 66.7%, #f87171 66.7% 100%); }
.result-scale b { position: absolute; top: -5px; width: 4px; height: 24px; border-radius: 2px; background: var(--text); transform: translateX(-2px); }

/* ---------- Compartir ---------- */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.share-title { font-weight: 700; font-size: .95rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0;
  font-weight: 650; font-size: .9rem; color: #fff; text-decoration: none; cursor: pointer;
}
.share-btn:hover { filter: brightness(1.08); text-decoration: none; color: #fff; }
.share-fb { background: #1877f2; }
.share-wa { background: #1fa855; }
.share-x { background: #111; }
.share-tg { background: #229ed9; }
.share-copy { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.share-copy:hover { color: var(--text); }
:root[data-theme="dark"] .share-x { background: #f2f2f2; color: #111; }
@media (max-width: 520px) { .share-name { display: none; } .share-btn { padding: 0 12px; } .share-copy .share-name { display: inline; } }

/* ---------- Tarjetas y listados ---------- */
.directory { margin: 8px 0 34px; }
.directory-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.directory-head h2 { margin: 0; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .icon { position: absolute; left: 14px; top: 14px; color: var(--muted); }
.search input { padding-left: 44px; background: var(--surface); }
.cat-block { margin: 22px 0 8px; }
.cat-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.cat-title a { color: var(--c); text-decoration: none; }
.cat-title a:hover { text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tool-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tool-card:hover { border-color: var(--c); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.tool-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px;
  background: var(--cs); color: var(--c); font-weight: 800; font-size: .95rem; letter-spacing: -.02em;
}
.tool-text strong { display: block; font-size: .98rem; line-height: 1.3; margin-bottom: 3px; }
.tool-text span { display: block; font-size: .87rem; color: var(--muted); line-height: 1.4; }
.tool-card[hidden], .cat-block[hidden] { display: none; }
.no-results { padding: 18px; text-align: center; color: var(--muted); }
.other-cats ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.cat-pill { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--cs); color: var(--c) !important; font-weight: 650; text-decoration: none; }
.related { margin-top: 34px; }

/* ---------- Texto (explicación / legal) ---------- */
.explain, .faq, .other-cats, .legal { margin: 34px 0; }
.prose { max-width: 78ch; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose h2 { margin-top: 1.4em; }
.prose h3 { margin-top: 1.4em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.legal h2 { font-size: 1.3rem; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding: 10px 0 10px 46px; border-bottom: 1px solid var(--border); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 9px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font-weight: 800; font-size: .9rem;
}
:root[data-theme="dark"] .steps li::before { color: var(--brand-strong); }
.formula { margin: 22px 0; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); }
.formula-label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.formula code { font-family: var(--mono); font-size: .98rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.info-table th { width: 32%; }

/* ---------- FAQ ---------- */
.faq-item { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 16px 52px 16px 18px; font-weight: 700; position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); color: var(--brand-text); font-weight: 800;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { background: var(--surface-2); }
.faq-answer { padding: 0 18px 4px; }
.faq-answer p { color: var(--muted); }

/* ---------- Avisos ---------- */
.notice, .alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin: 18px 0; font-size: .93rem; }
.notice { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.notice .icon { color: var(--warn); margin-top: 2px; }
.notice p, .alert p { margin: 0; }
.alert--ok { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.alert--error { background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); outline: none; }

/* ---------- Contacto ---------- */
.contact-box { max-width: 820px; }
.hp-field { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.captcha-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.captcha-img { border-radius: 10px; border: 1px solid var(--border); background: #f5f6fa; }
.form-status { color: var(--muted); font-weight: 600; font-size: .92rem; }
.email-img { vertical-align: middle; height: 28px; width: auto; }
:root[data-theme="dark"] .email-img { filter: invert(1) hue-rotate(180deg); }
.email-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Calculadora básica / científica ---------- */
.calc { display: grid; gap: 22px; }
@media (min-width: 860px) { .calc--basic { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; } }
.calc-main { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 900px) {
  .calc--sci .calc-main { grid-template-columns: 1.15fr 1fr; grid-template-areas: "screen screen" "sci basic" "tip tip"; column-gap: 16px; }
  .calc--sci .calc-screen { grid-area: screen; }
  .calc--sci .calc-keys--sci { grid-area: sci; }
  .calc--sci .calc-keys--basic { grid-area: basic; }
  .calc--sci .calc-tip { grid-area: tip; }
}
.calc-screen {
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 12px 16px; text-align: right; min-width: 0;
}
.calc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.calc-prev { color: var(--muted); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; font-variant-numeric: tabular-nums; }
.calc-angle { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 2px 10px; font-weight: 700; font-size: .8rem; cursor: pointer; color: var(--brand-text); }
.calc-input {
  width: 100%; border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: right; padding: 0 !important;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); font-weight: 700; min-height: 52px; font-variant-numeric: tabular-nums; caret-color: var(--brand);
}
.calc-result { display: block; min-height: 1.6em; color: var(--brand-text); font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
:root[data-theme="dark"] .calc-result { color: var(--brand-strong); }
.calc-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.calc-keys--sci { grid-template-columns: repeat(5, minmax(0, 1fr)); align-content: start; }
.key {
  min-height: 56px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 1.25rem; font-weight: 650; color: var(--text); box-shadow: var(--shadow-sm); transition: background .1s, transform .05s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.calc-keys--sci .key { min-height: 46px; font-size: .98rem; background: var(--surface-2); }
.key:hover { background: var(--surface-2); }
.key:active, .key.is-pressed { transform: scale(.97); }
.key--op { color: var(--brand-text); background: var(--brand-soft); font-size: 1.4rem; }
:root[data-theme="dark"] .key--op { color: var(--brand-strong); }
.key--fn { color: var(--muted); }
.key--eq { background: var(--brand); color: var(--on-brand); border-color: transparent; font-size: 1.5rem; }
.key--eq:hover { background: var(--brand-strong); }
.calc-tip { font-size: .85rem; color: var(--muted); margin: 2px 0 0; text-align: center; }
.calc-history { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; min-width: 0; }
.calc-history-head { display: flex; align-items: center; justify-content: space-between; }
.calc-history-title { margin: 0; font-weight: 700; }
.calc-history-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 360px; overflow: auto; }
.calc-history-list li { padding: 8px 0; border-bottom: 1px solid var(--border); text-align: right; cursor: pointer; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc-history-list li:hover { color: var(--brand-text); }
.calc-history-list small { display: block; color: var(--muted); }
.calc-history-empty { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.calc-history-list:not(:empty) + .calc-history-empty { display: none; }

/* ---------- Publicidad ---------- */
.ad-slot { margin: 24px auto; text-align: center; min-height: 90px; overflow: hidden; max-width: 100%; }
.sidebar .ad-slot { margin-top: 0; min-height: 250px; }
.ad-slot--placeholder {
  display: grid; place-items: center; min-height: 100px; border: 2px dashed var(--border); border-radius: 12px;
  color: var(--muted); font: 600 .85rem var(--mono); background: var(--surface-2);
}
.wrap > .ad-slot, body > .ad-slot { width: calc(100% - 32px); max-width: 1152px; }

/* ---------- Pie ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 36px 0 24px; margin-top: 20px; font-size: .94rem; }
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-brand p { color: var(--muted); margin-top: 10px; max-width: 40ch; }
.footer-title { font-weight: 750; margin-bottom: 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 6px; }
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); text-decoration: underline; }
.disclaimer { display: flex; gap: 12px; margin-top: 28px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-size: .88rem; }
.disclaimer p { margin: 0; }
.disclaimer .icon { margin-top: 2px; }
.copyright { margin: 18px 0 0; color: var(--muted); font-size: .85rem; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding: 30px 0 10px; }
.nf-code { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 900; line-height: 1; margin: 0; color: var(--brand); opacity: .25; }
.not-found .lead { color: var(--muted); }

/* ---------- Accesibilidad y otros ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .sidebar, .share, .ad-slot, .actions, .related, .crumbs { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-box { box-shadow: none; border: 1px solid #ccc; }
}
