/* CalculaEuros — estilos compartidos */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --text: #141831;
  --muted: #5a6282;
  --border: #e1e5f0;
  --accent: #4f46e5;
  --accent-strong: #3f37c9;
  --accent-soft: #eceefe;
  --green: #0f9f6e;
  --green-soft: #e3f7ef;
  --orange: #e8780c;
  --orange-soft: #fdf0e2;
  --rose: #d6336c;
  --shadow: 0 1px 2px rgba(20, 24, 49, .05), 0 10px 30px rgba(20, 24, 49, .07);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1020;
    --surface: #161a2e;
    --surface-2: #1d2238;
    --text: #eef0fa;
    --muted: #a1a8c6;
    --border: #2a3050;
    --accent: #8b85ff;
    --accent-strong: #a49fff;
    --accent-soft: #24264a;
    --green: #34d399;
    --green-soft: #12302a;
    --orange: #fbab4f;
    --orange-soft: #33261a;
    --rose: #f472a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1020;
  --surface: #161a2e;
  --surface-2: #1d2238;
  --text: #eef0fa;
  --muted: #a1a8c6;
  --border: #2a3050;
  --accent: #8b85ff;
  --accent-strong: #a49fff;
  --accent-soft: #24264a;
  --green: #34d399;
  --green-soft: #12302a;
  --orange: #fbab4f;
  --orange-soft: #33261a;
  --rose: #f472a6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo b { color: var(--accent); font-weight: 800; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0ea5a3); color: #fff; font-weight: 800;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1rem; flex: none;
}
@media (max-width: 940px) {
  .nav { flex-wrap: wrap; gap: 8px; padding: 10px 0; }
  .nav-links { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .theme-toggle { margin-left: auto; }
}

/* Cabecera de página */
.page-head { padding: 28px 0 18px; }
.page-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 6px; }
.page-head p { margin: 0; color: var(--muted); max-width: 680px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600;
  color: var(--green); background: var(--green-soft); padding: 4px 10px; border-radius: 99px; margin-bottom: 10px;
}

/* Bloque de herramienta */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .tool { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card h2 { font-size: 1.05rem; margin: 0 0 14px; }

.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-weight: 500; }
input[type="number"], input[type="date"], select {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 12px;
  padding: 12px 40px 12px 14px; outline: none; transition: border-color .15s, background .15s;
}
select { padding-right: 14px; cursor: pointer; }
input[type="number"]:focus, input[type="date"]:focus, select:focus { border-color: var(--accent); background: var(--surface); }
input[type="number"]::-webkit-inner-spin-button { opacity: .4; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; } }

.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented label { flex: 1; margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 8px 6px; border-radius: 9px; cursor: pointer;
  font-weight: 600; font-size: .9rem; color: var(--muted); transition: background .15s, color .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* Resultados */
.result-main {
  border-radius: 14px; padding: 20px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #2c6be0 55%, #0ea5a3 100%);
}
.result-main .k { font-size: .9rem; opacity: .9; font-weight: 500; }
.result-main .v { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-main .s { font-size: .9rem; opacity: .9; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 6px 0 10px; }
.bar > span { display: block; height: 100%; transition: width .35s ease; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--muted); }

.note { font-size: .8rem; color: var(--muted); margin: 12px 0 0; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }

.chart-box { position: relative; height: 240px; margin-top: 4px; }
.chart-box canvas { width: 100%; height: 100%; display: block; }
.chart-tip {
  position: absolute; top: 4px; left: 8px; font-size: .8rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; pointer-events: none; box-shadow: var(--shadow);
}

/* Calculadoras de porcentajes */
.pct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.pct-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 500; }
.pct-line input { width: 120px; flex: 1 1 100px; padding-right: 14px; }
.pct-out {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft);
  font-size: 1.5rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; min-height: 56px;
}
.pct-out small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); }

/* Huecos de publicidad */
.ad-slot { margin: 24px auto; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-slot.is-preview {
  border: 1.5px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .8rem; background: var(--surface-2);
}
.ad-slot.is-preview::before { content: "Espacio para anuncio · " attr(data-ad); }
.ad-slot ins { width: 100%; }

/* Contenido SEO */
.content { padding: 8px 0 20px; }
.content article { max-width: 760px; }
.content h2 { font-size: 1.4rem; margin: 32px 0 10px; }
.content h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.content p, .content li { color: var(--muted); }
.content strong { color: var(--text); }
details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; }

/* Tarjetas de herramientas */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 8px 0 24px; }
.tool-card {
  display: block; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool-card .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 12px; }
.tool-card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.tool-card .go { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 600; font-size: .9rem; }

.hero { padding: 48px 0 24px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 12px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), #0ea5a3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto; font-size: 1.1rem; }

/* Pie */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 24px 0 32px; color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .bar > span, .tool-card { transition: none; }
}

input[type="date"] { padding-right: 14px; min-height: 50px; }
.field label input[type="checkbox"] { accent-color: var(--accent); margin-right: 6px; }
.field label:has(input[type="checkbox"]) { font-weight: 500; }
.alert {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; font-size: .88rem;
  background: var(--orange-soft); color: var(--text); border-left: 4px solid var(--orange);
}

/* Guías */
.post { max-width: 760px; margin: 0 auto; padding: 20px 0 8px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.tag {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 99px; margin-bottom: 8px;
}
.post h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin: 4px 0 12px; }
.post .lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 10px; }
.post-meta { font-size: .85rem; color: var(--muted); margin-bottom: 20px; }
.post h2 { font-size: 1.45rem; margin: 36px 0 10px; }
.post h3 { font-size: 1.1rem; margin: 24px 0 6px; }
.post p, .post li { font-size: 1.05rem; line-height: 1.75; }
.post li { margin-bottom: 6px; }
.post .table-wrap { margin: 14px 0; }
.cta {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--accent); border-radius: 16px; padding: 14px 18px;
  box-shadow: var(--shadow); margin: 18px 0; transition: transform .15s;
}
.cta:hover { transform: translateY(-2px); }
.cta-ico { font-size: 1.6rem; flex: none; }
.cta b { display: block; }
.cta small { color: var(--muted); font-size: .88rem; }
.cta-go { margin-left: auto; font-size: 1.3rem; color: var(--accent); font-weight: 700; }
.callout {
  background: var(--green-soft); border-left: 4px solid var(--green); border-radius: 12px;
  padding: 14px 16px; margin: 18px 0;
}
.callout p { margin: 0; }
.see-also { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.tool-card .tag { margin: 0 0 8px; }
@media (prefers-reduced-motion: reduce) { .cta { transition: none; } }

/* Versión para insertar en otras webs */
body.widget { background: transparent; }
.widget .card { padding: 16px; box-shadow: none; }
.widget .result-main { padding: 14px 16px; margin-bottom: 12px; }
.widget .result-main .v { font-size: 2rem; }
.widget .field { margin-bottom: 10px; }
.widget input[type="number"], .widget select { padding-top: 9px; padding-bottom: 9px; font-size: 1rem; }
.widget .stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 10px; }
.widget .stat { padding: 8px 10px; }
.widget .stat .v { font-size: 1rem; }
.widget-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.widget-foot a { font-weight: 600; text-decoration: none; }
.code-box {
  width: 100%; min-height: 150px; font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; resize: vertical;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; padding: 10px 16px;
}
.btn:hover { background: var(--accent-strong); }
.embed-preview { max-width: 480px; }
.embed-preview iframe { width: 100%; border: 0; display: block; }
.widget .row-2 { grid-template-columns: 1fr 1fr; gap: 8px; }
.widget .field label, .widget .field .label { font-size: .8rem; margin-bottom: 4px; }
.widget .segmented span { font-size: .85rem; padding: 6px 4px; }
.widget .legend { font-size: .78rem; gap: 4px 10px; }
.widget .bar { margin: 4px 0 6px; }
@media (max-width: 380px) {
  .widget .card { padding: 12px; }
  .widget .result-main .v { font-size: 1.7rem; }
  .widget .stats { gap: 6px; }
  .widget-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
}
