/* ============================================================
   约签签 CRM v3 — AI 驾驶舱
   Tailwind CSS palette: Emerald 600 (brand) + Slate (neutral)
   Light theme — Clean, professional dashboard
   ============================================================ */

:root {
  /* ── Surfaces (Slate) ── */
  --page:          #f1f5f9;   /* Slate 100 */
  --surface:       #ffffff;   /* White */
  --surface-alt:   #f8fafc;   /* Slate 50 */
  --surface-hover: #e2e8f0;   /* Slate 200 */
  --overlay:       rgba(15,23,42,0.40);

  /* ── Borders (Slate) ── */
  --border:        #e2e8f0;   /* Slate 200 */
  --border-strong: #cbd5e1;   /* Slate 300 */
  --border-focus:  #94a3b8;   /* Slate 400 */

  /* ── Ink (Slate) ── */
  --ink-primary:   #0f172a;   /* Slate 900 */
  --ink-secondary: #475569;   /* Slate 600 */
  --ink-muted:     #94a3b8;   /* Slate 400 */

  /* ── Brand: Emerald ── */
  --brand:         #059669;   /* Emerald 600 */
  --brand-light:   #10b981;   /* Emerald 500 */
  --brand-dark:    #047857;   /* Emerald 700 */
  --brand-bg:      rgba(5,150,105,0.08);
  --brand-bg-strong: rgba(5,150,105,0.14);

  /* ── Accent colors (Tailwind 500/600 series) ── */
  --blue:          #2563eb;   /* Blue 600 — AI */
  --blue-bg:       rgba(37,99,235,0.08);
  --amber:         #d97706;   /* Amber 600 — handoff / warning */
  --amber-bg:      rgba(217,119,6,0.08);
  --rose:          #e11d48;   /* Rose 600 — critical / redline */
  --rose-bg:       rgba(225,29,72,0.08);
  --sky:           #0284c7;   /* Sky 600 — info */
  --sky-bg:        rgba(2,132,199,0.08);
  --violet:        #7c3aed;   /* Violet 600 — accent */
  --violet-bg:     rgba(124,58,237,0.08);
  --orange:        #ea580c;   /* Orange 600 — attention */
  --orange-bg:     rgba(234,88,12,0.08);
  --cyan:          #0891b2;   /* Cyan 600 — teal */
  --cyan-bg:       rgba(8,145,178,0.08);
  --gold:          #b45309;   /* Amber 700 — ranking/accent */

  /* ── Chart categorical (Tailwind 500s, ordered for CVD safety) ── */
  --cat-1: #3b82f6;   /* blue */
  --cat-2: #f59e0b;   /* amber */
  --cat-3: #10b981;   /* emerald (brand) */
  --cat-4: #8b5cf6;   /* violet */
  --cat-5: #f97316;   /* orange */
  --cat-6: #06b6d4;   /* cyan */
  --cat-7: #ec4899;   /* pink */
  --cat-8: #e11d48;   /* rose */

  /* ── Status (fixed) ── */
  --status-good:     #059669;   /* Emerald 600 */
  --status-warning:  #d97706;   /* Amber 600 */
  --status-serious:  #ea580c;   /* Orange 600 */
  --status-critical: #e11d48;   /* Rose 600 */

  /* ── Chart chrome ── */
  --chart-gridline:  #e2e8f0;   /* Slate 200 */
  --chart-baseline:  #cbd5e1;   /* Slate 300 */

  /* ── Geometry ── */
  --sidebar-w: 232px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --gap:       16px;
  --gap-sm:    10px;
  --gap-xs:    6px;
  --transition: 180ms ease;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);

  /* ── Typography ── */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink-primary);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  height: 100vh; position: fixed; left: 0; top: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  font-size: 1.15rem; font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand span {
  color: var(--ink-muted); font-weight: 400;
  font-size: 0.72rem; letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 10px 12px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--ink-secondary); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px; position: relative;
}
.sidebar-nav a:hover { background: var(--surface-hover); color: var(--ink-primary); }
.sidebar-nav a.active { background: var(--brand-bg); color: var(--brand); }
.sidebar-nav a.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--brand);
}
.sidebar-nav a .icon { font-size: 1.05rem; width: 22px; text-align: center; }
.sidebar-nav a .badge-count {
  margin-left: auto;
  background: var(--surface-hover);
  padding: 2px 8px; border-radius: 10px;
  font-size: 0.68rem; font-weight: 600;
  color: var(--ink-muted); min-width: 22px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.sidebar-nav a.active .badge-count {
  background: var(--brand-bg-strong); color: var(--brand);
}

.sidebar-divider { height: 1px; background: var(--border); margin: 12px 8px; }

.sidebar-footer {
  padding: 14px 16px 18px; border-top: 1px solid var(--border);
  font-size: 0.73rem; color: var(--ink-muted);
}

/* Pulse */
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-good); display: inline-block;
  animation: pulse-ring 2s ease-out infinite; margin-right: 6px;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 13px 28px;
  display: flex; align-items: center; gap: 12px;
}
.topbar h2 { font-size: 1.05rem; font-weight: 600; color: var(--ink-primary); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.content { flex: 1; padding: 24px 28px; overflow-y: auto; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: var(--gap); margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.kpi-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
}
.kpi-card:hover {
  border-color: var(--border-strong); box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.kpi-card .kpi-label {
  font-size: 0.7rem; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
  margin-bottom: 10px;
}
.kpi-card .kpi-value {
  font-size: 2rem; font-weight: 700; color: var(--ink-primary);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi-card .kpi-sub {
  font-size: 0.73rem; color: var(--ink-secondary); margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}
.kpi-card .kpi-sub::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* KPI accent left-border strips */
.kpi-card.accent-1 { border-left: 3px solid var(--blue); }     /* AI */
.kpi-card.accent-2 { border-left: 3px solid var(--amber); }    /* handoff */
.kpi-card.accent-3 { border-left: 3px solid var(--brand); }    /* growth */
.kpi-card.accent-4 { border-left: 3px solid var(--violet); }   /* attention */
.kpi-card.accent-5 { border-left: 3px solid var(--sky); }      /* info */

/* ============================================================
   CHART CARDS
   ============================================================ */
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: var(--gap);
}
.chart-card h3 {
  font-size: 0.85rem; font-weight: 600; color: var(--ink-secondary);
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.02em;
}
.chart-card h3 .dot {
  width: 8px; height: 8px; border-radius: 2px; background: var(--brand);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }

/* ============================================================
   FILTERS & INPUTS
   ============================================================ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--gap-xs);
  margin-bottom: 14px; align-items: center;
}
.filter-bar input, .filter-bar select {
  background: var(--surface); color: var(--ink-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 0.82rem; font-family: var(--font);
  outline: none; transition: border var(--transition), box-shadow var(--transition);
}
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.filter-bar input { min-width: 220px; }
.filter-bar input::placeholder { color: var(--ink-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-secondary); cursor: pointer;
  font-size: 0.8rem; font-weight: 500; font-family: var(--font);
  transition: all var(--transition); white-space: nowrap; text-align: center;
}
.btn:hover { background: var(--surface-hover); color: var(--ink-primary); border-color: var(--border-strong); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn-primary:hover { background: var(--brand-light); border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px; font-size: 0.7rem; font-weight: 600;
  color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); position: sticky; top: 0;
}
tbody td {
  padding: 10px 14px; font-size: 0.84rem;
  border-bottom: 1px solid var(--border); color: var(--ink-secondary);
}
tbody tr { transition: background var(--transition); cursor: pointer; }
tbody tr:hover td { background: var(--surface-hover); }
tbody tr.selected td { background: var(--brand-bg); }
td.name-cell { color: var(--ink-primary); font-weight: 500; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 3px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1.5;
}
.badge-A { background: var(--sky-bg);    color: var(--sky); }
.badge-B { background: var(--blue-bg);   color: var(--blue); }
.badge-C { background: var(--surface-hover); color: var(--ink-muted); }
.badge-D { background: var(--rose-bg);   color: var(--rose); }
.badge-ai { background: var(--blue-bg);  color: var(--blue); }
.badge-human { background: var(--amber-bg); color: var(--amber); }

/* ============================================================
   CRM SPLIT (customers)
   ============================================================ */
.crm-split {
  display: grid; grid-template-columns: var(--split-width,380px) 6px 1fr;
  gap: 0; height: calc(100vh - 130px);
}
.crm-split-handle {
  width: 6px; cursor: col-resize; background: transparent;
  transition: background 0.2s; z-index: 10; user-select: none;
}
.crm-split-handle:hover,.crm-split-handle.dragging{background:var(--brand)}
.crm-list-panel{margin-right:6px}
.crm-detail-panel{margin-left:6px}
.crm-list-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden;
}
.crm-list-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.82rem; color: var(--ink-secondary);
  display: flex; justify-content: space-between; align-items: center;
}
.crm-list-scroll { flex: 1; overflow-y: auto; }
.crm-list-item {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition);
}
.crm-list-item:hover { background: var(--surface-hover); }
.crm-list-item.selected {
  background: var(--brand-bg); border-left: 3px solid var(--brand);
  padding-left: 15px;
}
.crm-list-item .li-name { font-weight: 600; color: var(--ink-primary); font-size: 0.88rem; }
.crm-list-item .li-company { font-size: 0.78rem; color: var(--ink-secondary); margin-top: 2px; }
.crm-list-item .li-meta {
  font-size: 0.72rem; color: var(--ink-muted); margin-top: 4px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

.crm-detail-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;
  min-height: 0;
}
.crm-split > * { min-height: 0; overflow: hidden; }
.crm-detail-header { padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.crm-detail-header h2 { font-size: 1.1rem; font-weight: 600; }
.crm-detail-header .subtitle {
  font-size: 0.78rem; color: var(--ink-muted); margin-top: 4px;
  font-family: var(--font-mono);
}
.crm-detail-info { flex-shrink: 0; overflow-y: auto; }
.crm-detail-vsplit {
  height: 8px; flex-shrink: 0; cursor: row-resize;
  background: var(--border); border-radius: 2px;
  transition: background 0.2s, box-shadow 0.2s; z-index: 10; user-select: none;
  margin: 0;
}
.crm-detail-vsplit:hover, .crm-detail-vsplit.dragging {
  background: var(--brand); box-shadow: 0 0 0 4px rgba(5,150,105,0.2);
}
.crm-detail-chat { flex: 1 0 var(--chat-h, 200px); overflow-y: auto; min-height: 120px; padding: 0 22px 18px; }
.crm-detail-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }

.tab-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  padding: 0 22px; background: var(--surface);
}
.tab-item {
  padding: 10px 16px; cursor: pointer; font-size: 0.82rem; font-weight: 500;
  color: var(--ink-muted); border-bottom: 2px solid transparent;
  transition: all var(--transition); margin-bottom: -1px;
}
.tab-item:hover { color: var(--ink-secondary); }
.tab-item.active { color: var(--brand); border-bottom-color: var(--brand); }

.field-row {
  display: grid; grid-template-columns: 100px 1fr;
  gap: 8px; margin-bottom: 10px; align-items: center;
}
.field-row label {
  font-size: 0.73rem; color: var(--ink-muted);
  font-weight: 500; letter-spacing: 0.02em;
}
.field-row select, .field-row input, .field-row textarea {
  background: var(--page); color: var(--ink-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 0.84rem; outline: none;
  font-family: var(--font); width: 100%;
  transition: border var(--transition), box-shadow var(--transition);
}
.field-row select:focus, .field-row input:focus, .field-row textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}
.field-row textarea { min-height: 50px; resize: vertical; }

/* ============================================================
   TIMELINE / MESSAGE ROWS
   ============================================================ */
.timeline-section { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.timeline-section h3 { font-size: 0.85rem; font-weight: 600; color: var(--ink-secondary); margin-bottom: 14px; }

/* Message row — flex container, full width */
.message-row {
  display: flex; width: 100%; margin: 12px 0; align-items: flex-start;
}
.message-row.customer { justify-content: flex-start; flex-direction: row; }
.message-row.ours     { justify-content: flex-end;   flex-direction: row; }

/* Avatar */
.avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 700;
}
.customer .avatar { margin-right: 8px; background: var(--violet-bg); color: var(--violet); }
.ours .avatar     { margin-left: 8px;  background: var(--brand-bg);  color: var(--brand); }

/* Message content wrapper */
.message-content { max-width: 75%; }
.ours .message-content { display: flex; flex-direction: column; align-items: flex-end; }
.message-bubble {
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.81rem; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.customer .message-bubble {
  background: #f3f6fb; color: var(--ink-primary); border-bottom-left-radius: 3px;
}
.ours .message-bubble {
  background: #e8f8f0; color: var(--ink-primary); border-bottom-right-radius: 3px;
}

/* Meta: time + translate button */
.message-meta { font-size: 0.66rem; color: var(--ink-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.customer .message-meta { text-align: left; }
.ours .message-meta     { text-align: right; }

/* Translation text — click to toggle */
.tl-text { cursor: pointer; user-select: none; }
.tl-text:hover { opacity: 0.7; }

.timeline-handoff {
  text-align: center; padding: 8px; margin: 12px 0;
  background: var(--rose-bg); border: 1px dashed var(--rose);
  border-radius: var(--radius-sm); color: var(--rose);
  font-size: 0.76rem; font-weight: 500;
}

/* ============================================================
   FEED / MONITOR
   ============================================================ */
.feed-container { display: flex; flex-direction: column; max-height: 480px; overflow-y: auto; }
.feed-item {
  padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start;
  border-bottom: 1px solid var(--border); transition: background var(--transition); cursor: pointer;
}
.feed-item:hover { background: var(--surface-hover); }
.feed-item .feed-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0; margin-top: 2px;
}
.feed-item .feed-body { flex: 1; min-width: 0; }
.feed-item .feed-name { font-weight: 600; font-size: 0.8rem; color: var(--ink-primary); }
.feed-item .feed-text {
  font-size: 0.78rem; color: var(--ink-secondary); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-item .feed-meta {
  font-size: 0.66rem; color: var(--ink-muted); margin-top: 3px;
  display: flex; gap: 6px; align-items: center;
}

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-wrap { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col {
  flex: 1; min-width: 185px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  max-height: calc(100vh - 200px);
}
.kanban-col-header {
  padding: 11px 14px; font-size: 0.8rem; font-weight: 600;
  border-bottom: 2px solid var(--border); display: flex; justify-content: space-between;
  background: var(--surface-alt); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kanban-col-body { flex: 1; padding: 8px; overflow-y: auto; min-height: 80px; }
.kanban-card {
  background: var(--page); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
  cursor: grab; transition: all var(--transition);
}
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.35; }
.kanban-card .kc-name { font-weight: 600; font-size: 0.81rem; color: var(--ink-primary); }
.kanban-card .kc-company { font-size: 0.72rem; color: var(--ink-muted); margin-top: 2px; }
.kanban-card.A { border-left: 3px solid var(--sky); }
.kanban-card.B { border-left: 3px solid var(--blue); }
.kanban-card.C { border-left: 3px solid var(--ink-muted); }
.kanban-card.D { border-left: 3px solid var(--rose); }
.kanban-col-body.drag-over { background: var(--brand-bg); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 16px 0;
}
.pagination button {
  background: var(--surface); color: var(--ink-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer; font-size: 0.78rem; font-family: var(--font);
  transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink-primary); border-color: var(--border-strong); }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.pagination span { color: var(--ink-muted); font-size: 0.78rem; }

/* ============================================================
   STATES
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.84rem; }

.loading-box { text-align: center; padding: 40px; color: var(--ink-muted); }
.spinner {
  width: 28px; height: 28px; border: 2.5px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.65s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  padding: 11px 18px; border-radius: var(--radius);
  font-size: 0.81rem; font-weight: 500; color: var(--ink-primary);
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.2s ease;
}
.toast-ok { border-left: 3px solid var(--status-good); }
.toast-err { border-left: 3px solid var(--status-critical); }
.toast-close { background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.toast-close:hover { color: var(--ink-primary); }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   MISC
   ============================================================ */
.field-empty { color: var(--ink-muted); font-style: italic; cursor: pointer; font-size: 0.8rem; }
.field-empty:hover { color: var(--brand); font-style: normal; }

.silence-bar { display: flex; gap: 3px; height: 22px; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.silence-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 600; color: #fff;
  transition: all var(--transition); cursor: pointer;
}
.silence-segment:hover { filter: brightness(1.2); }

.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.profile-section { margin-bottom: 14px; }
.profile-section h4 { font-size: 0.76rem; color: var(--ink-muted); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.memory-item { padding: 5px 0 5px 10px; font-size: 0.82rem; border-left: 2px solid var(--brand); margin-bottom: 4px; color: var(--ink-secondary); }

.reason-tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 0.68rem; font-weight: 600; }
.reason-customer  { background: var(--blue-bg);   color: var(--blue); }
.reason-price     { background: var(--rose-bg);   color: var(--rose); }
.reason-file      { background: var(--amber-bg);  color: var(--amber); }
.reason-redline   { background: var(--rose-bg);   color: var(--rose); }
.reason-system    { background: var(--surface-hover); color: var(--ink-muted); }

.sidebar-nav .icon { display: inline-flex; align-items: center; width: 20px; height: 20px; }
.sidebar-nav .icon svg { width: 18px; height: 18px; }
.sidebar-nav a.active .icon svg { stroke: var(--brand); }

.chart-card canvas { max-width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .crm-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .kanban-col { min-width: 150px; }
}
@media (max-width: 768px) {
  .sidebar { width: 56px; min-width: 56px; }
  .sidebar .sidebar-brand span, .sidebar .sidebar-nav a span:not(.icon),
  .sidebar .sidebar-footer, .sidebar .badge-count { display: none; }
  .main { margin-left: 56px; }
  :root { --sidebar-w: 56px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-card { padding: 14px 16px; }
  .kpi-card .kpi-value { font-size: 1.5rem; }
}

/* ============================================================
   NEW: Orders — status timeline
   ============================================================ */
.order-timeline { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 0; position: relative; }
.order-timeline::before { content: ''; position: absolute; top: 24px; left: 10%; right: 10%; height: 2px; background: var(--border); z-index: 0; }
.ot-step { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; }
.ot-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border); border: 2px solid #fff; }
.ot-step.active .ot-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
.ot-step.current .ot-dot { background: var(--brand); box-shadow: 0 0 0 5px var(--brand-bg-strong); }
.ot-step span { font-size: 0.68rem; color: var(--ink-muted); white-space: nowrap; }
.ot-step.active span { color: var(--brand); font-weight: 600; }

/* ============================================================
   NEW: Follow-up cards
   ============================================================ */
.fu-card { transition: box-shadow var(--transition); }
.fu-card:hover { box-shadow: var(--shadow-sm); }

/* ============================================================
   NEW: Completeness bar (customer enrichment)
   ============================================================ */
.completeness-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 4px 0; }
.completeness-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.completeness-low .completeness-bar-fill { background: var(--rose); }
.completeness-medium .completeness-bar-fill { background: var(--amber); }
.completeness-high .completeness-bar-fill { background: var(--brand); }

/* ============================================================
   NEW: Enrichment review modal
   ============================================================ */
.enrich-review-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.enrich-review-row:last-child { border-bottom: none; }
.enrich-field-label { width: 70px; font-size: 0.8rem; color: var(--ink-secondary); flex-shrink: 0; }
.enrich-old-val { font-size: 0.8rem; color: var(--ink-muted); text-decoration: line-through; flex: 1; }
.enrich-new-val { font-size: 0.85rem; color: var(--brand); font-weight: 500; flex: 1; }
.enrich-arrow { color: var(--ink-muted); font-size: 0.8rem; }
.enrich-conf-badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.enrich-conf-high { background: var(--brand-bg); color: var(--brand); }
.enrich-conf-medium { background: var(--amber-bg); color: var(--amber); }
.enrich-conf-low { background: var(--rose-bg); color: var(--rose); }

/* ============================================================
   NEW: Pager buttons
   ============================================================ */
.pager { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; justify-content: center; }
