/* Web Psychrometric Chart — MVP styles */
:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2230;
  --line: #2a3140;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4a9eff;
  --hl: #ff4d4d;
  /* isoline palette */
  --c-sat: #e6edf3;
  --c-rh: #4a9eff;
  --c-w: #3a4a63;
  --c-db: #2f3a4d;
  --c-wb: #35c08a;
  --c-h: #e0a54a;
  --c-v: #b06de0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--text); overflow: hidden;
}
.app { display: flex; height: 100vh; }

/* ── Panel ─────────────────────────────── */
.panel {
  width: 280px; flex: 0 0 280px; background: var(--panel);
  border-right: 1px solid var(--line); overflow-y: auto;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 18px;
}
.panel h1 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.panel h1 .h1-sub { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; letter-spacing: .3px; }

/* top bar: language + save/load */
.topbar { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.topbar #lang-sel { flex: 0 0 auto; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); font-size: 12px; padding: 5px 6px; cursor: pointer; }
.topbar #lang-sel:focus { outline: none; border-color: var(--accent); }
.mini-btn { flex: 1; padding: 6px 4px; font-size: 11px; }
.ctrl-group { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.ctrl-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

.btn {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #222b3a; color: var(--text); font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #2b3546; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
.btn.primary:hover { background: #6bb0ff; }

.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; cursor: pointer; user-select: none; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.sw { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.sw.sat { background: var(--c-sat); } .sw.rh { background: var(--c-rh); }
.sw.w { background: var(--c-w); } .sw.db { background: var(--c-db); }
.sw.wb { background: var(--c-wb); } .sw.h { background: var(--c-h); } .sw.v { background: var(--c-v); }

.field { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.field label { color: var(--muted); }
.field input { width: 90px; padding: 5px 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); font-size: 13px; text-align: right; }
.field input:focus { outline: none; border-color: var(--accent); }
.field.readonly span { color: var(--text); font-variant-numeric: tabular-nums; }
.panel-foot { margin-top: auto; font-size: 10px; color: var(--muted); text-align: center; padding-top: 8px; }

/* ── Canvas ────────────────────────────── */
.canvas { flex: 1; position: relative; background: var(--bg); }
#chart { width: 100%; height: 100%; display: block; }

.readout {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  background: rgba(22,27,34,.92); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; min-width: 190px; backdrop-filter: blur(4px);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.ro-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.ro-row { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; padding: 2px 0; }
.ro-row span { color: var(--muted); }
.ro-row b { font-weight: 600; }

/* ── SVG isolines ──────────────────────── */
.iso { fill: none; pointer-events: stroke; cursor: pointer; }
.iso.sat { stroke: var(--c-sat); stroke-width: 2; }
.iso.rh { stroke: var(--c-rh); stroke-width: 1; opacity: .75; }
.iso.w  { stroke: var(--c-w);  stroke-width: 1; }
.iso.db { stroke: var(--c-db); stroke-width: 1; }
.iso.wb { stroke: var(--c-wb); stroke-width: .9; opacity: .6; stroke-dasharray: 4 3; }
.iso.h  { stroke: var(--c-h);  stroke-width: .9; opacity: .6; stroke-dasharray: 2 3; }
.iso.v  { stroke: var(--c-v);  stroke-width: .9; opacity: .55; stroke-dasharray: 6 3; }
.iso.hl { stroke: var(--hl) !important; stroke-width: 2.5 !important; opacity: 1 !important; stroke-dasharray: none !important; }
.iso:hover { opacity: 1; }

.iso-label { font-size: 9px; fill: var(--muted); pointer-events: none; }
.iso-label.sat { fill: var(--c-sat); }
.iso-label.rh { fill: var(--c-rh); }
.iso-label.wb { fill: var(--c-wb); }
.iso-label.h { fill: var(--c-h); }
.iso-label.v { fill: var(--c-v); }

.axes .domain { stroke: var(--line); }
.axes .tick line { stroke: var(--line); }
.axes .tick text { fill: var(--muted); font-size: 11px; }
.axis-title { fill: var(--text); font-size: 12px; font-weight: 500; }

.indicator-marker circle { fill: var(--accent); stroke: #06101f; stroke-width: 1.5; }
.indicator-marker line { stroke: var(--accent); stroke-width: .6; stroke-dasharray: 3 3; opacity: .5; }

/* ── Climate data controls (M2) ────────── */
.data-info { font-size: 11px; color: var(--muted); margin: 8px 0; line-height: 1.4; }
.data-info.err { color: #ff6b6b; }
#climate-controls.collapsed { display: none; }
.sub-title { font-size: 11px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.radios { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: 12px; margin-bottom: 4px; }
.radios label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.radios input { accent-color: var(--accent); }
.field select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
  font-size: 12px; padding: 4px 6px; max-width: 130px; }
.field input.mini, .cond-val.mini { width: 46px; }
.field span { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.cond-row { display: flex; gap: 5px; margin-bottom: 6px; }
.cond-row select { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); font-size: 12px; padding: 4px; }
.cond-row .cond-op { flex: 0 0 40px; }
.cond-row input { flex: 0 0 52px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); font-size: 12px; padding: 4px; text-align: right; }

.drop-overlay { position: absolute; inset: 0; z-index: 10; display: none;
  align-items: center; justify-content: center; background: rgba(74,158,255,.12);
  border: 3px dashed var(--accent); border-radius: 12px; margin: 12px; pointer-events: none; }
.drop-overlay.active { display: flex; }
.drop-overlay div { font-size: 18px; font-weight: 600; color: var(--accent); }

/* overlay marks */
.cell { stroke: none; }
.pt { fill: var(--accent); fill-opacity: .28; }
.month-seg { fill: none; stroke: var(--c-h); stroke-width: 2; opacity: .85; }
.month-node { fill: var(--c-h); }
.month-lbl { fill: var(--text); font-size: 10px; }
.daily-outline { fill: rgba(74,158,255,.10); stroke: var(--accent); stroke-width: 1.5; }
.daily-node { stroke: #06101f; stroke-width: .5; }
.climate-legend .leg-lbl { fill: var(--muted); font-size: 10px; }

/* ── Comfort & bioclimatic (M3) ────────── */
.indent { padding-left: 6px; border-left: 2px solid var(--line); margin: 6px 0 8px 4px; }
.chk.small { font-size: 11.5px; color: var(--muted); }
.slider { margin: 8px 0; }
.slider label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.slider label b { color: var(--text); font-variant-numeric: tabular-nums; }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); }

.comfort-zone { pointer-events: none; }
.comfort-label { fill: var(--text); font-size: 10px; font-weight: 600; paint-order: stroke;
  stroke: #06101f; stroke-width: 3px; pointer-events: none; }

.comp-row { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; }
.comp-row b { color: #3ddc84; font-variant-numeric: tabular-nums; }
.comp-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.comp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3ddc84, #4ad0ff); }

/* ── Process lines, settings, export (M4) ─ */
.field.col { flex-direction: column; align-items: stretch; gap: 3px; }
.field.col label { margin-bottom: 2px; }
.field.col input { width: 100%; text-align: left; }
.btn.danger { background: #4a2226; border-color: #7a3038; }
.btn.danger:hover { background: #5c2a30; border-color: var(--hl); }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.chart-title { fill: var(--text); font-size: 16px; font-weight: 700; }
.chart-subtitle { fill: var(--muted); font-size: 12px; }

.proc-seg { stroke: #ff8c42; stroke-width: 2.2; fill: none; }
.proc-node { fill: #ff8c42; stroke: #06101f; stroke-width: 1.5; }
.proc-node:hover { fill: #ffb070; }
.proc-idx { fill: #06101f; font-size: 9px; font-weight: 700; pointer-events: none; }
.proc-label { fill: #ffb070; font-size: 10px; font-weight: 600; paint-order: stroke;
  stroke: #06101f; stroke-width: 3px; pointer-events: none; }

.popover { position: absolute; z-index: 20; width: 196px; background: rgba(22,27,34,.98);
  border: 1px solid var(--accent); border-radius: 10px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.pop-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.pop-title span { color: var(--accent); }
.popover .field { margin-bottom: 7px; }
.pop-actions { display: flex; gap: 6px; margin-top: 4px; }
.pop-actions .btn { padding: 6px; font-size: 12px; }

/* process point list */
.pt-list { margin: 10px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.pt-row { display: flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.pt-row .pt-i { color: #ff8c42; font-weight: 700; flex: 0 0 26px; }
.pt-row .pt-v { flex: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.pt-row button { flex: 0 0 auto; width: 24px; height: 22px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--line); background: #222b3a; color: var(--text); font-size: 12px; line-height: 1; padding: 0; }
.pt-row .pt-edit:hover { border-color: var(--accent); color: var(--accent); }
.pt-row .pt-del:hover { border-color: var(--hl); color: var(--hl); }
.proc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
