/* ============================================================
 * 企迈 · 单用户企服工作台
 * 复用旧版设计语言，去掉角色/多租户相关样式。
 * ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf2;
  --line-2: #eef1f7;
  --primary: #2f5bff;
  --primary-d: #1e40d8;
  --primary-soft: #eef2ff;
  --teal: #0d9488;
  --teal-soft: #e6f7f4;
  --amber: #d97706;
  --amber-soft: #fff7e6;
  --green: #16a34a;
  --green-soft: #e9f8ee;
  --rose: #e11d48;
  --rose-soft: #fff0f3;
  --violet: #7c3aed;
  --violet-soft: #f3edff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 6px 24px rgba(15, 23, 42, .07);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .16);
  --radius: 14px;
}

* { box-sizing: border-box; }
/* 所有 icon() 生成的图标默认 16px；容器规则在后面按场景覆盖 */
svg.icon { width: 16px; height: 16px; flex: none; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 226px; flex: none; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20;
}
.side-logo { padding: 20px 18px 16px; display: flex; align-items: center; gap: 11px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #2f5bff 0%, #6d5bff 55%, #0d9488 100%);
  display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(47, 91, 255, .28);
}
.logo-mark svg { width: 20px; height: 20px; }
.logo-text { font-size: 17px; font-weight: 800; letter-spacing: .5px; line-height: 1.2; }
.logo-sub { font-size: 10px; color: var(--muted-2); letter-spacing: 1.4px; font-weight: 600; }

.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-group-label { font-size: 11px; color: var(--muted-2); font-weight: 700; letter-spacing: 1px; padding: 15px 10px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; margin-bottom: 3px; border: 1px solid transparent;
  transition: .16s ease; position: relative; width: 100%; background: none; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-d); font-weight: 700; border-color: #dce4ff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .nav-label { flex: 1; }

.side-foot { padding: 12px; border-top: 1px solid var(--line-2); }
.side-account {
  display: flex; align-items: center; gap: 9px; margin-top: 9px; padding: 8px;
  border: none; background: transparent; border-radius: 10px; width: 100%; text-align: left;
}
.side-account:hover { background: var(--surface-2); }
.side-account .sa-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.side-account .sa-name { font-size: 12px; font-weight: 700; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account .sa-sub { font-size: 10.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: none; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; gap: 16px; z-index: 15;
}
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crumb { font-size: 13px; color: var(--muted); white-space: nowrap; }
.crumb b { color: var(--ink); font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 9px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--ink-2); position: relative; transition: .15s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 17px; height: 17px; }
.ai-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 20px; border: 1px solid var(--line); background: #fff;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2); transition: .15s;
}
.ai-pill:hover { border-color: var(--primary); }
.ai-pill.ready { background: linear-gradient(100deg, #eef2ff, #f3edff); border-color: #ded4ff; color: #5b3fd6; }
.ai-pill.off { background: var(--amber-soft); border-color: #fde8bd; color: #b45309; }
.account-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 3px 11px 3px 3px;
  border-radius: 30px; border: 1px solid var(--line); background: #fff; max-width: 220px;
}
.account-chip:hover { border-color: var(--primary); }
.account-chip .ac-name { font-size: 12px; font-weight: 700; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 12px; flex: none; letter-spacing: .5px; background: linear-gradient(135deg,#2f5bff,#7c3aed);
}
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 54px; height: 54px; border-radius: 15px; font-size: 17px; }
.avatar.round { border-radius: 50%; }

.view { flex: 1; overflow-y: auto; padding: 22px 26px 46px; }
.page { max-width: 1400px; margin: 0 auto; animation: fadeUp .24s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- 通用 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.4px; margin: 0; display: flex; align-items: center; gap: 9px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line-2); }
.card-title { font-size: 14.5px; font-weight: 750; margin: 0; display: flex; align-items: center; gap: 7px; }
.card-title svg { width: 16px; height: 16px; color: var(--muted); }
.card-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 17px; }
.card-body.tight { padding: 11px 17px; }
.grid { display: grid; gap: 15px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr); gap: 15px; align-items: start; }
.split-match { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 15px; align-items: start; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt6 { margin-top: 6px; } .mt10 { margin-top: 10px; } .mt14 { margin-top: 14px; } .mt18 { margin-top: 18px; } .mt24 { margin-top: 24px; }
.mb10 { margin-bottom: 10px; } .mb14 { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.strong { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.divider { height: 1px; background: var(--line-2); margin: 13px 0; }
.section-title { font-size: 12.5px; font-weight: 750; color: var(--ink-2); margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.section-title svg { width: 15px; height: 15px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 35px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-weight: 600; font-size: 13px; transition: .16s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(47,91,255,.2); }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-soft { background: var(--primary-soft); border-color: #dce4ff; color: var(--primary-d); }
.btn-soft:hover { background: #e2e9ff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 29px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { color: #be123c; border-color: #ffd7df; background: var(--rose-soft); }
.btn-danger:hover { background: #ffe4e9; color: #be123c; border-color: #f8b4c2; }
.btn-ai { background: linear-gradient(100deg, #2f5bff, #7c3aed 70%, #0d9488); border: none; color: #fff; }
.btn-ai:hover { color: #fff; filter: brightness(1.07); box-shadow: 0 6px 18px rgba(90,70,240,.28); }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag-blue { background: var(--primary-soft); color: var(--primary-d); border-color: #dce4ff; }
.tag-teal { background: var(--teal-soft); color: #0f766e; border-color: #c9ede7; }
.tag-amber { background: var(--amber-soft); color: #b45309; border-color: #fde8bd; }
.tag-green { background: var(--green-soft); color: #15803d; border-color: #cdeed9; }
.tag-rose { background: var(--rose-soft); color: #be123c; border-color: #ffd7df; }
.tag-violet { background: var(--violet-soft); color: #6d28d9; border-color: #e4d8ff; }
.tag-ai { background: linear-gradient(100deg, #eef2ff, #f3edff); color: #5b3fd6; border-color: #ded4ff; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); }
.dot-rose { background: var(--rose); } .dot-gray { background: var(--muted-2); } .dot-blue { background: var(--primary); }

.score {
  display: inline-flex; align-items: baseline; gap: 3px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--primary-soft); color: var(--primary-d);
}
.score b { font-size: 15px; }
.score.high { background: var(--green-soft); color: #15803d; }
.score.mid { background: var(--amber-soft); color: #b45309; }
.score.low { background: var(--rose-soft); color: #be123c; }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  padding: 8px 11px; outline: none; color: var(--ink); transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,91,255,.09); }
.textarea { resize: vertical; min-height: 82px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-row { margin-bottom: 13px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; display: block; }
.form-label .req { color: var(--rose); }
.form-hint { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.chip-select { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: #fff; color: var(--ink-2); transition: .15s; }
.chip:hover { border-color: var(--primary); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-d); font-weight: 700; }

/* ---------- 工具条 / 标签页 ---------- */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar .select { width: auto; min-width: 130px; }
.toolbar .input { width: auto; min-width: 190px; }
.toolbar .spacer { margin-left: auto; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 10px; overflow-x: auto; }
.tab { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); border: none; background: transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--primary-d); font-weight: 750; box-shadow: var(--shadow-sm); }
.count-note { font-size: 12px; color: var(--muted); }

.search-box { position: relative; }
.search-box input { padding-left: 32px; }
.search-box svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--muted-2); }

/* ---------- Hero / KPI ---------- */
.hero {
  border-radius: 16px; padding: 22px 25px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(115deg, #1a35a8 0%, #2f5bff 46%, #6b53e8 78%, #0d9488 120%);
  box-shadow: 0 12px 30px rgba(38, 66, 190, .18); margin-bottom: 16px;
}
.hero::after { content: ''; position: absolute; width: 340px; height: 340px; border-radius: 50%; right: -90px; top: -170px; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); }
.hero::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: 140px; bottom: -190px; background: radial-gradient(circle, rgba(255,255,255,.1), transparent 65%); }
.hero-in { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.hero p { margin: 0; font-size: 13px; color: rgba(255,255,255,.86); max-width: 700px; line-height: 1.7; }
.hero-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-tag { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); }
.hero-btn { background: #fff; color: #1e40d8; border: none; height: 40px; padding: 0 17px; border-radius: 10px; font-weight: 750; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.hero-btn:hover { transform: translateY(-1px); }
.hero-btn svg { width: 16px; height: 16px; }
.ai-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .8px; padding: 3px 9px; border-radius: 20px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); margin-bottom: 10px; }
.spark { width: 6px; height: 6px; border-radius: 50%; background: #7dffdc; box-shadow: 0 0 8px #7dffdc; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }

.kpi { padding: 16px 17px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center; }
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -1px; margin: 7px 0 1px; line-height: 1.2; }
.kpi-value small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { font-size: 11px; color: var(--muted-2); }

/* ---------- 图表 / 指标 ---------- */
.bar { display: block; height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #2f5bff, #6d5bff); transition: width .5s ease; }
.bar-fill.teal { background: linear-gradient(90deg, #0d9488, #22c1a8); }
.bar-fill.amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-fill.green { background: linear-gradient(90deg, #16a34a, #4ade80); }
.dim-row { display: grid; grid-template-columns: 82px 1fr 42px; align-items: center; gap: 9px; margin-bottom: 9px; font-size: 11.5px; color: var(--muted); }
.dim-row:last-child { margin-bottom: 0; }
.dim-val { text-align: right; font-weight: 700; color: var(--ink-2); }
.dim-evidence { font-size: 10.5px; color: var(--muted-2); margin: -5px 0 9px 91px; line-height: 1.5; }
.ring { width: 84px; height: 84px; flex: none; }
.ring-wrap { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring-label { position: absolute; text-align: center; line-height: 1.15; }
.ring-label b { font-size: 21px; font-weight: 800; color: var(--ink); letter-spacing: -1px; }
.ring-label span { font-size: 10px; color: var(--muted); display: block; }

/* ---------- 动态流 ---------- */
.activity-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.activity-item:last-child { border-bottom: none; padding-bottom: 2px; }
.act-icon { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.act-icon svg { width: 14px; height: 14px; }
.act-text { font-size: 12px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.act-time { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; margin-top: 2px; }
.scroll-list { max-height: 330px; overflow-y: auto; padding-right: 4px; }

/* ---------- 企业卡片 ---------- */
.company-card { padding: 15px 16px; cursor: pointer; transition: .18s; position: relative; }
.company-card:hover { border-color: #cbd8ff; box-shadow: var(--shadow); transform: translateY(-2px); }
.cc-head { display: flex; gap: 11px; align-items: flex-start; }
.cc-main { flex: 1; min-width: 0; }
.cc-name { font-size: 14.5px; font-weight: 750; line-height: 1.35; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; min-height: 21px; }
.cc-foot { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-2); }
.cc-metrics { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.cc-metrics b { color: var(--ink-2); font-size: 12px; }

/* ---------- 列表卡片 ---------- */
.item-card { padding: 15px 17px; transition: .18s; position: relative; }
.item-card:hover { border-color: #cbd8ff; box-shadow: var(--shadow-sm); }
.ic-title { font-size: 14px; font-weight: 750; line-height: 1.45; margin: 0 0 6px; color: var(--ink); }
.ic-desc { font-size: 12px; color: var(--muted); line-height: 1.6; }
.item-meta { display: flex; gap: 13px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.item-meta b { color: var(--ink-2); font-weight: 700; }
.ic-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.ic-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }

/* ---------- 匹配 ---------- */
.demand-pick { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 7px; cursor: pointer; background: #fff; transition: .16s; }
.demand-pick:hover { border-color: #cbd8ff; background: var(--surface-2); }
.demand-pick.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.dp-title { font-size: 12.5px; font-weight: 700; line-height: 1.45; }
.dp-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.engine-head { display: flex; align-items: center; gap: 11px; padding: 13px 17px; background: linear-gradient(100deg,#f3f6ff,#f6f2ff); border-bottom: 1px solid var(--line-2); }
.engine-orb { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg,#2f5bff,#7c3aed); display: grid; place-items: center; color: #fff; flex: none; box-shadow: 0 5px 14px rgba(80,70,220,.28); }
.engine-orb svg { width: 19px; height: 19px; }
.match-result { border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; margin-bottom: 11px; background: #fff; transition: .18s; }
.match-result:hover { border-color: #cbd8ff; box-shadow: var(--shadow-sm); }
.match-result.top { border-color: #c9d4ff; background: linear-gradient(180deg,#fbfcff,#fff); }
.match-head { display: flex; gap: 12px; align-items: flex-start; }
.match-main { flex: 1; min-width: 0; }
.match-title { font-size: 13.5px; font-weight: 750; line-height: 1.45; margin: 0; }
.match-co { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.reason-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.reason-list .tag { font-weight: 500; }
.gap-list { margin-top: 7px; font-size: 11px; color: #b45309; display: flex; flex-direction: column; gap: 3px; }
.match-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.reason-box { background: var(--violet-soft); border: 1px solid #e4d8ff; border-radius: 9px; padding: 9px 11px; font-size: 12px; color: #5b3fd6; line-height: 1.65; }
.resource-row { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed var(--line-2); }
.resource-row:last-child { border-bottom: none; }
.resource-main { flex: 1; min-width: 0; }
.resource-name { font-size: 13px; font-weight: 700; }
.resource-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ai-loading { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; padding: 18px 0; }
.spinner { width: 17px; height: 17px; border: 2px solid #dbe3ff; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-output { font-size: 12.5px; line-height: 1.75; color: var(--ink-2); }
.ai-output .ai-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 10.5px; color: var(--muted-2); flex-wrap: wrap; }
.ai-thinking { margin-bottom: 9px; border: 1px dashed #dce4ff; border-radius: 8px; background: #fbfcff; padding: 7px 10px; }
.ai-thinking summary { cursor: pointer; font-size: 11px; color: var(--muted); }
.ai-thinking pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 11px; color: var(--muted); margin: 6px 0 0; max-height: 140px; overflow: auto; }
.ai-placeholder { font-size: 12px; color: var(--muted); padding: 6px 0; }

/* ---------- 政策 ---------- */
.policy-card { padding: 16px 17px; transition: .18s; }
.policy-card:hover { border-color: #cbd8ff; box-shadow: var(--shadow-sm); }
.pc-amount { font-size: 18px; font-weight: 800; color: var(--amber); letter-spacing: -.5px; }
.pc-title { font-size: 14px; font-weight: 750; line-height: 1.45; margin: 0; }
.pc-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.pc-rules { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.rule-hit, .rule-miss { font-size: 11px; display: flex; gap: 6px; align-items: flex-start; }
.rule-hit { color: #15803d; } .rule-miss { color: #b45309; }
.pc-foot { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 15px; }
.summary-item { padding: 13px 15px; display: flex; align-items: center; gap: 11px; }
.summary-item > svg.icon { width: 20px; height: 20px; color: var(--muted-2); }

/* 政策库：区域 chips 与卡片 */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 5px 13px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.policy-lib .pl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.policy-lib .pl-head b { flex: 1; min-width: 0; font-size: 13.5px; }
.tag-blue { background: var(--primary-soft); color: var(--primary-d); }
.tag-plain { background: var(--surface-2); color: var(--muted); }
.t-ok { color: #15803d; font-weight: 600; }
.t-warn { color: #b45309; font-weight: 600; }

/* 全企业匹配：逐企业行 */
.batch-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
.batch-row:last-child { border-bottom: none; }
.batch-row .br-main { width: 170px; flex: none; }
.batch-row .br-main b { display: block; font-size: 13px; }
.batch-row .br-stats { display: flex; gap: 6px; flex: none; }
.batch-row .br-top { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-mark { color: var(--primary); font-weight: 800; }
.summary-item b { font-size: 21px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.summary-item span { font-size: 11px; color: var(--muted); display: block; }

/* ---------- 资料 ---------- */
.dropzone {
  border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 20px; text-align: center;
  background: var(--surface-2); transition: .18s; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 30px; height: 30px; color: var(--primary); margin-bottom: 6px; }
.dropzone b { display: block; font-size: 13px; }
.dropzone span { font-size: 11.5px; color: var(--muted); }
.doc-row { display: flex; gap: 11px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line-2); }
.doc-row:last-child { border-bottom: none; }
.doc-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-d); display: grid; place-items: center; flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.doc-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.field-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.field-table th { text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 700; padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.field-table td { padding: 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.field-table .conf { font-size: 10.5px; color: var(--muted); }
.need-pick { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 7px; background: #fff; }
.need-pick .np-main { flex: 1; min-width: 0; }

/* ---------- 详情 / 空态 ---------- */
.detail-kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 12.5px; }
.detail-kv .k { color: var(--muted); }
.detail-kv .v { color: var(--ink-2); font-weight: 600; word-break: break-word; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: #cbd5e1; margin-bottom: 8px; }
.empty p { margin: 0 0 10px; font-size: 12.5px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.status.open { background: var(--primary-soft); color: var(--primary-d); }
.status.progress { background: var(--amber-soft); color: #b45309; }
.status.done { background: var(--green-soft); color: #15803d; }
.status.archive { background: var(--surface-2); color: var(--muted); }
.status.wait { background: var(--rose-soft); color: #be123c; }

.company-hero { padding: 19px 21px; margin-bottom: 15px; }
.ch-head { display: flex; gap: 15px; align-items: flex-start; flex-wrap: wrap; }
.ch-main { flex: 1; min-width: 220px; }
.ch-name { font-size: 20px; font-weight: 800; letter-spacing: -.4px; margin: 0; line-height: 1.35; }
.ch-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.ch-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.ch-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.ch-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.ch-metric { min-width: 0; }
.ch-metric b { font-size: 19px; font-weight: 800; letter-spacing: -.5px; display: block; line-height: 1.2; }
.ch-metric span { font-size: 10.5px; color: var(--muted); }
.ch-bar { margin-top: 12px; }
.tagline { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 对话 ---------- */
.chat-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 15px; height: calc(100vh - 152px); min-height: 480px; }
.chat-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.chat-head { padding: 12px 17px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px; background: linear-gradient(180deg,#fbfcff,#fff 220px); }
.chat-msg { display: flex; gap: 10px; margin-bottom: 17px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-av { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg,#2f5bff,#7c3aed); }
.chat-msg.user .chat-av { background: #e2e8f0; color: var(--muted); }
.chat-bub { max-width: min(680px, 86%); border-radius: 13px; padding: 10px 13px; font-size: 13px; line-height: 1.7; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); }
.chat-msg.user .chat-bub { background: var(--primary); border-color: var(--primary); color: #fff; }
.chat-bub .ai-meta { margin-bottom: 6px; }
.chat-empty { text-align: center; padding: 42px 16px 20px; }
.chat-empty .ce-orb { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg,#2f5bff,#7c3aed,#0d9488); box-shadow: 0 10px 24px rgba(80,70,220,.26); }
.chat-empty .ce-orb svg { width: 26px; height: 26px; }
.chat-empty h3 { margin: 0 0 5px; font-size: 16px; }
.chat-empty p { margin: 0 auto; max-width: 480px; font-size: 12.5px; color: var(--muted); }
.quick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.quick-q { text-align: left; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 12px; color: var(--ink-2); }
.quick-q:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-d); }
.chat-composer { border-top: 1px solid var(--line-2); padding: 11px 13px; background: #fff; }
.chat-input-wrap { display: flex; gap: 9px; align-items: flex-end; }
.chat-input { flex: 1; resize: none; min-height: 42px; max-height: 130px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; outline: none; font-size: 13px; line-height: 1.55; }
.chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,91,255,.09); }
.chat-send { width: 42px; height: 42px; padding: 0; flex: none; }
.chat-send svg { width: 18px; height: 18px; }
.composer-hint { font-size: 10.5px; color: var(--muted-2); margin-top: 6px; }

/* ---------- Markdown ---------- */
.md { font-size: 12.8px; line-height: 1.78; color: var(--ink-2); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { color: var(--ink); line-height: 1.45; margin: 14px 0 7px; font-weight: 800; }
.md h1 { font-size: 17px; } .md h2 { font-size: 15.5px; } .md h3 { font-size: 14px; } .md h4 { font-size: 13px; }
.md p { margin: 7px 0; }
.md ul, .md ol { margin: 7px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md strong { color: var(--ink); font-weight: 750; }
.md blockquote { margin: 9px 0; padding: 7px 11px; border-left: 3px solid #cbd8ff; background: var(--surface-2); color: var(--muted); border-radius: 0 7px 7px 0; }
.md code { background: #eef2f7; border-radius: 4px; padding: 1px 5px; font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.md pre { background: #0f172a; color: #e2e8f0; border-radius: 9px; padding: 11px 13px; overflow-x: auto; margin: 9px 0; }
.md pre code { background: none; color: inherit; padding: 0; font-size: 11.5px; }
.md table { border-collapse: collapse; width: 100%; margin: 9px 0; font-size: 11.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.md th { background: var(--surface-2); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 13px 0; }
.md a { color: var(--primary); text-decoration: underline; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .9fr); gap: 15px; align-items: start; }
.set-block + .set-block { margin-top: 15px; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.info-banner { display: flex; align-items: flex-start; gap: 8px; padding: 10px 13px; border-radius: 10px; background: var(--primary-soft); border: 1px solid #dde5ff; color: var(--ink-2); font-size: 12px; line-height: 1.55; }
.info-banner svg { width: 15px; height: 15px; flex: none; vertical-align: -2px; }
.path-line { font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; word-break: break-all; font-family: ui-monospace, Consolas, monospace; }
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; }
.code-row .btn { flex: none; }
.login-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.login-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border: none; background: transparent; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-tab svg { width: 15px; height: 15px; }
.login-tab:hover { color: var(--ink); }
.login-tab.active { background: #fff; color: var(--primary-d); font-weight: 750; box-shadow: var(--shadow-sm); }
.account-head { display: flex; align-items: center; gap: 12px; }
.account-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.account-name { font-size: 15px; font-weight: 800; }
.kv-list { border-top: 1px dashed var(--line-2); }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.kv-key { font-size: 12px; color: var(--muted); flex: none; }
.kv-val { font-size: 13px; font-weight: 600; text-align: right; word-break: break-all; }

.enrich-panel { border: 1px dashed #cdd8f5; background: #f7f9ff; border-radius: 12px; padding: 13px 14px; margin-bottom: 15px; }
.candidate-list { display: flex; flex-direction: column; gap: 6px; }
.candidate-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 11px; cursor: pointer; transition: .15s; }
.candidate-row:hover { border-color: #cbd8ff; background: var(--surface-2); }
.candidate-row .cand-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.candidate-row .cand-main b { font-size: 12.5px; }
.candidate-row svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.input.field-web, .textarea.field-web { border-color: #f2c069; background: #fffaf0; }
.input.field-api { border-color: #b5e3c2; }
.enrich-legend-web { color: #b45309; font-weight: 700; }

/* ---------- 浮层 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.42); backdrop-filter: blur(2px); z-index: 40; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(620px, calc(100vw - 30px)); max-height: min(86vh, 880px); background: #fff;
  border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: pop .22s ease; overflow: hidden;
}
.modal.wide { width: min(880px, calc(100vw - 30px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%,-46%) scale(.97); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
.modal-head { padding: 17px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 800; }
.modal-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.modal-body { padding: 18px 21px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 21px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); flex-wrap: wrap; }
.close-x { width: 30px; height: 30px; border-radius: 8px; border: none; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.close-x svg { width: 16px; height: 16px; }
.close-x:hover { background: var(--rose-soft); color: var(--rose); }
.drawer {
  position: fixed; z-index: 50; right: 0; top: 0; bottom: 0; width: min(540px, 100vw);
  background: #fff; box-shadow: -12px 0 40px rgba(15,23,42,.16); display: flex; flex-direction: column;
  animation: slide .24s ease;
}
@keyframes slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 11px 15px; min-width: 240px; max-width: 380px; animation: toastIn .24s ease; }
.toast.ok { border-left-color: var(--green); } .toast.warn { border-left-color: var(--amber); } .toast.err { border-left-color: var(--rose); } .toast.ai { border-left-color: var(--violet); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.toast-title { font-size: 12.5px; font-weight: 750; display: flex; align-items: center; gap: 6px; }
.toast-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.confirm-text { font-size: 13px; color: var(--ink-2); line-height: 1.7; }

/* ---------- 移动端 ---------- */
.nav-toggle, .tabbar, .nav-scrim { display: none; }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-main { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-match { grid-template-columns: 250px minmax(0,1fr); }
  .chat-layout { grid-template-columns: 230px minmax(0,1fr); }
}
@media (max-width: 900px) {
  html, body { height: 100%; -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
  body.nav-open { overflow: hidden; }
  .app { height: 100vh; height: 100dvh; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 270px; max-width: 84vw;
    transform: translateX(-102%); transition: transform .28s cubic-bezier(.32,.72,0,1);
    box-shadow: 10px 0 34px rgba(15,23,42,.16); z-index: 60; padding-top: env(safe-area-inset-top, 0px);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15,23,42,.42); }
  .nav-scrim[hidden] { display: none; }
  .nav-toggle { display: grid; }
  .topbar {
    height: calc(55px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 10px 0;
    gap: 8px;
  }
  .top-left { gap: 8px; }
  .crumb { font-size: 12.5px; }
  .top-right { gap: 6px; }
  .ai-pill { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .account-chip { padding: 2px 8px 2px 2px; }
  .account-chip .ac-name { display: none; }
  .view { padding: 13px 12px calc(86px + env(safe-area-inset-bottom, 0px)); }
  .page-head { flex-direction: column; align-items: stretch; gap: 9px; margin-bottom: 13px; }
  .page-title { font-size: 19px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 130px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .split-main, .split-match { grid-template-columns: 1fr; }
  .card-body { padding: 14px; }
  .card-head { padding: 13px 14px; }
  .item-card, .policy-card, .company-card { padding: 14px; }
  .hero { padding: 17px 15px; }
  .hero-in { gap: 14px; }
  .hero p { font-size: 12.5px; }
  .hero-in > .hero-actions { width: 100%; display: flex; gap: 8px; }
  .hero-in > .hero-actions .hero-btn { flex: 1; justify-content: center; }
  .toolbar .select, .toolbar .input, .toolbar .search-box { width: 100%; min-width: 0; }
  .toolbar .spacer { margin-left: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .input, .select, .textarea, .chat-input { font-size: 16px; }
  .ch-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chat-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .chat-side { display: none; }
  .chat-main { height: calc(100vh - 132px); height: calc(100dvh - 132px); min-height: 420px; }
  .chat-scroll { padding: 13px; }
  .chat-bub { max-width: 88%; }
  .summary-strip { grid-template-columns: 1fr; gap: 8px; }
  .modal, .modal.wide {
    width: 100%; left: 0; top: auto; bottom: 0; transform: none; max-height: 92vh; max-height: 92dvh;
    border-radius: 18px 18px 0 0; animation: sheetUp .26s ease;
  }
  @keyframes sheetUp { from { transform: translateY(28px); opacity: .5; } to { transform: none; opacity: 1; } }
  .modal-foot .btn { flex: 1; height: 42px; }
  .drawer { width: 100%; top: auto; bottom: 0; height: 92vh; height: 92dvh; border-radius: 18px 18px 0 0; animation: sheetUp .26s ease; }
  .toast-root { left: 12px; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: none; background: none; padding: 6px 2px; color: var(--muted);
    font-size: 10.5px; font-weight: 600; border-radius: 10px; transition: .15s;
  }
  .tabbar-item svg { width: 20px; height: 20px; }
  .tabbar-item.active { color: var(--primary); }
  .tabbar-item.active span { font-weight: 800; }
  body.kb-open .tabbar { transform: translateY(140%); opacity: 0; pointer-events: none; }
  body.kb-open .view { padding-bottom: 20px; }
}
@media (max-width: 560px) {
  .page-title { font-size: 18px; }
  .ch-name { font-size: 18px; }
  .kpi-value { font-size: 22px; }
  .ch-actions { width: 100%; }
  .ch-actions .btn { flex: 1 1 auto; }
  .g4 > .kpi:last-child { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
