:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --sidebar: #f1f5f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #687381;
  --line: #e5e9ef;
  --active: #e8f1f6;
  --brand: #17495b;
  --blue: #1d73e8;
  --flow: #12d96f;
  --ok: #29b474;
  --watch: #f4b72f;
  --bad: #ec5a64;
  --cell: #eef0ff;
  --cell-line: #e2e5fb;
  --shadow: 0 8px 22px rgba(17, 24, 39, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans Thai", sans-serif;
}

button,
select {
  font: inherit;
}

.icon-sprite {
  display: none;
}

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

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 18px 10px;
}

.brand {
  padding: 0 14px 26px;
  color: var(--brand);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  color: #337a8c;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.side-nav a,
.nav-group-title {
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 15px;
  border-radius: 5px;
  color: #4c5662;
  text-decoration: none;
  line-height: 1.2;
}

.side-nav a svg,
.nav-group-title svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #62707d;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav a svg use,
.nav-group-title svg use,
.menu-button svg use {
  pointer-events: none;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--active);
  color: #111827;
}

.side-nav a:hover svg,
.side-nav a.active svg,
.nav-group-title svg {
  color: #17495b;
}

.side-nav a.active {
  font-weight: 800;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group-title {
  color: #17495b;
  font-weight: 800;
}

.nav-group a {
  padding-left: 50px;
}

.workspace {
  min-width: 0;
  background: #fff;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid #eef1f5;
  background: #fff;
  box-shadow: 0 3px 12px rgba(17, 24, 39, 0.03);
}

.menu-button {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: #202733;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.menu-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-select,
.filter-row select {
  min-width: 270px;
  height: 36px;
  border: 1px solid #d9dee7;
  border-radius: 4px;
  background: #fff;
  color: #303846;
  padding: 0 12px;
}

.top-spacer {
  flex: 1;
}

.refresh-meta {
  margin: 0;
  color: #303846;
  font-size: 13px;
  white-space: nowrap;
}

.refresh-meta.error {
  color: var(--bad);
  font-weight: 800;
}

.divider {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.language,
.admin {
  color: #303846;
  white-space: nowrap;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #74a8d7, #d4e5b7);
}

.crumb-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 24px 10px;
  background: #fff;
}

.crumb-tabs span {
  border: 1px solid #dfe4eb;
  border-radius: 4px;
  padding: 4px 9px;
  background: #fff;
  color: #596271;
  font-size: 12px;
  white-space: nowrap;
  cursor: default;
}

.crumb-tabs [data-view-link],
.side-nav [data-view-link] {
  cursor: pointer;
}

.crumb-tabs .active {
  background: #f6f8fb;
  color: #111827;
}

.sub-tabs {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--line);
}

.sub-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0 0 16px;
  color: #4b5563;
  cursor: pointer;
}

.sub-tabs button.active {
  color: #111827;
  font-weight: 800;
}

.sub-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #111827;
}

.status-pill {
  margin-left: auto;
  border-radius: 999px;
  padding: 5px 12px;
  background: #f0f3f7;
  color: #687381;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok,
.node-status.ok {
  background: #e7f8ef;
  color: #168a55;
}

.status-pill.watch,
.node-status.watch {
  background: #fff6db;
  color: #9a6a00;
}

.status-pill.bad,
.node-status.bad {
  background: #ffe9eb;
  color: #c8323f;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

#microgrid-view {
  position: relative;
}

.microgrid-head {
  position: relative;
  min-height: 98px;
  padding: 22px 24px 0;
}

.microgrid-head p {
  margin: 0;
  color: #8a939f;
}

.microgrid-head strong {
  color: #3c4652;
}

.capacity-card {
  position: absolute;
  top: 18px;
  right: 24px;
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 34px;
  padding: 14px 24px;
  border: 1px solid #edf0f4;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

.capacity-card span {
  display: block;
  margin-bottom: 6px;
  color: #8a939f;
  font-size: 12px;
}

.capacity-card strong {
  display: block;
  color: #05070a;
  font-size: 24px;
  line-height: 1;
}

.capacity-card small {
  color: #111827;
  font-size: 12px;
}

.microgrid-canvas {
  position: relative;
  min-height: 500px;
  margin: 0 24px 18px;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
}

.power-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.power-lines path {
  fill: none;
  stroke: var(--flow);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.micro-node {
  position: absolute;
  min-width: 126px;
  color: #05070a;
}

.micro-node h3 {
  margin: 6px 0 4px;
  font-size: 13px;
  line-height: 1.15;
}

.micro-node h3,
.micro-node p {
  position: relative;
  z-index: 2;
  width: max-content;
  padding-right: 5px;
  background: #fff;
}

.micro-node p {
  margin: 2px 0;
  color: #111827;
  font-size: 12px;
}

.node-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 18px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}

.node-status::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
}

.grid-node {
  left: 82px;
  top: 205px;
}

.load-node {
  left: 305px;
  top: 92px;
}

.diesel-node {
  left: 510px;
  top: 24px;
}

.pv-node {
  left: 640px;
  top: 262px;
}

.charger-node {
  left: 430px;
  top: 305px;
}

.switch-node {
  left: 280px;
  top: 272px;
  min-width: 70px;
}

.storage-node {
  right: 62px;
  top: 132px;
  min-width: 205px;
  border: 0;
  border-radius: 8px;
  padding: 8px;
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.storage-node:hover,
.storage-node:focus-visible {
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.1);
  transform: translateY(-1px);
}

.storage-node h3,
.storage-node p,
.storage-node .node-status {
  position: relative;
  z-index: 2;
}

.storage-node h3,
.storage-node p {
  width: max-content;
  padding-right: 5px;
  background: #fff;
}

.tower-art {
  position: relative;
  width: 86px;
  height: 116px;
  border-left: 4px solid #98a6b3;
  border-right: 4px solid #98a6b3;
  transform: skewX(-13deg);
}

.tower-art::before,
.tower-art::after {
  content: "";
  position: absolute;
  left: -14px;
  right: -14px;
  height: 3px;
  background: #98a6b3;
}

.tower-art::before {
  top: 28px;
  box-shadow: 0 30px 0 #98a6b3, 0 60px 0 #98a6b3;
}

.tower-art::after {
  bottom: 0;
  transform: rotate(-28deg);
  transform-origin: left center;
}

.building-art,
.device-art,
.storage-art,
.charger-art,
.pcs-device {
  position: relative;
  width: 78px;
  height: 64px;
  border-radius: 3px;
  background: linear-gradient(135deg, #eaf0f6 0%, #cfd9e5 100%);
  box-shadow: 13px 10px 0 #edf1f5;
}

.building-art::before,
.device-art::before,
.storage-art::before,
.pcs-device::before {
  content: "";
  position: absolute;
  left: 0;
  top: -22px;
  width: 78px;
  height: 29px;
  transform: skewX(-35deg);
  transform-origin: bottom left;
  background: #dfe7ef;
}

.building-art::after,
.device-art::after,
.storage-art::after,
.pcs-device::after {
  content: "";
  position: absolute;
  right: -27px;
  top: -10px;
  width: 28px;
  height: 64px;
  transform: skewY(-35deg);
  transform-origin: left top;
  background: #bac7d4;
}

.device-art.compact {
  width: 64px;
  height: 78px;
}

.device-art.compact::before {
  width: 70px;
}

.device-art.compact::after {
  height: 88px;
}

.storage-art {
  width: 132px;
  height: 62px;
  background:
    linear-gradient(90deg, rgba(131, 148, 166, 0.24) 1px, transparent 1px),
    linear-gradient(135deg, #e9f0f7 0%, #d4dee8 100%);
  background-size: 17px 100%, auto;
  box-shadow: 16px 13px 0 #eef3f7;
}

.storage-art::before {
  top: -22px;
  width: 132px;
  height: 31px;
  background: #e2eaf2;
}

.storage-art::after {
  right: -31px;
  top: -11px;
  width: 32px;
  height: 62px;
  background: #b9c7d5;
}

.storage-art .door {
  position: absolute;
}

.pv-art {
  width: 118px;
  height: 68px;
  transform: skewX(-18deg);
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, 0.4) 25%, transparent 26%),
    linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, 0.4) 25%, transparent 26%),
    linear-gradient(135deg, #4f95c8, #2770ad);
  background-size: 28px 100%, 100% 18px, auto;
  box-shadow: 15px 12px 0 #d9e2ec;
}

.charger-art {
  width: 32px;
  height: 108px;
  border-radius: 16px 16px 4px 4px;
  box-shadow: 14px 9px 0 #edf1f5;
}

.car-art {
  position: absolute;
  left: -58px;
  top: 76px;
  width: 48px;
  height: 18px;
  border-radius: 13px 18px 7px 7px;
  background: linear-gradient(135deg, #f0f4f8, #cbd5df);
  box-shadow: 7px 5px 0 #edf1f5;
  transform: rotate(-18deg);
}

.car-art::before,
.car-art::after {
  content: "";
  position: absolute;
  bottom: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa7b4;
}

.car-art::before {
  left: 8px;
}

.car-art::after {
  right: 8px;
}

.storage-detail-card {
  position: absolute;
  left: 260px;
  top: 110px;
  width: min(760px, calc(100% - 330px));
  border: 1px solid #e1e6ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
  padding: 20px 24px 22px;
  z-index: 8;
}

.storage-detail-card.is-hidden {
  display: none;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.detail-head h2 {
  margin: 0;
  font-size: 16px;
}

.detail-head button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  font-size: 18px;
}

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

.pcs-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.pcs-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.pcs-card p {
  margin: 2px 0;
  font-size: 11px;
}

.pcs-device {
  width: 48px;
  height: 70px;
  box-shadow: 9px 8px 0 #edf1f5;
}

.pcs-device::before {
  top: -15px;
  width: 48px;
  height: 22px;
}

.pcs-device::after {
  right: -20px;
  top: -8px;
  width: 21px;
  height: 70px;
}

.microgrid-stage {
  position: relative;
  min-height: 520px;
  margin: 0 24px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  background: #fff;
}

.microgrid-board {
  position: relative;
  width: 980px;
  height: 520px;
  margin: 0 auto;
}

.microgrid-svg {
  position: absolute;
  inset: 0;
  width: 980px;
  height: 520px;
}

.flow-lines path {
  fill: none;
  stroke: var(--flow);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aux-lines path {
  fill: none;
  stroke: #d9d9d9;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-main {
  marker-end: url("#flowArrow");
}

.svg-tower path {
  fill: none;
  stroke: #9aa7b4;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-building path,
.svg-pv path,
.svg-storage path,
.pv-rack path {
  fill: none;
  stroke: rgba(116, 133, 151, 0.28);
  stroke-width: 1.4;
}

.micro-label {
  position: absolute;
  z-index: 3;
  color: #05070a;
  font-size: 12px;
  line-height: 1.25;
}

.micro-label h3,
.micro-label p {
  width: max-content;
  margin: 0;
  padding-right: 5px;
  background: #fff;
}

.micro-label h3 {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 800;
}

.micro-label p {
  margin-top: 2px;
}

.grid-label {
  left: 148px;
  top: 308px;
}

.load-label {
  left: 410px;
  top: 174px;
}

.diesel-label {
  left: 620px;
  top: 84px;
}

.switch-label {
  left: 334px;
  top: 326px;
}

.charger-label {
  left: 566px;
  top: 430px;
}

.pv-label {
  left: 746px;
  top: 374px;
}

.storage-label {
  left: 790px;
  top: 170px;
  width: 190px;
  height: 230px;
  min-width: 0;
  padding: 112px 0 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.storage-label:hover,
.storage-label:focus-visible {
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.1);
  transform: translateY(-1px);
}

.storage-label .node-status {
  margin: 1px 0 3px;
}

.stat-grid,
.summary-grid,
.filter-row,
.battery-panel,
.bottom-grid {
  margin-left: 24px;
  margin-right: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.stat-card,
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 108px;
  padding: 24px;
  background: #fbfbfc;
}

.stat-card span,
.metric span {
  display: block;
  margin-bottom: 12px;
  color: #6b7280;
}

.stat-card strong {
  display: block;
  color: #05070a;
  font-size: 24px;
  line-height: 1.2;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric {
  min-height: 82px;
  padding: 15px 16px;
}

.metric strong {
  color: #202733;
  font-size: 22px;
  line-height: 1.1;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.filter-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b7280;
}

.filter-row button {
  height: 34px;
  border: 0;
  border-radius: 5px;
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
}

.view-switch {
  margin-left: auto;
  display: flex;
  border-radius: 5px;
  background: #f4f6f9;
  box-shadow: inset 0 0 0 1px #edf0f4;
  overflow: hidden;
}

.view-switch span {
  min-width: 86px;
  padding: 8px 12px;
  text-align: center;
  color: #111827;
}

.view-switch .active {
  background: #fff;
  box-shadow: 0 1px 5px rgba(17, 24, 39, 0.1);
}

.panel {
  padding: 20px 22px;
}

.battery-panel {
  margin-top: 20px;
}

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

h2,
p {
  margin: 0;
}

h2 {
  color: #05070a;
  font-size: 20px;
  line-height: 1.2;
}

.panel-title p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.panel-title > span {
  border-radius: 999px;
  background: #f5f7fa;
  color: #202733;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #6b7280;
  font-size: 12px;
}

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

.legend .ok {
  background: var(--cell);
}

.legend .watch {
  background: #ffd76a;
}

.legend .bad {
  background: #ef6770;
}

.cell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 12px;
}

.cell-tile {
  position: relative;
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--cell-line);
  border-radius: 6px;
  background: var(--cell);
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.cell-tile::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 18px;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
  background: #e8ebfb;
}

.cell-tile span {
  color: #5f6876;
  font-size: 11px;
}

.cell-tile strong {
  font-size: 12px;
}

.cell-tile.watch {
  border-color: #e7a900;
  background: #ffd76a;
}

.cell-tile.watch::before {
  background: #f0bd33;
}

.cell-tile.bad {
  border-color: #db4a55;
  background: #ef6770;
  color: #fff;
}

.cell-tile.bad::before {
  background: #df4f5b;
}

.event-panel {
  margin: 24px;
}

.pcs-overview {
  margin: 24px;
}

.pcs-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.pcs-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pcs-toolbar input[type="date"] {
  height: 34px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  color: #111827;
}

.pcs-toolbar button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #111827;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.pcs-toolbar #pcsApply,
.pcs-toolbar #pcsRefresh {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.pcs-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  height: 34px;
  background: #fff;
  color: #374151 !important;
}

.pcs-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
}

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

.pcs-metric-grid .metric strong {
  font-size: 20px;
}

.pcs-chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 4px 0 12px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}

.pcs-chart-legend i {
  display: inline-block;
  width: 22px;
  height: 3px;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: 3px;
}

.pcs-chart-legend .bms {
  background: #1d73e8;
}

.pcs-chart-legend .pcs {
  background: #12b981;
}

.pcs-chart {
  min-height: 350px;
  overflow-x: auto;
  border: 1px solid #eef1f5;
  border-radius: 8px;
  background: #fff;
}

.pcs-chart-svg {
  display: block;
  width: 100%;
  min-width: 780px;
  height: auto;
}

.pcs-chart-bg {
  fill: #ffffff;
}

.pcs-grid-line {
  stroke: #edf2f7;
  stroke-width: 1;
}

.pcs-grid-line.x {
  stroke-dasharray: 2 7;
  stroke: #f4f7fb;
}

.pcs-grid-line.x.major {
  stroke: #e8eef5;
  stroke-dasharray: 3 6;
}

.pcs-grid-line.x.minor {
  stroke: #f7f9fc;
}

.pcs-axis {
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.pcs-axis-label,
.pcs-axis-title {
  fill: #526175;
  font-size: 11px;
  font-weight: 800;
}

.pcs-line {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcs-line.bms,
.pcs-hover-target.bms .pcs-hover-focus {
  stroke: #1d73e8;
}

.pcs-line.pcs,
.pcs-hover-target.pcs .pcs-hover-focus {
  stroke: #12b981;
}

.pcs-hover-target {
  cursor: crosshair;
}

.pcs-hover-area {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.pcs-hover-focus {
  fill: #fff;
  stroke-width: 1.6;
  opacity: 0;
  pointer-events: none;
}

.pcs-hover-target:hover .pcs-hover-focus {
  opacity: 1;
}

.pcs-chart-empty {
  display: grid;
  min-height: 340px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.pcs-empty-label {
  fill: #6b7280;
  font-size: 13px;
  font-weight: 800;
}

.event-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.event-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-toolbar input {
  height: 34px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  color: #111827;
}

.event-toolbar button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #111827;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.event-toolbar > button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.event-table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.event-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 12px;
}

.event-table th,
.event-table td {
  border-bottom: 1px solid #eef1f5;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.event-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #5f6876;
  font-weight: 900;
}

.event-table tr.watch td {
  background: #fffbeb;
}

.event-table tr.bad td {
  background: #fff1f2;
}

.log-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf5ef;
  color: #15803d;
  font-size: 11px;
  font-weight: 900;
}

.log-status.watch {
  background: #fff3bf;
  color: #92400e;
}

.log-status.bad {
  background: #ffe1e5;
  color: #b91c1c;
}

.event-empty {
  display: none;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.event-empty.is-visible {
  display: block;
}

.cell-tile.bad span,
.cell-tile.bad strong {
  color: #fff;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.45fr 1fr;
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 28px;
  align-items: start;
}

.issue-list,
.temperature-grid,
.action-grid {
  display: grid;
  gap: 10px;
}

.issue,
.action,
.temp-card {
  border: 1px solid #e6ebf1;
  border-radius: 7px;
  background: #fbfcfd;
  padding: 12px;
}

.issue {
  border-left: 4px solid var(--bad);
}

.issue strong,
.action strong {
  display: block;
  margin-bottom: 6px;
  color: #111827;
}

.issue p,
.action p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.temp-card {
  background: #fff;
}

.temp-card.ok {
  border-color: #d8efe3;
}

.temp-card.watch {
  border-color: #f2d37a;
  background: #fffaf0;
}

.temp-card.bad {
  border-color: #f0b4ba;
  background: #fff2f3;
}

.temp-card-head,
.temp-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.temp-card-head span {
  border-radius: 999px;
  padding: 3px 8px;
  background: #e7f8ef;
  color: #168a55;
  font-size: 11px;
  font-weight: 800;
}

.temp-card.watch .temp-card-head span {
  background: #fff0c7;
  color: #9a6a00;
}

.temp-card.bad .temp-card-head span {
  background: #ffe0e3;
  color: #c8323f;
}

.temp-value {
  margin-top: 10px;
  color: #111827;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.temp-value small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 13px;
}

.temp-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1380px) {
  .storage-detail-card {
    left: 180px;
    width: min(690px, calc(100% - 250px));
  }

  .pcs-grid {
    gap: 18px;
  }
}

@media (max-width: 1280px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

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

  .microgrid-canvas {
    overflow-x: auto;
  }

  .power-lines,
  .micro-node {
    min-width: initial;
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav-group {
    grid-column: 1 / -1;
  }

  .topbar,
  .filter-row,
  .sub-tabs {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .top-spacer,
  .divider {
    display: none;
  }

  .capacity-card,
  .storage-detail-card {
    position: static;
    width: auto;
    margin: 14px 24px;
  }

  .capacity-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .microgrid-canvas {
    min-width: 980px;
  }

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

  .view-switch {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .stat-grid,
  .summary-grid,
  .pcs-metric-grid,
  .temperature-grid {
    grid-template-columns: 1fr;
  }
}
