:root {
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --primary-dark: #1557b0;
  --success: #10b981;
  --success-bg: #d1fae5;
  --success-text: #059669;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-text: #d97706;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-text: #ef4444;
  --info: #3b82f6;
  --info-bg: #e8f0fe;
  --info-text: #1a73e8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --secondary-bg: #f1f5f9;
  --row-alt: #fafbfc;
  --text: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --radius-btn: 6px;
  --radius-input: 8px;
  --radius-card: 10px;
  --radius-modal: 12px;
  --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.08);
  --shadow-modal: 0 8px 32px rgba(0,0,0,.12);
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

/* ===== 通用元素 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 150ms cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--border); background: var(--card); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--secondary-bg); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: var(--success-bg); color: var(--success-text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 40px; font-size: 15px; }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-btn); color: var(--text-2);
  transition: all 150ms cubic-bezier(.4,0,.2,1); position: relative;
}
.icon-btn:hover { background: var(--secondary-bg); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--text-2); }
.input, .select, textarea.input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--card);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: box-shadow 150ms ease, border-color 150ms ease;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.22);
}
.input::placeholder, textarea.input::placeholder { color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: box-shadow 150ms ease;
}
.card.hoverable:hover { box-shadow: var(--shadow-hover); }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; line-height: 1.4; }
.card-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 700; line-height: 1.3; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag-green { background: var(--success-bg); color: var(--success-text); }
.tag-yellow { background: var(--warning-bg); color: var(--warning-text); }
.tag-red { background: var(--danger-bg); color: var(--danger-text); }
.tag-blue { background: var(--info-bg); color: var(--info-text); }
.tag-gray { background: var(--secondary-bg); color: var(--text-2); }
.tag-plain::before { display: none; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green { background: var(--success); }
.dot-yellow { background: var(--warning); }
.dot-red { background: var(--danger); }
.dot-blue { background: var(--info); }
.dot-gray { background: var(--text-3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.table th {
  background: var(--secondary-bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.5;
}
.table tbody tr:nth-child(even) { background: var(--row-alt); }
.table tbody tr:hover { background: var(--primary-light); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.table .link { color: var(--primary); cursor: pointer; }
.table .link:hover { text-decoration: underline; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 16px;
  display: flex; align-items: center; gap: 14px;
}
.kpi-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
.kpi-ico svg { width: 20px; height: 20px; }
.kpi-meta { min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi-delta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success-text); }
.kpi-delta.down { color: var(--danger-text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.section { margin-bottom: 16px; }

.bar { height: 8px; border-radius: 4px; background: var(--secondary-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.bar-green > i { background: var(--success); }
.bar-yellow > i { background: var(--warning); }
.bar-red > i { background: var(--danger); }

.progress-steps { display: flex; align-items: flex-start; gap: 0; }
.pstep { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; }
.pstep::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--border);
}
.pstep:first-child::before { display: none; }
.pstep.done::before { background: var(--success); }
.pstep-ico {
  width: 28px; height: 28px; border-radius: 50%; background: var(--secondary-bg);
  color: var(--text-3); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; z-index: 1; border: 2px solid var(--border);
}
.pstep.done .pstep-ico { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }
.pstep.active .pstep-ico { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.pstep-label { font-size: 12px; color: var(--text-2); }
.pstep.done .pstep-label { color: var(--success-text); }
.pstep.active .pstep-label { color: var(--primary); font-weight: 600; }

.filter-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px; margin-bottom: 16px;
}
.filter-bar .field { min-width: 150px; flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 8px 12px; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 150ms ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.agent-steps {
  background: var(--primary-light); border-radius: 8px; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--primary-dark);
  margin-bottom: 12px;
}
.agent-steps .spin { width: 16px; height: 16px; border: 2px solid rgba(26,115,232,.25); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 16px; color: var(--text-3); text-align: center;
}
.empty svg { width: 40px; height: 40px; opacity: .55; }

/* ===== 登录页 ===== */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--card); }
.login-brand {
  background: linear-gradient(150deg, #f4f8ff 0%, #e8f0fe 55%, #dbe7fb 100%);
  display: flex; align-items: center; justify-content: center; padding: 48px; position: relative; overflow: hidden;
}
.login-brand::before {
  content: ""; position: absolute; right: -140px; top: -140px; width: 420px; height: 420px;
  border-radius: 50%; border: 1px solid rgba(26,115,232,.16);
}
.login-brand::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  border-radius: 50%; border: 1px solid rgba(26,115,232,.22);
}
.login-brand-inner { max-width: 520px; width: 100%; position: relative; z-index: 1; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex: none;
}
.brand-mark-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; }
.login-kicker { margin-top: 20px; font-size: 13px; color: var(--text-2); letter-spacing: 0; }
.login-brand h1 { font-size: 34px; font-weight: 700; line-height: 1.3; margin-top: 10px; color: #153b7a; }
.login-tagline { font-size: 15px; color: var(--text-2); margin-top: 8px; }
.login-flow {
  margin-top: 40px; background: rgba(255,255,255,.72); border: 1px solid rgba(26,115,232,.14);
  border-radius: 12px; padding: 22px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-card); backdrop-filter: blur(4px);
}
.flow-node { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); flex: none; }
.flow-ico {
  width: 46px; height: 46px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--primary);
}
.flow-line { flex: 1; display: flex; gap: 5px; }
.flow-line i { flex: 1; height: 2px; border-radius: 1px; background: var(--primary); opacity: .25; }
.flow-line i:nth-child(2) { opacity: .5; }
.flow-line i:nth-child(3) { opacity: .9; }
.login-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.login-stats > div { background: rgba(255,255,255,.8); border: 1px solid rgba(26,115,232,.12); border-radius: 10px; padding: 12px; }
.login-stats b { display: block; font-size: 22px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.login-stats span { font-size: 12px; color: var(--text-2); }
.login-secure { display: flex; align-items: center; gap: 8px; margin-top: 24px; font-size: 13px; color: var(--text-2); }

.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; background: var(--card); }
.login-card { width: 100%; max-width: 380px; }
.login-card-head h2 { font-size: 22px; font-weight: 700; }
.login-card-head p { font-size: 13px; color: var(--text-2); margin: 6px 0 24px; }
.login-card .field { margin-bottom: 16px; }
.login-hint { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 12px; }
.login-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.role-chip {
  height: 36px; border-radius: var(--radius-btn); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); transition: all 150ms ease;
}
.role-chip:hover { border-color: var(--primary); color: var(--primary); }
.role-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.login-foot { position: absolute; bottom: 20px; font-size: 12px; color: var(--text-3); }

/* ===== 主框架 ===== */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.brand-name { font-size: 14px; font-weight: 700; }
.brand-sub { font-size: 11px; color: var(--text-2); }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2);
  transition: all 150ms ease; text-align: left;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--secondary-bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-chevron { margin-left: auto; width: 14px; height: 14px; transition: transform 150ms ease; }
.nav-chevron.open { transform: rotate(90deg); }
.nav-sub { padding-left: 34px; display: none; }
.nav-sub.open { display: block; }
.nav-sub-item {
  display: block; width: 100%; text-align: left; padding: 7px 10px;
  border-radius: 6px; font-size: 13px; color: var(--text-2); transition: all 150ms ease;
}
.nav-sub-item:hover { background: var(--secondary-bg); color: var(--text); }
.nav-sub-item.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.side-user {
  border-top: 1px solid var(--border); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--primary), #4f83f1); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.side-user-name { font-size: 13px; font-weight: 600; }
.side-user-role { font-size: 12px; color: var(--text-2); }
.side-user .icon-btn { margin-left: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.crumb { font-size: 14px; font-weight: 600; white-space: nowrap; }
.top-search { flex: 1; max-width: 440px; display: flex; gap: 8px; margin-left: auto; }
.top-search .input { height: 32px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.top-user { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.top-user-name { font-size: 13px; font-weight: 600; }
.top-user-role { font-size: 12px; color: var(--text-2); }
.notify-dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid var(--card);
}
.menu-btn { display: none; }
.dropdown {
  position: absolute; top: 48px; right: 8px; width: 320px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-modal);
  z-index: 60; overflow: hidden;
}
.dropdown-head { padding: 12px 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border); }
.dropdown-list { max-height: 360px; overflow-y: auto; }
.drop-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.drop-item:last-child { border-bottom: none; }
.drop-item:hover { background: var(--secondary-bg); }
.drop-item .dot { margin-top: 6px; }
.drop-item b { font-size: 13px; display: block; }
.drop-item span { font-size: 12px; color: var(--text-2); display: block; }
.drop-item time { font-size: 11px; color: var(--text-3); display: block; margin-top: 2px; }

.view { padding: 24px; flex: 1; }

/* ===== 组件：聊天 / 时间线 / 详情抽屉 / 模态 ===== */
.chat-box {
  display: flex; flex-direction: column; gap: 14px; padding: 16px;
  max-height: 520px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px;
}
.msg { display: flex; gap: 10px; max-width: 92%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.msg.user .msg-avatar { background: var(--primary); }
.msg.agent .msg-avatar { background: linear-gradient(135deg, #7c3aed, var(--primary)); }
.msg-body {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; font-size: 14px; line-height: 1.7; box-shadow: var(--shadow-card);
}
.msg.user .msg-body { background: var(--primary); border-color: var(--primary); color: #fff; }
.cite-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cite-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--primary-light);
  color: var(--primary-dark); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer;
}
.cite-chip:hover { background: #dbe7fb; }
.msg-actions { display: flex; gap: 8px; margin-top: 12px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-suggests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggest-chip {
  font-size: 12px; color: var(--primary); background: var(--primary-light);
  border: 1px solid transparent; border-radius: 14px; padding: 5px 10px; transition: all 150ms ease;
}
.suggest-chip:hover { border-color: var(--primary); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--card); border: 3px solid var(--primary);
}
.tl-date { font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 640px; max-height: 86vh; overflow-y: auto;
  background: var(--card); border-radius: var(--radius-modal); box-shadow: var(--shadow-modal);
  padding: 24px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.32); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 94vw;
  background: var(--card); box-shadow: var(--shadow-modal); z-index: 95;
  display: flex; flex-direction: column; animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.toast-root { position: fixed; top: 68px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff; border-radius: 8px; padding: 10px 14px;
  font-size: 13px; box-shadow: var(--shadow-modal); display: flex; align-items: center; gap: 8px;
  animation: toastIn .2s ease; max-width: 360px;
}
.toast.success { background: var(--success-text); }
.toast.warning { background: var(--warning-text); }
.toast.error { background: var(--danger-text); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.score-ring { position: relative; width: 120px; height: 120px; border-radius: 50%; }
.score-ring .ring-inner {
  position: absolute; inset: 12px; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.score-ring span { font-size: 11px; color: var(--text-2); }

.diff-orig { background: var(--danger-bg); border-radius: 3px; padding: 0 2px; }
.diff-new { background: var(--success-bg); border-radius: 3px; padding: 0 2px; }
.doc-preview {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 24px; font-size: 13px; line-height: 1.9; max-height: 480px; overflow-y: auto;
}
.doc-preview h3 { font-size: 15px; margin: 14px 0 8px; color: #153b7a; }
.doc-preview p { margin-bottom: 8px; }
.doc-preview .cite { color: var(--info-text); font-size: 11px; }

.slide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.slide-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; transition: all 150ms ease; background: #fff; }
.slide-card:hover { box-shadow: var(--shadow-hover); }
.slide-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.slide-thumb { aspect-ratio: 16 / 10; background: linear-gradient(160deg, #f4f8ff, #e8f0fe); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.slide-thumb i { display: block; height: 6px; border-radius: 3px; background: rgba(26,115,232,.25); }
.slide-thumb i:first-child { width: 55%; height: 9px; background: var(--primary); }
.slide-thumb i:nth-child(2) { width: 90%; }
.slide-thumb i:nth-child(3) { width: 82%; }
.slide-thumb i:nth-child(4) { width: 70%; }
.slide-name { padding: 8px 12px; font-size: 12px; border-top: 1px solid var(--border); color: var(--text-2); }

.switch { position: relative; width: 38px; height: 22px; border-radius: 12px; background: var(--border); transition: background 150ms ease; flex: none; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left 150ms ease;
}
.switch.on { background: var(--primary); }
.switch.on::after { left: 19px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row b { font-size: 14px; display: block; }
.setting-row span { font-size: 12px; color: var(--text-2); display: block; margin-top: 2px; }

.qa-drawer { }
.qa-block { margin-bottom: 16px; }
.qa-block-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.qa-text { font-size: 13px; color: var(--text); background: var(--bg); border-radius: 8px; padding: 12px; line-height: 1.8; border: 1px solid var(--border); }

.agent-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.agent-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.agent-meta { flex: 1; min-width: 0; }
.agent-meta b { font-size: 14px; display: block; }
.agent-meta span { font-size: 12px; color: var(--text-2); display: block; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--secondary-bg); font-size: 12px; color: var(--text-2); }
.chip-blue { background: var(--primary-light); color: var(--primary-dark); }

.kb-lib { cursor: pointer; transition: box-shadow 150ms ease, border-color 150ms ease; }
.kb-lib:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); }
.kb-lib-head { display: flex; gap: 12px; align-items: flex-start; }
.kb-lib-head .kpi-ico { width: 40px; height: 40px; }
.kb-lib-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
}
.kb-lib-foot .link { font-size: 13px; }
.folder-row { display: flex; flex-wrap: wrap; gap: 8px; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--card);
  font-size: 13px; color: var(--text-2); transition: all 150ms ease;
}
.folder-chip svg { width: 14px; height: 14px; }
.folder-chip:hover { border-color: var(--primary); color: var(--primary); }
.folder-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }

@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 80; transform: translateX(-100%); transition: transform 180ms ease; box-shadow: var(--shadow-modal); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .top-search { display: none; }
  .grid-2, .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
  .view { padding: 16px; }
  .slide-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-row, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .top-user > div:last-child { display: none; }
  .login-panel { padding: 24px 16px; }
}
