:root {
  --bg-canvas: #070d19;
  --bg-surface: rgba(15, 23, 42, 0.82);
  --bg-elevated: rgba(30, 41, 59, 0.56);
  --bg-hover: rgba(51, 65, 85, 0.45);
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(56, 189, 248, 0.35);
  --primary: #38bdf8;
  --primary-solid: #0ea5e9;
  --cyan: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 10px 30px rgba(2, 6, 23, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 0%, #0f1f3d 0%, #070d19 52%, #050912 100%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 自定义细滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.38); }

/* 顶部导航栏 */
.topbar {
  height: 64px;
  background: rgba(7, 13, 25, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 60;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 16px; letter-spacing: 0.3px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.45);
  font-size: 15px; color: #04111f; font-weight: 800;
}
.brand small {
  font-weight: 500; font-size: 11px; color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12); padding: 3px 9px; border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.nav-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(15, 23, 42, 0.9); border: 1px solid var(--border-subtle); border-radius: 10px;
}
.nav-tab {
  border: none; background: transparent; color: var(--text-secondary);
  padding: 8px 16px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all 0.2s ease;
}
.nav-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-tab.active {
  color: #fff; background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(34, 211, 238, 0.18));
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.role-select {
  background: rgba(15, 23, 42, 0.95); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 7px 12px; font-size: 12px; outline: none; cursor: pointer;
}
.role-select:focus { border-color: var(--primary); }
.clock-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1; background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle); padding: 6px 11px; border-radius: 8px;
}

/* 主视图容器 */
.view { display: none; max-width: 1680px; margin: 0 auto; padding: 22px 28px 36px; }
.view.active { display: block; }

/* 面板与卡片 */
.panel {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.panel-title {
  font-size: 15px; font-weight: 600; color: #f8fafc;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.panel-title .title-left { display: flex; align-items: center; gap: 8px; }
.panel-title .title-bar { width: 3px; height: 15px; border-radius: 99px; background: linear-gradient(180deg, var(--primary), var(--cyan)); }
.panel-title span.sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* 按钮系统 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(30, 41, 59, 0.8); color: #e2e8f0;
  border: 1px solid var(--border-subtle);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 500;
  transition: all 0.18s ease; white-space: nowrap;
}
.btn:hover { background: rgba(51, 65, 85, 0.9); border-color: rgba(148, 163, 184, 0.3); }
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border-color: rgba(56, 189, 248, 0.5); color: #fff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ok { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.38); color: #6ee7b7; }
.btn-ok:hover { background: rgba(16, 185, 129, 0.26); }
.btn-warn { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.38); color: #fcd34d; }
.btn-danger { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.38); color: #fda4af; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }

/* 标签徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 500;
}
.b-ok { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.b-warn { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.b-danger { background: rgba(244, 63, 94, 0.14); color: #fb7185; }
.b-info { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.b-muted { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; }

/* 指挥大屏布局：宽敞、主次分明 */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
  background: linear-gradient(180deg, rgba(20, 32, 56, 0.86), rgba(11, 19, 36, 0.88));
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: 18px 20px; position: relative; overflow: hidden;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: rgba(56, 189, 248, 0.3); }
.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.kpi-val {
  font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums; color: #fff;
}
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.dash-main { display: grid; grid-template-columns: 1.65fr 1fr; gap: 20px; margin-bottom: 20px; align-items: stretch; }
.dash-bottom { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 20px; }

.info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: background 0.18s, border-color 0.18s;
}
.info-card:hover { background: var(--bg-hover); border-color: rgba(148, 163, 184, 0.25); }
.prog-bar { height: 6px; background: rgba(15, 23, 42, 0.9); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.prog-fill { height: 100%; background: linear-gradient(90deg, #0ea5e9, #10b981); border-radius: 99px; transition: width 0.35s ease; }

/* 高精工业 GIS 电子地图 */
.gis-wrap {
  position: relative; flex: 1; display: flex; flex-direction: column;
  background: #060e1c; border-radius: 12px; border: 1px solid var(--border-subtle); overflow: hidden;
}
.gis-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; background: rgba(11, 19, 36, 0.92);
  border-bottom: 1px solid var(--border-subtle); font-size: 12px;
}
.gis-toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gis-toolbar select {
  background: rgba(15, 23, 42, 0.95); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: 7px; padding: 6px 10px; font-size: 12px;
}
.gis-stage { position: relative; flex: 1; min-height: 430px; overflow: hidden; background: radial-gradient(circle at 50% 45%, #0c1d38 0%, #060e1c 78%); }
.gis-svg { width: 100%; height: 100%; display: block; transition: transform 0.25s ease; transform-origin: center center; }

.gis-zoom-ctrl {
  position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px;
}
.gis-zoom-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.88); color: #e2e8f0; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.gis-zoom-btn:hover { border-color: var(--primary); color: var(--primary); }

.gis-legend {
  position: absolute; left: 14px; top: 14px;
  background: rgba(7, 13, 25, 0.82); backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 7px 12px; display: flex; gap: 12px; font-size: 11px; color: #cbd5e1;
}
.gis-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.gis-hud {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  background: rgba(7, 13, 25, 0.88); backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle); border-radius: 10px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 8px;
}
.gis-hud-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px;
}
.gis-coord-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cyan); font-size: 12px; }
.gis-pb-row { display: none; align-items: center; gap: 12px; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.gis-pb-row.show { display: flex; }
.gis-slider {
  flex: 1; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 99px;
  background: rgba(148, 163, 184, 0.25); outline: none; cursor: pointer;
}
.gis-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 10px var(--cyan); cursor: pointer;
}

@keyframes pulseRing {
  0% { r: 2.2; opacity: 0.9; }
  100% { r: 6.2; opacity: 0; }
}
.pulse-ring { animation: pulseRing 2s infinite ease-out; }

/* 后台管理系统布局 */
.admin-layout { display: grid; grid-template-columns: 236px 1fr; gap: 20px; align-items: start; }
.admin-side {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 14px; position: sticky; top: 86px;
}
.side-item {
  padding: 11px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between;
  transition: all 0.16s;
}
.side-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.side-item.active {
  background: rgba(14, 165, 233, 0.16); color: #fff; font-weight: 500;
  box-shadow: inset 3px 0 0 var(--primary);
}

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.filter-bar input, .filter-bar select {
  background: rgba(15, 23, 42, 0.9); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: 8px; padding: 8px 12px; font-size: 12px; outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.tbl th {
  color: var(--text-secondary); font-weight: 500; font-size: 12px;
  background: rgba(15, 23, 42, 0.72); position: sticky; top: 0;
}
.tbl tr:hover td { background: rgba(56, 189, 248, 0.04); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

/* 手机端模拟器（大厂移动 UI 规范） */
.mobile-stage {
  display: flex; gap: 36px; justify-content: center; align-items: flex-start; flex-wrap: wrap;
  padding: 12px 0 32px;
}
.phone-frame {
  width: 396px; height: 800px; background: #09111f;
  border: 10px solid #1e293b; border-radius: 42px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.2);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}
.phone-status {
  height: 34px; background: #070d19; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-secondary);
}
.phone-header {
  padding: 14px 18px; background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
}
.phone-body { flex: 1; overflow-y: auto; padding: 16px; background: #070e1b; }
.phone-tabbar {
  height: 62px; background: rgba(11, 19, 36, 0.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.phone-tab {
  border: none; background: transparent; color: var(--text-muted); font-size: 11px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: color 0.15s;
}
.phone-tab.active { color: var(--primary); font-weight: 600; }

.phone-side-guide {
  width: 360px; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 22px 24px; font-size: 13px; line-height: 1.8;
  box-shadow: var(--shadow-card);
}
.phone-side-guide h3 { margin: 0 0 14px; font-size: 15px; color: #f8fafc; }
.phone-side-guide li { margin-bottom: 10px; color: #cbd5e1; }

/* 人脸识别 */
.face-box {
  width: 176px; height: 176px; margin: 36px auto 18px; border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.65); position: relative; overflow: hidden;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.2), #070e1b);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  box-shadow: 0 0 32px rgba(14, 165, 233, 0.2);
}
.face-scan {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan); animation: scan 2.2s infinite ease-in-out;
}
@keyframes scan { 0% { top: 12%; } 50% { top: 86%; } 100% { top: 12%; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.vibrate { animation: shake 0.22s linear 2; }

/* 大厂级顶部 Toast（含声波提示动效） */
.toast-stack {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  min-width: 300px; max-width: 480px;
  background: rgba(15, 23, 42, 0.94); backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  font-size: 13px; color: #f8fafc;
  animation: toastIn 0.22s ease;
}
.toast-item.is-err { border-color: rgba(244, 63, 94, 0.6); }
.toast-item.is-ok { border-color: rgba(16, 185, 129, 0.55); }
.sound-wave { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.sound-wave i {
  width: 2.5px; background: var(--cyan); border-radius: 2px; display: block;
  animation: waveBar 0.7s infinite ease-in-out alternate;
}
.sound-wave i:nth-child(2) { animation-delay: 0.15s; height: 14px; }
.sound-wave i:nth-child(1), .sound-wave i:nth-child(3) { height: 7px; }
@keyframes waveBar { from { transform: scaleY(0.45); } to { transform: scaleY(1.15); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.76); backdrop-filter: blur(6px);
  z-index: 120; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal-box {
  width: 100%; max-width: 560px; background: #0d172a;
  border: 1px solid var(--border-subtle); border-radius: 16px;
  padding: 22px 24px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; font-weight: 600; font-size: 15px;
}
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; background: rgba(7, 13, 25, 0.9); color: #fff;
  border: 1px solid var(--border-subtle); border-radius: 8px; padding: 9px 12px; font-size: 13px; outline: none;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--primary); }

@media (max-width: 1180px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dash-main, .dash-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 14px; height: auto; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .view { padding: 14px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .phone-side-guide { display: none; }
  .phone-frame { width: 100%; height: calc(100vh - 110px); border: none; border-radius: 16px; }
}
