/* ================= 设计令牌：扁平化 + 深浅双主题 ================= */
:root {
  --radius: 6px;
  --bg: #f2f5f9;
  --panel: #ffffff;
  --panel-2: #f7fafc;
  --line: #e3e9f1;
  --line-2: #eef2f7;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #7b8aa0;
  --accent: #0ea5e9;
  --accent-2: #0284c7;
  --accent-soft: #e8f6fd;
  --accent-line: #bae6fd;
  --side-bg: #0b1424;
  --side-text: #a9b7c9;
  --side-hover: #142338;
  --side-line: #1a2a42;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --c-green-bg: #e8f7f1; --c-green-fg: #0f9d69;
  --c-orange-bg: #fdf3e3; --c-orange-fg: #c77700;
  --c-red-bg: #fdecec; --c-red-fg: #dc2626;
  --c-blue-bg: #e8f4fe; --c-blue-fg: #0284c7;
  --c-gray-bg: #eef1f5; --c-gray-fg: #64748b;
  --c-purple-bg: #f1ecfd; --c-purple-fg: #7c3aed;
  --overlay: rgba(9, 17, 30, .45);
}
html[data-theme="dark"] {
  --bg: #070d18;
  --panel: #0e1726;
  --panel-2: #111d30;
  --line: #1c2a3f;
  --line-2: #16233a;
  --text: #e6edf6;
  --text-2: #a9b7c9;
  --muted: #6d7f96;
  --accent: #22d3ee;
  --accent-2: #0891b2;
  --accent-soft: #0a2632;
  --accent-line: #155e6b;
  --side-bg: #050a13;
  --side-text: #93a5bb;
  --side-hover: #0e1a2b;
  --side-line: #142134;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --c-green-bg: rgba(16,185,129,.15); --c-green-fg: #4ade80;
  --c-orange-bg: rgba(245,158,11,.15); --c-orange-fg: #fbbf24;
  --c-red-bg: rgba(239,68,68,.15); --c-red-fg: #f87171;
  --c-blue-bg: rgba(14,165,233,.16); --c-blue-fg: #38bdf8;
  --c-gray-bg: rgba(148,163,184,.14); --c-gray-fg: #94a3b8;
  --c-purple-bg: rgba(139,92,246,.16); --c-purple-fg: #a78bfa;
  --overlay: rgba(0, 0, 0, .62);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  transition: background .2s, color .2s;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }
a { color: var(--accent-2); text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

/* ================= 矢量图标 ================= */
.ico { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }
.ico-lg { width: 22px; height: 22px; }
.ico-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text-2);
}
.ico-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100vh; padding: 40px 16px; display: flex; align-items: center; justify-content: center;
  background-color: var(--side-bg);
  background-image:
    linear-gradient(var(--side-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--side-line) 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-card {
  width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 34px 32px; position: relative;
}
.login-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--accent); border-radius: 8px 8px 0 0;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.login-brand img { max-height: 40px; max-width: 180px; object-fit: contain; }
.login-brand .mark {
  width: 38px; height: 38px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent-line);
}
.login-logo { text-align: center; font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 26px; }
.login-card .f-row { margin-bottom: 14px; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; }
.login-foot { margin-top: 14px; text-align: center; color: var(--muted); font-size: 12px; }

/* ================= 布局 ================= */
.layout { display: flex; height: 100vh; overflow: hidden; }
.side { width: 220px; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid var(--side-line); }
.side .logo { padding: 16px 18px 14px; border-bottom: 1px solid var(--side-line); }
.side .logo .brand-row { display: flex; align-items: center; gap: 9px; }
.side .logo img { max-height: 28px; max-width: 60px; object-fit: contain; }
.side .logo .mark {
  width: 28px; height: 28px; border-radius: 5px; background: rgba(14,165,233,.14);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(14,165,233,.28);
}
.side .logo .name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .logo small { display: block; font-size: 10.5px; color: #5f7692; margin-top: 6px; letter-spacing: 1px; text-transform: uppercase; }
.menu { flex: 1; overflow-y: auto; padding: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius);
  color: var(--side-text); cursor: pointer; margin-bottom: 2px; font-size: 13.5px; user-select: none;
  border-left: 2px solid transparent; transition: background .15s, color .15s;
}
.menu-item:hover { background: var(--side-hover); color: #fff; }
.menu-item.active { background: var(--side-hover); color: #fff; font-weight: 600; border-left-color: var(--accent); }
.menu-item.active .ico { color: var(--accent); }
.menu-item .mi { width: 18px; display: flex; color: inherit; }
.side-foot { padding: 10px 16px; font-size: 11px; color: #54677e; border-top: 1px solid var(--side-line); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 54px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 18px; gap: 12px; flex-shrink: 0; }
.page-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; display: flex; align-items: center; gap: 8px; }
.page-title .ico { color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; }

/* 铃铛 */
.bell { position: relative; cursor: pointer; padding: 7px; border-radius: var(--radius); color: var(--text-2); border: 1px solid var(--line); display: flex; }
.bell:hover { border-color: var(--accent); color: var(--accent); }
.badge-dot {
  position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 8px; padding: 0 4px;
}
.badge-dot.hide { display: none; }
.msg-panel {
  display: none; position: absolute; right: 0; top: 40px; width: 360px; max-height: 440px; overflow-y: auto;
  background: var(--panel); border-radius: var(--radius); z-index: 900; border: 1px solid var(--line);
}
.msg-panel.open { display: block; }
.msg-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
.msg-h span { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 400; }
.msg-item { padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.msg-item:hover { background: var(--panel-2); }
.msg-item.unread { background: var(--accent-soft); }
.msg-t { font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.msg-c { color: var(--muted); font-size: 12px; margin-top: 3px; }
.msg-time { color: var(--muted); font-size: 11px; margin-top: 3px; }
.msg-empty { padding: 26px; text-align: center; color: var(--muted); }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 5px; background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.role-tag { font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 4px; }

.content { flex: 1; overflow-y: auto; padding: 18px; }

/* ================= 卡片 ================= */
.card { background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px 18px; margin-bottom: 14px; }
.card-t { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-t::before { content: ''; width: 3px; height: 14px; background: var(--accent); border-radius: 1px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; display: flex; align-items: center; gap: 13px; }
.kpi .ic { width: 44px; height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid transparent; }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ic-blue { background: var(--c-blue-bg); color: var(--c-blue-fg); border-color: var(--accent-line); }
.ic-green { background: var(--c-green-bg); color: var(--c-green-fg); }
.ic-orange { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.ic-red { background: var(--c-red-bg); color: var(--c-red-fg); }
.ic-purple { background: var(--c-purple-bg); color: var(--c-purple-fg); }
.ic-gray { background: var(--c-gray-bg); color: var(--c-gray-fg); }

/* 快捷入口 */
.shortcuts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.shortcut {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text-2);
}
.shortcut:hover { border-color: var(--accent); color: var(--accent); }
.shortcut .ico { color: var(--accent); }

/* ================= 表格 ================= */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 9px 10px; background: var(--panel-2); color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; color: var(--text); }
.tbl td.wrap { white-space: normal; min-width: 160px; }
.tbl tbody tr:nth-child(even) { background: var(--panel-2); }
.tbl tbody tr:hover { background: var(--accent-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-low { background: var(--c-red-bg) !important; }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* ================= 徽章 ================= */
.badge { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 12px; white-space: nowrap; border: 1px solid transparent; }
.b-green { background: var(--c-green-bg); color: var(--c-green-fg); }
.b-orange { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.b-red { background: var(--c-red-bg); color: var(--c-red-fg); }
.b-blue { background: var(--c-blue-bg); color: var(--c-blue-fg); }
.b-gray { background: var(--c-gray-bg); color: var(--c-gray-fg); }
.b-purple { background: var(--c-purple-bg); color: var(--c-purple-fg); }

/* ================= 按钮 ================= */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text-2); border-radius: var(--radius);
  padding: 7px 14px; font-size: 13px; transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-p { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-mini { padding: 2px 8px; font-size: 12px; border-radius: 4px; margin: 1px 2px 1px 0; }
.btn-mini.btn-p { background: var(--c-blue-bg); color: var(--c-blue-fg); border-color: var(--accent-line); }
.btn-mini.btn-p:hover { background: var(--accent); color: #fff; }
.btn-mini.btn-warn { background: var(--c-orange-bg); color: var(--c-orange-fg); border-color: var(--c-orange-bg); }
.btn-mini.btn-warn:hover { background: var(--warn); color: #fff; }
.btn-mini.btn-red { background: var(--c-red-bg); color: var(--c-red-fg); border-color: var(--c-red-bg); }
.btn-mini.btn-red:hover { background: var(--danger); color: #fff; }
.btn-mini.btn-green { background: var(--c-green-bg); color: var(--c-green-fg); border-color: var(--c-green-bg); }
.btn-mini.btn-green:hover { background: var(--ok); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ================= 表单 ================= */
.f-row { display: flex; align-items: center; margin-bottom: 12px; gap: 10px; }
.f-row label { width: 92px; text-align: right; color: var(--text-2); flex-shrink: 0; font-size: 13px; }
.f-row label .req { color: var(--danger); margin-right: 2px; }
.input, .select, textarea.input {
  flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; outline: none;
  background: var(--panel); color: var(--text); min-width: 0;
}
.input::placeholder { color: var(--muted); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.f-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { flex: 0 0 auto; width: auto; }
.toolbar .sp { flex: 1; }

/* ================= 弹窗 ================= */
.mask { position: fixed; inset: 0; background: var(--overlay); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 96vw; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; color: var(--text); }
.modal-x { cursor: pointer; color: var(--muted); font-size: 15px; padding: 2px 6px; display: flex; }
.modal-x:hover { color: var(--danger); }
.modal-b { padding: 18px; max-height: 72vh; overflow-y: auto; }

/* ================= Toast ================= */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; }
.toast {
  background: var(--c-red-bg); color: var(--c-red-fg); border: 1px solid var(--danger); padding: 9px 20px; border-radius: var(--radius);
  margin-bottom: 8px; opacity: 0; transform: translateY(-8px); transition: .25s; font-size: 13px; max-width: 70vw;
}
.toast.ok { background: var(--c-green-bg); color: var(--c-green-fg); border-color: var(--ok); }
.toast.show { opacity: 1; transform: translateY(0); }

/* ================= 进度条 ================= */
.pbar { position: relative; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; height: 16px; min-width: 90px; overflow: hidden; }
.pbar-i { height: 100%; background: var(--accent); transition: width .3s; }
.pbar span { position: absolute; inset: 0; text-align: center; font-size: 10.5px; line-height: 15px; color: var(--text); font-weight: 600; }

/* ================= 图表（纯 CSS） ================= */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 10px 6px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; align-items: flex-end; gap: 4px; height: 100%; }
.chart .bar { width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-g { background: var(--ok); } .bar-n { background: var(--danger); }
.chart .xl { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar-row .n { width: 110px; font-size: 12.5px; color: var(--text-2); text-align: right; flex-shrink: 0; }
.hbar-row .tr { flex: 1; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 3px; height: 18px; position: relative; overflow: hidden; }
.hbar-row .fill { height: 100%; background: var(--accent); }
.hbar-row .fill.ng { background: var(--danger); position: absolute; top: 0; }
.hbar-row .v { width: 90px; font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ================= Tabs ================= */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13.5px; margin-bottom: -1px; }
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ================= 基础资料布局 ================= */
.basic-wrap { display: flex; gap: 14px; align-items: flex-start; }
.basic-menu { width: 170px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; flex-shrink: 0; }
.basic-menu .bm { padding: 8px 12px; border-radius: 4px; cursor: pointer; color: var(--text-2); font-size: 13px; margin-bottom: 2px; }
.basic-menu .bm:hover { background: var(--panel-2); }
.basic-menu .bm.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.basic-main { flex: 1; min-width: 0; }

/* ================= 工单详情 ================= */
.wo-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 18px; margin-bottom: 14px; font-size: 13px; }
.wo-head .k { color: var(--muted); }
.dtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.dtab { padding: 6px 14px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line-2); cursor: pointer; font-size: 13px; color: var(--text-2); }
.dtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
.tl-time { font-size: 11.5px; color: var(--muted); }
.tl-title { font-weight: 600; font-size: 13px; margin: 2px 0; }
.tl-detail { font-size: 12.5px; color: var(--muted); }

/* ================= 异常卡片 ================= */
.ex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ex-card { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: var(--radius); padding: 14px 16px; }
.ex-card.handling { border-left-color: var(--warn); }
.ex-card.closed { border-left-color: var(--ok); }
.ex-t { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.ex-d { font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; min-height: 34px; }
.ex-m { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ex-f { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); }

/* ================= AI 聊天 ================= */
.chat-box { max-width: 860px; margin: 0 auto; }
.chat-list { min-height: 220px; padding: 8px 2px; }
.chat-item { display: flex; margin-bottom: 14px; }
.chat-item.user { justify-content: flex-end; }
.chat-b { max-width: 76%; padding: 10px 14px; border-radius: 6px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.chat-item.user .chat-b { background: var(--accent); color: #fff; border-bottom-right-radius: 1px; }
.chat-item.ai .chat-b { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 1px; }
.chat-input { display: flex; gap: 10px; margin-top: 10px; }
.samples { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.sample { padding: 5px 12px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; font-size: 12.5px; cursor: pointer; border: 1px solid var(--accent-line); }
.sample:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.thinking { color: var(--muted); font-size: 12.5px; padding: 6px 0; }

/* ================= 追溯 ================= */
.trace-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.trace-card .th { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 600; }
.trace-sec { font-size: 12.5px; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
.mini-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-tbl th, .mini-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.mini-tbl th { color: var(--text-2); background: var(--panel-2); }

/* 子表格编辑 */
.sub-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sub-tbl th { background: var(--panel-2); padding: 6px; border: 1px solid var(--line); color: var(--text-2); }
.sub-tbl td { padding: 4px; border: 1px solid var(--line-2); }
.sub-tbl .input, .sub-tbl .select { width: 100%; padding: 4px 6px; border-radius: 4px; font-size: 12.5px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lock-banner { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); font-size: 12px; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .ex-grid { grid-template-columns: 1fr 1fr; } }

/* ================= 系统设置 ================= */
.srv-link { margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.srv-link:hover { color: var(--accent); }

.test-res { padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; border: 1px solid transparent; }
.test-res.ok { background: var(--c-green-bg); color: var(--c-green-fg); border-color: var(--ok); }
.test-res.fail { background: var(--c-red-bg); color: var(--c-red-fg); border-color: var(--danger); }
.test-res.warn { background: var(--c-orange-bg); color: var(--c-orange-fg); border-color: var(--warn); }

.st-sec { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.st-sec .card-t { margin-bottom: 10px; }
.form-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }

.scene-wrap { display: flex; gap: 14px; align-items: flex-start; }
.scene-roles { width: 190px; flex-shrink: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel-2); }
.scene-role { padding: 9px 14px; cursor: pointer; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; }
.scene-role:last-child { border-bottom: none; }
.scene-role:hover { background: var(--panel); }
.scene-role.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
.scene-role .muted { font-size: 11px; margin-top: 2px; }
.scene-editor { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

.chkgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.chk input { accent-color: var(--accent); }
.chk .ico { color: var(--muted); width: 16px; height: 16px; }
.sc-ico { display: inline-flex; width: 18px; height: 18px; vertical-align: middle; margin-right: 6px; color: var(--accent); }
.sc-ico .ico { width: 18px; height: 18px; }
.badge .ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.btn .ico { width: 15px; height: 15px; }
.btn-mini .ico { width: 13px; height: 13px; }

.ai-answer { margin-top: 10px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; line-height: 1.7; white-space: pre-wrap; color: var(--text); }
.doc-pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; line-height: 1.6; overflow-x: auto; color: var(--text-2); white-space: pre-wrap; }

/* 品牌标识 */
.brand-preview { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2); margin-bottom: 14px; }
.brand-preview .logo-box {
  width: 120px; height: 66px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.brand-preview .logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-preview .logo-box .mark { color: var(--accent); }
.brand-preview .meta { flex: 1; min-width: 0; }
.brand-preview .meta .n { font-size: 18px; font-weight: 700; color: var(--text); }
.brand-preview .meta .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.upload-row .file { display: none; }

@media (max-width: 900px) {
  .scene-wrap { flex-direction: column; }
  .scene-roles { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); }
  .chkgrid { grid-template-columns: repeat(2, 1fr); }
}
