/* Layout: panel de consumo fijo a la izquierda, resultados en una columna a la derecha; en móvil todo apilado. */
:root {
  --bg: #eef1f3;
  --surface: #fcfcfb;
  --ink: #14202b;
  --muted: #55636f;
  --line: #d3dae0;
  --accent: #0086a8;
  --accent-strong: #006b86;
  --on-accent: #ffffff;
  --sin-solar: #b45309;
  --con-solar: #0086a8;
  --good: #1c7a4b;
  --warn: #9a5b00;
  --sun: #e8a317;
  --font-display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214;
    --surface: #1a1a19;
    --ink: #e8ecef;
    --muted: #9aa6b0;
    --line: #2e3438;
    --accent: #2597ba;
    --accent-strong: #2597ba;
    --on-accent: #0b1013;
    --sin-solar: #d4780f;
    --con-solar: #2597ba;
    --good: #52b788;
    --warn: #e0a040;
    --sun: #f0b43a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1214;
  --surface: #1a1a19;
  --ink: #e8ecef;
  --muted: #9aa6b0;
  --line: #2e3438;
  --accent: #2597ba;
  --accent-strong: #2597ba;
  --on-accent: #0b1013;
  --sin-solar: #d4780f;
  --con-solar: #2597ba;
  --good: #52b788;
  --warn: #e0a040;
  --sun: #f0b43a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 28px 56px;
}
.wrap { max-width: 1120px; margin-inline: auto; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

header.top { display: flex; align-items: center; gap: 16px; padding-bottom: 24px; }
.sun { flex: none; width: 44px; height: 44px; }
header.top h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.1; font-weight: 700; }
header.top p { color: var(--muted); margin-top: 4px; max-width: 60ch; }

.layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 880px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr); gap: 32px; }
  .panel { position: sticky; top: 16px; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px; display: grid; gap: 18px; min-width: 0; }
label, .label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: block; }
.kwh-row { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.kwh-row input { width: 100%; min-width: 0; font: 500 2rem/1.1 var(--font-display); color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--ink); padding: 2px 0 4px; border-radius: 0; font-variant-numeric: tabular-nums; }
.kwh-row span { font-family: var(--font-mono); color: var(--muted); }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 10px 0 0; }
.scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { font: 500 13px var(--font-mono); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.error { color: var(--warn); font-size: 13px; min-height: 1.2em; }

details { border-top: 1px solid var(--line); }
details > summary { cursor: pointer; padding-block: 12px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; font-family: var(--font-mono); color: var(--muted); }
details[open] > summary::after { content: "–"; }
.assump { display: grid; gap: 12px; padding-bottom: 6px; }
.assump input { width: 100%; font: 400 14px var(--font-mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 7px 8px; margin-top: 4px; }

.results { display: grid; gap: 36px; min-width: 0; }
.section { display: grid; gap: 14px; min-width: 0; }
.section > h2 { font-size: 1.25rem; font-weight: 700; }

.rec { display: grid; gap: 14px; }
.rec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.badge { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; padding: 5px 10px; border-radius: 4px; border: 1.5px solid var(--accent-strong); color: var(--accent-strong); font-weight: 500; }
.badge.hib { background: var(--accent-strong); color: var(--on-accent); }
.rec-head h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
.why { max-width: 62ch; color: var(--muted); }
.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spec { padding: 12px 16px 12px 0; min-width: 0; }
.spec b { display: block; font: 500 1.25rem var(--font-display); font-variant-numeric: tabular-nums; }
.spec small { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px 24px; }
.kpi { min-width: 0; }
.kpi .v { font: 700 1.4rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; margin-top: 4px; white-space: nowrap; }
.kpi.main .v { font-size: 1.7rem; color: var(--good); }
.kpi .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.notice { border-left: 3px solid var(--warn); padding: 6px 12px; color: var(--ink); background: var(--surface); }

.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 10px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid; }
#chart { position: relative; width: 100%; min-width: 0; touch-action: pan-y; }
#chart svg { display: block; width: 100%; overflow: visible; }
.tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 2px 10px rgba(0,0,0,0.16); white-space: nowrap; z-index: 2; }
.tip b { font-family: var(--font-mono); font-weight: 500; }
.tip .r { display: flex; justify-content: space-between; gap: 16px; }
.tip .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.chart-note { color: var(--muted); font-size: 13px; margin-top: 10px; max-width: 70ch; }
.link-btn { font: inherit; color: var(--accent-strong); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { font: 500 11.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
tfoot td { font-weight: 600; border-bottom: 0; padding-top: 12px; }
tr.total td { font-weight: 600; border-bottom: 0; }

footer.note { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; max-width: 80ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
