:root {
  --bg: #f5f8fb; --surface: #fff; --surface-2: #f2f6f9; --text: #1f3346; --muted: #5a6f82; --border: #dce8ee; --input: #b9cedb;
  --accent: #1f7fb8; --accent-soft: #e3f2fb; --accent-text: #fff; --brand: #2b7d61;
  --warn-bg: #fff6e8; --warn: #c27a1f; --good: #237a55; --bad: #b3372d; --grid: #e4ecf1;
  --c-pv: #c98f00; --c-wind: #0f9fa8; --c-load: #1f7fb8; --c-imp: #5b6b7d; --c-exp: #8a63c9; --c-bad: #c8382d;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820; --surface: #16222c; --surface-2: #1c2b37; --text: #e3edf4; --muted: #9db0bf; --border: #2a3b48; --input: #3a5061;
    --accent: #5db6ea; --accent-soft: #1d3a4d; --accent-text: #08263a; --brand: #5fc79d;
    --warn-bg: #2f2615; --warn: #e8a44a; --good: #5fc79d; --bad: #f07a6f; --grid: #26343f;
    --c-pv: #f2c14e; --c-wind: #4fd6dc; --c-load: #5db6ea; --c-imp: #a9b8c6; --c-exp: #b294e8; --c-bad: #f07a6f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 18px max(20px, calc((100vw - 1120px) / 2)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
header strong { font-size: 22px; }
header span { color: var(--brand); }
header small, .note, footer, .hint { color: var(--muted); }
main { max-width: 1120px; margin: 28px auto; padding: 0 16px; }
nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
button { font: inherit; border: 1px solid var(--input); background: var(--surface); border-radius: 10px; padding: 10px 16px; color: var(--text); font-weight: 600; cursor: pointer; }
button:hover:not(:disabled):not([aria-selected=true]):not(.primary) { background: var(--accent-soft); }
button[aria-selected=true]:hover { filter: brightness(1.08); }
button[aria-selected=true], button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
button.ghost { background: transparent; }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 3px 16px #213f5010; }
h1 { font-size: 28px; margin: 0 0 14px; }
h2 { margin-top: 28px; font-size: 20px; }
h3 { margin-top: 26px; font-size: 17px; }
p, li { line-height: 1.6; }
aside { background: var(--warn-bg); border-left: 4px solid var(--warn); padding: 14px 16px; border-radius: 8px; }
.steps { list-style: none; padding: 0; counter-reset: s; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.steps li { counter-increment: s; padding: 16px 16px 16px 52px; background: var(--surface-2); border-radius: 12px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 15px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.hyp { padding-left: 20px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 8px 18px 12px; margin: 18px 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; margin: 8px 0; min-width: 0; }
label.inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; }
.hint { font-weight: 400; font-size: 13px; }
.range { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; border: 1px solid var(--input); border-radius: 9px; padding: 10px; background: var(--surface); color: var(--text); max-width: 100%; min-width: 0; }
input[type=file] { padding: 8px; }
input[type=range] { padding: 0; flex: 1 1 200px; accent-color: var(--accent); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { width: 100%; resize: vertical; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.scenario { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 14px 0 6px; }
.profileRow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stale { color: var(--warn); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpis article { padding: 14px 16px; background: var(--surface-2); border-radius: 12px; display: flex; flex-direction: column; gap: 3px; border-left: 4px solid transparent; }
.kpis article span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpis article strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpis article small { color: var(--muted); font-size: 12.5px; }
.kpis article.bad { border-left-color: var(--bad); } .kpis article.bad strong { color: var(--bad); }
.kpis article.warn { border-left-color: var(--warn); }
.kpis article.good { border-left-color: var(--good); }
.chartCtl { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-bottom: 8px; }
.chartCtl output { font-weight: 700; min-width: 11ch; }
.quick { display: flex; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin: 6px 0; }
.legend span::before { content: ""; display: inline-block; width: 18px; height: 3px; background: var(--c); vertical-align: middle; margin-right: 6px; border-radius: 2px; }
canvas { display: block; width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tableWrap { overflow-x: auto; margin: 8px 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
#variants tbody tr { cursor: pointer; }
#variants tbody tr:hover { background: var(--surface-2); }
#variants tr.current td:first-child { box-shadow: inset 3px 0 var(--accent); }
td.best { color: var(--good); font-weight: 700; }
td.status.good { color: var(--good); font-weight: 700; }
td.status.bad { color: var(--bad); font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); max-width: min(560px, calc(100vw - 32px)); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: 0 6px 24px #0004; transition: transform .25s, opacity .25s; z-index: 20; opacity: 0; visibility: hidden; }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
#toast.err { background: var(--bad); color: #fff; }
#toast.warn { background: var(--warn); color: #1d1405; }
footer { text-align: center; padding: 24px 16px; }
@media (max-width: 760px) { .kpis, .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .fields, .fields.three, .steps, .kpis { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  header { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: 12px; }
.badge.good { color: var(--good); } .badge.warn { color: var(--warn); }
.kpiTitle { margin: 18px 0 10px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpiTitle small { text-transform: none; letter-spacing: 0; font-weight: 400; }
td.status.warn { color: var(--warn); font-weight: 600; }
#variants tbody tr:focus-visible { outline-offset: -3px; }
