:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-strong: #172330;
  --text: #15202b;
  --muted: #647384;
  --border: #d6dee6;
  --border-strong: #b7c4d0;
  --primary: #0e5f76;
  --primary-soft: #e4f2f5;
  --ok: #1d7f55;
  --ok-soft: #e6f4ee;
  --warn: #bf3f20;
  --warn-soft: #fff0eb;
  --backup: #9a6815;
  --backup-soft: #fff5dd;
  --line-off: #c8d1db;
  --shadow: 0 14px 34px rgba(25, 42, 56, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-box {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 8px;
  color: var(--text);
}

.login-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.login-box input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.login-error {
  padding: 10px 12px;
  background: var(--warn-soft);
  border: 1px solid #efb49f;
  border-radius: 8px;
  color: #7f260d;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #172330;
  color: #ffffff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: #d9e8ed;
  border-radius: 8px;
  color: #122a35;
  font-weight: 900;
}

.brand span:last-child {
  display: block;
  margin-top: 2px;
  color: #aebdca;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  padding: 11px 12px;
  border-radius: 8px;
  color: #d2dde5;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.is-active {
  background: #263747;
  color: #ffffff;
}

.main-content {
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

p {
  color: var(--muted);
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(25, 42, 56, 0.07);
  font-weight: 800;
}

.state-dot {
  width: 10px;
  height: 10px;
  background: var(--ok);
  border-radius: 50%;
}

.system-state.is-fault .state-dot,
.system-state.is-warning .state-dot {
  background: var(--warn);
}

.system-state.is-backup .state-dot {
  background: var(--backup);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}

.network-panel,
.message-card,
.logs-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.network-panel,
.logs-panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-header.compact {
  padding: 18px 18px 0;
}

.secondary-button,
.action-button,
.icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.secondary-button {
  padding: 10px 13px;
}

.secondary-button:hover,
.icon-button:hover,
.action-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.secondary-button.danger {
  border-color: #d99b9b;
  color: #9b1c1c;
}

.secondary-button.danger:hover {
  background: #fff1f1;
  border-color: #b91c1c;
  color: #b91c1c;
}

.meter-strip {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  min-width: 0;
  padding: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric-card.primary {
  background: #17313d;
  border-color: #17313d;
  color: #ffffff;
}

.metric-card span,
.status-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card.primary span,
.metric-card.primary small {
  color: #bdd0d8;
}

.metric-card strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
  line-height: 1.1;
}

.metric-card small,
.status-tile small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-tile {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 13px 14px;
  background: var(--ok-soft);
  border: 1px solid #b9dccb;
  border-left: 5px solid var(--ok);
  border-radius: 8px;
}

.status-tile strong {
  font-size: 17px;
}

.status-tile.is-offline {
  background: var(--warn-soft);
  border-color: #efb49f;
  border-left-color: var(--warn);
}

.network-diagram {
  position: relative;
  width: 100%;
  min-height: 650px;
  overflow: hidden;
  padding: 20px;
  background:
    linear-gradient(#edf2f5 1px, transparent 1px),
    linear-gradient(90deg, #edf2f5 1px, transparent 1px),
    #f9fbfc;
  background-size: 32px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.diagram-label {
  position: absolute;
  z-index: 4;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ac-label {
  left: 43%;
  top: 42px;
}

.dc-label {
  left: 28%;
  top: 494px;
}

.node,
.consumer-node {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 86px;
  padding: 13px;
  background: #ffffff;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(25, 42, 56, 0.1);
}

.node {
  width: 172px;
}

.consumer-node {
  width: 176px;
  min-height: 78px;
}

.dynamic-consumers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dynamic-consumers .consumer-node,
.dynamic-consumers .load-line {
  pointer-events: auto;
}

.distribution-canvas {
  position: relative;
  min-height: 100%;
}

.load-line.category-main {
  left: 840px;
  width: 36px;
  height: 14px;
  right: auto;
}

.distribution-block {
  position: absolute;
  left: 876px;
  z-index: 5;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  width: 292px;
  padding: 8px;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(25, 42, 56, 0.1);
  pointer-events: auto;
}

.distribution-block::before {
  content: "";
  position: absolute;
  left: 112px;
  top: 12px;
  bottom: 12px;
  width: 8px;
  border-radius: 999px;
  background:
    linear-gradient(to right,
      #b91c1c 0 2px,
      transparent 2px 3px,
      #1e5f99 3px 5px,
      transparent 5px 6px,
      #14804f 6px 8px);
  opacity: 0.9;
}

.distribution-block.is-offline,
.distribution-block:not(.is-active-load) {
  border-color: #c7d0d6;
}

.distribution-block.is-active-load {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.is-new-load {
  animation: newLoadBlink 0.85s ease-in-out infinite;
}

.distribution-header {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  padding-right: 12px;
}

.distribution-header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.distribution-header strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.1;
}

.distribution-header small {
  color: var(--muted);
  font-size: 10px;
}

.distribution-device-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-height: 132px;
  overflow-y: auto;
  padding-left: 14px;
  scrollbar-width: thin;
}

.device-row {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fbfc;
}

.device-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row.is-active-load {
  border-color: #91c7ac;
  background: #f2fbf6;
}

.dynamic-consumers.is-many {
  overflow-y: auto;
  scrollbar-width: thin;
}

.node span,
.consumer-node span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.node strong,
.consumer-node strong {
  font-size: 16px;
  line-height: 1.15;
}

.node small,
.consumer-node small {
  color: var(--muted);
  font-size: 12px;
}

.node:hover,
.consumer-node:hover {
  border-color: var(--primary);
}

.node.is-failed,
.consumer-node.is-offline {
  background: var(--warn-soft);
  border-color: var(--warn);
  animation: alertFlash 0.8s infinite;
}

.consumer-node.is-active-load {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.consumer-node.is-empty,
.load-line.is-empty {
  display: none;
}

.node.is-standby {
  background: #fffaf0;
  border-color: #d9bd7d;
}

.source {
  left: 4%;
  top: 112px;
}

.grid {
  left: 52%;
  top: 112px;
}

.transformer {
  left: 4%;
  top: 428px;
}

.battery {
  left: 29%;
  top: 428px;
}

.inverter {
  left: 52%;
  top: 428px;
}

.technik {
  right: 3%;
  top: 78px;
}

.elektrik {
  right: 3%;
  top: 214px;
}

.beleuchtung {
  right: 3%;
  top: 350px;
}

.serverraum {
  right: 3%;
  top: 486px;
}

.line,
.load-line,
.busbar {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
  background: var(--line-off);
  overflow: hidden;
}

.line::after,
.load-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.96), transparent);
  animation: flow 1.05s linear infinite;
}

.line.horizontal {
  height: 8px;
}

.line.vertical {
  width: 8px;
}

.line.active,
.load-line,
.busbar {
  background: var(--ok);
}

.line.backup {
  background: var(--backup);
}

.line.hidden {
  display: none;
}

.line.is-off,
.load-line.is-off {
  background: var(--line-off);
}

.line.is-off::after,
.load-line.is-off::after {
  background: transparent;
  animation: none;
}

[data-line="feed-grid"] {
  left: calc(4% + 172px);
  right: 48%;
  top: 154px;
  width: auto;
}

[data-line="feed-transformer"] {
  left: calc(4% + 82px);
  top: 198px;
  width: 8px;
  height: 230px;
}

[data-line="transformer-battery"] {
  left: calc(4% + 172px);
  right: 71%;
  top: 470px;
  width: auto;
}

[data-line="battery-inverter"] {
  left: calc(29% + 172px);
  right: 48%;
  top: 470px;
  width: auto;
  height: 8px;
}

[data-line="inverter-grid"] {
  left: calc(52% + 82px);
  top: 198px;
  width: 8px;
  height: 230px;
}

.busbar {
  left: 76%;
  top: 92px;
  width: 8px;
  height: 472px;
}

[data-load-line="technik"] {
  left: 76%;
  right: calc(3% + 176px);
  top: 116px;
  width: auto;
  height: 8px;
}

[data-load-line="elektrik"] {
  left: 76%;
  right: calc(3% + 176px);
  top: 252px;
  width: auto;
  height: 8px;
}

[data-load-line="beleuchtung"] {
  left: 76%;
  right: calc(3% + 176px);
  top: 388px;
  width: auto;
  height: 8px;
}

[data-load-line="serverraum"] {
  left: 76%;
  right: calc(3% + 176px);
  top: 524px;
  width: auto;
  height: 8px;
}

.message-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
}

.warning-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--warn-soft);
  border: 1px solid #efb49f;
  border-radius: 8px;
  color: #7f260d;
  animation: alertFlash 0.8s infinite;
}

.warning-banner[hidden] {
  display: none;
}

.warning-banner span {
  display: block;
}

.warning-pulse {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: var(--warn);
  border-radius: 50%;
}

.message-list,
.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.message-list {
  padding: 0 18px 18px;
}

.message-list li,
.history-list li {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.message-list li:last-child,
.history-list li:last-child {
  border-bottom: 0;
}

.message-time {
  color: var(--muted);
  font-size: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.action-button {
  min-height: 52px;
  background: var(--surface);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 32, 44, 0.28);
}

.modal::backdrop {
  background: rgba(10, 18, 25, 0.45);
}

.modal-header,
.modal-body,
.modal-actions,
.history-list {
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-body dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.modal-body div {
  display: grid;
  gap: 5px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.log-table th,
.log-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.log-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ok-soft);
  color: #136640;
}

.status-pill.info {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-pill.warning,
.status-pill.critical {
  background: var(--warn-soft);
  color: #8a2f13;
}

@keyframes flow {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes alertFlash {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(191, 63, 32, 0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(191, 63, 32, 0.16);
  }
}

@keyframes newLoadBlink {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(34, 150, 88, 0), 0 10px 22px rgba(25, 42, 56, 0.1);
    filter: saturate(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 150, 88, 0.18), 0 10px 22px rgba(25, 42, 56, 0.1);
    filter: saturate(1.25);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
  }

  .brand {
    margin-bottom: 0;
  }

  .nav-list {
    grid-auto-flow: column;
    align-items: center;
  }

  .meter-strip,
  .status-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .network-diagram {
    min-height: 760px;
  }

  .source,
  .transformer {
    left: 4%;
  }

  .battery {
    left: 4%;
    top: 542px;
  }

  .grid,
  .inverter {
    left: 38%;
  }

  .busbar {
    left: 68%;
  }

  .consumer-node {
    right: 3%;
  }

  [data-line="feed-grid"] {
    left: calc(4% + 172px);
    right: 62%;
  }

  [data-line="transformer-battery"] {
    left: calc(4% + 82px);
    top: 514px;
    width: 8px;
    height: 28px;
  }

  [data-line="battery-inverter"] {
    left: calc(4% + 172px);
    right: 62%;
    top: 584px;
  }

  [data-line="inverter-grid"] {
    left: calc(38% + 82px);
  }

  [data-load-line="technik"],
  [data-load-line="elektrik"],
  [data-load-line="beleuchtung"],
  [data-load-line="serverraum"] {
    left: 68%;
    right: calc(3% + 176px);
  }

  .message-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-content {
    padding: 18px;
  }

  .page-header,
  .panel-header,
  .sidebar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-grid {
    gap: 16px;
  }

  .meter-strip,
  .status-overview {
    grid-template-columns: 1fr;
  }
}

/* Full viewport dashboard override */
.dashboard-page {
  overflow: hidden;
}

.dashboard-page .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.dashboard-page .main-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
  padding: clamp(14px, 2vw, 24px);
}

.dashboard-page .page-header {
  margin-bottom: 14px;
}

.dashboard-page .page-header h1 {
  font-size: clamp(22px, 2.4vw, 30px);
}

.dashboard-page .page-header p:not(.eyebrow) {
  margin-bottom: 0;
}

.dashboard-page .dashboard-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.dashboard-page .network-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
  padding: clamp(14px, 1.6vw, 18px);
  overflow: hidden;
}

.dashboard-page .panel-header {
  margin-bottom: 10px;
}

.dashboard-page .panel-header p {
  margin-bottom: 0;
}

.dashboard-page .meter-strip {
  grid-template-columns: 1.1fr repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-page .metric-card {
  padding: 11px 13px;
}

.dashboard-page .metric-card strong {
  margin-top: 5px;
  font-size: clamp(18px, 2vw, 23px);
}

.dashboard-page .metric-card small,
.dashboard-page .status-tile small {
  margin-top: 4px;
}

.dashboard-page .status-overview {
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-page .status-tile {
  padding: 10px 12px;
}

.diagram-viewport {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fbfc;
}

.dashboard-page .network-diagram {
  position: absolute;
  left: 0;
  top: 0;
  width: 1180px;
  height: 540px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  transform: scale(var(--diagram-scale, 1));
  transform-origin: top left;
}

.dashboard-page .diagram-label {
  z-index: 5;
}

.dashboard-page .ac-label {
  left: 356px;
  top: 32px;
}

.dashboard-page .dc-label {
  left: 258px;
  top: 438px;
}

.phase-board {
  position: absolute;
  left: 244px;
  top: 74px;
  z-index: 6;
  display: grid;
  gap: 5px;
  width: 246px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(25, 42, 56, 0.08);
}

.phase-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.phase-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 19px;
}

.phase-row span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 18px;
  border-radius: 5px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.phase-row i {
  position: relative;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f5;
}

.phase-row i::before {
  content: "";
  position: absolute;
  inset: 3px 0;
  background-repeat: repeat-x;
  background-size: 48px 12px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12' viewBox='0 0 48 12'%3E%3Cpath d='M0 6 C6 0 12 0 18 6 S30 12 36 6 S42 0 48 6' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-repeat: repeat-x;
  mask-size: 48px 12px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12' viewBox='0 0 48 12'%3E%3Cpath d='M0 6 C6 0 12 0 18 6 S30 12 36 6 S42 0 48 6' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat-x;
  -webkit-mask-size: 48px 12px;
}

.phase-l span { background: #9b1c1c; }
.phase-n span { background: #1e5f99; }
.phase-pe span { background: #14804f; }
.phase-l i::before { background: #b91c1c; animation: sineTravel 0.22s linear infinite, phasePulse 0.44s ease-in-out infinite; }
.phase-n i::before { background: #1e5f99; animation: sineTravel 0.22s linear infinite reverse, phasePulse 0.44s ease-in-out infinite; }
.phase-pe i::before { background: linear-gradient(90deg, #14804f 0 44%, #d4a20f 44% 56%, #14804f 56%); mask-image: none; -webkit-mask-image: none; opacity: 0.85; }
.phase-board.is-offline .phase-l i::before,
.phase-board.is-offline .phase-n i::before,
.phase-board.is-offline .phase-pe i::before {
  animation: none;
  background: #b6c2cd;
  opacity: 0.65;
}

.dashboard-page .node,
.dashboard-page .consumer-node {
  width: 168px;
  min-height: 82px;
}

.dashboard-page .consumer-node {
  width: 170px;
  min-height: 76px;
}

.dashboard-page .source { left: 42px; top: 136px; }
.dashboard-page .grid { left: 525px; top: 136px; }
.dashboard-page .transformer { left: 42px; top: 376px; }
.dashboard-page .battery { left: 286px; top: 376px; }
.dashboard-page .inverter { left: 525px; top: 376px; }
.dashboard-page .technik { left: 804px; top: 86px; }
.dashboard-page .elektrik { left: 804px; top: 196px; }
.dashboard-page .beleuchtung { left: 804px; top: 306px; }
.dashboard-page .serverraum { left: 804px; top: 416px; }

.dashboard-page [data-line="feed-grid"] { left: 210px; top: 176px; width: 315px; right: auto; }
.dashboard-page [data-line="grid-bus"] { left: 693px; top: 176px; width: 147px; right: auto; }
.dashboard-page [data-line="feed-transformer"] { left: 124px; top: 218px; height: 158px; }
.dashboard-page [data-line="transformer-battery"] { left: 210px; top: 416px; width: 76px; right: auto; }
.dashboard-page [data-line="battery-inverter"] { left: 454px; top: 416px; width: 71px; right: auto; }
.dashboard-page [data-line="inverter-grid"] { left: 607px; top: 218px; height: 158px; }
.dashboard-page .busbar { left: 840px; top: 86px; height: 406px; width: 18px; }
.dashboard-page .load-line.category-main { left: 840px; width: 36px; right: auto; }
.dashboard-page .distribution-block { left: 876px; }
.dashboard-page [data-load-line="technik"] { left: 735px; top: 124px; width: 69px; right: auto; }
.dashboard-page [data-load-line="elektrik"] { left: 735px; top: 234px; width: 69px; right: auto; }
.dashboard-page [data-load-line="beleuchtung"] { left: 735px; top: 344px; width: 69px; right: auto; }
.dashboard-page [data-load-line="serverraum"] { left: 735px; top: 454px; width: 69px; right: auto; }

.dashboard-page .message-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  grid-template-columns: auto auto;
  width: auto;
  gap: 10px;
  pointer-events: none;
}

.dashboard-page .message-panel > * {
  pointer-events: auto;
}

.dashboard-page .warning-banner {
  grid-column: 1 / -1;
}

.dashboard-page .message-card {
  width: 58px;
  height: 58px;
  box-shadow: 0 10px 24px rgba(25, 42, 56, 0.12);
}

.dashboard-page .message-card .panel-header.compact {
  display: grid;
  padding: 10px;
  margin: 0;
}

.dashboard-page .message-card .panel-header.compact div {
  display: none;
}

.dashboard-page .message-list {
  display: none;
}

.dashboard-page .action-row {
  grid-template-columns: repeat(2, 58px);
  gap: 8px;
}

.dashboard-page .action-button {
  min-height: 58px;
  box-shadow: 0 10px 24px rgba(25, 42, 56, 0.12);
}

@keyframes sineTravel {
  from { transform: translateX(0); }
  to { transform: translateX(48px); }
}

@keyframes phasePulse {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

@media (max-width: 1080px) {
  .dashboard-page .main-content {
    height: calc(100dvh - 74px);
  }

  .dashboard-page .network-panel {
    padding: 12px;
  }

  .dashboard-page .meter-strip,
  .dashboard-page .status-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-page .sidebar {
    display: none;
  }

  .dashboard-page .app-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-page .main-content {
    height: 100dvh;
    padding: 10px;
  }

  .dashboard-page .page-header {
    flex-direction: row;
    align-items: center;
  }

  .dashboard-page .page-header h1 {
    font-size: 20px;
  }

  .dashboard-page .meter-strip,
  .dashboard-page .status-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Integrated L/N/PE conductors */
.dashboard-page .phase-board {
  display: none;
}

.dashboard-page .line.horizontal,
.dashboard-page .load-line {
  height: 18px;
}

.dashboard-page .line.vertical,
.dashboard-page .busbar {
  width: 18px;
}

.dashboard-page .line.active,
.dashboard-page .load-line:not(.is-off),
.dashboard-page .busbar {
  background: transparent;
}

.dashboard-page .line.active.horizontal,
.dashboard-page .load-line:not(.is-off) {
  background:
    linear-gradient(to bottom,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.dashboard-page .line.active.vertical,
.dashboard-page .busbar {
  background:
    linear-gradient(to right,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.dashboard-page .line.active::after,
.dashboard-page .load-line:not(.is-off)::after,
.dashboard-page .busbar::after {
  display: none;
}

.dashboard-page .line.active::before,
.dashboard-page .load-line:not(.is-off)::before,
.dashboard-page .busbar::before {
  content: "L  N  PE · 50 Hz";
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  animation: phaseTextPulse 0.6s ease-in-out infinite;
}

.dashboard-page .busbar::before,
.dashboard-page .load-line::before,
.dashboard-page [data-line="feed-transformer"]::before,
.dashboard-page [data-line="transformer-battery"]::before {
  content: "";
  display: none;
}

.dashboard-page .line.active.horizontal,
.dashboard-page .line.active.vertical,
.dashboard-page .load-line:not(.is-off),
.dashboard-page .busbar {
  animation: conductorPulse 0.5s ease-in-out infinite;
}

.dashboard-page .line.is-off,
.dashboard-page .load-line.is-off,
.dashboard-page .network-diagram.is-grid-offline .line.active,
.dashboard-page .network-diagram.is-grid-offline .load-line,
.dashboard-page .network-diagram.is-grid-offline .busbar {
  background: var(--line-off);
  animation: none;
}

.dashboard-page .message-card {
  display: none;
}

.dashboard-page .message-panel {
  right: 12px;
  bottom: 12px;
}

.dashboard-page .action-row {
  grid-template-columns: repeat(2, 46px);
}

.dashboard-page .action-button {
  min-height: 46px;
  font-size: 13px;
  opacity: 0.82;
}

.dashboard-page .network-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.dashboard-page .meter-strip {
  margin-bottom: 7px;
}

.dashboard-page .status-overview {
  margin-bottom: 7px;
}

.dashboard-page .metric-card {
  padding: 8px 11px;
}

.dashboard-page .metric-card strong {
  font-size: clamp(16px, 1.6vw, 20px);
}

.dashboard-page .metric-card small {
  display: none;
}

.dashboard-page .status-tile {
  padding: 7px 10px;
}

.dashboard-page .status-tile small {
  margin-top: 2px;
}

@keyframes conductorPulse {
  0%, 100% { filter: brightness(0.86) saturate(0.95); }
  50% { filter: brightness(1.18) saturate(1.12); }
}

@keyframes phaseTextPulse {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

/* Dashboard warning is represented by header and status cards; keep diagram unobstructed. */
.dashboard-page .message-panel {
  display: none;
}

.dashboard-page .warning-banner {
  display: none !important;
}

/* Compact header and counters to give the schematic priority. */
.dashboard-page .main-content {
  padding: 12px 18px;
}

.dashboard-page .page-header {
  min-height: 42px;
  margin-bottom: 8px;
}

.dashboard-page .page-header h1 {
  font-size: 24px;
}

.dashboard-page .page-header p:not(.eyebrow) {
  display: none;
}

.dashboard-page .network-panel {
  padding: 10px 12px;
}

.dashboard-page .panel-header {
  align-items: center;
  margin-bottom: 6px;
}

.dashboard-page .panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.dashboard-page .panel-header p {
  display: none;
}

.dashboard-page .secondary-button {
  padding: 7px 10px;
}

.dashboard-page .meter-strip {
  gap: 8px;
  margin-bottom: 6px;
}

.dashboard-page .metric-card {
  position: relative;
  min-height: 54px;
  padding: 7px 10px;
}

.dashboard-page .metric-card span,
.dashboard-page .status-tile span {
  font-size: 10px;
}

.dashboard-page .metric-card strong {
  margin-top: 3px;
  font-size: 18px;
}

.dashboard-page .metric-card.primary small {
  display: block;
  margin-top: 2px;
  padding-right: 50px;
  font-size: 10px;
}

.meter-reset {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.meter-reset:hover {
  background: rgba(255, 255, 255, 0.18);
}

.dashboard-page .status-overview {
  gap: 8px;
  margin-bottom: 6px;
}

.dashboard-page .status-tile {
  min-height: 44px;
  padding: 6px 9px;
}

.dashboard-page .status-tile strong {
  font-size: 14px;
}

.dashboard-page .status-tile small {
  overflow: hidden;
  margin: 0;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page .diagram-viewport {
  min-height: 360px;
}

/* AC remains three conductors, DC is rendered as the two-pole 12V path. */
.dashboard-page [data-line="transformer-battery"].active,
.dashboard-page [data-line="battery-inverter"].backup:not(.is-off) {
  height: 14px;
  background:
    linear-gradient(to bottom,
      #c2410c 0 5px,
      transparent 5px 9px,
      #334155 9px 14px);
  animation: dcPulse 0.7s ease-in-out infinite;
}

.dashboard-page [data-line="transformer-battery"].active::before,
.dashboard-page [data-line="battery-inverter"].backup:not(.is-off)::before {
  content: "DC 12V";
  display: block;
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-page [data-line="inverter-grid"].backup:not(.is-off) {
  background:
    linear-gradient(to right,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
  animation: conductorPulse 0.5s ease-in-out infinite;
}

.dashboard-page [data-line="inverter-grid"].backup:not(.is-off)::before {
  content: "L  N  PE · 50 Hz";
  display: block;
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

@keyframes dcPulse {
  0%, 100% { filter: brightness(0.9); }
  50% { filter: brightness(1.16); }
}

/* Specificity fix: DC paths must not inherit AC L/N/PE conductor styling. */
.dashboard-page .line.horizontal.active[data-line="transformer-battery"],
.dashboard-page .line.horizontal.backup[data-line="battery-inverter"]:not(.is-off) {
  height: 14px;
  background:
    linear-gradient(to bottom,
      #c2410c 0 5px,
      transparent 5px 9px,
      #334155 9px 14px);
  animation: dcPulse 0.7s ease-in-out infinite;
}

.dashboard-page .line.horizontal.active[data-line="transformer-battery"]::before,
.dashboard-page .line.horizontal.backup[data-line="battery-inverter"]:not(.is-off)::before {
  content: "DC 12V";
  display: block;
}

/* Larger scrollable pyramid layout */
.dashboard-page {
  overflow-y: auto;
  overflow-x: hidden;
}

.dashboard-page .app-shell {
  min-height: 100dvh;
  height: auto;
  overflow: visible;
}

.dashboard-page .main-content {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
  padding: 18px 24px 28px;
}

.dashboard-page .dashboard-grid,
.dashboard-page .network-panel {
  overflow: visible;
}

.dashboard-page .network-panel {
  grid-template-rows: auto auto auto auto;
}

.dashboard-page .page-header {
  margin-bottom: 12px;
}

.dashboard-page .page-header h1 {
  font-size: 30px;
}

.censor-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(25, 42, 56, 0.07);
}

.censor-toggle.is-active {
  background: #172330;
  border-color: #172330;
  color: #ffffff;
}

.is-censored .censor-target {
  color: transparent !important;
  text-shadow: none !important;
  background: #111c27 !important;
  border-radius: 5px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  user-select: none;
}

.is-censored .metric-card.primary .censor-target {
  background: #d9e8ed !important;
}

.dashboard-page .meter-strip {
  grid-template-columns: 1.05fr repeat(3, minmax(0, 1fr));
}

.dashboard-page .metric-card {
  min-height: 64px;
  padding: 10px 12px;
}

.dashboard-page .metric-card strong {
  font-size: 23px;
}

.dashboard-page .metric-card small {
  display: block;
}

.dashboard-page .status-tile {
  min-height: 56px;
  padding: 9px 12px;
}

.dashboard-page .status-tile strong {
  font-size: 17px;
}

.dashboard-page .status-tile small {
  white-space: normal;
}

.dashboard-page .diagram-viewport {
  min-height: 620px;
}

.dashboard-page .network-diagram {
  width: 1000px;
  height: 720px;
}

.dashboard-page .ac-label { left: 416px; top: 38px; }
.dashboard-page .dc-label { left: 403px; top: 505px; }

.dashboard-page .node,
.dashboard-page .consumer-node {
  width: 178px;
  min-height: 90px;
}

.dashboard-page .source { left: 411px; top: 594px; }
.dashboard-page .grid { left: 411px; top: 92px; }
.dashboard-page .transformer { left: 108px; top: 420px; }
.dashboard-page .battery { left: 411px; top: 420px; }
.dashboard-page .inverter { left: 714px; top: 420px; }
.dashboard-page .technik { left: 720px; top: 70px; }
.dashboard-page .elektrik { left: 720px; top: 178px; }
.dashboard-page .beleuchtung { left: 720px; top: 286px; }
.dashboard-page .serverraum { left: 720px; top: 594px; }

.dashboard-page [data-line="feed-grid"] {
  left: 491px;
  top: 182px;
  width: 18px;
  height: 412px;
  right: auto;
}

.dashboard-page [data-line="grid-bus"] {
  left: 589px;
  top: 132px;
  width: 96px;
  height: 18px;
  right: auto;
}

.dashboard-page [data-line="feed-transformer"] {
  left: 286px;
  top: 636px;
  width: 125px;
  height: 18px;
}

.dashboard-page [data-line="feed-transformer"]::before {
  content: "AC 230V";
  display: block;
}

.dashboard-page [data-line="transformer-battery"] {
  left: 286px;
  top: 462px;
  width: 125px;
  height: 14px;
  right: auto;
}

.dashboard-page [data-line="battery-inverter"] {
  left: 589px;
  top: 462px;
  width: 125px;
  height: 14px;
  right: auto;
}

.dashboard-page [data-line="inverter-grid"] {
  left: 795px;
  top: 182px;
  width: 18px;
  height: 238px;
}

.dashboard-page .busbar {
  left: 685px;
  top: 86px;
  width: 18px;
  height: 596px;
}

.dashboard-page [data-load-line="technik"] { left: 685px; top: 108px; width: 35px; height: 18px; right: auto; }
.dashboard-page [data-load-line="elektrik"] { left: 685px; top: 216px; width: 35px; height: 18px; right: auto; }
.dashboard-page [data-load-line="beleuchtung"] { left: 685px; top: 324px; width: 35px; height: 18px; right: auto; }
.dashboard-page [data-load-line="serverraum"] { left: 685px; top: 632px; width: 35px; height: 18px; right: auto; }

.dashboard-page .line.active.vertical,
.dashboard-page .busbar {
  background:
    linear-gradient(to right,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.dashboard-page .line.horizontal.active[data-line="feed-transformer"] {
  background:
    linear-gradient(to bottom,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.dashboard-page .line.horizontal.active[data-line="transformer-battery"],
.dashboard-page .line.horizontal.backup[data-line="battery-inverter"]:not(.is-off) {
  background:
    linear-gradient(to bottom,
      #c2410c 0 5px,
      transparent 5px 9px,
      #334155 9px 14px);
}

.dashboard-page [data-line="feed-transformer"] {
  left: 286px;
  top: 456px;
  width: 214px;
  height: 18px;
  transform: rotate(54deg);
  transform-origin: left center;
}

/* Restore larger side-oriented schematic layout */
.dashboard-page .diagram-viewport {
  min-height: 590px;
}

.dashboard-page .network-diagram {
  width: 1180px;
  height: 620px;
}

.dashboard-page .ac-label { left: 378px; top: 40px; }
.dashboard-page .dc-label { left: 330px; top: 520px; }

.dashboard-page .node,
.dashboard-page .consumer-node {
  width: 176px;
  min-height: 88px;
}

.dashboard-page .source { left: 44px; top: 136px; }
.dashboard-page .grid { left: 522px; top: 136px; }
.dashboard-page .transformer { left: 44px; top: 430px; }
.dashboard-page .battery { left: 330px; top: 430px; }
.dashboard-page .inverter { left: 600px; top: 430px; }
.dashboard-page .technik { left: 812px; top: 88px; }
.dashboard-page .elektrik { left: 812px; top: 208px; }
.dashboard-page .beleuchtung { left: 812px; top: 328px; }
.dashboard-page .serverraum { left: 812px; top: 448px; }

.dashboard-page [data-line="feed-grid"] {
  left: 220px;
  top: 176px;
  width: 302px;
  height: 18px;
  right: auto;
  transform: none;
}

.dashboard-page [data-line="grid-bus"] {
  left: 698px;
  top: 176px;
  width: 142px;
  height: 18px;
  right: auto;
  transform: none;
}

.dashboard-page [data-line="feed-transformer"] {
  left: 124px;
  top: 224px;
  width: 18px;
  height: 206px;
  transform: none;
}

.dashboard-page [data-line="feed-transformer"]::before {
  content: "";
  display: none;
}

.dashboard-page [data-line="transformer-battery"] {
  left: 220px;
  top: 472px;
  width: 110px;
  height: 14px;
  right: auto;
  transform: none;
}

.dashboard-page [data-line="battery-inverter"] {
  left: 506px;
  top: 472px;
  width: 94px;
  height: 14px;
  right: auto;
  transform: none;
}

.dashboard-page [data-line="inverter-grid"] {
  left: 679px;
  top: 224px;
  width: 18px;
  height: 206px;
  transform: none;
}

.dashboard-page .busbar {
  left: 840px;
  top: 116px;
  width: 18px;
  height: 422px;
}

.dashboard-page .load-line.category-main { left: 840px; width: 36px; right: auto; }
.dashboard-page .distribution-block { left: 876px; }

.dashboard-page [data-load-line="technik"] { left: 786px; top: 126px; width: 26px; height: 18px; right: auto; }
.dashboard-page [data-load-line="elektrik"] { left: 786px; top: 246px; width: 26px; height: 18px; right: auto; }
.dashboard-page [data-load-line="beleuchtung"] { left: 786px; top: 366px; width: 26px; height: 18px; right: auto; }
.dashboard-page [data-load-line="serverraum"] { left: 786px; top: 486px; width: 26px; height: 18px; right: auto; }

.dashboard-page .line.active.vertical,
.dashboard-page .busbar {
  background:
    linear-gradient(to right,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.dashboard-page .line.horizontal.active[data-line="feed-grid"],
.dashboard-page .line.horizontal.active[data-line="grid-bus"],
.dashboard-page .load-line:not(.is-off) {
  background:
    linear-gradient(to bottom,
      #b91c1c 0 4px,
      transparent 4px 7px,
      #1e5f99 7px 11px,
      transparent 11px 14px,
      #14804f 14px 18px);
}

.load-intelligence {
  display: grid;
  grid-template-columns: minmax(210px, 0.95fr) minmax(260px, 1.55fr) minmax(280px, 1.2fr);
  gap: 10px;
  margin: 0 0 10px;
}

.load-summary,
.load-question,
.load-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.load-summary,
.load-question {
  min-width: 0;
  padding: 10px 12px;
}

.load-summary span,
.load-question span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.load-summary strong,
.load-question strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.15;
}

.load-summary small,
.load-question small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.load-devices {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 1px;
}

.load-chip {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  min-width: 118px;
  padding: 9px 10px;
  box-shadow: 0 8px 16px rgba(25, 42, 56, 0.05);
}

.load-chip strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}

.load-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.load-chip-action {
  justify-self: start;
  min-height: 24px;
  border: 1px solid #d6a08f;
  border-radius: 6px;
  padding: 3px 7px;
  background: #fff5f1;
  color: #8f3b25;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.load-chip-action:hover {
  border-color: #b65a3d;
}

.load-chip.muted {
  align-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.load-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-color: #c6d7e0;
  background: #f8fbfc;
}

.load-question[hidden] {
  display: none;
}

.load-actions {
  display: flex;
  gap: 6px;
}

.load-answer {
  min-width: 64px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.load-answer:hover {
  border-color: var(--primary);
  color: var(--primary);
}

@media (max-width: 1180px) {
  .load-intelligence {
    grid-template-columns: 1fr;
  }

  .load-devices {
    overflow-x: visible;
    flex-wrap: wrap;
  }
}

/* Sidebar Verbrauchsanalyse */
.dashboard-page .dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  overflow: visible;
}

.dashboard-page .message-panel {
  position: sticky;
  top: 18px;
  right: auto;
  bottom: auto;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: auto;
  pointer-events: auto;
}

.dashboard-page .message-card,
.dashboard-page .warning-banner {
  display: none !important;
}

.dashboard-page .load-intelligence {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.dashboard-page .load-summary,
.dashboard-page .load-question {
  box-shadow: 0 10px 24px rgba(25, 42, 56, 0.08);
}

.dashboard-page .load-devices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: visible;
}

.dashboard-page .load-chip {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.dashboard-page .load-question {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.dashboard-page .load-question strong {
  font-size: 15px;
}

.load-dialog {
  width: min(520px, calc(100vw - 34px));
}

.load-dialog .modal-body {
  display: grid;
  gap: 14px;
}

.correction-dialog .modal-body,
.correction-form,
.correction-measure {
  display: grid;
  gap: 10px;
}

.correction-form[hidden],
.correction-measure[hidden] {
  display: none;
}

.correction-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.correction-form input,
.correction-form select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
}

.correction-measure strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.correction-measure small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.load-dialog-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.load-answer.primary {
  background: #17313d;
  border-color: #17313d;
  color: #ffffff;
}

.load-other-form {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.load-other-form[hidden] {
  display: none;
}

.load-other-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.load-other-form select,
.load-other-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
}

@media (max-width: 1180px) {
  .dashboard-page .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-page .message-panel {
    position: static;
  }
}

.calibration-page {
  overflow-y: auto;
}

.calibration-page .app-shell {
  min-height: 100dvh;
  height: auto;
}

.calibration-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 320px;
  gap: 14px;
  align-items: start;
}

.calibration-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(25, 42, 56, 0.07);
}

.calibration-panel.live,
.calibration-panel.detected,
.calibration-panel.device-list,
.calibration-panel.inventory,
.calibration-panel.instruction,
.calibration-panel.mesh {
  display: grid;
  gap: 10px;
}

.calibration-panel.live span,
.calibration-panel.detected span,
.calibration-panel.instruction > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.calibration-panel.live strong,
.calibration-panel.detected strong,
.calibration-panel.instruction > strong {
  color: var(--text);
  font-size: 32px;
  line-height: 1;
}

.calibration-panel.live small,
.calibration-panel.detected small,
.calibration-panel.instruction > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.calibration-delta {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.calibration-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calibration-steps li {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 5px solid #c8d5dd;
  border-radius: 8px;
  background: var(--surface-soft);
}

.calibration-steps li.is-active {
  border-left-color: var(--primary);
  background: #eef6f8;
}

.calibration-steps strong {
  color: var(--text);
  font-size: 15px;
}

.calibration-steps span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.calibration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.calibration-panel.detected {
  grid-column: 1 / -1;
  grid-template-columns: minmax(220px, 0.6fr) minmax(260px, 1fr);
  border-color: #9dc7bd;
  background: #f2fbf8;
}

.calibration-panel.inventory,
.calibration-panel.mesh {
  grid-column: 1 / -1;
}

.calibration-panel.instruction {
  border-color: #a9bdd4;
  background: #f4f8fc;
}

.device-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.device-form label {
  display: none;
}

.device-form input,
.device-form select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
}

.inventory-form {
  grid-template-columns: minmax(160px, 1fr) 140px minmax(160px, 0.8fr) 180px auto;
}

.calibration-panel.device-list {
  grid-column: 1 / -1;
}

.calibrated-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calibrated-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
}

.calibrated-list li.inventory-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px minmax(160px, 0.8fr) 180px auto;
  align-items: center;
}

.inventory-item input,
.inventory-item select {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 9px;
  color: var(--text);
  font: inherit;
}

.compact-save {
  min-height: 38px;
  padding-block: 8px;
}

.inventory-item.is-saving {
  opacity: 0.72;
}

.calibrated-list strong {
  color: var(--text);
}

.calibrated-list span {
  color: var(--muted);
  font-weight: 800;
}

.mesh-graph {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 0.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 28%, rgba(78, 120, 142, 0.18) 28% 29%, transparent 29%),
    var(--surface-soft);
}

.mesh-center,
.mesh-node,
.mesh-empty {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.mesh-center {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(25, 42, 56, 0.08);
}

.mesh-center span,
.mesh-node span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.mesh-center strong,
.mesh-node strong {
  overflow-wrap: anywhere;
  color: var(--text);
}

.mesh-center small,
.mesh-node small,
.mesh-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mesh-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.mesh-node {
  position: relative;
}

.mesh-node::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -17px;
  width: 16px;
  height: 2px;
  background: #9db2bd;
}

.mesh-node[data-state="on"] {
  border-color: #87bca2;
}

.mesh-node[data-state="standby"] {
  border-color: #d0ba7a;
}

.mesh-node[data-state="disconnected"] {
  border-color: #c7cfd5;
  opacity: 0.84;
}

@media (max-width: 980px) {
  .calibration-layout,
  .calibration-panel.detected,
  .device-form,
  .inventory-form,
  .calibrated-list li.inventory-item,
  .mesh-graph {
    grid-template-columns: 1fr;
  }

  .mesh-node::before {
    display: none;
  }
}
