:root {
  --bg: #0b1020;
  --panel: rgba(14, 20, 34, 0.94);
  --panel-strong: rgba(17, 26, 42, 0.98);
  --line: rgba(126, 154, 186, 0.22);
  --text: #eaf2ff;
  --muted: #8da2bd;
  --soft: #c5d5e9;
  --cyan: #28d8d8;
  --green: #5be07d;
  --amber: #ffbd4a;
  --red: #ff5d64;
  --violet: #9e8cff;
  --surface: #131d2e;
  --surface-2: #1a2638;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.command-app {
  min-width: 1180px;
  min-height: 720px;
  height: 100vh;
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr) 74px;
  background:
    linear-gradient(90deg, rgba(40, 216, 216, 0.08), transparent 26%, transparent 74%, rgba(255, 189, 74, 0.08)),
    radial-gradient(circle at 50% 120%, rgba(91, 224, 125, 0.10), transparent 38%),
    #0b1020;
}

.topbar,
.status-strip,
.panel,
.map-toolbar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.topbar {
  margin: 10px 12px 6px;
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.system-badge {
  height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 189, 74, 0.55);
  color: var(--amber);
  background: rgba(255, 189, 74, 0.08);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 21px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(108px, 1fr));
  gap: 10px;
  min-width: 388px;
}

.top-stats div {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.top-stats span,
.top-stats b {
  display: block;
  white-space: nowrap;
}

.top-stats span {
  color: var(--cyan);
  font-size: 16px;
  font-weight: 700;
}

.top-stats b {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.dashboard {
  min-height: 0;
  padding: 0 12px 8px;
  display: grid;
  grid-template-columns: minmax(290px, 320px) minmax(480px, 1fr) minmax(320px, 370px);
  gap: 10px;
}

.panel {
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-section {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  min-height: 0;
}

.panel-section:last-child {
  border-bottom: 0;
}

.command-section,
.detail-section {
  flex: 0 0 auto;
}

.resource-section {
  flex: 0 1 286px;
  display: flex;
  flex-direction: column;
  min-height: 172px;
}

.task-section,
.aircraft-section,
.alert-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: #f4f8ff;
}

.small-pill,
.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(40, 216, 216, 0.11);
  color: var(--cyan);
  border: 1px solid rgba(40, 216, 216, 0.26);
  font-size: 12px;
  white-space: nowrap;
}

.small-pill.warn {
  color: var(--amber);
  background: rgba(255, 189, 74, 0.10);
  border-color: rgba(255, 189, 74, 0.28);
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(91, 224, 125, 0.9);
}

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

.action,
.tool-btn {
  min-height: 36px;
  border: 1px solid rgba(141, 162, 189, 0.28);
  border-radius: 6px;
  color: var(--soft);
  background: var(--surface);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.action:hover,
.tool-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(40, 216, 216, 0.55);
  background: #17243a;
}

.action.primary {
  color: #021b1d;
  background: var(--cyan);
  border-color: rgba(40, 216, 216, 0.9);
  font-weight: 700;
}

.action.danger,
.tool-btn.warning {
  color: #ffe2e2;
  border-color: rgba(255, 93, 100, 0.42);
  background: rgba(255, 93, 100, 0.13);
}

.base-list,
.task-list,
.aircraft-list,
.alert-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.base-item,
.task-item,
.aircraft-item,
.alert-item {
  border: 1px solid rgba(141, 162, 189, 0.18);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 6px;
}

.base-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 9px 10px;
}

.base-name,
.task-title,
.aircraft-name,
.alert-title {
  font-size: 13px;
  color: #f4f8ff;
  font-weight: 700;
}

.base-meta,
.task-meta,
.aircraft-meta,
.alert-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.base-score {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  align-self: center;
}

.task-item {
  padding: 9px 10px;
}

.task-row,
.aircraft-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress {
  height: 5px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cyan);
}

.map-column {
  min-height: 0;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 8px;
}

.map-toolbar {
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-group.muted {
  color: var(--muted);
  font-size: 12px;
}

.tool-btn {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.map-shell {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(126, 154, 186, 0.24);
  border-radius: 8px;
  overflow: hidden;
  background: #071019;
}

#map {
  width: 100%;
  height: 100%;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(rgba(11, 16, 32, 0.86), rgba(11, 16, 32, 0.86)),
    repeating-linear-gradient(0deg, rgba(40, 216, 216, 0.08), rgba(40, 216, 216, 0.08) 1px, transparent 1px, transparent 38px),
    repeating-linear-gradient(90deg, rgba(40, 216, 216, 0.08), rgba(40, 216, 216, 0.08) 1px, transparent 1px, transparent 38px);
}

.map-placeholder.show {
  display: flex;
}

.placeholder-card {
  width: min(460px, 100%);
  padding: 18px;
  border: 1px solid rgba(40, 216, 216, 0.28);
  background: rgba(14, 20, 34, 0.96);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.placeholder-card h2 {
  font-size: 18px;
}

.placeholder-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.placeholder-card label {
  display: block;
  margin-top: 12px;
}

.placeholder-card label span {
  display: block;
  margin-bottom: 6px;
  color: var(--soft);
  font-size: 12px;
}

.placeholder-card input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid rgba(141, 162, 189, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.placeholder-card input:focus {
  border-color: rgba(40, 216, 216, 0.7);
}

.config-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.config-actions .action {
  flex: 1;
}

.config-hint {
  min-height: 18px;
}

.aircraft-item {
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.aircraft-item:hover,
.aircraft-item.selected {
  border-color: rgba(40, 216, 216, 0.55);
  background: rgba(40, 216, 216, 0.08);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(141, 162, 189, 0.24);
  color: var(--soft);
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.status-chip.flying {
  color: #d8fff2;
  border-color: rgba(91, 224, 125, 0.4);
  background: rgba(91, 224, 125, 0.12);
}

.status-chip.returning {
  color: #fff0cd;
  border-color: rgba(255, 189, 74, 0.4);
  background: rgba(255, 189, 74, 0.12);
}

.status-chip.alert,
.status-chip.hold {
  color: #ffe0e0;
  border-color: rgba(255, 93, 100, 0.45);
  background: rgba(255, 93, 100, 0.14);
}

.video-feed {
  position: relative;
  height: 118px;
  margin-bottom: 10px;
  border: 1px solid rgba(40, 216, 216, 0.24);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(40, 216, 216, 0.12), transparent 30%),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, 0.04) 22px 23px),
    #08121f;
}

.video-feed::before,
.video-feed::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(91, 224, 125, 0.55);
}

.video-feed::before {
  width: 54px;
  height: 34px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.video-feed::after {
  inset: 12px;
  border-color: rgba(40, 216, 216, 0.32);
}

.video-feed span {
  position: absolute;
  left: 10px;
  bottom: 8px;
  color: var(--green);
  font-size: 12px;
  z-index: 2;
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(40, 216, 216, 0.16), transparent);
  animation: scan 3.6s linear infinite;
}

@keyframes scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

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

.detail-cell {
  padding: 8px;
  border: 1px solid rgba(141, 162, 189, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  min-width: 0;
}

.detail-cell span,
.detail-cell b {
  display: block;
}

.detail-cell span {
  color: var(--muted);
  font-size: 11px;
}

.detail-cell b {
  margin-top: 4px;
  color: #fff;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-item {
  padding: 9px 10px;
  border-left: 3px solid var(--cyan);
}

.alert-item.warn {
  border-left-color: var(--amber);
}

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

.status-strip {
  margin: 0 12px 10px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}

.status-strip div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.status-strip div:last-child {
  border-right: 0;
}

.status-strip b,
.status-strip span {
  display: block;
}

.status-strip b {
  color: var(--cyan);
  font-size: 24px;
  line-height: 1;
}

.status-strip span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.city-marker {
  min-width: 76px;
  padding: 4px 7px;
  border: 1px solid rgba(40, 216, 216, 0.55);
  border-radius: 6px;
  color: #ecfeff;
  background: rgba(12, 24, 38, 0.86);
  box-shadow: 0 0 18px rgba(40, 216, 216, 0.28);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.city-marker.command {
  border-color: rgba(255, 189, 74, 0.75);
  color: #fff5dd;
  background: rgba(54, 38, 9, 0.9);
  box-shadow: 0 0 22px rgba(255, 189, 74, 0.38);
}

.plane-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #021b1d;
  background: var(--cyan);
  border: 2px solid #e6ffff;
  box-shadow: 0 0 20px rgba(40, 216, 216, 0.52);
  font-size: 17px;
  transform-origin: center;
}

.plane-marker.alert,
.plane-marker.hold {
  color: #fff;
  background: var(--red);
  border-color: #ffe1e1;
  animation: pulse 0.9s ease-in-out infinite;
}

.plane-marker.returning {
  background: var(--amber);
  border-color: #fff4d8;
}

@keyframes pulse {
  50% {
    transform: scale(1.16);
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(141, 162, 189, 0.28);
  border-radius: 999px;
}

@media (max-width: 1400px) {
  .dashboard {
    grid-template-columns: 292px minmax(450px, 1fr) 330px;
  }

  .top-stats {
    min-width: 330px;
  }

  .status-strip b {
    font-size: 21px;
  }
}
