/* ==========================================================================
   西开时代 CRM · 蓝钴卷宗设计系统
   ========================================================================== */

:root {
  --bg: hsl(210 25% 97%);
  --bg-deep: hsl(210 24% 94%);
  --fg: hsl(215 28% 17%);
  --fg-soft: hsl(215 20% 32%);
  --card: #ffffff;
  --muted: hsl(215 14% 46%);
  --muted-2: hsl(215 12% 58%);
  --border: hsl(214 18% 89%);
  --border-strong: hsl(214 16% 82%);

  --primary: hsl(200 90% 35%);
  --primary-600: hsl(200 90% 29%);
  --primary-700: hsl(200 92% 24%);
  --primary-50: hsl(200 80% 96%);
  --primary-100: hsl(200 70% 90%);
  --primary-ring: hsl(200 90% 35% / 0.22);

  --success: hsl(160 70% 36%);
  --success-50: hsl(160 60% 95%);
  --warning: hsl(33 92% 47%);
  --warning-50: hsl(36 100% 95%);
  --danger: hsl(0 66% 52%);
  --danger-50: hsl(0 80% 96%);
  --violet: hsl(250 58% 58%);
  --violet-50: hsl(250 70% 96%);

  --st-potential: hsl(210 50% 48%);
  --st-potential-bg: hsl(210 60% 95%);
  --st-intention: hsl(250 58% 58%);
  --st-intention-bg: hsl(250 70% 96%);
  --st-negotiating: hsl(33 92% 47%);
  --st-negotiating-bg: hsl(36 100% 95%);
  --st-cooperated: hsl(160 70% 36%);
  --st-cooperated-bg: hsl(160 60% 95%);
  --st-lost: hsl(0 66% 52%);
  --st-lost-bg: hsl(0 80% 96%);

  --sidebar: hsl(215 35% 12%);
  --sidebar-2: hsl(215 33% 15%);
  --sidebar-fg: hsl(210 20% 84%);
  --sidebar-muted: hsl(212 16% 58%);
  --sidebar-line: hsl(215 25% 22%);

  --radius: 7px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --shadow-xs: 0 1px 2px hsl(215 30% 20% / 0.05);
  --shadow-sm: 0 2px 8px hsl(215 30% 20% / 0.05), 0 1px 2px hsl(215 30% 20% / 0.04);
  --shadow-md: 0 8px 24px hsl(215 30% 20% / 0.09), 0 2px 6px hsl(215 30% 20% / 0.05);
  --shadow-lg: 0 24px 60px hsl(215 40% 15% / 0.18), 0 6px 16px hsl(215 40% 15% / 0.08);

  --font: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', ui-monospace, monospace;
  --sidebar-w: 238px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

::selection { background: var(--primary-100); color: var(--primary-700); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: hsl(214 14% 80%); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: hsl(214 12% 70%); }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.tnum { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mono { font-family: var(--font-num); }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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;
}

/* icon defaults */
svg { flex: none; }
svg[viewBox="0 0 24 24"] {
  width: 1em; height: 1em;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.14em;
}
.nav-icon svg { width: 16px; height: 16px; }
.icon-btn svg, .btn svg, .nav-icon, .search-icon, .chev, .badge svg, .link-btn svg {
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.stat-box strong { white-space: nowrap; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-root { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 55% at 0% 0%, hsl(200 70% 22% / 0.55) 0%, transparent 60%),
    linear-gradient(180deg, var(--sidebar) 0%, hsl(215 38% 10%) 100%);
  color: var(--sidebar-fg);
  border-right: 1px solid var(--sidebar-line);
  transition: transform 0.25s ease;
}
.brand {
  height: var(--topbar-h);
  flex: none;
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, hsl(197 88% 44%), hsl(203 92% 28%));
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 12px hsl(200 90% 30% / 0.45), inset 0 1px 0 hsl(0 0% 100% / 0.25);
  letter-spacing: 0;
}
img.brand-mark {
  display: block;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.brand-wordmark {
  display: block;
  width: 64px;
  height: auto;
  flex: none;
}
.brand-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.2; }
.brand-copy strong { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; letter-spacing: 0.2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: 0.5px; }
.brand-text span { color: var(--sidebar-muted); font-size: 10.5px; letter-spacing: 0.6px; }
.sidebar-close { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 18px; scrollbar-width: thin; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: hsl(215 20% 28%); border: none; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label {
  padding: 0 10px 6px;
  font-size: 10.5px; letter-spacing: 1.2px; font-weight: 600;
  color: hsl(212 15% 47%);
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 6px;
  color: hsl(210 18% 76%);
  font-size: 13px;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: hsl(212 30% 20% / 0.75); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, hsl(199 80% 30% / 0.42), hsl(200 70% 26% / 0.18));
  color: #fff;
  box-shadow: inset 0 0 0 1px hsl(198 80% 45% / 0.18);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #4fc3f7, #0891b2);
}
.nav-icon { width: 16px; height: 16px; opacity: 0.9; }
.nav-item.active .nav-icon { color: #7fdcff; opacity: 1; }
.nav-item .nav-text { flex: 1; min-width: 0; }
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: hsl(0 70% 52% / 0.85); color: #fff;
  font-family: var(--font-num); font-size: 10.5px; font-weight: 600;
}
.nav-badge.soft { background: hsl(210 30% 26%); color: hsl(205 35% 85%); }
.nav-badge.warn { background: hsl(33 92% 47% / 0.9); }

.sidebar-foot { flex: none; padding: 10px 12px 14px; border-top: 1px solid var(--sidebar-line); }
.sidebar-help {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; margin-bottom: 8px;
  color: var(--sidebar-muted); font-size: 12px; border-radius: 6px;
}
.sidebar-help:hover { color: #fff; background: hsl(212 30% 20% / 0.6); }
.help-dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(160 70% 45%); box-shadow: 0 0 0 3px hsl(160 70% 45% / 0.16); }
.storage-mini { padding: 6px 8px 2px; }
.storage-mini .sm-row { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--sidebar-muted); margin-bottom: 5px; }
.storage-mini .sm-bar { height: 3px; border-radius: 3px; background: hsl(212 20% 24%); overflow: hidden; }
.storage-mini .sm-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #38bdf8, #14b8a6); transition: width 0.4s ease; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: hsl(0 0% 100% / 0.86);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }

.global-search {
  position: relative;
  display: flex; align-items: center;
  width: min(420px, 42vw);
  height: 34px;
  padding: 0 8px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.global-search:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.global-search .search-icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); }
.global-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 13px; color: var(--fg);
}
.global-search input::placeholder { color: var(--muted-2); }
.global-search kbd {
  flex: none; font-family: var(--font); font-size: 10px; color: var(--muted-2);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: #fff;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative;
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--fg-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--bg-deep); color: var(--fg); }
.icon-btn svg { width: 17px; height: 17px; }
.notify-badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 15px; height: 15px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 8px; border: 2px solid #fff;
  background: var(--danger); color: #fff;
  font-family: var(--font-num); font-size: 9.5px; font-weight: 700; line-height: 1;
}

.user-wrap, .notify-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 8px 0 4px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.user-chip:hover { background: var(--bg); border-color: var(--border); }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-meta strong { font-size: 12.5px; font-weight: 600; }
.user-meta small { font-size: 10.5px; color: var(--muted); }
.chev { width: 13px; height: 13px; color: var(--muted); }

.avatar {
  width: 30px; height: 30px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, hsl(199 85% 42%), hsl(203 85% 30%));
  color: #fff; font-size: 12px; font-weight: 600;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.22);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.teal { background: linear-gradient(145deg, #14b8a6, #0d7f74); }
.avatar.violet { background: linear-gradient(145deg, #8b7ce8, #5a48c0); }
.avatar.amber { background: linear-gradient(145deg, #f0a63a, #c47a0d); }
.avatar.rose { background: linear-gradient(145deg, #ef7a7a, #c23b3b); }
.avatar.slate { background: linear-gradient(145deg, #6b829c, #41556d); }

.popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  min-width: 230px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.985); } to { opacity: 1; transform: none; } }
.notify-pop { width: 340px; }
.user-pop { width: 244px; }
.pop-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px; }
.pop-head div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pop-head strong { font-size: 13.5px; }
.pop-head small { font-size: 11px; color: var(--muted); }
.pop-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; font-size: 12.5px; color: var(--fg-soft);
  cursor: pointer;
}
.pop-item:hover { background: var(--bg); color: var(--fg); }
.pop-item.danger { color: var(--danger); }
.pop-item.danger:hover { background: var(--danger-50); }
.pop-sep { height: 1px; margin: 5px 6px; background: var(--border); }
.notify-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; }
.notify-head strong { font-size: 13px; }
.notify-head span { font-size: 11px; color: var(--muted); }
.notify-list { max-height: 320px; overflow: auto; }
.notify-item {
  display: flex; gap: 10px; padding: 9px 12px;
  border-radius: 7px; cursor: pointer;
}
.notify-item:hover { background: var(--bg); }
.notify-item .dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; flex: none; background: var(--warning); }
.notify-item.over .dot { background: var(--danger); }
.notify-item div { min-width: 0; }
.notify-item strong { display: block; font-size: 12.5px; font-weight: 600; }
.notify-item small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Page scaffolding
   ========================================================================== */
.page { flex: 1; padding: 20px 22px 40px; outline: none; }
.page-enter { animation: rise 0.28s cubic-bezier(0.22, 0.8, 0.3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head .ph-main { min-width: 0; }
.page-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.page-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; font-size: 12px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-strong); }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 13.5px; font-weight: 650; letter-spacing: 0; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 12px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }

/* KPI */
.kpi-card {
  position: relative;
  padding: 15px 16px 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.kpi-card::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, hsl(199 85% 45%), hsl(203 85% 28%));
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi-card.tone-green::before { background: linear-gradient(180deg, #34d399, #0f8a63); }
.kpi-card.tone-amber::before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.kpi-card.tone-violet::before { background: linear-gradient(180deg, #a78bfa, #6d4fd8); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-icon {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; background: var(--primary-50); color: var(--primary);
}
.kpi-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.75; }
.kpi-value { margin-top: 6px; font-family: var(--font-num); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-value small { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-foot { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-num); font-size: 11px; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--muted); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--fg-soft);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--bg); border-color: var(--border-strong); color: var(--fg); }
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 14px; height: 14px; }
.btn.primary {
  background: linear-gradient(180deg, hsl(200 88% 38%), hsl(200 90% 32%));
  border-color: hsl(200 90% 29%);
  color: #fff;
  box-shadow: 0 1px 2px hsl(200 90% 25% / 0.3), inset 0 1px 0 hsl(0 0% 100% / 0.14);
}
.btn.primary:hover { background: linear-gradient(180deg, hsl(200 90% 42%), hsl(200 92% 34%)); border-color: hsl(200 92% 27%); color: #fff; }
.btn.soft { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.btn.soft:hover { background: hsl(200 70% 93%); border-color: hsl(200 60% 82%); color: var(--primary-700); }
.btn.danger { background: #fff; border-color: hsl(0 60% 86%); color: var(--danger); }
.btn.danger:hover { background: var(--danger-50); border-color: hsl(0 60% 78%); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { background: hsl(160 70% 32%); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-deep); color: var(--fg); }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.sm svg { width: 12.5px; height: 12.5px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 13.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 7px 7px 0; }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; background: none;
  color: var(--primary); font-size: 12.5px; cursor: pointer;
}
.link-btn:hover { color: var(--primary-700); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.muted { color: var(--muted); }
.link-btn.danger { color: var(--danger); }
.link-btn svg { width: 13px; height: 13px; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label {
  font-size: 12px; font-weight: 550; color: var(--fg-soft);
  display: flex; align-items: center; gap: 4px;
}
.req { color: var(--danger); font-weight: 700; }
.field-hint { font-size: 11px; color: var(--muted-2); }
.field-error { font-size: 11.5px; color: var(--danger); display: flex; align-items: center; gap: 4px; }

.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--fg);
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.65; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px hsl(0 66% 52% / 0.12); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.select {
  appearance: none;
  padding-right: 28px;
  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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.select.sm, .input.sm { height: 29px; font-size: 12px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.75; }
.input-icon .input { padding-left: 30px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section-title {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  margin-top: 2px; padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
  font-size: 12px; font-weight: 650; color: var(--fg-soft);
}
.form-section-title::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: var(--primary); }

.check, .radio {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--fg-soft); cursor: pointer; user-select: none;
}
.check input, .radio input { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 34px; height: 19px; border-radius: 10px; background: hsl(214 15% 82%);
  transition: background 0.18s ease; position: relative; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px hsl(215 30% 20% / 0.2);
  transition: transform 0.18s ease;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-ring); }

/* chips / tags picker */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--fg-soft); font-size: 11.5px;
  cursor: pointer; transition: all 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); background: var(--bg); }
.chip.on { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); font-weight: 500; }
.chip .x { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: -2px; border-radius: 50%; color: var(--muted); }
.chip .x:hover { background: hsl(214 20% 90%); color: var(--danger); }
.tag {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px;
  border-radius: 4px;
  background: var(--bg-deep); color: var(--fg-soft);
  font-size: 11px; white-space: nowrap;
}
.tag.blue { background: var(--primary-50); color: var(--primary-700); }
.tag.green { background: var(--success-50); color: var(--success); }
.tag.amber { background: var(--warning-50); color: hsl(30 90% 36%); }
.tag.violet { background: var(--violet-50); color: var(--violet); }
.tag.red { background: var(--danger-50); color: var(--danger); }

/* ==========================================================================
   Badges & status
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 7px;
  border-radius: 5px;
  font-size: 11.5px; font-weight: 500; line-height: 1;
  white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.no-dot::before { display: none; }
.badge.st-potential { background: var(--st-potential-bg); color: var(--st-potential); }
.badge.st-intention { background: var(--st-intention-bg); color: var(--st-intention); }
.badge.st-negotiating { background: var(--st-negotiating-bg); color: var(--st-negotiating); }
.badge.st-cooperated { background: var(--st-cooperated-bg); color: var(--st-cooperated); }
.badge.st-lost { background: var(--st-lost-bg); color: var(--st-lost); }
.badge.gray { background: var(--bg-deep); color: var(--muted); }
.badge.blue { background: var(--primary-50); color: var(--primary-700); }
.badge.green { background: var(--success-50); color: var(--success); }
.badge.amber { background: var(--warning-50); color: hsl(30 90% 36%); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.violet { background: var(--violet-50); color: var(--violet); }
.badge.solid { background: var(--primary); color: #fff; }
.badge.solid::before { background: #fff; }
.grade {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  font-family: var(--font-num); font-size: 11.5px; font-weight: 700;
}
.grade.A { background: hsl(160 60% 93%); color: hsl(160 70% 30%); }
.grade.B { background: var(--primary-50); color: var(--primary-700); }
.grade.C { background: var(--warning-50); color: hsl(30 90% 36%); }
.grade.D { background: var(--bg-deep); color: var(--muted); }
.imp { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.imp .bar { width: 3px; border-radius: 2px; background: currentColor; opacity: 0.85; }
.imp.high { color: var(--danger); }
.imp.high .bar { height: 12px; }
.imp.medium { color: var(--warning); }
.imp.medium .bar { height: 9px; }
.imp.low { color: var(--muted-2); }
.imp.low .bar { height: 6px; }

/* ==========================================================================
   Toolbar / filters
   ========================================================================== */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, hsl(210 30% 99.5%));
}
.toolbar .grow { flex: 1; }
.filter-search { position: relative; width: 250px; max-width: 100%; }
.filter-search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.75; }
.filter-search .input { padding-left: 30px; height: 32px; }
.filter-select { width: auto; min-width: 112px; height: 32px; font-size: 12.5px; }
.active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); background: hsl(200 60% 98.5%); }
.filter-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 7px;
  border-radius: 5px; border: 1px solid var(--primary-100);
  background: #fff; color: var(--primary-700); font-size: 11.5px;
}
.filter-pill button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; line-height: 1; }
.filter-pill button:hover { color: var(--danger); }

.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--bg-deep); border-radius: 7px;
}
.segmented button {
  height: 26px; padding: 0 11px;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.segmented button:hover { color: var(--fg); }
.segmented button.on { background: #fff; color: var(--primary-700); font-weight: 600; box-shadow: var(--shadow-xs); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; }
.tab {
  position: relative;
  height: 40px; padding: 0 12px;
  border: 0; background: none; color: var(--muted);
  font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--fg); }
.tab.on { color: var(--primary-700); font-weight: 600; }
.tab.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary); }
.tab .count { font-family: var(--font-num); font-size: 10.5px; padding: 0 5px; height: 16px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--bg-deep); color: var(--muted); }
.tab.on .count { background: var(--primary-50); color: var(--primary-700); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 12px;
  background: hsl(210 30% 98%);
  border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  text-align: left; white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--fg); background: var(--bg-deep); }
table.data th .sort-ind { margin-left: 3px; font-size: 9px; color: var(--muted-2); }
table.data th.sorted .sort-ind { color: var(--primary); }
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid hsl(214 20% 93%);
  vertical-align: middle;
}
table.data tbody tr { transition: background 0.12s ease; }
table.data tbody tr:hover { background: hsl(205 40% 98.5%); }
table.data tbody tr.selected { background: hsl(200 60% 97.5%); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
table.data td.center, table.data th.center { text-align: center; }
table.data .cell-main { font-weight: 600; color: var(--fg); }
table.data .cell-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
table.data .cell-actions { white-space: nowrap; text-align: right; }
table.data tr.clickable { cursor: pointer; }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.check-cell { width: 36px; }
.check-cell input { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; }
.customer-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.customer-cell .avatar { border-radius: 8px; }
.customer-cell .cc-text { min-width: 0; }
.customer-cell .cc-text strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.customer-cell .cc-text small { font-size: 10.5px; color: var(--muted); }
.cell-tags { display: flex; gap: 3px; flex-wrap: wrap; max-width: 150px; }

.table-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.table-foot .grow { flex: 1; }

.pagination { display: inline-flex; align-items: center; gap: 3px; }
.page-btn {
  min-width: 27px; height: 27px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--fg-soft);
  font-family: var(--font-num); font-size: 12px; cursor: pointer;
}
.page-btn:hover { background: var(--bg-deep); }
.page-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--muted); font-size: 11.5px; }

/* ==========================================================================
   Empty / loading
   ========================================================================== */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 42px 20px; text-align: center; color: var(--muted);
}
.empty .empty-art {
  width: 56px; height: 56px; margin-bottom: 12px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--primary-50), hsl(160 50% 96%));
  color: var(--primary);
}
.empty .empty-art svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty strong { display: block; font-size: 13.5px; color: var(--fg-soft); font-weight: 600; }
.empty p { margin-top: 3px; font-size: 12px; max-width: 380px; }
.empty .btn { margin-top: 14px; }
.empty.sm { padding: 22px 12px; }
.empty.sm .empty-art { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 8px; }
.empty.sm .empty-art svg { width: 20px; height: 20px; }

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

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid hsl(200 60% 88%); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 10.5px; }
.chart .axis-line { stroke: var(--border); stroke-width: 1; }
.chart .grid-line { stroke: hsl(214 20% 93%); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .series-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { opacity: 0.14; }
.chart .bar-rect { transition: opacity 0.15s ease; cursor: pointer; }
.chart .bar-rect:hover { opacity: 0.78; }
.chart .donut-seg { transition: opacity 0.15s ease; cursor: pointer; }
.chart .donut-seg:hover { opacity: 0.82; }
.chart .point { cursor: pointer; }
.chart .chart-hit { fill: transparent; cursor: pointer; }
.chart-tip {
  position: fixed; z-index: 200; pointer-events: none;
  padding: 7px 9px;
  background: hsl(215 35% 14% / 0.94); color: #fff;
  border-radius: 6px; box-shadow: var(--shadow-md);
  font-size: 11.5px; line-height: 1.5; max-width: 240px;
  transform: translate(-50%, calc(-100% - 10px));
  backdrop-filter: blur(4px);
}
.chart-tip strong { display: block; font-weight: 600; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 5px; color: hsl(210 20% 85%); }
.chart-tip .sw { width: 7px; height: 7px; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.legend-item .sw { width: 8px; height: 8px; border-radius: 3px; }
.legend-item strong { font-family: var(--font-num); color: var(--fg-soft); font-weight: 600; }
.chart-empty { height: 220px; display: grid; place-items: center; color: var(--muted-2); font-size: 12px; }

/* ==========================================================================
   Modal / drawer
   ========================================================================== */
.modal-root { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: hsl(215 40% 12% / 0.45);
  backdrop-filter: blur(3px);
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: 560px; max-width: 100%;
  max-height: min(86vh, 900px);
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
  overflow: hidden;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal.wide { width: 760px; }
.modal.xwide { width: 940px; }
.modal.narrow { width: 420px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 650; line-height: 1.35; }
.modal-head p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.modal-head .close {
  margin-left: auto; width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.modal-head .close:hover { background: var(--bg-deep); color: var(--fg); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-body.tight { padding: 12px 16px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); background: hsl(210 30% 99%); }
.modal-foot .grow { flex: 1; }

.drawer-root { position: fixed; inset: 0; z-index: 120; }
.drawer-backdrop { position: absolute; inset: 0; background: hsl(215 40% 12% / 0.38); backdrop-filter: blur(2px); animation: fade 0.18s ease; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(520px, 94vw);
  display: flex; flex-direction: column;
  background: #fff;
  box-shadow: -20px 0 60px hsl(215 40% 15% / 0.18);
  animation: slide-in 0.24s cubic-bezier(0.22, 0.9, 0.3, 1);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer .modal-head { padding: 16px 18px 12px; }
.drawer .modal-body { flex: 1; padding: 16px 18px; }
.drawer .modal-foot { padding: 12px 18px; }

/* confirm */
.confirm-body { display: flex; gap: 12px; align-items: flex-start; }
.confirm-icon {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--warning-50); color: var(--warning);
}
.confirm-icon.danger { background: var(--danger-50); color: var(--danger); }
.confirm-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.confirm-body p { font-size: 13px; color: var(--fg-soft); white-space: pre-line; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-root {
  position: fixed; z-index: 300; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 240px; max-width: 380px;
  padding: 11px 14px;
  background: hsl(215 35% 14% / 0.96);
  color: #fff;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px; line-height: 1.55;
  animation: toast-in 0.22s ease;
  pointer-events: auto;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toast-out 0.2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
.toast .t-icon { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.toast.success .t-icon { color: #4ade80; }
.toast.error .t-icon { color: #fca5a5; }
.toast.info .t-icon { color: #7dd3fc; }
.toast.warn .t-icon { color: #fcd34d; }
.toast .t-body { min-width: 0; }
.toast strong { display: block; font-weight: 600; }
.toast span { color: hsl(210 20% 82%); }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.hero {
  position: relative;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(90% 140% at 100% 0%, hsl(197 80% 40% / 0.5) 0%, transparent 55%),
    linear-gradient(120deg, hsl(207 55% 22%), hsl(203 65% 16%));
  color: #eaf6ff;
  overflow: hidden;
  border: 1px solid hsl(203 60% 22%);
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: ''; position: absolute; right: -40px; bottom: -70px;
  width: 240px; height: 240px; border-radius: 50%;
  border: 1px solid hsl(195 80% 70% / 0.12);
  box-shadow: 0 0 0 30px hsl(195 80% 70% / 0.05), 0 0 0 60px hsl(195 80% 70% / 0.035);
  pointer-events: none;
}
.hero .hero-greet { font-size: 12px; color: hsl(200 40% 78%); letter-spacing: 0.3px; }
.hero h2 { margin: 3px 0 4px; font-size: 20px; font-weight: 650; color: #fff; letter-spacing: 0.2px; }
.hero p { font-size: 12.5px; color: hsl(200 35% 80%); }
.hero .hero-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: hsl(0 0% 100% / 0.1); border-color: hsl(0 0% 100% / 0.22); color: #fff; }
.hero .btn:hover { background: hsl(0 0% 100% / 0.18); border-color: hsl(0 0% 100% / 0.35); color: #fff; }
.hero .btn.primary { background: hsl(197 85% 46%); border-color: hsl(197 90% 52%); }
.hero .btn.primary:hover { background: hsl(197 88% 52%); }
.hero-stats { display: flex; gap: 26px; margin-top: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-stat { min-width: 74px; }
.hero-stat strong { display: block; font-family: var(--font-num); font-size: 20px; font-weight: 650; color: #fff; line-height: 1.2; }
.hero-stat span { font-size: 11.5px; color: hsl(200 30% 76%); }
.hero-stat em { font-style: normal; font-size: 11px; color: #7fe3c4; margin-left: 4px; }

.reminder-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid hsl(36 90% 84%);
  border-radius: var(--radius);
  background: linear-gradient(90deg, hsl(38 100% 96%), hsl(38 100% 98%));
  font-size: 12.5px; color: hsl(30 70% 32%);
}
.reminder-bar.over { border-color: hsl(0 70% 88%); background: linear-gradient(90deg, var(--danger-50), hsl(0 100% 98.5%)); color: hsl(0 60% 38%); }
.reminder-bar .rb-icon { width: 18px; height: 18px; display: grid; place-items: center; }
.reminder-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.reminder-bar strong { font-weight: 650; }
.reminder-bar .grow { flex: 1; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.feed-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.feed-item:first-child { padding-top: 2px; }
.feed-icon {
  width: 26px; height: 26px; flex: none; margin-top: 1px;
  display: grid; place-items: center; border-radius: 8px;
  background: var(--primary-50); color: var(--primary);
}
.feed-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.feed-main { min-width: 0; flex: 1; }
.feed-main .fm-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.feed-main strong { font-size: 12.5px; font-weight: 600; }
.feed-main .fm-time { font-size: 10.5px; color: var(--muted-2); }
.feed-main p { font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed-main .fm-meta { margin-top: 3px; font-size: 10.5px; color: var(--muted-2); }

.rank-list { display: flex; flex-direction: column; gap: 2px; }
.rank-item { display: flex; align-items: center; gap: 9px; padding: 7px 4px; border-radius: 6px; }
.rank-item:hover { background: var(--bg); }
.rank-no { width: 18px; font-family: var(--font-num); font-size: 11px; font-weight: 600; color: var(--muted-2); text-align: center; }
.rank-item:nth-child(1) .rank-no { color: #d97706; }
.rank-item:nth-child(2) .rank-no { color: #64748b; }
.rank-item:nth-child(3) .rank-no { color: #b45309; }
.rank-main { flex: 1; min-width: 0; }
.rank-main strong { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main small { font-size: 10.5px; color: var(--muted); }
.rank-val { font-family: var(--font-num); font-size: 12.5px; font-weight: 600; color: var(--primary-700); }
.progress-track { height: 4px; border-radius: 3px; background: var(--bg-deep); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, hsl(197 85% 46%), hsl(160 65% 42%)); }

/* ==========================================================================
   Detail page
   ========================================================================== */
.detail-hero {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  padding: 18px;
  background:
    radial-gradient(70% 120% at 100% 0%, hsl(198 75% 95%) 0%, transparent 60%),
    #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.detail-hero .dh-avatar {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(150deg, hsl(198 80% 44%), hsl(204 85% 28%));
  color: #fff; font-size: 18px; font-weight: 650;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.25);
}
.detail-hero .dh-main { flex: 1; min-width: 220px; }
.detail-hero h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.detail-hero .dh-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.detail-hero .dh-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.detail-hero .dh-meta span { display: inline-flex; align-items: center; gap: 4px; }
.detail-hero .dh-meta svg { width: 12.5px; height: 12.5px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.detail-hero .dh-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-left: auto; align-items: flex-start; }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.info-item { min-width: 0; }
.info-item dt { font-size: 11px; color: var(--muted); margin-bottom: 1px; }
.info-item dd { margin: 0; font-size: 12.5px; color: var(--fg); word-break: break-word; }
.info-item.full { grid-column: 1 / -1; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(180deg, var(--border), hsl(214 20% 94%)); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -19px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px hsl(200 90% 35% / 0.08);
}
.tl-item.overdue::before { border-color: var(--danger); box-shadow: 0 0 0 3px hsl(0 66% 52% / 0.1); }
.tl-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-head strong { font-size: 12.5px; font-weight: 600; }
.tl-time { font-family: var(--font-num); font-size: 10.5px; color: var(--muted-2); }
.tl-content { margin-top: 3px; font-size: 12.5px; color: var(--fg-soft); white-space: pre-wrap; line-height: 1.65; }
.tl-next {
  margin-top: 7px; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 5px;
  background: var(--primary-50); color: var(--primary-700);
  font-size: 11px;
}
.tl-next.overdue { background: var(--danger-50); color: var(--danger); }
.tl-next svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.contact-card {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px; border-radius: 7px;
}
.contact-card:hover { background: var(--bg); }
.contact-main { flex: 1; min-width: 0; }
.contact-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.contact-main small { font-size: 11px; color: var(--muted); }
.contact-right { text-align: right; font-size: 11px; color: var(--muted); white-space: nowrap; }

.attachment {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px; border-radius: 7px;
}
.attachment:hover { background: var(--bg); }
.file-ico {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center; border-radius: 7px;
  background: var(--primary-50); color: var(--primary);
  font-size: 9px; font-weight: 700; letter-spacing: 0.2px;
}
.file-ico.img { background: var(--violet-50); color: var(--violet); }
.file-ico.pdf { background: var(--danger-50); color: var(--danger); }
.file-ico.doc { background: var(--primary-50); color: var(--primary); }
.file-ico.xls { background: var(--success-50); color: var(--success); }
.file-ico.zip { background: var(--warning-50); color: hsl(30 90% 36%); }
.attachment .att-main { flex: 1; min-width: 0; }
.attachment .att-main strong { display: block; font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .att-main small { font-size: 10.5px; color: var(--muted); }

.opp-card {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.opp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.opp-card .oc-top { display: flex; align-items: flex-start; gap: 8px; }
.opp-card .oc-top strong { flex: 1; font-size: 12.5px; font-weight: 600; min-width: 0; }
.opp-card .oc-amount { font-family: var(--font-num); font-size: 14px; font-weight: 650; color: var(--primary-700); white-space: nowrap; }
.opp-card .oc-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.opp-card .oc-bar { height: 4px; border-radius: 3px; background: var(--bg-deep); margin-top: 9px; overflow: hidden; }
.opp-card .oc-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), #2dd4bf); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 22px 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 9px;
  background: hsl(210 30% 99%);
  color: var(--muted); font-size: 12px; text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.dropzone svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.dropzone strong { color: var(--fg-soft); font-weight: 600; font-size: 12.5px; }

/* ==========================================================================
   Reports & analytics
   ========================================================================== */
.report-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.report-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.range-preview {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px;
  border-radius: 7px; background: var(--primary-50);
  color: var(--primary-700); font-size: 11.5px;
}
.range-preview strong { font-family: var(--font-num); font-weight: 600; }
.mini-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-kpi .mk { padding: 10px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.mini-kpi .mk span { font-size: 11px; color: var(--muted); }
.mini-kpi .mk strong { display: block; margin-top: 2px; font-family: var(--font-num); font-size: 17px; font-weight: 650; }
.report-table-wrap { overflow-x: auto; }
.rank-cell { display: inline-flex; align-items: center; gap: 5px; }
.rank-medal { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 700; background: var(--bg-deep); color: var(--muted); }
.rank-medal.r1 { background: linear-gradient(145deg, #fde68a, #f59e0b); color: #7c2d12; }
.rank-medal.r2 { background: linear-gradient(145deg, #e2e8f0, #94a3b8); color: #334155; }
.rank-medal.r3 { background: linear-gradient(145deg, #fcd34d, #b45309); color: #fff; }
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-label { width: 76px; flex: none; font-size: 12px; color: var(--fg-soft); }
.funnel-bar-wrap { flex: 1; height: 26px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.funnel-bar {
  height: 100%; min-width: 2px; border-radius: 6px;
  background: linear-gradient(90deg, hsl(200 85% 42%), hsl(195 75% 52%));
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 7px; color: #fff; font-family: var(--font-num); font-size: 11px; font-weight: 600;
  transition: width 0.45s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.funnel-row.won .funnel-bar { background: linear-gradient(90deg, hsl(160 65% 38%), hsl(160 60% 50%)); }
.funnel-row.lost .funnel-bar { background: linear-gradient(90deg, hsl(0 55% 55%), hsl(0 65% 65%)); }
.funnel-meta { width: 116px; flex: none; text-align: right; font-size: 11px; color: var(--muted); }
.funnel-meta strong { font-family: var(--font-num); color: var(--fg-soft); font-weight: 600; }

.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.stat-box { padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.stat-box span { font-size: 11px; color: var(--muted); }
.stat-box strong { display: block; margin-top: 2px; font-family: var(--font-num); font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.stat-box em { font-style: normal; font-family: var(--font); font-size: 10.5px; color: var(--muted-2); margin-left: 3px; }

.report-cover {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, hsl(207 55% 20%), hsl(200 60% 27%));
  color: #fff;
}
.report-cover h2 { font-size: 18px; font-weight: 650; }
.report-cover p { font-size: 11.5px; color: hsl(200 30% 78%); margin-top: 2px; }
.report-cover .rc-meta { margin-left: auto; text-align: right; font-size: 11px; color: hsl(200 30% 80%); }
.report-cover .rc-meta strong { display: block; font-family: var(--font-num); font-size: 13px; color: #fff; }

.print-only { display: none; }
.report-doc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.report-doc-head { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid var(--primary); }
.report-doc-head h2 { font-size: 17px; }
.report-doc-head .rd-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.report-doc-head .rd-logo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; }
img.rd-logo { display: block; object-fit: contain; background: transparent !important; border-radius: 0; padding: 1px; }
.rd-logo-wordmark { width: 92px; height: auto; display: block; flex: none; }
.doc-section-title { font-size: 13px; font-weight: 650; margin: 18px 0 8px; display: flex; align-items: center; gap: 7px; }
.doc-section-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); }
.doc-note { font-size: 11px; color: var(--muted-2); margin-top: 10px; }

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-shell { display: grid; grid-template-columns: 186px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.settings-nav button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--fg-soft); text-align: left;
  font-size: 12.5px; cursor: pointer;
}
.settings-nav button:hover { background: var(--bg); }
.settings-nav button.on { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.settings-nav svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.setting-row { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .sr-main { flex: 1; min-width: 0; }
.setting-row .sr-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.setting-row .sr-main p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.setting-row .sr-ctrl { flex: none; display: flex; align-items: center; gap: 8px; }
.quota-bar { height: 8px; border-radius: 5px; background: var(--bg-deep); overflow: hidden; margin-top: 6px; }
.quota-bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), #2dd4bf); }
.dict-group { margin-bottom: 18px; }
.dict-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.dict-head strong { font-size: 12.5px; }
.dict-items { display: flex; flex-wrap: wrap; gap: 6px; }
.dict-item {
  display: inline-flex; align-items: center; gap: 4px;
  height: 25px; padding: 0 6px 0 9px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 11.5px; color: var(--fg-soft);
}
.dict-item button { border: 0; background: none; color: var(--muted-2); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.dict-item button:hover { color: var(--danger); }
.inline-add { display: flex; gap: 6px; margin-top: 8px; }
.inline-add .input { height: 30px; width: 180px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row .ur-main { flex: 1; min-width: 0; }
.user-row .ur-main strong { display: block; font-size: 12.5px; }
.user-row .ur-main small { font-size: 11px; color: var(--muted); }

.backup-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: linear-gradient(160deg, hsl(203 50% 98%), #fff);
}
.backup-card h4 { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.backup-card p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.backup-card .btn { margin-top: 10px; }

.import-result { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.import-result .ir-head { display: flex; gap: 20px; padding: 12px 14px; background: var(--bg); font-size: 12.5px; }
.import-result .ir-head strong { font-family: var(--font-num); }
.import-result .ir-errors { max-height: 220px; overflow: auto; }
.import-result .ir-err { display: flex; gap: 10px; padding: 7px 14px; border-top: 1px solid var(--border); font-size: 11.5px; }
.import-result .ir-err .rowno { flex: none; width: 54px; color: var(--danger); font-family: var(--font-num); }
.import-result .ir-err .msg { color: var(--fg-soft); }

/* ==========================================================================
   Login
   ========================================================================== */
.login-root {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  background: #fff;
}
.login-art {
  position: relative;
  overflow: hidden;
  padding: 44px 48px;
  display: flex; flex-direction: column;
  background:
    radial-gradient(80% 70% at 85% 10%, hsl(194 80% 38% / 0.55) 0%, transparent 60%),
    radial-gradient(70% 60% at 10% 100%, hsl(168 60% 40% / 0.28) 0%, transparent 60%),
    linear-gradient(150deg, hsl(210 50% 16%), hsl(205 62% 11%));
  color: #fff;
}
.login-art::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(hsl(0 0% 100% / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, hsl(0 0% 100% / 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(80% 70% at 50% 40%, #000 20%, transparent 100%);
}
.login-art .la-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-art .la-brand .brand-wordmark { width: 86px; height: auto; }
.la-brand-copy { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.la-brand-copy strong { font-size: 14.5px; font-weight: 600; color: #fff; letter-spacing: 0.4px; white-space: nowrap; }
.login-switch .brand-wordmark.sm { width: 64px; }
.login-switch strong { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.login-switch span { font-size: 11px; letter-spacing: 1.4px; color: var(--muted); }
.login-art .la-body { margin-top: auto; position: relative; z-index: 1; max-width: 470px; }
.login-art h1 { font-size: 30px; line-height: 1.38; font-weight: 650; letter-spacing: 0.2px; }
.login-art h1 em { font-style: normal; color: #5eead4; }
.login-art .la-desc { margin-top: 12px; font-size: 13px; line-height: 1.85; color: hsl(200 30% 78%); }
.login-art .la-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-top: 26px; }
.login-art .la-feat { display: flex; gap: 9px; align-items: flex-start; }
.login-art .la-feat .ic {
  width: 27px; height: 27px; flex: none; border-radius: 7px;
  display: grid; place-items: center;
  background: hsl(0 0% 100% / 0.08); border: 1px solid hsl(0 0% 100% / 0.12);
  color: #7dd3fc;
}
.login-art .la-feat svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.login-art .la-feat strong { display: block; font-size: 12px; font-weight: 600; }
.login-art .la-feat small { font-size: 10.5px; color: hsl(200 20% 68%); line-height: 1.5; }
.login-art .la-foot { margin-top: 30px; position: relative; z-index: 1; font-size: 10.5px; color: hsl(200 20% 55%); display: flex; gap: 14px; flex-wrap: wrap; }
.login-art .la-foot .dot { width: 5px; height: 5px; border-radius: 50%; background: #34d399; align-self: center; box-shadow: 0 0 0 3px hsl(160 70% 45% / 0.16); }
mark { background: hsl(45 100% 78%); color: inherit; border-radius: 2px; padding: 0 1px; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: hsl(210 30% 98.5%); }
.login-box { width: 100%; max-width: 356px; }
.login-box .lb-head { margin-bottom: 22px; }
.login-box .lb-head .lb-eyebrow { font-size: 11px; letter-spacing: 1.4px; color: var(--primary); font-weight: 650; text-transform: uppercase; }
.login-box h2 { margin-top: 5px; font-size: 23px; font-weight: 650; letter-spacing: -0.01em; }
.login-box .lb-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.login-box .field { margin-bottom: 13px; }
.login-box .input { height: 40px; border-radius: 8px; }
.login-box .btn.lg { margin-top: 6px; }
.login-error {
  display: none; align-items: center; gap: 6px;
  margin-bottom: 12px; padding: 8px 10px;
  border: 1px solid hsl(0 60% 88%); border-radius: 7px;
  background: var(--danger-50); color: var(--danger); font-size: 12px;
}
.login-error.show { display: flex; }
.login-error svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.login-tools { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 6px; }
.login-tools .check { font-size: 12px; }
.login-tools a { font-size: 12px; }
.login-hint { margin-top: 18px; font-size: 10.5px; color: var(--muted-2); line-height: 1.7; }
.login-switch { display: none; }

/* ==========================================================================
   Misc pages
   ========================================================================== */
.guide-step { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px dashed var(--border); }
.guide-step:last-child { border: 0; }
.guide-num {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary-700);
  font-family: var(--font-num); font-size: 11.5px; font-weight: 700;
}
.guide-step strong { display: block; font-size: 12.5px; }
.guide-step p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; }
.check-item .ck { width: 17px; height: 17px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--success-50); color: var(--success); margin-top: 1px; }
.check-item .ck svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.check-item.pending .ck { background: var(--bg-deep); color: var(--muted-2); }

.search-modal .modal-body { padding: 0; }
.search-results { max-height: 62vh; overflow: auto; }
.sr-group { padding: 8px 0; }
.sr-group-title { padding: 5px 18px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.8px; color: var(--muted); text-transform: uppercase; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 18px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--primary-50); }
.sr-item .sr-main { flex: 1; min-width: 0; }
.sr-item .sr-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.sr-item .sr-main small { font-size: 11px; color: var(--muted); }
.sr-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 12.5px; }

.notice {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--primary-100); background: var(--primary-50);
  color: var(--primary-700); font-size: 11.5px; line-height: 1.65;
}
.notice.warn { border-color: hsl(36 90% 84%); background: var(--warning-50); color: hsl(30 80% 32%); }
.notice.danger { border-color: hsl(0 70% 88%); background: var(--danger-50); color: hsl(0 60% 40%); }
.notice svg { width: 14px; height: 14px; margin-top: 2px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.notice a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.code-block {
  font-family: var(--font-num); font-size: 11px;
  padding: 10px 12px; border-radius: 7px;
  background: hsl(215 30% 15%); color: hsl(200 30% 88%);
  overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-all;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-shell { grid-template-columns: 264px minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 214px; }
  .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-art { padding: 34px 32px; }
  .login-art .la-features { grid-template-columns: 1fr; }
  .login-art h1 { font-size: 26px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .brand { padding: 0 12px; gap: 7px; }
  .brand-wordmark { width: 56px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy span { display: none; }
  .sidebar-close {
    display: grid; place-items: center; margin-left: auto;
    width: 26px; height: 26px; border: 0; border-radius: 6px;
    background: transparent; color: var(--sidebar-muted); cursor: pointer;
  }
  .sidebar-close:hover { background: hsl(0 0% 100% / 0.08); color: #fff; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: hsl(215 40% 12% / 0.45); backdrop-filter: blur(2px); display: none; }
  .scrim.show { display: block; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: grid; }
  .page { padding: 16px 16px 34px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .global-search { width: auto; flex: 1; }
  .global-search kbd { display: none; }
  .user-meta { display: none; }
  .login-root { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; background: hsl(210 40% 98%); padding: 28px 20px; }
  .login-switch { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; }
  .login-switch strong { font-size: 15px; }
  .settings-shell { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
  .report-shell { grid-template-columns: minmax(0, 1fr); }
  .report-side { position: static; }
}
@media (max-width: 720px) {
  .g-4, .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title { font-size: 18px; }
  .page-head { gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .toolbar { gap: 6px; }
  .filter-search { width: 100%; }
  .filter-select { flex: 1; min-width: 100px; }
  .modal-root { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 14px 14px 0 0; }
  .modal-foot { padding: 11px 14px; }
  .modal-body { padding: 14px; }
  .modal-head { padding: 15px 14px 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .detail-hero .dh-actions { width: 100%; margin-left: 0; }
  .detail-hero .dh-actions .btn { flex: 1; justify-content: center; }
  .kpi-value { font-size: 22px; }
  .hero { padding: 15px; }
  .hero h2 { font-size: 18px; }
  .hero-stats { gap: 16px; }
  .topbar-actions > .icon-btn { display: none; }  .notify-pop, .user-pop { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; min-width: 0; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .report-cover { flex-wrap: wrap; }
  .report-cover .rc-meta { margin-left: 0; text-align: left; width: 100%; }
  table.data th, table.data td { padding: 8px 9px; }
  .customer-cell .cc-text strong { max-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Print (报表导出 PDF)
   ========================================================================== */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .page-head, .no-print, .toast-root, .modal-root, .scrim, #chart-tip { display: none !important; }
  .main { margin: 0 !important; }
  .page { padding: 0 !important; }
  .report-shell { display: block !important; }
  .report-side { display: none !important; }
  .report-doc { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .print-only { display: block !important; }
  .card, .kpi-card, .stat-box { box-shadow: none !important; border-color: #d5dde5 !important; break-inside: avoid; }
  .grid, .kpi-strip, .report-doc { break-inside: avoid-page; }
  .report-doc .card { break-inside: avoid; }
  .report-doc .chart { max-width: 680px; margin: 0 auto; }
  .report-doc .chart-card { max-width: 760px; margin-left: auto !important; margin-right: auto !important; }
  .report-doc .chart svg { width: 100%; height: auto; }
  .report-doc .card-body { padding: 10px 12px !important; }
  .report-doc table.data { font-size: 10.5px; }
  .report-doc table.data th, .report-doc table.data td { padding: 5px 6px; }
  a { color: inherit !important; text-decoration: none !important; }
  table.data th { background: #f3f6f9 !important; }
  ::-webkit-scrollbar { display: none; }
}

/* 权限矩阵 */
.perm-head { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.perm-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.perm-matrix { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.perm-group { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); }
.perm-group:first-child { border-top: 0; }
.perm-group-title { font-size: 12px; font-weight: 600; color: var(--fg-soft); padding-top: 1px; }
.perm-items { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.perm-items .check { font-size: 12px; }
.perm-summary { font-size: 11px; margin-top: 2px; }
@media (max-width: 720px) {
  .perm-group { grid-template-columns: minmax(0, 1fr); gap: 5px; }
}

/* 协同申请 */
.collab-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px dashed var(--border); }
.collab-row:first-child { border-top: 0; }
.collab-main { flex: 1; min-width: 0; }
.collab-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.collab-main small { font-size: 11px; color: var(--muted); }
.settings-nav .nav-count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--warning); color: #fff; font-family: var(--font-num); font-size: 10.5px; font-weight: 700; }

/* 线索公告智能识别 */
.lead-import { border: 1px solid var(--primary-100); background: linear-gradient(180deg, var(--primary-50), #fff); border-radius: 10px; padding: 13px 14px; }
.lead-import-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.lead-import-head strong { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--primary-700); }
.lead-import-head strong svg { width: 15px; height: 15px; }
.lead-import-head span { flex: 1; min-width: 220px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.lead-import textarea { min-height: 94px; width: 100%; }
.customer-cell .cc-text small { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 驾驶舱分区标题与可点击卡片 */
.dash-section-head { display: flex; align-items: flex-end; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.dash-section-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dash-section-head p { margin-top: 2px; }
.kpi-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.kpi-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi-link:hover .kpi-label { color: var(--primary); }

.sidebar-company { font-size: 10px; line-height: 1.5; color: var(--muted-2); padding: 0 4px 8px; letter-spacing: .01em; }
