:root {
  color-scheme: dark;
  --bg: #020814;
  --sidebar: #061428;
  --panel: rgba(4, 25, 55, 0.9);
  --panel-soft: rgba(6, 34, 72, 0.82);
  --line: rgba(30, 144, 255, 0.36);
  --line-soft: rgba(30, 144, 255, 0.18);
  --text: #eaf4ff;
  --muted: #8fb2d6;
  --blue: #168cff;
  --cyan: #20f6ff;
  --green: #38df75;
  --orange: #ff9f1a;
  --red: #ff4d4f;
  --purple: #8b5cf6;
  --gray: #8fa3b8;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1480px;
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(circle at 50% -10%, rgba(22, 140, 255, 0.12), transparent 34%),
    radial-gradient(circle at 92% 7%, rgba(32, 246, 255, 0.04), transparent 24%),
    linear-gradient(180deg, #06162e 0%, #020814 48%, #01050e 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(30, 144, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 144, 255, 0.032) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 78%);
}

body.day-theme {
  color-scheme: light;
  --bg: #f4f7fb;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --line: #dce6f3;
  --line-soft: #edf2f8;
  --text: #1f2f46;
  --muted: #6f7f92;
  --blue: #2f7bf6;
  --cyan: #55b7ff;
  --green: #56c867;
  --orange: #ff9f2d;
  --red: #ff6262;
  --purple: #8b76ff;
  background:
    linear-gradient(180deg, #fbfdff 0%, #f4f7fb 42%, #eef4fb 100%);
  color: var(--text);
}

body.day-theme::before {
  background: none;
}

body.day-theme .sidebar,
body.day-theme .topbar {
  border-color: #e2eaf4;
  background: #ffffff;
  color: #1f2f46;
  box-shadow: 0 8px 24px rgba(35, 74, 120, 0.07);
}

body.day-theme .brand strong,
body.day-theme .top-left strong,
body.day-theme .title-frame h1,
body.day-theme .stat-card strong,
body.day-theme .panel-title h2,
body.day-theme .panel h3,
body.day-theme .ring strong,
body.day-theme .key-grid b,
body.day-theme .signal-summary-head strong,
body.day-theme .modal-title h2 {
  color: #1d5fd2;
  text-shadow: none;
}

body.day-theme .brand-logo {
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 32%, transparent 33%),
    conic-gradient(from 30deg, #55b7ff, #2f7bf6, #55b7ff);
  filter: drop-shadow(0 0 4px rgba(47, 123, 246, 0.16));
}

body.day-theme .nav a {
  color: #526073;
}

body.day-theme .nav a.active,
body.day-theme .nav a:hover {
  border-color: #d8e7ff;
  background: linear-gradient(90deg, rgba(47, 123, 246, 0.13), rgba(47, 123, 246, 0.04));
  color: #2f6fe4;
  box-shadow: inset 3px 0 0 #2f7bf6;
}

body.day-theme .stat-card,
body.day-theme .panel,
body.day-theme .map-tools,
body.day-theme .map-board,
body.day-theme .point-detail,
body.day-theme .modal-panel {
  border-color: #dfe8f4;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(36, 72, 112, 0.08);
}

body.day-theme .filter-bar input,
body.day-theme .filter-bar select,
body.day-theme .map-toolbar input,
body.day-theme .map-toolbar select,
body.day-theme #map-device-search,
body.day-theme .admin-form input,
body.day-theme .admin-form select,
body.day-theme .admin-form textarea,
body.day-theme .dingtalk-global-settings input,
body.day-theme .dingtalk-config-row input,
body.day-theme .dingtalk-config-row textarea,
body.day-theme .dingtalk-config-row select,
body.day-theme .dingtalk-select-button,
body.day-theme .factory-map-config-row input,
body.day-theme .device-add-form input,
body.day-theme .device-add-form select,
body.day-theme .picker-tools input,
body.day-theme .picker-tools select,
body.day-theme .pager input {
  background: #ffffff;
  color: #1f2f46;
  border-color: #d8e2ef;
}

body.day-theme th {
  background: #f7faff;
  color: #25364f;
}

body.day-theme td,
body.day-theme .stat-card span,
body.day-theme .filter-bar label,
body.day-theme .check-row,
body.day-theme .clock,
body.day-theme .weather,
body.day-theme .detail-grid b,
body.day-theme .chart-legend {
  color: #4a5c72;
}

body.day-theme .device-table th:last-child,
body.day-theme .device-table td:last-child {
  background: #ffffff;
}

body.day-theme .content {
  background: #f4f7fb;
}

body.day-theme .title-frame h1 {
  color: #1d5fd2;
}

body.day-theme .title-frame h1::before,
body.day-theme .title-frame h1::after {
  border-color: rgba(47, 123, 246, 0.28);
}

body.day-theme .stat-card::after,
body.day-theme .panel::before {
  background: none;
}

body.day-theme .stat-icon {
  color: #ffffff;
  border: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--card-color) 78%, #ffffff), var(--card-color));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--card-color) 25%, transparent);
}

body.day-theme .stat-card em,
body.day-theme .panel h3,
body.day-theme .sidebar-copy {
  color: #6f7f92;
}

body.day-theme .stat-card small {
  color: #35b857;
}

body.day-theme .panel-title {
  border-bottom-color: #edf2f8;
}

body.day-theme table {
  color: #26374f;
}

body.day-theme tbody tr:hover {
  background: #f3f8ff;
}

body.day-theme .plant-visual {
  background:
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.72) 70%, #ffffff 100%),
    url("/assets/dashboard-map.svg") center bottom / cover no-repeat;
  opacity: 0.42;
}

body.day-theme .plant-visual::after {
  background: linear-gradient(180deg, transparent, #ffffff);
}

body.day-theme .plain-icon {
  color: #526073;
}

body.day-theme .primary-button,
body.day-theme .pager button.active {
  background: linear-gradient(180deg, #4b8df8, #2f6fe4);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 111, 228, 0.18);
}

body.day-theme .outline-button,
body.day-theme .map-buttons button,
body.day-theme .map-toolbar button,
body.day-theme .pager button {
  border-color: #d8e2ef;
  background: #ffffff;
  color: #526073;
}

body.day-theme .theme-switch {
  border-color: #d8e2ef;
  background: #f7fbff;
}

body.day-theme .theme-switch-icon {
  transform: translateX(16px);
  background: #ffbd3a;
  box-shadow: 0 0 0 4px rgba(255, 189, 58, 0.14), 0 0 14px rgba(255, 189, 58, 0.34);
}

body.day-theme .theme-switch-icon::before {
  inset: -5px;
  border: 2px solid rgba(255, 189, 58, 0.42);
  background: transparent;
  transform: scale(0.72);
}

body.day-theme .chart-shell svg rect {
  fill: #ffffff;
}

body.day-theme .chart-shell text {
  fill: #6f7f92;
}

body.day-theme .chart-shell .axis-title {
  fill: #25364f;
}

body.day-theme .chart-shell .grid-line {
  stroke: #dfe8f4;
}

body.day-theme .empty-chart {
  border-color: #d8e2ef;
  background: #ffffff;
  color: #526073;
}

body.day-theme .chart-tooltip,
body.day-theme .map-tooltip {
  border-color: #d7e2ef;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  color: #25364f;
  box-shadow: 0 14px 30px rgba(35, 74, 120, 0.16);
}

body.day-theme .chart-tooltip strong,
body.day-theme .map-tooltip strong,
body.day-theme .alert-item strong,
body.day-theme .ops-feed b,
body.day-theme .health-cards strong,
body.day-theme .area-card strong,
body.day-theme .area-card b,
body.day-theme .quick-grid strong,
body.day-theme .live-values strong,
body.day-theme .summary-list b,
body.day-theme .key-grid b,
body.day-theme .signal-score strong,
body.day-theme .signal-report-grid b,
body.day-theme .signal-summary-grid b,
body.day-theme .signal-summary-head strong,
body.day-theme .map-counts strong,
body.day-theme .detail-head strong,
body.day-theme .alert-detail-body b,
body.day-theme .alert-donut-ring strong,
body.day-theme .alert-donut-legend b,
body.day-theme .health-legend b,
body.day-theme .donut-with-legend b,
body.day-theme .layer-list b {
  color: #1f2f46;
}

body.day-theme .chart-tooltip span,
body.day-theme .map-tooltip span,
body.day-theme .alert-item span,
body.day-theme .alert-item time,
body.day-theme .ops-feed small,
body.day-theme .ops-feed time,
body.day-theme .health-legend span,
body.day-theme .health-cards span,
body.day-theme .area-card span,
body.day-theme .quick-grid span,
body.day-theme .live-values span,
body.day-theme .donut-with-legend span,
body.day-theme .layer-list span,
body.day-theme .summary-list span,
body.day-theme .key-grid span,
body.day-theme .signal-score span,
body.day-theme .signal-report-grid span,
body.day-theme .signal-report p,
body.day-theme .signal-summary-head span,
body.day-theme .signal-summary p,
body.day-theme .map-counts span,
body.day-theme .map-legend,
body.day-theme .map-legend span,
body.day-theme .detail-grid span,
body.day-theme .detail-grid b,
body.day-theme .alert-detail-body span,
body.day-theme .alert-donut-ring span,
body.day-theme .alert-donut-legend span,
body.day-theme .alert-detail-actions p,
body.day-theme .scale,
body.day-theme .empty-admin,
body.day-theme .loading,
body.day-theme .device-add-form p,
body.day-theme .admin-form p,
body.day-theme .modal-chart .muted,
body.day-theme .picker-scope,
body.day-theme .pager,
body.day-theme .pager span,
body.day-theme .pager label {
  color: #526073;
}

body.day-theme .map-tooltip::after {
  border-color: #d7e2ef;
  background: rgba(255, 255, 255, 0.78);
}

body.day-theme .campus-overview,
body.day-theme .factory-map,
body.day-theme .map-counts,
body.day-theme .map-point b,
body.day-theme .map-marker b,
body.day-theme .map-legend,
body.day-theme .health-cards div,
body.day-theme .area-card,
body.day-theme .quick-grid a,
body.day-theme .live-values div,
body.day-theme .detail-grid span,
body.day-theme .summary-list div,
body.day-theme .key-grid span,
body.day-theme .signal-summary-head,
body.day-theme .signal-summary-grid span,
body.day-theme .signal-score,
body.day-theme .signal-report-grid span,
body.day-theme .signal-report p,
body.day-theme .alert-item,
body.day-theme .alert-detail-body span,
body.day-theme .alert-donut-ring,
body.day-theme .alert-donut-legend span,
body.day-theme .ops-feed div,
body.day-theme .picker-row,
body.day-theme .picker-pager,
body.day-theme .table-wrap {
  border-color: #dfe8f4;
  background: #ffffff;
  color: #25364f;
  box-shadow: 0 6px 18px rgba(36, 72, 112, 0.06);
}

body.day-theme .campus-overview img,
body.day-theme .factory-map img {
  opacity: 0.96;
  filter: saturate(0.95) contrast(0.98) brightness(1.04);
}

body.day-theme .map-counts span,
body.day-theme .device-table th:last-child,
body.day-theme .device-table td:last-child {
  border-color: #dfe8f4;
}

body.day-theme .map-distribution-filters label,
body.day-theme .map-point-readout span,
body.day-theme .map-device-option {
  border-color: #dfe8f4;
  background: #ffffff;
  color: #25364f;
}

body.day-theme .dingtalk-config-row,
body.day-theme .factory-map-config-row,
body.day-theme .online-device-options,
body.day-theme .device-check-grid,
body.day-theme .factory-map-preview {
  border-color: #dfe8f4;
  background: #ffffff;
  color: #25364f;
}

body.day-theme .dingtalk-area-menu,
body.day-theme .dingtalk-device-summary {
  border-color: #dfe8f4;
  background: #ffffff;
  color: #25364f;
  box-shadow: 0 14px 30px rgba(35, 74, 120, 0.14);
}

body.day-theme .dingtalk-select-button b,
body.day-theme .dingtalk-device-summary {
  color: #25364f;
}

body.day-theme .map-distribution-filters b,
body.day-theme .map-point-readout b,
body.day-theme .map-device-option b {
  color: #1f2f46;
}

body.day-theme .map-device-option small {
  color: #526073;
}

body.day-theme .device-table th:last-child {
  background: #f7faff;
}

body.day-theme .device-table td:last-child {
  box-shadow: -10px 0 18px rgba(35, 74, 120, 0.08);
}

body.day-theme .table-action {
  border-color: #d8e2ef;
  background: #ffffff;
  color: #2f6fe4;
}

body.day-theme .table-action:hover {
  border-color: #bfd7ff;
  background: #f3f8ff;
}

body.day-theme .danger-action {
  border-color: #ffd2d2;
  background: #fff5f5;
  color: #d64343;
}

body.day-theme .signal-meter {
  color: #1f2f46;
}

body.day-theme .ring {
  background:
    radial-gradient(circle, #ffffff 0 52%, transparent 53%),
    conic-gradient(var(--ring-color) var(--percent), #e4ebf5 0);
  box-shadow: inset 0 0 0 1px #dfe8f4;
}

body.day-theme .ring span {
  color: #526073;
}

body.day-theme .modal-title {
  border-bottom-color: #edf2f8;
}

body.day-theme .modal-title button {
  border-color: #d8e2ef;
  background: #ffffff;
  color: #526073;
}

body.day-theme .device-add-form label,
body.day-theme .admin-form label,
body.day-theme .dingtalk-global-settings label,
body.day-theme .dingtalk-config-row label,
body.day-theme .factory-map-config-row label,
body.day-theme .check-admin {
  color: #25364f;
}

body.day-theme .device-add-form input:disabled {
  background: #f4f7fb;
  color: #6f7f92;
}

body.day-theme .filter-bar,
body.day-theme .map-toolbar {
  border-color: #edf2f8;
}

body.day-theme .check-row .icon {
  color: #6f7f92;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 12px 18px;
  border-right: 1px solid rgba(30, 144, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(6, 28, 58, 0.96), rgba(1, 8, 20, 0.98)),
    var(--sidebar);
  box-shadow: inset -1px 0 0 rgba(32, 246, 255, 0.1), 16px 0 54px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.brand,
.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.brand strong,
.top-left strong {
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}

.brand strong {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-logo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  background:
    radial-gradient(circle at 50% 50%, #052147 0 32%, transparent 33%),
    conic-gradient(from 30deg, #20f6ff, #168cff, #20f6ff);
  clip-path: polygon(50% 0, 92% 25%, 92% 75%, 50% 100%, 8% 75%, 8% 25%);
  filter: drop-shadow(0 0 4px rgba(22, 140, 255, 0.28));
}

.brand-logo.small {
  width: 28px;
  height: 28px;
}

.plain-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #d8ecff;
  cursor: pointer;
  font-size: 19px;
}

.nav {
  display: grid;
  gap: 7px;
  margin-top: 26px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  color: #bdd2eb;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nav a.active,
.nav a:hover {
  border-color: rgba(30, 144, 255, 0.42);
  background: linear-gradient(90deg, rgba(22, 140, 255, 0.56), rgba(22, 140, 255, 0.08));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--cyan), 0 0 12px rgba(22, 140, 255, 0.14);
}

.nav a[hidden] {
  display: none;
}

.plant-visual {
  position: relative;
  min-height: 280px;
  margin: auto -12px 14px;
  background:
    linear-gradient(180deg, transparent, rgba(1, 8, 20, 0.88)),
    url("/assets/dashboard-map.svg") center bottom / cover no-repeat;
  opacity: 0.8;
}

.plant-visual::after {
  position: absolute;
  inset: auto 0 0;
  height: 110px;
  content: "";
  background: linear-gradient(180deg, transparent, #061428);
}

.sidebar-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  color: #8fb2d6;
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 120px minmax(300px, 1fr) 390px;
  align-items: center;
  min-height: 70px;
  border-bottom: 1px solid rgba(30, 144, 255, 0.28);
  padding: 0 18px;
  background:
    linear-gradient(90deg, rgba(3, 12, 28, 0.97), rgba(4, 22, 48, 0.9), rgba(3, 12, 28, 0.97));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.title-frame {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.title-frame h1 {
  position: relative;
  margin: 0;
  min-width: 340px;
  padding: 0 76px;
  color: #ffffff;
  text-align: center;
  font-size: 27px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(32, 246, 255, 0.24);
}

.title-frame h1::before,
.title-frame h1::after {
  position: absolute;
  top: 50%;
  width: 94px;
  height: 18px;
  content: "";
  border-top: 1px solid rgba(32, 246, 255, 0.36);
  border-bottom: 1px solid rgba(22, 140, 255, 0.22);
}

.title-frame h1::before {
  left: -34px;
  clip-path: polygon(0 50%, 78% 50%, 88% 100%, 100% 100%, 90% 0, 0 0);
}

.title-frame h1::after {
  right: -34px;
  clip-path: polygon(0 100%, 12% 100%, 22% 50%, 100% 50%, 100% 0, 10% 0);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: #d7ecff;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  min-width: 46px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 5px;
}

.theme-switch-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d8ecff;
  box-shadow: inset -6px -3px 0 #6f8fb6, 0 0 12px rgba(32, 246, 255, 0.24);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.theme-switch-icon::before {
  position: absolute;
  inset: 4px -4px 4px 10px;
  border-radius: 50%;
  background: #061428;
  content: "";
}

.clock,
.weather {
  color: #d7ecff;
  font-size: 14px;
  white-space: nowrap;
}

.weather {
  border-left: 1px solid rgba(30, 144, 255, 0.36);
  padding-left: 12px;
}

.content {
  display: grid;
  gap: 14px;
  padding: 16px 16px 18px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: currentColor;
}

.icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats-row {
  display: grid;
  gap: 12px;
}

.stats-row.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat-card,
.panel,
.map-tools,
.map-board,
.point-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 140, 255, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(7, 32, 68, 0.94), rgba(2, 17, 38, 0.93));
  box-shadow: inset 0 0 0 1px rgba(32, 246, 255, 0.018), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 112px;
  padding: 12px 13px;
  overflow: hidden;
}

.stat-card > div:last-child {
  min-width: 0;
}

.stat-card::after,
.panel::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(32, 246, 255, 0.13), transparent 120px) 0 0 / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(32, 246, 255, 0.06), transparent) 50% 100% / 68% 1px no-repeat;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--card-color) 32%, rgba(255, 255, 255, 0.08)), transparent 48%),
    linear-gradient(180deg, color-mix(in srgb, var(--card-color) 52%, #07336a), rgba(3, 22, 48, 0.94));
  border: 1px solid color-mix(in srgb, var(--card-color) 58%, transparent);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05), 0 0 0 3px rgba(22, 140, 255, 0.05);
}

.stat-card.blue { --card-color: var(--blue); }
.stat-card.green { --card-color: var(--green); }
.stat-card.cyan { --card-color: var(--cyan); }
.stat-card.red { --card-color: var(--red); }
.stat-card.purple { --card-color: var(--purple); }
.stat-card.orange { --card-color: var(--orange); }

.stat-card span,
.panel-title h2,
.panel h3 {
  color: #d7ecff;
}

.stat-card span {
  display: block;
  font-size: 14px;
  white-space: nowrap;
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  text-shadow: none;
}

.stat-card strong.text-value {
  max-width: 100%;
  font-size: 20px;
  line-height: 1.08;
  white-space: nowrap;
}

.stat-card strong.long-value {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.stat-card em {
  margin-left: 7px;
  color: #d7ecff;
  font-size: 15px;
  font-style: normal;
  font-weight: 500;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: #63f0d7;
  font-size: 12px;
}

.panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 14px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title h2,
.panel h3 {
  margin: 0;
  font-size: 17px;
}

.panel h3 {
  margin: 16px 12px 10px;
  color: #d7ecff;
  font-size: 15px;
}

.panel-body {
  padding: 12px;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.02fr 1.12fr 0.84fr;
  gap: 14px;
}

.trend-panel {
  min-height: 372px;
  overflow: visible;
}

.map-panel {
  min-height: 372px;
}

.alerts-panel {
  min-height: 372px;
}

.health-panel,
.areas-panel,
.quick-panel {
  min-height: 284px;
}

.campus-overview {
  position: relative;
  height: 326px;
  margin: 12px;
  overflow: hidden;
  border: 1px solid rgba(30, 144, 255, 0.26);
  border-radius: 6px;
  background: rgba(2, 17, 38, 0.78);
}

.campus-overview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.map-point,
.map-marker {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
}

.map-point {
  width: 20px;
  height: 20px;
  background: var(--green);
  box-shadow: 0 0 9px rgba(56, 223, 117, 0.34), 0 0 0 4px rgba(56, 223, 117, 0.12);
}

.map-point span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
}

.map-point b {
  position: absolute;
  top: -26px;
  left: 50%;
  min-width: max-content;
  border: 1px solid rgba(30, 144, 255, 0.4);
  border-radius: 4px;
  padding: 3px 7px;
  background: rgba(2, 17, 38, 0.82);
  color: #d7ecff;
  font-size: 12px;
  transform: translateX(-50%);
}

.map-point.warn {
  background: var(--orange);
  box-shadow: 0 0 9px rgba(255, 159, 26, 0.34), 0 0 0 4px rgba(255, 159, 26, 0.12);
}

.p1 { left: 49%; top: 24%; }
.p2 { left: 23%; top: 35%; }
.p3 { left: 58%; top: 42%; }
.p4 { left: 78%; top: 38%; }
.p5 { left: 30%; top: 70%; }

.map-counts {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  border: 1px solid rgba(30, 144, 255, 0.36);
  border-radius: 6px;
  background: rgba(2, 17, 38, 0.78);
}

.map-counts span {
  display: grid;
  gap: 3px;
  min-width: 70px;
  padding: 8px 12px;
  border-left: 1px solid rgba(30, 144, 255, 0.2);
  color: #9fc4e8;
  text-align: center;
  font-size: 12px;
}

.map-counts span:first-child {
  border-left: 0;
}

.map-counts strong {
  color: #ffffff;
  font-size: 18px;
}

.alert-list,
.ops-feed,
.summary-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.alert-item,
.ops-feed div {
  display: grid;
  grid-template-columns: 36px 1fr 72px;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(8, 38, 78, 0.64);
}

.alert-item .icon,
.ops-feed .icon {
  width: 28px;
  height: 28px;
  color: var(--orange);
}

.alert-item.danger .icon,
.ops-feed .warn .icon {
  color: var(--red);
}

.alert-item strong,
.ops-feed b {
  display: block;
  color: #ffffff;
  font-size: 14px;
}

.alert-item span,
.ops-feed small,
.alert-item time,
.ops-feed time {
  color: #9fc4e8;
  font-size: 12px;
}

.more-link {
  display: flex;
  justify-content: flex-end;
  color: #2aa7ff;
  text-decoration: none;
  font-size: 13px;
}

.health-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 8px;
}

.health-legend,
.donut-with-legend > div,
.layer-list {
  display: grid;
  gap: 12px;
}

.health-legend span,
.donut-with-legend span,
.layer-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #c9def6;
  font-size: 14px;
}

.health-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 16px 14px;
}

.health-cards div,
.area-card,
.quick-grid a,
.live-values div,
.detail-grid span,
.summary-list div {
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  background: rgba(6, 34, 72, 0.7);
}

.health-cards div {
  display: grid;
  gap: 8px;
  min-height: 66px;
  padding: 12px;
}

.health-cards span,
.area-card span,
.quick-grid span,
.live-values span {
  color: #8fb2d6;
  font-size: 12px;
}

.health-cards strong,
.area-card strong,
.quick-grid strong,
.live-values strong {
  color: #ffffff;
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.area-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  min-height: 82px;
  padding: 11px;
}

.area-card .icon {
  width: 28px;
  height: 28px;
  color: var(--cyan);
}

.area-card p {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.area-card b {
  color: #d7ecff;
  font-size: 12px;
  font-weight: 500;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.quick-grid a {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px 12px;
  min-height: 90px;
  padding: 16px;
  color: #eaf4ff;
  text-decoration: none;
}

.quick-grid a .icon {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  color: var(--cyan);
}

.chart-shell {
  min-width: 0;
}

.chart-frame {
  position: relative;
  min-width: 0;
  overflow: visible;
}

.empty-chart {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(30, 144, 255, 0.26);
  border-radius: 6px;
  background: rgba(2, 15, 34, 0.28);
  color: #8fb2d6;
}

.chart-shell svg {
  display: block;
  width: 100%;
  min-height: 260px;
}

.chart-shell.small svg {
  min-height: 150px;
}

.chart-shell svg rect {
  fill: rgba(2, 16, 34, 0.7);
}

.chart-shell text {
  fill: #9fc4e8;
  font-size: 12px;
}

.chart-shell .axis-title {
  fill: #cfe8ff;
  font-weight: 700;
}

.chart-shell .grid-line {
  stroke: rgba(120, 170, 220, 0.18);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-shell polyline {
  fill: none;
  stroke: var(--stroke);
  stroke-width: 2.1;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  filter: none;
}

.chart-shell .bound-line {
  stroke: var(--stroke);
  stroke-width: 0.9;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-dasharray: 5 6;
  opacity: 0.68;
}

.chart-shell .bound-line.min {
  stroke-dasharray: 2 6;
  opacity: 0.58;
}

.chart-shell .bound-label {
  fill: var(--fill);
  font-size: 11px;
  font-weight: 700;
}

.chart-shell .hover-dot {
  fill: transparent;
  stroke: transparent;
  cursor: help;
}

.chart-hotspots {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.chart-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  outline: 0;
  cursor: crosshair;
}

.chart-hit::before {
  position: absolute;
  top: 24px;
  bottom: 34px;
  left: var(--point-x, 50%);
  width: 1px;
  background: transparent;
  content: "";
  transform: translateX(-50%);
}

.chart-hover-node {
  position: absolute;
  left: var(--point-x, 50%);
  z-index: 7;
  width: 9px;
  height: 9px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--node-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-color) 20%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.chart-hit:hover::before,
.chart-hit:focus::before,
.chart-hit:focus-visible::before {
  background: rgba(207, 232, 255, 0.3);
}

.chart-hit:hover .chart-hover-node,
.chart-hit:focus .chart-hover-node,
.chart-hit:focus-visible .chart-hover-node {
  opacity: 1;
}

.chart-tooltip {
  position: absolute;
  top: var(--point-y, 50%);
  left: var(--point-x, 50%);
  z-index: 8;
  display: grid;
  gap: 9px;
  width: max-content;
  max-width: 330px;
  border: 1px solid rgba(30, 144, 255, 0.42);
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(2, 17, 38, 0.76);
  backdrop-filter: blur(6px);
  color: #cfe8ff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 16px));
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: normal;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
}

.chart-hit.tooltip-right .chart-tooltip {
  transform: translate(18px, -50%);
}

.chart-hit.tooltip-left .chart-tooltip {
  transform: translate(calc(-100% - 18px), -50%);
}

.chart-hit.tooltip-bottom .chart-tooltip {
  transform: translate(-50%, 16px);
}

.chart-tooltip strong {
  color: #ffffff;
  font-size: 13px;
}

.chart-tooltip span,
.chart-tooltip i {
  color: #9fc4e8;
  font-style: normal;
}

.chart-tooltip-group {
  display: grid;
  gap: 3px;
  padding-top: 7px;
  border-top: 1px solid rgba(143, 178, 214, 0.2);
}

.chart-tooltip-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.chart-tooltip-group b {
  color: #ffffff;
  font-size: 12px;
}

.chart-tooltip-foot {
  padding-top: 7px;
  border-top: 1px solid rgba(143, 178, 214, 0.2);
}

.chart-hit:hover .chart-tooltip,
.chart-hit:focus .chart-tooltip,
.chart-hit:focus-visible .chart-tooltip {
  opacity: 1;
}

.chart-hit.tooltip-right:hover .chart-tooltip,
.chart-hit.tooltip-right:focus .chart-tooltip,
.chart-hit.tooltip-right:focus-visible .chart-tooltip,
.chart-hit.tooltip-left:hover .chart-tooltip,
.chart-hit.tooltip-left:focus .chart-tooltip,
.chart-hit.tooltip-left:focus-visible .chart-tooltip {
  opacity: 1;
}

.chart-hit.tooltip-bottom:hover .chart-tooltip,
.chart-hit.tooltip-bottom:focus .chart-tooltip,
.chart-hit.tooltip-bottom:focus-visible .chart-tooltip {
  opacity: 1;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0 0 8px;
  color: #d7ecff;
  font-size: 13px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i,
.green-dot,
.blue-dot,
.cyan-dot,
.orange-dot,
.red-dot,
.gray-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-legend .bounds-legend i {
  width: 20px;
  height: 0;
  border-top: 2px dashed #9fc4e8;
  border-radius: 0;
  background: transparent;
}

.green-dot { background: var(--green); }
.blue-dot { background: var(--blue); }
.cyan-dot { background: var(--cyan); }
.orange-dot { background: var(--orange); }
.red-dot { background: var(--red); }
.gray-dot { background: var(--gray); }

.ring-card {
  --ring-color: var(--green);
  display: grid;
  place-items: center;
  gap: 8px;
}

.ring-card.blue { --ring-color: var(--blue); }
.ring-card.green { --ring-color: var(--green); }
.ring-card.red { --ring-color: var(--red); }
.ring-card.cyan { --ring-color: var(--cyan); }

.ring {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(3, 20, 44, 0.96) 0 52%, transparent 53%),
    conic-gradient(var(--ring-color) var(--percent), rgba(67, 89, 118, 0.36) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.ring-card.small .ring {
  width: 118px;
  height: 118px;
}

.ring strong {
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.ring span {
  margin-top: 28px;
  color: #cfe8ff;
  font-size: 12px;
}

.ring-card small {
  color: color-mix(in srgb, var(--ring-color) 80%, #ffffff);
  font-weight: 800;
}

.device-page-grid,
.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}

.device-main,
.right-rail,
.history-main {
  display: grid;
  gap: 14px;
}

.right-rail {
  position: sticky;
  top: 86px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(260px, 1.4fr) auto auto;
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
  padding: 14px;
}

.history-filter .filter-bar {
  grid-template-columns: minmax(310px, 1.4fr) repeat(5, minmax(130px, 1fr)) auto auto;
}

.filter-bar label {
  display: grid;
  gap: 7px;
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 700;
}

.filter-bar input,
.filter-bar select,
.map-toolbar input,
.map-toolbar select {
  width: 100%;
  height: 38px;
  min-width: 0;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.filter-bar input:focus,
.filter-bar select:focus,
.map-toolbar input:focus,
.map-toolbar select:focus,
.device-add-form input:focus,
.device-add-form select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--blue) 68%, #ffffff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}

.date-range div {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.primary-button,
.outline-button,
.map-buttons button,
.map-toolbar button,
.pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.52);
  border-radius: 6px;
  padding: 0 14px;
  color: #ffffff;
  text-decoration: none;
  background: linear-gradient(180deg, #168cff, #0754bd);
  box-shadow: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.outline-button,
.map-buttons button,
.map-toolbar button,
.pager button {
  background: rgba(4, 25, 54, 0.82);
  color: #cfe8ff;
}

.primary-button:hover,
.outline-button:hover,
.map-buttons button:hover,
.map-toolbar button:hover,
.pager button:hover,
.table-action:hover {
  transform: translateY(-1px);
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 8px 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  color: #dceeff;
}

.device-table table {
  min-width: 1620px;
}

.history-table table {
  min-width: 1060px;
}

.compact-table table {
  min-width: 0;
}

th,
td {
  height: 46px;
  border-right: 1px solid rgba(30, 144, 255, 0.16);
  border-bottom: 1px solid rgba(30, 144, 255, 0.16);
  padding: 7px 8px;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
}

th {
  background: rgba(10, 62, 120, 0.52);
  color: #d7ecff;
  font-weight: 800;
}

.device-table th:last-child,
.device-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 146px;
  border-left: 1px solid rgba(30, 144, 255, 0.22);
  background: rgba(5, 28, 58, 0.96);
  box-shadow: -10px 0 18px rgba(2, 17, 38, 0.9);
}

.device-table th:last-child {
  z-index: 3;
  background: rgba(10, 62, 120, 0.96);
}

tbody tr:hover {
  background: rgba(22, 140, 255, 0.08);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 3px rgba(56, 223, 117, 0.34);
}

.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 3px rgba(255, 77, 79, 0.34);
}

.ok { color: var(--green); }
.warn { color: var(--orange); }
.danger { color: var(--red); }

.sensor-reading {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 66px;
  min-height: 26px;
  border: 1px solid rgba(143, 178, 214, 0.22);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(143, 178, 214, 0.08);
  color: var(--muted);
  font-weight: 800;
  line-height: 1;
}

.sensor-reading.ok {
  border-color: color-mix(in srgb, var(--green) 34%, transparent);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
}

.sensor-reading.danger {
  border-color: color-mix(in srgb, var(--red) 34%, transparent);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
}

.sensor-reading.disconnected {
  border-color: rgba(143, 178, 214, 0.22);
  background: rgba(143, 178, 214, 0.07);
  color: var(--muted);
}

.sensor-reading.offline {
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
  background: color-mix(in srgb, var(--red) 9%, transparent);
  color: var(--red);
}

.sensor-reading small {
  font-size: 11px;
  font-weight: 700;
}

.sensor-state-list {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  max-width: 170px;
}

.sensor-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 3px 8px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-size: 12px;
  line-height: 1;
}

.signal,
.ops {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

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

.signal-meter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #dceeff;
}

.signal-meter b {
  min-width: 28px;
  text-align: right;
}

.signal-meter small {
  min-width: 38px;
  color: var(--muted);
}

.signal-bars {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 16px;
}

.signal-bars i {
  display: block;
  width: 4px;
  border-radius: 1px;
  background: rgba(143, 178, 214, 0.22);
}

.signal-bars i:nth-child(1) { height: 5px; }
.signal-bars i:nth-child(2) { height: 8px; }
.signal-bars i:nth-child(3) { height: 12px; }
.signal-bars i:nth-child(4) { height: 16px; }

.signal-meter.good .signal-bars i.active,
.signal-meter.normal .signal-bars i.active {
  background: var(--green);
}

.signal-meter.warn .signal-bars i.active {
  background: var(--orange);
}

.signal-meter.danger .signal-bars i.active {
  background: var(--red);
}

.signal-meter.unknown .signal-bars i.active {
  background: var(--gray);
}

.signal .icon,
.ops .icon {
  width: 15px;
  height: 15px;
  color: var(--green);
}

.ops .icon {
  color: var(--blue);
}

.action-buttons {
  gap: 6px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  color: #cfe8ff;
}

.pager button {
  min-width: 34px;
  min-height: 32px;
  padding: 0 10px;
}

.pager button.active {
  background: linear-gradient(180deg, #168cff, #0754bd);
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager input {
  width: 54px;
  height: 32px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 4px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
  text-align: center;
}

.donut-with-legend {
  display: grid;
  grid-template-columns: 142px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.twin-rings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px;
}

.ops-feed div {
  grid-template-columns: 32px 1fr 70px;
}

.ops-feed .ok-feed .icon {
  color: var(--green);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 12px;
}

.map-tools,
.map-board,
.point-detail {
  overflow: hidden;
}

.point-detail {
  overflow: visible;
}

.map-tools {
  padding-bottom: 12px;
}

.map-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  color: #cfe8ff;
  font-size: 13px;
}

.check-row input {
  accent-color: var(--blue);
}

.check-row .icon {
  width: 15px;
  height: 15px;
  color: #8fb2d6;
}

.layer-list {
  padding: 0 12px;
}

.map-toolbar {
  display: grid;
  grid-template-columns: 170px minmax(220px, 1fr) repeat(4, auto);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.map-distribution-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px;
}

.map-distribution-filters label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid rgba(30, 144, 255, 0.22);
  border-radius: 4px;
  padding: 0 10px;
  color: #cfe8ff;
  font-size: 13px;
}

.map-distribution-filters input {
  accent-color: var(--blue);
}

.map-distribution-filters b {
  color: #ffffff;
}

.factory-map {
  position: relative;
  height: min(68vh, 720px);
  min-height: 560px;
  overflow: hidden;
  background: #04162d;
  cursor: default;
  touch-action: none;
}

.factory-map.is-active {
  cursor: grab;
}

.factory-map.is-dragging {
  cursor: grabbing;
}

.map-canvas-content {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.factory-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.98;
  filter: saturate(1.1) contrast(1.05);
  user-select: none;
}

.map-marker {
  position: absolute;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  background: var(--green);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(56, 223, 117, 0.32), 0 0 0 4px rgba(56, 223, 117, 0.1);
}

.map-marker:hover,
.map-marker:focus-visible {
  z-index: 5;
  outline: 0;
}

.map-marker.air {
  background: var(--blue);
  box-shadow: 0 0 10px rgba(22, 140, 255, 0.34), 0 0 0 4px rgba(22, 140, 255, 0.1);
}

.map-marker.water {
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(32, 246, 255, 0.34), 0 0 0 4px rgba(32, 246, 255, 0.1);
}

.map-marker.terminal {
  background: var(--green);
  box-shadow: 0 0 10px rgba(56, 223, 117, 0.32), 0 0 0 4px rgba(56, 223, 117, 0.1);
}

.map-marker.sensor-dual-ok {
  background: conic-gradient(var(--blue) 0 50%, var(--cyan) 0 100%);
  box-shadow: 0 0 12px rgba(32, 246, 255, 0.32), 0 0 0 4px rgba(22, 140, 255, 0.12);
}

.map-marker.sensor-partial {
  border-color: rgba(255, 159, 26, 0.86);
  box-shadow: 0 0 12px rgba(255, 159, 26, 0.38), 0 0 0 4px rgba(255, 159, 26, 0.13);
}

.map-marker.sensor-error {
  background: var(--red);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 14px rgba(255, 77, 79, 0.44), 0 0 0 5px rgba(255, 77, 79, 0.15);
}

.map-marker.offline {
  background: var(--gray);
  box-shadow: 0 0 8px rgba(143, 163, 184, 0.28), 0 0 0 4px rgba(143, 163, 184, 0.1);
}

.map-marker .icon {
  width: 17px;
  height: 17px;
}

.map-sensor-dots {
  position: absolute;
  right: -5px;
  bottom: -4px;
  display: flex;
  gap: 2px;
  border-radius: 999px;
  padding: 2px;
  background: rgba(2, 17, 38, 0.78);
}

.map-sensor-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray);
}

.map-sensor-dots .ok {
  background: var(--green);
}

.map-sensor-dots .danger {
  background: var(--red);
}

.map-sensor-dots .unknown {
  background: var(--orange);
}

.map-sensor-dots .disabled {
  background: rgba(143, 163, 184, 0.34);
}

.map-marker b {
  position: absolute;
  top: 33px;
  left: 50%;
  border-radius: 3px;
  padding: 3px 6px;
  background: rgba(2, 17, 38, 0.86);
  color: #ffffff;
  font-size: 11px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.map-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 8;
  display: grid;
  gap: 5px;
  width: 228px;
  border: 1px solid rgba(30, 144, 255, 0.42);
  border-radius: 5px;
  padding: 10px;
  background: rgba(2, 17, 38, 0.76);
  backdrop-filter: blur(6px);
  color: #cfe8ff;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  transform: translate(-50%, 6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
}

.map-tooltip::after {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(30, 144, 255, 0.42);
  border-bottom: 1px solid rgba(30, 144, 255, 0.42);
  background: rgba(2, 17, 38, 0.76);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.map-tooltip strong {
  color: #ffffff;
  font-size: 13px;
}

.map-tooltip span {
  color: #9fc4e8;
}

.map-marker:hover .map-tooltip,
.map-marker:focus-visible .map-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.map-legend {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: flex;
  gap: 18px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 5px;
  padding: 7px 12px;
  background: rgba(2, 17, 38, 0.82);
  color: #d7ecff;
  font-size: 13px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.zoom-control {
  position: absolute;
  right: 12px;
  bottom: 52px;
  display: grid;
}

.zoom-control button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(30, 144, 255, 0.4);
  background: rgba(234, 244, 255, 0.9);
  color: #06214a;
  font-size: 20px;
  font-weight: 800;
}

.scale {
  position: absolute;
  right: 66px;
  bottom: 24px;
  color: #ffffff;
  font-size: 12px;
}

.scale::after {
  display: block;
  width: 54px;
  height: 6px;
  margin-top: 2px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  content: "";
}

.map-fullscreen {
  position: fixed;
  inset: 10px;
  z-index: 70;
}

.map-fullscreen .factory-map {
  height: calc(100vh - 128px);
  min-height: 520px;
}

.map-layer-modal {
  width: min(560px, 94vw);
}

.map-layer-modal-body,
.map-device-picker-body {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.layer-check-list {
  display: grid;
  gap: 6px;
}

.map-context-backdrop {
  place-items: start;
  background: rgba(0, 8, 20, 0.28);
}

.map-context-backdrop .map-device-picker-modal {
  position: fixed;
  width: min(430px, calc(100vw - 36px));
  max-height: min(620px, calc(100vh - 36px));
}

.map-device-picker-modal {
  width: min(620px, 94vw);
}

.map-point-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.map-point-readout span {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(30, 144, 255, 0.22);
  border-radius: 4px;
  padding: 9px;
  color: #8fb2d6;
  font-size: 12px;
}

.map-point-readout b {
  color: #d7ecff;
}

#map-device-search {
  height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 4px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.map-device-option-list {
  display: grid;
  gap: 8px;
  max-height: 390px;
  overflow: auto;
}

.map-device-option {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(30, 144, 255, 0.22);
  border-radius: 5px;
  padding: 10px;
  background: rgba(2, 15, 34, 0.72);
  color: #eaf4ff;
  text-align: left;
  cursor: pointer;
}

.map-device-option span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-device-option small {
  color: #8fb2d6;
}

.map-device-option.offline {
  opacity: 0.78;
}

.detail-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 15px 14px 10px;
}

.detail-head .icon {
  color: var(--blue);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.detail-grid span {
  padding: 9px;
  color: #8fb2d6;
  font-size: 12px;
}

.detail-grid b {
  color: #d7ecff;
  font-weight: 500;
}

.live-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 14px 12px;
}

.live-values div {
  display: grid;
  gap: 8px;
  min-height: 62px;
  padding: 11px;
  text-align: center;
}

.live-values strong {
  color: var(--cyan);
  font-size: 20px;
}

.point-detail .chart-shell {
  padding: 0 12px 12px;
}

.map-bottom-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.15fr 1fr;
  gap: 12px;
}

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

.alerts-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.alerts-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 14px;
}

.alert-trend-panel {
  padding: 12px;
}

.alert-trend-svg {
  display: block;
  width: 100%;
  min-height: 190px;
}

.alert-trend-svg line {
  stroke: rgba(120, 170, 220, 0.18);
  stroke-dasharray: 3 5;
}

.alert-trend-svg polyline {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.alert-trend-svg circle {
  fill: var(--red);
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 1.5;
}

.alert-trend-svg text {
  fill: #cfe8ff;
  font-size: 12px;
}

.alert-donut {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.alert-donut-ring {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(3, 20, 44, 0.98) 0 50%, transparent 51%),
    conic-gradient(var(--alert-gradient));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.alert-donut-ring strong {
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
}

.alert-donut-ring span {
  margin-top: 38px;
  color: #cfe8ff;
  font-size: 12px;
}

.alert-donut-legend {
  display: grid;
  gap: 12px;
}

.alert-donut-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #cfe8ff;
  font-size: 13px;
}

.alert-donut-legend b {
  color: #ffffff;
}

.alert-filter {
  grid-template-columns: minmax(150px, 0.7fr) minmax(160px, 0.8fr) minmax(260px, 1.4fr) auto auto;
}

.alert-table tbody tr {
  cursor: pointer;
}

.alert-table tbody tr.selected {
  background: rgba(22, 140, 255, 0.14);
}

.alert-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.alert-type.temperature,
.alert-type.offline {
  color: var(--red);
}

.alert-type.humidity {
  color: var(--blue);
}

.alert-type.water {
  color: var(--cyan);
}

.alert-detail {
  position: sticky;
  top: 86px;
}

.alert-detail-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.alert-detail-body span {
  display: grid;
  gap: 7px;
  min-height: 54px;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 6px;
  padding: 10px;
  background: rgba(2, 17, 38, 0.52);
  color: #8fb2d6;
  font-size: 12px;
}

.alert-detail-body b {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.alert-detail-actions {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.alert-detail-actions .primary-button {
  width: 100%;
}

.alert-detail-actions p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

body.day-theme .alert-trend-svg line {
  stroke: #dfe8f4;
}

body.day-theme .alert-trend-svg text {
  fill: #6f7f92;
}

body.day-theme .alert-donut-ring {
  background:
    radial-gradient(circle, #ffffff 0 50%, transparent 51%),
    conic-gradient(var(--alert-gradient));
  box-shadow: inset 0 0 0 1px #dfe8f4;
}

body.day-theme .alert-table tbody tr.selected {
  background: #eef5ff;
}

.history-grid {
  grid-template-columns: minmax(0, 1fr) 410px;
}

.history-main {
  gap: 12px;
}

.mini-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-list div {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
}

.summary-list .icon {
  width: 32px;
  height: 32px;
}

.summary-list .orange .icon { color: var(--orange); }
.summary-list .blue .icon { color: var(--blue); }
.summary-list .cyan .icon { color: var(--cyan); }

.summary-list span {
  color: color-mix(in srgb, currentColor 70%, #ffffff);
  font-weight: 800;
}

.summary-list b {
  color: #d7ecff;
  font-size: 13px;
  font-weight: 500;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.admin-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.admin-form label,
.check-admin {
  display: grid;
  gap: 7px;
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 700;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 4px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.admin-form input,
.admin-form select {
  height: 38px;
}

.admin-form textarea {
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
}

.admin-form select[multiple],
.dingtalk-config-row select[multiple] {
  height: 92px;
  padding: 8px 10px;
}

.dingtalk-device-panel,
.factory-map-manager-form {
  overflow: visible;
}

.dingtalk-config-form,
.factory-map-manager-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.dingtalk-global-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dingtalk-global-settings label,
.dingtalk-config-row label,
.factory-map-config-row label {
  display: grid;
  gap: 7px;
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 700;
}

.dingtalk-global-settings input,
.dingtalk-config-row input,
.dingtalk-config-row select,
.dingtalk-select-button,
.factory-map-config-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 4px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.dingtalk-global-settings input,
.dingtalk-config-row input,
.dingtalk-select-button,
.factory-map-config-row input {
  height: 38px;
}

.dingtalk-config-row textarea {
  min-height: 78px;
  padding: 9px 11px;
  resize: vertical;
}

.dingtalk-config-list,
.factory-map-config-list {
  display: grid;
  gap: 10px;
}

.dingtalk-config-row {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  padding: 12px;
  background: rgba(2, 17, 38, 0.44);
}

.dingtalk-row-main {
  display: grid;
  grid-template-columns: 94px minmax(160px, 0.8fr) minmax(360px, 1.7fr) minmax(180px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.dingtalk-row-targets {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 118px minmax(150px, 0.55fr) auto;
  gap: 10px;
  align-items: center;
}

.dingtalk-area-select {
  position: relative;
  min-width: 0;
}

.dingtalk-select-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.dingtalk-select-button span {
  color: #8fb2d6;
  font-size: 12px;
  font-weight: 700;
}

.dingtalk-select-button b {
  min-width: 0;
  overflow: hidden;
  color: #eaf4ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dingtalk-area-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 12;
  display: none;
  width: min(360px, 82vw);
  max-height: 240px;
  overflow: auto;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 5px;
  padding: 8px;
  background: rgba(2, 15, 34, 0.98);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.dingtalk-area-select.open .dingtalk-area-menu {
  display: grid;
  gap: 6px;
}

.dingtalk-area-menu .check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 30px;
  border: 0;
  padding: 4px 6px;
  background: transparent;
  font-size: 12px;
}

.dingtalk-area-menu b {
  color: #8fb2d6;
  font-size: 12px;
}

.dingtalk-device-summary {
  display: inline-grid;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 4px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.58);
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 700;
}

.device-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 126px;
  overflow: auto;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 5px;
  padding: 8px;
  background: rgba(2, 15, 34, 0.62);
}

.device-check-grid label {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 26px;
  font-size: 12px;
  font-weight: 500;
}

.device-check-grid input {
  width: 15px;
  height: 15px;
}

.factory-map-config-row {
  display: grid;
  grid-template-columns: 100px minmax(150px, 0.8fr) minmax(260px, 1.2fr) 140px auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  padding: 10px;
  background: rgba(2, 17, 38, 0.44);
}

.factory-map-preview {
  width: 140px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(30, 144, 255, 0.24);
  border-radius: 5px;
  background: rgba(2, 15, 34, 0.72);
}

.factory-map-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-device-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 12px;
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(2, 17, 38, 0.44);
}

.online-device-options > span {
  color: #8fb2d6;
  font-size: 13px;
  font-weight: 800;
}

.online-device-options .check-admin {
  min-height: 30px;
}

.modal-inline-actions,
.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 12px 0;
}

.modal-detail-grid {
  padding: 16px;
}

.check-admin {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-content: center;
  min-height: 38px;
}

.check-admin input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.admin-form button {
  align-self: end;
}

.admin-form p {
  align-self: center;
  margin: 0;
  font-size: 13px;
}

.admin-summary {
  padding: 14px;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.key-grid span {
  display: grid;
  gap: 8px;
  min-height: 70px;
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  padding: 12px;
  background: rgba(6, 34, 72, 0.7);
  color: #8fb2d6;
  font-size: 12px;
}

.key-grid b {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.table-action {
  min-height: 28px;
  border: 1px solid rgba(30, 144, 255, 0.34);
  border-radius: 4px;
  padding: 0 10px;
  background: rgba(5, 34, 72, 0.78);
  color: #cfe8ff;
  cursor: pointer;
}

.table-action .icon {
  width: 14px;
  height: 14px;
}

.table-action:hover {
  border-color: rgba(32, 246, 255, 0.42);
  background: rgba(10, 86, 160, 0.32);
}

.primary-button:disabled,
.outline-button:disabled,
.table-action:disabled {
  cursor: wait;
  opacity: 0.62;
}

.danger-action {
  border-color: rgba(255, 77, 79, 0.45);
  background: rgba(255, 77, 79, 0.14);
  color: #ff8b8d;
}

.muted-action {
  width: 30px;
  padding: 0;
}

.signal-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.signal-summary-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(30, 144, 255, 0.2);
  border-radius: 6px;
  padding: 12px;
  background: rgba(6, 34, 72, 0.7);
}

.signal-summary-head .icon {
  color: var(--cyan);
}

.signal-summary-head span,
.signal-summary p {
  color: var(--muted);
  font-size: 13px;
}

.signal-summary-head strong {
  color: #ffffff;
}

.signal-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.signal-summary-grid span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(2, 17, 38, 0.52);
  color: #cfe8ff;
  font-size: 13px;
}

.signal-summary-grid b {
  color: #ffffff;
  font-size: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 8, 20, 0.62);
  backdrop-filter: blur(8px);
}

.modal-panel {
  width: min(980px, 94vw);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid rgba(30, 144, 255, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 140, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(7, 32, 68, 0.98), rgba(2, 17, 38, 0.98));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  border-bottom: 1px solid rgba(30, 144, 255, 0.22);
  padding: 0 16px;
}

.modal-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.modal-title h2 {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
}

.modal-title button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(30, 144, 255, 0.28);
  border-radius: 4px;
  background: rgba(2, 15, 34, 0.82);
  color: #cfe8ff;
  cursor: pointer;
  font-size: 22px;
}

.device-add-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.device-add-form label {
  display: grid;
  gap: 7px;
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 700;
}

.device-add-form input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.device-add-form select {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.device-add-form p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
}

.modal-table,
.modal-chart {
  padding: 16px;
}

.modal-table table {
  min-width: 760px;
}

.trend-modal {
  width: min(1060px, 96vw);
}

.modal-chart .chart-shell svg {
  min-height: 320px;
}

.signal-modal {
  width: min(760px, 94vw);
}

.picker-modal {
  width: min(720px, 94vw);
}

.picker-tools,
.picker-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}

.picker-tools input,
.picker-tools select {
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(30, 144, 255, 0.32);
  border-radius: 4px;
  padding: 0 11px;
  background: rgba(2, 15, 34, 0.9);
  color: #eaf4ff;
}

.picker-tools input {
  flex: 1;
}

.picker-tools select {
  flex: 0 0 132px;
}

.picker-scope {
  margin: 10px 16px 0;
  color: #8fb2d6;
  font-size: 13px;
}

.picker-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px 0;
  max-height: 430px;
  overflow: auto;
}

.picker-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(30, 144, 255, 0.22);
  border-radius: 6px;
  padding: 10px;
  background: rgba(2, 15, 34, 0.58);
  color: #eaf4ff;
}

.picker-row input {
  width: 16px;
  height: 16px;
}

.picker-row span {
  display: grid;
  gap: 3px;
}

.picker-row small {
  color: #8fb2d6;
}

.picker-pager {
  justify-content: flex-end;
  color: #8fb2d6;
  font-size: 13px;
}

.picker-pager span {
  margin-right: auto;
}

.signal-report {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.signal-score {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(30, 144, 255, 0.22);
  border-radius: 6px;
  padding: 14px;
  background: rgba(6, 34, 72, 0.7);
}

.signal-score strong {
  color: #ffffff;
  font-size: 24px;
}

.signal-score span {
  color: #cfe8ff;
}

.signal-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.signal-report-grid span {
  display: grid;
  gap: 8px;
  min-height: 64px;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 6px;
  padding: 10px;
  background: rgba(2, 17, 38, 0.52);
  color: #8fb2d6;
  font-size: 12px;
}

.signal-report-grid b {
  color: #ffffff;
  overflow-wrap: anywhere;
}

.signal-report p {
  margin: 0;
  border: 1px solid rgba(30, 144, 255, 0.18);
  border-radius: 6px;
  padding: 12px;
  background: rgba(2, 17, 38, 0.52);
  color: #d7ecff;
  line-height: 1.6;
}

.empty-admin {
  min-height: 170px;
  display: grid;
  place-items: center;
  color: #8fb2d6;
}

.loading {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: #d7ecff;
}

.loading.error {
  color: var(--red);
}

.nav-collapsed .app-shell {
  grid-template-columns: 76px minmax(1240px, 1fr);
}

.nav-collapsed .brand strong,
.nav-collapsed .nav span,
.nav-collapsed .sidebar-copy,
.nav-collapsed .plant-visual {
  display: none;
}

.nav-collapsed .nav a {
  justify-content: center;
  padding: 0;
}

.nav-collapsed .brand {
  justify-content: center;
}

@media (max-width: 1500px) {
  body {
    min-width: 1180px;
  }

  .app-shell,
  .nav-collapsed .app-shell {
    grid-template-columns: 212px minmax(960px, 1fr);
  }

  .stats-row.six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-grid,
  .device-page-grid,
  .history-grid,
  .map-layout,
  .map-bottom-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell,
  .nav-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .title-frame {
    justify-content: flex-start;
  }

  .title-frame h1 {
    min-width: 0;
    padding: 0;
    text-align: left;
  }

  .title-frame h1::before,
  .title-frame h1::after {
    display: none;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .content {
    padding: 12px;
  }

  .stats-row.six,
  .area-grid,
  .quick-grid,
  .mini-chart-grid,
  .right-rail,
  .map-bottom-grid,
  .health-layout,
  .health-cards,
  .live-values,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .history-filter .filter-bar,
  .map-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1500px) {
  body {
    min-width: 0;
  }

  .app-shell,
  .nav-collapsed .app-shell {
    grid-template-columns: 212px minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }

  .stats-row.six {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .map-layout,
  .alerts-layout,
  .history-grid,
  .admin-grid.three {
    grid-template-columns: 1fr;
  }

  .alerts-chart-grid,
  .map-bottom-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .factory-map {
    height: 62vh;
    min-height: 460px;
  }
}

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

  .sidebar {
    position: relative;
    z-index: 30;
    height: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 12px;
  }

  .brand {
    grid-template-columns: 44px 1fr auto;
  }

  .nav {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .plant-visual,
  .sidebar-copy {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    padding: 12px;
  }

  .title-frame {
    justify-content: flex-start;
  }

  .title-frame h1 {
    min-width: 0;
    padding: 0;
    text-align: left;
    font-size: 24px;
  }

  .title-frame h1::before,
  .title-frame h1::after {
    display: none;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .content {
    padding: 12px;
  }
}

@media (max-width: 900px) {
  .stats-row.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    grid-template-columns: 40px 1fr;
    min-height: 82px;
    padding: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
  }

  .stat-card span {
    font-size: 12px;
    white-space: normal;
  }

  .stat-card strong {
    margin-top: 4px;
    font-size: 22px;
  }

  .panel-title {
    min-height: 44px;
  }

  .panel-title h2 {
    font-size: 16px;
  }

  .map-board {
    overflow: visible;
  }

  .map-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .map-toolbar select,
  .map-toolbar input {
    grid-column: 1 / -1;
    width: 100%;
  }

  .map-toolbar button {
    width: 100%;
    min-height: 38px;
    justify-content: center;
  }

  .map-distribution-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: none;
  }

  .map-distribution-filters::-webkit-scrollbar {
    display: none;
  }

  .map-distribution-filters label {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .factory-map {
    height: 58vh;
    min-height: 360px;
    max-height: 620px;
  }

  .map-marker {
    width: 38px;
    height: 38px;
  }

  .map-marker b {
    top: 39px;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
  }

  .map-marker.selected {
    z-index: 6;
    outline: 2px solid rgba(255, 255, 255, 0.78);
    outline-offset: 3px;
  }

  .map-marker.selected b,
  .map-marker:focus-visible b {
    display: block;
  }

  .map-tooltip {
    width: min(240px, 76vw);
  }

  .point-detail {
    overflow: visible;
  }

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

  .point-detail .chart-shell {
    overflow-x: auto;
  }

  .chart-tooltip {
    max-width: min(300px, 82vw);
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 760px;
  }

  .device-table th:last-child,
  .device-table td:last-child {
    position: static;
    box-shadow: none;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-panel {
    width: min(100%, 680px);
    max-height: calc(100vh - 24px);
  }

  .device-add-form,
  .admin-form,
  .dingtalk-global-settings,
  .dingtalk-config-row,
  .dingtalk-row-main,
  .dingtalk-row-targets,
  .factory-map-config-row,
  .signal-report-grid {
    grid-template-columns: 1fr;
  }

  .map-fullscreen {
    inset: 0;
    border-radius: 0;
  }

  .map-fullscreen .factory-map {
    height: calc(100vh - 160px);
    min-height: 360px;
  }
}

@media (max-width: 600px) {
  body {
    background: #f4f7fb;
  }

  body:not(.day-theme) {
    background: #020814;
  }

  .sidebar {
    padding: 10px;
  }

  .brand {
    grid-template-columns: 40px 1fr 34px;
    gap: 8px;
  }

  .brand-badge {
    width: 40px;
    height: 40px;
  }

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

  .nav a {
    min-height: 36px;
    border-radius: 5px;
    font-size: 13px;
  }

  .nav .icon {
    width: 17px;
    height: 17px;
  }

  .topbar {
    position: relative;
    min-height: 0;
  }

  .title-frame h1 {
    font-size: 22px;
  }

  .clock,
  .weather {
    font-size: 12px;
  }

  .weather {
    border-left: 0;
    padding-left: 0;
  }

  .outline-button,
  .primary-button,
  .table-action,
  .map-toolbar button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .theme-switch {
    width: 46px;
    min-width: 46px;
    min-height: 30px;
    padding: 0 5px;
  }

  .content {
    gap: 10px;
    padding: 10px;
  }

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

  .stat-card {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 78px;
    padding: 9px;
  }

  .stat-icon {
    width: 30px;
    height: 30px;
  }

  .stat-card strong {
    font-size: 18px;
  }

  .stat-card small {
    margin-top: 3px;
    font-size: 11px;
  }

  .map-toolbar {
    grid-template-columns: 1fr 1fr;
    padding: 8px;
  }

  .map-distribution-filters {
    padding: 8px;
  }

  .factory-map {
    height: 52vh;
    min-height: 320px;
  }

  .zoom-control {
    right: 8px;
    bottom: 44px;
  }

  .zoom-control button {
    width: 38px;
    height: 38px;
  }

  .scale {
    right: 56px;
    bottom: 18px;
  }

  .detail-head,
  .detail-grid,
  .live-values,
  .point-detail .chart-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .detail-grid,
  .live-values,
  .map-point-readout {
    grid-template-columns: 1fr;
  }

  .map-bottom-grid,
  .alerts-chart-grid,
  .admin-grid,
  .admin-grid.three,
  .dingtalk-global-settings,
  .dingtalk-config-row,
  .dingtalk-row-main,
  .dingtalk-row-targets,
  .factory-map-config-row,
  .history-grid,
  .mini-chart-grid,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .pager {
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .map-context-backdrop .map-device-picker-modal {
    top: 10px !important;
    left: 10px !important;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .map-device-option-list,
  .picker-list {
    max-height: 52vh;
  }
}
