* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a56db;
  --primary-light: #5ad6ff;
  --accent: #00e676;
  --warn: #ff9f43;
  --danger: #ff5a5a;
  --bg: #0a1628;
  --bg-card: #0f1d35;
  --text: #ffffff;
  --text-muted: #9fb3cc;
  --border: rgba(90, 214, 255, 0.18);
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.topbar {
  height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #0f1d35 0%, #0a1d38 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 10;
}
.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 36px;
  height: 36px;
}
.brand-logo.home-quay-image,
.brand-logo.platform-logo-image {
  width: 64px;
  height: 36px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  border: 1px solid rgba(90, 214, 255, 0.5);
  box-shadow: 0 0 12px rgba(90, 214, 255, 0.2);
}
.brand-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.brand-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .4px;
  white-space: nowrap;
  background: linear-gradient(90deg, #fff 0%, #5ad6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-tag {
  font-size: 11px;
  color: var(--primary-light);
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(90, 214, 255, 0.1);
  border: 1px solid rgba(90, 214, 255, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.bell::before {
  content: "🔔";
  font-size: 15px;
  filter: grayscale(0.3) brightness(1.3);
}
.dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.fullscreen::before {
  content: "⛶";
  color: var(--text-muted);
  font-size: 15px;
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.user-name { font-size: 12px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* 容器 */
.container {
  flex: 1;
  padding: 14px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

/* 通用面板 */
.panel {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-head {
  height: 46px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(90, 214, 255, 0.06), transparent);
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.panel-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--primary);
}
.gis-icon { background: linear-gradient(135deg, #5ad6ff, #1a56db); }
.alert-icon { background: linear-gradient(135deg, #ff9f43, #ff5a5a); }
.list-icon { background: linear-gradient(135deg, #00e676, #0a9b4a); }
.panel-extra {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.map-segment {
  background: rgba(90, 214, 255, 0.1);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(90, 214, 255, 0.2);
}
.map-zoom {
  letter-spacing: 4px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  cursor: pointer;
}

/* 上部区域 */
.upper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  flex: 1;
}

.panel-gis {
  width: 100%;
  min-height: 520px;
  flex: 1;
}
.gis-body {
  flex: 1;
  min-height: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

/* KPI 卡 */
.kpi-row {
  display: flex;
  gap: 12px;
}
.kpi-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.kpi-card.alert {
  background: rgba(255, 90, 90, 0.08);
  border-color: rgba(255, 90, 90, 0.3);
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon span { width: 12px; height: 12px; border-radius: 50%; }
.kpi-icon.blue { background: rgba(26, 86, 219, 0.2); }
.kpi-icon.blue span { background: var(--primary-light); box-shadow: 0 0 6px var(--primary-light); }
.kpi-icon.green { background: rgba(0, 230, 118, 0.15); }
.kpi-icon.green span { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.kpi-icon.red { background: rgba(255, 90, 90, 0.2); }
.kpi-icon.red span { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.kpi-label { font-size: 11px; color: var(--text-muted); }
.kpi-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.kpi-card.alert .kpi-value { color: var(--danger); }

/* 地图 */
.map-wrap {
  flex: 1;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a1a30;
  min-height: 0;
}
#canalMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.map-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.buoy { cursor: pointer; }
.buoy-alert { animation: pulseRed 1.6s infinite; }
.buoy-warn { animation: pulseYellow 1.6s infinite; }
@keyframes pulseRed {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes pulseYellow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(10, 22, 40, 0.85);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  z-index: 5;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--accent); }
.dot-yellow { background: var(--warn); }
.dot-red { background: var(--danger); }
.dot-drone { background: var(--primary-light); box-shadow: 0 0 4px var(--primary-light); }

/* 无人机巡检悬浮框 */
.patrol-drone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  background: rgba(10, 22, 40, 0.92);
  border: 1px solid rgba(90,214,255,0.3);
  border-radius: 10px;
  padding: 10px 12px;
  z-index: 5;
  text-align: center;
  backdrop-filter: blur(6px);
}
.patrol-drone-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 8px;
}
.patrol-drone-screen {
  width: 100%;
  height: 55px;
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  border: 1px dashed rgba(90,214,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.patrol-drone-status {
  font-size: 11px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulseGreen 1.6s infinite;
}
@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* 地图侧边卡 */
.map-sidecards {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 170px;
  z-index: 5;
}
.sidecard {
  background: rgba(10, 22, 40, 0.88);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  backdrop-filter: blur(4px);
}
.sidecard-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidecard-title::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--primary-light);
  border-radius: 2px;
}
.sidecard-list { display: flex; flex-direction: column; gap: 6px; }
.side-item {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.side-item i { width: 6px; height: 6px; border-radius: 50%; }
.ic-red { background: var(--danger); }
.ic-green { background: var(--accent); }

/* 告警分析与智能预测 */
.analysis {
  display: flex;
  width: 100%;
}
.panel-right {
  width: 100%;
  flex: none;
  min-height: 220px;
}
.right-body { padding: 12px; }
.right-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: 200px;
  gap: 12px;
  height: 100%;
}
.chart-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.chart-subtitle { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.chart-box { flex: 1; min-height: 0; }

/* 下部区域 */
.lower { flex: 0 0 340px; }
.lower-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-group label { font-size: 12px; color: var(--text-muted); }
.filter-group select, .btn-search, .btn-export {
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  padding: 0 10px;
  outline: none;
}
.filter-group select { min-width: 90px; }
.btn-search {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border: none;
  cursor: pointer;
}
.btn-export {
  background: transparent;
  cursor: pointer;
}

.lower-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
  min-height: 0;
}
.table-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.table-head {
  height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(90, 214, 255, 0.04);
}
.table-title { font-size: 13px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); cursor: pointer; }
.link-more { font-size: 11px; color: var(--primary-light); text-decoration: none; }

.table-wrap { flex: 1; overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table-wrap th, .table-wrap td { padding: 9px 10px; text-align: left; }
.table-wrap thead { background: rgba(90, 214, 255, 0.06); color: var(--primary-light); font-weight: 600; }
.table-wrap tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.table-wrap tbody tr:hover { background: rgba(90, 214, 255, 0.06); }
.table-wrap td { color: var(--text-muted); border-bottom: 1px solid rgba(90, 214, 255, 0.08); }
.table-wrap td:first-child { color: #fff; font-weight: 600; }
.table-wrap a { color: var(--primary-light); text-decoration: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.tag-green { background: rgba(0, 230, 118, 0.15); color: var(--accent); }
.tag-yellow { background: rgba(255, 159, 67, 0.15); color: var(--warn); }
.tag-red { background: rgba(255, 90, 90, 0.15); color: var(--danger); }

.order-list { padding: 12px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.order { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid rgba(90, 214, 255, 0.08); }
.order:last-child { border-bottom: none; padding-bottom: 0; }
.order-main { display: flex; align-items: center; gap: 8px; }
.order-status { font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.order-status.doing { background: rgba(90, 214, 255, 0.15); color: var(--primary-light); }
.order-status.done { background: rgba(0, 230, 118, 0.15); color: var(--accent); }
.order-status.plan { background: rgba(255, 159, 67, 0.15); color: var(--warn); }
.order-title { font-size: 12px; color: var(--text); }
.order-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.order-progress { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.order-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.order-scope { color: var(--primary-light); }

.refresh-time { color: var(--text-muted); }

/* 响应式 */
@media (max-width: 1200px) {
  .right-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: 200px 200px; }
}
@media (max-width: 900px) {
  .right-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: 200px 200px 200px; }
  .lower-grid { grid-template-columns: 1fr; }
  .lower { flex: none; min-height: 600px; }
}
