:root {
  --bg: #f4f6fa; --panel: #fff; --line: #d8dee9; --ink: #25303f; --muted: #6b7787;
  --price: #7ec8e3; --soc: #8e44ad; --charge: rgba(46,204,113,.22); --discharge: rgba(231,76,60,.22);
  --minsoc: #e67e22; --accent: #2d6cdf;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 18px; margin: 0; }
header .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.modes { display: flex; gap: 6px; }
.mode { padding: 7px 16px; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  cursor: pointer; font-weight: 600; color: var(--muted); }
.mode.active { background: var(--accent); color: #fff; border-color: var(--accent); }
main { display: grid; grid-template-columns: 320px 1fr; gap: 16px; padding: 16px; }
@media (max-width: 1000px) { main { grid-template-columns: 1fr; } }
#form-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; height: fit-content; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; }
legend { font-weight: 700; font-size: 12px; color: var(--muted); padding: 0 6px; text-transform: uppercase; letter-spacing: .04em; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; margin-bottom: 8px; }
label.full { }
label.check { flex-direction: row; align-items: center; gap: 8px; margin: 8px 0 12px; }
input, textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fbfcfe; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
button.primary { width: 100%; padding: 10px; background: var(--accent); color: #fff; border: 0; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 14px; }
button.primary:hover { filter: brightness(1.06); }
button.ghost { width: 100%; padding: 7px; background: #eef3fc; color: var(--accent); border: 1px solid #cfe0fb; border-radius: 7px; cursor: pointer; margin-top: 4px; }
#result-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-height: 480px; }
.status { min-height: 18px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.status.error { color: #c0392b; font-weight: 600; }
.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.kpi { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 120px; }
.kpi .v { font-size: 18px; font-weight: 700; }
.kpi .v.pos { color: #1e8e4f; } .kpi .v.neg { color: #c0392b; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
#chart { width: 100%; height: 560px; }
#equity { width: 100%; height: 240px; }
.hidden { display: none !important; }
h3 { font-size: 14px; margin: 14px 0 6px; }
code { background: #eef1f6; padding: 1px 4px; border-radius: 4px; }

/* Mobile: adapt ONLY the graph zone — the rest of the page keeps the desktop
 * layout. The chart's contents are re-rendered for small screens in app.js
 * (renderCombined → mobile branch); here we only give it room to breathe. */
@media (max-width: 640px) {
  #chart { height: 64vh; min-height: 380px; }
  #equity { height: 200px; }
}
