*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222535;
  --border: #2a2d3e;
  --accent: #6366f1;
  --accent-hover: #5254cc;
  --accent-light: rgba(99,102,241,.15);
  --text: #e2e8f0;
  --muted: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --sidebar-w: 230px;
}
[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --accent: #6366f1;
  --accent-hover: #5254cc;
  --accent-light: rgba(99,102,241,.10);
  --text: #1e293b;
  --muted: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
}
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder { color: #94a3b8; }
[data-theme="light"] .modal { background: #ffffff; }
[data-theme="light"] .modal-header { background: #f8fafc; border-color: #e2e8f0; }
[data-theme="light"] code { background: #f1f5f9; color: #6366f1; }

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo h1 { font-size: 18px; font-weight: 700; color: var(--accent); }
.sidebar-logo p { font-size: 11px; color: var(--muted); margin-top: 2px; }

.sidebar-nav { padding: 12px 8px; flex: 1; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--muted);
  transition: all .15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 18px; text-align: center; display: flex; align-items: center; justify-content: center; }
.nav-item .icon svg { width: 16px; height: 16px; stroke-width: 1.8; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--accent); color: white; font-size: 10px; padding: 1px 6px; border-radius: 10px; }

.sidebar-user { padding: 12px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.user-info:hover { background: var(--surface2); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: white; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 24px; gap: 16px; flex-shrink: 0; background: var(--surface);
}
.topbar-title { font-size: 18px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 8px; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-icon { font-size: 20px; margin-bottom: 8px; }

/* ── TABLES ── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-header h3 { font-size: 15px; font-weight: 600; flex: 1; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface2); }
td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-whatsapp { background: #25d366; color: white; }
.btn-whatsapp:hover { background: #1da851; }
.badge-paused { background: rgba(245,158,11,.2); color: #fbbf24; }
.badge-pending { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-in_progress { background: rgba(99,102,241,.2); color: #818cf8; }
.badge-opted_out { background: rgba(100,116,139,.15); color: #64748b; }

/* ── BADGES / STATUS ── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-new { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-contacted { background: rgba(59,130,246,.2); color: #60a5fa; }
.badge-warm { background: rgba(245,158,11,.2); color: #fbbf24; }
.badge-hot { background: rgba(239,68,68,.2); color: #f87171; }
.badge-customer { background: rgba(34,197,94,.2); color: #4ade80; }
.badge-lost { background: rgba(100,116,139,.15); color: #64748b; }
.badge-inbound { background: rgba(99,102,241,.2); color: #818cf8; }
.badge-outbound { background: rgba(245,158,11,.2); color: #fbbf24; }
.badge-active { background: rgba(34,197,94,.2); color: #4ade80; }
.badge-draft { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-completed { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-failed { background: rgba(239,68,68,.2); color: #f87171; }

/* ── SEARCH & FILTERS ── */
.search-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 14px; outline: none; width: 240px; }
.search-input:focus { border-color: var(--accent); }
.filter-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 14px; outline: none; cursor: pointer; width: auto; max-width: 200px; flex-shrink: 0; }

/* ── PAGINATION ── */
.btn:disabled, .btn[disabled] { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════════════════
   CONTACTS — Professional CRM UI
═══════════════════════════════════════════════════ */

/* ── View toggle (Lista | Board) ── */
.view-toggle-group {
  display: flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; overflow: hidden; flex-shrink: 0;
}
.view-toggle-btn {
  background: none; border: none; padding: 6px 11px;
  color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
  transition: all .12s;
}
.view-toggle-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.04); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }

/* ── Toolbar (search + filters + actions, one row) ── */
.contacts-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.contacts-search-wrap {
  position: relative; flex: 1; max-width: 340px; min-width: 140px;
}
.contacts-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-size: 12px; line-height: 1;
}
.contacts-search {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px 7px 30px; color: var(--text);
  font-size: 13px; outline: none; transition: border-color .15s;
}
.contacts-search::placeholder { color: var(--muted); }
.contacts-search:focus { border-color: var(--accent); }
.contacts-search:-webkit-autofill,
.contacts-search:-webkit-autofill:hover,
.contacts-search:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #222535 inset !important;
  -webkit-text-fill-color: #e2e8f0 !important;
}

/* Inline filter selects */
.contacts-filter-group {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: nowrap;
}
.contacts-filter-pill {
  display: block; width: auto; flex-shrink: 0; max-width: 160px; min-width: 100px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 26px 7px 10px; color: var(--text);
  font-size: 13px; outline: none; cursor: pointer; white-space: nowrap;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5'%3E%3Cpath d='M0 0l4.5 5L9 0z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  transition: border-color .15s;
}
.contacts-filter-pill:hover,
.contacts-filter-pill:focus { border-color: var(--accent); }
.contacts-filter-pill.active {
  border-color: var(--accent); background-color: rgba(99,102,241,.1);
  color: #a5b4fc;
}
.contacts-reset-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 7px 10px; color: var(--muted); font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; transition: all .15s;
}
.contacts-reset-btn:hover { border-color: #ef4444; color: #f87171; background: rgba(239,68,68,.07); }

/* ── Meta row (count + sort) ── */
.contacts-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; min-height: 26px;
}
.contacts-count { font-size: 12px; color: var(--muted); }
.contacts-sort-select {
  background: transparent; border: none; color: var(--accent);
  font-size: 12px; font-weight: 600; outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236366f1'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1px center;
}

/* ── Bulk bar ── */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(99,102,241,.07); border: 1px solid rgba(99,102,241,.25);
  border-radius: 8px; padding: 8px 14px; margin-bottom: 8px;
}
.bulk-label { font-size: 13px; font-weight: 600; color: #a5b4fc; white-space: nowrap; }
.bulk-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Table wrapper ── */
.contacts-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  max-height: calc(100vh - 250px); overflow-y: auto;
}
/* scrollbar */
.contacts-table-wrap::-webkit-scrollbar { width: 6px; }
.contacts-table-wrap::-webkit-scrollbar-track { background: transparent; }
.contacts-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.contacts-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.contacts-table { width: 100%; border-collapse: collapse; table-layout: fixed; }

.contacts-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface2); border-bottom: 1px solid var(--border);
  padding: 9px 14px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); font-weight: 700;
  white-space: nowrap; text-align: left;
}
.contacts-table td {
  padding: 0 14px; height: 50px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle; overflow: hidden;
}
.contacts-table tbody tr:last-child td { border-bottom: none; }
.contacts-table tbody tr { transition: background .08s; cursor: pointer; }
.contacts-table tbody tr:hover { background: rgba(255,255,255,.025); }
.contacts-table tbody tr:hover .row-actions { opacity: 1; }

/* Column widths */
.col-check   { width: 40px; }
.col-name    { width: 25%; }
.col-company { width: 16%; }
.col-phone   { width: 13%; }
.col-status  { width: 108px; }
.col-source  { width: 10%; }
.col-lists   { width: auto; }
.col-actions { width: 68px; }

/* Sort headers */
.sort-th { cursor: pointer; }
.sort-th:hover { color: var(--text); }
.sort-arrow { font-size: 9px; opacity: .25; margin-left: 3px; }
.sort-th.sort-active { color: var(--accent); }
.sort-th.sort-active .sort-arrow { opacity: 1; }

/* ── Avatar ── */
.contact-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .02em;
}

/* ── Name cell ── */
.contact-name-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.contact-name-info { display: flex; flex-direction: column; min-width: 0; }
.contact-name-main {
  font-weight: 600; font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-name-sub {
  font-size: 11px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Helpers ── */
.cell-muted { color: var(--muted); font-size: 12px; }
.cell-link { color: var(--text); text-decoration: none; }
.cell-link:hover { color: var(--accent); }

/* ── Inline status select ── */
.status-select {
  border: none; border-radius: 5px; cursor: pointer;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  outline: none; appearance: none; -webkit-appearance: none;
  transition: filter .12s; letter-spacing: .01em;
}
.status-select:hover { filter: brightness(1.2); }
.status-select.status-new       { background: rgba(99,102,241,.18);  color: #a5b4fc; }
.status-select.status-contacted { background: rgba(59,130,246,.18);  color: #93c5fd; }
.status-select.status-warm      { background: rgba(245,158,11,.18);  color: #fcd34d; }
.status-select.status-hot       { background: rgba(239,68,68,.18);   color: #fca5a5; }
.status-select.status-customer  { background: rgba(34,197,94,.18);   color: #86efac; }
.status-select.status-lost      { background: rgba(100,116,139,.18); color: #94a3b8; }

/* ── List pills ── */
.list-pill {
  display: inline-block;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  margin-right: 3px; white-space: nowrap; letter-spacing: .02em;
  border: 1px solid transparent;
}

/* ── RAG Test Panel ── */
.rag-test-panel {
  margin-top: 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.rag-test-header {
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.rag-test-input-row {
  display: flex; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border);
  align-items: center;
}
.rag-test-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 13px; outline: none;
}
.rag-test-input:focus { border-color: var(--accent); }
.rag-test-loading { padding: 24px 20px; color: var(--muted); font-size: 13px; }
.rag-test-empty   { padding: 24px 20px; color: var(--muted); font-size: 13px; }

.rag-result-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 20px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s;
}
.rag-result-row:last-child { border-bottom: none; }
.rag-result-row:hover { background: var(--surface2); }
.rag-result-rank  { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.rag-result-main  { flex: 1; min-width: 0; }
.rag-result-name  { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.rag-result-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rag-result-chunk { font-size: 11px; color: var(--muted); font-style: italic; }
.rag-result-score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; width: 90px; }
.rag-score-bar-wrap { width: 80px; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.rag-score-bar    { height: 100%; border-radius: 3px; transition: width .4s ease; }
.rag-score-label  { font-size: 12px; font-weight: 700; }

/* ── Sub-tabs ── */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.sub-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 13px; font-weight: 500; padding: 8px 16px;
  cursor: pointer; transition: all .15s; margin-bottom: -1px;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Product cards (Overview) ── */
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.product-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(99,102,241,.15); }
.product-card-img { width: 100%; height: 140px; overflow: hidden; background: var(--surface2); }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.product-card-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.product-card-brand { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.product-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-card-price { font-weight: 700; font-size: 15px; color: var(--text); }

/* ── Products DB table ── */
.products-db-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.products-db-table th { padding: 8px 10px; text-align: left; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--surface2); white-space: nowrap; }
.products-db-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.products-db-table tbody tr:hover { background: var(--surface2); }
.products-db-table tbody tr:hover .row-actions { opacity: 1; }

/* ── Product tag pills ── */
.tag-pill {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 4px; margin: 1px 2px 1px 0; white-space: nowrap;
  background: rgba(99,102,241,.18); color: #a5b4fc; border: 1px solid rgba(99,102,241,.3);
}

/* ── Category pill ── */
.category-pill {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; background: rgba(245,158,11,.15); color: #fbbf24;
  border: 1px solid rgba(245,158,11,.3);
}

/* ── Active toggle button ── */
.active-toggle {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; border: none; cursor: pointer; transition: all .15s;
}
.active-toggle-on  { background: rgba(34,197,94,.18); color: #4ade80; }
.active-toggle-on:hover  { background: rgba(34,197,94,.3); }
.active-toggle-off { background: rgba(100,116,139,.18); color: #94a3b8; }
.active-toggle-off:hover { background: rgba(100,116,139,.3); }

/* ── Clickable product row ── */
.product-row { cursor: pointer; }
.product-row:hover .row-actions { opacity: 1; }

/* ── Modal large ── */
.modal-lg { width: 720px; }

/* ── Product detail layout ── */
.detail-grid { display: flex; flex-direction: column; gap: 20px; }
.detail-section { background: var(--surface2); border-radius: 10px; padding: 16px; }
.detail-row { display: flex; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 100px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Import dropzone ── */
.import-dropzone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 32px 24px; text-align: center; cursor: pointer;
  transition: all .2s; color: var(--muted);
}
.import-dropzone:hover, .import-dropzone.drag-over {
  border-color: var(--accent); background: var(--accent-light); color: var(--text);
}
.import-map-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 12px;
}
.import-map-select:focus { outline: none; border-color: var(--accent); }

/* ── Row actions (visible on hover) ── */
.row-actions { opacity: 0; transition: opacity .1s; display: flex; align-items: center; gap: 1px; }

/* ── Checkboxes ── */
.contacts-table input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }

/* ── Pagination ── */
.contacts-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 12px 20px;
}
.page-btn {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 9px; color: var(--muted);
  font-size: 12px; cursor: pointer; transition: all .1s;
  min-width: 30px; text-align: center; line-height: 1.4;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,.07); }
.page-btn:disabled { opacity: .2; cursor: not-allowed; }
.page-btn.page-current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-info { font-size: 12px; color: var(--muted); padding: 0 4px; }

/* ── KANBAN ── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { min-width: 220px; width: 220px; flex-shrink: 0; }
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px 8px 0 0; background: var(--surface); border: 1px solid var(--border); border-bottom: none; }
.kanban-col-header h4 { font-size: 13px; font-weight: 600; flex: 1; }
.kanban-col-header .count { font-size: 11px; color: var(--muted); }
.kanban-col-body { background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 8px 8px; min-height: 400px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: grab; transition: box-shadow .15s; }
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.kanban-card.dragging { opacity: .5; }
.kanban-card h5 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kanban-card p { font-size: 12px; color: var(--muted); }
.kanban-col-body.drag-over { background: var(--accent-light); border-color: var(--accent); }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── TOOL OPTIONS ── */
#builtinToolsList, .tools-list { display: flex; flex-direction: column; gap: 8px; }
.tool-option { display: block; }
.tool-option-label { display: flex; align-items: flex-start; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; cursor: pointer; box-sizing: border-box; }
.tool-option-added .tool-option-label { border-color: var(--success); opacity: 0.65; cursor: default; }
.tool-option-label input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; flex-shrink: 0; margin-top: 2px; cursor: pointer; }
.tool-option-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.tool-option-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-option-desc { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-option-path { font-size: 10px; color: var(--accent); }
.badge-success { font-size: 11px; color: var(--success); margin-left: 6px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; color: var(--muted); font-weight: 500; }
input, select, textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px; outline: none; width: 100%; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

/* ── TOASTS ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: 14px; min-width: 240px; animation: slideIn .2s ease; display: flex; align-items: center; gap: 10px; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes livePulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }

/* ── LUCIDE ICON HELPERS ── */
.btn-icon { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }
.view-toggle-btn svg { width: 15px; height: 15px; stroke-width: 2; }
.contacts-search-icon svg { width: 13px; height: 13px; stroke-width: 2; }
.contacts-reset-btn svg { width: 12px; height: 12px; stroke-width: 2.5; }

/* ── AGENT CARD ── */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.agent-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: border-color .15s; }
.agent-card:hover { border-color: var(--accent); }
.agent-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.agent-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-light); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.agent-card h4 { font-size: 15px; font-weight: 600; }
.agent-card p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.agent-card-footer { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── PIPELINE STEPS ── */
.pipeline-steps { display: flex; flex-direction: column; gap: 8px; }
.step-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.step-type { font-size: 13px; font-weight: 600; }
.step-desc { font-size: 12px; color: var(--muted); }
.step-connector { height: 16px; width: 2px; background: var(--border); margin-left: 22px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── MISC ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { font-size: 20px; font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--muted); font-size: 13px; }
.tag { display: inline-flex; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--muted); gap: 4px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.ml-auto { margin-left: auto; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* ── APPOINTMENTS CALENDAR ── */
.appt-cal-nav {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.appt-cal-month {
  font-size: 16px; font-weight: 700; min-width: 180px; text-align: center;
}
.appt-cal-grid {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.appt-cal-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.appt-cal-header > div {
  text-align: center; padding: 10px 0; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.appt-cal-body {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.appt-cal-cell {
  min-height: 100px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px; cursor: pointer; transition: background .1s; vertical-align: top;
}
.appt-cal-cell:hover { background: rgba(99,102,241,.04); }
.appt-cal-cell:nth-child(7n) { border-right: none; }
.appt-cal-cell.appt-cal-empty { cursor: default; background: rgba(0,0,0,.03); }
.appt-cal-cell.appt-cal-today { background: rgba(99,102,241,.06); }
.appt-cal-day-num {
  font-size: 13px; font-weight: 600; color: var(--muted);
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; margin-bottom: 4px;
}
.appt-cal-day-num.today {
  background: var(--accent); color: #fff;
}
.appt-cal-events { display: flex; flex-direction: column; gap: 2px; }
.appt-cal-event {
  font-size: 10px; padding: 2px 5px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: filter .1s;
}
.appt-cal-event:hover { filter: brightness(1.3); }

/* ── CONTACT AUTOCOMPLETE (appointment modal) ── */
.appt-ac-wrap {
  position: relative;
}
.appt-ac-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px;
  outline: none; font-family: inherit; transition: border-color .15s;
}
.appt-ac-input:focus { border-color: var(--accent); }
.appt-ac-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-height: 240px; overflow-y: auto;
}
.appt-ac-item {
  padding: 10px 14px; cursor: pointer; transition: background .1s; border-radius: 4px;
}
.appt-ac-item:hover, .appt-ac-item.appt-ac-active {
  background: rgba(99,102,241,.12);
}
.appt-ac-name { font-size: 13px; font-weight: 600; color: var(--text); }
.appt-ac-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.appt-ac-empty { padding: 12px 14px; font-size: 13px; color: var(--muted); text-align: center; }
