:root {
  color-scheme: dark;
  --bg: #0b1017;
  --bg-alt: #111823;
  --panel: #16202d;
  --panel-2: #1a2635;
  --line: #273447;
  --text: #e6edf6;
  --muted: #9cb0c7;
  --pv: #79d27f;
  --grid: #7bc7ff;
  --battery: #c68cff;
  --load: #f2b15b;
  --heat: #ff8f6b;
  --frequency: #91e0d0;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(123, 199, 255, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(121, 210, 127, 0.07), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

.app-shell {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.title-block h1 {
  margin: 4px 0 6px;
  font-size: 2rem;
  line-height: 1.05;
}

.eyebrow,
.subtitle,
.status-label,
.metric-foot,
.panel-head p,
.stat-card small {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.subtitle {
  margin: 0;
  max-width: 62ch;
}

.page-nav {
  display: inline-flex;
  gap: 8px;
  padding: 5px;
  background: rgba(16, 23, 33, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.page-link {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1;
}

.page-link:hover,
.page-link:focus-visible {
  color: var(--text);
}

.page-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.health-summary-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-alt); }
.health-summary-alert { width: 100%; margin-bottom: 0; }
.health-summary-alert[hidden] { display: none; }
.health-summary-chip { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg-alt); cursor: help; }
.health-summary-chip .health-summary-copy { display: none; }
.health-summary-chip .health-summary-icon { width: 24px; height: 24px; font-size: 14px; }
.health-summary-link { color: inherit; text-decoration: none; transition: border-color .2s, transform .2s; }
.health-summary-link:hover { transform: translateY(-1px); }
.health-summary-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; font-weight: 700; background: #586273; color: #fff; }
.health-summary-title { font-size: 1.05rem; font-weight: 700; }
.health-summary-meta, .health-target-meta { color: var(--muted); font-size: .83rem; margin-top: 3px; }
.health-status-up { border-color: #238b57; }
.health-status-up .health-summary-icon { background: #238b57; }
.health-status-degraded { border-color: #c58b25; }
.health-status-degraded .health-summary-icon { background: #c58b25; }
.health-status-down { border-color: #c54b4b; }
.health-status-down .health-summary-icon { background: #c54b4b; }
.health-status-unknown { border-color: #586273; }
.health-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 16px; color: var(--muted); }
.health-toolbar label { display: flex; align-items: center; gap: 7px; }
.health-toolbar select { color: inherit; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; }
.health-toolbar > span { margin-left: auto; font-size: .83rem; }
.health-target-list { display: grid; gap: 10px; }
.health-target-card { padding: 15px 18px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; background: var(--bg-alt); }
.health-target-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.health-target-head h2 { margin: 0; font-size: 1rem; }
.health-target-head p { margin: 4px 0 0; color: var(--muted); font-size: .83rem; }
.health-target-note { margin-top: 5px; color: var(--muted); font-size: .78rem; cursor: text; }
.health-target-note span { color: var(--text); }
.health-target-note:hover { color: var(--text); }
.health-target-head strong { white-space: nowrap; font-size: .85rem; }
.health-target-state { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.health-ack-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; white-space: nowrap; cursor: pointer; }
.health-ack-label input { accent-color: #c58b25; }
.health-ack-note { margin-top: 9px; color: #f3cb79; font-size: .8rem; }
.health-checks { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.health-check-chip { display: inline-block; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .76rem; }
.health-check-chip.health-status-up { border-color: #238b57; color: #8de0ae; }
.health-check-chip.health-status-down { border-color: #c54b4b; color: #ffadad; }
.health-check-chip.health-status-degraded { border-color: #c58b25; color: #f3cb79; }
.health-target-meta { display: flex; flex-wrap: wrap; gap: 15px; }
.health-error { margin-top: 10px; padding: 8px 10px; border-radius: 7px; background: rgba(197, 75, 75, .12); color: #ffadad; font-size: .82rem; overflow-wrap: anywhere; }
.empty-state { color: var(--muted); }
.health-note-dialog { min-width: min(460px, calc(100vw - 32px)); padding: 20px; color: var(--text); background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.health-note-dialog::backdrop { background: rgba(0, 0, 0, .58); }
.health-note-dialog h2 { margin: 0 0 8px; font-size: 1.1rem; }
.health-note-target { margin: 0 0 14px; color: var(--muted); }
.health-note-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: .83rem; }
.health-note-dialog textarea { width: 100%; box-sizing: border-box; resize: vertical; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 9px; font: inherit; }
.health-note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.status-panel {
  display: grid;
  grid-auto-flow: column;
  gap: 14px;
  background: rgba(16, 23, 33, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.status-panel > div {
  min-width: 108px;
}

.status-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.dashboard-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 8px 2px 0;
  border-top: 1px solid rgba(156, 176, 199, 0.1);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.dashboard-footer-inventory {
  margin-top: -2px;
}

.footer-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.footer-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.62rem;
  opacity: 0.9;
}

.footer-item strong {
  color: var(--text);
  font-weight: 500;
  font-size: 0.74rem;
}

.footer-item-version strong {
  font-weight: 400;
}

.footer-item-version {
  margin-left: auto;
  text-align: right;
}

.footer-note {
  flex-basis: 100%;
  color: rgba(156, 176, 199, 0.82);
  font-size: 0.68rem;
  margin-top: -2px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.stat-card,
.chart-panel {
  background: linear-gradient(180deg, rgba(28, 39, 53, 0.95), rgba(18, 26, 37, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
  min-height: 142px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #f4f7fb;
  font-size: 0.95rem;
}

.metric-trend {
  color: var(--muted);
  white-space: nowrap;
}

.metric-value {
  font-size: clamp(1.7rem, 2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.metric-foot {
  font-size: 0.8rem;
}

.metric-foot-stack {
  display: grid;
  gap: 4px;
  line-height: 1.1;
}

.metric-foot-load {
  display: grid;
  gap: 6px;
  line-height: 1.1;
}

.metric-average-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 10px;
  font-size: 0.68rem;
}

.metric-average-grid span {
  white-space: nowrap;
}

.accent-pv { box-shadow: inset 0 0 0 1px rgba(121, 210, 127, 0.2), var(--shadow); }
.accent-grid { box-shadow: inset 0 0 0 1px rgba(123, 199, 255, 0.2), var(--shadow); }
.accent-battery { box-shadow: inset 0 0 0 1px rgba(198, 140, 255, 0.2), var(--shadow); }
.accent-load { box-shadow: inset 0 0 0 1px rgba(242, 177, 91, 0.2), var(--shadow); }
.accent-heat { box-shadow: inset 0 0 0 1px rgba(255, 143, 107, 0.2), var(--shadow); }
.accent-frequency { box-shadow: inset 0 0 0 1px rgba(145, 224, 208, 0.2), var(--shadow); }
.accent-socket { box-shadow: inset 0 0 0 1px rgba(255, 202, 108, 0.22), var(--shadow); }
.accent-wassertrog { box-shadow: inset 0 0 0 1px rgba(96, 200, 215, 0.22), var(--shadow); }
.accent-mitemp { box-shadow: inset 0 0 0 1px rgba(154, 215, 201, 0.24), var(--shadow); }

.stats-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 14px 15px;
  display: grid;
  gap: 6px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  font-size: 1.4rem;
  line-height: 1.05;
}

.stat-card-voltage {
  grid-column: span 2;
}

.stat-card-voltage strong {
  font-size: 0.92rem;
  line-height: 1.12;
}

.stat-card-compact {
  gap: 4px;
}

.stat-card-compact strong {
  font-size: 0.98rem;
  line-height: 1.12;
}

.stat-card-compact.tooltip-card strong {
  font-size: 0.98rem;
}

.stat-card-compact small {
  font-size: 0.76rem;
}

.wstrog-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.wstrog-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.wstrog-state {
  font-size: 1rem;
  font-weight: 700;
  transition: color 200ms ease;
}

.wstrog-state.on { color: #79d27f; }
.wstrog-state.off { color: var(--muted); }
.wstrog-state.toggling { color: var(--muted); opacity: 0.6; }

.wstrog-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.wstrog-data {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.power-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(96, 200, 215, 0.12);
  border: 1px solid rgba(96, 200, 215, 0.25);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.power-btn:hover {
  background: rgba(96, 200, 215, 0.22);
  border-color: rgba(96, 200, 215, 0.45);
}

.power-btn:active {
  background: rgba(96, 200, 215, 0.32);
  transform: scale(0.94);
}

.power-btn.toggling {
  opacity: 0.5;
  cursor: wait;
}

.power-btn.toggling .power-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.power-icon {
  width: 18px;
  height: 18px;
}

.tooltip-card,
.stat-card-mi-temp,
.stat-card-thermal {
  position: relative;
  overflow: visible;
  cursor: help;
}

.tooltip-card:hover,
.tooltip-card:focus-within,
.stat-card-mi-temp:hover,
.stat-card-mi-temp:focus-within,
.stat-card-thermal:hover,
.stat-card-thermal:focus-within {
  z-index: 3;
}

.tooltip-card strong,
.stat-card-mi-temp strong,
.stat-card-thermal strong {
  font-size: 1.18rem;
}

.tooltip-panel,
.mi-temp-tooltip,
.thermal-tooltip {
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  min-width: 0;
  max-width: none;
  padding: 12px 14px 13px;
  border-radius: 12px;
  border-color: rgba(156, 176, 199, 0.3);
  background: linear-gradient(180deg, rgba(12, 18, 27, 0.98), rgba(8, 12, 18, 0.98));
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  line-height: 1.25;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 250ms ease, transform 250ms ease, visibility 0s linear 250ms;
}

.tooltip-panel::before,
.mi-temp-tooltip::before,
.thermal-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 22px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: inherit;
  border-left: 1px solid rgba(156, 176, 199, 0.3);
  border-top: 1px solid rgba(156, 176, 199, 0.3);
}

.tooltip-card:hover .tooltip-panel,
.tooltip-card:focus-within .tooltip-panel,
.tooltip-card:focus-visible .tooltip-panel,
.stat-card-mi-temp:hover .mi-temp-tooltip,
.stat-card-mi-temp:focus-within .mi-temp-tooltip,
.stat-card-mi-temp:focus-visible .mi-temp-tooltip,
.stat-card-thermal:hover .thermal-tooltip,
.stat-card-thermal:focus-within .thermal-tooltip,
.stat-card-thermal:focus-visible .thermal-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 250ms ease, transform 250ms ease, visibility 0s linear 0s;
}

.tooltip-card.tooltip-top .tooltip-panel {
  top: auto;
  bottom: calc(100% + 12px);
}

.tooltip-card.tooltip-top .tooltip-panel::before {
  top: auto;
  bottom: -6px;
  transform: rotate(-135deg);
}

.tooltip-foot,
.mi-temp-tooltip-foot,
.thermal-tooltip-foot {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.1;
}

.tooltip-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}

.tooltip-foot + .tooltip-foot {
  margin-top: 6px;
}

.tooltip-link:hover {
  color: var(--text);
  border-bottom-color: currentColor;
}

.tooltip-panel .chart-tooltip-title,
.mi-temp-tooltip .chart-tooltip-title,
.thermal-tooltip .chart-tooltip-title {
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tooltip-panel .chart-tooltip-row,
.mi-temp-tooltip .chart-tooltip-row,
.thermal-tooltip .chart-tooltip-row {
  margin-top: 0;
  padding-top: 6px;
  border-top: 1px solid rgba(156, 176, 199, 0.14);
}

.tooltip-panel .chart-tooltip-row:first-of-type,
.mi-temp-tooltip .chart-tooltip-row:first-of-type,
.thermal-tooltip .chart-tooltip-row:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.tooltip-panel .chart-tooltip-value,
.mi-temp-tooltip .chart-tooltip-value,
.thermal-tooltip .chart-tooltip-value {
  font-weight: 600;
  color: var(--text);
}

.voltage-stack {
  display: grid;
  gap: 0;
}

.voltage-stack span {
  display: block;
  white-space: nowrap;
}

.voltage-grid {
  display: grid;
  grid-template-columns: minmax(2.2ch, auto) minmax(0, 1fr) minmax(0, 1fr) minmax(7ch, auto);
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
}

.voltage-label,
.voltage-line,
.voltage-side {
  white-space: nowrap;
}

.voltage-label {
  color: var(--muted);
}

.voltage-line {
  text-align: left;
}

.voltage-voltage {
  color: var(--text);
}

.voltage-side {
  text-align: right;
}

.chart-grid {
  display: grid;
  gap: 14px;
}

.chart-panel {
  padding: 14px;
}

.chart-frame {
  position: relative;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.panel-head p {
  margin: 0;
  font-size: 0.85rem;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: rgba(8, 12, 17, 0.4);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.seg.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(180deg, rgba(10, 15, 22, 0.25), rgba(10, 15, 22, 0.08));
  border-radius: 8px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.legend-item:hover .legend-label,
.legend-item:focus-visible .legend-label {
  text-decoration: underline;
}

.legend-item.is-hidden {
  opacity: 0.45;
}

.legend-item.is-hidden .legend-swatch {
  filter: grayscale(1);
}

.legend-item:focus-visible {
  outline: 2px solid rgba(123, 199, 255, 0.8);
  outline-offset: 3px;
  border-radius: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 180px;
  max-width: 280px;
  background: rgba(9, 14, 21, 0.96);
  border: 1px solid rgba(156, 176, 199, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 11px;
  color: var(--text);
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.86rem;
}

.chart-tooltip-value {
  margin-left: auto;
  white-space: nowrap;
}

body[data-view="inventory"] {
  background:
    radial-gradient(circle at top left, rgba(255, 202, 108, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(123, 199, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #081018 0%, #0b111a 40%, #0b1017 100%);
}

.inventory-page .status-panel {
  grid-auto-flow: column;
}

.inventory-layout {
  gap: 14px;
}

.inventory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  background: linear-gradient(180deg, rgba(28, 39, 53, 0.96), rgba(18, 26, 37, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 15px;
  display: grid;
  gap: 6px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-card strong {
  font-size: 1.5rem;
  line-height: 1;
}

.inventory-toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 12px;
  background: rgba(16, 23, 33, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.filter-group {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.filter-group input,
.filter-group select {
  width: 100%;
  background: rgba(9, 14, 21, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: 2px solid rgba(255, 202, 108, 0.65);
  outline-offset: 1px;
}

.filter-toggle {
  align-content: start;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--text);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--load);
}

.inventory-panel {
  background: linear-gradient(180deg, rgba(28, 39, 53, 0.95), rgba(18, 26, 37, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.inventory-panel-head {
  margin-bottom: 14px;
}

.inventory-table-wrap {
  overflow: auto;
  border: 1px solid rgba(156, 176, 199, 0.16);
  border-radius: 12px;
  background: rgba(9, 14, 21, 0.8);
}

.inventory-table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(12, 18, 27, 0.98);
  color: #f4f7fb;
  text-align: left;
  padding: 12px 12px;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(156, 176, 199, 0.2);
  white-space: nowrap;
}

.inventory-table tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(156, 176, 199, 0.08);
  vertical-align: top;
  font-size: 0.84rem;
}

.inventory-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.inventory-table tbody tr[data-poll-supported="true"] {
  cursor: pointer;
}

.inventory-table tbody tr[data-poll-supported="true"]:focus-visible {
  outline: 2px solid rgba(255, 202, 108, 0.7);
  outline-offset: -2px;
}

.inventory-table tbody tr[data-poll-supported="false"] {
  cursor: default;
}

.inventory-table tbody tr.is-active td:first-child {
  box-shadow: inset 3px 0 0 rgba(121, 210, 127, 0.95);
}

.inventory-table tbody tr.is-inactive td:first-child {
  box-shadow: inset 3px 0 0 rgba(156, 176, 199, 0.3);
}

.inventory-table tbody tr.is-polling {
  background: rgba(255, 202, 108, 0.06);
}

.inventory-cell-stack {
  display: grid;
  gap: 4px;
}

.inventory-cell-stack strong {
  font-size: 0.92rem;
}

.inventory-cell-stack code {
  color: #f3d18f;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 2px 6px;
  width: fit-content;
  font-size: 0.8rem;
}

.inventory-subtle {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.inventory-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(156, 176, 199, 0.12);
  border: 1px solid rgba(156, 176, 199, 0.22);
  color: var(--text);
  font-size: 0.74rem;
  text-transform: none;
}

.inventory-chip.is-enabled,
.inventory-table tbody tr.is-active .inventory-chip {
  background: rgba(121, 210, 127, 0.12);
  border-color: rgba(121, 210, 127, 0.28);
}

.inventory-chip.is-known {
  background: rgba(123, 199, 255, 0.12);
  border-color: rgba(123, 199, 255, 0.28);
}

.inventory-chip.is-ignored,
.inventory-chip.is-deprecated {
  background: rgba(156, 176, 199, 0.08);
}

.inventory-chip.is-broken,
.inventory-chip.is-error {
  background: rgba(255, 143, 107, 0.12);
  border-color: rgba(255, 143, 107, 0.28);
}

.inventory-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 202, 108, 0.12);
  border: 1px solid rgba(255, 202, 108, 0.2);
  color: #f7d39d;
  font-size: 0.72rem;
  width: fit-content;
}

.inventory-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  color: var(--muted);
}

.inventory-empty strong {
  color: var(--text);
}

@media (max-width: 1200px) {
  .tile-grid,
  .stats-band,
  .inventory-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-nav {
    align-self: flex-start;
  }

  .status-panel {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inventory-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card-voltage {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .tile-grid,
  .stats-band,
  .status-panel,
  .inventory-summary,
  .inventory-toolbar {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .page-nav {
    width: 100%;
    justify-content: space-between;
    border-radius: 12px;
  }

  .page-link {
    flex: 1;
    text-align: center;
  }

  .segmented {
    width: 100%;
    justify-content: space-between;
    border-radius: 12px;
  }

  .seg {
    flex: 1;
    padding-inline: 8px;
  }

  .inventory-table {
    min-width: 1180px;
  }

  .stat-card-voltage {
    grid-column: span 1;
  }
}
