:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #667480;
  --line: #dbe4ea;
  --blue: #2d6d8d;
  --green: #4f9d82;
  --amber: #b99748;
  --red: #b95a55;
  --shadow: 0 16px 34px rgba(26, 43, 63, 0.1);
  --hud-bg: #07101b;
  --hud-panel: rgba(10, 24, 36, 0.94);
  --hud-panel-2: rgba(13, 31, 45, 0.96);
  --hud-line: rgba(118, 157, 174, 0.4);
  --hud-cyan: #86c6d8;
  --hud-green: #79bd9a;
  --hud-warn: #d5b46b;
  --hud-red: #cc756f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

body.dashboard-mode {
  background:
    radial-gradient(circle at 50% 4%, rgba(37, 83, 105, 0.5), transparent 34%),
    linear-gradient(180deg, #07121d, #03070c 68%);
  overflow: hidden;
}

body.dashboard-mode .sidebar {
  display: none;
}

body.dashboard-mode main {
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 248px;
  padding: 22px 16px;
  background: #102033;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 4px 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2f7f71;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #aab8c8;
  margin-top: 4px;
  font-size: 12px;
}

.nav-btn {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #c6d2df;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}

.nav-btn.active,
.nav-btn:hover {
  background: #1b3654;
  color: #fff;
}

main {
  flex: 1;
  padding: 24px;
  overflow: auto;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-header {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.command-screen {
  width: 100%;
  height: 100vh;
  min-height: 0;
  padding: clamp(4px, 0.35vw, 7px);
  color: #dff7ff;
  background:
    linear-gradient(90deg, rgba(134, 198, 216, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(213, 180, 107, 0.035) 1px, transparent 1px);
  background-size: 54px 54px;
}

.command-header {
  height: clamp(48px, 5.2vh, 64px);
  display: grid;
  grid-template-columns: minmax(260px, 24vw) 1fr minmax(260px, 24vw);
  align-items: center;
  gap: clamp(8px, 1vw, 18px);
  border: 1px solid var(--hud-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 34, 50, 0.98), rgba(6, 16, 28, 0.98));
  box-shadow: inset 0 0 26px rgba(134, 198, 216, 0.1), 0 12px 30px rgba(0, 0, 0, 0.2);
}

.command-header h1 {
  justify-self: center;
  color: #fff;
  font-size: clamp(20px, 1.5vw, 30px);
  text-shadow: 0 0 10px rgba(134, 198, 216, 0.4);
  white-space: nowrap;
}

.project-name {
  padding-left: clamp(12px, 1.2vw, 24px);
  color: #a9bdc8;
  font-weight: 700;
  font-size: clamp(12px, 0.78vw, 14px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: clamp(10px, 1.1vw, 22px);
  color: #b6c8d2;
  font-weight: 700;
  font-size: clamp(12px, 0.8vw, 14px);
}

.mini-btn,
.action-btn {
  border: 1px solid #41667b;
  border-radius: 6px;
  background: #102536;
  color: #eaf7fb;
  cursor: pointer;
}

.mini-btn {
  padding: 6px 10px;
}

.command-layout {
  display: grid;
  grid-template-columns: minmax(220px, 18fr) minmax(560px, 64fr) minmax(220px, 18fr);
  gap: clamp(4px, 0.32vw, 6px);
  height: calc(100vh - clamp(48px, 5.2vh, 64px) - (clamp(4px, 0.32vw, 6px) * 3));
  margin-top: clamp(4px, 0.32vw, 6px);
  overflow: hidden;
  align-items: stretch;
}

.screen-col,
.screen-center {
  display: grid;
  gap: clamp(4px, 0.32vw, 6px);
  min-width: 0;
  min-height: 0;
  height: auto !important;
  max-height: none;
  overflow: hidden;
  align-self: stretch;
}

.left-col {
  grid-template-rows: minmax(0, 0.68fr) minmax(0, 1.28fr) minmax(0, 1.4fr);
}

.right-col {
  grid-template-rows: minmax(0, 0.9fr) minmax(0, 0.66fr) minmax(0, 0.9fr) minmax(0, 1.14fr);
}

.screen-center {
  grid-template-rows: minmax(0, 3.15fr) minmax(0, 0.5fr) minmax(0, 0.78fr);
}

.screen-center .map-panel {
  order: 1;
}

.screen-center > .hud-panel:nth-child(3) {
  order: 2;
}

.screen-center .chain-panel {
  order: 3;
}

.hud-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: clamp(6px, 0.48vw, 10px);
  border: 1px solid var(--hud-line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--hud-panel-2), var(--hud-panel));
  box-shadow: inset 0 0 22px rgba(134, 198, 216, 0.06);
}

.hud-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 30px;
  background: linear-gradient(180deg, rgba(134, 198, 216, 0.13), transparent);
  pointer-events: none;
}

.hud-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  text-align: center;
  color: #f0f8fb;
  font-size: clamp(12px, 0.76vw, 15px);
  line-height: 1.35;
  text-shadow: 0 0 8px rgba(134, 198, 216, 0.34);
}

.panel-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
  text-align: left;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.kpi-strip div {
  padding: 8px;
  border: 1px solid rgba(134, 198, 216, 0.28);
  border-radius: 7px;
  background: rgba(12, 34, 49, 0.72);
}

.kpi-strip span,
.metric-item small,
.method-item small,
.model-item span,
.cmd-alert time,
.alert-meta span {
  color: #a9bbc4;
  font-size: 12px;
}

.kpi-strip strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: clamp(23px, 1.55vw, 34px);
  line-height: 1;
}

.dual-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100% - 66px);
  min-height: 0;
}

.gauge {
  width: 100%;
  height: 100%;
  min-height: 110px;
}

.map-panel {
  padding-bottom: 40px;
}

.county-map {
  height: calc(100% - 42px);
  min-height: 0;
  border: 1px solid rgba(134, 198, 216, 0.22);
  border-radius: 6px;
  overflow: hidden;
  background: #07101b;
}

.amap-container {
  background: #07101b;
  color: #edf5f7;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.amap-layers {
  filter: saturate(0.92) brightness(0.92) contrast(1.08);
}

.amap-logo,
.amap-copyright {
  display: none;
}

.eco-marker {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(134, 198, 216, 0.6);
}

.eco-marker::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.45;
}

.eco-marker.warning::after {
  animation: pulse 1.5s infinite;
}

.eco-marker span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.eco-marker.high {
  color: var(--hud-red);
  background: var(--hud-red);
}

.eco-marker.mid {
  color: var(--hud-warn);
  background: var(--hud-warn);
}

.eco-marker.low {
  color: var(--hud-cyan);
  background: var(--hud-cyan);
}

@keyframes pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.town-label {
  box-sizing: border-box;
  min-width: 54px;
  padding: 2px 7px;
  border: 1px solid rgba(134, 198, 216, 0.35);
  border-radius: 3px;
  background: rgba(3, 16, 27, 0.68);
  color: #f6fbff;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  text-shadow: 0 0 5px #00111f, 0 0 10px #00111f;
  white-space: nowrap;
}

.village-dot {
  position: relative;
  width: 14px;
  height: 14px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(6, 21, 33, 0.72);
  box-shadow: 0 0 10px rgba(134, 198, 216, 0.7);
  cursor: pointer;
}

.village-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 7px;
  background: rgba(255, 255, 255, 0.68);
  transform: translateX(-50%);
}

.village-dot i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hud-cyan);
  transform: translate(-50%, -50%);
}

.village-dot.high {
  box-shadow: 0 0 10px rgba(204, 117, 111, 0.7);
}

.village-dot.high i {
  background: var(--hud-red);
}

.village-dot.mid {
  box-shadow: 0 0 10px rgba(213, 180, 107, 0.65);
}

.village-dot.mid i {
  background: var(--hud-warn);
}

.village-popup {
  min-width: 210px;
}

.amap-eco-popup {
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--hud-cyan);
  border-radius: 6px;
  background: rgba(8, 18, 30, 0.97);
  color: #edf5f7;
  box-shadow: 0 0 16px rgba(134, 198, 216, 0.22);
  font-size: 12px;
  line-height: 1.55;
}

.amap-eco-popup strong {
  display: block;
  margin-bottom: 6px;
  color: #fff5cf;
  font-size: 13px;
}

.amap-eco-popup p {
  margin: 2px 0;
}

.amap-controls,
.amap-scalecontrol {
  filter: invert(1) hue-rotate(165deg) saturate(0.7);
  opacity: 0.78;
}

.map-legend,
.map-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #b7c9d2;
  font-size: 12px;
}

.map-status {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 10px;
  justify-content: center;
  padding: 6px;
  border: 1px solid rgba(134, 198, 216, 0.28);
  border-radius: 7px;
  background: rgba(4, 13, 22, 0.72);
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
}

.dot.high {
  background: var(--hud-red);
}

.dot.mid {
  background: var(--hud-warn);
}

.dot.low {
  background: var(--hud-cyan);
}

.legal-chain {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  height: calc(100% - 30px);
}

.chain-node {
  position: relative;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(134, 198, 216, 0.3);
  border-radius: 8px;
  background: rgba(12, 34, 49, 0.78);
}

.chain-node::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 8px;
  border-top: 2px solid var(--hud-cyan);
}

.chain-node:last-child::after {
  display: none;
}

.chain-node strong {
  display: block;
  color: var(--hud-cyan);
  font-size: clamp(11px, 0.68vw, 13px);
}

.chain-node span {
  display: block;
  margin: 2px 0;
  color: #fff;
  font-size: clamp(15px, 0.95vw, 20px);
  font-weight: 800;
}

.chain-node small {
  color: #a8bbc4;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
}

.cmd-alerts,
.method-list,
.model-list,
.metric-list {
  display: grid;
  gap: 8px;
  height: auto;
  min-height: 0;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(134, 198, 216, 0.48) rgba(5, 18, 30, 0.7);
}

.cmd-alert {
  padding: 8px;
  min-height: 0;
  border: 1px solid rgba(134, 198, 216, 0.26);
  border-left: 4px solid var(--hud-warn);
  border-radius: 8px;
  background: rgba(11, 29, 43, 0.9);
}

.cmd-alert.high {
  border-left-color: var(--hud-red);
  box-shadow: inset 0 0 18px rgba(204, 117, 111, 0.08);
}

.cmd-alert.done {
  border-left-color: var(--hud-green);
}

.alert-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.level {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(213, 180, 107, 0.18);
  color: #ffe6a0;
  font-size: 12px;
  white-space: nowrap;
}

.cmd-alert.high .level {
  background: rgba(204, 117, 111, 0.2);
  color: #ffd5d1;
}

.cmd-alert strong,
.method-item strong,
.model-item strong {
  color: #fff;
  font-size: 13px;
}

.cmd-alert h3 {
  margin: 6px 0 3px;
  color: #eaf7fb;
  font-size: 13px;
}

.cmd-alert p {
  margin: 0;
  color: #bdcdd5;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.alert-meta span {
  padding: 4px 6px;
  border: 1px solid rgba(134, 198, 216, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.resolved-pill {
  border: 1px solid rgba(121, 189, 154, 0.35);
  border-radius: 999px;
  padding: 5px 9px;
  color: #bce7cf;
  font-size: 12px;
  white-space: nowrap;
}

.method-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(134, 198, 216, 0.22);
  border-radius: 8px;
  background: rgba(10, 31, 45, 0.78);
}

.method-item > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(134, 198, 216, 0.14);
  color: var(--hud-cyan);
  font-weight: 800;
}

.method-item p,
.model-item p {
  margin: 3px 0;
  color: #bdcdd5;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-list {
  grid-template-columns: 1fr 1fr;
  align-content: start;
}

.model-item {
  padding: 8px;
  border: 1px solid rgba(134, 198, 216, 0.22);
  border-radius: 8px;
  background: rgba(10, 31, 45, 0.78);
}

.model-item span {
  display: inline-block;
  margin-top: 4px;
  color: var(--hud-warn);
}

.screen-table-wrap {
  overflow: hidden;
  height: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(134, 198, 216, 0.48) rgba(5, 18, 30, 0.7);
}

.cmd-alerts::-webkit-scrollbar,
.method-list::-webkit-scrollbar,
.model-list::-webkit-scrollbar,
.metric-list::-webkit-scrollbar,
.screen-table-wrap::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.cmd-alerts::-webkit-scrollbar-track,
.method-list::-webkit-scrollbar-track,
.model-list::-webkit-scrollbar-track,
.metric-list::-webkit-scrollbar-track,
.screen-table-wrap::-webkit-scrollbar-track {
  background: rgba(5, 18, 30, 0.7);
}

.cmd-alerts::-webkit-scrollbar-thumb,
.method-list::-webkit-scrollbar-thumb,
.model-list::-webkit-scrollbar-thumb,
.metric-list::-webkit-scrollbar-thumb,
.screen-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(134, 198, 216, 0.48);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.screen-table {
  min-width: 0;
  table-layout: fixed;
  color: #dcebf0;
}

.screen-table th,
.screen-table td {
  vertical-align: top;
}

th,
td {
  padding: 6px 9px;
  border-bottom: 1px solid rgba(122, 156, 170, 0.22);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #b4c8d1;
  font-weight: 600;
  background: rgba(134, 198, 216, 0.09);
}

.metric-item {
  display: grid;
  grid-template-columns: minmax(48px, 0.65fr) minmax(70px, 1fr) minmax(52px, 0.7fr);
  align-items: center;
  gap: 6px;
  color: #dcebf0;
  font-size: 13px;
  min-height: 0;
}

.metric-item strong,
.metric-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-item .bar {
  height: 10px;
  border-radius: 999px;
  background: #142b3a;
  overflow: hidden;
}

.metric-item .bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hud-cyan), #9fb3c1);
}

.metric-list.compact .metric-item {
  grid-template-columns: 1fr minmax(62px, 4.2vw) minmax(42px, 3.2vw);
}

.small-chart {
  height: calc(100% - 30px);
  min-height: 120px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e8eef5;
  color: #234;
  white-space: nowrap;
}

.badge.high,
.badge.已超时 {
  background: #fde8e7;
  color: var(--red);
}

.badge.medium,
.badge.待地方确认,
.badge.待平台审核,
.badge.处理中,
.badge.待接收 {
  background: #fff3d8;
  color: #9c741d;
}

.badge.done,
.badge.已完成 {
  background: #e3f7ef;
  color: var(--green);
}

.action-btn {
  padding: 7px 10px;
  background: rgba(16, 37, 54, 0.9);
}

.action-btn:hover {
  border-color: var(--hud-cyan);
  color: #fff;
}

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

.panel table {
  min-width: 920px;
}

.panel th {
  background: #f7fafc;
  color: var(--muted);
}

.detail-panel {
  margin-top: 16px;
}

.detail-empty {
  color: var(--muted);
  padding: 24px 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.button-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline,
.rules-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.rule-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.timeline-item.error {
  border-left: 4px solid var(--red);
}

.timeline-item.ok {
  border-left: 4px solid var(--green);
}

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

.ok-text {
  color: #9fe1bd !important;
}

.warn-text {
  color: #f0cd7e !important;
}

@media (max-width: 1500px) {
  .command-layout {
    grid-template-columns: minmax(190px, 18fr) minmax(520px, 64fr) minmax(200px, 18fr);
  }

  .left-col {
    grid-template-rows: minmax(0, 0.7fr) minmax(0, 1.35fr) minmax(0, 1.55fr);
  }

  .right-col {
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.72fr) minmax(0, 0.95fr) minmax(0, 1.2fr);
  }

  .screen-center {
    grid-template-rows: minmax(0, 2.9fr) minmax(0, 0.52fr) minmax(0, 0.86fr);
  }

  .model-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1900px) {
  .command-screen {
    padding: 10px;
  }

  .command-header {
    height: 82px;
  }

  .command-layout {
    grid-template-columns: minmax(430px, 22fr) minmax(980px, 56fr) minmax(430px, 22fr);
    gap: 10px;
    height: calc(100vh - 102px);
    margin-top: 10px;
  }

  .screen-col,
  .screen-center {
    gap: 10px;
  }

  .hud-panel {
    padding: 12px;
  }

  .hud-panel h2 {
    font-size: 18px;
  }

  .county-map {
    min-height: 0;
  }

  .cmd-alert p,
  .method-item p,
  .model-item p,
  .metric-item,
  .screen-table th,
  .screen-table td {
    font-size: 14px;
  }

  .chain-node small {
    font-size: 13px;
  }
}

@media (min-width: 1600px) and (max-height: 1120px) {
  .command-screen {
    padding: 6px;
  }

  .command-header {
    height: 54px;
  }

  .command-header h1 {
    font-size: clamp(24px, 1.35vw, 30px);
  }

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

  .mini-btn {
    padding: 5px 10px;
  }

  .command-layout {
    grid-template-columns: minmax(340px, 18fr) minmax(1080px, 64fr) minmax(340px, 18fr);
    gap: 6px;
    height: calc(100vh - 66px);
    margin-top: 6px;
  }

  .screen-col,
  .screen-center {
    gap: 6px;
  }

  .left-col {
    grid-template-rows: minmax(0, 0.52fr) minmax(0, 1.2fr) minmax(0, 1.35fr);
  }

  .right-col {
    grid-template-rows: minmax(0, 0.78fr) minmax(0, 0.58fr) minmax(0, 0.82fr) minmax(0, 1.05fr);
  }

  .screen-center {
    grid-template-rows: minmax(0, 3.25fr) minmax(0, 0.65fr) minmax(0, 0.86fr);
  }

  .hud-panel {
    padding: 6px 8px;
  }

  .hud-panel h2 {
    margin-bottom: 4px;
    font-size: 14px;
  }

  .kpi-panel {
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .kpi-panel .dual-gauges {
    display: none;
  }

  .kpi-strip {
    height: 100%;
  }

  .kpi-strip div {
    display: grid;
    align-content: center;
    padding: 4px 6px;
  }

  .kpi-strip strong {
    font-size: 22px;
  }

  .cmd-alert {
    padding: 6px;
  }

  .cmd-alert p,
  .method-item p,
  .model-item p,
  .chain-node small {
    -webkit-line-clamp: 2;
    font-size: 11px;
  }

  .cmd-alert h3,
  .method-item strong,
  .model-item strong {
    font-size: 13px;
  }

  .level,
  .alert-meta span {
    font-size: 11px;
    padding: 2px 5px;
  }

  .method-item,
  .model-item {
    padding: 6px;
  }

  .metric-item {
    grid-template-columns: minmax(44px, 4vw) 1fr minmax(50px, 3.5vw);
    gap: 5px;
    font-size: 12px;
  }

  .metric-list.compact .metric-item {
    grid-template-columns: 1fr minmax(54px, 4vw) minmax(42px, 3vw);
  }

  .screen-table th,
  .screen-table td {
    padding: 4px 7px;
    font-size: 12px;
  }

  .small-chart {
    min-height: 0;
  }
}

@media (max-width: 1280px) and (min-width: 901px) {
  .command-header {
    grid-template-columns: minmax(190px, 22vw) 1fr minmax(190px, 22vw);
    height: 60px;
  }

  .command-header h1 {
    font-size: clamp(22px, 2.2vw, 30px);
  }

  .project-name {
    padding-left: 12px;
    font-size: 12px;
  }

  .clock {
    padding-right: 12px;
    font-size: 12px;
  }

  .mini-btn {
    padding: 5px 9px;
  }

  .command-layout {
    grid-template-columns: minmax(170px, 18fr) minmax(520px, 62fr) minmax(210px, 20fr);
    height: calc(100vh - 70px);
  }

  .left-col {
    grid-template-rows: minmax(0, 0.55fr) minmax(0, 1.3fr) minmax(0, 1.55fr);
  }

  .right-col {
    grid-template-rows: minmax(0, 0.9fr) minmax(0, 0.65fr) minmax(0, 0.9fr) minmax(0, 1.22fr);
  }

  .screen-center {
    grid-template-rows: minmax(0, 2.75fr) minmax(0, 0.48fr) minmax(0, 0.8fr);
  }

  .hud-panel {
    padding: 7px;
  }

  .hud-panel h2 {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .kpi-panel {
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .kpi-panel .dual-gauges {
    display: none;
  }

  .kpi-strip {
    height: 100%;
  }

  .kpi-strip div {
    display: grid;
    align-content: center;
    padding: 5px 6px;
  }

  .kpi-strip strong {
    font-size: 24px;
  }

  .legal-chain {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .chain-node {
    padding: 6px;
  }

  .chain-node small,
  .method-item p,
  .model-item p,
  .cmd-alert p {
    font-size: 11px;
  }

  .model-list {
    grid-template-columns: 1fr;
  }

  .metric-item {
    grid-template-columns: minmax(44px, 52px) 1fr minmax(44px, 56px);
    gap: 5px;
    font-size: 12px;
  }

  .metric-list.compact .metric-item {
    grid-template-columns: 1fr minmax(42px, 48px) minmax(34px, 42px);
    gap: 4px;
  }

  .screen-table th,
  .screen-table td {
    padding: 5px 8px;
    font-size: 12px;
  }

  .small-chart {
    min-height: 0;
  }

  .alert-top {
    grid-template-columns: auto 1fr;
  }

  .cmd-alert time {
    display: none;
  }

  .cmd-alert h3,
  .cmd-alert strong {
    word-break: keep-all;
  }

  .alert-meta span {
    padding: 3px 5px;
  }
}

@media (max-width: 900px) {
  body {
    display: block;
  }

  body.dashboard-mode {
    overflow: auto;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    min-width: 260px;
    padding-bottom: 8px;
  }

  .command-screen {
    height: auto;
    min-height: 100vh;
  }

  .command-header {
    grid-template-columns: 1fr;
    padding: 10px 12px;
    text-align: center;
  }

  .command-header h1 {
    white-space: normal;
  }

  .project-name,
  .clock {
    justify-self: center;
    padding: 0;
  }

  .command-layout {
    height: auto;
    min-height: calc(100vh - 120px);
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "left"
      "right";
  }

  .screen-center {
    grid-template-rows: minmax(430px, auto) auto auto;
  }

  .left-col,
  .right-col {
    grid-template-rows: none;
  }

  .hud-panel {
    min-height: 210px;
  }

  .county-map {
    min-height: 360px;
  }

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

  .chain-node::after {
    display: none;
  }
}

@media (max-width: 560px) {
  .command-screen {
    padding: 6px;
  }

  .command-header h1 {
    font-size: 22px;
  }

  .clock,
  .map-legend,
  .map-status {
    justify-content: center;
  }

  .county-map {
    min-height: 330px;
  }

  .legal-chain,
  .detail-grid,
  .dual-gauges,
  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .cmd-alerts,
  .method-list,
  .model-list,
  .metric-list {
    max-height: 320px;
  }

  .screen-table {
    min-width: 680px;
  }
}
