/* wind_lab — engineering UI: dark sidebar, full-height dynamic map */

* { box-sizing: border-box; margin: 0; }

:root {
  --bg: #1b2430;
  --bg2: #232e3d;
  --line: #33415380;
  --tx: #e6ebf2;
  --mut: #93a1b5;
  --acc: #4cc2ff;
  --warn: #f5a524;
  --bad: #e5484d;
}

html, body { height: 100%; }
body {
  display: flex;
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--tx);
  background: var(--bg);
  overflow: hidden;
}

/* ---------- sidebar ---------- */
#side {
  width: 320px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
#side h1 {
  font-size: 16px;
  letter-spacing: .04em;
  padding: 14px 16px 10px;
}
#side h1 span { color: var(--acc); }
.sec {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}
.sec h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  margin-bottom: 8px;
}
.row { display: flex; gap: 6px; margin-bottom: 6px; }

input[type=text], select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--tx);
  font: inherit;
}
label.f { display: block; font-size: 12px; color: var(--mut); margin-bottom: 6px; }
label.f select { margin-top: 2px; }

button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--tx);
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: var(--acc); }
button.primary { background: var(--acc); border-color: var(--acc); color: #06202e; font-weight: 600; }
button.on { background: var(--acc); border-color: var(--acc); color: #06202e; font-weight: 600; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }

/* ---------- turbine list ---------- */
#tList { flex: 1; overflow-y: auto; padding: 4px 8px; }
.empty { color: var(--mut); font-size: 13px; padding: 10px 8px; }
.trow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.trow:hover { background: var(--bg2); }
.tnum {
  min-width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--acc); color: #06202e;
  border-radius: 50%;
  font-weight: 700; font-size: 12px;
}
.tinfo { flex: 1; font-size: 13px; }
.mut { color: var(--mut); font-size: 12px; }
.warn { color: var(--warn); }
.bad { color: var(--bad); font-weight: 600; }
.x {
  border: none; background: none; color: var(--mut);
  font-size: 16px; line-height: 1; padding: 2px 6px;
}
.x:hover { color: var(--bad); }

.chk {
  display: flex; gap: 7px; align-items: center;
  font-size: 13px; color: var(--mut);
  cursor: pointer;
  margin-top: 2px;
}
.chk input { accent-color: var(--acc); }

/* ---------- wind data (W1) ---------- */
.wrow {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  font-size: 13px;
}
.winfo { flex: 1; }
.badge {
  min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  font-weight: 700; font-size: 11px;
  cursor: help;
}
.badge.a { background: #2f9e6e; color: #06110b; }
.badge.b { background: #4cc2ff; color: #06202e; }
.badge.c { background: #93a1b5; color: #141a22; }
#windStatus { font-size: 12px; margin-top: 6px; min-height: 15px; }

#csvModal {
  position: fixed; inset: 0;
  background: #000a;
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
#csvModal .modal {
  width: 340px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
#csvModal h3 { font-size: 14px; margin-bottom: 4px; overflow-wrap: anywhere; }
#csvModal p { margin-bottom: 10px; }
#csvModal input[type=text] { margin-top: 2px; }

/* ---------- statistics panel (W2) ---------- */
#statsModal {
  position: fixed; inset: 0;
  background: #000a;
  display: flex; align-items: center; justify-content: center;
  z-index: 1500;
}
.spanel {
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.shead { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.shead h3 { font-size: 15px; flex: 1; }
.shead select { width: auto; max-width: 380px; }
.shead .x { font-size: 20px; }
.cards { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card {
  flex: 1; min-width: 120px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.card .cv { font-size: 17px; font-weight: 600; }
.card .cl { font-size: 11px; color: var(--mut); margin-top: 2px; }
.chgrid { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.chbox h4, .spanel h4 {
  font-size: 12px; color: var(--mut);
  margin: 10px 0 6px;
  text-transform: uppercase; letter-spacing: .05em;
}
.twrap { overflow-x: auto; }
.stab { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stab th, .stab td { padding: 4px 12px 4px 0; text-align: right; border-bottom: 1px solid var(--line); }
.stab th { color: var(--mut); font-weight: 600; font-size: 11px; }
.stab td:first-child, .stab th:first-child { text-align: left; }
.snote { font-size: 12px; margin-top: 12px; }

#statusBar {
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--mut);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- map ---------- */
#map { flex: 1; background: #0d141c; }
#map.crosshair { cursor: crosshair; }

.wl-marker {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--acc);
  border: 2px solid #06202e;
  border-radius: 50%;
  color: #06202e;
  font: 700 12px/1 "Segoe UI", sans-serif;
  box-shadow: 0 1px 4px #0008;
}

.wl-pop label { display: block; margin-top: 6px; font-size: 12px; color: #555; }
.wl-pop select { width: 100%; margin-top: 2px; }
.wl-pop button { margin-top: 8px; width: 100%; }
.wl-pop .mut { color: #777; font-size: 12px; }
.wl-pop .danger { background: #fff; border: 1px solid #e5484d; color: #e5484d; border-radius: 6px; padding: 5px; cursor: pointer; }
