/* ============================================================
   style.css - 云端智慧收费特情处置模拟系统（实训版）v2.0
   布局：顶部功能区 + 左（入口/工单流）+ 右（出口/特情处理）
   主题：深蓝科技感 · 响应式
   ============================================================ */
:root {
  --bg: #0a1628;
  --bg2: #0e1f38;
  --panel: rgba(16, 38, 66, 0.85);
  --panel-solid: #102642;
  --panel-light: #16304f;
  --line: rgba(94, 175, 255, 0.18);
  --line-strong: rgba(94, 175, 255, 0.4);
  --primary: #2f8cff;
  --primary-2: #00d4ff;
  --danger: #ff4d6a;
  --warn: #ffb020;
  --ok: #2ee6a8;
  --text: #e6f1ff;
  --text-dim: #8fb3d9;
  --text-dark: #14304f;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 140, 255, 0.16), transparent 60%),
    radial-gradient(900px 400px at 95% 0%, rgba(0, 212, 255, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

/* ---------- 通用元素 ---------- */
button { font-family: inherit; cursor: pointer; }
.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  background: var(--panel-light);
  color: var(--text);
  transition: all .18s;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 600; }
.btn-danger { background: linear-gradient(135deg, #ff4d6a, #ff7a5c); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--text-dim); }
.btn-soft { background: rgba(47, 140, 255, 0.14); color: var(--primary-2); border: 1px solid rgba(47, 140, 255, 0.35); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

input[type="text"], input[type="password"], input[type="number"], textarea, select {
  background: rgba(10, 24, 46, 0.85);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15); }

/* ---------- 登录视图 ---------- */
#loginView { display: none; position: fixed; inset: 0; align-items: center; justify-content: center; z-index: 100; background: radial-gradient(900px 600px at 50% 0%, rgba(47,140,255,.2), transparent 65%), var(--bg); }
#loginView.show { display: flex; }
.login-box {
  width: 400px; max-width: 92vw;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 36px 34px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-box h1 { font-size: 20px; letter-spacing: 1px; margin-bottom: 4px; }
.login-sub { color: var(--text-dim); font-size: 12px; margin-bottom: 24px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-error { color: var(--danger); font-size: 12px; min-height: 16px; text-align: left; }
.login-hint { margin-top: 16px; color: var(--text-dim); font-size: 11px; line-height: 1.6; }

/* ---------- 应用主视图 ---------- */
#appView { display: none; height: 100vh; flex-direction: column; }
#appView.show { display: flex; }

/* ===== 顶部功能区（横贯全屏） ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(16, 38, 66, 0.95), rgba(10, 24, 46, 0.92));
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  z-index: 20;
  flex-wrap: wrap;
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 260px; }
.top-logo { font-size: 22px; }
.top-title { font-size: 16px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
.role-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: rgba(47, 140, 255, 0.2); color: var(--primary-2); border: 1px solid rgba(47, 140, 255, 0.4);
}
.role-badge.role-yunkong { background: rgba(0, 212, 255, 0.16); color: #7fe9ff; }
.role-badge.role-feiyuan { background: rgba(46, 230, 168, 0.14); color: #7ff0cd; }
.role-badge.role-admin { background: rgba(255, 176, 32, 0.14); color: #ffd27a; }

.top-stats { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
.ts-item {
  min-width: 88px; padding: 6px 14px; text-align: center;
  background: rgba(10, 24, 46, 0.6); border: 1px solid var(--line);
  border-radius: 10px;
}
.ts-item .ts-label { display: block; font-size: 10px; color: var(--text-dim); }
.ts-item b { font-size: 17px; color: var(--primary-2); font-family: Consolas, monospace; }
.ts-item b { transition: color .2s; }
.top-right { display: flex; align-items: center; gap: 10px; }
.top-time { font-family: Consolas, monospace; color: var(--text-dim); font-size: 12px; }
.top-role { color: var(--text); font-size: 12px; white-space: nowrap; }
.top-nav { display: flex; gap: 4px; }
.top-nav button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
}
.top-nav button:hover { color: var(--text); background: rgba(47, 140, 255, 0.12); }
.top-nav button.active { color: #fff; background: linear-gradient(135deg, rgba(47,140,255,.35), rgba(0,212,255,.25)); }

/* ===== 主区域：左右两列（入口/工单 | 出口/特情），每列内上下各 50% 占满 ===== */
.main-grid {
  display: none;
  flex: 1;
  flex-direction: row;
  gap: 12px;
  padding: 12px 16px;
  min-height: 0;
  min-width: 0;
}
.main-grid.show { display: flex; }
.col-left, .col-right {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(47, 140, 255, 0.10), transparent);
}
.panel-head h3 { font-size: 14px; font-weight: 600; }
.panel-hint { font-size: 11px; color: var(--text-dim); }
.panel-stat { font-size: 12px; color: var(--text-dim); }
.panel-stat b { color: var(--primary-2); font-size: 15px; font-family: Consolas, monospace; }

/* 入口 / 出口展示区（顶部车道动画 + 小正方形过车方块网格） */
.entry-panel, .exit-panel { min-height: 0; }
.lane-area { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lane-road { position: relative; height: 72px; overflow: hidden; background: linear-gradient(#1b3353, #0e2038); border-bottom: 1px solid var(--line); }
.lane-track { position: absolute; left: 0; right: 0; top: 18px; height: 40px; overflow: hidden; border-top: 2px dashed rgba(255,255,255,.25); border-bottom: 2px dashed rgba(255,255,255,.25); }
.lane-gate {
  position: absolute; top: 8px; right: 14px;
  font-size: 11px; color: var(--primary-2);
  background: rgba(47, 140, 255, 0.16); border: 1px solid rgba(47, 140, 255, 0.4);
  padding: 3px 10px; border-radius: 12px; z-index: 3;
}
.lane-car {
  position: absolute; top: 8px; width: 30px; height: 20px; border-radius: 4px; opacity: 0;
  animation: laneRun 3s linear infinite;
}
.lane-car.c1 { background: #e74c3c; }
.lane-car.c2 { background: #3498db; }
.lane-car::before { content: ''; position: absolute; top: 2px; left: 5px; width: 10px; height: 7px; background: rgba(200, 235, 255, 0.85); border-radius: 3px; }
.track-entry .lane-car { animation-name: laneRunL; }
.track-exit .lane-car { animation-name: laneRunR; }
@keyframes laneRunL { 0% { left: -40px; opacity: 0; } 8% { opacity: 1; } 90% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes laneRunR { 0% { left: 100%; opacity: 0; } 8% { opacity: 1; } 90% { opacity: 1; } 100% { left: 8px; opacity: 0; } }

/* 过车小方块（与工单方块同款网格） */
.lane-events {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  grid-auto-rows: 86px;
  gap: 8px;
  align-content: start;
}
.lane-ev {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(150deg, rgba(255, 176, 32, 0.16), rgba(255, 176, 32, 0.05));
  border: 1px solid rgba(255, 176, 32, 0.5);
  border-radius: 10px;
  padding: 5px;
  text-align: center;
  overflow: hidden;
}
.lane-ev .ev-plate { color: var(--text); font-family: Consolas, monospace; font-weight: 700; font-size: 13px; line-height: 1.2; word-break: break-all; max-width: 100%; }
.lane-ev .ev-lane { color: var(--text-dim); font-size: 11px; line-height: 1.2; }
.lane-ev.empty { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; border-color: var(--line); background: rgba(10, 24, 46, 0.5); }

/* 工单显示窗口（小正方形方块网格） */
.ticket-panel { flex: 1; min-height: 0; }
.ticket-flow {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  grid-auto-rows: 86px;
  gap: 8px;
  align-content: start;
}
.flow-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(150deg, rgba(255, 176, 32, 0.16), rgba(255, 176, 32, 0.05));
  border: 1px solid rgba(255, 176, 32, 0.5);
  border-radius: 10px;
  padding: 5px;
  text-align: center;
  overflow: hidden;
  opacity: 0; transform: translateY(-6px) scale(.9);
  transition: opacity .35s, transform .35s, background .4s, border-color .4s;
  animation: flowIn .35s forwards;
  cursor: pointer;
}
.flow-card.in { opacity: 1; transform: none; }
.flow-card.manual { border-color: rgba(255, 77, 106, 0.75); background: linear-gradient(150deg, rgba(255, 77, 106, 0.18), rgba(255, 77, 106, 0.06)); box-shadow: 0 0 12px rgba(255, 77, 106, 0.25); }
.flow-card.auto-done { border-color: rgba(46, 230, 168, 0.55); background: linear-gradient(150deg, rgba(46, 230, 168, 0.14), rgba(46, 230, 168, 0.05)); }
.flow-card.fading { opacity: 0; transform: scale(0.7); transition: all .6s; }
@keyframes flowIn { from { opacity: 0; transform: translateY(-8px) scale(.9); } to { opacity: 1; transform: none; } }

.flow-plate { font-size: 12px; font-weight: 700; font-family: Consolas, monospace; letter-spacing: .3px; line-height: 1.15; word-break: break-all; max-width: 100%; }
.flow-badge { padding: 0 6px; border-radius: 8px; font-size: 9px; font-weight: 600; line-height: 1.7; }
.badge-emergency { background: rgba(255, 77, 106, 0.22); color: #ff9db0; border: 1px solid rgba(255, 77, 106, 0.5); }
.badge-normal { background: rgba(255, 176, 32, 0.16); color: #ffd27a; border: 1px solid rgba(255, 176, 32, 0.4); }
.flow-type { font-size: 12px; color: var(--text); line-height: 1.3; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flow-meta { font-size: 11px; color: var(--text-dim); line-height: 1.2; }
.flow-status { font-size: 11px; color: var(--text-dim); line-height: 1.2; }
.flow-ops { margin-top: auto; }
.flow-ops .btn-sm { padding: 2px 8px; font-size: 11px; }
.tag-auto { color: var(--ok); }
.tag-timeout { color: var(--danger); }

/* 特情处理窗口 */
.scene-panel { flex: 1; min-height: 0; }
.scene-area { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scene-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); text-align: center; font-size: 13px; line-height: 2;
}

/* 特情处理窗口：人工特情工单（86px 小正方形，与工单处理窗口一致） */
.special-list {
  position: absolute; inset: 0; z-index: 20;
  padding: 10px; overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  grid-auto-rows: 86px;
  gap: 8px;
  align-content: start;
}
.special-empty {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); text-align: center; font-size: 13px; line-height: 2;
}
/* 特情方块禁用整体重渲染时的入场动画，避免持续闪烁 */
.special-list .flow-card { animation: none; }

/* 新工单接入弹窗（特情处理窗口内，右下角） */
#ticketAlert {
  position: absolute; bottom: 10px; right: 10px; width: 320px; max-width: 92%;
  background: linear-gradient(160deg, rgba(255, 77, 106, 0.20), rgba(16, 38, 66, 0.97));
  border: 1px solid rgba(255, 77, 106, 0.6);
  border-radius: 14px; box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
  z-index: 30; overflow: hidden;
  opacity: 0; transform: translateY(28px); pointer-events: none;
  transition: all .35s;
}
#ticketAlert.show { opacity: 1; transform: none; pointer-events: auto; animation: alertPulse 1.2s ease 1; }
#ticketAlert.hide { opacity: 0; transform: translateY(28px); pointer-events: none; }
@keyframes alertPulse { 0%,100% { box-shadow: 0 10px 36px rgba(0,0,0,.55); } 50% { box-shadow: 0 0 0 6px rgba(255,77,106,.25), 0 10px 36px rgba(0,0,0,.55); } }
.ta-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(255, 77, 106, 0.16); border-bottom: 1px solid rgba(255, 77, 106, 0.3); }
.ta-badge { font-size: 12px; font-weight: 700; color: #ff8ba0; }
.ta-close { background: none; border: none; color: var(--text-dim); font-size: 18px; line-height: 1; }
.ta-body { padding: 12px; }
.ta-plate { font-size: 26px; font-weight: 800; font-family: Consolas, monospace; color: #fff; letter-spacing: 2px; }
.ta-type { font-size: 14px; color: #ffb0bd; margin: 4px 0 10px; }
.ta-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; flex-wrap: wrap; }
.ta-meta b { color: var(--text); }
.ta-ops { display: flex; justify-content: flex-end; gap: 8px; padding: 0 12px 12px; }

/* 特情处置案例展示区（弹窗内） */
.ta-case { margin-top: 8px; border-top: 1px dashed rgba(255, 77, 106, 0.35); padding-top: 8px; }
.ta-case-label { font-size: 11px; font-weight: 700; color: #ffb0bd; margin-bottom: 6px; }
.ta-case-img { width: 100%; display: block; border-radius: 8px; border: 1px solid rgba(255, 77, 106, 0.35); background: rgba(8, 20, 38, 0.6); }
.ta-case-title { font-size: 12px; color: #ffd0d8; margin-top: 6px; text-align: center; }

/* 车道场景视图 */
#sceneView {
  position: absolute; inset: 0; z-index: 25;
  background: linear-gradient(170deg, #0a1a30, #0d2038);
  display: flex; flex-direction: column;
  opacity: 0; transform: scale(0.96); pointer-events: none;
  transition: all .3s;
}
#sceneView.show { opacity: 1; transform: none; pointer-events: auto; }
.sv-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(10, 24, 46, 0.8); border-bottom: 1px solid var(--line); }
.sv-title { font-size: 14px; font-weight: 700; color: var(--primary-2); }
.sv-close { background: none; border: none; color: var(--text-dim); font-size: 20px; line-height: 1; }
.sv-info { display: flex; gap: 12px; padding: 6px 12px; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sv-info b { color: var(--text); }
.sv-case { padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(8, 20, 38, 0.5); }
.sv-case-label { font-size: 12px; font-weight: 700; color: var(--primary-2); margin-bottom: 6px; }
.sv-case-label span { font-weight: 400; color: var(--text); }
.sv-case-img { width: 100%; max-height: 130px; display: block; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.75); }
.sv-scene { height: 150px; flex: 0 0 auto; background: #0e2038; }
#laneCanvas { width: 100%; height: 100%; display: block; }
.sv-intercom { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); overflow: hidden; background: rgba(8, 20, 38, 0.55); }
.sv-tip { flex: 0 0 auto; padding: 6px 12px; font-size: 13px; color: var(--text-dim); text-align: center; border-top: 1px solid var(--line); background: rgba(10, 26, 48, 0.5); }

/* 对讲面板 */
#sceneIntercom { display: flex; flex-direction: column; }
.ic-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: rgba(10, 24, 46, 0.6); }
.ic-peer { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ic-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; }
.ic-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: blink 1.2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.ic-state { font-size: 11px; color: var(--text-dim); }
.ic-bubbles { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 30px; max-height: 130px; }
.ic-bubble { max-width: 82%; padding: 7px 12px; border-radius: 10px; font-size: 15px; position: relative; }
.ic-bubble span { display: block; line-height: 1.5; }
.ic-bubble em { display: block; font-style: normal; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.ic-bubble.peer { align-self: flex-start; background: rgba(47, 140, 255, 0.18); border: 1px solid rgba(47, 140, 255, 0.3); }
.ic-bubble.me { align-self: flex-end; background: rgba(46, 230, 168, 0.16); border: 1px solid rgba(46, 230, 168, 0.3); }
.ic-empty { color: var(--text-dim); font-size: 12px; padding: 12px; text-align: center; }
.ic-ops { display: flex; gap: 8px; padding: 6px 12px; flex-wrap: wrap; }
.ic-input { display: flex; gap: 8px; padding: 0 12px 8px; }
.ic-input input { flex: 1; font-size: 14px; }

/* 处置表单 */
.dp-ticket { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: rgba(47, 140, 255, 0.08); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.dp-type { font-size: 15px; font-weight: 700; color: var(--text); }
.dp-meta { font-size: 13px; color: var(--text-dim); margin-left: auto; }
.sf-label { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.sf-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sf-step { font-size: 14px; color: var(--text-dim); background: rgba(47, 140, 255, 0.1); border: 1px solid var(--line); padding: 5px 12px; border-radius: 6px; line-height: 1.5; }
.sf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sf-actions .btn { font-size: 14px; padding: 6px 14px; }
.sf-actions .btn.selected {
  background: rgba(46, 230, 168, 0.22); border-color: var(--ok); color: #a9f7d8;
  box-shadow: 0 0 0 2px rgba(46, 230, 168, 0.25); font-weight: 700;
}
.sf-remark textarea { min-height: 46px; font-size: 13px; }
.sf-submit { text-align: right; margin-top: 8px; }
.sf-submit .btn { font-size: 14px; padding: 7px 18px; }

/* 全局通话浮条 */
#callPanel {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: none; align-items: center; gap: 12px;
  background: rgba(14, 31, 56, 0.96); border: 1px solid rgba(0, 212, 255, 0.45);
  border-radius: 14px; padding: 10px 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
}
#callPanel.show { display: flex; }
.cp-peer { font-size: 13px; }
.cp-state { font-size: 11px; color: var(--primary-2); }
.cp-plate { font-size: 12px; color: var(--text-dim); font-family: Consolas, monospace; }

/* 放行动画 */
#releaseAnim {
  position: fixed; inset: 0; z-index: 95; display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 12, 24, 0.65); backdrop-filter: blur(3px);
}
#releaseAnim.show { display: flex; }
.ra-content {
  text-align: center; padding: 36px 60px;
  background: linear-gradient(160deg, rgba(16, 60, 48, 0.95), rgba(10, 30, 26, 0.97));
  border: 1px solid rgba(46, 230, 168, 0.6);
  border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: raPop .4s;
}
@keyframes raPop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.ra-icon { font-size: 52px; margin-bottom: 8px; }
.ra-plate { font-size: 30px; font-weight: 800; font-family: Consolas, monospace; letter-spacing: 3px; color: var(--ok); }
.ra-lane { font-size: 14px; color: var(--text-dim); margin: 6px 0; }
.ra-text { font-size: 15px; color: var(--ok); }

/* 通用模态 */
#modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; background: rgba(4, 10, 20, 0.7); }
#modal.show { display: flex; }
#disposeModal { position: fixed; inset: 0; z-index: 130; display: none; align-items: center; justify-content: center; background: rgba(4, 10, 20, 0.72); }
#disposeModal.show { display: flex; }
#disposeModal .modal-box { width: 480px; }
.dispose-box .modal-head b { color: #ffd27a; font-family: Consolas, monospace; font-size: 15px; }
.modal-box { width: 520px; max-width: 92vw; max-height: 82vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 20px; }
.modal-body { padding: 16px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(14, 31, 56, 0.96); border: 1px solid var(--line-strong);
  color: var(--text); padding: 10px 22px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 200; font-size: 13px;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.warn { border-color: var(--warn); color: #ffd27a; }

/* ---------- 覆盖页（统计/知识库/设置） ---------- */
.page-section { display: none; flex: 1; padding: 16px; overflow: auto; }
.page-section.show { display: block; }
.page-body { padding: 14px; overflow: auto; }
.panel-title { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--primary-2); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: linear-gradient(135deg, rgba(22, 48, 79, 0.9), rgba(10, 24, 46, 0.9)); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat-card b { display: block; font-size: 24px; color: var(--primary-2); font-family: Consolas, monospace; }
.stat-card span { font-size: 12px; color: var(--text-dim); }

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.table th { background: rgba(47, 140, 255, 0.12); color: var(--primary-2); }
.table tr:nth-child(even) td { background: rgba(10, 24, 46, 0.4); }

.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-item { background: rgba(16, 38, 66, 0.7); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kb-head b { font-size: 14px; }
.kb-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.kb-steps { font-size: 12px; color: var(--primary-2); margin-top: 6px; }
.kb-actions { font-size: 12px; color: var(--ok); margin-top: 4px; }

/* 设置页 */
.set-group { background: rgba(16, 38, 66, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.set-title { font-size: 13px; font-weight: 700; color: var(--primary-2); margin-bottom: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row input[type="number"] { width: 150px; }
.set-actions { text-align: right; }
.switch { position: relative; width: 42px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #26374e; border-radius: 20px; transition: .25s; }
.switch i::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #8fa7c0; border-radius: 50%; transition: .25s; }
.switch input:checked + i { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.switch input:checked + i::before { transform: translateX(20px); background: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(94, 175, 255, 0.35); border-radius: 4px; }
::-webkit-scrollbar-track { background: rgba(10, 24, 46, 0.5); }

/* 响应式 */
@media (max-width: 1080px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .top-stats { justify-content: flex-start; }
  .main-grid { flex-direction: column; overflow: auto; }
  .col-left, .col-right { min-height: 0; }
}

/* ---------- 处理历史记录页 ---------- */
.hist-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.hist-filter { display: flex; gap: 8px; }
.hist-count { font-size: 12px; color: var(--text-dim, #8fa7c0); margin-bottom: 8px; }
.hist-empty { text-align: center; color: var(--text-dim, #8fa7c0); padding: 48px 0; font-size: 13px; line-height: 2; }
.hist-toolbar .btn { padding: 5px 14px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.tag-auto { background: rgba(0, 200, 150, 0.15); color: #2ee6b0; border: 1px solid rgba(0, 200, 150, 0.35); }
.tag-manual { background: rgba(255, 77, 106, 0.15); color: #ff7d94; border: 1px solid rgba(255, 77, 106, 0.35); }
#historyBody .table td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
