:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8dee6;
  --line-strong: #bac4cf;
  --forest: #18543f;
  --forest-2: #123f31;
  --moss: #3d7c55;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c24136;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

#overview,
#nodes,
#packet-section {
  scroll-margin-top: 18px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

button {
  cursor: pointer;
}

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

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px;
  background: #111827;
  color: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #f8fafc;
  color: #123f31;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.16);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  overflow: visible;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-block strong {
  font-size: 15px;
  letter-spacing: 0;
}

.rail-nav {
  display: grid;
  gap: 4px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

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

.rail-nav a.active {
  box-shadow: inset 3px 0 0 #22c55e;
}

.dashboard {
  display: grid;
  gap: 14px;
  min-width: 0;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px clamp(16px, 2vw, 28px) 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions,
.command-row,
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-button,
.ghost-button,
.command-button,
.tab-button,
.inline-button {
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: var(--forest);
  color: #ffffff;
}

.app-install-button {
  color: #1f2937;
  background: #f8fafc;
  border-color: var(--line);
}

.app-install-button.ready {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

.app-install-button[hidden] {
  display: none;
}

.ghost-button,
.command-button,
.tab-button,
.inline-button {
  background: #f8fafc;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button:hover,
.command-button:hover,
.tab-button:hover,
.inline-button:hover {
  border-color: #9cb0a7;
}

.command-button {
  flex: 1;
  background: #ffffff;
}

.command-button.danger {
  color: var(--red);
}

.tab-button,
.inline-button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.tab-button.active {
  background: var(--forest);
  color: #ffffff;
  border-color: var(--forest);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.metric-card {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px 14px;
  border-top: 3px solid #8ea69a;
}

.metric-card.online {
  border-top-color: var(--moss);
}

.metric-card.alert,
.metric-card.risk.high {
  border-top-color: var(--red);
}

.metric-card.risk.medium {
  border-top-color: var(--amber);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 24px;
  line-height: 1;
}

.metric-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.primary-grid,
.secondary-grid,
.ops-grid,
.tertiary-grid {
  display: grid;
  gap: 14px;
}

.primary-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.72fr);
}

.map-first-grid {
  grid-template-columns: 1fr;
}

.map-first-grid .map-panel,
.map-first-grid .command-panel {
  grid-column: 1 / -1;
}

.secondary-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
}

.ops-grid,
.tertiary-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.log-only-grid .log-panel {
  grid-column: 1 / -1;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.panel-heading.compact {
  min-height: 58px;
}

.status-pill,
.state-pill,
.queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 4px;
  padding: 0 10px;
  background: #ecfdf3;
  color: #166534;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.warn,
.state-pill.warn,
.queue-count.warn {
  background: #fff4dc;
  color: #855300;
}

.status-pill.danger,
.state-pill.danger,
.queue-count.danger {
  background: #ffe9e5;
  color: #993126;
}

.field-map {
  position: relative;
  min-height: min(70vh, 720px);
  margin: 12px 16px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
  background-color: #e3e8e4;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.72) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
}

.map-toolbar {
  display: grid;
  grid-template-columns: 140px minmax(240px, 1fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) auto auto;
  gap: 10px 12px;
  align-items: end;
  padding: 12px 16px 0;
}

.map-toolbar.local-mode .tile-field,
.map-toolbar.local-mode .amap-field,
.map-toolbar.leaflet-mode .amap-field,
.map-toolbar.amap-mode .tile-field {
  display: none;
}

.map-toolbar.local-mode {
  grid-template-columns: 140px auto auto;
}

.map-toolbar.leaflet-mode,
.map-toolbar.amap-mode {
  grid-template-columns: 140px minmax(240px, 1fr) auto auto;
}

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

.map-toolbar input,
.map-toolbar select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.map-status {
  margin: 8px 16px 0;
  padding: 8px 10px;
  border: 1px solid #dce2e8;
  border-radius: 4px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.map-status.warn {
  border-color: #f1d598;
  background: #fff8e8;
  color: #7d540f;
}

.map-status.danger {
  border-color: #efb3aa;
  background: #fff1ee;
  color: #923126;
}

.leaflet-container,
.amap-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  min-height: 100%;
  background: #dfe9de;
}

.field-map.leaflet-active,
.field-map.amap-active {
  background: #dfe9de;
}

.field-map.leaflet-active .leaflet-container,
.field-map.amap-active .amap-container {
  display: block;
}

.field-map.leaflet-active .terrain-band,
.field-map.leaflet-active .range-ring,
.field-map.leaflet-active .base-marker,
.field-map.leaflet-active .node-marker,
.field-map.amap-active .terrain-band,
.field-map.amap-active .range-ring,
.field-map.amap-active .base-marker,
.field-map.amap-active .node-marker,
.field-map.amap-active .link-line,
.field-map.amap-active .hot-zone {
  display: none;
}

.leaflet-container .leaflet-control-attribution {
  font-size: 10px;
}

.osm-tile-layer,
.osm-overlay-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.osm-tile-layer {
  z-index: 1;
  background: #dfe9de;
}

.leaflet-container.tile-fallback .osm-tile-layer {
  background-color: #e6ece8;
  background-image:
    linear-gradient(28deg, transparent 0 42%, rgba(148, 163, 184, 0.46) 42% 43%, transparent 43%),
    linear-gradient(151deg, transparent 0 31%, rgba(100, 116, 139, 0.32) 31% 32%, transparent 32%),
    linear-gradient(92deg, transparent 0 55%, rgba(255, 255, 255, 0.78) 55% 57%, transparent 57%),
    linear-gradient(rgba(255, 255, 255, 0.58) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.58) 1px, transparent 1px);
  background-size: cover, cover, cover, 54px 54px, 54px 54px;
}

.leaflet-container.tile-fallback .osm-tile-layer::before,
.leaflet-container.tile-fallback .osm-tile-layer::after {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(23, 53, 46, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.leaflet-container.tile-fallback .osm-tile-layer::before {
  content: "离线工程底图";
  left: 16px;
  top: 14px;
}

.leaflet-container.tile-fallback .osm-tile-layer::after {
  content: "500 m 现场投影";
  right: 14px;
  bottom: 34px;
}

.leaflet-container.tile-fallback .osm-tile {
  opacity: 0;
}

.osm-overlay-layer {
  z-index: 2;
  pointer-events: none;
}

.osm-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
}

.osm-overlay-layer .link-line,
.osm-overlay-layer .hot-zone,
.osm-overlay-layer .leaflet-base-pin,
.osm-overlay-layer .leaflet-node-pin,
.osm-range-circle {
  position: absolute;
}

.osm-overlay-layer .leaflet-base-pin,
.osm-overlay-layer .leaflet-node-pin {
  z-index: 5;
  pointer-events: auto;
}

.osm-range-circle {
  z-index: 2;
  border: 2px solid rgba(36, 84, 70, 0.3);
  border-radius: 50%;
  background: rgba(94, 139, 100, 0.08);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.osm-hot-zone {
  z-index: 3;
}

.osm-attribution {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 4;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.88);
  color: #355047;
  font-size: 10px;
  text-decoration: none;
}

.leaflet-div-icon.ep-base-icon,
.leaflet-div-icon.ep-node-icon {
  border: 0;
  background: transparent;
}

.leaflet-base-pin,
.leaflet-node-pin,
.amap-base-pin,
.amap-node-pin {
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.18);
  color: #ffffff;
  font-weight: 900;
}

.leaflet-base-pin,
.amap-base-pin {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0;
}

.base-house-icon {
  position: absolute;
  inset: 2px;
  z-index: 6;
  width: 28px;
  height: 28px;
  overflow: visible;
}

.base-house-icon path {
  fill: #17352e;
  stroke: #ffffff;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.base-marker::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-right: 0;
  border-bottom: 0;
  background: var(--forest-2);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.2);
  transform: rotate(45deg);
}

.base-marker::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: 2px;
  z-index: 3;
  width: 22px;
  height: 17px;
  border: 2px solid #ffffff;
  border-top: 0;
  border-radius: 2px 2px 6px 6px;
  background:
    linear-gradient(90deg, transparent 0 8px, rgba(255, 255, 255, 0.36) 8px 12px, transparent 12px),
    var(--forest-2);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.2);
}

.leaflet-node-pin,
.amap-node-pin {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--moss);
  font-size: 11px;
}

.leaflet-node-pin.warn,
.amap-node-pin.warn {
  background: var(--amber);
}

.leaflet-node-pin.danger,
.amap-node-pin.danger {
  background: var(--red);
}

.leaflet-node-pin.offline,
.amap-node-pin.offline {
  background: #6f7d77;
}

.terrain-band {
  position: absolute;
  height: 130px;
  border-radius: 999px;
  opacity: 0.55;
  filter: blur(0.2px);
  transform: rotate(-12deg);
}

.band-a {
  left: -8%;
  top: 16%;
  width: 48%;
  background: rgba(94, 139, 100, 0.22);
}

.band-b {
  right: -14%;
  top: 42%;
  width: 58%;
  background: rgba(36, 84, 70, 0.18);
}

.band-c {
  left: 24%;
  bottom: -8%;
  width: 54%;
  background: rgba(40, 95, 146, 0.12);
}

.range-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 2px solid rgba(23, 53, 46, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ring-inner {
  width: 300px;
  height: 300px;
}

.ring-outer {
  width: 520px;
  height: 520px;
}

.base-marker,
.node-marker {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.18);
}

.base-marker {
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: transparent;
}

.base-marker strong,
.base-marker span {
  display: none;
}

.base-marker span {
  color: #c9dbd4;
  font-size: 12px;
}

.node-marker {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--moss);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.node-marker.warn {
  background: var(--amber);
}

.node-marker.danger {
  background: var(--red);
}

.node-marker.offline {
  background: #6f7d77;
}

.node-marker.selected {
  outline: 5px solid rgba(40, 95, 146, 0.24);
}

.link-line {
  position: absolute;
  z-index: 2;
  height: 2px;
  background: rgba(36, 84, 70, 0.34);
  transform-origin: left center;
  pointer-events: none;
}

.link-line.warn {
  background: rgba(173, 114, 31, 0.48);
}

.link-line.danger {
  background: rgba(189, 63, 54, 0.58);
}

.hot-zone {
  position: absolute;
  z-index: 1;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(194, 65, 54, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.command-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(400px, 1.2fr) minmax(300px, 0.9fr);
  align-items: start;
  gap: 12px;
  padding-bottom: 14px;
}

.command-panel .panel-heading {
  grid-column: 1 / -1;
}

.command-block,
.selected-node {
  margin: 0;
}

.command-actions {
  margin-left: 16px;
}

.selected-node {
  margin-right: 16px;
}

.command-block,
.selected-node {
  min-height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.block-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.command-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.command-help-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.command-help-grid span,
.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.command-help-grid span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
}

.command-help-grid strong {
  color: var(--forest-2);
}

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

.settings-form .wide-field {
  grid-column: 1 / -1;
}

.settings-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-form input,
.settings-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.selected-node {
  display: grid;
  gap: 12px;
}

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

.ai-panel {
  grid-column: 1 / -1;
}

.ai-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px 0;
}

.ai-summary article {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
}

.ai-summary span,
.ai-summary small {
  color: var(--muted);
  font-size: 12px;
}

.ai-summary strong {
  color: var(--forest-2);
  font-size: 20px;
  line-height: 1.2;
}

.ai-panel .health-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.selected-node h3 {
  margin: 0;
  font-size: 16px;
}

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

.node-stats div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
}

.node-stats span {
  color: var(--muted);
  font-size: 12px;
}

.node-stats strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: #334155;
  background: #f8fafc;
  font-weight: 750;
}

td {
  color: var(--ink);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected-row {
  background: #f1f5f9;
}

.battery-bar {
  width: 84px;
  height: 8px;
  border-radius: 999px;
  background: #dfe8e2;
  overflow: hidden;
}

.battery-bar span {
  display: block;
  height: 100%;
  background: var(--moss);
}

.battery-bar.low span {
  background: var(--amber);
}

.battery-value,
.small-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.alert-list,
.log-list,
.health-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
}

.alert-list {
  max-height: 452px;
  overflow-y: auto;
}

.alert-item,
.log-item,
.health-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 4px;
  background: #ffffff;
}

.alert-item.danger,
.log-item.danger,
.health-item.danger {
  border-left-color: var(--red);
}

.alert-item.normal,
.log-item.normal,
.health-item.normal {
  border-left-color: var(--moss);
}

.alert-item strong,
.log-item strong,
.health-item strong {
  font-size: 14px;
}

.alert-meta,
.log-meta,
.health-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 12px;
}

.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #afbeb5;
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
}

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

.deploy-grid article {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.deploy-grid span,
.deploy-grid small {
  color: var(--muted);
  font-size: 12px;
}

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

.hardware-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(260px, 1fr);
  gap: 16px;
  padding: 18px;
}

.hardware-body img {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.module-chain {
  display: grid;
  gap: 10px;
}

.module-chain article {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.module-chain strong {
  color: var(--forest-2);
}

.module-chain span {
  color: var(--muted);
  font-size: 13px;
}

.log-list {
  max-height: 342px;
  overflow-y: auto;
}

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

  .secondary-grid,
  .ops-grid,
  .tertiary-grid {
    grid-template-columns: 1fr;
  }

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

  .command-actions,
  .selected-node {
    margin-left: 16px;
    margin-right: 16px;
  }

  .settings-form,
  .ai-summary,
  .ai-panel .health-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .primary-grid {
    grid-template-columns: 1fr;
  }
}

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

  .side-rail {
    position: static;
    height: auto;
    padding: 12px 16px;
  }

  .brand-block,
  .rail-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .rail-nav a {
    flex: 0 0 auto;
  }

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

  .top-actions,
  .command-row,
  .filter-tabs {
    width: 100%;
    flex-wrap: wrap;
  }

  .primary-button,
  .ghost-button,
  .command-button,
  .tab-button {
    flex: 1 1 auto;
  }

  .metric-strip,
  .deploy-grid,
  .hardware-body {
    grid-template-columns: 1fr;
  }

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

  .map-toolbar.local-mode,
  .map-toolbar.leaflet-mode,
  .map-toolbar.amap-mode {
    grid-template-columns: 1fr 1fr;
  }

  .map-toolbar .tile-field,
  .map-toolbar .key-field {
    grid-column: span 2;
  }

  .field-map {
    min-height: 380px;
    margin: 12px;
  }

  .ring-outer {
    width: 430px;
    height: 430px;
  }

  .hardware-body img {
    max-height: 220px;
  }

  .module-chain article {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dashboard {
    padding: 16px 12px 28px;
  }

  h1 {
    font-size: 26px;
  }

  .metric-card strong {
    font-size: 26px;
  }

  .node-stats {
    grid-template-columns: 1fr;
  }

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

  .map-toolbar.local-mode,
  .map-toolbar.leaflet-mode,
  .map-toolbar.amap-mode {
    grid-template-columns: 1fr;
  }

  .map-toolbar .tile-field,
  .map-toolbar .key-field {
    grid-column: auto;
  }

}
