/* ============================================================
   禅城区出租屋管理平台 - 全局样式
   风格：政府数字治理 · 深蓝科技色系（#0a1e3d / #0e2a52）+ 青色/金色高亮
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-deep: #0a1e3d;          /* 页面最深层背景 */
  --bg-panel: #0e2a52;         /* 面板背景 */
  --bg-panel-2: rgba(14, 42, 82, .55);
  --line: #1d4a86;             /* 描边 */
  --line-soft: rgba(55, 213, 255, .18);
  --cyan: #37d5ff;             /* 青色高亮 */
  --gold: #ffd76a;             /* 金色高亮 */
  --green: #6ee7a8;
  --orange: #ff9e6a;
  --red: #ff6b81;
  --txt: #e8f2ff;              /* 主文字 */
  --txt-dim: #8fa8c9;          /* 次级文字 */
  --sidebar-w: 210px;
  --sidebar-w-min: 64px;
  --topbar-h: 64px;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg-deep);
  color: var(--txt);
  font-size: 14px;
  overflow: hidden;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #1d4a86; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #12386e 0%, var(--bg-deep) 55%, #061529 100%);
}
.login-bg-grid { /* 背景网格线 */
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,213,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,213,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  animation: gridMove 22s linear infinite;
}
@keyframes gridMove { to { background-position: 42px 42px; } }

.login-panel {
  position: relative; width: 400px; padding: 44px 46px 34px;
  background: rgba(14, 42, 82, .75);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  text-align: center;
}
.login-deco-corner { position: absolute; width: 26px; height: 26px; }
.login-deco-corner.tl { top: -2px; left: -2px; border-top: 2px solid var(--cyan); border-left: 2px solid var(--cyan); border-radius: 6px 0 0 0; }
.login-deco-corner.br { bottom: -2px; right: -2px; border-bottom: 2px solid var(--cyan); border-right: 2px solid var(--cyan); border-radius: 0 0 6px 0; }
.login-logo {
  width: 66px; height: 66px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: bold; color: #06192f;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  border-radius: 16px; box-shadow: 0 0 30px rgba(55,213,255,.4);
}
.login-panel h1 { font-size: 22px; letter-spacing: 2px; }
.login-sub { font-size: 10px; color: var(--txt-dim); letter-spacing: 1.5px; margin-top: 6px; }
.login-slogan { margin: 14px 0 24px; color: var(--gold); letter-spacing: 4px; font-size: 13px; }
.login-field { text-align: left; margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; color: var(--txt-dim); margin-bottom: 6px; }
.login-field input {
  width: 100%; padding: 11px 14px; font-size: 14px;
  color: var(--txt); background: rgba(6, 21, 41, .8);
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.login-field input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(55,213,255,.15); }
.btn-login {
  width: 100%; padding: 12px; margin-top: 6px; font-size: 16px; letter-spacing: 8px;
  color: #06192f; background: linear-gradient(135deg, var(--cyan), #4b9fff);
  border: none; border-radius: 8px; cursor: pointer; font-weight: bold;
  transition: transform .15s, box-shadow .15s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(55,213,255,.35); }
.login-tip { margin-top: 16px; font-size: 11px; color: #5c7699; }

/* ============================================================
   主框架布局
   ============================================================ */
.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶部栏 ---------- */
.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px 0 10px;
  background: linear-gradient(180deg, #0c274d, #0a1e3d 90%);
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.topbar::after { /* 底部青色渐变光带 */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
  width: 36px; height: 36px; font-size: 16px; line-height: 1;
  color: var(--cyan); background: transparent;
  border: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer;
}
.sidebar-toggle:hover { background: rgba(55,213,255,.1); }
.logo-box { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: bold; color: #06192f;
  background: linear-gradient(135deg, var(--cyan), var(--gold)); border-radius: 10px;
}
.logo-title { display: block; font-size: 20px; font-weight: bold; letter-spacing: 2px;
  background: linear-gradient(90deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo-en { display: block; font-size: 9px; color: var(--txt-dim); letter-spacing: 1.2px; }
.topbar-center { font-size: 15px; color: var(--gold); letter-spacing: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--txt-dim); }
.top-item { white-space: nowrap; }
#top-clock { font-family: Consolas, monospace; color: var(--cyan); font-size: 15px; letter-spacing: 1px; }
.btn-fullscreen {
  padding: 6px 12px; color: var(--gold); background: rgba(255,215,106,.08);
  border: 1px solid rgba(255,215,106,.35); border-radius: 20px; cursor: pointer; font-size: 12px;
}
.btn-fullscreen:hover { background: rgba(255,215,106,.18); }
.top-user { display: flex; align-items: center; gap: 8px; color: var(--txt); }
.avatar {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: #4d3600; border-radius: 50%; font-size: 13px; font-weight: bold;
}

/* ---------- 侧边导航 ---------- */
.sidebar {
  position: fixed; left: 0; top: var(--topbar-h); bottom: 0;
  width: var(--sidebar-w); z-index: 50;
  background: linear-gradient(180deg, #0c274d, #0a1e3d);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  transition: width .25s ease;
  overflow: hidden;
}
.app.side-min .sidebar { width: var(--sidebar-w-min); }
.nav-list { list-style: none; padding: 14px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 6px; border-radius: 9px;
  color: var(--txt-dim); cursor: pointer; position: relative;
  transition: all .2s; white-space: nowrap;
}
.nav-item:hover { color: var(--txt); background: rgba(55,213,255,.08); }
.nav-item.active {
  color: #fff; background: linear-gradient(90deg, rgba(55,213,255,.22), rgba(55,213,255,.02));
  border-left: 3px solid var(--cyan);
}
.nav-item.active::after {
  content: ""; position: absolute; right: 10px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}
.nav-ico { font-size: 18px; flex: none; }
.app.side-min .nav-txt { display: none; }
.app.side-min .nav-item { justify-content: center; }
.sidebar-footer { padding: 18px 14px; font-size: 11px; line-height: 1.8; color: #3d5f8f; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.app.side-min .sidebar-footer { display: none; }

/* ---------- 主内容区 ---------- */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 14px; overflow: auto;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(55,213,255,.06), transparent 40%),
    radial-gradient(ellipse at 0% 100%, rgba(255,215,106,.04), transparent 40%),
    var(--bg-deep);
  transition: margin .25s ease;
}
.app.side-min .main { margin-left: var(--sidebar-w-min); }

/* 页面切换淡入动画 */
.page { display: none !important; }
.page.active { display: block !important; animation: pageFade .45s ease; }
/* 特殊布局页面在激活时才用 flex */
#page-dashboard.active, #page-ai.active { display: flex !important; }
@keyframes pageFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   通用组件
   ============================================================ */
/* 面板 */
.panel {
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  position: relative;
}
.panel-title {
  font-size: 14px; font-weight: bold; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.panel-title i {
  width: 4px; height: 16px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--cyan), var(--gold));
}
.chart { width: 100%; }

/* 页面卡片（业务页面） */
.page-card {
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.page-title { font-size: 17px; margin-bottom: 14px; letter-spacing: 1px; }
.page-title small { font-size: 11px; color: var(--txt-dim); margin-left: 10px; letter-spacing: 1px; font-weight: normal; }

/* 按钮 */
.btn {
  padding: 8px 16px; border: none; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--txt); transition: all .15s;
}
.btn-primary { background: linear-gradient(135deg, #1e90e0, var(--cyan)); color: #04182e; font-weight: bold; }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(55,213,255,.35); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--txt-dim); }
.btn-ghost:hover { color: var(--txt); border-color: var(--cyan); }
.btn-mini { padding: 4px 10px; font-size: 12px; background: rgba(55,213,255,.08); border: 1px solid var(--line-soft); color: var(--txt-dim); border-radius: 5px; }
.btn-mini.active { color: #04182e; background: var(--cyan); border-color: var(--cyan); }

/* 筛选区 */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 14px; margin-bottom: 12px;
  background: rgba(8, 26, 52, .6);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.filter-item label { display: block; font-size: 12px; color: var(--txt-dim); margin-bottom: 5px; }
.filter-item input, .filter-item select {
  width: 170px; padding: 8px 10px; font-size: 13px;
  color: var(--txt); background: #06192f;
  border: 1px solid var(--line); border-radius: 6px; outline: none;
}
.filter-item input:focus, .filter-item select:focus { border-color: var(--cyan); }
.filter-item select option { background: #06192f; }
.filter-btns { margin-left: auto; display: flex; gap: 10px; }

/* 表格 */
.table-summary { font-size: 12px; color: var(--txt-dim); margin-bottom: 10px; }
.table-summary b { color: var(--cyan); }
.c-green { color: var(--green); } .c-gray { color: #7d93ad; }
.c-cyan { color: var(--cyan); } .c-gold { color: var(--gold); }
.c-red { color: var(--red); } .c-org { color: var(--orange); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 10px 8px; text-align: left; white-space: nowrap;
  color: var(--gold); font-weight: bold;
  background: rgba(10, 30, 61, .9);
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 10px 8px; color: var(--txt-dim);
  border-bottom: 1px solid rgba(29, 74, 134, .35);
  white-space: nowrap;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(55,213,255,.06); }
.data-table tbody tr:hover td { color: var(--txt); }
.link-btn { color: var(--cyan); cursor: pointer; background: none; border: none; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* 标签 */
.tag { display: inline-block; padding: 2px 9px; font-size: 11px; border-radius: 10px; white-space: nowrap; }
.tag-green { background: rgba(110,231,168,.14); color: var(--green); border: 1px solid rgba(110,231,168,.4); }
.tag-gray { background: rgba(125,147,173,.14); color: #9fb4cc; border: 1px solid rgba(125,147,173,.4); }
.tag-cyan { background: rgba(55,213,255,.14); color: var(--cyan); border: 1px solid rgba(55,213,255,.4); }
.tag-gold { background: rgba(255,215,106,.14); color: var(--gold); border: 1px solid rgba(255,215,106,.4); }
.tag-org { background: rgba(255,158,106,.16); color: var(--orange); border: 1px solid rgba(255,158,106,.45); }
.tag-red { background: rgba(255,107,129,.16); color: var(--red); border: 1px solid rgba(255,107,129,.5); }
.tag-blue { background: rgba(94,160,255,.16); color: #7fb5ff; border: 1px solid rgba(94,160,255,.45); }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--txt-dim); }
.pager button {
  min-width: 30px; height: 30px; padding: 0 8px;
  background: rgba(8,26,52,.8); border: 1px solid var(--line);
  border-radius: 6px; color: var(--txt-dim); cursor: pointer; font-size: 12px;
}
.pager button:hover:not(:disabled) { color: var(--cyan); border-color: var(--cyan); }
.pager button.cur { background: var(--cyan); color: #04182e; font-weight: bold; border-color: var(--cyan); }
.pager button:disabled { opacity: .35; cursor: default; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 900; display: none;
  background: rgba(4, 12, 26, .72); backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; animation: pageFade .3s ease; }
.modal {
  width: 720px; max-width: 94vw; max-height: 88vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d2b56, #0a1e3d);
  border: 1px solid var(--line-soft); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  font-size: 16px; font-weight: bold; letter-spacing: 1px;
  background: linear-gradient(90deg, rgba(55,213,255,.12), transparent);
}
.modal-close { background: none; border: none; color: var(--txt-dim); font-size: 16px; cursor: pointer; }
.modal-close:hover { color: var(--red); }
.modal-body { padding: 18px; overflow-y: auto; }

/* 详情字段组 */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; margin-bottom: 16px; }
.detail-grid.two { grid-template-columns: repeat(2, 1fr); }
.detail-grid .d-item { background: rgba(8,26,52,.55); border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 12px; }
.detail-grid .d-item label { display: block; font-size: 11px; color: var(--txt-dim); margin-bottom: 3px; }
.detail-grid .d-item span { font-size: 13px; color: var(--txt); }
.sec-title { font-size: 13px; color: var(--gold); margin: 4px 0 10px; letter-spacing: 1px; border-left: 3px solid var(--gold); padding-left: 8px; }

/* 房间平面示意图 */
.room-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.room-cell {
  width: 54px; height: 40px; border-radius: 5px; font-size: 11px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .15s;
}
.room-cell:hover { transform: scale(1.12); }
.room-rented { background: rgba(110,231,168,.22); border: 1px solid var(--green); color: var(--green); }
.room-empty { background: rgba(125,147,173,.15); border: 1px solid #556a85; color: #8aa0ba; }
.room-book { background: rgba(255,158,106,.2); border: 1px solid var(--orange); color: var(--orange); }
.room-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--txt-dim); }
.room-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* 时间线（人员轨迹） */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--cyan), transparent); }
.tl-item { position: relative; padding: 0 0 16px 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg-deep); border: 2px solid var(--cyan); box-shadow: 0 0 8px rgba(55,213,255,.6);
}
.tl-item .tl-time { font-size: 12px; color: var(--gold); font-family: Consolas, monospace; }
.tl-item .tl-body { font-size: 13px; color: var(--txt); margin-top: 2px; }
.tl-item .tl-meta { font-size: 12px; color: var(--txt-dim); margin-top: 2px; }
.tl-photo {
  width: 64px; height: 48px; margin-top: 5px; border-radius: 5px;
  border: 1px dashed var(--line);
  background: repeating-linear-gradient(45deg, rgba(55,213,255,.06) 0 8px, rgba(8,26,52,.8) 8px 16px);
  display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--txt-dim);
}

/* ============================================================
   页面1：数据总览大屏
   ============================================================ */
#page-dashboard { display: none; }
#page-dashboard.active { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 28px); }

/* KPI 指标卡 */
.kpi-row {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px;
  margin-bottom: 12px;
}
.kpi-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.kpi-card::before { /* 顶部光带 */
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}
.kpi-ico { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; border-radius: 10px; }
.kpi-num {
  font-size: 21px; font-weight: bold; color: var(--cyan);
  font-family: Consolas, "Microsoft YaHei", monospace; line-height: 1.1;
  text-shadow: 0 0 14px rgba(55,213,255,.45);
}
.kpi-name { font-size: 12px; color: var(--txt); margin: 2px 0; }
.kpi-sub { font-size: 11px; color: var(--txt-dim); white-space: nowrap; }
.kpi-sub .up { color: var(--green); } .kpi-sub .down { color: var(--red); }

/* 三栏主体 */
.screen-body {
  flex: 1; display: grid; gap: 12px;
  grid-template-columns: 24% 1fr 24%;
  min-height: 0;
}
.col { display: flex; flex-direction: column; min-height: 0; gap: 4px; }
.col .panel { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 12px; }
.col .panel:last-child { margin-bottom: 0; }
.col .chart { flex: 1; min-height: 0; }
.panel-map { height: 100%; }
.panel-map .map-box { flex: 1; min-height: 300px; }
.map-name { font-size: 12px; color: var(--gold); font-weight: normal; margin-left: auto; }
.map-legend { display: flex; gap: 14px; justify-content: center; padding-top: 6px; font-size: 12px; color: var(--txt-dim); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.range-label { margin-left: auto; font-size: 11px; color: var(--txt-dim); font-weight: normal; }
.back-btn {
  margin-left: auto; font-size: 12px; font-weight: normal; padding: 2px 10px;
  color: var(--gold); border: 1px solid rgba(255,215,106,.4); border-radius: 10px; cursor: pointer;
}
.back-btn:hover { background: rgba(255,215,106,.15); }

/* 告警滚动列表 */
.alarm-list { flex: 1; overflow: hidden; position: relative; }
.alarm-scroll { animation: alarmRoll 14s linear infinite; }
.alarm-list:hover .alarm-scroll { animation-play-state: paused; }
@keyframes alarmRoll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
.alarm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 8px; border-radius: 7px; font-size: 12px;
  cursor: pointer; transition: background .15s;
}
.alarm-item:hover { background: rgba(55,213,255,.08); }
.alarm-item.lv-red { background: rgba(255,107,129,.1); border-left: 3px solid var(--red); }
.alarm-item.lv-org { background: rgba(255,158,106,.1); border-left: 3px solid var(--orange); }
.alarm-item.lv-yel { background: rgba(255,215,106,.08); border-left: 3px solid var(--gold); }
.alarm-item .a-time { margin-left: auto; color: var(--txt-dim); font-family: Consolas, monospace; font-size: 11px; white-space: nowrap; }
.alarm-item .a-txt { color: var(--txt); }
.alarm-tab { margin-left: auto; display: flex; gap: 8px; font-size: 11px; font-weight: normal; color: var(--txt-dim); align-items: center; }
.dot-red, .dot-org, .dot-yel { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.dot-red { background: var(--red); } .dot-org { background: var(--orange); } .dot-yel { background: var(--gold); }

/* 底部出入滚动条 */
.passage-bar {
  flex: none; margin-top: 12px; display: flex; align-items: center;
  height: 40px; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-panel-2); border: 1px solid var(--line-soft);
}
.passage-label {
  flex: none; padding: 0 16px; height: 100%;
  display: flex; align-items: center; font-size: 13px; color: #04182e; font-weight: bold;
  background: linear-gradient(135deg, var(--cyan), #4b9fff);
}
.passage-track { flex: 1; overflow: hidden; position: relative; height: 100%; }
.passage-move {
  position: absolute; white-space: nowrap; top: 0; height: 100%;
  display: flex; align-items: center; gap: 46px; padding-left: 20px;
  font-size: 13px; color: var(--txt-dim);
  animation: passageMove 40s linear infinite;
}
@keyframes passageMove { from { left: 100%; } to { left: -160%; } }
.passage-move b { color: var(--txt); font-weight: normal; }
.passage-move .way { color: var(--cyan); }
.passage-move .num { font-family: Consolas, monospace; color: var(--gold); }

/* ============================================================
   页面4：视频监控
   ============================================================ */
.video-layout { display: flex; gap: 14px; min-height: calc(100vh - var(--topbar-h) - 140px); }
.video-tree { width: 250px; flex: none; align-self: flex-start; }
.tree { font-size: 13px; padding: 4px 0; }
.tree-node .tn-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; color: var(--txt-dim); }
.tree-node .tn-row:hover { background: rgba(55,213,255,.08); color: var(--txt); }
.tree-node.open > .tn-row { color: var(--gold); }
.tree-children { display: none; padding-left: 22px; }
.tree-node.open > .tree-children { display: block; }
.tn-arrow { font-size: 10px; width: 12px; transition: transform .2s; display: inline-block; }
.tree-node.open > .tn-row .tn-arrow { transform: rotate(90deg); }
.tn-count { margin-left: auto; font-size: 11px; color: var(--cyan); background: rgba(55,213,255,.1); padding: 1px 7px; border-radius: 8px; }
.tree-leaf { display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: var(--txt-dim); cursor: pointer; border-radius: 6px; }
.tree-leaf:hover { background: rgba(55,213,255,.08); color: var(--txt); }
.tree-leaf.sel { background: rgba(55,213,255,.16); color: var(--cyan); }

.video-main { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.video-toolbar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--txt-dim); }
.video-toolbar b { color: var(--cyan); }
.video-wall { flex: 1; display: grid; gap: 10px; }
.video-wall.grid9 { grid-template-columns: repeat(3, 1fr); }
.video-wall.grid6 { grid-template-columns: repeat(3, 1fr); }
.vcell {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(rgba(6,18,36,.55), rgba(6,18,36,.55)),
    repeating-linear-gradient(135deg, #0b2244 0 14px, #0d2a52 14px 28px);
  transition: box-shadow .2s, transform .2s;
  min-height: 150px;
}
.vcell:hover { box-shadow: 0 0 0 2px var(--cyan), 0 8px 24px rgba(55,213,255,.25); transform: translateY(-2px); }
.vcell .v-name { position: absolute; left: 10px; top: 8px; font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000; z-index: 3; }
.vcell .v-status { position: absolute; right: 8px; top: 8px; z-index: 3; }
.vcell .v-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; color: rgba(55,213,255,.18); z-index: 1; }
.vcell .v-water {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  font-size: 12px; letter-spacing: 5px; color: rgba(255,255,255,.5); z-index: 2; white-space: nowrap;
}
.vcell .v-time {
  position: absolute; left: 10px; bottom: 8px; right: 10px;
  display: flex; justify-content: space-between; font-size: 11px;
  color: rgba(255,255,255,.55); font-family: Consolas, monospace; z-index: 3;
}
.vcell.offline { filter: grayscale(.9) brightness(.55); }
/* 视频预览弹窗 */
.video-preview { width: 100%; aspect-ratio: 16/9; position: relative; border-radius: 8px; overflow: hidden;
  background: repeating-linear-gradient(135deg, #0b2244 0 20px, #0d2a52 20px 40px); }
.vp-water { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; color: rgba(55,213,255,.15); }
.vp-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; letter-spacing: 8px; color: rgba(255,255,255,.4); }
.vp-time { position: absolute; left: 12px; bottom: 10px; font-family: Consolas, monospace; font-size: 13px; color: rgba(255,255,255,.75); }
.vp-btns { display: flex; gap: 12px; margin-top: 14px; }
.vp-btns .btn { flex: 1; padding: 10px; }
.vp-alarms { margin-top: 14px; }
.vp-alarms .vp-a-item { padding: 8px 12px; background: rgba(8,26,52,.6); border: 1px solid var(--line-soft); border-radius: 7px; margin-bottom: 8px; font-size: 12px; color: var(--txt-dim); display: flex; gap: 12px; }
.vp-alarms .vp-a-item b { color: var(--orange); }
/* 回放进度条 */
.replay-bar { margin-top: 12px; }
.replay-track { position: relative; height: 8px; border-radius: 4px; background: #06192f; cursor: pointer; }
.replay-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--gold)); width: 35%; }
.replay-knob { position: absolute; top: 50%; left: 35%; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); cursor: pointer; }
.replay-times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--txt-dim); font-family: Consolas, monospace; }
.replay-play { margin-top: 10px; text-align: center; }
.replay-play button { padding: 6px 22px; border-radius: 20px; border: 1px solid var(--line); background: rgba(55,213,255,.08); color: var(--cyan); cursor: pointer; }

/* ============================================================
   页面5：AI智能治理
   ============================================================ */
#page-ai.active { display: flex !important; flex-direction: column; gap: 14px; }
.ai-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ai-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; align-items: start; }
.ai-right { display: flex; flex-direction: column; gap: 14px; }
.ai-right .page-card { margin-bottom: 0; }
.rule-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rule-box { border-radius: 10px; padding: 12px 14px; border: 1px solid var(--line-soft); }
.rule-box h4 { font-size: 13px; margin-bottom: 10px; letter-spacing: 1px; }
.rule-box.add h4 { color: var(--green); }
.rule-box.sub h4 { color: var(--red); }
.rule-box p { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--txt-dim); border-bottom: 1px dashed rgba(29,74,134,.3); }
.rule-box p:last-child { border-bottom: none; }
.rule-box.add p b { color: var(--green); }
.rule-box.sub p b { color: var(--red); }
.rank-table td { padding: 8px; }
.rank-badge { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; font-size: 12px; font-weight: bold; }
.rank-1 { background: linear-gradient(135deg, #ffd76a, #ff9e6a); color: #4d3600; }
.rank-2 { background: linear-gradient(135deg, #cfd8e8, #9fb4cc); color: #21314a; }
.rank-3 { background: linear-gradient(135deg, #ffb98a, #d98d5f); color: #4a2a12; }
.rank-n { background: rgba(55,213,255,.12); color: var(--cyan); }
.rank-up { color: var(--green); } .rank-down { color: var(--red); } .rank-flat { color: var(--txt-dim); }

.effect-box { display: flex; align-items: stretch; gap: 14px; margin-bottom: 14px; }
.effect-item { flex: 1; text-align: center; padding: 16px 10px; border-radius: 10px; border: 1px solid var(--line-soft); background: rgba(8,26,52,.5); }
.effect-label { font-size: 12px; padding: 2px 10px; border-radius: 10px; }
.effect-box .effect-item:first-child .effect-label { background: rgba(125,147,173,.2); color: #9fb4cc; }
.effect-box .effect-item:last-child .effect-label { background: rgba(55,213,255,.15); color: var(--cyan); }
.effect-num { font-size: 26px; font-weight: bold; color: var(--txt); margin: 10px 0 4px; font-family: Consolas, monospace; }
.effect-num small { font-size: 12px; color: var(--txt-dim); font-weight: normal; }
.effect-desc { font-size: 12px; color: var(--txt-dim); }
.effect-arrow { align-self: center; color: var(--gold); font-size: 13px; white-space: nowrap; }
.effect-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.effect-tags span { font-size: 12px; padding: 5px 12px; border-radius: 14px; color: var(--cyan); background: rgba(55,213,255,.08); border: 1px solid rgba(55,213,255,.25); }

/* AI处置流程步骤条 */
.ai-flow { margin: 6px 0 18px; }
.ai-flow ol { list-style: none; display: flex; justify-content: space-between; position: relative; margin-bottom: 14px; }
.ai-flow ol::before { content: ""; position: absolute; left: 6%; right: 6%; top: 15px; height: 2px; background: var(--line); }
.ai-flow li { position: relative; text-align: center; flex: 1; z-index: 2; }
.ai-flow li .f-dot {
  width: 32px; height: 32px; margin: 0 auto 8px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--bg-panel); border: 2px solid var(--line); color: var(--txt-dim);
}
.ai-flow li.done .f-dot { background: rgba(110,231,168,.15); border-color: var(--green); color: var(--green); box-shadow: 0 0 10px rgba(110,231,168,.3); }
.ai-flow li.doing .f-dot { background: rgba(255,215,106,.15); border-color: var(--gold); color: var(--gold); box-shadow: 0 0 10px rgba(255,215,106,.4); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 18px rgba(255,215,106,.75); } }
.ai-flow li .f-name { font-size: 12px; color: var(--txt); }
.ai-flow li .f-desc { font-size: 11px; color: var(--txt-dim); margin-top: 3px; }
.flow-logs { font-size: 12px; border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 14px; background: rgba(8,26,52,.5); max-height: 170px; overflow-y: auto; }
.flow-logs p { padding: 4px 0; color: var(--txt-dim); border-bottom: 1px dashed rgba(29,74,134,.25); font-family: Consolas, "Microsoft YaHei", monospace; }
.flow-logs p b { color: var(--cyan); font-weight: normal; }

/* ============================================================
   页面6：数据统计分析
   ============================================================ */
.stats-toolbar { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--txt-dim); }
.stats-toolbar select { padding: 9px 14px; font-size: 13px; color: var(--txt); background: #06192f; border: 1px solid var(--line); border-radius: 7px; outline: none; }
.stats-toolbar select:focus { border-color: var(--cyan); }
.stats-note { color: var(--txt-dim); font-size: 12px; }
.stats-sec-title { font-size: 15px; color: var(--gold); margin: 8px 0 12px; letter-spacing: 1px; }
.stats-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.stats-grid.g4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid .page-card { margin-bottom: 0; }
.card-title { font-size: 13px; color: var(--txt); margin-bottom: 8px; letter-spacing: 1px; }
.stats-grid .chart { height: 230px; }
#page-stats .page-card:last-child { padding-bottom: 16px; }

/* ============================================================
   AI 智能客服浮窗（assistant.js 动态注入）
   ============================================================ */
/* 右下角悬浮球 */
#ai-fab {
  position: fixed; right: 26px; bottom: 30px; z-index: 950;
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  background: linear-gradient(135deg, #1e90e0, var(--cyan));
  border: 2px solid rgba(55, 213, 255, .55);
  box-shadow: 0 6px 24px rgba(30, 144, 224, .45);
  transition: transform .2s, box-shadow .2s;
}
#ai-fab:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 30px rgba(55, 213, 255, .55); }
#ai-fab.hide { display: none; }
#ai-fab .fab-ico { font-size: 26px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
#ai-fab .fab-ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid rgba(55, 213, 255, .5);
  animation: fabPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes fabPulse {
  0% { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* 聊天窗体 */
#ai-chat-box {
  position: fixed; right: 26px; bottom: 30px; z-index: 960;
  width: 380px; max-width: calc(100vw - 40px);
  height: 520px; max-height: calc(100vh - 90px);
  display: none; flex-direction: column;
  background: linear-gradient(180deg, #0d2b56, #0a1e3d);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(55, 213, 255, .06);
  overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.96);
  transition: opacity .25s ease, transform .25s ease;
}
#ai-chat-box.open { display: flex; opacity: 1; transform: none; }

/* 头部 */
.ai-chat-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(55, 213, 255, .14), rgba(55, 213, 255, .02));
  border-bottom: 1px solid var(--line-soft);
}
.ai-chat-title { display: flex; align-items: center; gap: 10px; }
.ai-chat-logo {
  width: 36px; height: 36px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: bold; color: #04182e;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  border-radius: 10px;
  box-shadow: 0 0 16px rgba(55, 213, 255, .35);
}
.ai-chat-title b { display: block; font-size: 14px; letter-spacing: 1px; }
.ai-chat-title small { display: block; font-size: 10px; color: var(--txt-dim); margin-top: 2px; }
.ai-chat-close {
  background: none; border: none; cursor: pointer;
  color: var(--txt-dim); font-size: 15px; padding: 4px 8px; border-radius: 6px;
}
.ai-chat-close:hover { color: var(--red); background: rgba(255, 107, 129, .1); }

/* 消息区 */
.ai-chat-list { flex: 1; overflow-y: auto; padding: 14px 12px 6px; }
.ai-msg { display: flex; gap: 8px; margin-bottom: 12px; position: relative; }
.ai-msg-avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; margin-top: 2px;
}
.ai-msg.bot .ai-msg-avatar { background: linear-gradient(135deg, var(--cyan), var(--gold)); color: #04182e; }
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg.user .ai-msg-avatar { background: var(--gold); color: #4d3600; }
.ai-msg-bubble {
  max-width: 76%; padding: 9px 12px; font-size: 13px; line-height: 1.65;
  border-radius: 10px; word-break: break-all;
}
.ai-msg.bot .ai-msg-bubble {
  background: rgba(8, 26, 52, .78); border: 1px solid var(--line-soft); color: var(--txt);
  border-top-left-radius: 3px;
}
.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, #1e90e0, #2fa8ff); color: #fff;
  border-top-right-radius: 3px;
}
.ai-msg-bubble b { color: var(--cyan); font-weight: bold; }
.ai-msg.user .ai-msg-bubble b { color: #fff; }
.ai-msg-bubble .c-green { color: var(--green); }
.ai-msg-bubble .c-red { color: var(--red); }
.ai-msg-time {
  position: absolute; top: -4px; font-size: 10px; color: #5c7699;
  font-family: Consolas, monospace;
}
.ai-msg.bot .ai-msg-time { left: 42px; }
.ai-msg.user .ai-msg-time { right: 42px; }

/* 打字机光标 */
.ai-msg-bubble.typing::after {
  content: "▍"; color: var(--cyan); animation: blink .8s step-end infinite; margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* "思考中"动画 */
.ai-dots { display: inline-flex; gap: 5px; align-items: center; height: 14px; }
.ai-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
  animation: dotJump 1.2s infinite;
}
.ai-dots i:nth-child(2) { animation-delay: .18s; }
.ai-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dotJump { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* 推荐问题条 */
.ai-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px 38px; }
.ai-suggest button {
  font-size: 12px; padding: 5px 12px; cursor: pointer;
  color: var(--cyan); background: rgba(55, 213, 255, .08);
  border: 1px solid rgba(55, 213, 255, .3); border-radius: 14px;
  transition: all .15s;
}
.ai-suggest button:hover { background: rgba(55, 213, 255, .2); color: #fff; transform: translateY(-1px); }

/* 底部输入区 */
.ai-chat-foot {
  flex: none; display: flex; gap: 10px; padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  background: rgba(6, 21, 41, .6);
}
.ai-chat-foot input {
  flex: 1; padding: 10px 12px; font-size: 13px; outline: none;
  color: var(--txt); background: #06192f;
  border: 1px solid var(--line); border-radius: 8px;
}
.ai-chat-foot input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(55, 213, 255, .12); }
#ai-chat-send {
  flex: none; width: 42px; border: none; border-radius: 8px; cursor: pointer;
  color: #04182e; font-size: 16px;
  background: linear-gradient(135deg, var(--cyan), #4b9fff);
  transition: box-shadow .15s, transform .15s;
}
#ai-chat-send:hover { box-shadow: 0 4px 14px rgba(55, 213, 255, .45); transform: translateY(-1px); }
.ai-chat-tip {
  flex: none; padding: 6px 12px 8px; font-size: 10px; color: #4d6788;
  text-align: center; background: rgba(6, 21, 41, .6);
  border-top: 1px dashed rgba(29, 74, 134, .4);
}

/* ============================================================
   响应式适配（1440 以下大屏自动缩放 KPI）
   ============================================================ */
@media (max-width: 1600px) {
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .kpi-num { font-size: 18px; }
}
@media (max-width: 1360px) {
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .screen-body { grid-template-columns: 30% 1fr 30%; }
  .stats-grid.g4 { grid-template-columns: repeat(2, 1fr); }
  .ai-layout { grid-template-columns: 1fr; }
  .topbar-center { display: none; }
}
@media (max-width: 1100px) {
  .screen-body { grid-template-columns: 1fr; overflow-y: auto; }
  #page-dashboard.active { height: auto; }
  .col-l .chart, .col-r .chart { min-height: 220px; }
  .video-layout { flex-direction: column; }
  .video-tree { width: 100%; }
}
