/* Battery Sim — clean energy aesthetic */
:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --border: #e7e6df;
  --border-strong: #d3d2c9;
  --ink: #1a1f1a;
  --ink-2: #4a5048;
  --ink-3: #80877e;
  --accent: oklch(0.62 0.13 150);
  --accent-strong: oklch(0.52 0.15 150);
  --accent-warn: oklch(0.5 0.16 60);
  --accent-soft: oklch(0.93 0.05 150);
  --accent-bg: oklch(0.97 0.025 150);
  --warn: oklch(0.7 0.15 60);
  --warn-bg: oklch(0.96 0.04 80);
  --bad: oklch(0.6 0.18 25);
  --bad-bg: oklch(0.96 0.04 25);
  --info: oklch(0.62 0.12 240);
  --info-bg: oklch(0.96 0.03 240);
  --shadow-sm: 0 1px 2px rgba(20, 30, 20, 0.04);
  --shadow-md: 0 2px 8px rgba(20, 30, 20, 0.06), 0 1px 2px rgba(20, 30, 20, 0.04);
  --shadow-lg: 0 8px 30px rgba(20, 30, 20, 0.08), 0 2px 6px rgba(20, 30, 20, 0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 22px;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-strong) 100%);
  position: relative;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px oklch(0.62 0.13 150 / 0.3);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px 8px;
  border: 1.5px solid white;
  border-radius: 3px;
}
.brand-mark::before {
  content: "";
  position: absolute;
  top: 3px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 4px;
  background: white;
  border-radius: 2px 2px 0 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
  font-size: 13.5px;
  border: 1px solid transparent;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.nav-item .step-num {
  font-family: var(--mono);
  font-size: 11px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--border);
}
.nav-item.active .step-num {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.nav-item.done .step-num {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.nav-item.disabled { opacity: 0.45; cursor: not-allowed; }

.sidebar-foot { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--border); }
.connection-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-2);
  font-family: var(--mono);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3);
}
.dot.live {
  background: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.62 0.13 150 / 0.18);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px oklch(0.62 0.13 150 / 0.18); }
  50% { box-shadow: 0 0 0 6px oklch(0.62 0.13 150 / 0.05); }
}

/* Main canvas */
.canvas {
  overflow-y: auto;
  padding: 32px 40px 80px;
}
.canvas-inner { max-width: 1180px; margin: 0 auto; }

.page-head { margin-bottom: 24px; }
.page-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page-sub {
  color: var(--ink-2);
  max-width: 640px;
  font-size: 14.5px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-tight { padding: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-weight: 600; font-size: 14px; letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.card-sub { color: var(--ink-3); font-size: 12.5px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: white;
  box-shadow: 0 1px 0 oklch(0.45 0.14 150) inset, 0 4px 10px oklch(0.52 0.15 150 / 0.25);
}
.btn-primary:hover {
  background: oklch(0.48 0.16 150);
  border-color: oklch(0.48 0.16 150);
}
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Inputs */
.input, .select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--ink);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.input.mono { font-family: var(--mono); }
.label {
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  margin-bottom: 6px; display: block;
  letter-spacing: 0.005em;
}
.label-hint { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.label-hint-accent {
  color: var(--accent-strong);
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-family: var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label {
  font-size: 11.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.stat-unit {
  font-size: 13px;
  color: var(--ink-3);
  margin-left: 4px;
  font-weight: 400;
}
.stat-delta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
}
.stat-delta.good { color: var(--accent-strong); }
.stat-delta.bad { color: var(--bad); }

.stat-tile {
  background: var(--surface-2);
  padding: 12px;
  border-radius: 8px;
}

/* Sliders */
.slider-row {
  display: grid;
  grid-template-columns: 1fr 64px;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.slider-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.slider-name { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.slider-val { font-family: var(--mono); font-size: 12px; color: var(--ink); }
input[type="range"].slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-strong);
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
input[type="range"].slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-strong);
  border: 2px solid white;
  cursor: pointer;
}

/* Sensor row */
.sensor-row {
  display: grid;
  grid-template-columns: 1fr 220px 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sensor-row:last-child { border-bottom: none; }
.sensor-id {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
}
.sensor-name { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.sensor-unit {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: right;
}

/* Battery card grid */
.battery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.bat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex; flex-direction: column;
  position: relative;
}
.bat-card:hover { border-color: var(--ink-3); box-shadow: var(--shadow-md); }
.bat-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.bat-card .check {
  position: absolute;
  top: 14px; right: 14px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid; place-items: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.12s;
}
.bat-card.selected .check { opacity: 1; }
.bat-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.bat-arch { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; }
.bat-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-bottom: 14px;
}
.bat-spec-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bat-spec-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}
.bat-price {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex; justify-content: space-between; align-items: baseline;
}
.bat-price-val {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 17px;
}
.bat-price-per {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

/* Module / upgrade row */
.module-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-top: 6px;
  font-size: 12px;
}
.module-row .module-label { font-weight: 500; }
.module-row .module-price { font-family: var(--mono); color: var(--ink-2); }

/* Tabs (in simulation page) */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.tab {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
  border: none;
  background: transparent;
  font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--accent-bg);
  color: var(--accent-strong);
}

/* Tables */
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.results th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.results td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
}
table.results tr:last-child td { border-bottom: none; }
table.results td.name {
  font-family: var(--sans);
  font-weight: 500;
}
table.results td.verdict {
  font-family: var(--sans);
  font-weight: 500;
}
.verdict-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
}
.verdict-pill.good { background: var(--accent-bg); color: var(--accent-strong); }
.verdict-pill.meh { background: var(--warn-bg); color: oklch(0.45 0.13 60); }
.verdict-pill.bad { background: var(--bad-bg); color: var(--bad); }

/* Connect screen */
.connect-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 12px;
}
.connect-fakebrowser {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.connect-fakebrowser .browser-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.browser-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.browser-url {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 10px;
  margin-left: 12px;
  color: var(--ink-2);
}
.fake-ha-content { padding: 18px; min-height: 360px; }
.fake-ha-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.fake-ha-token-row {
  font-family: var(--mono);
  font-size: 11.5px;
  background: #14181c;
  color: #b9d8a4;
  padding: 10px 12px;
  border-radius: 6px;
  word-break: break-all;
  user-select: all;
}

/* Headline insight banner */
.insight-banner {
  background: linear-gradient(135deg, oklch(0.96 0.04 150) 0%, oklch(0.93 0.06 150) 100%);
  border: 1px solid oklch(0.85 0.07 150);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 22px;
  display: flex; align-items: center; gap: 22px;
}
.insight-banner .ib-num {
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 500;
  color: var(--accent-strong);
  letter-spacing: -0.02em;
}
.insight-banner .ib-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: oklch(0.4 0.1 150);
  font-weight: 600;
}
.insight-banner .ib-detail {
  font-size: 14px;
  color: var(--ink-2);
  max-width: 560px;
  margin-top: 4px;
}

.insight-banner.warn {
  background: linear-gradient(135deg, var(--warn-bg) 0%, oklch(0.93 0.06 60) 100%);
  border-color: oklch(0.85 0.07 60);
}
.insight-banner.warn .ib-num { color: oklch(0.5 0.16 60); }
.insight-banner.warn .ib-label { color: oklch(0.4 0.13 60); }

/* Two-col layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
}
.two-col.wide-right {
  grid-template-columns: 1fr 380px;
}

/* Section heads */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-sub { color: var(--ink-3); font-size: 12.5px; }

/* Helpers */
.row { display: flex; align-items: center; gap: 10px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
}

.callout {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
}

.callout.callout-error {
  border-color: oklch(0.85 0.06 25);
  background: var(--bad-bg);
  color: var(--bad);
}

.subpanel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.help {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
}

.tax-table th,
.tax-table td {
  border: 1px solid var(--border);
  padding: 6px;
  font-size: 11px;
  text-align: left;
}

.tax-table th {
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 500;
}

.tax-table input {
  min-width: 88px;
}

/* Chart styles */
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-svg {
  width: 100%;
  display: block;
}
.legend {
  display: flex; gap: 18px; margin-top: 8px;
  font-size: 12px; color: var(--ink-2);
  flex-wrap: wrap;
}
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: #1a1f1a;
  color: white;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
  transform: translate(-50%, -110%);
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.tooltip::after {
  content: "";
  position: absolute;
  bottom: -4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px;
  background: #1a1f1a;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Footer of canvas with actions */
.page-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

/* Toggle group (tariff selector) */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
  border: none;
  background: transparent;
  font-family: inherit;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Scrollbar */
.canvas::-webkit-scrollbar { width: 10px; }
.canvas::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
.canvas::-webkit-scrollbar-track { background: transparent; }

/* Combobox (searchable entity picker) */
.combobox { position: relative; width: 100%; }
.combobox-input {
  font-family: var(--mono);
  font-size: 12.5px;
  padding-right: 56px;
}
.combobox-input:focus { box-shadow: 0 0 0 3px var(--accent-bg); }
.combobox-hint {
  position: absolute;
  right: 38px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  pointer-events: none;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(90deg, transparent, var(--surface) 12px);
  padding-left: 16px;
}
.combobox-clear {
  position: absolute;
  right: 30px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: grid; place-items: center;
  z-index: 1;
}
.combobox-clear:hover { background: var(--border-strong); color: var(--ink); }
.combobox-caret {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--ink-3);
  pointer-events: none;
}
.combobox-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}
.combobox-list { max-height: 320px; overflow-y: auto; }
.combobox-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.combobox-item:last-child { border-bottom: none; }
.combobox-item.active { background: var(--accent-bg); }
.combobox-item.selected { background: var(--accent-soft); }
.combobox-item-id {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-all;
}
.combobox-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.combobox-item-unit {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10.5px;
  color: var(--ink-2);
}
.combobox-kind {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
}
.combobox-kind.kind-energy { background: var(--accent-bg); color: var(--accent-strong); border-color: var(--accent-soft); }
.combobox-kind.kind-power { background: oklch(0.96 0.03 230); color: oklch(0.42 0.16 230); border-color: oklch(0.85 0.05 230); }
.combobox-kind.kind-price { background: var(--warn-bg); color: oklch(0.45 0.13 60); border-color: oklch(0.85 0.07 60); }
.combobox-empty {
  padding: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}
.combobox-foot {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--surface-2);
}
.combobox-list::-webkit-scrollbar { width: 8px; }
.combobox-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Info tooltip */
.infotip { position: relative; display: inline-block; }
.infotip-trigger {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: inline-grid; place-items: center;
  margin-left: 6px;
  vertical-align: middle;
  font-family: var(--sans);
  padding: 0;
  line-height: 1;
}
.infotip-trigger:hover {
  background: var(--accent-bg);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.infotip-trigger[aria-expanded="true"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.infotip-pop {
  position: absolute;
  left: 0; top: 24px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.55;
  width: 320px;
  z-index: 60;
  box-shadow: var(--shadow-lg);
  font-weight: 400;
  display: block;
  white-space: normal;
}
.infotip-pop strong { color: oklch(0.92 0.07 150); }
.infotip-pop code {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}
.infotip-pop::before {
  content: "";
  position: absolute;
  top: -5px; left: 5px;
  width: 10px; height: 10px;
  background: var(--ink);
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Sensor mapping rows (with optional live preview underneath) */
.sensor-mapping {
  display: grid;
  grid-template-columns: 1fr 240px 80px;
  column-gap: 10px;
  row-gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.sensor-mapping:last-child { border-bottom: none; }
.sensor-mapping-row {
  display: contents;
}
.sensor-preview {
  grid-column: 2 / -1;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.sensor-preview.loading,
.sensor-preview.error {
  font-size: 12px;
  color: var(--ink-3);
  font-style: italic;
}
.sensor-preview.error { color: var(--bad); border-color: oklch(0.85 0.06 25); background: var(--bad-bg); }

.sensor-preview-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sensor-preview-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11.5px;
}
.sensor-preview-numbers { color: var(--ink-3); }
.sensor-preview-numbers .mono { color: var(--ink-2); }

.pattern-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
}
.pattern-pill.quality-great {
  background: var(--accent-bg);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.pattern-pill.quality-ok {
  background: var(--warn-bg);
  color: oklch(0.45 0.13 60);
  border-color: oklch(0.85 0.07 60);
}
.pattern-pill.quality-warn {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: oklch(0.85 0.06 25);
}
.sensor-preview.quality-great .pattern-pill {
  background: var(--accent-bg);
  color: var(--accent-strong);
  border-color: var(--accent-soft);
}
.sensor-preview.quality-good .pattern-pill {
  background: var(--info-bg);
  color: oklch(0.42 0.13 240);
  border-color: oklch(0.85 0.05 240);
}
.sensor-preview.quality-ok .pattern-pill {
  background: var(--warn-bg);
  color: oklch(0.45 0.13 60);
  border-color: oklch(0.85 0.07 60);
}
.sensor-preview.quality-warn {
  background: var(--bad-bg);
  border-color: oklch(0.85 0.06 25);
}
.sensor-preview.quality-warn .pattern-pill {
  background: white;
  color: var(--bad);
  border-color: oklch(0.85 0.06 25);
}

@media (max-width: 900px) {
  .sensor-mapping {
    grid-template-columns: 1fr;
  }
  .sensor-preview { grid-column: 1; }
}

/* Data-source provenance */
.data-sources {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.data-sources-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.data-source-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
}
.data-source-label {
  color: var(--ink-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.data-src {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-block;
  align-self: flex-start;
  font-weight: 500;
}
.data-src-mapped { background: var(--accent-bg); color: var(--accent-strong); border-color: var(--accent-soft); }
.data-src-derived { background: var(--info-bg); color: oklch(0.42 0.13 240); border-color: oklch(0.85 0.05 240); }
.data-src-unmapped { background: var(--surface-2); color: var(--ink-3); border-color: var(--border-strong); }
.data-src-missing { background: var(--bad-bg); color: var(--bad); border-color: oklch(0.85 0.06 25); }

@media (max-width: 720px) {
  .data-sources-grid { grid-template-columns: repeat(2, 1fr); }
}
