:root {
  --y: #fdbf00; --y-ink: #7a5c00; --y-soft: #fff6d6;
  --ink: #141517; --ink-2: #2f3136; --mute: #74777e; --mute-2: #a2a5ab;
  --line: #e7e7e4; --line-2: #f0f0ee; --bg: #f5f5f3; --card: #ffffff;
  --r: 18px; --r-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 21, 23, .04), 0 8px 28px rgba(20, 21, 23, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
h2, h3 { margin: 0; letter-spacing: -.01em; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px max(16px, env(safe-area-inset-left)); background: rgba(20, 21, 23, .96); backdrop-filter: blur(10px); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand span { display: block; font-size: 12px; color: var(--mute-2); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.source-pill { font-size: 12px; padding: 5px 10px; border-radius: 99px; background: rgba(253, 191, 0, .14); color: var(--y); white-space: nowrap; }
.source-pill.off { background: rgba(255, 255, 255, .1); color: #ddd; }
.topbar .btn.ghost { border-color: rgba(255, 255, 255, .18); color: #fff; background: transparent; }
.topbar .btn.ghost:not(:disabled):hover { background: var(--y); color: var(--ink); border-color: var(--y); }

/* ---------- Layout ---------- */
.app { max-width: 1480px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left)) 40px; }
.top-grid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(360px, .72fr); gap: 20px; align-items: start; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line-2); }

/* ---------- Escena ---------- */
.scene-card { position: sticky; top: 76px; padding: 18px 18px 14px; overflow: hidden; }
.scene-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.scene-head h2 { font-size: 19px; font-weight: 700; }
.scene-head p { margin: 2px 0 0; color: var(--mute); font-size: 13px; }
.scene-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.badge { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.y { background: var(--y); color: var(--ink); }
.scene-host { margin: 6px -6px 0; }
.scene-svg { width: 100%; height: auto; max-height: 58vh; }
.scene-svg .pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; transform-box: fill-box; transform-origin: center; }
@keyframes pop { from { opacity: 0; transform: translateY(-14px) scale(.85); } to { opacity: 1; transform: none; } }
.scene-svg .flow { stroke-dasharray: 5 9; animation: flow 1.5s linear infinite; }
.scene-svg .flow.rev { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.scene-svg .chip text { pointer-events: none; }
.scene-svg #sunG, .scene-svg #moonG { transition: transform .35s ease, opacity .4s; }
@media (prefers-reduced-motion: reduce) { .scene-svg .flow { animation: none; } .scene-svg .pop { animation: none; } }

.timebar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 4px; background: var(--bg); border-radius: 14px; }
.timebar-main { flex: 1; min-width: 0; }
.timebar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); margin-bottom: 2px; }
.timebar-label span:first-child { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend .muted { color: var(--mute); margin-left: auto; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.y { background: var(--y); } .dot.k { background: var(--ink); }

/* ---------- Controles ---------- */
input[type=range] { width: 100%; height: 26px; background: transparent; -webkit-appearance: none; appearance: none; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--ink) var(--p, 50%), #dcdcd8 var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #dcdcd8; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--y); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--y); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

.icon-btn { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: .15s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.y { background: var(--y); border-color: var(--y); }
.icon-btn.y:hover { background: #ffcd2e; }
.icon-btn.playing { background: var(--ink); color: var(--y); border-color: var(--ink); }

.mini-select, select { height: 38px; padding: 0 30px 0 12px; border-radius: 11px; border: 1px solid var(--line); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%2374777e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; -webkit-appearance: none; appearance: none; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn.primary { background: var(--y); border-color: var(--y); color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: #ffcb26; box-shadow: 0 6px 18px rgba(253, 191, 0, .35); }
.btn .spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(20, 21, 23, .25); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.btn.loading .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { border: 0; background: none; padding: 4px 0 0; color: var(--y-ink); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }

/* ---------- Configuración ---------- */
.config-card { padding: 6px 18px 0; }
.sec { border-bottom: 1px solid var(--line-2); padding: 4px 0 14px; }
.sec summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; padding: 12px 0 10px; font-weight: 700; font-size: 15px; user-select: none; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--mute-2); border-bottom: 2px solid var(--mute-2); transform: rotate(45deg); transition: .2s; }
.sec[open] summary::after { transform: rotate(-135deg); }
.sec summary .switch { margin-left: auto; margin-right: 12px; }
.sec summary:has(.switch)::after { margin-left: 0; }
.num { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--ink); color: var(--y); font-size: 12px; font-weight: 700; }
.sub-h { margin: 14px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.grid3:first-child { margin-top: 0; }
.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 11.5px; color: var(--mute); font-weight: 400; margin: 0; }
.field input[type=text], .field input[type=number], .unit, .field select { width: 100%; }
input[type=text], input[type=number] { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
input[type=text]:focus, input[type=number]:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(253, 191, 0, .3); outline: none; }
.unit { display: flex; align-items: center; position: relative; }
.unit input { padding-right: 54px; }
.unit em { position: absolute; right: 12px; font-style: normal; font-size: 12px; color: var(--mute); pointer-events: none; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.readout { justify-content: flex-end; padding: 8px 12px; border-radius: var(--r-sm); background: var(--y-soft); }
.readout > span { color: var(--y-ink); }
.readout b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.readout small { font-size: 11.5px; color: var(--y-ink); }
.stepper { display: flex; height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 42px; flex: none; border: 0; background: var(--bg); font-size: 18px; font-weight: 600; cursor: pointer; }
.stepper button:hover { background: var(--y); }
.stepper input { flex: 1; min-width: 0; border: 0; border-radius: 0; text-align: center; font-weight: 700; height: 100%; }
.stepper input:focus { box-shadow: none; }

.seg { display: inline-flex; padding: 3px; background: var(--bg); border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--mute); cursor: pointer; transition: .15s; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg.wide { display: flex; } .seg.wide button { flex: 1; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row b { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.slider-row.disabled { opacity: .4; pointer-events: none; }
.orient { display: grid; grid-template-columns: 1fr 120px; gap: 16px; align-items: center; }
.orient-col { display: flex; flex-direction: column; gap: 14px; }
.compass { width: 120px; height: 120px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #d6d6d2; transition: .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: .2s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { left: 21px; background: var(--y); }
#batFields.off { opacity: .4; pointer-events: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); align-self: end; min-height: 40px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }

/* Ubicación */
.loc-wrap { position: relative; }
.loc-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 13px; padding: 4px 4px 4px 12px; transition: .15s; }
.loc-input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(253, 191, 0, .3); }
.loc-input > svg { width: 18px; height: 18px; color: var(--mute); flex: none; }
.loc-input input { flex: 1; border: 0; height: 36px; padding: 0; box-shadow: none !important; }
.loc-meta { margin-top: 8px; font-size: 12px; color: var(--mute); }
.loc-meta b { color: var(--ink); font-weight: 600; }
.suggest { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .12); overflow: hidden; max-height: 320px; overflow-y: auto; }
.loc-wrap > .suggest { top: 50px; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: #fff; padding: 11px 14px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.suggest button:hover, .suggest button.act { background: var(--y-soft); }
.suggest button.map-opt { font-weight: 600; }
.suggest button.map-opt svg { width: 18px; height: 18px; color: var(--y-ink); flex: none; }
.suggest .s-empty { padding: 12px 14px; color: var(--mute); font-size: 13px; }

/* Perfil de consumo */
.profile-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; text-align: left; transition: .15s; }
.profile-btn:hover { border-color: var(--ink); }
.profile-btn .pt { flex: 1; min-width: 0; }
.profile-btn .pt b { display: block; font-size: 13.5px; }
.profile-btn .pt small { color: var(--mute); font-size: 12px; }
.spark { width: 86px; height: 30px; flex: none; }
.profile-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .12); padding: 6px; }
.profile-pop button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; }
.profile-pop button:hover, .profile-pop button.on { background: var(--y-soft); }
.profile-pop .pt b { display: block; font-size: 13px; } .profile-pop .pt small { color: var(--mute); font-size: 12px; }
.csv-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.csv-row label.btn { cursor: pointer; }

.sim-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 -18px; padding: 14px 18px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r) var(--r); }
.sim-bar .btn.primary { margin-left: auto; min-width: 128px; height: 44px; font-size: 15px; }

/* ---------- Resultados ---------- */
.results { margin-top: 20px; padding: 20px; }
.res-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.res-head h2 { font-size: 19px; font-weight: 700; }
.res-head p { margin: 2px 0 0; color: var(--mute); font-size: 13px; }
.empty { display: flex; flex-direction: column; align-items: center; padding: 34px 16px 40px; text-align: center; color: var(--mute); }
.empty svg { width: 64px; height: 64px; fill: #e2e2de; margin-bottom: 12px; }
.empty svg .y { fill: var(--y); }
.empty p { max-width: 420px; margin: 0; }
.res-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 24px; }
.kpis { display: flex; flex-direction: column; gap: 18px; }
.kgroup h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.kgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { padding: 12px 14px; border-radius: 14px; background: var(--bg); min-width: 0; }
.kpi.hero { grid-column: 1 / -1; background: var(--ink); color: #fff; padding: 16px 18px; }
.kpi.hero .v { color: var(--y); font-size: 32px; }
.kpi.hero .l, .kpi.hero .s { color: #b9bbc0; }
.kpi.y { background: var(--y-soft); }
.kpi .l { font-size: 12px; color: var(--mute); }
.kpi .v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .v small { font-size: 12px; font-weight: 600; letter-spacing: 0; margin-left: 3px; color: var(--mute); }
.kpi.hero .v small { color: #b9bbc0; }
.kpi .s { font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.bar { height: 8px; border-radius: 6px; background: #e3e3df; overflow: hidden; display: flex; margin-top: 8px; }
.bar i { display: block; height: 100%; }
.charts { min-width: 0; }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg); border-radius: 13px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--mute); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.chips { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chips button.on { background: var(--ink); color: var(--y); border-color: var(--ink); }
.chart-box { position: relative; height: 380px; margin-top: 14px; }
.chart-note { margin: 8px 0 0; font-size: 12px; color: var(--mute); }
.table-wrap { margin-top: 20px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.table-wrap summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.scroll-x { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; margin-top: 8px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 11.5px; color: var(--mute); font-weight: 600; }
tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
.foot { margin-top: 22px; text-align: center; font-size: 11.5px; color: var(--mute-2); }

/* ---------- Modal mapa ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(20, 21, 23, .55); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { display: flex; flex-direction: column; width: min(980px, 100%); height: min(760px, 100%); background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px 20px; }
.modal-head h3 { font-size: 17px; }
.map-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 16px 12px 20px; }
.map-search { position: relative; flex: 1; min-width: 200px; }
.map-search input { width: 100%; }
.map-coords { display: flex; gap: 8px; flex: 1; min-width: 200px; }
.map-coords input { flex: 1; width: 0; }
.map { flex: 1; min-height: 240px; background: #eee; }
.map .tiles-mono { filter: grayscale(1) contrast(.92) brightness(1.04); }
.map .leaflet-control-layers { border-radius: 12px; border: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 12px 20px; border-top: 1px solid var(--line-2); }
.map-pick { font-size: 13px; color: var(--mute); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.map-pick b { color: var(--ink); }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; background: var(--y); border: 3px solid var(--ink); transform: rotate(-45deg); box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; max-width: calc(100% - 32px); padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: fade .2s; }
.toast b { color: var(--y); }

/* ---------- Idioma y modo didáctico ---------- */
.lang-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, .08); }
.lang-seg button { border: 0; background: none; color: #bfc1c6; font-size: 12px; font-weight: 700; padding: 6px 9px; border-radius: 8px; cursor: pointer; }
.lang-seg button.on { background: var(--y); color: var(--ink); }
.topbar .didactic-btn[aria-pressed=true] { background: var(--y); color: var(--ink); border-color: var(--y); }
.help { display: none; width: 18px; height: 18px; margin-left: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--y); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; cursor: pointer; vertical-align: 1px; flex: none; }
.help:hover { transform: scale(1.12); }
body.didactic .help { display: inline-block; }
.kpi.hero .help { background: var(--y); color: var(--ink); }
.kpi .l { display: flex; align-items: center; }
.help-pop { position: fixed; z-index: 300; width: min(340px, calc(100vw - 24px)); padding: 16px 18px; background: #fff; border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .22); border: 1px solid var(--line); animation: fade .15s; }
.help-pop h4 { margin: 0 24px 6px 0; font-size: 15px; }
.help-pop p { margin: 0; color: var(--ink-2); font-size: 13px; }
.help-f { margin-top: 10px; padding: 9px 11px; border-radius: 10px; background: var(--y-soft); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.help-f:empty { display: none; }
.help-f small { display: block; color: var(--y-ink); font-weight: 600; margin-bottom: 2px; }
.help-pop .btn { margin-top: 12px; text-decoration: none; }
.help-x { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border: 0; background: none; font-size: 20px; color: var(--mute); cursor: pointer; }

/* ---------- Importar consumo ---------- */
.drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border: 1.5px dashed #cfcfca; border-radius: 14px; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--ink); background: var(--y-soft); }
.drop > svg { width: 22px; height: 22px; color: var(--y-ink); flex: none; }
.drop-t { flex: 1; min-width: 180px; }
.drop-t b { display: block; font-size: 13.5px; }
.drop-t small { color: var(--mute); font-size: 12px; }
.drop .link { padding: 0; }
.import-ok { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 9px 12px; border-radius: 11px; background: var(--y-soft); font-size: 12.5px; }
.import-ok .link { padding: 0; }

/* ---------- Comparador ---------- */
.res-head.wrap { flex-wrap: wrap; align-items: flex-start; }
.res-head.wrap > div:first-child { flex: 1 1 320px; }
.cmp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-mini { margin: 0; padding: 20px; text-align: center; color: var(--mute); background: var(--bg); border-radius: 14px; }
.cmp-table th, .cmp-table td { text-align: right; }
.cmp-table thead th { vertical-align: bottom; min-width: 160px; }
.cmp-table thead th:first-child { min-width: 130px; }
.cmp-name input { border-color: transparent; background: transparent; }
.cmp-name input:hover { border-color: var(--line); }
.cmp-table tbody th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 500; }
.cmp-name { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.cmp-name input { height: 32px; width: 100%; min-width: 0; text-align: right; font-weight: 700; font-size: 13px; color: var(--ink); padding: 0 6px; }
.cmp-name .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cmp-x { width: 26px; height: 26px; flex: none; border: 0; background: none; color: var(--mute-2); font-size: 18px; cursor: pointer; border-radius: 8px; }
.cmp-x:hover { background: var(--bg); color: var(--ink); }
.cmp-table td.best { font-weight: 800; }
.cmp-table td.best::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--y); vertical-align: 1px; }
.cmp-chart { margin-top: 18px; }
.chart-box.short { height: 300px; margin-top: 4px; }

/* ---------- Modal informe ---------- */
.form-card { width: min(640px, 100%); height: auto; max-height: min(860px, 100%); }
.modal-body { padding: 0 20px 16px; overflow-y: auto; }
.modal-body .sub-h:first-child { margin-top: 0; }
.modal-body .hint { margin: -4px 0 12px; }
.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.logo-box { display: grid; place-items: center; width: 150px; height: 70px; border-radius: 12px; border: 1.5px dashed #cfcfca; color: var(--mute-2); font-size: 12px; overflow: hidden; background: #fff; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.logo-btns label { cursor: pointer; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; resize: vertical; outline: none; }
textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(253, 191, 0, .3); }
.checks { display: flex; flex-direction: column; gap: 2px; }
.checks .check { min-height: 32px; }

/* ---------- Cuenta y planes ---------- */
.acc-btn { gap: 6px; padding: 0 8px 0 6px; }
.acc-btn:not(:has(.acc-av)) { padding: 0 14px; }
.acc-av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--y); color: var(--ink); font-weight: 800; font-size: 13px; }
.plan-badge { font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, .14); }
.plan-badge.pro { background: var(--y); color: var(--ink); }
.acc-card { width: min(520px, 100%); }
.acc-p { margin: 0 0 12px; color: var(--ink-2); }
.acc-form { display: flex; gap: 8px; }
.acc-input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; outline: none; }
.acc-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(253, 191, 0, .3); }
.acc-input.code { font-size: 20px; font-weight: 700; letter-spacing: .3em; text-align: center; }
.acc-form .btn { height: 42px; }
.modal-body .hint.acc-gap { margin: 8px 0 4px; }
.acc-reason { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--y-soft); color: var(--ink-2); font-size: 13.5px; }
.acc-who { font-size: 13px; color: var(--mute); margin-bottom: 8px; }
.acc-plan { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--bg); }
.acc-plan b { font-size: 16px; }
.acc-plan span { font-size: 13px; color: var(--ink-2); }
.acc-plan.pro { background: var(--ink); color: #fff; }
.acc-plan.pro b { color: var(--y); }
.acc-plan.pro span { color: #d6d7da; }
.acc-plan.pro .link { color: var(--y); align-self: flex-start; margin-top: 4px; }
.usage { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 6px; }
.usage i { display: block; height: 100%; background: var(--y); }
.acc-feats { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13.5px; }
.acc-feats li::before { content: "✓"; color: var(--y-ink); font-weight: 800; margin-right: 8px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font: inherit; text-align: left; cursor: pointer; transition: .15s; }
.plan-opt:hover:not(:disabled) { border-color: var(--ink); }
.plan-opt:disabled { opacity: .45; cursor: not-allowed; }
.plan-opt.best { border-color: var(--y); background: var(--y-soft); }
.plan-opt span { font-size: 12.5px; font-weight: 600; color: var(--mute); }
.plan-opt b { font-size: 22px; font-weight: 800; }
.plan-opt small { font-size: 12px; color: var(--mute); }
.plan-opt em { position: absolute; top: -9px; right: 10px; font-style: normal; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--ink); color: var(--y); }
.acc-foot { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .top-grid { grid-template-columns: 1fr; }
  .scene-card { position: relative; top: 0; }
  .scene-svg { max-height: none; }
  .res-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .app { padding-top: 12px; }
  .top-grid { gap: 12px; }
  .brand span { display: none; }
  .top-actions .btn span { display: none; }
  .top-actions { gap: 6px; }
  .help-pop { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
  .cmp-actions .btn { flex: 1 1 auto; }
  .top-actions .btn { width: 40px; padding: 0; }
  .top-actions .acc-btn { width: auto; padding: 0 6px; }
  .top-actions .acc-btn span { display: inline; }
  .top-actions .acc-btn .acc-av { display: inline-grid; }
  .acc-form { flex-direction: column; }
  .source-pill { display: none; }
  .scene-card { padding: 14px 12px 12px; }
  .scene-head { flex-direction: column; }
  .scene-badges { justify-content: flex-start; }
  .legend .muted { margin-left: 0; width: 100%; }
  .timebar { gap: 10px; padding: 8px 10px; }
  #timeMonth { display: none; }
  .timebar .mini-select { width: 108px; }
  .config-card { padding: 4px 14px 0; }
  .sim-bar { margin: 0 -14px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); position: fixed; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .08); z-index: 60; }
  .app { padding-bottom: 96px; }
  .grid2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .orient { grid-template-columns: 1fr; }
  .compass { width: 100px; height: 100px; margin: 0 auto; }
  input[type=text], input[type=number], select, .stepper, .btn { font-size: 16px; } /* evita zoom en iOS */
  .results { padding: 16px 14px; margin-top: 12px; }
  .chart-box { height: 300px; }
  .kpi .v { font-size: 19px; }
  .kpi.hero .v { font-size: 28px; }
  .modal { padding: 0; }
  .modal-card { width: 100%; height: 100%; border-radius: 0; }
  .modal-foot { flex-direction: column; align-items: stretch; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { height: 46px; }
}
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }
