/* ==========================================================================
   LeadOps 运营后台 — 纯静态样式（无外网字体 / 图片 / CDN）
   设计基准：基础字号 13px，表格行高 33px，页面左右留白 18px
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --bg: #f2f4f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f3f6fa;
  --line: #e3e7ee;
  --line-2: #eef1f6;
  --line-strong: #cfd6e2;

  --text: #17202e;
  --text-2: #475467;
  --muted: #667085;
  --muted-2: #8b95a5;

  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-soft: #e9efff;
  --brand-line: #c7d7ff;

  --green: #15803d;
  --green-soft: #e7f6ec;
  --green-line: #b7e3c4;
  --orange: #b45309;
  --orange-soft: #fdf1dc;
  --orange-line: #f0d3a1;
  --red: #b91c1c;
  --red-soft: #fdeaea;
  --red-line: #f3c1c1;
  --purple: #6d28d9;
  --purple-soft: #f0e9fe;
  --purple-line: #d8c8fb;
  --teal: #0f766e;
  --teal-soft: #e2f5f2;
  --teal-line: #b0e4dd;
  --gray: #475467;
  --gray-soft: #eef1f6;
  --gray-line: #d8dee8;

  --sidebar-w: 200px;
  --topbar-h: 48px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 6px 18px rgba(16, 24, 40, 0.10);
  --shadow-3: 0 12px 32px rgba(16, 24, 40, 0.16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-y: scroll;
}
body.no-scroll { overflow: hidden; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code, pre, .mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.45);
  outline-offset: 1px;
}

.ic { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.hidden, [hidden] { display: none !important; }
.only-mobile { display: none; }

/* ---------------------------------------------------------------- 启动页 */
.boot-splash {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--muted);
}
.boot-logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.boot-bar { width: 180px; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; background: var(--brand); border-radius: 3px; animation: boot-slide 1.1s ease-in-out infinite; }
.boot-text { font-size: 12px; }
@keyframes boot-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }

.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 800; letter-spacing: -0.5px; flex: 0 0 auto;
}

/* ---------------------------------------------------------------- 框架 */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: #101b2d; color: #c7d2e3;
  transition: width 0.16s ease;
}
.sidebar-brand {
  height: var(--topbar-h); flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); overflow: hidden; white-space: nowrap;
}
.sidebar-brand .logo-mark { width: 22px; height: 22px; font-size: 14px; background: #2563eb; }
.sidebar-name { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: 0.2px; }
.sidebar-tag { margin-left: auto; font-size: 10px; color: #7f8ea8; border: 1px solid #2b3a52; padding: 0 4px; border-radius: 3px; }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 8px 8px 12px; }
.nav-group { margin-top: 10px; padding: 4px 8px; font-size: 10.5px; letter-spacing: 0.6px; color: #64748b; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; margin: 1px 0;
  border-radius: 6px; color: #c7d2e3; font-size: 13px; white-space: nowrap; overflow: hidden;
  text-decoration: none; position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: #93b4ff; border-radius: 2px; }
.nav-item .ic { width: 17px; height: 17px; opacity: 0.9; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff;
  font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.nav-badge.dim { background: #334155; color: #cbd5e1; }

.sidebar-foot {
  flex: 0 0 auto; border-top: 1px solid rgba(255, 255, 255, 0.07); padding: 8px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-foot .tenant-mini { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.sidebar-foot .tenant-mini b { display: block; color: #e2e8f0; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .tenant-mini span { display: block; color: #7f8ea8; font-size: 10.5px; }
.sidebar-foot .icon-btn { color: #93a3ba; }
.sidebar-foot .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.16s ease; }

body.sb-collapsed { --sidebar-w: 56px; }
body.sb-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sb-collapsed .sidebar-brand .sidebar-name,
body.sb-collapsed .sidebar-brand .sidebar-tag,
body.sb-collapsed .nav-label,
body.sb-collapsed .nav-group,
body.sb-collapsed .sidebar-foot .tenant-mini { display: none; }
body.sb-collapsed .nav-item { justify-content: center; padding: 0; }
body.sb-collapsed .nav-item .nav-badge { position: absolute; top: 2px; right: 6px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }
body.sb-collapsed .sidebar-nav { padding: 8px 6px; }
body.sb-collapsed .sidebar-foot { justify-content: center; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-search { position: relative; width: 300px; max-width: 34vw; }
.topbar-search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 14px; height: 14px; }
.topbar-search input {
  width: 100%; height: 30px; padding: 0 28px 0 29px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--panel-2); font-size: 12.5px; color: var(--text);
}
.topbar-search input::placeholder { color: var(--muted-2); }
.topbar-search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12); }
.topbar-search kbd {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: 11px var(--font-mono); color: var(--muted-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 0 4px; background: #fff; line-height: 16px;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted);
  position: relative;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn .ic { width: 17px; height: 17px; }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: #ef4444; border: 1.5px solid #fff;
}
.btn-dot-count {
  position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #fff;
}

.topbar-divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }

.menu-wrap { position: relative; }
.menu-trigger {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text); font-size: 12.5px;
}
.menu-trigger:hover { background: var(--panel-3); }
.menu-trigger .ic { color: var(--muted); width: 14px; height: 14px; }
.menu-trigger .avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.menu-trigger .tenant-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.usr-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-popover {
  position: absolute; top: 36px; right: 0; z-index: 60; min-width: 200px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-3);
  padding: 5px; display: none;
}
.menu-wrap.open .menu-popover { display: block; }
.menu-title { padding: 6px 9px 4px; font-size: 11px; color: var(--muted-2); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 9px;
  border: 0; background: transparent; border-radius: 5px; color: var(--text); font-size: 13px; text-align: left;
}
.menu-item:hover { background: var(--panel-3); }
.menu-item .ic { width: 15px; height: 15px; color: var(--muted); }
.menu-item.active { color: var(--brand); font-weight: 600; }
.menu-item.active .ic { color: var(--brand); }
.menu-item .menu-check { margin-left: auto; color: var(--brand); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-meta { padding: 6px 9px; font-size: 11.5px; color: var(--muted-2); }

/* ---------------------------------------------------------------- 内容区 */
.content { flex: 1; min-width: 0; padding: 14px 18px 30px; }
.page { max-width: 1680px; margin: 0 auto; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); margin-bottom: 6px; }
.crumbs a { color: var(--muted-2); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: #c3cad6; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.page-title { font-size: 19px; line-height: 1.25; font-weight: 700; letter-spacing: -0.3px; }
.page-desc { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text); font-size: 13px; line-height: 1; white-space: nowrap;
  text-decoration: none; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--panel-2); border-color: #b8c2d2; text-decoration: none; }
.btn .ic { width: 14px; height: 14px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-danger { color: var(--red); border-color: var(--red-line); background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #e6a9a9; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #991b1b; border-color: #991b1b; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-3); color: var(--text); border-color: transparent; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn-sm .ic { width: 13px; height: 13px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.6; pointer-events: none; }
.btn.is-busy::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn { border: 0; background: transparent; color: var(--brand); padding: 0 2px; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* ---------------------------------------------------------------- 表单控件 */
.input, .select, .textarea {
  height: 30px; width: 100%; min-width: 0; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff;
  color: var(--text); font-size: 13px; line-height: 30px;
}
.select { padding-right: 24px; 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='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.textarea { height: auto; min-height: 66px; padding: 7px 9px; line-height: 1.5; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #b8c2d2; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input[readonly] { background: var(--panel-2); color: var(--muted); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--red); background: #fffafa; }
.form-error { color: var(--red); font-size: 12px; min-height: 0; }
.form-hint { color: var(--muted-2); font-size: 11.5px; }

label.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
label.field > span, .field-label { font-size: 12px; color: var(--muted); font-weight: 500; }
label.field > span .req, .req { color: var(--red); }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 14px; height: 14px; accent-color: var(--brand); margin: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-row { display: flex; gap: 8px; align-items: center; }
.form-row .input, .form-row .select { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 开关 */
.switch {
  position: relative; width: 34px; height: 19px; flex: 0 0 auto; padding: 0; border: 0;
  border-radius: 10px; background: #cbd5e1; transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25); transition: transform 0.15s;
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(15px); }
.switch[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- 筛选条 */
.filterbar {
  position: sticky; top: var(--topbar-h); z-index: 20;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; margin-bottom: 10px; box-shadow: var(--shadow-1);
}
.filterbar .f-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.filterbar .f-field > label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.filterbar .input, .filterbar .select { width: auto; }
.filterbar .grow { flex: 1 1 220px; min-width: 180px; }
.filterbar .grow .input { width: 100%; }
.filterbar .spacer { flex: 1; }
.filterbar .fb-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- 卡片 / KPI */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); min-height: 40px;
}
.card-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.card-title .ic { width: 15px; height: 15px; color: var(--muted); }
.card-sub { font-size: 11.5px; color: var(--muted-2); font-weight: 400; }
.card-body { padding: 12px 14px; }
.card-body.tight { padding: 8px 10px; }
.card-grid { display: grid; gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi {
  position: relative; overflow: hidden; display: block; padding: 11px 14px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none;
}
a.kpi:hover { border-color: var(--brand-line); box-shadow: var(--shadow-2); text-decoration: none; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.kpi.kpi-green::before { background: var(--green); }
.kpi.kpi-orange::before { background: var(--orange); }
.kpi.kpi-red::before { background: var(--red); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-top .ic { width: 15px; height: 15px; color: var(--muted-2); }
.kpi-value { margin-top: 3px; font-size: 25px; line-height: 1.15; font-weight: 700; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.kpi-foot { margin-top: 3px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi-foot .up { color: var(--green); }
.kpi-foot .warn { color: var(--orange); }
.kpi-foot .danger { color: var(--red); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.dash-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }

/* 趋势柱状图（纯 CSS） */
.chart { display: flex; align-items: stretch; gap: 10px; height: 156px; padding: 8px 2px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.chart-bar {
  width: 62%; max-width: 46px; min-height: 2px; background: #bfd0f7; border-radius: 3px 3px 0 0;
  transition: background 0.15s; position: relative;
}
.chart-col.today .chart-bar { background: var(--brand); }
.chart-bar:hover { background: var(--brand); }
.chart-val { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-lbl { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.chart-bars { flex: 1; display: flex; align-items: flex-end; gap: 10px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; height: 156px; padding: 0 0 22px; font-size: 10.5px; color: var(--muted-2); text-align: right; }

/* 来源分布 */
.dist { display: flex; flex-direction: column; gap: 11px; }
.dist-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 48px; align-items: center; gap: 9px; }
.dist-name { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-track { height: 7px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.dist-fill { height: 100%; background: var(--brand); border-radius: 4px; }
.dist-row:nth-child(2) .dist-fill { background: #3b82f6; }
.dist-row:nth-child(3) .dist-fill { background: #60a5fa; }
.dist-row:nth-child(4) .dist-fill { background: #93b4f8; }
.dist-row:nth-child(5) .dist-fill { background: #a9c2f5; }
.dist-row:nth-child(6) .dist-fill { background: #c2d3f7; }
.dist-count { font-size: 12px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* 迷你列表 */
.mini-list { display: flex; flex-direction: column; }
.mini-item {
  display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 5px 4px;
  border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none;
}
.mini-item:last-child { border-bottom: 0; }
.mini-item:hover { background: var(--panel-2); text-decoration: none; }
.mini-main { flex: 1; min-width: 0; }
.mini-title { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { font-size: 11px; color: var(--muted-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-side { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- 表格 */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line);
  background: #fff; font-size: 12px; color: var(--muted);
}
.table-toolbar .spacer { flex: 1; }
.table-wrap { overflow: auto; max-height: calc(100vh - 240px); }
.table-wrap.short { max-height: calc(100vh - 320px); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 2; height: 34px; padding: 0 10px; text-align: left;
  background: #f7f9fc; color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--brand); }
table.data th .sort-ind { font-size: 10px; color: var(--brand); margin-left: 3px; }
table.data td {
  height: 33px; padding: 0 10px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle; white-space: nowrap; color: var(--text);
}
table.data tbody tr:nth-child(even) td { background: #fbfcfe; }
table.data tbody tr:hover td { background: #f2f6ff; }
table.data tbody tr.selected td { background: #eaf1ff; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .col-check { width: 34px; padding-left: 12px; padding-right: 0; }
table.data .col-actions { width: 1%; text-align: right; padding-right: 12px; }
table.data .cell-main { display: flex; flex-direction: column; justify-content: center; line-height: 1.25; max-width: 280px; }
table.data .cell-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
table.data .cell-main small { color: var(--muted-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
table.data .truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.data .num { font-variant-numeric: tabular-nums; }
table.data .row-sub { color: var(--muted-2); font-size: 11.5px; }
.row-actions { display: inline-flex; align-items: center; gap: 2px; }
.row-actions .icon-btn { width: 24px; height: 24px; }
.row-actions .icon-btn .ic { width: 14px; height: 14px; }
.checkbox-cell { width: 14px; height: 14px; accent-color: var(--brand); display: block; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 3px; }
.pager .btn { height: 26px; min-width: 26px; padding: 0 7px; font-size: 12px; }
.pager .btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pager-info { margin: 0 6px; }

/* 状态胶囊 */
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1;
  background: var(--gray-soft); color: var(--gray);
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.9; flex: 0 0 auto; }
.pill.no-dot::before { display: none; }
.pill-blue { background: var(--brand-soft); color: var(--brand); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-orange { background: var(--orange-soft); color: var(--orange); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-teal { background: var(--teal-soft); color: var(--teal); }
.pill-gray { background: var(--gray-soft); color: var(--gray); }
.pill-outline { background: #fff; border: 1px solid var(--line-strong); color: var(--text-2); }
.pill-lg { height: 22px; padding: 0 9px; font-size: 12px; }
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); font-size: 11px; }

.score-chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 20px;
  padding: 0 5px; border-radius: 4px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--gray-soft); color: var(--gray);
}
.score-hi { background: var(--green-soft); color: var(--green); }
.score-mid { background: var(--brand-soft); color: var(--brand); }
.score-low { background: var(--gray-soft); color: var(--muted); }
.risk-high { background: var(--red-soft); color: var(--red); }
.risk-normal { background: var(--orange-soft); color: var(--orange); }
.risk-low { background: var(--gray-soft); color: var(--gray); }

.run-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; }
.run-dot.running { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* 批量操作条 */
.bulk-bar {
  position: sticky; top: calc(var(--topbar-h) + 52px); z-index: 19;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef4ff; border: 1px solid var(--brand-line); border-radius: var(--radius);
  padding: 7px 12px; margin-bottom: 10px; box-shadow: var(--shadow-1);
}
.bulk-bar .bulk-count { font-size: 12.5px; color: var(--brand); font-weight: 600; }
.bulk-bar .bulk-count b { font-size: 13px; }
.bulk-bar .spacer { flex: 1; }

/* 分段控件 */
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--panel-3); border-radius: 7px; border: 1px solid var(--line); overflow-x: auto; max-width: 100%; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 11px; border: 0;
  border-radius: 5px; background: transparent; color: var(--text-2); font-size: 12.5px; white-space: nowrap;
}
.seg-btn:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); }
.seg-btn.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow-1); }
.seg-btn .seg-count { font-size: 11px; color: var(--muted-2); background: var(--panel-3); border-radius: 8px; padding: 0 5px; min-width: 17px; text-align: center; }
.seg-btn.active .seg-count { background: var(--brand-soft); color: var(--brand); }

/* 空状态 / 骨架 / 错误 */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .empty-ic { width: 38px; height: 38px; border-radius: 50%; background: var(--panel-3); display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.empty .empty-ic .ic { width: 20px; height: 20px; color: #a9b3c2; }
.empty-title { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.empty-desc { font-size: 12px; color: var(--muted-2); max-width: 420px; }
.empty .btn { margin-top: 5px; }

.skeleton-row { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.sk { height: 10px; border-radius: 3px; background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk.w20 { width: 20%; } .sk.w15 { width: 15%; } .sk.w30 { width: 30%; } .sk.w10 { width: 10%; } .sk.w40 { width: 40%; }

.state-error { padding: 30px 20px; text-align: center; color: var(--muted); }
.state-error .ic { width: 22px; height: 22px; color: var(--orange); }
.state-error .state-title { margin-top: 6px; font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- 抽屉 */
.drawer-root { position: fixed; inset: 0; z-index: 60; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.38); animation: fade-in 0.15s ease; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 480px; max-width: 100%;
  display: flex; flex-direction: column; background: #fff; box-shadow: -10px 0 30px rgba(15, 23, 42, 0.18);
  animation: drawer-in 0.2s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer-head {
  flex: 0 0 auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px 10px 16px; border-bottom: 1px solid var(--line); background: #fff;
}
.drawer-head-main { flex: 1; min-width: 0; }
.drawer-kicker { font-size: 11px; color: var(--muted-2); letter-spacing: 0.3px; }
.drawer-title { font-size: 16px; font-weight: 700; line-height: 1.3; margin-top: 2px; word-break: break-word; }
.drawer-sub { margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px 28px; overscroll-behavior: contain; }
.drawer-section { margin-bottom: 14px; }
.drawer-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--muted-2); letter-spacing: 0.4px; text-transform: uppercase;
  padding: 3px 0 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 9px;
}
.drawer-actions {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
}
.drawer-loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.drawer-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 16px; background: var(--panel-2); display: flex; gap: 8px; justify-content: flex-end; }

/* 键值明细 */
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.kv dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--line-2); color: var(--text); word-break: break-word; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.kv .kv-empty { color: var(--muted-2); }
.kv a { word-break: break-all; }

/* 时间轴 */
.timeline { position: relative; margin: 0; padding: 2px 0 0 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 4px; width: 1px; background: var(--line-strong); }
.tl-item { position: relative; padding: 0 0 14px 4px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 4px; width: 7px; height: 7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-sizing: content-box;
}
.tl-item.tone-green::before { border-color: var(--green); }
.tl-item.tone-red::before { border-color: var(--red); }
.tl-item.tone-orange::before { border-color: var(--orange); }
.tl-item.tone-gray::before { border-color: #a9b3c2; }
.tl-when { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 12.5px; margin-top: 1px; color: var(--text); word-break: break-word; }
.tl-actor { color: var(--muted-2); font-size: 11.5px; }
.tl-kind { font-size: 10.5px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; margin-left: 4px; }

/* 备注 / 草稿输入 */
.composer { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.composer .textarea { min-height: 62px; }
.composer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-actions .spacer { flex: 1; }

/* ---------------------------------------------------------------- 弹窗 */
.modal-root { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; overflow-y: auto; background: rgba(15, 23, 42, 0.42); }
.modal {
  width: 560px; max-width: 100%; background: #fff; border-radius: 10px; box-shadow: var(--shadow-3);
  animation: modal-in 0.16s ease; margin-bottom: 16px;
}
.modal.modal-sm { width: 420px; }
.modal.modal-lg { width: 680px; }
@keyframes modal-in { from { transform: translateY(-6px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px 11px; border-bottom: 1px solid var(--line); }
.modal-head-main { flex: 1; min-width: 0; }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 14px 16px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 10px 10px; }
.modal-foot .spacer { flex: 1; }

.alert { display: flex; gap: 8px; padding: 9px 11px; border-radius: 7px; font-size: 12.5px; border: 1px solid; }
.alert .ic { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.alert-warn { background: var(--orange-soft); border-color: var(--orange-line); color: #7c3f08; }
.alert-danger { background: var(--red-soft); border-color: var(--red-line); color: #7f1d1d; }
.alert-info { background: var(--brand-soft); border-color: var(--brand-line); color: #1e3a8a; }
.alert-success { background: var(--green-soft); border-color: var(--green-line); color: #14532d; }

/* ---------------------------------------------------------------- Toast */
.toasts { position: fixed; top: 56px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; max-width: 380px;
  padding: 9px 12px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 12.5px;
  box-shadow: var(--shadow-3); animation: toast-in 0.16s ease; word-break: break-word;
}
.toast .ic { width: 15px; height: 15px; margin-top: 1px; flex: 0 0 auto; }
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
.toast.warn { background: #78350f; }
.toast.info { background: #1e3a8a; }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- 审批卡 */
.approval-list { display: flex; flex-direction: column; gap: 10px; }
.approval-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 12px 14px; }
.approval-card.done { opacity: 0.92; }
.approval-head { display: flex; align-items: flex-start; gap: 12px; }
.approval-head-main { flex: 1; min-width: 0; }
.approval-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.approval-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.approval-meta span { display: inline-flex; align-items: center; gap: 4px; }
.approval-meta .ic { width: 13px; height: 13px; }
.approval-preview {
  margin-top: 9px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap; word-break: break-word;
}
.approval-preview .pv-subject { font-weight: 600; color: var(--text); margin-bottom: 3px; display: block; }
.approval-preview .pv-to { color: var(--muted); font-size: 11.5px; display: block; margin-bottom: 3px; }
.approval-note { margin-top: 9px; }
.approval-note .input { height: 28px; font-size: 12.5px; }
.approval-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.approval-actions .btn { min-width: 92px; }
.approval-decision { margin-top: 9px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 渠道卡 */
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.channel-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); display: flex; flex-direction: column; }
.channel-head { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.channel-ico { width: 30px; height: 30px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.channel-ico .ic { width: 16px; height: 16px; }
.channel-ico.k-telegram { background: #e0f2fe; color: #0369a1; }
.channel-ico.k-whatsapp { background: #dcfce7; color: #15803d; }
.channel-ico.k-sms { background: #fef3c7; color: #b45309; }
.channel-name { font-size: 13px; font-weight: 600; }
.channel-sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.channel-head .spacer { flex: 1; }
.channel-body { padding: 12px 14px; flex: 1; }
.channel-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; }
.channel-fields .span-2 { grid-column: 1 / -1; }
.channel-foot { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line-2); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }
.channel-foot .spacer { flex: 1; }
.channel-foot .last-check { font-size: 11px; color: var(--muted-2); }

/* ---------------------------------------------------------------- 设置 */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.subtab {
  position: relative; padding: 9px 13px; border: 0; background: transparent; color: var(--muted);
  font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.settings-note { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .tr-main { min-width: 0; }
.toggle-row .tr-title { font-size: 12.5px; }
.toggle-row .tr-desc { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }

/* ---------------------------------------------------------------- 登录页 */
.is-login { overflow: hidden; }
.login-shell { min-height: 100vh; display: flex; background: var(--bg); }
.login-brand {
  flex: 1 1 55%; min-width: 0; background: #101b2d; color: #dbe4f2;
  padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand-lg { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.login-brand-lg .logo-mark { width: 28px; height: 28px; font-size: 17px; }
.login-pitch { max-width: 500px; margin: 24px 0; }
.login-pitch h1 { font-size: 30px; line-height: 1.25; font-weight: 700; color: #fff; letter-spacing: -0.6px; }
.login-pitch p { margin-top: 12px; font-size: 13px; line-height: 1.7; color: #9fb0c9; }
.login-points { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.login-points li { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: #b9c8de; }
.login-points .ic { width: 15px; height: 15px; margin-top: 1px; color: #60a5fa; }
.login-brand-foot { font-size: 11.5px; color: #64748b; }
.login-card-wrap { flex: 0 0 440px; display: flex; align-items: center; justify-content: center; padding: 28px; background: var(--bg); }
.login-card { width: 100%; max-width: 350px; }
.login-card-mark { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; margin-bottom: 22px; }
.login-card h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.login-card .login-lead { margin-top: 5px; margin-bottom: 20px; font-size: 12.5px; color: var(--muted); }
.login-card .field { margin-bottom: 12px; }
.login-card .field .input { height: 36px; line-height: 36px; font-size: 13.5px; }
.login-err { margin: 4px 0 10px; padding: 7px 10px; border-radius: 6px; background: var(--red-soft); border: 1px solid var(--red-line); color: #7f1d1d; font-size: 12px; }
.login-card .btn-lg { margin-top: 4px; }
.login-hint { margin-top: 16px; font-size: 11.5px; color: var(--muted-2); text-align: center; line-height: 1.7; }
.login-hint code { background: var(--panel-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 11px; }

/* ---------------------------------------------------------------- 移动端底部导航 */
.mobile-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.06);
}
.mobile-nav a {
  flex: 1; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: 10.5px; text-decoration: none; position: relative;
}
.mobile-nav a.active { color: var(--brand); font-weight: 600; }
.mobile-nav a .ic { width: 20px; height: 20px; }
.mobile-nav .m-dot {
  position: absolute; top: 5px; right: calc(50% - 17px); min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: #ef4444; color: #fff; font-size: 9.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.mobile-more-sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; background: rgba(15, 23, 42, 0.42); }
.mobile-more-sheet .sheet { width: 100%; background: #fff; border-radius: 14px 14px 0 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); animation: modal-in 0.16s ease; }
.sheet-handle { width: 36px; height: 4px; background: var(--line-strong); border-radius: 2px; margin: 6px auto 10px; }
.sheet-title { font-size: 12px; color: var(--muted-2); padding: 0 10px 6px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sheet-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 8px; color: var(--text); font-size: 12px; background: transparent; border: 0; }
.sheet-item:hover { background: var(--panel-3); }
.sheet-item .ic { width: 20px; height: 20px; color: var(--muted); }
.sheet-item.danger { color: var(--red); }
.sheet-item.danger .ic { color: var(--red); }

/* 移动端卡片列表 */
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 10px 12px; position: relative; }
.m-card.clickable { cursor: pointer; }
.m-card-top { display: flex; align-items: flex-start; gap: 8px; }
.m-card-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.m-card-fields { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; font-size: 12px; color: var(--text-2); }
.m-card-fields span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-card-fields .ic { width: 12px; height: 12px; color: var(--muted-2); }
.m-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--muted-2); }
.m-card-foot .spacer { flex: 1; }
.m-card .checkbox-cell { margin-top: 2px; }
.m-card.selected { border-color: var(--brand); background: #f5f8ff; }

.m-pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 0 2px; font-size: 12px; color: var(--muted); }
.m-pager .btn { min-width: 74px; }

/* ---------------------------------------------------------------- 其它通用 */
.section-gap { margin-top: 12px; }
.divider { height: 1px; background: var(--line); margin: 10px 0; }
.inline-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chip-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.code-block { background: #0f172a; color: #dbe4f2; border-radius: 7px; padding: 10px 12px; font-size: 12px; line-height: 1.6; overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 280px; }
.code-inline { background: var(--panel-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 11.5px; word-break: break-all; }
.key-reveal { display: flex; gap: 8px; align-items: center; }
.key-reveal .input { font-family: var(--font-mono); font-size: 12px; background: var(--panel-2); }
.steps { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.step-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); background: #fff; font-size: 12.5px; }
.step-row:last-child { border-bottom: 0; }
.step-row .step-idx { width: 20px; height: 20px; border-radius: 50%; background: var(--panel-3); color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.step-row.ok .step-idx { background: var(--green-soft); color: var(--green); }
.step-row.fail .step-idx { background: var(--red-soft); color: var(--red); }
.step-main { flex: 1; min-width: 0; }
.step-name { font-weight: 600; word-break: break-word; }
.step-detail { color: var(--muted); font-size: 11.5px; margin-top: 1px; word-break: break-word; }
.step-ms { color: var(--muted-2); font-size: 11.5px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.output-pre { margin: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; font-size: 11.5px; line-height: 1.55; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* 时间范围字段 */
input[type="datetime-local"], input[type="date"] { min-height: 30px; }

/* ---------------------------------------------------------------- v2：RBAC / 批量审批 / 分数明细 */
.role-chip {
  display: inline-flex; align-items: center; height: 17px; padding: 0 5px; border-radius: 3px;
  font-size: 10px; font-weight: 600; background: var(--gray-soft); color: var(--gray); white-space: nowrap;
}
.role-chip.role-owner { background: var(--purple-soft); color: var(--purple); }
.role-chip.role-admin { background: var(--brand-soft); color: var(--brand); }
.role-chip.role-operator { background: var(--teal-soft); color: var(--teal); }
.role-chip.role-viewer { background: var(--gray-soft); color: var(--gray); }
.role-chip.role-api { background: var(--orange-soft); color: var(--orange); }

.readonly-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 18px;
  background: var(--brand-soft); border-bottom: 1px solid var(--brand-line);
  color: #1e3a8a; font-size: 12px;
}
.readonly-bar .ic { width: 14px; height: 14px; }

.approval-selectbar {
  display: flex; align-items: center; gap: 10px; padding: 6px 2px 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.approval-selectbar .spacer { flex: 1; }
.approval-check { display: flex; align-items: flex-start; padding-top: 3px; }
.approval-card.selected { border-color: var(--brand); background: #f7f9ff; box-shadow: 0 0 0 1px var(--brand-soft); }
.approval-delivery { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.approval-bulk { position: sticky; top: calc(var(--topbar-h) + 50px); z-index: 18; }

.countdown {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--gray-soft); color: var(--gray); font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.countdown .ic { width: 12px; height: 12px; }
.countdown.warn { background: var(--orange-soft); color: var(--orange); }
.countdown.expired { background: var(--red-soft); color: var(--red); }

.score-total { display: flex; align-items: center; gap: 9px; padding: 2px 0 9px; border-bottom: 1px solid var(--line-2); margin-bottom: 8px; }
.score-big { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.score-big.hi { color: var(--green); }
.score-big.mid { color: var(--brand); }
.score-big.low { color: var(--muted); }
.score-list { display: flex; flex-direction: column; gap: 1px; }
.score-row { display: grid; grid-template-columns: minmax(86px, 1.1fr) 46px minmax(0, 2fr); gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line-2); font-size: 12px; }
.score-row:last-child { border-bottom: 0; }
.score-rule { color: var(--text-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.score-delta { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.score-delta.plus { color: var(--green); }
.score-delta.minus { color: var(--red); }
.score-reason { color: var(--muted); font-size: 11.5px; word-break: break-word; }

.transition-row { display: flex; flex-wrap: wrap; gap: 6px; }
.consent-quote {
  margin-top: 4px; padding: 6px 9px; border-left: 2px solid var(--green-line); background: var(--green-soft);
  border-radius: 0 5px 5px 0; color: #14532d; font-size: 12px; line-height: 1.55;
}
.weights-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.perm-group { margin-bottom: 10px; }
.perm-group-title { font-size: 11.5px; color: var(--muted-2); margin-bottom: 4px; }
.perm-group .tag { font-size: 10.5px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .channel-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  table.data .hide-lg { display: none; }
}

@media (max-width: 980px) {
  .topbar-search { width: 220px; }
  .filterbar .grow { flex-basis: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  table.data .hide-md { display: none; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 48px; }
  body { font-size: 13.5px; }
  .sidebar { display: none; }
  .main { margin-left: 0 !important; padding-bottom: 62px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-search { flex: 1; width: auto; max-width: none; }
  .topbar-search kbd { display: none; }
  .topbar-search input { height: 32px; }
  .topbar .tenant-name { max-width: 88px; }
  .content { padding: 10px 12px 18px; }
  .page-head { align-items: flex-start; margin-bottom: 10px; }
  .page-title { font-size: 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .crumbs { margin-bottom: 4px; }

  .only-desktop { display: none !important; }
  .only-mobile { display: block !important; }

  .filterbar { position: static; flex-wrap: nowrap; overflow-x: auto; padding: 7px 8px; gap: 6px; }
  .filterbar .f-field { flex: 0 0 auto; }
  .filterbar .grow { flex: 1 0 180px; }
  .filterbar .input, .filterbar .select { height: 30px; }
  .bulk-bar { position: static; }
  .kpi-grid { gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 22px; }
  .dash-grid, .dash-grid-2 { gap: 10px; }
  .chart { height: 140px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .channel-fields { grid-template-columns: 1fr; }
  .channel-fields .span-2 { grid-column: auto; }
  .drawer { width: 100%; }
  .drawer-head { padding: 12px 12px 10px 14px; }
  .drawer-body { padding: 12px 14px 24px; }
  .drawer-actions .btn { flex: 1 1 auto; }
  .kv { grid-template-columns: 84px minmax(0, 1fr); font-size: 12.5px; }
  .approval-actions .btn { flex: 1; height: 42px; font-size: 14px; }
  .approval-actions .btn-primary { order: 1; }
  .approval-actions .btn-danger { order: 2; }
  .approval-note .input { height: 34px; }
  .mobile-nav { display: flex; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; margin-bottom: 0; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
  .modal-body { max-height: none; flex: 1; overflow-y: auto; padding-bottom: 18px; }
  .modal-foot { border-radius: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; height: 38px; }
  .toasts { top: 54px; right: 10px; left: 10px; }
  .toast { max-width: none; }
  .table-wrap { display: none; }
  .table-foot { display: none; }
  .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-toolbar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
  .m-list { margin-top: 0; }
  .m-card:active { background: var(--panel-2); }
  .auth-note { display: none; }
  .usr-name { display: none; }
  .topbar .topbar-divider { display: none; }

  /* 设置页的明细表在移动端保留（可横向滚动），其余列表页用卡片列表 */
  #settings-body .table-wrap { display: block; overflow-x: auto; }
  #settings-body table.data { min-width: 560px; }
  #settings-body .table-wrap { max-height: none !important; }

  /* 登录页 */
  .login-shell { flex-direction: column; }
  .login-brand { flex: 0 0 auto; padding: 22px 20px; }
  .login-pitch { display: none; }
  .login-brand-foot { display: none; }
  .login-card-wrap { flex: 1; padding: 24px 20px 40px; align-items: flex-start; }
  .login-card { max-width: 400px; }
  .charts-axis { display: none; }
  .card-body { padding: 11px 12px; }
  .subtabs { margin-bottom: 10px; }
  .approval-card { padding: 11px 12px; }
  .approval-bulk { position: static; flex-wrap: wrap; }
  .approval-bulk .input { max-width: none !important; width: 100%; order: 3; }
  .approval-bulk .spacer { display: none; }
  .approval-bulk .btn { flex: 1; height: 38px; font-size: 13px; }
  .readonly-bar { padding: 6px 12px; font-size: 11.5px; }
  .role-chip { display: none; }
  .weights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-row { grid-template-columns: minmax(72px, 1fr) 42px minmax(0, 1.8fr); }
  .approval-selectbar { padding-top: 2px; }
}

@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .mobile-nav a { font-size: 10px; }
}

/* 打印（导出/截图用） */
@media print {
  .sidebar, .topbar, .mobile-nav, .filterbar, .page-actions, .toasts, .drawer-root, .modal-root { display: none !important; }
  .main { margin-left: 0 !important; }
  .table-wrap { max-height: none; overflow: visible; }
  body { background: #fff; }
}
