:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --sidebar: #0b1020;
  --sidebar-soft: #141b31;
  --ink: #161a2b;
  --muted: #6b7280;
  --muted-2: #9aa0b4;
  --line: #e5e7f0;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef0ff;
  --high: #e11d48;
  --high-soft: #ffe4ea;
  --medium: #b45309;
  --medium-soft: #fef3c7;
  --low: #0f766e;
  --low-soft: #ccfbf1;
  --green: #059669;
  --green-soft: #d1fae5;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 12px 30px rgba(20, 27, 49, 0.07);
  --shadow-lg: 0 30px 70px rgba(15, 23, 42, 0.22);
  --radius: 18px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.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;
}

:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.35); outline-offset: 2px; }
::selection { background: #c7d2fe; color: #1e1b4b; }

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 252px;
  height: 100vh;
  flex-shrink: 0;
  padding: 20px 16px;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.28), transparent 38%),
    linear-gradient(180deg, #0b1020 0%, #0d1326 100%);
  color: #aab1c8;
  z-index: 60;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
  color: #fff;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.brand-logo svg { width: 21px; height: 21px; stroke: #fff; stroke-width: 2; }

.brand-text {
  font-family: "Sora", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-text span { color: #a5b4fc; }

.sidebar-nav { display: grid; gap: 4px; }

.nav-label {
  padding: 0 10px;
  margin-bottom: 6px;
  color: #5d6885;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-label-spaced { margin-top: 22px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #9aa4bd;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e7eaf5; }
.nav-item.is-active { background: linear-gradient(90deg, rgba(99, 102, 241, 0.26), rgba(99, 102, 241, 0.1)); color: #fff; box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35); }

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.68rem;
  font-weight: 800;
}

.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }

.automation-card {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.16), rgba(255, 255, 255, 0.03));
}

.automation-head { display: flex; align-items: center; gap: 7px; color: #c7d2fe; font-size: 0.74rem; font-weight: 700; }

.pulse-dot {
  position: relative;
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

.automation-card p { margin-top: 7px; color: #8d97b2; font-size: 0.78rem; line-height: 1.45; }
.automation-stat { display: flex; align-items: baseline; gap: 6px; margin-top: 9px; }
.automation-stat strong { color: #fff; font-family: "Sora", sans-serif; font-size: 1.1rem; }
.automation-stat span { color: #7c87a4; font-size: 0.68rem; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.sidebar-user strong { display: block; color: #e7eaf5; font-size: 0.82rem; }
.sidebar-user span { display: block; color: #6f7a97; font-size: 0.7rem; }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.avatar-user { background: linear-gradient(135deg, #0ea5e9, #6366f1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 231, 240, 0.85);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-left { flex: 1; min-width: 0; }

.icon-btn.menu-btn { display: none; }

.global-search {
  position: relative;
  display: block;
  width: min(380px, 100%);
}

.global-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.global-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 37px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f9fc;
  font-size: 0.84rem;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

.global-search input::placeholder { color: #9ba1b5; }
.global-search input:focus { outline: none; border-color: #b9bdf5; background: #fff; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08); }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid #d7f2e4;
  border-radius: 999px;
  background: #f2fdf8;
  color: #047857;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-pill .pulse-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16); }

.topbar-avatar { width: 34px; height: 34px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn svg { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, #4f46e5, #4338ca); color: #fff; box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(79, 70, 229, 0.32); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #c9cce0; background: #fbfbfe; }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); border-color: #dcdcff; }
.btn-soft:hover { background: #e4e6ff; }
.btn-sm { padding: 8px 12px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--ink); border-color: #c9cce0; background: #fbfbfe; }

/* Content */
.content { width: min(1280px, 100%); margin: 0 auto; padding: 28px 28px 40px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-head h1 { font-size: clamp(1.55rem, 2.6vw, 2rem); }
.page-sub { margin-top: 6px; color: var(--muted); font-size: 0.87rem; }

.range-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.range-pill svg { width: 15px; height: 15px; }

/* Workflow strip */
.workflow-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid #dddefb;
  border-radius: 14px;
  background:
    radial-gradient(circle at 92% 20%, rgba(139, 92, 246, 0.16), transparent 42%),
    linear-gradient(100deg, #f5f4ff, #fbfaff);
}

.workflow-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.workflow-icon { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.workflow-icon svg { width: 19px; height: 19px; }
.workflow-main strong { display: block; font-size: 0.84rem; }
.workflow-main p { margin-top: 2px; color: var(--muted); font-size: 0.77rem; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }

.kpi {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

.kpi-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; }
.kpi-icon svg { width: 18px; height: 18px; }
.tint-indigo { background: var(--brand-soft); color: var(--brand); }
.tint-rose { background: var(--high-soft); color: var(--high); }
.tint-emerald { background: #d1fae5; color: #047857; }
.tint-amber { background: var(--amber-soft); color: #b45309; }

.kpi-trend { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 800; }
.kpi-trend svg { width: 12px; height: 12px; }
.kpi-trend.is-up { background: #ecfdf5; color: #047857; }
.kpi-trend.is-down { background: #eff6ff; color: #1d4ed8; }
.kpi-trend.is-down svg { transform: scaleY(-1); }

.kpi-label { color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.kpi-value { margin-top: 2px; font-family: "Sora", sans-serif; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.kpi-note { margin-top: 3px; color: var(--muted-2); font-size: 0.7rem; }

/* Cards & charts */
.chart-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 16px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chart-card, .source-card { padding: 20px 22px; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 1rem; }
.card-head p { margin-top: 3px; color: var(--muted); font-size: 0.76rem; }

.chart-total { text-align: right; }
.chart-total strong { display: block; font-family: "Sora", sans-serif; font-size: 1.4rem; line-height: 1.1; }
.chart-total span { color: var(--muted-2); font-size: 0.68rem; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 2.4vw, 22px);
  height: 168px;
  padding: 8px 4px 0;
}

.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }

.bar-value { color: var(--muted); font-size: 0.68rem; font-weight: 700; opacity: 0; transform: translateY(3px); transition: opacity 0.15s, transform 0.15s; }

.bar-track {
  position: relative;
  width: 100%;
  max-width: 42px;
  flex: 1;
  border-radius: 8px 8px 5px 5px;
  background: #f1f2f8;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--h);
  border-radius: 8px 8px 5px 5px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  transition: filter 0.15s;
}

.bar-col:hover .bar-fill { filter: brightness(1.08); }
.bar-col:hover .bar-value { opacity: 1; transform: none; }
.bar-col.is-today .bar-fill { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.bar-col.is-today .bar-value { opacity: 1; transform: none; color: var(--brand-dark); }

.bar-day { color: var(--muted-2); font-size: 0.68rem; font-weight: 600; }
.bar-col.is-today .bar-day { color: var(--ink); font-weight: 800; }

.source-list { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }

.source-row { display: grid; gap: 7px; }
.source-top { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; }
.source-top svg { width: 15px; height: 15px; color: var(--muted); }
.source-top strong { margin-left: auto; font-size: 0.76rem; }
.source-track { height: 7px; border-radius: 999px; background: #f0f1f7; overflow: hidden; }
.source-fill { height: 100%; border-radius: 999px; background: var(--bar); }

/* Table */
.table-card { overflow: hidden; }

.table-head { padding: 18px 20px 12px; margin-bottom: 0; }

.table-filters { display: flex; align-items: center; gap: 8px; }

.select, .input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 0.83rem;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.select, .input { height: 37px; padding: 0 11px; }
.textarea { padding: 10px 11px; resize: vertical; min-height: 96px; }

.select:focus, .input:focus, .textarea:focus { outline: none; border-color: #b9bdf5; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08); }

#status-select { width: 150px; height: 36px; color: var(--muted); font-size: 0.78rem; }

.priority-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 14px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}

.chip span { color: var(--muted-2); font-size: 0.68rem; font-weight: 700; }
.chip:hover { border-color: #c9cce0; color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.is-active span { color: #c7cbe0; }

.table-wrap { overflow-x: auto; }

.lead-table { width: 100%; border-collapse: collapse; }

.lead-table th {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
  color: var(--muted-2);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.lead-table th:first-child, .lead-table td:first-child { padding-left: 20px; }
.lead-table th:last-child, .lead-table td:last-child { padding-right: 20px; text-align: right; }

.lead-table td { padding: 12px 14px; border-bottom: 1px solid #eef0f6; font-size: 0.82rem; vertical-align: middle; }

.lead-table tbody tr { cursor: pointer; transition: background 0.14s; }
.lead-table tbody tr:hover { background: #fafbff; }
.lead-table tbody tr:last-child td { border-bottom: 0; }
.lead-table tbody tr:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.3); outline-offset: -3px; }

.lead-cell { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.lead-cell .avatar { width: 34px; height: 34px; font-size: 0.68rem; }
.lead-cell strong { display: block; font-size: 0.82rem; font-weight: 700; }
.lead-cell span { display: block; color: var(--muted); font-size: 0.72rem; }

.avatar-0 { background: linear-gradient(135deg, #f97316, #ea580c); }
.avatar-1 { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.avatar-2 { background: linear-gradient(135deg, #10b981, #047857); }
.avatar-3 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-4 { background: linear-gradient(135deg, #ec4899, #be185d); }
.avatar-5 { background: linear-gradient(135deg, #14b8a6, #0f766e); }

.source-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.source-cell svg { width: 14px; height: 14px; }

.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.priority::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.priority.high { background: var(--high-soft); color: #be123c; }
.priority.medium { background: var(--medium-soft); color: #92400e; }
.priority.low { background: var(--low-soft); color: #0f766e; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.new { color: var(--blue); }
.status.contacted { color: var(--green); }
.status.followup { color: var(--amber); }
.status.won { color: #7c3aed; }

.time-cell { color: var(--muted-2); font-size: 0.74rem; white-space: nowrap; }

.row-open { width: 30px; height: 30px; border: 0; background: transparent; color: #b3b8cb; }
.row-open:hover { background: var(--brand-soft); color: var(--brand); border: 0; }
.row-open svg { width: 16px; height: 16px; }

.table-empty { padding: 48px 20px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; background: #f3f4fa; color: var(--muted-2); }
.empty-icon svg { width: 23px; height: 23px; }
.table-empty h3 { font-size: 1rem; margin-bottom: 5px; }
.table-empty p { margin-bottom: 14px; color: var(--muted); font-size: 0.82rem; }

.page-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 22px 4px 0; color: var(--muted-2); font-size: 0.72rem; }

/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(470px, 100%);
  height: 100dvh;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.26s cubic-bezier(0.22, 0.68, 0.3, 1);
  overflow: hidden;
}

.drawer.is-open { transform: translateX(0); }

#drawer-content { display: flex; flex: 1; min-height: 0; flex-direction: column; }

.drawer-scroll { flex: 1; overflow-y: auto; padding: 22px 22px 8px; }

.drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

.drawer-profile { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-profile .avatar { width: 48px; height: 48px; font-size: 0.85rem; }
.drawer-profile h2 { font-size: 1.18rem; margin-bottom: 2px; }
.drawer-profile p { color: var(--muted); font-size: 0.79rem; }

.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
}

.badge.high { background: var(--high-soft); color: #be123c; }
.badge.medium { background: var(--medium-soft); color: #92400e; }
.badge.low { background: var(--low-soft); color: #0f766e; }
.badge.neutral { background: #f2f3f9; color: var(--muted); }
.badge.ai { background: var(--brand-soft); color: var(--brand-dark); }

.drawer-section { padding: 18px 0; border-top: 1px solid #eef0f6; }
.drawer-section:first-of-type { border-top: 0; padding-top: 0; }

.drawer-section h3 { margin-bottom: 10px; color: var(--muted-2); font-family: "Plus Jakarta Sans", sans-serif; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-item { padding: 9px 10px; border: 1px solid #eef0f6; border-radius: 9px; background: #fbfbfe; }
.contact-item span { display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.contact-item svg { width: 12px; height: 12px; }
.contact-item strong { display: block; margin-top: 3px; font-size: 0.76rem; font-weight: 600; word-break: break-word; }

.ai-card {
  padding: 14px;
  border: 1px solid #ddddfb;
  border-radius: 12px;
  background: linear-gradient(150deg, #f7f7ff, #fdfcff);
}

.ai-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ai-card-title { display: flex; align-items: center; gap: 7px; color: var(--brand-dark); font-size: 0.74rem; font-weight: 800; }
.ai-card-title svg { width: 15px; height: 15px; }
.ai-card p { color: #3f4359; font-size: 0.82rem; line-height: 1.6; }

.ai-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e6e6fb; }

.score-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(var(--ring, var(--brand)) calc(var(--score, 0) * 1%), #e9eaf6 0);
}

.score-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.score-ring span { position: relative; font-family: "Sora", sans-serif; font-size: 0.82rem; font-weight: 800; }
.score-ring small { position: relative; display: block; margin-top: -14px; color: var(--muted-2); font-size: 0.5rem; font-weight: 700; text-align: center; }

.reply-box { position: relative; padding: 12px 14px; border: 1px solid #eef0f6; border-radius: 11px; background: #fbfbfe; }
.reply-box p { color: #3f4359; font-size: 0.8rem; line-height: 1.65; white-space: pre-wrap; }
.copy-btn { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 0.64rem; font-weight: 700; cursor: pointer; }
.copy-btn:hover { color: var(--brand); border-color: #c9cbf3; }
.copy-btn svg { width: 12px; height: 12px; }

.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }

.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 9px; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 19px; bottom: 0; width: 1px; background: #e8eaf3; }
.timeline li:last-child::before { display: none; }

.tl-dot { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #eef0f8; color: var(--muted); }
.tl-dot svg { width: 11px; height: 11px; }
.tl-dot.ai { background: var(--brand-soft); color: var(--brand); }
.tl-dot.mail { background: var(--blue-soft); color: var(--blue); }
.tl-dot.chat { background: var(--green-soft); color: var(--green); }
.tl-dot.clock { background: var(--amber-soft); color: var(--amber); }
.tl-dot.won { background: #ede9fe; color: #7c3aed; }

.tl-body strong { display: block; font-size: 0.77rem; font-weight: 600; line-height: 1.45; }
.tl-body span { display: block; margin-top: 1px; color: var(--muted-2); font-size: 0.67rem; }

.drawer-actions { display: flex; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); background: #fff; }
.drawer-actions .btn { flex: 1; }

/* Overlay & modal */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 20, 38, 0.45);
  backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease;
}

.modal-overlay { z-index: 120; display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(560px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 1.2rem; }
.modal-head p { margin-top: 4px; color: var(--muted); font-size: 0.8rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field > span { color: #4b5065; font-size: 0.73rem; font-weight: 700; }
.error { min-height: 0.9rem; color: #dc2626; font-size: 0.68rem; font-weight: 600; }

.form-hint { display: flex; align-items: flex-start; gap: 6px; margin-top: 12px; padding: 9px 11px; border-radius: 9px; background: var(--brand-soft); color: #4338ca; font-size: 0.73rem; }
.form-hint svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 140;
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #12182b;
  color: #eef0f8;
  font-size: 0.79rem;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(10, 15, 30, 0.35);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.sidebar-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 15, 30, 0.45); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Responsive */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .bar-chart { height: 150px; }
}

@media (max-width: 980px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 18px 34px; }
}

@media (max-width: 760px) {
  .live-pill { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .workflow-strip { flex-direction: column; align-items: flex-start; }
  .workflow-strip .btn { width: 100%; }
  .table-head { flex-direction: column; align-items: stretch; }
  .table-filters { justify-content: space-between; }
  #status-select { flex: 1; }
  .lead-table th:nth-child(2), .lead-table td:nth-child(2) { display: none; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { height: 60px; gap: 8px; }
  .topbar-right .btn span { display: none; }
  .topbar-right .btn { padding: 9px 11px; }
  .topbar-avatar { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.45rem; }
  .kpi-trend { display: none; }
  .chart-card, .source-card { padding: 16px; }
  .bar-chart { gap: 8px; }
  .lead-table th:nth-child(4), .lead-table td:nth-child(4) { display: none; }
  .lead-table th:first-child, .lead-table td:first-child { padding-left: 14px; }
  .lead-table td { padding: 10px 8px; }
  .lead-cell { min-width: 170px; }
  .lead-cell .avatar { display: none; }
  .priority-chips { padding-inline: 14px; }
  .table-head { padding: 16px 14px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer-scroll { padding: 18px 16px 8px; }
  .drawer-actions { padding: 12px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .drawer { transition: none; }
}
