/* 双公司经营系统 TradeLedgerV2 · 旗舰桌面设计系统 v3.0
 * 风格：浅色优先、通透留白、金融级财务排版 + 左下角浅色/深色一键切换
 */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-sub: #f8fafc;
  --surface-hover: #f1f5f9;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e6ecf5;
  --sidebar-text: #475569;
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: #eef4ff;
  --sidebar-active-text: #1d4ed8;

  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #e4eaf3;
  --border-strong: #cbd5e1;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff5ff;
  --accent-border: #bfdbfe;

  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;

  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;

  --danger: #dc2626;
  --danger-solid: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.025);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-drawer: -12px 0 36px rgba(15, 23, 42, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --font: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SF Mono", monospace;
}

body.theme-dark {
  --bg: #0b1120;
  --surface: #111a2c;
  --surface-sub: #162238;
  --surface-hover: #1d2b45;
  --sidebar-bg: #0e1626;
  --sidebar-border: #1e2d45;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --sidebar-active-bg: rgba(37, 99, 235, 0.22);
  --sidebar-active-text: #93c5fd;

  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --muted-light: #64748b;
  --border: #1f2e47;
  --border-strong: #334666;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --accent-border: rgba(59, 130, 246, 0.35);

  --amber-soft: rgba(217, 119, 6, 0.16);
  --amber-border: rgba(245, 158, 11, 0.35);

  --ok: #34d399;
  --ok-soft: rgba(16, 185, 129, 0.14);
  --ok-border: rgba(52, 211, 153, 0.32);

  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.15);
  --warn-border: rgba(251, 191, 36, 0.32);

  --danger: #f87171;
  --danger-solid: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(248, 113, 113, 0.35);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.42);
  --shadow-drawer: -14px 0 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 13.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.55); }

.mono, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.code-font { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ===================== 主体两栏工作台 ===================== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* 左侧纯白清爽导航栏 */
.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  user-select: none;
}

.sidebar-brand {
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}
.brand-mark.amber {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.25);
}
.brand-title { font-weight: 700; font-size: 14.5px; color: var(--text); line-height: 1.25; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 148px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 14px;
}
.nav-section {
  font-size: 11px; font-weight: 600; color: var(--sidebar-muted);
  padding: 12px 10px 5px; letter-spacing: 0.02em;
}
.nav-section:first-child { padding-top: 2px; }

.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 8.5px 11px;
  margin-bottom: 2px;
  border: none; border-radius: 9px;
  background: transparent;
  color: var(--sidebar-text);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background 0.14s, color 0.14s;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.78; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item .nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-count {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-hover); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { background: var(--accent); color: #fff; }
.nav-count.danger { background: var(--danger); color: #fff !important; }
.nav-count.blue { background: var(--accent); color: #fff; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; gap: 10px;
}

/* 左下角浅色/深色切换胶囊 */
.theme-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  padding: 3px; border-radius: 999px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
}
.theme-opt {
  border: none; border-radius: 999px; padding: 5px 8px;
  background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: all 0.15s;
}
.theme-opt svg { width: 13px; height: 13px; }
.theme-opt.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs);
}

.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user-chip { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.sidebar-hint { font-size: 11px; color: var(--muted-light); line-height: 1.4; }

/* ===================== 右侧主工作区 ===================== */
.workspace {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

.topbar {
  height: 58px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left { display: flex; flex-direction: column; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; line-height: 1.2; }
.topbar-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ok-soft); border: 1px solid var(--ok-border);
  color: var(--ok); font-size: 12px; font-weight: 600;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 36px;
}
.content-inner { max-width: 1320px; margin: 0 auto; }

/* ===================== 顶部醒目双公司 / 三卡切换栏 ===================== */
.company-banner-wrap { margin-bottom: 16px; }
.company-cards-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.company-cards-3 {
  display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 12px;
}
.company-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; text-align: left; font-family: var(--font);
  transition: all 0.16s ease;
  box-shadow: var(--shadow-xs);
}
.company-card:hover { border-color: var(--accent-border); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.company-card.active {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10), var(--shadow-sm);
}
.company-card.active-solid {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}
.company-card.active-solid .cc-title,
.company-card.active-solid .cc-sub,
.company-card.active-solid .cc-action { color: #ffffff; }
.company-card.active-solid .cc-sub { opacity: 0.86; }
.company-card.active-solid .cc-icon { background: rgba(255, 255, 255, 0.18); color: #fff; }

.cc-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cc-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cc-icon.amber { background: var(--amber-soft); color: var(--amber); }
.cc-icon svg { width: 18px; height: 18px; }
.cc-title { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.cc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc-sub .reject-dot { color: var(--danger); font-weight: 700; }
.cc-action {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; background: var(--surface-sub);
  white-space: nowrap; flex-shrink: 0;
}
.company-card.active .cc-action { background: var(--accent-soft); color: var(--accent); }
.company-card.active-solid .cc-action { background: rgba(255, 255, 255, 0.2); color: #fff; }

.company-banner-note {
  font-size: 11.5px; color: var(--muted); margin-top: 7px; padding-left: 2px;
}

/* 跨公司待办提醒条（柔和醒目，一键切换） */
.cross-company-strip {
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 12.5px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; transition: filter 0.14s;
}
.cross-company-strip:hover { filter: brightness(0.97); }
.cross-company-strip strong { font-weight: 700; }

/* ===================== 卡片与容器 ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-tight { padding: 14px 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; margin: 0;
}
.card-title svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.card-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===================== 快速动作坞（替代丑陋大表单） ===================== */
.quick-dock {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 16px;
}
.quick-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-align: left; font-family: var(--font);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
}
.quick-tile:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.qt-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.qt-icon svg { width: 19px; height: 19px; }
.qt-icon.blue { background: var(--accent-soft); color: var(--accent); }
.qt-icon.green { background: var(--ok-soft); color: var(--ok); }
.qt-icon.amber { background: var(--amber-soft); color: var(--amber); }
.qt-icon.rose { background: var(--danger-soft); color: var(--danger); }
.qt-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.qt-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ===================== 统计 KPI 行 ===================== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-val { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-val.blue { color: var(--accent); }
.kpi-val.ok { color: var(--ok); }
.kpi-val.warn { color: var(--warn); }
.kpi-val.danger { color: var(--danger); }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ===================== 今日待办横向动作条 & 退回横幅 ===================== */
.reject-banner {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.reject-banner-text {
  color: var(--danger); font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.reject-banner-text svg { width: 17px; height: 17px; }

.action-card-list { display: flex; flex-direction: column; gap: 9px; }

.todo-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  transition: border-color 0.14s, background 0.14s;
}
.todo-row:hover { border-color: var(--accent-border); background: var(--surface-sub); }
.todo-row.is-reject {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}
.todo-row.is-reject:hover { filter: brightness(0.99); }
.todo-row-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.todo-row-body { min-width: 0; flex: 1; }
.todo-row-title { font-size: 13.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.todo-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.todo-row-reason { font-size: 12.5px; color: var(--danger); margin-top: 4px; font-weight: 500; }
.todo-row-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.todo-row-amt { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* ===================== 老板 2×3 核算卡片（合同结算/合同审批） ===================== */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.review-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.review-card-title {
  font-size: 15.5px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.review-card-meta { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.metric-grid-6 {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 14px;
}
.metric-cell {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
}
.metric-cell-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.metric-cell-val {
  font-size: 18px; font-weight: 800; color: var(--text);
  margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.metric-cell-val.blue { color: var(--accent); }
.metric-cell-val.ok { color: var(--ok); }
.metric-cell-val.warn { color: var(--warn); }
.metric-cell-val.danger { color: var(--danger); }

.review-conclusion {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.review-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap;
}

/* 左图右账双栏核对卡片（银行回单 / 付款凭证） */
.review-split {
  display: grid; grid-template-columns: 320px 1fr; gap: 18px;
}
.proof-box {
  background: var(--surface-sub);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  min-height: 210px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; position: relative; padding: 10px;
}
.proof-box img { max-width: 100%; max-height: 240px; border-radius: 8px; object-fit: contain; }
.proof-box-caption { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ===================== 按钮层级系统 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7.5px 14px; border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-secondary);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.14s ease;
  text-decoration: none; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--muted-light); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #ffffff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }

.btn-ok { background: var(--ok); border-color: var(--ok); color: #ffffff; }
.btn-ok:hover { filter: brightness(0.93); color: #ffffff; }

.btn-danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #ffffff; }
.btn-danger-solid:hover { filter: brightness(0.92); color: #ffffff; }

.btn-danger {
  background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #ffffff; }

.btn-soft-blue {
  background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent);
}
.btn-soft-blue:hover { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.btn-ghost {
  background: transparent; border-color: transparent; color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }

.btn-link {
  background: transparent; border: none; padding: 4px 6px;
  color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font);
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-sm svg { width: 13.5px; height: 13.5px; }
.btn-lg { padding: 10px 20px; font-size: 14px; border-radius: 10px; }

/* ===================== 标签 Badges & 筛选胶囊 ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-sub); color: var(--text-secondary);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge-blue { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.pill-tabs {
  display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px;
  background: var(--surface-sub); border: 1px solid var(--border);
}
.pill-tab {
  border: none; border-radius: 7px; padding: 5.5px 12px;
  background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.14s;
}
.pill-tab:hover { color: var(--text); }
.pill-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }

.search-box {
  position: relative; flex: 1; min-width: 240px; max-width: 440px;
}
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted-light); pointer-events: none;
}
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: 13px;
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

/* ===================== 数据表格 ===================== */
.table-wrap {
  width: 100%; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--surface-sub);
  color: var(--muted); font-size: 12px; font-weight: 600;
  text-align: left; padding: 10px 13px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: 11.5px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sub); }
td.right, th.right { text-align: right; }

/* ===================== 表单控件 ===================== */
label.field-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
input, select, textarea {
  width: 100%; padding: 8.5px 11px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: 13px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); cursor: pointer; }
textarea { resize: vertical; min-height: 76px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-section {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.form-section-title {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;
}

.dropzone {
  border: 1.5px dashed var(--accent-border);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone-title { font-weight: 700; color: var(--accent); font-size: 13.5px; }
.dropzone-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ===================== 提醒条 Alerts ===================== */
.alert {
  padding: 11px 14px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.55; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 9px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-info { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); }
.alert-ok { background: var(--ok-soft); border: 1px solid var(--ok-border); color: var(--ok); }
.alert-warn { background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn); }
.alert-danger { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); }

.empty-state {
  text-align: center; padding: 36px 20px; color: var(--muted);
}
.empty-state svg { width: 32px; height: 32px; opacity: 0.35; margin-bottom: 8px; }
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.empty-state-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ===================== 右侧滑出抽屉 & 模态预览 ===================== */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end;
  animation: fadeIn 0.15s ease;
}
.drawer-panel {
  width: 580px; max-width: 94vw; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  display: flex; flex-direction: column;
  animation: slideInRight 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-panel.drawer-lg { width: 760px; }
.drawer-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}
.drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot {
  padding: 13px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-sub);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

.overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px 22px;
  width: 520px; max-width: 94vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-lg { width: 880px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(28px); opacity: 0.7; } to { transform: translateX(0); opacity: 1; } }

/* ===================== 独立全屏登录页 ===================== */
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(circle at 18% 18%, #e0ecff 0%, #f4f6fa 48%, #edf2fa 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
body.theme-dark .login-screen {
  background: radial-gradient(circle at 20% 20%, #172554 0%, #0b1120 65%);
}
.login-card {
  width: 820px; max-width: 96vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  display: grid; grid-template-columns: 1.05fr 1fr;
}
.login-hero {
  background: linear-gradient(155deg, #1d4ed8 0%, #1e40af 55%, #172554 100%);
  color: #ffffff;
  padding: 36px 34px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero.staff-hero {
  background: linear-gradient(155deg, #2563eb 0%, #1d4ed8 58%, #1e3a8a 100%);
}
.login-hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.15); color: #fff;
  font-size: 12px; font-weight: 600; width: fit-content;
}
.login-hero h1 { font-size: 24px; font-weight: 800; margin: 18px 0 8px; line-height: 1.3; letter-spacing: -0.01em; }
.login-hero p { font-size: 13px; color: rgba(255, 255, 255, 0.84); margin: 0; line-height: 1.65; }
.login-points { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-point {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: rgba(255, 255, 255, 0.92);
}
.login-point-dot { width: 6px; height: 6px; border-radius: 50%; background: #93c5fd; flex-shrink: 0; }
.login-form-pane { padding: 36px 34px; display: flex; flex-direction: column; justify-content: center; }
.login-form-title { font-size: 20px; font-weight: 800; color: var(--text); margin: 0 0 4px; }
.login-form-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 22px; }
.login-demo-hint {
  margin-top: 14px; padding: 9px 12px; border-radius: 9px;
  background: var(--surface-sub); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
}

/* ===================== Toast 提示 ===================== */
.toast-box {
  position: fixed; top: 18px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 16px; border-radius: 10px;
  background: #0f172a; color: #f8fafc;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
  animation: fadeIn 0.16s ease;
}
.toast.ok { background: #047857; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }

@media (max-width: 1120px) {
  .quick-dock, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-split { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .company-cards-2, .company-cards-3, .metric-grid-6, .login-card { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
