/**
 * AI 消防员运营工作台 — 视觉对齐企业数字员工 /platform
 * 浅蓝底 + 白卡片 + 蓝主色；消防红仅作强调（紧急 KPI）
 */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #dbe8f5;
  --bg-gradient: linear-gradient(165deg, #cfe2f5 0%, #e2edf8 42%, #eef5fb 100%);
  --surface: #ffffff;
  --surface2: #f0f6fc;
  --border: #b0c9e0;
  --text: #111827;
  --muted: #475569;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #3b82f6;
  --ok: #15803d;
  --warn: #b45309;
  --crit: #b91c1c;
  --fire: #b91c1c;
  --fire-2: #dc2626;
  --info: #0369a1;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --side-w: 240px;
  --topbar-h: 64px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.05), 0 12px 40px rgba(37, 99, 235, 0.06);
  --font: "Plus Jakarta Sans", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-gradient);
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ========== 登录页（对齐 platform LoginPage） ========== */
.login-page {
  --login-ink: #0f172a;
  --login-muted: #64748b;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 40px;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(900px 500px at 88% 110%, rgba(185, 28, 28, 0.08), transparent 50%),
    linear-gradient(165deg, #d7e7f8 0%, #e8f1fb 45%, #f4f8fd 100%);
}
.login-page__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}
.login-page__orb--a {
  width: 280px; height: 280px; top: 8%; right: 12%;
  background: rgba(59, 130, 246, 0.22);
  animation: login-orb-drift 14s ease-in-out infinite;
}
.login-page__orb--b {
  width: 220px; height: 220px; bottom: 10%; left: 8%;
  background: rgba(248, 113, 113, 0.16);
  animation: login-orb-drift 18s ease-in-out infinite reverse;
}
.login-page__grid {
  position: absolute; inset: 0; z-index: 0; opacity: 0.35;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  pointer-events: none;
}
.login-page__links {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin-top: 20px;
  max-width: 520px; width: 100%;
}
.login-page__links a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.login-page__links a:hover {
  color: var(--accent);
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.login-page__links svg { width: 16px; height: 16px; flex-shrink: 0; }

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(191, 219, 254, 0.85);
  border-radius: 24px;
  padding: 18px 26px 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  animation: login-card-in 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-dh { margin: 0 0 16px; }
.login-dh__stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(147, 197, 253, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  aspect-ratio: 16 / 9;
}
.login-dh__art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
}
.login-dh__shine {
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.28) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: login-dh-shine 7.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}
.login-card__header { text-align: center; margin-bottom: 18px; }
.login-brand { display: inline-flex; align-items: center; gap: 10px; }
.login-brand__mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(29, 78, 216, 0.2));
}
.login-brand__title {
  margin: 0; font-size: 1.18rem; font-weight: 700;
  color: var(--login-ink); line-height: 1.2; letter-spacing: -0.01em;
}
.login-brand__sub {
  margin: 8px 0 0; font-size: 13px; color: var(--login-muted); line-height: 1.5;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--login-ink); margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 11px 14px;
  border: 1px solid #c7d7ea; border-radius: 12px;
  background: #f4f8fd; color: var(--login-ink);
  font-size: 14px; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.login-field input::placeholder { color: #94a3b8; }
.login-field input:focus {
  border-color: #60a5fa; background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.login-field input:disabled { opacity: 0.7; cursor: not-allowed; }
.login-alert {
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.45; min-height: 0;
}
.login-alert:empty { display: none; }
.login-alert--error {
  background: rgba(185, 28, 28, 0.06);
  border: 1px solid rgba(185, 28, 28, 0.2);
  color: var(--crit);
}
.login-submit {
  width: 100%; margin-top: 4px; padding: 12px 16px;
  border: none; border-radius: 12px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; font-size: 14.5px; font-weight: 600;
  letter-spacing: 0.01em; cursor: pointer;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.login-submit:hover:not(:disabled) {
  filter: brightness(1.04);
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.34);
  transform: translateY(-1px);
}
.login-submit:active:not(:disabled) { transform: translateY(0); }
.login-submit:disabled {
  background: #94a3b8; box-shadow: none; cursor: not-allowed;
}
.login-submit:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.login-card__footer {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  text-align: center; font-size: 12px; color: var(--login-muted);
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes login-dh-shine {
  0%, 70%, 100% { transform: translateX(-120%); }
  85% { transform: translateX(120%); }
}
@keyframes login-orb-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-18px, 12px); }
}

/* ========== 主工作台布局 ========== */
#app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100vh;
  background: var(--bg-gradient);
}
#app.app--chat {
  grid-template-columns: 1fr;
}
#app.app--chat .side {
  display: none;
}
#app.app--chat .main {
  padding: 14px 18px 18px;
}
#app.app--chat .topbar .page-head .sub {
  display: none;
}
#app.app--chat .dchat {
  height: calc(100vh - var(--topbar-h) - 28px);
}
.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  z-index: 20;
}
.side .logo {
  padding: 18px 18px 12px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.side .logo .badge {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 6px 14px rgba(29, 78, 216, 0.28);
}
.side .logo .badge svg { width: 22px; height: 22px; }
.side .logo b { font-size: 14px; font-weight: 700; color: var(--text); display: block; }
.side .logo small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav { padding: 10px 8px; overflow: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  margin: 2px 0; cursor: pointer; text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.nav a .ic {
  width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.nav a .ic svg { width: 18px; height: 18px; }
.nav a:hover {
  background: var(--surface2); color: var(--text);
  text-decoration: none;
}
.nav a.active {
  background: rgba(29, 78, 216, 0.08);
  color: var(--accent);
  border-color: rgba(147, 197, 253, 0.7);
}
.side .foot {
  padding: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px;
  background: var(--surface2);
}
.side .foot #whoami { line-height: 1.5; }

.main {
  overflow: auto;
  padding: 22px 26px 32px;
  min-width: 0;
}
.topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; font-size: 12px;
  color: var(--muted); box-shadow: var(--shadow-sm);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.mock { background: var(--warn); }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.user-menu { position: relative; }
.user-menu__btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.user-menu__btn:hover { border-color: #93c5fd; box-shadow: var(--shadow-md); }
.user-menu__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-menu__name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__chev { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.user-menu__drop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 200;
  min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
  overflow: hidden;
}
.user-menu__drop button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; border: none; background: transparent;
  color: var(--text); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer;
}
.user-menu__drop button:hover { background: var(--surface2); }
.user-menu__drop button.danger { color: var(--crit); }
.user-menu__drop button svg { width: 14px; height: 14px; flex-shrink: 0; }
.user-menu__sep { height: 1px; background: var(--border); margin: 0 8px; }

.profile-page { max-width: 720px; }
.profile-page h1 { margin: 0 0 8px; font-size: 1.35rem; font-weight: 700; }
.profile-page .profile-intro { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.profile-row {
  display: grid; grid-template-columns: 120px 1fr; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.profile-row span:first-child { color: var(--muted); }
.profile-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.profile-form input { max-width: 400px; }
.profile-form .field { margin-bottom: 16px; }
.profile-err {
  margin-bottom: 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(185, 28, 28, 0.06); border: 1px solid rgba(185, 28, 28, 0.2);
  color: var(--crit); font-size: 13px;
}
.dchat__kb-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--muted); cursor: pointer; font: inherit; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}
.dchat__kb-toggle.on {
  border-color: #059669; background: rgba(5, 150, 105, 0.14);
  color: #047857; font-weight: 700;
}
.pill--console,
.pill--back {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pill--console:hover,
.pill--back:hover {
  color: var(--accent);
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}
.pill--console svg,
.pill--back svg {
  width: 16px; height: 16px; flex-shrink: 0;
}
.pill--console {
  color: var(--accent);
  border-color: rgba(147, 197, 253, 0.85);
  background: rgba(37, 99, 235, 0.06);
}
.pill--console:hover {
  background: rgba(37, 99, 235, 0.1);
}
#app.app--chat .pill--console .pill--console-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
#app.app--chat .pill--console {
  padding: 6px 10px;
}

/* ========== 卡片 / KPI ========== */
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.kpi:hover { border-color: #93c5fd; box-shadow: var(--shadow-md); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; color: var(--text); }
.kpi .val small { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .trend { font-size: 12px; margin-top: 4px; color: var(--muted); }
.kpi.fire {
  border-color: rgba(185, 28, 28, 0.28);
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}
.kpi.fire .val { color: var(--fire); }

/* ========== 表单控件 ========== */
input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-soft);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; font-size: 13px;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2);
  transition: filter 0.2s, transform 0.15s;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.btn.ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn.ghost:hover {
  border-color: var(--accent-soft);
  color: var(--accent);
  filter: none;
}
.btn.sm { padding: 6px 10px; font-size: 12px; box-shadow: none; }
.err { color: var(--crit); font-size: 12px; min-height: 16px; }

/* ========== 表格 ========== */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface2); }
tr:hover td { background: rgba(240, 246, 252, 0.7); }
.tag {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px; font-size: 11px; margin: 1px;
  color: var(--muted);
}
.badge {
  display: inline-block; border-radius: 6px;
  padding: 2px 8px; font-size: 11px; font-weight: 600;
}
.b-new { background: rgba(3, 105, 161, 0.1); color: var(--info); }
.b-assigned { background: rgba(180, 83, 9, 0.12); color: var(--warn); }
.b-processing { background: rgba(180, 83, 9, 0.14); color: var(--warn); }
.b-closed { background: rgba(21, 128, 61, 0.12); color: var(--ok); }
.b-critical { background: rgba(185, 28, 28, 0.12); color: var(--crit); }
.b-high { background: rgba(180, 83, 9, 0.14); color: var(--warn); }
.b-normal { background: var(--surface2); color: var(--muted); }
.b-review { background: rgba(3, 105, 161, 0.1); color: var(--info); }
.b-rejected { background: rgba(185, 28, 28, 0.1); color: var(--crit); }

/* ========== 工具行 / 聊天 ========== */
.toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar input, .toolbar select { width: auto; margin: 0; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.chat-log {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px; height: 340px; overflow: auto; font-size: 13px;
}
.msg {
  margin: 8px 0; padding: 10px 12px; border-radius: 12px; max-width: 80%;
}
.msg.me {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; margin-left: auto;
}
.msg.bot {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.msg .meta { font-size: 10px; opacity: 0.7; margin-top: 4px; }
.toast {
  position: fixed; right: 20px; bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--ok); border-radius: 10px;
  padding: 12px 16px; box-shadow: var(--shadow-md);
  z-index: 99; font-size: 13px; color: var(--text);
}
.toast.err { border-left-color: var(--crit); }
.bar {
  height: 8px; background: var(--surface2);
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
}
.row { display: flex; gap: 8px; align-items: center; }
.section-title {
  font-size: 12px; color: var(--muted);
  font-weight: 600; letter-spacing: 0.04em;
  margin: 22px 0 10px; text-transform: uppercase;
}

.dechat-layout .dechat-panel .chat-log { height: 420px; }
.de-cards { display: grid; gap: 10px; }
.de-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface2); color: var(--text); cursor: pointer;
}
.de-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.06);
}
.de-card b { font-size: 14px; }
.de-card small { font-size: 11px; color: var(--muted); }
.de-card .muted { font-size: 11px; line-height: 1.5; }

/* ============ AI 对话工作台（对齐 NIP :8000 三栏 + 数字人形象）============ */
.dchat {
  --chat-navy: #1a3a6b;
  --chat-navy-deep: #0f2748;
  --chat-blue: #2563eb;
  --chat-sky: #e8f1fb;
  --chat-sky-2: #f0f5fb;
  --chat-border: rgba(176, 201, 224, 0.9);
  --chat-shadow: 0 8px 28px rgba(15, 39, 72, 0.07);
  --chat-shadow-soft: 0 4px 16px rgba(15, 39, 72, 0.05);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 280px;
  gap: 12px;
  height: calc(100vh - var(--topbar-h) - 52px);
  min-height: 520px;
  padding: 4px;
}
.dchat__side {
  background: var(--surface);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
  box-shadow: var(--chat-shadow-soft);
}
.dchat__side-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dchat__side-title { font-size: 13px; font-weight: 700; color: var(--text); }
.dchat__refresh {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.dchat__refresh:hover { border-color: var(--accent); color: var(--accent); }
.dchat__persona { display: flex; flex-direction: column; gap: 8px; }
.de-persona {
  display: flex; align-items: center; gap: 10px;
  text-align: left; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface2); color: var(--text); cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.de-persona:hover { border-color: rgba(37, 99, 235, 0.35); }
.de-persona.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: rgba(37, 99, 235, 0.06);
}
.de-persona__avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(26, 58, 107, 0.16);
}
.de-persona__avatar img {
  width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block;
}
.de-persona__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.de-persona__name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.de-persona__id { font-size: 10px; color: var(--muted); }
.dchat__caps { display: flex; flex-direction: column; gap: 6px; }
.dchat__caps-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}
.dchat__caps-label span {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border);
}
.dchat__caps-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.dchat__cap-tag {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
}
.dchat__cap-more { font-size: 10px; color: var(--muted); padding: 3px 4px; }
.dchat__new { width: 100%; }
.dchat__slabel {
  font-size: 11px; color: var(--muted); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; margin-top: 2px;
}
.dchat__sessions { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.dchat__sess {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; width: 100%; padding: 7px 9px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--text); cursor: pointer;
}
.dchat__sess:hover { background: var(--surface2); }
.dchat__sess.active { background: rgba(37,99,235,.08); border-color: var(--border); }
.dchat__sess-t { font-size: 12px; line-height: 1.3; }
.dchat__sess-m { font-size: 10px; color: var(--muted); }
.dchat__side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dchat__bridge { font-size: 11px; }
.dchat__bridge.ok { color: var(--ok); }
.dchat__bridge.bad { color: var(--warn); }

.dchat__main {
  background: var(--surface);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--chat-shadow);
  min-width: 0;
}
.dchat__head {
  padding: 12px 16px; border-bottom: 1px solid var(--chat-border);
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, #f8fbfe 0%, #ffffff 100%);
  flex-shrink: 0;
}
.dchat__head-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(26, 58, 107, 0.14);
}
.dchat__head-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.dchat__head-meta { min-width: 0; }
.dchat__head-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.dchat__head-sub { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.dchat__head-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0;
}
.dchat__head-dot.on { background: #16a34a; }
.dchat__log { flex: 1; overflow: auto; padding: 18px 16px; background: #fafbfd; }
.dchat__empty { max-width: 480px; margin: 6% auto; text-align: center; color: var(--text); }
.dchat__empty-face {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; overflow: hidden;
  border: 3px solid #fff; box-shadow: 0 4px 16px rgba(26, 58, 107, 0.18);
}
.dchat__empty-face img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.dchat__empty-ic { width: 54px; height: 54px; margin: 0 auto 12px; color: var(--accent); }
.dchat__empty-ic svg { width: 54px; height: 54px; }
.dchat__empty b { font-size: 16px; }
.dchat__empty p { font-size: 13px; line-height: 1.7; margin-top: 8px; text-align: left; }
.dchat__empty-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }

.msg-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.msg-row.me { justify-content: flex-end; }
.msg-row.bot { justify-content: flex-start; }
.dchat__msg-av {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0; margin-top: 4px;
  border: 1.5px solid #fff; box-shadow: 0 2px 6px rgba(26, 58, 107, 0.14);
}
.dchat__msg-av img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }

.dchat__log .msg { max-width: 82%; }
.dchat__log .msg.bot { max-width: 88%; }
.msg-body { font-size: 13.5px; line-height: 1.7; }
.msg-body p { margin: 4px 0; }
.msg-body h3, .msg-body h4, .msg-body h5, .msg-body h6 { margin: 8px 0 4px; font-size: 14px; }
.msg-body ul, .msg-body ol { margin: 4px 0; padding-left: 20px; }
.msg-body li { margin: 2px 0; }
.md-code { background: rgba(15,23,42,.06); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.md-pre { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; }
.md-pre code { background: none; color: inherit; padding: 0; }

.dchat__steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.dchat__step {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 9px;
}
.dchat__step.done { color: var(--text); }
.dchat__step em { font-style: normal; margin-left: auto; font-size: 11px; opacity: .8; }
.step-ok { color: var(--ok); font-weight: 700; }

.dchat__card {
  margin-top: 8px; padding: 10px 12px;
  border: 1px solid var(--accent-soft); border-left-width: 3px;
  border-radius: 10px; background: rgba(37,99,235,.05);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.dchat__card-h { font-size: 13px; font-weight: 600; color: var(--accent-hover); }

.dchat__sources { margin-top: 8px; font-size: 12px; }
.dchat__sources summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.dchat__sources .src-item { margin: 6px 0; padding: 6px 8px; background: var(--surface2); border-radius: 8px; }
.dchat__sources .src-h { font-size: 12px; }
.dchat__sources .src-snip { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.dchat__hint {
  min-height: 20px; padding: 0 16px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.dchat__composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px; border-top: 1px solid var(--border); background: #fff; }
.dchat__composer textarea {
  flex: 1; resize: none; max-height: 120px; min-height: 40px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: 13.5px; line-height: 1.5; background: var(--surface2); color: var(--text);
}
.dchat__composer textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.dchat__quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: #fff; }

.dchat__dock {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px 0; background: #fff; flex-shrink: 0;
}
.dchat__modes { display: flex; gap: 6px; flex-wrap: wrap; }
.dchat__mode {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.dchat__mode.on {
  border-color: var(--accent); background: rgba(37, 99, 235, 0.08); color: var(--accent-hover);
}
.dchat__mode:hover { border-color: rgba(37, 99, 235, 0.35); }

.dchat__fb {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.dchat__fb-btn {
  padding: 3px 10px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}
.dchat__fb-btn:hover { border-color: var(--accent); color: var(--accent); }
.dchat__fb-done { margin-top: 8px; font-size: 11px; color: var(--muted); }
.dchat__fb--corr { flex-direction: column; align-items: stretch; }
.dchat__fb-corr {
  width: 100%; margin-top: 4px; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12px; font-family: inherit; resize: vertical;
}
.dchat__fb-actions { display: flex; gap: 8px; margin-top: 6px; }
.dchat__attach-btn { flex-shrink: 0; padding: 6px 10px; }
.dchat__attach-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 4px; min-height: 0; }
.dchat__attach-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; background: var(--surface2); border: 1px solid var(--border);
}
.dchat__attach-chip button {
  border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1;
}
.dchat__attach-chip button:hover { color: var(--warn); }

.dchat__tool-dock { padding: 0 16px 4px; }
.dchat__tool-mode {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px; border-radius: 10px; background: #f0f7ff; border: 1px solid #dbeafe; font-size: 12px;
}
.dchat__tool-tag { font-weight: 600; color: var(--accent-hover); }
.dchat__quick .btn.on { border-color: var(--accent); color: var(--accent); background: rgba(37,99,235,.06); }

.fw-bridge {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px; border-radius: 10px; font-size: 12px; border: 1px solid var(--border); background: var(--surface2);
}
.fw-bridge.ok { border-color: #bbf7d0; background: #f0fdf4; }
.fw-bridge.bad { border-color: #fecaca; background: #fef2f2; }
.fw-bridge__st { font-weight: 600; }
.fw-toolbar .btn.on { border-color: var(--accent); color: var(--accent); }
.fw-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.fw-modal.hidden { display: none; }
.fw-modal__box {
  background: #fff; border-radius: 14px; max-width: 560px; width: 100%; max-height: 85vh; overflow: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.15);
}
.fw-modal__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.fw-modal__body { padding: 14px 16px; font-size: 13px; line-height: 1.65; }
.fw-modal__body p { margin: 0 0 12px; }

.dchat__wf {
  padding: 12px; border-radius: 12px; border: 1px solid #dbeafe;
  background: #f8faff; font-size: 13px; color: #1e3a5f;
}
.dchat__wf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.dchat__wf-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 8px;
  background: #e0e7ff; color: #3730a3;
}
.dchat__wf-steps { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.dchat__wf-steps li { padding: 4px 0 4px 12px; border-left: 2px solid #e5e7eb; margin-left: 6px; }
.dchat__wf-sum { margin-top: 8px; font-size: 12px; line-height: 1.55; color: var(--text); }
.dchat__wf-err { margin-top: 6px; font-size: 12px; color: var(--warn); }

.dchat__spin {
  width: 12px; height: 12px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  display: inline-block; animation: dchat-spin .7s linear infinite;
}
.dchat__spin.sm { width: 10px; height: 10px; border-width: 2px; }
@keyframes dchat-spin { to { transform: rotate(360deg); } }

/* 右侧数字人形象面板（对齐 :8000 DeDigitalHumanPanel） */
.dchat__dh {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dchat__dh-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px dashed var(--chat-border);
  border-radius: 16px;
  background: var(--surface2);
}
.de-dh-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  background: linear-gradient(165deg, #dce9f7 0%, #eef4fb 48%, #f7fafc 100%);
  box-shadow: var(--chat-shadow);
}
.de-dh-panel__stage {
  position: relative;
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 44px 12px 8px;
  overflow: hidden;
}
.de-dh-panel__status {
  position: absolute;
  top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(15, 39, 72, 0.08);
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.de-dh-panel__status.is-on { color: var(--chat-navy); }
.de-dh-panel__figure {
  position: relative;
  width: 100%; max-width: 220px;
  aspect-ratio: 3 / 4;
  display: flex; align-items: flex-end; justify-content: center;
}
.de-dh-panel__figure.is-live .de-dh-panel__img {
  filter: saturate(1.08) contrast(1.04);
}
.de-dh-panel__img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  border-radius: 18px 18px 8px 8px;
  display: block;
  transition: filter 0.3s ease;
}
.de-dh-panel__glow {
  pointer-events: none;
  position: absolute;
  inset: auto 8% -6% 8%;
  height: 28%;
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.22), transparent 70%);
  filter: blur(8px);
}
.de-dh-panel__card {
  margin: 0 12px 12px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--chat-shadow-soft);
  flex-shrink: 0;
}
.de-dh-panel__badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--chat-sky); color: var(--chat-navy);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.de-dh-panel__title { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.de-dh-panel__desc {
  font-size: 11px; line-height: 1.55; color: var(--muted);
  margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4;
  -webkit-box-orient: vertical; overflow: hidden;
}
.de-dh-panel__cta {
  width: 100%; padding: 10px 12px; border: none; border-radius: 12px;
  background: var(--chat-navy); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.2s ease;
}
.de-dh-panel__cta:hover { background: var(--chat-navy-deep); }
.de-dh-panel__cta.is-on { background: #0f766e; }

@media (max-width: 1100px) {
  .dchat { grid-template-columns: 220px minmax(0, 1fr); }
  .dchat__dh { display: none; }
}
@media (max-width: 860px) {
  .dchat { grid-template-columns: 1fr; height: auto; }
  .dchat__side { order: 2; }
  .dchat__main { order: 1; height: 70vh; }
}

.menu-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 40;
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-md); align-items: center; justify-content: center;
  color: var(--text);
}
.menu-toggle svg { width: 20px; height: 20px; }
.side-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35); z-index: 25;
}

@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  #app { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 30;
  }
  .side.open { transform: translateX(0); }
  .side-backdrop.show { display: block; }
  .main { padding: 64px 16px 24px; }
}
@media (max-width: 480px) {
  .login-card { padding: 14px 14px 20px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-card, .login-dh__shine, .login-page__orb, .side {
    animation: none !important;
    transition: none !important;
  }
}
