/* ============================================================
   智慧城管大屏演示系统 · 公共样式
   依据 design-spec.md v1.0（苏画屏）
   主色 #1677FF ｜ 面板 #0A2342 ｜ 科技青 #00CFE8
   大屏背景 #06172E ｜ 8pt 栅格 ｜ 卡片圆角 8px
   ============================================================ */
:root {
  --primary: #1677FF;
  --panel: #0A2342;
  --cyan: #00CFE8;
  --green: #22C55E;
  --orange: #F59E0B;
  --red: #EF4444;
  --gray: #8A94A6;
  --bg: #06172E;
  --text: #F0F6FF;
  --text2: #A8C0DC;
  --text3: #5E7896;
  --border: rgba(255, 255, 255, 0.08);
  --num-font: 'Bahnschrift', 'DIN Alternate', 'Consolas', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: #04101F;
  font-family: 'HarmonyOS Sans', 'PingFang SC', 'Source Han Sans SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  font-size: 14px;
}

/* ---------- 舞台（1920x1080 等比缩放） ---------- */
#stage {
  width: 1920px; height: 1080px;
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
#stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at 50% 0%, rgba(22, 119, 255, 0.10), transparent 55%),
              radial-gradient(ellipse at 50% 110%, rgba(0, 207, 232, 0.06), transparent 50%);
}

/* ---------- 顶栏 72px ---------- */
.topbar {
  height: 72px; flex: 0 0 72px; position: relative; z-index: 10;
  display: flex; align-items: center; padding: 0 24px;
  background: linear-gradient(180deg, rgba(10, 35, 66, 0.95), rgba(10, 35, 66, 0.75));
  border-bottom: 1px solid var(--border);
}
.tb-left { display: flex; align-items: center; gap: 12px; width: 420px; }
.tb-logo {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  position: relative;
}
.tb-logo::after {
  content: ''; position: absolute; left: 7px; top: 7px; width: 18px; height: 18px;
  border: 2px solid #fff; border-radius: 3px; opacity: .9;
}
.tb-sys { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.tb-nav { flex: 1; display: flex; align-items: stretch; height: 100%; justify-content: center; }
.tb-item {
  display: flex; align-items: center; padding: 0 14px; margin: 0 2px;
  color: var(--text2); text-decoration: none; font-size: 15px;
  position: relative; transition: color .2s; white-space: nowrap;
}
.tb-item:hover { color: #fff; }
.tb-item.active { color: #fff; font-weight: 600; }
.tb-item.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 4px; border-radius: 2px 2px 0 0; background: var(--primary);
  box-shadow: 0 0 8px rgba(22, 119, 255, .8);
}
.tb-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text2); }
.tb-clock { font-family: var(--num-font); font-size: 18px; color: var(--cyan); letter-spacing: 1px; }
.tb-fs {
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text2); cursor: pointer; font-size: 14px;
  transition: all .2s;
}
.tb-fs:hover { color: #fff; border-color: var(--primary); background: rgba(22, 119, 255, .15); }
.tb-admin { display: inline-flex; align-items: center; gap: 8px; }
.tb-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: linear-gradient(135deg, #1677FF, #00CFE8); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ---------- KPI 行 96px ---------- */
.kpi-row {
  height: 96px; flex: 0 0 96px; display: flex; gap: 16px;
  padding: 8px 24px 0; position: relative; z-index: 5;
}
.kpi {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: linear-gradient(180deg, rgba(10, 35, 66, .92), rgba(10, 35, 66, .6));
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.kpi:hover { transform: translateY(-2px); border-color: rgba(22, 119, 255, .55); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.kpi.warn { border-color: var(--orange); }
.kpi.danger { border-color: var(--red); }
.kpi-ico {
  width: 44px; height: 44px; border-radius: 8px; flex: 0 0 44px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: rgba(22, 119, 255, .16); color: var(--primary);
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-num-row { display: flex; align-items: baseline; gap: 4px; }
.kpi-num {
  font-family: var(--num-font); font-size: 36px; font-weight: 700; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
}
.kpi.warn .kpi-num { color: var(--orange); }
.kpi.danger .kpi-num { color: var(--red); }
.kpi-unit { font-size: 12px; color: var(--text3); }
.kpi-label { font-size: 12px; color: var(--text2); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.kpi-trend { font-size: 12px; font-family: var(--num-font); }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--gray); }

/* ---------- 主体三栏 ---------- */
.main { flex: 1; display: flex; gap: 16px; padding: 16px 24px; min-height: 0; position: relative; z-index: 5; }
.col-left { width: 320px; flex: 0 0 320px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.col-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.col-right { width: 340px; flex: 0 0 340px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }

/* ---------- 面板卡片 ---------- */
.panel {
  background: linear-gradient(180deg, rgba(10, 35, 66, .92), rgba(10, 35, 66, .55));
  border: 1px solid var(--border); border-radius: 8px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-title {
  flex: 0 0 44px; display: flex; align-items: center; padding: 0 16px;
  font-size: 16px; font-weight: 500; color: var(--text);
  border-bottom: 1px solid var(--border); gap: 8px;
}
.panel-title::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--cyan); }
.panel-title .more { margin-left: auto; font-size: 12px; color: var(--text3); font-weight: 400; cursor: pointer; }
.panel-title .more:hover { color: var(--primary); }
.panel-body { flex: 1; padding: 12px 16px; min-height: 0; overflow-y: auto; }
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 2px; }

/* ---------- GIS 地图 ---------- */
.map-wrap { flex: 1; position: relative; border-radius: 8px; overflow: hidden; min-height: 0; }
.map-wrap svg.citymap { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-toolbar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px;
  background: rgba(6, 23, 46, .82); border: 1px solid var(--border); backdrop-filter: blur(4px);
}
.map-tool {
  width: 32px; height: 32px; border-radius: 6px; border: none; cursor: pointer;
  background: transparent; color: var(--text2); font-size: 14px; transition: all .2s;
}
.map-tool:hover { background: rgba(22, 119, 255, .2); color: #fff; }
.map-tool.on { background: rgba(22, 119, 255, .3); color: var(--cyan); }
.map-legend {
  position: absolute; right: 12px; bottom: 12px; z-index: 6;
  background: rgba(6, 23, 46, .85); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--text2); display: grid; grid-template-columns: auto auto; gap: 6px 14px;
}
.map-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.map-legend i.sq { border-radius: 2px; }

/* 地图浮层信息卡 320~360px */
.map-pop {
  position: absolute; top: 16px; right: 16px; width: 340px; z-index: 8;
  background: rgba(10, 35, 66, .96); border: 1px solid rgba(0, 207, 232, .3);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  display: none; transform: translateX(12px); opacity: 0; transition: all .24s ease-out;
}
.map-pop.show { display: block; transform: translateX(0); opacity: 1; }
.mp-h { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; }
.mp-h .mp-x { margin-left: auto; cursor: pointer; color: var(--text3); font-size: 13px; padding: 2px 6px; }
.mp-h .mp-x:hover { color: #fff; }
.mp-b { padding: 12px 16px 16px; font-size: 13px; color: var(--text2); }
.mp-row { display: flex; justify-content: space-between; padding: 5px 0; }
.mp-row b { color: var(--text); font-weight: 500; }
.mp-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- 列表行 ---------- */
.row-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-radius: 6px; cursor: pointer; border-bottom: 1px solid rgba(255, 255, 255, .04);
  transition: background .2s;
}
.row-item:hover { background: rgba(22, 119, 255, .1); }
.row-item .ri-main { flex: 1; min-width: 0; }
.row-item .ri-title { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .ri-sub { font-size: 12px; color: var(--text3); margin-top: 3px; }
.row-item.danger .ri-title { color: #FF8A8A; }

/* ---------- 标签 ---------- */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.tag-red { background: rgba(239, 68, 68, .12); color: #FF8A8A; }
.tag-orange { background: rgba(245, 158, 11, .12); color: #FBBF24; }
.tag-blue { background: rgba(22, 119, 255, .12); color: #5C9DFF; }
.tag-green { background: rgba(34, 197, 94, .12); color: #4ADE80; }
.tag-gray { background: rgba(138, 148, 166, .12); color: var(--gray); }
.tag-cyan { background: rgba(0, 207, 232, .12); color: var(--cyan); }

/* ---------- 按钮 ---------- */
.btn {
  height: 40px; padding: 0 16px; border-radius: 8px; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; transition: all .2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #3E8BFF; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: rgba(22, 119, 255, .12); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: rgba(239, 68, 68, .12); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }

/* ---------- 底部滚动条 56px ---------- */
.mq-bar {
  height: 56px; flex: 0 0 56px; margin: 0 24px 16px; position: relative; z-index: 5;
  display: flex; align-items: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(10, 35, 66, .92), rgba(10, 35, 66, .6));
  border: 1px solid var(--border); border-radius: 8px;
}
.mq-tag {
  flex: 0 0 auto; height: 26px; padding: 0 12px; margin-left: 12px; border-radius: 4px;
  background: rgba(239, 68, 68, .15); color: #FF8A8A; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.mq-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.mq-view { flex: 1; overflow: hidden; }
.mq-inner { display: inline-flex; white-space: nowrap; animation: mqmove 42s linear infinite; }
.mq-inner span { font-size: 13px; color: var(--text2); padding: 0 28px; position: relative; }
.mq-inner span::after { content: ''; position: absolute; right: 0; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--text3); transform: translateY(-50%); }

/* ---------- 弹窗 ---------- */
.mask {
  position: absolute; inset: 0; z-index: 900; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.mask.show { opacity: 1; }
.modal {
  width: 440px; max-width: 88%; background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  transform: translateY(10px); transition: transform .24s ease-out; max-height: 80%;
  display: flex; flex-direction: column;
}
.mask.show .modal { transform: translateY(0); }
.modal-h { display: flex; align-items: center; padding: 14px 20px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--border); }
.modal-x { margin-left: auto; cursor: pointer; color: var(--text3); padding: 2px 6px; }
.modal-x:hover { color: #fff; }
.modal-b { padding: 16px 20px; overflow-y: auto; font-size: 14px; color: var(--text2); }
.modal-f { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.modal-b::-webkit-scrollbar { width: 4px; }
.modal-b::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); }

/* 弹窗内下钻统计 */
.drill-stats { display: flex; gap: 12px; margin-bottom: 16px; }
.drill-stat { flex: 1; background: rgba(255, 255, 255, .04); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.drill-stat .dv { font-family: var(--num-font); font-size: 22px; font-weight: 700; color: var(--cyan); }
.drill-stat .dl { font-size: 12px; color: var(--text3); margin-top: 2px; }
.bar-track { height: 16px; background: rgba(255, 255, 255, .06); border-radius: 8px; overflow: hidden; flex: 1; }
.bar-fill { height: 100%; border-radius: 8px; width: 0; transition: width .8s cubic-bezier(.22,.9,.36,1); }
.bar-line { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 12px; }
.bar-line .bl-label { width: 84px; color: var(--text2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-line .bl-val { width: 56px; font-family: var(--num-font); color: var(--text); }
.drill-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.drill-table th { text-align: left; font-weight: 500; color: var(--text3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.drill-table td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, .04); }

/* ---------- Toast ---------- */
.toast {
  position: absolute; top: 88px; left: 50%; transform: translate(-50%, -8px); z-index: 999;
  background: rgba(10, 35, 66, .96); border: 1px solid var(--primary); color: var(--text);
  border-radius: 8px; padding: 10px 20px; font-size: 13px;
  opacity: 0; transition: all .3s; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.danger { border-color: var(--red); }

/* ---------- 入场动效（错峰编排 5.12） ---------- */
[data-anim] { opacity: 0; transform: translateY(16px); }
[data-anim].anim-in { opacity: 1; transform: translateY(0); transition: opacity .4s ease, transform .4s ease; }

/* ---------- SVG 动效 ---------- */
.ring { transform-box: fill-box; transform-origin: center; animation: breath 2.4s ease-out infinite; }
@keyframes breath { 0% { transform: scale(.5); opacity: .8; } 70% { transform: scale(2.6); opacity: 0; } 100% { transform: scale(2.6); opacity: 0; } }
.alarm-ring { transform-box: fill-box; transform-origin: center; animation: breath 1.4s ease-out infinite; }
.flow-line { stroke-dasharray: 6 10; animation: flowmove 1.2s linear infinite; }
@keyframes flowmove { to { stroke-dashoffset: -64; } }
.poi { cursor: pointer; }
.poi:hover .poi-dot { stroke: #fff; stroke-width: 2; }
.end-dot { animation: endpulse 2s ease-out infinite; }
@keyframes endpulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- 通用 keyframes ---------- */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes mqmove { to { transform: translateX(-50%); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
.pop { animation: pop .3s ease; display: inline-block; }
@keyframes haloBreathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .5); } 50% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); } }

/* 排名条 */
.rank-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 12px; }
.rank-no { width: 18px; height: 18px; border-radius: 4px; background: rgba(255, 255, 255, .08); color: var(--text2); display: inline-flex; align-items: center; justify-content: center; font-family: var(--num-font); flex: 0 0 18px; }
.rank-no.top { background: rgba(245, 158, 11, .2); color: #FBBF24; }
.rank-name { width: 72px; color: var(--text2); white-space: nowrap; }
.rank-val { width: 48px; text-align: right; font-family: var(--num-font); color: var(--text); }

/* 环形图中心 */
.donut-center-num { font-family: var(--num-font); font-size: 24px; font-weight: 700; fill: #fff; text-anchor: middle; }
/* 窄视口防系统名换行溢出 */
.tb-sys { white-space: nowrap; }
@media (max-width: 1500px) { .tb-sys { display: none; } }
