:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #16202b;
  --muted: #64748b;
  --line: #e3e8ef;
  --brand: #f59e0b;
  --brand-ink: #7c4a03;
  --accent: #0e7490;
  --green: #15803d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
  --hero-grad: linear-gradient(135deg, #0b1f33 0%, #123a5a 55%, #b45309 130%);
  --hero-ink: #ffffff;
  --hero-sub: #dbe6f1;
  --hero-pill-bg: rgba(255, 255, 255, .14);
  --hero-pill-hover: rgba(255, 255, 255, .26);
  --hero-pill-border: rgba(255, 255, 255, .25);
}
html { color-scheme: light dark; }
[hidden] { display: none !important; }
body {
  margin: 0;
  text-align: left;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hero {
  background: var(--hero-grad);
  color: var(--hero-ink, #fff);
  padding: 2.6rem 1rem 3.2rem;
}
.hero-inner { max-width: 1080px; margin: 0 auto; }
.brandbar { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; flex-wrap: wrap; }
.brandbar img { height: 38px; max-width: 190px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px 8px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; background: #fff; border-radius: 10px; color: var(--brand, #f59e0b); }
.brand-mark svg { display: block; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand-phone { margin-left: auto; color: var(--hero-ink, #fff); text-decoration: none; font-weight: 600; background: var(--hero-pill-bg, rgba(255,255,255,.16)); border: 1px solid var(--hero-pill-border, rgba(255,255,255,.28)); padding: .35rem .7rem; border-radius: 999px; font-size: .9rem; white-space: nowrap; }
.brand-phone:hover { background: var(--hero-pill-hover, rgba(255,255,255,.26)); }
.badge {
  display: inline-block;
  font-size: .74rem;
  letter-spacing: .02em;
  background: var(--hero-pill-bg, rgba(255,255,255,.14));
  border: 1px solid var(--hero-pill-border, rgba(255,255,255,.25));
  color: var(--hero-ink, #fff);
  padding: .3rem .6rem;
  border-radius: 999px;
  margin-bottom: .9rem;
}
.hero h1 { margin: 0 0 .5rem; font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 1.15; }
.hero p { margin: 0; max-width: 60ch; color: var(--hero-sub, #dbe6f1); font-size: 1.02rem; }

.layout {
  max-width: 1080px;
  margin: -2rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.1rem;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); margin-top: -1.5rem; }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem;
}
.results-panel { min-height: 320px; }
.form-panel { position: sticky; top: 12px; }
@media (max-width: 860px) { .form-panel, .results-panel { position: static; } }

h2 { font-size: 1.05rem; margin: 0 0 1rem; }
h3 { font-size: .95rem; margin: 0 0 .6rem; }

.field { display: block; margin-bottom: .85rem; }
.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.field small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; box-sizing: border-box;
  padding: .6rem .7rem; font-size: .95rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); border-color: var(--brand); }
textarea { resize: vertical; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row { display: flex; gap: .5rem; }
.row input { flex: 1; }
.hint { font-size: .78rem; color: var(--muted); margin: -.4rem 0 .9rem; }
button { font-family: inherit; cursor: pointer; border-radius: 9px; font-weight: 600; }
.btn-primary {
  width: 100%; padding: .8rem 1rem; margin-top: .3rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 84%, #fff), var(--brand));
  color: var(--brand-ink);
  border: none; font-size: 1rem; box-shadow: 0 2px 0 color-mix(in srgb, var(--brand) 65%, #000);
}
.btn-primary:not([disabled]) { color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 65%, #000); }
.btn-secondary {
  padding: .6rem .8rem; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); white-space: nowrap;
}
.geo-results { list-style: none; margin: -.3rem 0 .9rem; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.geo-results li { padding: .5rem .7rem; font-size: .85rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.geo-results li:last-child { border-bottom: none; }
.geo-results li:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }

/* Estimador de consumo (#kwhHelp): ayuda a quien no sabe sus kWh (factura o tipo de vivienda). */
.kwh-help { margin: -.2rem 0 .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.kwh-help > summary { cursor: pointer; padding: .6rem .8rem; font-size: .85rem; font-weight: 600; color: var(--accent); }
.kwh-help > summary::marker { color: var(--muted); }
.kwh-help[open] > summary { border-bottom: 1px solid var(--line); }
.kwh-help > .hint { margin: .6rem .8rem 0; }
.kwh-block { padding: .7rem .8rem .9rem; }
.kwh-block + .kwh-block { border-top: 1px dashed var(--line); }
.kwh-block h4 { margin: 0 0 .5rem; font-size: .85rem; }
.kwh-block .field { margin-bottom: .5rem; }
.kwh-block .hint { margin: .2rem 0 .5rem; }
.kwh-block .btn-secondary { width: 100%; }

.trustbox { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.trustbox h3 { font-size: .85rem; margin-bottom: .5rem; }
.trustbox ul { margin: 0; padding-left: 1.1rem; }
.trustbox li { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.trustbox strong { color: var(--ink); }

.verdict {
  margin: .2rem 0 .9rem; padding: .85rem .9rem;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-left: 4px solid var(--accent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
.verdict h3 { margin: 0 0 .35rem; font-size: 1rem; }
.verdict p { margin: 0 0 .55rem; font-size: .88rem; }
.verdict ul { margin: 0; padding-left: 1.1rem; }
.verdict li { font-size: .83rem; color: var(--muted); margin-bottom: .3rem; }
.verdict a { color: var(--accent); }
.verdict[data-level="great"] {
  border-left-color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, var(--line));
  background: color-mix(in srgb, var(--green) 7%, var(--panel));
}
.verdict[data-level="bad"] {
  border-left-color: #d97706; border-color: color-mix(in srgb, #d97706 30%, var(--line));
  background: color-mix(in srgb, #d97706 7%, var(--panel));
}

.placeholder { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.placeholder .sun { font-size: 2.6rem; margin-bottom: .5rem; }
.loading { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto .8rem;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }
.stat {
  background: color-mix(in srgb, var(--ink) 4%, var(--panel));
  border: 1px solid var(--line); border-radius: 11px; padding: .7rem .8rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.stat.big .stat-value { font-size: 1.9rem; }
.stat .stat-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.stat .stat-value { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.stat .stat-sub { font-size: .74rem; color: var(--muted); }
.stat.accent { background: color-mix(in srgb, var(--green) 10%, var(--panel)); }
.stat.accent .stat-value { color: var(--green); }
.stats.small { grid-template-columns: 1fr 1fr; }
.stats.small .stat { padding: .55rem .65rem; }
.stats.small .stat-value { font-size: .98rem; }

.chart-block { margin-top: 1.1rem; }
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; margin-top: .3rem; }
.dot { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; }
.dot.gen { background: var(--brand); }
.dot.load { background: var(--accent); }

.lead { margin-top: 1.3rem; padding: 1rem; border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--brand) 5%, var(--panel)); }
.lead p { font-size: .88rem; color: var(--muted); margin: 0 0 .8rem; }
.lead-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .5rem; }
.lead select:has(option[value=""]:checked) { color: var(--muted); }
@media (max-width: 420px) { .lead-row { grid-template-columns: 1fr; } }
.lead-alt { margin: .2rem 0 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; text-align: left; }
.linklike:hover { color: var(--brand-ink); }
.lead-email-only { margin-top: .5rem; }
.lead-email-only .btn-secondary { width: auto; }
.hp-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.consent { display: flex; gap: .5rem; align-items: flex-start; font-size: .78rem; color: var(--muted); margin: .4rem 0 .8rem; }
.consent input { width: auto; margin-top: .15rem; }
.consent a { color: var(--accent); }

.share-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.share-bar .btn-secondary { padding: .52rem .8rem; font-size: .88rem; }
.share-bar .hint { margin: 0; font-size: .78rem; }

.foot { max-width: 1080px; margin: 0 auto; padding: 0 1rem 2.2rem; color: var(--muted); font-size: .76rem; }

/* --- Buzón de consultas (pie de página, presente en todas las páginas publicadas) --- */
.contact {
  margin: 0 0 1.2rem; padding: 1.15rem 1.2rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: left; color: var(--ink);
}
.contact h2 { font-size: 1rem; margin: 0 0 .3rem; }
.contact > p { font-size: .82rem; color: var(--muted); margin: 0 0 .8rem; }
.contact .lead-row { margin-bottom: .5rem; }
.contact textarea { font-size: .9rem; min-height: 88px; }
.contact button { margin-top: .5rem; }
.contact-status { font-size: .78rem; margin: .5rem 0 0; min-height: 1em; }
.contact-status.ok { color: var(--green); }
.contact-status.err { color: #dc2626; }
.contact-mail { font-size: .8rem; margin: .7rem 0 0; }
.contact-mail a { color: var(--accent); }

/* --- Secciones de contenido SEO (páginas de provincia) --- */
.prov {
  max-width: 1080px; margin: 1.4rem auto; padding: 1.4rem 1.2rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.prov-intro { margin-top: 1.8rem; }
.prov h2 { font-size: 1.22rem; margin: 1.2rem 0 .55rem; }
.prov h2:first-child { margin-top: 0; }
.prov p { margin: 0 0 .6rem; }
.prov a { color: var(--accent); }
.prov-table { width: 100%; border-collapse: collapse; margin: .7rem 0 .9rem; font-size: .9rem; }
.prov-table th, .prov-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.prov-table thead th { font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--line); }
.prov-table tbody th { font-weight: 600; color: var(--muted); }
.prov-table th:not(:first-child), .prov-table td:not(:first-child) { text-align: right; }
.prov-table tbody tr:last-child th, .prov-table tbody tr:last-child td { border-bottom: none; }
.prov-table tbody tr.battery-best td { background: rgba(245, 158, 11, .20); font-weight: 600; }
.prov-table tbody tr.battery-best td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.prov-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .25rem .9rem; margin: .6rem 0 1rem; }
.prov-months div { display: flex; justify-content: space-between; gap: .6rem; padding: .32rem .55rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.prov-months .m { color: var(--muted); }
.prov-months .v { font-weight: 600; }
.faq h3 { font-size: 1rem; margin: 1.1rem 0 .25rem; }
.faq p { margin: 0; color: var(--muted); font-size: .9rem; }
.prov-links { list-style: none; margin: .7rem 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .3rem .9rem; }
.prov-links a { color: var(--accent); text-decoration: none; font-size: .88rem; }
.prov-links a:hover { text-decoration: underline; }
.prov-links .current { font-weight: 700; color: var(--ink); }

/* --- Estudio: ranking de producción solar por provincia (página citables, ver SEO.md §3) --- */
.study-table-wrap { overflow-x: auto; margin: .7rem 0 .4rem; -webkit-overflow-scrolling: touch; }
.study-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.study-table caption { caption-side: top; text-align: left; font-size: .78rem; color: var(--muted); padding: 0 0 .5rem; }
.study-table th, .study-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.study-table thead th { font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--line); cursor: pointer; user-select: none; }
.study-table thead th small { font-weight: 400; color: var(--muted); }
.study-table thead th:hover { color: var(--accent); }
.study-table thead th[data-dir]::after { content: " ▾"; color: var(--accent); }
.study-table thead th[data-dir="asc"]::after { content: " ▴"; }
.study-table .study-prov { text-align: left; }
.study-table a { color: var(--accent); text-decoration: none; }
.study-table a:hover { text-decoration: underline; }
.study-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.study-bar-cell { width: 84px; min-width: 84px; }
.study-table th.study-bar-cell { white-space: normal; line-height: 1.15; }
/* Variante para tablas con TEXTO largo (no numéricas): permite el salto de línea dentro de la celda. */
.study-table.wrap th, .study-table.wrap td { white-space: normal; text-align: left; vertical-align: top; }
.study-table.wrap thead th { cursor: default; }
.study-table.wrap thead th:hover { color: var(--ink); }
.study-bar { display: block; height: .5rem; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #facc15); }
.study-notes { margin: .4rem 0 0; padding-left: 1.1rem; }
.study-notes li { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.study-notes strong { color: var(--ink); }
.study-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; margin: .4rem 0 .8rem; }
.study-two h3 { font-size: .98rem; margin: 0 0 .35rem; }
.study-list { font-size: .9rem; line-height: 1.9; }
.study-cta { border-left: 4px solid var(--brand); }
@media (max-width: 620px) {
  .study-two { grid-template-columns: 1fr; }
  .study-bar-cell { width: 64px; min-width: 64px; }
}
@media (max-width: 620px) {
  .prov { margin: 1rem auto; padding: 1.1rem .85rem; }
  .prov-table { font-size: .84rem; }
  .prov-table th, .prov-table td { padding: .42rem .4rem; }
}

/* --- Página "precio de la luz hoy" (PVPC en vivo; se rellena en cliente) --- */
.pl-live { margin: .6rem 0 .4rem; }
.pl-tabs { display: flex; gap: .4rem; margin: .1rem 0 .5rem; flex-wrap: wrap; }
.pl-tab {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: .32rem .85rem;
}
.pl-tab:hover { border-color: var(--accent); color: var(--accent); }
.pl-tab.is-on { background: var(--brand); border-color: var(--brand); color: #0b1720; }
.pl-date { margin: 0 0 .1rem; }
.pl-summary { margin: .1rem 0 .6rem; font-size: .9rem; }
.pl-tip {
  margin: .1rem 0 .6rem; font-size: .9rem; padding: .5rem .7rem; border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border-left: 3px solid var(--brand);
}
.pl-table td.pl-hour { text-align: left; font-variant-numeric: tabular-nums; }
.pl-table td.pl-price { font-variant-numeric: tabular-nums; font-weight: 600; }
.pl-table tbody tr.pl-now td { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.pl-table tbody tr.pl-neg td.pl-price { color: #0b7a4b; }
.pl-table tbody tr.pl-neg .pl-bar { background: linear-gradient(90deg, #6ee7b7, #34d399); }
.pl-nowtag {
  font-size: .68rem; font-weight: 700; color: var(--brand-ink);
  background: color-mix(in srgb, var(--brand) 24%, transparent);
  border-radius: 999px; padding: .05rem .4rem; margin-left: .3rem;
}
.pl-badge {
  display: inline-block; font-size: .68rem; font-weight: 700; border-radius: 999px;
  padding: .1rem .45rem; border: 1px solid transparent;
}
.pl-valle { color: #0b7a4b; background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .35); }
.pl-llano { color: #8a5a00; background: rgba(245, 158, 11, .16); border-color: rgba(245, 158, 11, .35); }
.pl-punta { color: #b91c1c; background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .32); }
.pl-bar-head, .pl-bar-cell { width: 130px; min-width: 130px; }
.pl-bar { display: block; height: .5rem; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #facc15); }
.pl-bar-valle { background: linear-gradient(90deg, #34d399, #10b981); }
.pl-bar-llano { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.pl-bar-punta { background: linear-gradient(90deg, #f87171, #ef4444); }
.pl-negtag {
  font-size: .72rem; font-weight: 700; color: #0b7a4b;
  background: rgba(16, 185, 129, .16); border-radius: 999px; padding: .05rem .45rem;
}
.pl-loading { animation: pl-pulse 1.1s ease-in-out infinite; }
@keyframes pl-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
/* En móvil la tabla cabe sin scroll si se oculta la barra (el tramo ya lo da la etiqueta). */
@media (max-width: 620px) {
  .pl-bar-head, .pl-bar-cell { display: none; }
  .pl-table th, .pl-table td { padding: .38rem .4rem; }
}

/* --- Consola de la VM (puente MCP; pieza opcional, ver README.md §2) --- */
.vm {
  max-width: 1080px; margin: 1.4rem auto 0; padding: 0 1rem;
}
.vm > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .75rem 1rem; font-weight: 600;
}
.vm > summary::-webkit-details-marker { display: none; }
.vm > summary::before { content: "▸"; color: var(--muted); font-weight: 700; }
.vm[open] > summary::before { content: "▾"; }
.vm[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
.vm-title { font-size: .92rem; }
.vm-sum { font-size: .78rem; font-weight: 600; color: var(--muted); margin-left: auto; }
.vm-sum[data-level="ok"] { color: var(--green); }
.vm-sum[data-level="warn"] { color: var(--brand-ink); }
.vm-sum[data-level="err"] { color: #dc2626; }
.vm-body {
  background: var(--panel); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow);
  padding: 1rem; text-align: left; display: flex; flex-direction: column; gap: .8rem;
}
.vm-body > .hint { margin: 0; }
.vm-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.vm-cfg { display: flex; flex-direction: column; gap: .6rem; padding: .8rem; border-radius: 11px; background: color-mix(in srgb, var(--ink) 4%, var(--panel)); border: 1px solid var(--line); }
.vm-cfg .field { margin: 0; }
.vm-cfg .hint { margin: 0; }
.vm-cfg .hint[data-level="ok"] { color: var(--green); }
.vm-cfg .hint[data-level="err"] { color: #dc2626; }
.vm-rows { display: flex; flex-direction: column; gap: .4rem; }
.vm-row {
  display: flex; align-items: baseline; gap: .55rem; padding: .5rem .7rem;
  border-radius: 10px; background: color-mix(in srgb, var(--ink) 4%, var(--panel));
  border: 1px solid var(--line); font-size: .84rem;
}
.vm-row .vm-dot { flex: 0 0 auto; font-weight: 800; }
.vm-row .vm-name { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }
.vm-row .vm-detail { color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.vm-row.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.vm-row.warn { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.vm-row.err { border-color: color-mix(in srgb, #dc2626 45%, var(--line)); }
.vm-row.ok .vm-dot { color: var(--green); }
.vm-row.warn .vm-dot { color: var(--brand); }
.vm-row.err .vm-dot { color: #dc2626; }
.vm-run { display: flex; flex-direction: column; gap: .6rem; }
.vm-run .field { margin: 0; }
.vm-run .hint { margin: 0; font-size: .78rem; }
.vm-run textarea, .vm-cfg textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.vm-run-btn { width: auto; margin: 0; padding: .62rem 1.1rem; font-size: .92rem; }
.vm-quick { display: flex; gap: .4rem; flex-wrap: wrap; }
.vm-quick .vm-quick-btn, .vm-quick .btn-secondary { padding: .38rem .6rem; font-size: .8rem; }
.vm-out {
  margin: 0; max-height: 340px; overflow: auto; padding: .7rem .8rem;
  border-radius: 10px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 6%, var(--panel));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem;
  line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
}
.vm-out[data-level="ok"] { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.vm-out[data-level="err"] { border-color: color-mix(in srgb, #dc2626 45%, var(--line)); }
@media (max-width: 620px) {
  .vm-run-btn { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --panel: #161b22; --ink: #e6edf3; --muted: #8b98a5;
    --line: #26303a; --green: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
  input, select, textarea { background: #0d1117; }
}

/* CTA fija: aparece al mostrar el resultado y lleva directo al formulario de presupuesto. */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: .9rem;
  padding: .65rem 1rem; background: rgba(11, 31, 51, .97); color: #fff;
  border-top: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 -8px 24px rgba(16, 24, 40, .22);
}
.sticky-cta p { margin: 0; font-size: .95rem; max-width: 48ch; color: #e6eef7; }
.sticky-cta .btn-primary { width: auto; margin: 0; padding: .55rem 1.05rem; }
.sticky-cta-close { background: transparent; border: 0; color: #aebecd; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: .25rem .4rem; }
.sticky-cta-close:hover { color: #fff; }
body.has-sticky-cta { padding-bottom: 72px; }
@media (max-width: 620px) {
  .sticky-cta { gap: .6rem; justify-content: space-between; }
  .sticky-cta p { display: none; }
  .sticky-cta .btn-primary { flex: 1; }
}


/* --- Comparador de presupuestos (#compareHelp) --- */
.compare { margin-top: 1.1rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; background: #f8fafc; }
.compare > summary { cursor: pointer; font-weight: 700; }
.compare[open] > summary { margin-bottom: .5rem; }
.compare-rows { display: flex; flex-direction: column; gap: .7rem; margin: .6rem 0; }
.compare-row { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; background: var(--panel); }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.compare-tag { font-weight: 700; font-size: .9rem; }
.compare-del { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: .95rem; padding: .1rem .35rem; line-height: 1; }
.compare-del:hover { color: #b91c1c; }
.compare-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.compare-actions .btn-primary, .compare-actions .btn-secondary { width: auto; margin: 0; }
.compare-out { margin-top: .8rem; min-width: 0; }
.cmp-cards { display: grid; gap: .6rem; min-width: 0; }
.cmp-card { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; background: var(--panel); min-width: 0; }
.cmp-card.cmp-best { border-color: var(--brand); background: #fff7e6; }
.cmp-card-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; flex-wrap: wrap; }
.cmp-tag { font-weight: 700; font-size: .92rem; }
.cmp-badge { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; background: var(--brand); color: #3a2400; border-radius: 999px; padding: .14rem .5rem; white-space: nowrap; }
.cmp-lines { display: grid; gap: .1rem; }
.cmp-lines > div { display: flex; justify-content: space-between; gap: .7rem; font-size: .84rem; padding: .18rem 0; border-bottom: 1px dotted var(--line); }
.cmp-lines > div:last-child { border-bottom: 0; }
.cmp-lines span { color: var(--muted); }
.cmp-lines strong { text-align: right; white-space: nowrap; }
@media (min-width: 720px) { .cmp-cards { grid-template-columns: 1fr 1fr; } }
#cmpLeadBtn { width: auto; margin-top: .6rem; }

/* --- Financiación (cuota orientativa) --- */
.finance { margin-top: 1.1rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; background: #f8fafc; }
.finance > summary { cursor: pointer; font-weight: 700; }
.finance[open] > summary { margin-bottom: .5rem; }
.fin-inputs { display: grid; gap: .6rem; grid-template-columns: 1fr; margin: .4rem 0; }
@media (min-width: 560px) { .fin-inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fin-out { margin-top: .8rem; min-width: 0; }
.fin-cards { display: grid; gap: .6rem; min-width: 0; }
.fin-card { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; background: var(--panel); min-width: 0; }
.fin-lines { display: grid; gap: .1rem; }
.fin-lines > div { display: flex; justify-content: space-between; gap: .7rem; font-size: .84rem; padding: .18rem 0; border-bottom: 1px dotted var(--line); }
.fin-lines > div:last-child { border-bottom: 0; }
.fin-lines span { color: var(--muted); }
.fin-lines strong { text-align: right; white-space: nowrap; }
.fin-verdict { display: flex; flex-direction: column; gap: .45rem; }
.fin-badge { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: .16rem .55rem; align-self: flex-start; font-weight: 700; }
.fin-badge.ok { background: var(--brand); color: #3a2400; }
.fin-badge.bad { background: #fee2e2; color: #991b1b; }
.fin-verdict p { margin: 0; font-size: .86rem; }
@media (min-width: 720px) { .fin-cards { grid-template-columns: 1fr 1fr; } }

.battery { margin-top: 1.1rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; background: #f8fafc; }
.battery > summary { cursor: pointer; font-weight: 700; }
.battery[open] > summary { margin-bottom: .5rem; }
.bat-inputs { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin: .4rem 0; }
.bat-inputs .field { max-width: 230px; flex: 1 1 180px; }
.bat-inputs .btn-primary { width: auto; margin: 0; }
.bat-out { margin-top: .8rem; min-width: 0; }
.bat-wrap { overflow-x: auto; min-width: 0; margin: .3rem 0 .7rem; }
.bat-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.bat-table th { text-align: right; font-weight: 700; color: var(--muted); font-size: .72rem; padding: .3rem .4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bat-table th:first-child, .bat-table td:first-child { text-align: left; }
.bat-table td { text-align: right; padding: .34rem .4rem; border-bottom: 1px dotted var(--line); white-space: nowrap; }
.bat-table tr.bat-best td { background: #fff7e6; font-weight: 700; }
.bat-badge { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; background: var(--brand); color: #3a2400; border-radius: 999px; padding: .1rem .4rem; white-space: nowrap; }
#finLeadBtn { width: auto; }

/* --- Informe imprimible (#report): oculto en pantalla; es lo ÚNICO que sale al imprimir/PDF --- */
#report { display: none; }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  body > *:not(#report) { display: none !important; }
  #report {
    display: block !important;
    color: #111827;
    font-size: 11.5px;
    line-height: 1.45;
    text-align: left;
    max-width: 100%;
  }
  #report .rp-head { border-bottom: 3px solid #0b1f33; padding-bottom: 8px; margin-bottom: 12px; }
  #report .rp-brand { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #1f6feb; }
  #report h1 { font-size: 22px; margin: 6px 0 4px; color: #0b1f33; }
  #report .rp-meta { margin: 0; font-size: 10.5px; color: #4b5563; overflow-wrap: anywhere; }
  #report h2 { font-size: 13.5px; margin: 16px 0 6px; color: #0b1f33; border-bottom: 1px solid #d1d5db; padding-bottom: 3px; }
  #report .rp-kpis { display: flex; gap: 8px; margin: 12px 0; }
  #report .rp-kpi { flex: 1 1 0; min-width: 0; border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 9px; }
  #report .rp-kpi span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
  #report .rp-kpi strong { display: block; font-size: 14.5px; margin-top: 3px; color: #0b1f33; overflow-wrap: anywhere; }
  #report .rp-verdict { font-size: 11px; line-height: 1.45; color: #374151; margin: 8px 0 2px; border-left: 3px solid #0e7490; padding: 2px 0 2px 9px; }
  #report .rp-verdict strong { color: #0b1f33; }
  #report .rp-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 6px 0 2px; }
  #report .rp-table td, #report .rp-table th { border: 1px solid #e5e7eb; padding: 4px 7px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
  #report .rp-table td:first-child { color: #4b5563; width: 46%; }
  #report .rp-table th { background: #f3f4f6; font-size: 10px; }
  #report .rp-months td, #report .rp-months th { padding: 3px 5px; font-size: 10px; }
  #report .rp-months td:first-child, #report .rp-months th:first-child { width: 20%; }
  #report .rp-months td:nth-child(n+2), #report .rp-months th:nth-child(n+2) { text-align: right; }
  #report .rp-notes { margin: 4px 0 0; padding-left: 16px; }
  #report .rp-notes li { margin-bottom: 3px; }
  #report .rp-foot { margin-top: 18px; border-top: 2px solid #0b1f33; padding-top: 8px; }
  #report .rp-cta { font-size: 14px; font-weight: 700; margin: 0 0 3px; color: #0b1f33; }
}
