:root {
  color-scheme: light;
  --bg: #eef3f4;
  --surface: #ffffff;
  --surface-soft: #f7f9f9;
  --ink: #172424;
  --muted: #647271;
  --line: #dce5e5;
  --teal: #0f8f85;
  --teal-dark: #0a665f;
  --amber: #c47b14;
  --red: #c94c42;
  --blue: #326bd9;
  --green: #218b51;
  --shadow: 0 24px 70px rgba(34, 50, 50, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
table {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #132828;
  color: #ecf7f4;
}

.brand,
.sidebar-status,
.topbar,
.panel-header,
.status-row,
.topbar-actions,
.legend {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #1fb5a7;
}

.brand-mark span {
  width: 16px;
  height: 26px;
  background: #fff;
  clip-path: polygon(55% 0, 0 54%, 42% 54%, 28% 100%, 100% 40%, 58% 40%);
}

.brand p,
.brand strong,
.sidebar-status p,
.sidebar-status strong {
  margin: 0;
}

.brand p,
.sidebar-status p {
  color: #9fc0be;
  font-size: 12px;
}

.brand strong {
  font-size: 18px;
}

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

.nav-list a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  color: #bed7d5;
  text-decoration: none;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.sidebar-status {
  gap: 12px;
  padding: 14px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #73d57f;
  box-shadow: 0 0 0 6px rgba(115, 213, 127, 0.14);
}

.main-content {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.topbar-actions {
  gap: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--teal);
}

.time-chip {
  min-width: 154px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.time-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.time-chip strong {
  font-size: 14px;
}

.hero-panel {
  position: relative;
  min-height: 260px;
  display: grid;
  grid-template-columns: 320px 1fr;
  align-items: center;
  gap: 24px;
  padding: 28px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 143, 133, 0.12), rgba(50, 107, 217, 0.06)),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(19, 40, 40, 0.05) 44px 45px),
    #ffffff;
  box-shadow: var(--shadow);
}

.meter-visual {
  display: grid;
  place-items: center;
}

.dial {
  position: relative;
  width: min(230px, 62vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.dial-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0 72%, #d7e8e7 72% 100%);
  box-shadow: inset 0 0 0 18px #fff;
}

.dial-center {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #132828;
  color: #fff;
}

.dial-center span {
  font-size: 44px;
  font-weight: 850;
}

.dial-center small {
  color: #a9cfcc;
}

.status-row {
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dff5e7;
  color: var(--green);
  font-size: 12px;
}

.status-pill.warning {
  background: #fff0d7;
  color: var(--amber);
}

.status-pill.danger {
  background: #ffe1de;
  color: var(--red);
}

.hero-copy h2 {
  margin: 16px 0 8px;
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.05;
}

.hero-copy p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

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

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kpi-card {
  min-height: 160px;
  padding: 18px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  color: #fff;
}

.kpi-icon.voltage { background: var(--teal); }
.kpi-icon.freq { background: var(--blue); }
.kpi-icon.power { background: var(--amber); }
.kpi-icon.cost { background: #6d5dd3; }

.kpi-card p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  font-size: 27px;
  line-height: 1.15;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 20px;
}

.legend {
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 22px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 99px;
}

.line-a { background: var(--teal); }
.line-b { background: var(--blue); }
.line-c { background: var(--amber); }

canvas {
  width: 100%;
  height: 320px;
  display: block;
}

.phase-list {
  display: grid;
  gap: 16px;
}

.phase-list div {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.phase-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.phase-list strong {
  font-size: 28px;
}

meter {
  width: 100%;
  height: 12px;
}

.table-panel {
  margin-bottom: 24px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

td {
  font-size: 14px;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.state-normal {
  color: var(--green);
  font-weight: 800;
}

.state-warning {
  color: var(--amber);
  font-weight: 800;
}

.state-danger {
  color: var(--red);
  font-weight: 800;
}

.error-box {
  padding: 14px;
  border: 1px solid #ffd4cd;
  border-radius: 8px;
  background: #fff2f0;
  color: #8e2f27;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 12px;
    align-items: center;
  }

  .brand div:last-child,
  .nav-list span,
  .sidebar-status div {
    display: none;
  }

  .sidebar-status {
    padding: 14px;
  }

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

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
  }

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

  .sidebar-status {
    display: none;
  }

  .main-content {
    padding: 18px;
  }

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

  .hero-panel {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    display: none;
  }
}
