﻿/* 全局设计变量：颜色、面板、边框和阴影统一在这里调。 */
:root {
  --bg: #071014;
  --panel: rgba(11, 22, 29, 0.84);
  --panel-solid: #0d171f;
  --panel-2: #111e27;
  --text: #edf6fb;
  --muted: #8da3af;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --blue: #2f8cff;
  --cyan: #18c7b8;
  --green: #56d37b;
  --amber: #e8b84e;
  --red: #ff4d4f;
  --paper: #eff4f7;
  --ink: #14202a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

/* 整个应用外壳：顶部栏 + 横向页面视口。 */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
  background:
    radial-gradient(circle at 76% 12%, rgba(47, 140, 255, 0.16), transparent 24%),
    linear-gradient(145deg, #071014, #0c171d 48%, #071014);
}

/* 顶部导航区：左品牌、中导航、右状态。 */
.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 14, 18, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
}

.brand strong,
.brand span {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
  font-weight: 720;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

/* 一级页面导航，JS 通过 .nav-button.active 控制当前页视觉状态。 */
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.nav-button {
  height: 30px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  color: rgba(237, 246, 251, 0.7);
  background: transparent;
}

.nav-button.active {
  color: #fff;
  background: rgba(47, 140, 255, 0.9);
}

.system-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  color: #fff;
  background: rgba(24, 199, 184, 0.18);
}

.state-pill.warn {
  background: rgba(232, 184, 78, 0.2);
  color: #ffd98b;
}

.state-pill.good {
  background: rgba(24, 199, 184, 0.2);
  color: #8cf4e9;
}

.state-pill.bad {
  background: rgba(255, 77, 79, 0.22);
  color: #ffb3b4;
}

.ghost-button,
.tool-button,
.layer-button,
.full-button,
.chart-controls button,
.video-actions button,
.command-grid button,
.source-button,
.primary-mini,
.admin-menu button,
.ptz-pad button,
.preset-row button,
.ptz-card button,
.dialog-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.ghost-button {
  height: 30px;
  padding: 0 12px;
}

/* 横向滑动页面容器，真正的页面切换由 #pageTrack transform 完成。 */
.viewport {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.page-track {
  height: 100%;
  display: flex;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

/* 监测大屏底层是 Leaflet 地图，所有浮层都绝对定位在其上方。 */
.monitor-page {
  background: #0a151b;
}

.map-canvas,
/* Leaflet 或在线瓦片不可用时的静态示意背景。 */
.map-fallback {
  position: absolute;
  inset: 0;
}

.map-canvas {
  z-index: 1;
  background: #10202a;
}

/* Leaflet 或在线瓦片不可用时的静态示意背景。 */
.map-fallback {
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(145deg, #0f1e23, #17261d 44%, #07141d);
  background-size: 42px 42px, 42px 42px, auto;
}

.river-shape,
.heat-shape,
.route-shape {
  position: absolute;
  border-radius: 50%;
  transform: rotate(18deg);
}

.river-shape {
  width: 280px;
  height: 1200px;
  left: 49%;
  top: -22%;
  background: linear-gradient(90deg, rgba(21, 94, 126, 0.32), rgba(69, 178, 206, 0.72), rgba(21, 94, 126, 0.28));
  filter: blur(3px);
}

.heat-shape {
  width: 160px;
  height: 780px;
  left: 55%;
  top: 4%;
  background: linear-gradient(180deg, rgba(47, 140, 255, 0.2), rgba(24, 199, 184, 0.48), rgba(232, 184, 78, 0.6), rgba(255, 77, 79, 0.38));
  filter: blur(14px);
}

.route-shape {
  width: 420px;
  height: 720px;
  left: 41%;
  top: 8%;
  border: 2px dashed rgba(255, 255, 255, 0.36);
  border-right-color: transparent;
}

/* 地图上的通用浮动面板样式。 */
.floating-panel {
  position: absolute;
  z-index: 5;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

/* 左上任务操作条：导入水系、历史数据/导出数据、开始/结束监测。 */
.task-toolbar {
  left: 18px;
  top: 18px;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.tool-button {
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.tool-select {
  height: 38px;
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #eff8fb;
  background: rgba(255, 255, 255, 0.08);
}

.primary,
.tool-button.primary,
.full-button.primary,
.primary-mini {
  border-color: rgba(24, 199, 184, 0.45);
  color: #fff;
  background: linear-gradient(135deg, rgba(24, 199, 184, 0.92), rgba(47, 140, 255, 0.9));
}

/* 无人船状态面板，与地图工具列共同占据左侧宽度。 */
.ship-panel {
  left: 18px;
  top: 82px;
  width: 292px;
  padding: 18px;
}

.panel-head,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head span,
.card-head span,
.summary-bar span {
  color: var(--muted);
  font-size: 12px;
}

.panel-head strong {
  color: var(--green);
  font-size: 13px;
}

.panel-head strong.warn {
  color: var(--amber);
}

.panel-head strong.bad {
  color: #ff6b6b;
}

#activeMetricLabel {
  font-size: 18px;
  letter-spacing: 0;
}

.ship-id {
  margin: 12px 0 14px;
  font-size: 30px;
  font-weight: 760;
}

.status-list {
  margin: 0;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  margin: 0;
  color: #f7fbff;
  text-align: right;
}

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

.command-grid button {
  min-height: 34px;
  font-size: 13px;
}

/* 右侧水质指标面板，选择指标会驱动热图和色阶刷新。 */
.sensor-panel {
  right: 18px;
  top: 18px;
  width: 326px;
  padding: 16px;
}

.sensor-groups {
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 3px;
}

.sensor-group {
  margin-top: 14px;
}

.sensor-group h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.sensor-row {
  display: grid;
  grid-template-columns: 22px minmax(82px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 7px;
}

.sensor-row:hover,
.sensor-row.active {
  background: rgba(255, 255, 255, 0.07);
}

.sensor-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.sensor-row strong {
  font-size: 17px;
}

.sensor-row em {
  width: 46px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.sensor-row.alert strong {
  color: var(--red);
}

.legend {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend-bar {
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f8cff, #18c7b8, #e6d85a, #f19b4d, #ff4d4f);
}

/* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
  right: 18px;
  bottom: 18px;
  width: 430px;
  padding: 12px;
}

.video-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.video-head button {
  border: 0;
  color: var(--text);
  background: transparent;
}

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

.video-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  height: 122px;
  overflow: hidden;
  border-radius: 7px;
  background:
    linear-gradient(rgba(10, 20, 26, 0.08), rgba(10, 20, 26, 0.36)),
    linear-gradient(135deg, #24404a, #adc5c9 47%, #2a5541);
}

.video-placeholder.alt {
  background:
    linear-gradient(rgba(10, 20, 26, 0.08), rgba(10, 20, 26, 0.36)),
    linear-gradient(145deg, #335b40, #c4d2c0 47%, #24476c);
}

.video-placeholder span,
.video-placeholder small {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}

.video-placeholder span {
  font-weight: 720;
}

.video-placeholder small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.7);
}

.video-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.video-actions button {
  height: 28px;
  font-size: 12px;
}

.layer-panel {
  left: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: auto repeat(3, auto);
  align-items: center;
  gap: 8px;
  padding: 10px;
}

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

.layer-button {
  height: 30px;
  padding: 0 10px;
}

.layer-button.active {
  border-color: rgba(47, 140, 255, 0.5);
  background: rgba(47, 140, 255, 0.22);
}

/* 非地图页面的统一内边距容器。 */
.workspace-grid {
  height: 100%;
  padding: 18px;
}

/* 曲线、表格、排口核查和系统管理页面中的白色工作卡片。 */
.work-card {
  min-width: 0;
  border: 1px solid rgba(20, 32, 42, 0.08);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 50px rgba(6, 16, 22, 0.12);
}

.work-card .card-head {
  min-height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid #dfe8ed;
}

.card-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.card-head.compact strong {
  margin: 0;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-controls button,
.source-button,
.primary-mini,
.ptz-card button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  background: #f6fafc;
}

.chart-controls .primary-mini,
.primary-mini {
  color: #fff;
}

.data-page,
.ai-page,
.admin-page {
  background: var(--paper);
}

/* 实时曲线页：左图表，右任务与导出面板。 */
.curve-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  grid-template-rows: 1fr;
  gap: 14px;
}

.summary-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}

.summary-bar div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 58px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 12px 36px rgba(6, 16, 22, 0.08);
}

.summary-bar strong {
  margin-top: 4px;
  font-size: 17px;
}

/* 曲线图卡片；内部 canvas 尺寸由 CSS 拉伸，绘制逻辑在 app.js。 */
.chart-card {
  grid-column: 1;
  overflow: hidden;
}

#trendCanvas {
  display: block;
  width: 100%;
  height: calc(100% - 58px);
}

/* 曲线页右侧任务筛选和导入导出操作。 */
.query-panel {
  grid-column: 2;
  padding: 0 16px 16px;
}

.query-panel label {
  display: block;
  margin-top: 14px;
  color: #52616b;
  font-size: 13px;
}

.query-panel input,
.query-panel select,
.table-card input {
  width: 100%;
  height: 36px;
  margin-top: 6px;
  padding: 0 10px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.metric-checks {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.metric-checks label {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.full-button {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  color: var(--ink);
  background: #f6fafc;
}

.table-card {
  overflow: hidden;
}

/* 数据记录页：整屏留给表格，适配 16:10 屏幕显示更多行。 */
.records-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
}

.records-head {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.data-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.data-tab {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: #52616b;
  background: #f7fafc;
}

.data-tab.active {
  border-color: rgba(47, 140, 255, 0.46);
  color: #0b62c8;
  background: rgba(47, 140, 255, 0.1);
}

.device-select {
  width: 148px;
  height: 28px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: #14202a;
  background: #fff;
}

/* 数据记录页右上角的筛选/导入/导出工具条。 */
.records-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.records-tools input,
.records-tools select {
  width: 180px;
  height: 32px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.records-tools button,
.table-action {
  min-height: 30px;
  border: 1px solid #cfdce4;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

/* 表格滚动容器；数据记录页固定列规则在文件末尾覆盖。 */
.table-wrap {
  height: calc(100% - 52px);
  overflow: auto;
}

.device-data-view {
  height: calc(100% - 52px);
  padding: 14px;
  overflow: auto;
  background: #f4f8fb;
}

.device-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.device-source-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #dce7ec;
  border-radius: 8px;
  background: #f8fbfd;
  color: #334653;
  font-size: 12px;
}

.device-source-banner strong {
  color: #0d5c54;
}

.device-source-banner.status-simulated strong {
  color: #9a5b00;
}

.device-source-banner.status-timeout strong,
.device-source-banner.status-not_connected strong,
.device-source-banner.status-offline strong {
  color: #b42325;
}

.device-summary div {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  background: #fff;
}

.device-summary span {
  display: block;
  margin-bottom: 6px;
  color: #6b7f8c;
  font-size: 12px;
}

.device-summary strong {
  color: #14202a;
  font-size: 14px;
  line-height: 1.35;
}

.device-notes {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  background: #fbfdfe;
  color: #53636e;
  font-size: 12px;
  line-height: 1.55;
}

.device-notes p {
  margin: 0;
}

.device-command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.device-command-bar input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  background: #fff;
}

.device-register-table {
  overflow: auto;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  background: #fff;
}

.device-register-table table {
  min-width: 1120px;
}

.device-register-table code {
  color: #0b62c8;
  font-weight: 760;
}

.device-register-table input {
  width: 92px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #cfdce4;
  border-radius: 6px;
}

.muted-cell {
  color: #9aa9b3;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  min-width: 86px;
  padding: 11px 12px;
  border-bottom: 1px solid #e2ebf0;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #52616b;
  background: #f7fafc;
}

.records-page th:nth-child(1),
.records-page td:nth-child(1),
.records-page th:nth-child(2),
.records-page td:nth-child(2),
.records-page th:nth-child(3),
.records-page td:nth-child(3),
.records-page th:nth-child(4),
.records-page td:nth-child(4) {
  position: sticky;
  z-index: 2;
  background: inherit;
}

.records-page th:nth-child(1),
.records-page td:nth-child(1) { left: 0; min-width: 158px; }
.records-page th:nth-child(2),
.records-page td:nth-child(2) { left: 158px; min-width: 166px; }
.records-page th:nth-child(3),
.records-page td:nth-child(3) { left: 324px; min-width: 108px; }
.records-page th:nth-child(4),
.records-page td:nth-child(4) { left: 432px; min-width: 108px; }
.records-page th:nth-child(-n + 4) { z-index: 3; background: #f7fafc; }
.records-page td:nth-child(-n + 4) { background: #fff; }

/* 排口核查页：左视频/示范图，右识别事件列表。 */
.ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: minmax(420px, 1fr) 220px;
  gap: 14px;
}

.ai-video-card {
  overflow: hidden;
}

/* 后摄像头/示范图容器，视频和图片都按比例 contain 显示。 */
.ai-video {
  position: relative;
  height: calc(100% - 58px);
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.28)),
    linear-gradient(135deg, #193141, #bdc9c6 46%, #37634c 72%, #182c3a);
}

.ai-video video,
.ai-demo-image,
.video-placeholder video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #071014;
}

.frame-noise {
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 32px 32px;
}

.events-card {
  grid-column: 2;
  grid-row: 1 / 3;
  overflow: hidden;
}

.ai-stream-controls {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.danger-mini {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 77, 79, 0.32);
  border-radius: 6px;
  color: #ffffff;
  background: #b42325;
  font-size: 12px;
  font-weight: 700;
}

.danger-mini:disabled,
.primary-mini:disabled,
.table-action:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  filter: grayscale(0.15);
}

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

.event-head-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #cfdce4;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.event-list {
  height: calc(100% - 58px);
  overflow: auto;
  padding: 12px;
}

.event-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  background: #fbfdfe;
}

.event-item + .event-item {
  margin-top: 10px;
}

.event-thumb {
  height: 58px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #2f4a55, #c5d0ca 52%, #315c43);
}

.event-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-thumb span {
  display: grid;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.event-body strong,
.event-body span {
  display: block;
}

.event-body span {
  margin-top: 3px;
  color: #65737e;
  font-size: 12px;
}

.event-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.event-actions button {
  min-height: 26px;
  border: 1px solid #cfdce4;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.event-actions button:first-child {
  border-color: rgba(24, 199, 184, 0.38);
  color: #067a70;
}

.event-actions button:last-child {
  border-color: rgba(255, 77, 79, 0.28);
  color: #bb3032;
}

.event-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.event-item.status-confirmed {
  border-color: rgba(24, 199, 184, 0.32);
}

.event-item.status-false_positive {
  opacity: 0.72;
  background: #fffafa;
}

.event-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed #d5e1e8;
  border-radius: 8px;
  color: #7a8892;
  background: #fbfdfe;
  font-size: 13px;
}

.ptz-card {
  padding-bottom: 12px;
}

.ptz-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  padding: 14px 16px;
}

.ptz-pad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 7px;
}

.ptz-pad button {
  height: 42px;
  color: var(--ink);
  background: #f6fafc;
}

.ptz-controls {
  display: grid;
  gap: 8px;
}

.ptz-controls label {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 10px;
  color: #52616b;
  font-size: 13px;
}

.preset-row {
  display: flex;
  gap: 8px;
}

.preset-row button {
  flex: 1;
}

/* 系统管理页：左侧二级菜单，右侧管理表格。 */
.admin-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 214px 1fr;
  gap: 14px;
  padding: 18px;
}

.admin-menu {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(6, 16, 22, 0.08);
}

.admin-menu button {
  min-height: 42px;
  color: var(--ink);
  text-align: left;
  background: #f6fafc;
}

.admin-menu button.active {
  border-color: rgba(47, 140, 255, 0.38);
  color: #0b62c8;
  background: #eaf4ff;
}

.admin-main {
  overflow: hidden;
}

#adminContent {
  height: calc(100% - 58px);
  overflow: auto;
  padding: 16px;
}

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

.settings-grid label {
  display: grid;
  gap: 6px;
  color: #53636e;
  font-size: 12px;
  font-weight: 700;
}

.settings-grid input,
.settings-grid select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #d4e0e7;
  border-radius: 8px;
  background: #fff;
  color: #14202a;
}

.settings-grid .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  background: #fbfdfe;
}

.settings-grid .check-row input {
  min-height: auto;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.settings-actions span {
  color: #6b7f8c;
  font-size: 12px;
}

.admin-table {
  overflow: auto;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.warn::before {
  background: var(--amber);
}

.status-dot.bad::before {
  background: var(--red);
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 22px;
  min-width: 260px;
  max-width: min(560px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: #fff;
  background: rgba(8, 18, 24, 0.92);
  box-shadow: var(--shadow);
  transform: translate(-50%, 90px);
  opacity: 0;
  transition: 220ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 34px));
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.confirm-dialog strong {
  display: block;
  font-size: 20px;
}

.confirm-dialog p {
  color: #5f6e78;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.danger-button {
  border-color: rgba(255, 77, 79, 0.38) !important;
  color: #fff !important;
  background: var(--red) !important;
}

.login-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: #52616b;
  font-size: 13px;
  font-weight: 700;
}

.login-field input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #d4e0e7;
  border-radius: 8px;
  color: #14202a;
  background: #fff;
}

@media (max-width: 1180px) {
  /* 顶部导航区：左品牌、中导航、右状态。 */
.topbar {
    grid-template-columns: 1fr auto;
  }

  /* 一级页面导航，JS 通过 .nav-button.active 控制当前页视觉状态。 */
.main-nav {
    grid-column: 1 / -1;
    justify-self: center;
    order: 3;
  }

  /* 整个应用外壳：顶部栏 + 横向页面视口。 */
.app-shell {
    grid-template-rows: 112px 1fr;
  }

  .sensor-panel,
  /* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
    width: 300px;
  }

  .data-grid,
  /* 排口核查页：左视频/示范图，右识别事件列表。 */
.ai-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 340px 240px auto;
    overflow: auto;
  }

  .summary-bar,
  .chart-card,
  .query-panel,
  .table-card,
  .events-card {
    grid-column: 1;
    grid-row: auto;
  }

  /* 曲线页右侧任务筛选和导入导出操作。 */
.query-panel {
    min-height: 360px;
  }
}

/* latest workflow polish */
.records-page .records-head {
  min-height: 62px;
  align-items: center;
}

.records-page .table-wrap,
.records-page .device-data-view {
  height: calc(100% - 62px);
}

.records-page .device-data-view[hidden],
.records-page .table-wrap[hidden],
.device-select[hidden],
.records-tools[hidden] {
  display: none;
}

.records-page th:nth-child(1),
.records-page td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 72px;
  background: #fff;
}

.records-page th:nth-child(2),
.records-page td:nth-child(2) {
  position: sticky;
  left: 72px;
  z-index: 4;
  min-width: 170px;
  background: #fff;
}

.records-page th:nth-child(1),
.records-page th:nth-child(2) {
  z-index: 6;
  background: #f7fafc;
}

.data-row {
  cursor: pointer;
}

.data-row:hover td {
  background: #eef7fb;
}

.detail-dialog {
  width: min(720px, calc(100vw - 32px));
}

.detail-content {
  max-height: 56vh;
  overflow: auto;
  margin-top: 12px;
  color: #24323d;
}

.detail-content dl {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.detail-content dt {
  color: #667783;
}

.detail-content dd {
  margin: 0;
  word-break: break-word;
}

.wq-map-popup .leaflet-popup-content {
  margin: 10px 12px;
  min-width: 210px;
  color: #16242e;
  font-size: 12px;
}

.wq-map-popup strong,
.wq-map-popup span {
  display: block;
}

.wq-map-popup strong {
  margin-bottom: 6px;
  color: #10212c;
  font-size: 13px;
}

.wq-map-popup span {
  color: #52616b;
  line-height: 1.55;
}

.river-heat-canvas {
  mix-blend-mode: normal;
  opacity: 0.9;
  filter: saturate(1.12) contrast(1.08) blur(0.1px);
}

.river-point-canvas {
  opacity: 0.96;
  filter: saturate(1.28) contrast(1.22);
}

@media (max-width: 1180px) {
  .device-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* engineering workflow overrides */
.records-page .table-wrap table {
  min-width: 1280px;
}

.records-page th:nth-child(n),
.records-page td:nth-child(n) {
  position: static;
  left: auto;
}

.records-page th:nth-child(1),
.records-page td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 72px;
  background: #fff;
}

.records-page th:nth-child(2),
.records-page td:nth-child(2) {
  position: sticky;
  left: 72px;
  z-index: 5;
  min-width: 170px;
  background: #fff;
}

.records-page th:nth-child(1),
.records-page th:nth-child(2) {
  z-index: 7;
  background: #f7fafc;
}

.primary-mini,
.full-button.primary,
.tool-button.primary {
  color: #ffffff;
  font-weight: 720;
}

.primary-mini:disabled,
.full-button:disabled,
.tool-button:disabled,
.table-action:disabled {
  color: #5c6b75;
  background: #e8eef2;
  border-color: #cfdce4;
  opacity: 1;
}

.camera-fallback-text,
.video-placeholder span {
  color: #f7fbff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.72);
}

.device-help-button {
  width: 30px;
  height: 30px;
  border: 1px solid #cfdce4;
  border-radius: 50%;
  color: #0b62c8;
  background: #fff;
  font-weight: 800;
}

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

.register-result {
  color: #334653;
}

.register-result.bad {
  color: #b42325;
}

/* final page split overrides */
/* 实时曲线页：左图表，右任务与导出面板。 */
.curve-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
}

.curve-page .chart-card,
.curve-page .query-panel,
.records-page .table-card {
  grid-row: 1;
}

.curve-page /* 曲线图卡片；内部 canvas 尺寸由 CSS 拉伸，绘制逻辑在 app.js。 */
.chart-card {
  grid-column: 1;
}

.curve-page /* 曲线页右侧任务筛选和导入导出操作。 */
.query-panel {
  grid-column: 2;
}

/* 数据记录页：整屏留给表格，适配 16:10 屏幕显示更多行。 */
.records-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.records-page .table-card {
  grid-column: 1;
  height: 100%;
}

.records-page /* 表格滚动容器；数据记录页固定列规则在文件末尾覆盖。 */
.table-wrap {
  height: calc(100% - 42px);
}

.records-page .records-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.records-page /* 数据记录页右上角的筛选/导入/导出工具条。 */
.records-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.records-page .records-tools input,
.records-page .records-tools select {
  width: 176px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: #14202a;
  background: #fff;
}

.records-page .records-tools button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #cfdce4;
  border-radius: 7px;
  color: #14202a;
  background: #fff;
}

.records-page .records-tools .primary-mini {
  color: #fff;
}

.records-page th:nth-child(1),
.records-page td:nth-child(1) {
  left: 0;
  min-width: 158px;
  width: 158px;
}

.records-page th:nth-child(2),
.records-page td:nth-child(2) {
  left: 158px;
  min-width: 166px;
  width: 166px;
}

.records-page th:nth-child(3),
.records-page td:nth-child(3) {
  left: 324px;
  min-width: 108px;
  width: 108px;
}

.records-page th:nth-child(4),
.records-page td:nth-child(4) {
  left: 432px;
  min-width: 108px;
  width: 108px;
  box-shadow: 8px 0 12px rgba(20, 32, 42, 0.05);
}

.records-page th:nth-child(-n + 4),
.records-page td:nth-child(-n + 4) {
  position: sticky;
}

.records-page th:nth-child(-n + 4) {
  z-index: 4;
  background: #f7fafc;
}

.records-page td:nth-child(-n + 4) {
  z-index: 2;
  background: #fff;
}

.ai-demo-image {
  display: block;
}

.ai-demo-image[hidden] {
  display: none;
}

@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  /* 整个应用外壳：顶部栏 + 横向页面视口。 */
.app-shell {
    min-height: 100vh;
    height: auto;
    grid-template-rows: auto 1fr;
  }

  /* 顶部导航区：左品牌、中导航、右状态。 */
.topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .brand span,
  .system-strip {
    display: none;
  }

  /* 一级页面导航，JS 通过 .nav-button.active 控制当前页视觉状态。 */
.main-nav {
    width: 100%;
    overflow: auto;
    justify-content: flex-start;
  }

  /* 横向滑动页面容器，真正的页面切换由 #pageTrack transform 完成。 */
.viewport {
    height: auto;
    overflow: visible;
  }

  .page-track {
    height: auto;
  }

  .page {
    min-height: calc(100vh - 104px);
    overflow: auto;
  }

  /* 监测大屏底层是 Leaflet 地图，所有浮层都绝对定位在其上方。 */
.monitor-page {
    padding-top: 420px;
  }

  .map-canvas,
  /* Leaflet 或在线瓦片不可用时的静态示意背景。 */
.map-fallback {
    height: 420px;
    bottom: auto;
  }

  /* 地图上的通用浮动面板样式。 */
.floating-panel {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: calc(100% - 24px);
    margin: 12px;
  }

  .task-toolbar,
  .layer-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .video-grid,
  .summary-bar,
  .ptz-layout,
  /* 系统管理页：左侧二级菜单，右侧管理表格。 */
.admin-layout {
    grid-template-columns: 1fr;
  }

  .workspace-grid,
  /* 系统管理页：左侧二级菜单，右侧管理表格。 */
.admin-layout {
    height: auto;
    padding: 12px;
  }

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

/* revision: operational layout refinements */
.brand {
  gap: 14px;
}

.brand .brand-logo {
  width: 118px;
  height: 36px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
}

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

.alarm-banner {
  position: absolute;
  z-index: 8;
  top: 18px;
  left: 370px;
  right: 690px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid rgba(255, 77, 79, 0.35);
  border-radius: 8px;
  color: #fff;
  background: rgba(92, 22, 24, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.alarm-banner[hidden] {
  display: none;
}

.alarm-banner strong {
  color: #ffb4b5;
}

/* 无人船状态面板，与地图工具列共同占据左侧宽度。 */
.ship-panel {
  width: 246px;
  padding: 16px;
}

.ship-id {
  margin: 10px 0 12px;
  font-size: 28px;
}

.status-list div {
  padding: 8px 0;
}

.status-list dd {
  font-size: 13px;
}

.map-tool-column {
  position: absolute;
  z-index: 7;
  left: 276px;
  top: 82px;
  display: grid;
  gap: 8px;
}

.map-icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: #fff;
  background: rgba(10, 20, 26, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.compass-button span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: auto;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  color: #ffdf7e;
  font-size: 12px;
  font-weight: 800;
}

.layers-button span,
.locate-button span {
  position: absolute;
  inset: 10px;
}

.layers-button span::before,
.layers-button span::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  height: 9px;
  border: 1px solid #8cc7ff;
  border-radius: 3px;
  transform: skewY(-18deg);
}

.layers-button span::before { top: 1px; }
.layers-button span::after { bottom: 1px; }

.locate-button span {
  border: 2px solid #18c7b8;
  border-radius: 50%;
}

.locate-button span::before,
.locate-button span::after {
  content: "";
  position: absolute;
  background: #18c7b8;
}

.locate-button span::before {
  left: 50%;
  top: -6px;
  bottom: -6px;
  width: 2px;
  transform: translateX(-50%);
}

.locate-button span::after {
  top: 50%;
  left: -6px;
  right: -6px;
  height: 2px;
  transform: translateY(-50%);
}

.layer-popover {
  position: absolute;
  left: 48px;
  top: 48px;
  display: grid;
  gap: 6px;
  width: 112px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(10, 20, 26, 0.92);
  backdrop-filter: blur(16px);
}

.layer-popover[hidden] {
  display: none;
}

.layer-popover .layer-button {
  width: 100%;
  text-align: left;
  color: #fff;
}

/* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
  top: 18px;
  right: 360px;
  bottom: auto;
  width: 300px;
  padding: 10px;
  resize: both;
  overflow: auto;
  min-width: 220px;
  min-height: 156px;
  max-width: 520px;
  max-height: 380px;
}

.video-grid {
  display: block;
}

.video-placeholder {
  width: 100%;
  height: 168px;
  min-height: 110px;
}

.video-placeholder span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(18, 40, 48, 0.35), rgba(194, 215, 214, 0.18));
}

/* 右侧水质指标面板，选择指标会驱动热图和色阶刷新。 */
.sensor-panel {
  width: 326px;
}

.data-grid {
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: minmax(420px, 1.35fr) minmax(250px, 0.65fr);
}

/* 曲线图卡片；内部 canvas 尺寸由 CSS 拉伸，绘制逻辑在 app.js。 */
.chart-card {
  grid-column: 1;
  grid-row: 1;
}

.chart-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  height: calc(100% - 58px);
  min-height: 0;
}

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

.chart-side {
  padding: 14px;
  border-left: 1px solid #dfe8ed;
  background: #f7fbfd;
  overflow: auto;
}

.chart-side strong {
  display: block;
  margin-bottom: 12px;
}

/* 曲线页右侧任务筛选和导入导出操作。 */
.query-panel {
  grid-column: 2;
  grid-row: 1 / 3;
  padding: 0 16px 16px;
}

.query-panel .summary-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0;
}

.query-panel .summary-bar div {
  min-height: 58px;
  padding: 0 12px;
  box-shadow: none;
  border: 1px solid #e2ebf0;
}

.query-panel .summary-bar strong {
  font-size: 15px;
}

.table-card {
  grid-column: 1;
  grid-row: 2;
}

.table-card .card-head {
  display: flex;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid #cfdce4;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 40px rgba(6, 16, 22, 0.18);
  pointer-events: none;
  font-size: 12px;
}

/* 排口核查页：左视频/示范图，右识别事件列表。 */
.ai-grid {
  grid-template-columns: minmax(0, 1fr) 430px;
  grid-template-rows: 1fr;
}

.ai-video-card {
  grid-column: 1;
}

.events-card {
  grid-column: 2;
  grid-row: 1;
}

.event-item {
  grid-template-columns: 92px 1fr;
}

.event-thumb {
  height: 74px;
}

@media (max-width: 1180px) {
  .alarm-banner {
    left: 18px;
    right: 18px;
    top: 132px;
  }

  .map-tool-column {
    left: 278px;
    top: 132px;
  }

  /* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
    right: 18px;
    top: 132px;
  }
}

/* final polish: chart legend and interaction affordances */
.chart-side .metric-checks {
  gap: 8px;
  margin: 0;
}

.chart-side .metric-checks label {
  grid-template-columns: 16px 12px minmax(0, 1fr);
  min-height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  color: #263640;
}

.chart-side .metric-checks label:hover {
  background: #eef5f9;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #18c7b8;
}

.swatch-0 { background: #18c7b8; }
.swatch-1 { background: #2f8cff; }
.swatch-2 { background: #e8b84e; }
.swatch-3 { background: #ff4d4f; }
.swatch-4 { background: #56d37b; }
.swatch-5 { background: #8b7cff; }
.swatch-6 { background: #14a2a8; }
.swatch-7 { background: #7aa6ff; }
.swatch-8 { background: #d09d38; }
.swatch-9 { background: #b55068; }
.swatch-10 { background: #62b66f; }
.swatch-11 { background: #7b8fa3; }

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  margin-bottom: 6px;
  color: #15232d;
}

.chart-tooltip span {
  line-height: 1.55;
  color: #52616b;
}

.leaflet-control-scale {
  margin-left: 52px !important;
  margin-bottom: 12px !important;
}

.leaflet-control-zoom {
  margin-left: 14px !important;
  margin-bottom: 12px !important;
  border: 1px solid rgba(255,255,255,0.22) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.leaflet-control-zoom a {
  background: rgba(10, 20, 26, 0.88) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.12) !important;
}

/* 2026-06 operational refinement */
/* 顶部导航区：左品牌、中导航、右状态。 */
.topbar {
  grid-template-columns: minmax(470px, 1.2fr) auto minmax(330px, 0.8fr);
}

.brand strong {
  font-size: 21px;
  font-weight: 780;
}

.state-pill.archive {
  background: rgba(86, 211, 123, 0.16);
  color: #a7f3c0;
}

/* 无人船状态面板，与地图工具列共同占据左侧宽度。 */
.ship-panel {
  width: 260px;
}

/* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
  left: 18px;
  top: 430px;
  right: auto;
  bottom: auto;
  width: 260px;
  min-width: 230px;
  max-width: 430px;
  max-height: 310px;
}

.video-placeholder {
  height: 154px;
}

.map-tool-column {
  left: 292px;
}

.route-button span {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 18px;
  height: 2px;
  background: #8cc7ff;
  transform: rotate(-24deg);
}

.route-button span::before,
.route-button span::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8cc7ff;
}

.route-button span::before { left: -2px; }
.route-button span::after { right: -2px; }
.route-button:not(.active) span { background: rgba(141, 163, 175, 0.55); }
.route-button:not(.active) span::before,
.route-button:not(.active) span::after { background: rgba(141, 163, 175, 0.55); }

.legend-panel {
  right: 356px;
  top: 18px;
  width: 82px;
  padding: 12px 10px;
}

.legend-title {
  display: grid;
  gap: 3px;
  text-align: center;
}

.legend-title span {
  font-size: 13px;
  font-weight: 720;
}

.legend-title em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.vertical-legend {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  margin-top: 10px;
  height: 188px;
}

.vertical-legend .legend-bar {
  width: 18px;
  height: 188px;
  border-radius: 999px;
  background: linear-gradient(0deg, #2f8cff, #18c7b8, #e6d85a, #f19b4d, #ff4d4f);
}

.legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.anomaly-card {
  right: 450px;
  top: 18px;
  width: 292px;
  padding: 14px;
  background: rgba(14, 24, 31, 0.62);
  border-color: rgba(255, 184, 78, 0.38);
}

.anomaly-card strong,
.anomaly-card span,
.anomaly-card em {
  display: block;
}

.anomaly-card strong {
  color: #ffe08a;
  font-size: 14px;
  margin-bottom: 8px;
}

.anomaly-card span {
  color: rgba(237, 246, 251, 0.9);
  font-size: 12px;
  line-height: 1.62;
}

.anomaly-card em {
  margin-top: 8px;
  color: #bff7e6;
  font-size: 12px;
  font-style: normal;
}

/* 右侧水质指标面板，选择指标会驱动热图和色阶刷新。 */
.sensor-panel {
  top: 18px;
  right: 18px;
  width: 326px;
}

.axis-sliders {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #dfe8ed;
}

.axis-sliders label {
  display: grid;
  gap: 8px;
  color: #52616b;
  font-size: 12px;
}

.axis-sliders input {
  width: 100%;
  accent-color: var(--blue);
}

.query-panel .summary-bar {
  grid-template-columns: 1fr;
}

.query-panel .summary-bar div {
  min-height: 52px;
}

.river-heat-canvas {
  mix-blend-mode: normal;
  opacity: 0.9;
}

.pollution-marker span {
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid #ffe08a;
  border-radius: 50%;
  background: rgba(255, 184, 78, 0.28);
  box-shadow: 0 0 0 8px rgba(255, 184, 78, 0.14), 0 0 18px rgba(255, 184, 78, 0.8);
}

@media (max-width: 1180px) {
  /* 顶部导航区：左品牌、中导航、右状态。 */
.topbar { grid-template-columns: 1fr auto; }
  .legend-panel { right: 326px; top: 132px; }
  .anomaly-card { right: 416px; top: 132px; }
  /* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock { left: 18px; top: 480px; }
}

/* dual heatmap professional mode */
/* 左上任务操作条：导入水系、历史数据/导出数据、开始/结束监测。 */
.task-toolbar {
  width: 314px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  z-index: 40;
}

.task-toolbar .tool-button {
  width: 100%;
  padding: 0 6px;
}

.task-toolbar .tool-select {
  width: 100%;
  padding: 0 6px;
}

.history-popover {
  position: absolute;
  left: 112px;
  top: 48px;
  z-index: 42;
  width: 148px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 8px;
  background: rgba(15, 31, 40, 0.9);
  box-shadow: 0 18px 48px rgba(0,0,0,0.28);
  backdrop-filter: blur(16px);
}

.history-popover[hidden] {
  display: none;
}

.history-popover button {
  width: 100%;
  min-height: 34px;
  margin: 2px 0;
  color: #eff8fb;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.history-popover button:hover {
  background: rgba(47, 140, 255, 0.24);
}

/* 无人船状态面板，与地图工具列共同占据左侧宽度。 */
.ship-panel {
  width: 260px;
}

.map-tool-column {
  left: 284px;
  top: 82px;
  gap: 10px;
}

.map-icon-button {
  width: 48px;
  height: 48px;
}

.heatmode-icon span {
  position: absolute;
  inset: 11px;
  border-radius: 6px;
}

.surface-mode-icon span {
  background:
    linear-gradient(135deg, rgba(28, 185, 108, 0.95), rgba(240, 207, 58, 0.92), rgba(180, 25, 49, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28);
}

.point-mode-icon span::before,
.point-mode-icon span::after,
.point-mode-icon span {
  background: transparent;
}

.point-mode-icon span::before,
.point-mode-icon span::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #8cc7ff;
  box-shadow: 12px 9px 0 #18c7b8, 2px 20px 0 #ffcf6b;
}

.point-mode-icon span::before {
  left: 2px;
  top: 2px;
  width: 8px;
  height: 8px;
}

.point-mode-icon span::after {
  right: 4px;
  top: 4px;
  width: 7px;
  height: 7px;
}

.points-on-button span,
.points-off-button span {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #8cc7ff;
  box-shadow: 12px 0 0 #18c7b8, 6px 12px 0 #ffcf6b;
}

.points-off-button span::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -16px;
  top: 10px;
  height: 3px;
  border-radius: 999px;
  background: #ff8a8a;
  transform: rotate(-38deg);
}

.points-on-button.active,
.points-off-button.active {
  border-color: rgba(24, 199, 184, 0.78);
  background: rgba(24, 199, 184, 0.18);
}

.heatmode-icon.active {
  border-color: rgba(24, 199, 184, 0.78);
  background: rgba(24, 199, 184, 0.18);
  box-shadow: 0 0 0 4px rgba(24, 199, 184, 0.12), var(--shadow);
}

/* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
  left: 18px;
  top: 430px;
  right: auto;
  bottom: auto;
  width: 314px;
  min-width: 314px;
  max-width: 430px;
  max-height: 316px;
}

.video-placeholder {
  height: 164px;
}

.alarm-button span {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 16px;
  height: 18px;
  border: 2px solid #ffcf6b;
  border-radius: 10px 10px 6px 6px;
}

.alarm-button span::before,
.alarm-button span::after {
  content: "";
  position: absolute;
  background: #ffcf6b;
}

.alarm-button span::before {
  left: 50%;
  top: -5px;
  width: 2px;
  height: 5px;
  transform: translateX(-50%);
}

.alarm-button span::after {
  left: 4px;
  right: 4px;
  bottom: -6px;
  height: 2px;
  border-radius: 999px;
}

.alarm-button i {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(10, 20, 26, 0.95);
  border-radius: 50%;
  background: #ff4d4f;
}

.alarm-button.has-alert {
  border-color: rgba(255, 184, 78, 0.68);
  box-shadow: 0 0 0 4px rgba(255, 184, 78, 0.12), var(--shadow);
}

.legend-panel {
  right: 360px;
  top: 72px;
  width: 70px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.vertical-legend {
  display: grid;
  grid-template-columns: 34px 18px;
  gap: 8px;
  align-items: stretch;
  height: 330px;
  margin: 0;
}

.vertical-legend .legend-bar {
  width: 18px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), inset 0 0 0 1px rgba(255,255,255,0.32);
}

.legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  font-size: 13px;
  font-weight: 760;
  text-align: right;
  text-shadow: 0 2px 8px rgba(0,0,0,0.72);
}

.legend-labels em {
  display: block;
  font-style: normal;
  font-size: 10px;
  opacity: 0.8;
}

.anomaly-card {
  left: 340px;
  top: 82px;
  right: auto;
  width: 310px;
  color: #14202a;
  background: rgba(255, 252, 245, 0.94);
  border-color: rgba(255, 184, 78, 0.42);
}

.anomaly-card[hidden] {
  display: none;
}

.anomaly-card strong {
  color: #8f3c0c;
}

.anomaly-card span {
  color: #334653;
}

.anomaly-card em {
  color: #0b766f;
}

.wq-map-tooltip {
  border: 1px solid rgba(140, 166, 179, 0.36) !important;
  border-radius: 8px !important;
  color: #16242e !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 16px 42px rgba(6, 16, 22, 0.18) !important;
}

.wq-map-tooltip strong,
.wq-map-tooltip span {
  display: block;
}

.wq-map-tooltip strong {
  margin-bottom: 5px;
}

.wq-map-tooltip span {
  color: #52616b;
  line-height: 1.52;
}

.river-heat-canvas {
  mix-blend-mode: normal;
  opacity: 0.94;
}

.river-point-canvas {
  mix-blend-mode: screen;
}

.leaflet-bottom.leaflet-right .leaflet-control-scale {
  margin-right: 18px !important;
  margin-bottom: 18px !important;
}

.leaflet-control-scale-line {
  border-color: rgba(20, 32, 42, 0.42) !important;
  color: #14202a !important;
  background: rgba(255, 255, 255, 0.78) !important;
  text-shadow: none !important;
}

.chart-body {
  grid-template-columns: minmax(0, 1fr) 208px;
}

.chart-range-selector {
  position: absolute;
  left: 76px;
  right: 238px;
  bottom: 18px;
  height: 28px;
  z-index: 3;
  touch-action: none;
}

.range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 8px;
  border-radius: 999px;
  background: #dbe7ee;
}

.range-selection {
  position: absolute;
  top: -4px;
  height: 16px;
  min-width: 28px;
  border-radius: 999px;
  background: rgba(47, 140, 255, 0.28);
  border: 1px solid rgba(47, 140, 255, 0.42);
  cursor: grab;
}

.range-selection b {
  position: absolute;
  inset: 0 10px;
  cursor: grab;
}

.range-selection i {
  position: absolute;
  top: -5px;
  width: 10px;
  height: 24px;
  border-radius: 5px;
  background: #2f8cff;
  box-shadow: 0 4px 12px rgba(47, 140, 255, 0.35);
  cursor: ew-resize;
}

.range-selection i:first-child {
  left: -5px;
}

.range-selection i:last-child {
  right: -5px;
}

.active-line-readout {
  min-height: 38px;
  margin: 10px 0 12px;
  padding: 8px 9px;
  border: 1px solid #dfe8ed;
  border-radius: 7px;
  color: #52616b;
  background: #fff;
  font-size: 12px;
}

.active-line-readout span {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
}

.active-line-readout strong {
  margin-right: 8px;
  color: #14202a;
}

.active-line-readout em {
  color: #0b62c8;
  font-style: normal;
  font-weight: 740;
}

.video-placeholder video,
.ai-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b171e;
}

.video-placeholder span[hidden],
.camera-fallback-text[hidden] {
  display: none;
}

.camera-fallback-text {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.76);
  font-weight: 720;
}

/* 表格滚动容器；数据记录页固定列规则在文件末尾覆盖。 */
.table-wrap {
  overflow: auto;
}

.table-wrap th {
  z-index: 3;
}

.table-wrap th small {
  display: block;
  margin-top: 2px;
  color: #8a99a3;
  font-size: 11px;
  font-weight: 500;
}

.table-action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #cfdce4;
  border-radius: 6px;
  color: #14202a;
  background: #fff;
}

.table-action.danger {
  border-color: rgba(255, 77, 79, 0.32);
  color: #bb3032;
}

/* first-version finishing polish */
.sensor-panel .panel-head span {
  color: #dce8ee;
  font-size: 16px;
  font-weight: 820;
}

#activeMetricLabel {
  color: #ffd35f;
  font-size: 23px;
  font-weight: 860;
}

.sensor-row {
  min-height: 38px;
}

.sensor-row span {
  font-size: 16px;
}

.sensor-row strong {
  font-size: 20px;
}

.sensor-row.active {
  background: rgba(255, 211, 95, 0.18);
  box-shadow: inset 3px 0 0 #ffd35f;
}

.sensor-row.active span,
.sensor-row.active strong {
  color: #ffd35f;
}

.river-heat-canvas {
  mix-blend-mode: normal;
  opacity: 0.9;
}

.video-placeholder {
  background: #071014;
}

.video-placeholder video,
.ai-video video {
  object-fit: contain;
}

.video-placeholder span {
  background: transparent;
}

.data-grid {
  grid-template-columns: minmax(0, 1fr) 286px;
  grid-template-rows: minmax(300px, 0.95fr) minmax(360px, 1.05fr);
  gap: 10px;
}

.work-card .card-head {
  min-height: 42px;
  padding: 0 14px;
}

.card-head strong {
  margin-top: 1px;
  font-size: 16px;
}

.chart-body {
  height: calc(100% - 42px);
  grid-template-columns: minmax(0, 1fr) 190px;
}

.chart-side {
  padding: 10px 12px;
}

.chart-side strong {
  margin-bottom: 8px;
  font-size: 14px;
}

.chart-side .metric-checks {
  gap: 4px;
}

.chart-side .metric-checks label {
  min-height: 26px;
}

.chart-range-selector {
  right: 220px;
  bottom: 14px;
}

.chart-y-range-selector {
  position: absolute;
  left: 42px;
  top: 42px;
  bottom: 56px;
  width: 28px;
  z-index: 3;
  touch-action: none;
}

.y-range-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 10px;
  width: 8px;
  border-radius: 999px;
  background: #dbe7ee;
}

.y-range-selection {
  position: absolute;
  left: -4px;
  width: 16px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(47, 140, 255, 0.28);
  border: 1px solid rgba(47, 140, 255, 0.42);
  cursor: grab;
}

.y-range-selection b {
  position: absolute;
  inset: 10px 0;
  cursor: grab;
}

.y-range-selection i {
  position: absolute;
  left: -5px;
  width: 24px;
  height: 10px;
  border-radius: 5px;
  background: #2f8cff;
  box-shadow: 0 4px 12px rgba(47, 140, 255, 0.35);
  cursor: ns-resize;
}

.y-range-selection i:first-child {
  top: -5px;
}

.y-range-selection i:last-child {
  bottom: -5px;
}

.active-line-readout,
.axis-sliders {
  display: none;
}

/* 曲线页右侧任务筛选和导入导出操作。 */
.query-panel {
  padding: 0 12px 12px;
}

.query-panel .summary-bar {
  gap: 6px;
  margin: 10px 0;
}

.query-panel .summary-bar div {
  min-height: 42px;
  padding: 0 10px;
}

.query-panel .summary-bar strong {
  margin-top: 3px;
  font-size: 13px;
}

.query-panel label {
  margin-top: 9px;
}

.full-button {
  min-height: 34px;
  margin-top: 8px;
}

/* 表格滚动容器；数据记录页固定列规则在文件末尾覆盖。 */
.table-wrap {
  height: calc(100% - 42px);
}

th,
td {
  padding: 8px 10px;
}

.leaflet-control-scale-line {
  min-width: 70px;
}

@media (max-width: 1180px) {
  /* 左上任务操作条：导入水系、历史数据/导出数据、开始/结束监测。 */
.task-toolbar {
    max-width: calc(100vw - 36px);
  }

  .map-tool-column {
    left: 292px;
    top: 132px;
  }

  .legend-panel {
    right: 18px;
    top: 132px;
  }

  .anomaly-card {
    left: 18px;
    top: 330px;
  }

  /* 前摄像头小窗，可 resize，真实 RTSP 经后端转码后填入 video。 */
.video-dock {
    left: 18px;
    top: 480px;
  }
}

/* final workflow overrides */
.records-page .records-head {
  min-height: 62px;
  align-items: center;
}

.records-page .table-wrap,
.records-page .device-data-view {
  height: calc(100% - 62px);
}

.records-page .device-data-view[hidden],
.records-page .table-wrap[hidden],
.device-select[hidden],
.records-tools[hidden] {
  display: none;
}

.wq-map-popup .leaflet-popup-content {
  margin: 10px 12px;
  min-width: 210px;
  color: #16242e;
  font-size: 12px;
}

.wq-map-popup strong,
.wq-map-popup span {
  display: block;
}

.wq-map-popup strong {
  margin-bottom: 6px;
  color: #10212c;
  font-size: 13px;
}

.wq-map-popup span {
  color: #52616b;
  line-height: 1.55;
}

.river-heat-canvas {
  mix-blend-mode: normal;
  opacity: 0.9;
  filter: saturate(1.12) contrast(1.08) blur(0.1px);
}

.river-point-canvas {
  opacity: 0.96;
  filter: saturate(1.28) contrast(1.22);
}

@media (max-width: 1180px) {
  .device-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


