/* ==========================================================================
   KlientsGrowth CRM — Naviira v7.11 design system, application build.
   Tokens mirror naviira-site/assets/css/v7.11.css exactly.
   Light-first. Brand deep blue #005fa0 (hover LIGHTENS to #0078c8).
   Radius: buttons 12 / cards 16 / panels 24. Spacing on the 4px scale.
   ========================================================================== */

@font-face {
  font-family: 'Geist';
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/geist-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/geist-mono-var.woff2') format('woff2');
}

/* ---------- Tokens: LIGHT (canonical) ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-1: #eef1f8;          /* cool, calm app canvas (matches the shell gradient) */
  --bg-2: #e6eaf3;
  --bg-3: #d9dfec;
  --card: #ffffff;
  --card-2: #f6f8fc;
  --glass: rgba(255, 255, 255, 0.9);
  --line: rgba(30, 41, 59, 0.10);
  --line-2: rgba(30, 41, 59, 0.15);
  --fg: #1a1b1e;
  --fg-2: #3f4147;
  --fg-3: #6a6c72;
  --fg-4: #9a9ba1;
  --blue: #005fa0;
  --blue-hover: #0078c8;
  --blue-ink: #005fa0;
  --green: #16a34a;
  --green-soft: #15803d;
  --red: #e11d48;
  --amber: #b45309;
  --coral: #f97316;
  --violet: #6d5cd3;
  --grad-edge-a: #4c8fe8; --grad-edge-b: #8f7df0;
  --tint-blue: rgba(0, 95, 160, 0.09);
  --tint-green: rgba(22, 163, 74, 0.11);
  --tint-red: rgba(225, 29, 72, 0.09);
  --tint-amber: rgba(180, 83, 9, 0.12);
  --tint-coral: rgba(249, 115, 22, 0.12);
  --tint-violet: rgba(109, 92, 211, 0.12);
  --grad-btn: #005fa0;
  /* Flat, professional depth: borders do the work; shadows are a whisper. */
  --shadow-card: 0 1px 1px rgba(20, 20, 18, 0.03);
  --shadow-float: 0 12px 40px -16px rgba(20, 20, 18, 0.24), 0 2px 8px rgba(20, 20, 18, 0.05);
  --shadow-btn: 0 1px 2px rgba(0, 95, 160, 0.22);
  --glow-soft: 0 2px 12px -6px rgba(20, 20, 18, 0.2);
  --nav-bg: #ffffff;
  --chart-grid: rgba(30, 41, 59, 0.07);
  --canvas: #f6f8fc;
  /* Semantic status palette — one source of truth for outcome/sentiment/warmth
     colors, reused by chips, warmth bars, goals, sentiment & the ESP heatmap. */
  --sc-positive: var(--green); --sc-tint-positive: var(--tint-green);
  --sc-negative: var(--red);   --sc-tint-negative: var(--tint-red);
  --sc-neutral: var(--fg-4);   --sc-tint-neutral: var(--bg-2);
  --sc-warm: var(--amber);     --sc-tint-warm: var(--tint-amber);
  --sc-meeting: var(--violet); --sc-tint-meeting: var(--tint-violet);
  --sc-won: var(--green-soft); --sc-lost: var(--red);
  --r-btn: 0px;
  --r-card: 0px;
  --r-panel: 0px;
  --r-shell: 0px;
  --r-lg: 0px; --r-md: 0px; --r-sm: 0px;
  /* Clean, flat surfaces: neutral canvas → light panel → white cards. */
  --app-bg: #e5e8ef;                 /* canvas behind the shell */
  --shadow-shell: 0 1px 2px rgba(20, 20, 18, 0.05);
  --main-grad: #f5f6f9;              /* sidebar + main panel surface (flat) */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 40px; --s-8: 56px;
  --font: "Geist", -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  --sidebar-w: 236px;
}

/* ---------- Tokens: DARK (supported alternative) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1120;
  --bg-1: #0f1a2e;
  --bg-2: #16233c;
  --bg-3: #1f3050;
  --card: #101c31;
  --card-2: #0f1a2e;
  --glass: rgba(16, 28, 49, 0.85);
  --line: rgba(226, 240, 255, 0.09);
  --line-2: rgba(226, 240, 255, 0.16);
  --fg: #f1f6fc;
  --fg-2: #c3d0e0;
  --fg-3: #8b9cb3;
  --fg-4: #5d6d84;
  --blue-ink: #9ecaff;
  --green: #4ade80;
  --red: #fda4af;
  --amber: #fcd34d;
  --coral: #fdba74;
  --violet: #b4a7ff;
  --grad-edge-a: #5b9bff; --grad-edge-b: #a794ff;
  --tint-blue: rgba(0, 95, 160, 0.22);
  --tint-green: rgba(74, 222, 128, 0.14);
  --tint-red: rgba(253, 164, 175, 0.12);
  --tint-amber: rgba(252, 211, 77, 0.12);
  --tint-coral: rgba(253, 186, 116, 0.12);
  --tint-violet: rgba(180, 167, 255, 0.14);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.22);
  --shadow-float: 0 12px 40px -16px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
  --glow-soft: 0 2px 12px -6px rgba(0, 0, 0, 0.4);
  --nav-bg: #0d1729;
  --chart-grid: rgba(226, 240, 255, 0.06);
  --canvas: #0f1a2e;
  --app-bg: #070c16;                 /* canvas behind the shell */
  --shadow-shell: 0 1px 3px rgba(0, 0, 0, 0.35);
  --main-grad: #0e1728;              /* sidebar + main panel surface (flat) */
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; color: inherit; }

body {
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--fg-2);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100dvh;
}
::selection { background: rgba(0, 95, 160, 0.22); color: var(--fg); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
b, strong { color: var(--fg); font-weight: 600; }
h1, h2, h3, h4 { color: var(--fg); letter-spacing: -0.025em; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Calm, static canvas (professional — no motion) ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--app-bg); background-attachment: fixed; }
.aurora .blob, .aurora .particles, .aurora .p { display: none; }
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Shell: contained canvas with two floating rounded cards ---------- */
.shell { position: relative; z-index: 1; display: flex; gap: var(--s-3); height: 100dvh; padding: var(--s-3); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column; min-height: 0;
  padding: var(--s-4) var(--s-3) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-shell);
  background: var(--main-grad);
  box-shadow: var(--shadow-shell);
  transition: width .22s var(--ease), padding .22s var(--ease);
}

/* ---------- Collapsed sidebar (icons only, tooltips on hover) ---------- */
.sidebar.collapsed { width: 68px; padding-left: 8px; padding-right: 8px; }
.sidebar.collapsed .brand { justify-content: center; padding: 4px 0 var(--s-4); }
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .nav-section { font-size: 0; padding: var(--s-3) 0 var(--s-2); height: 12px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; position: relative; }
.sidebar.collapsed .nav-item > span:not(.badge) { display: none; }
.sidebar.collapsed .nav-item .badge {
  position: absolute; top: 3px; right: 9px; min-width: 15px; padding: 0 4px;
  font-size: 9px; line-height: 15px; text-align: center;
}
.sidebar.collapsed .sidebar-footer { padding-left: 0; padding-right: 0; }
.sidebar.collapsed .sidebar-footer .foot-row { flex-direction: column; gap: 6px; padding: 6px 0; }
.sidebar.collapsed .foot-label { display: none; }
.sidebar.collapsed .user-chip { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .user-text { display: none; }
.sidebar.collapsed #logoutBtn { display: none; }
/* hover tooltip when collapsed */
.sidebar.collapsed [data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  white-space: nowrap; box-shadow: var(--shadow-float);
  opacity: 0; pointer-events: none; transition: opacity .14s var(--ease); z-index: 40;
}
.sidebar.collapsed [data-tip]:hover::after { opacity: 1; }
/* Sidebar toggle lives in the topbar so it's always visible (both states). */
.topbar-collapse { flex: none; }
.topbar-collapse svg { transition: transform .22s var(--ease); }
.topbar-collapse.is-collapsed svg { transform: rotate(180deg); }
.brand { display: flex; align-items: center; gap: 10px; padding: var(--s-1) var(--s-2) var(--s-4); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--blue);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
  box-shadow: var(--shadow-btn);
}
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; flex: none; background: #fff; padding: 2px; box-shadow: var(--shadow-card); }
/* The KlientsGrowth mark SVG is self-contained (its own white rounded field), so
   drop the extra tile padding/background the generic .brand-logo adds. */
.brand-logo.kg-mark { padding: 0; background: transparent; box-shadow: var(--shadow-card); }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; color: var(--fg); }
.brand-sub { font-size: 11px; color: var(--fg-4); margin-top: -2px; }

.nav-groups { display: flex; flex-direction: column; }
.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--fg-4); padding: var(--s-4) var(--s-3) var(--s-2);
}
.nav-section:first-child { padding-top: var(--s-2); }

/* Live-sync pill in the topbar — subtle, premium status cue. */
.ask-ai-btn { flex: none; }
@media (max-width: 1180px) { .ask-ai-btn span { display: none; } }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  color: var(--green); background: var(--tint-green);
}

/* Ask Your CRM chat modal */
.modal.ask-modal { width: min(680px, calc(100vw - 32px)); display: flex; flex-direction: column; max-height: 86dvh; }
.ask-msgs { flex: 1; min-height: 240px; overflow-y: auto; padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 12px; }
.ask-empty { margin: auto; text-align: center; padding: 20px 0; }
.ask-empty-title { color: var(--fg-3); font-size: 13px; margin-bottom: 14px; }
.ask-starters { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ask-starter { font-size: 12.5px; color: var(--fg-2); background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; transition: border-color .13s, background .13s; }
.ask-starter:hover { border-color: var(--blue); background: var(--tint-blue); color: var(--blue-ink); }
.ask-q { align-self: flex-end; max-width: 80%; background: var(--blue); color: #fff; padding: 8px 13px; border-radius: 15px 15px 4px 15px; font-size: 13.5px; line-height: 1.5; }
.ask-a { align-self: flex-start; max-width: 92%; display: flex; flex-direction: column; gap: 8px; }
.ask-answer { background: var(--card-2); border: 1px solid var(--line); padding: 11px 14px; border-radius: 15px 15px 15px 4px; font-size: 13.5px; line-height: 1.55; color: var(--fg-2); }
.ask-answer .ask-line { margin: 0 0 4px; }
.ask-answer .ask-line:last-child { margin-bottom: 0; }
.ask-answer .ask-line b, .ask-answer .ask-ul b { color: var(--fg); }
.ask-answer .ask-ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.ask-answer .ask-ul li { font-size: 13px; }
.ask-err { background: var(--tint-coral); color: var(--coral); padding: 9px 13px; border-radius: 12px; font-size: 12.5px; }
.ask-a .spinner { margin-right: 8px; }
.ask-data { font-size: 12px; }
.ask-data summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; font-size: 11.5px; padding: 2px 0; }
.ask-data .table-wrap { margin-top: 8px; max-height: 260px; overflow: auto; }
.ask-data .tbl th, .ask-data .tbl td { font-size: 11.5px; padding: 5px 9px; }
.ask-input-row { display: flex; gap: 8px; padding: var(--s-3) var(--s-5) var(--s-5); border-top: 1px solid var(--line); flex: none; }
.ask-input-row .input { flex: 1; }
.ask-input-row .btn.primary { flex: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
@media (prefers-reduced-motion: no-preference) { .live-dot { animation: live-pulse 2.2s infinite; } }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70% { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (max-width: 980px) { .live-pill { display: none; } }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px var(--s-3); border-radius: var(--r-btn); color: var(--fg-3);
  font-weight: 500; font-size: 13.5px; text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease);
  margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--tint-blue); color: var(--fg); }
.nav-item.active { background: var(--tint-blue); color: var(--blue-ink); font-weight: 650; }
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 650;
  background: var(--blue); color: #fff; padding: 1px 7px; border-radius: 999px;
}
.sidebar-footer { margin-top: auto; padding: var(--s-2) var(--s-2) 0; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: var(--s-2) var(--s-1); }
.user-chip .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.user-chip .u-name { font-size: 12.5px; font-weight: 650; color: var(--fg); }
.user-chip .u-mail { font-size: 10.5px; color: var(--fg-4); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2.6s infinite; flex: none; }
.sync-dot.err { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-shell);
  background: var(--main-grad);
  box-shadow: var(--shadow-shell);
  overflow: hidden;   /* clip the scrolling content to the panel */
}

.topbar {
  display: flex; align-items: center; gap: var(--s-3); flex: none;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  background: transparent;
  min-height: 70px;
}
.page-title { font-size: 21px; font-weight: 750; letter-spacing: -0.03em; color: var(--fg); line-height: 1.15; }
.page-sub { font-size: 12.5px; color: var(--fg-3); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
/* The page-tab seg sits inline in the topbar on desktop (display:contents = no extra box);
   on mobile it drops to its own full-width, horizontally-scrollable row so it never
   crowds the title, search, or notification bell. */
.topbar-seg-slot { display: contents; }

.searchbar {
  display: flex; align-items: center; gap: 8px;
  min-width: 200px; max-width: 380px; flex: 1 1 300px; height: 40px; padding: 0 12px;
  border-radius: var(--r-btn); border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-4); font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.searchbar:hover { border-color: var(--line-2); background: var(--card-2); }
.searchbar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchbar svg { width: 15px; height: 15px; flex: none; }
.searchbar kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--fg-4);
}

.content { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-5) var(--s-5) var(--s-8); }
.content.no-pad { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.content.no-pad > .page-enter { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.page-enter { animation: page-in .32s var(--ease); }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  border-radius: var(--r-card);
  border: 1px solid var(--line-2);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}

/* Flat cards are defined by their border alone — the animated glow edge was
   removed for a cleaner, calmer surface. */

.bulk-assign-bar { display: flex; align-items: center; gap: 10px; padding: 10px var(--s-4); border-bottom: 1px solid var(--line); background: var(--card-2); flex-wrap: wrap; }
.bulk-assign-all { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--fg-2); cursor: pointer; }
.bulk-assign-bar input[type="checkbox"], .ua-check { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.card.panel { border-radius: var(--r-panel); }
.card.hoverable:hover { border-color: var(--fg-4); transform: translateY(-1px); }
/* Aligned, comparable numbers everywhere they carry meaning. */
.tbl td.num, .tbl th.num, .num, .c-score, .warmth, .kv .v { font-variant-numeric: tabular-nums; }
.card-pad { padding: var(--s-4) var(--s-4); }
.card-title { font-size: 12.5px; font-weight: 650; color: var(--fg-3); letter-spacing: 0; }

/* ---------- Buttons (Naviira: 12px radius, brand blue, hover lightens) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-btn);
  font-weight: 600; letter-spacing: -0.01em;
  padding: 8px 18px; font-size: 13.5px;
  border: 1px solid var(--line-2);
  background: var(--card); color: var(--fg);
  transition: transform .2s var(--ease), box-shadow .25s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
  position: relative; overflow: hidden; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { border-color: var(--line-2); background: var(--bg-1); box-shadow: none; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--grad-btn); border-color: transparent; color: #fff; box-shadow: var(--shadow-btn); }
.btn.primary:hover { background: var(--blue-hover); box-shadow: var(--shadow-btn); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--fg-3); }
.btn.ghost:hover { color: var(--fg); background: var(--tint-blue); transform: none; box-shadow: none; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.icon { padding: 7px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.icon.on { color: var(--blue-ink); }
.btn .spinner { width: 13px; height: 13px; }
.btn.ai {
  background: var(--tint-blue); border-color: transparent; color: var(--blue-ink);
  box-shadow: none;
}
.btn.ai:hover { border-color: var(--blue); background: var(--tint-blue); box-shadow: none; }

/* ---------- Inputs ---------- */
.input, .select, textarea.input {
  width: 100%; padding: 8px 12px;
  border-radius: var(--r-btn); border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--fg); font-size: 13px; outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--tint-blue);
}
.input::placeholder { color: var(--fg-4); }
.select { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type="date"].input { font-family: var(--font); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 550; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-2); color: var(--fg-3); white-space: nowrap;
  border: 1px solid transparent;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.green { background: var(--tint-green); color: var(--green); }
.chip.amber { background: var(--tint-amber); color: var(--amber); }
.chip.coral { background: var(--tint-coral); color: var(--coral); }
.chip.red { background: var(--tint-red); color: var(--red); }
.chip.violet { background: var(--tint-violet); color: var(--violet); }
.chip.blue { background: var(--tint-blue); color: var(--blue-ink); }
.chip.dashed { background: transparent; border: 1px dashed var(--line-2); color: var(--fg-4); cursor: pointer; }
.chip.dashed:hover { color: var(--blue-ink); border-color: var(--blue); }
.chip .x { display: grid; place-items: center; opacity: .55; margin-left: 1px; cursor: pointer; }
.chip .x:hover { opacity: 1; }
.chip .x svg { width: 9px; height: 9px; }
.chip svg { width: 11px; height: 11px; flex: none; }
.ico-xs svg { width: 12px; height: 12px; vertical-align: -2px; }
/* Consistent search field (icon + input) */
.search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.search-field > svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--fg-4); pointer-events: none; flex: none; }
.search-field .input { padding-left: 34px; width: 100%; }
/* Clients card grid (flat, matches reference) */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.client-card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg, 14px); padding: 16px; cursor: pointer; transition: border-color .16s, transform .16s; }
.client-card:hover { border-color: var(--fg-4); transform: translateY(-1px); }
.client-card .client-head { display: flex; align-items: center; gap: 11px; }
.client-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.client-stats .cs-k { font-size: 10.5px; color: var(--fg-4); }
.client-stats .cs-v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--fg); margin-top: 1px; }
/* Relationships card grid */
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding: 2px; }
.rel-card { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-lg, 14px); padding: 14px; cursor: pointer; transition: box-shadow .16s, border-color .16s, transform .16s; display: flex; flex-direction: column; gap: 10px; }
.rel-card:hover { border-color: var(--line); box-shadow: 0 6px 20px rgba(20, 20, 43, .07); transform: translateY(-1px); }
.rel-card-top { display: flex; align-items: center; gap: 10px; }
.rel-card-id { flex: 1; min-width: 0; }
.rel-card-id b { font-size: 14px; color: var(--fg); display: block; }
.rel-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rel-card-focus { font-size: 12.5px; color: var(--fg-2); line-height: 1.5; }
.rel-card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.rel-link { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; color: var(--fg-4); background: var(--bg-2); }
.rel-link:hover { color: var(--blue-ink); background: var(--tint-blue); }
.rel-link svg { width: 14px; height: 14px; }
.warm-dots { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.warm-dots .wd { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.warm-dots .wd.on { background: var(--green); }
.warm-dots .warm-num { font-size: 10px; color: var(--fg-4); margin-left: 5px; font-variant-numeric: tabular-nums; }
/* Pipeline row quick action (revealed on hover) */
.pipe-act { text-align: right; padding-right: 10px !important; }
.pipe-act .btn { opacity: 0; transition: opacity .14s var(--ease); }
.tbl tbody tr:hover .pipe-act .btn, .tbl tbody tr:focus-within .pipe-act .btn { opacity: 1; }
@media (hover: none) { .pipe-act .btn { opacity: 1; } }
/* Pipeline stage tabs */
.stage-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: var(--s-4) var(--s-5) var(--s-3); }
.stage-tab { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--fg-3); font-size: 12.5px; font-weight: 550; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.stage-tab:hover { background: var(--bg-2); color: var(--fg); }
.stage-tab.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.stage-tab .k-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.stage-tab.active .k-dot { outline: 1.5px solid var(--bg); }
.stage-tab-n { font-variant-numeric: tabular-nums; font-size: 11px; opacity: .7; }
/* OpenRouter model picker */
.or-selected { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); font-size: 12.5px; color: var(--fg); }
.or-selected .or-id { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }
.or-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 8px; margin-top: 8px; }
.or-list:empty { display: none; }
.or-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 8px 11px; background: none; border: none; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.or-row:last-child { border-bottom: none; }
.or-row:hover { background: var(--bg-2); }
.or-row.active { background: var(--tint-blue); }
.or-row .or-name { font-weight: 550; font-size: 12.5px; color: var(--fg); }
.or-row .or-id { font-family: var(--mono); font-size: 10.5px; color: var(--fg-4); white-space: nowrap; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, var(--av-c1, #4c8fe8), var(--av-c2, #6d5cd3));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
:root[data-theme="dark"] .avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }

/* ---------- Skeletons ---------- */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--bg-2); border-radius: 8px; min-height: 12px;
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shimmer 1.4s infinite;
  transform: translateX(-100%);
}
:root[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(226, 240, 255, 0.07), transparent);
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Metrics ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: var(--s-4); }
.metric { padding: var(--s-4) var(--s-4) var(--s-3); display: flex; flex-direction: column; min-width: 0; }
.metric .m-label { font-size: 11.5px; font-weight: 650; color: var(--fg-3); }
.metric .m-value { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--fg); line-height: 1.15; }
.metric .m-foot { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 11.5px; color: var(--fg-4); min-height: 17px; }
.metric .m-trend { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.metric .m-trend.up { color: var(--green); }
.metric .m-trend.down { color: var(--red); }
.metric .m-trend.flat { color: var(--fg-4); }
.metric .m-spark { margin-top: var(--s-2); align-self: stretch; }
.metric .m-spark svg { width: 100%; }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s-4); margin-top: var(--s-5); }
.chart-card { grid-column: span 6; min-width: 0; }
.chart-card.third { grid-column: span 4; }
.chart-card.full { grid-column: span 12; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-1); flex-wrap: wrap; }
.chart-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--fg); }
.chart-body { padding: var(--s-1) var(--s-3) var(--s-3); min-width: 0; }
.chart-body svg { display: block; width: 100%; height: auto; }
.chart-tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-float);
  padding: 8px 11px; font-size: 12px; line-height: 1.45; min-width: 110px;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip .t-date { color: var(--fg-4); font-size: 10.5px; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: var(--s-3); flex-wrap: wrap; padding: 0 var(--s-4) var(--s-3); font-size: 11px; color: var(--fg-3); }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.donut-note {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--line);
  font-size: 12px; color: var(--fg-3);
}
.donut-note i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.donut-note b { color: var(--fg); font-variant-numeric: tabular-nums; }
.donut-note .muted { font-size: 11px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-card); min-width: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: none; color: var(--fg-3);
  padding: 13px var(--s-4); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 2;
}
.tbl td { padding: 15px var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .14s var(--ease); }
.tbl tbody tr:hover { background: var(--card-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }
.tbl .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- Filter bar / tabs / segments ---------- */
.filterbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-4); }
.filterbar .select { width: auto; min-width: 132px; }
.filterbar .input { width: 220px; }
.filterbar .spacer { flex: 1; }
.filterbar .dates { display: flex; align-items: center; gap: 6px; }
.filterbar .dates .input { width: 138px; }

.seg { display: inline-flex; align-items: center; padding: 3px; gap: 2px; border-radius: var(--r-btn); background: var(--bg-2); border: 1px solid var(--line); }
.seg button { padding: 5px 13px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--fg-3); white-space: nowrap; transition: all .16s var(--ease); }
.seg button.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }

/* ---------- Inbox 3-panel (every pane min-height:0 so nothing overflows) ---------- */
/* Two columns — list + a wide thread/composer. Lead intel is an on-demand drawer
   (below), so the conversation and composer get the full remaining width. */
.inbox-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); flex: 1; min-height: 0; }
.inbox-list {
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  min-width: 0; min-height: 0; background: var(--card-2);
}
.inbox-list-head { padding: var(--s-3) var(--s-3) var(--s-2); flex: none; }
.inbox-search-row { display: flex; gap: 6px; align-items: center; }
.inbox-search-row .input { flex: 1; min-width: 0; }
#filtersToggle { flex: none; }
#filtersToggle.on { background: var(--tint-blue); color: var(--blue-ink); }
.inbox-advanced { margin-top: 8px; }
.inbox-advanced[hidden] { display: none; }
.inbox-selects { display: flex; gap: 6px; }
.inbox-selects .select { flex: 1; min-width: 0; padding: 6px 26px 6px 10px; font-size: 12px; border-radius: 9px; }
.inbox-filters { display: flex; gap: 5px; padding: 2px var(--s-3) var(--s-2); overflow-x: auto; scrollbar-width: none; flex: none; }
.inbox-filters::-webkit-scrollbar { display: none; }
.inbox-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.convo {
  display: flex; gap: 11px; padding: 12px var(--s-4); cursor: pointer;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  transition: background .14s var(--ease);
}
.convo:hover { background: var(--bg-2); }
.convo.active { background: var(--tint-blue); border-left-color: var(--blue); }
.convo .c-body { flex: 1; min-width: 0; }
.convo .c-top { display: flex; align-items: baseline; gap: 8px; }
.convo .c-name { font-weight: 650; font-size: 14px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.convo.unread .c-name::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: 1px; }
.convo .c-time { margin-left: auto; font-size: 10.5px; color: var(--fg-4); white-space: nowrap; flex: none; }
.convo .c-mail { font-family: var(--mono); font-size: 11px; color: var(--fg-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.convo .c-subj { font-size: 12.5px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.convo.unread .c-subj { font-weight: 600; color: var(--fg-2); }
.convo .c-tags { display: flex; align-items: center; gap: 6px; margin-top: 7px; overflow: hidden; }
.convo .c-tags .chip { flex: none; height: 19px; font-size: 10px; padding: 0 8px; }
.convo .c-campaign { font-size: 10.5px; color: var(--fg-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.convo .c-campaign::before { content: ''; }
.convo .c-prev { font-size: 11.5px; color: var(--fg-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
/* Minimal card meta: a single quiet status signal (dot + label), no chip pill. */
.convo .c-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.c-stage { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 550; color: var(--fg-3); }
.c-stage-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.c-score { font-size: 10.5px; font-weight: 700; color: var(--fg-3); background: var(--bg-2); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.c-star { color: var(--amber); flex: none; display: inline-flex; }
.c-star svg { width: 12px; height: 12px; fill: var(--amber); }
.convo .c-time svg { width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; opacity: .6; }

.thread-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-1); }
.thread-head {
  display: flex; align-items: center; gap: var(--s-3); flex: none;
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line);
  background: var(--card-2); min-width: 0;
}
.thread-head .th-info { min-width: 0; flex: 1; }
.thread-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.thread-more { display: inline-flex; }   /* the More menu is always the home for secondary actions */
.thread-actions .tb-txt { margin-left: 5px; }

/* The thread pane's width is independent of the viewport — the intel pane can
   squeeze it to ~330px on a wide screen. Query the pane itself so the action bar
   never overflows the contact name (which was the Reply-button-over-name bug). */
.thread-pane { container-type: inline-size; }
@container (max-width: 620px) {
  .thread-head .th-info .chip { display: none; }   /* stage is in the list + intel */
  .thread-actions .tb-txt { display: none; }       /* icon-only Details when the pane is tight */
}
.thread-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-6) var(--s-6) var(--s-5); display: flex; flex-direction: column; gap: 6px; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }

/* Day separator (iMessage-style centered pill) */
.day-sep { align-self: center; margin: var(--s-3) 0 var(--s-2); }
.day-sep span {
  font-size: 10.5px; font-weight: 650; color: var(--fg-4);
  background: var(--bg-2); padding: 3px 12px; border-radius: 999px; letter-spacing: .02em;
}

/* Message row */
.msg { max-width: min(76%, 640px); min-width: 0; display: flex; flex-direction: column; animation: msg-in .26s var(--ease); }
.msg.in { align-self: flex-start; align-items: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg:not(.grouped-prev) { margin-top: var(--s-3); }
.msg.grouped-prev { margin-top: 0; }

.m-who { font-size: 11px; font-weight: 650; color: var(--fg-3); margin: 0 10px 3px; }
.m-time { font-size: 10px; color: var(--fg-4); margin: 3px 10px 0; }

.m-bubble {
  padding: 11px 15px; border-radius: 17px;
  font-size: 14px; line-height: 1.62; color: var(--fg-2);
  overflow-wrap: break-word; word-break: break-word; overflow: hidden; max-width: 100%;
}
.msg.in .m-bubble { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.msg.out .m-bubble { background: var(--blue); color: #fff; }
:root[data-theme="dark"] .msg.out .m-bubble { background: #1a54a0; }
.msg.in.grouped-prev .m-bubble { border-top-left-radius: 7px; }
.msg.in.grouped-next .m-bubble { border-bottom-left-radius: 7px; }
.msg.out.grouped-prev .m-bubble { border-top-right-radius: 7px; }
.msg.out.grouped-next .m-bubble { border-bottom-right-radius: 7px; }

.m-content > *:first-child { margin-top: 0; }
.m-content > *:last-child { margin-bottom: 0; }
.m-content p { margin: 0 0 8px; }
.m-content p:last-child { margin-bottom: 0; }
.m-content ul, .m-content ol { margin: 6px 0 6px 18px; }
.m-content li { margin: 2px 0; }
.m-bubble a { color: var(--blue-ink); text-decoration: underline; text-underline-offset: 2px; }
.msg.out .m-bubble a { color: #eaf3ff; }
.m-bubble img { max-width: 100%; height: auto; border-radius: 10px; margin: 4px 0; }
/* Attachment previews inside an outgoing bubble (images sent as real attachments). */
.m-attachs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.m-attach-img { max-width: 180px; max-height: 180px; border-radius: 10px; object-fit: cover; display: block; }
.m-attach-file { background: rgba(255, 255, 255, .18); color: #fff; border: none; }
.m-bubble blockquote { border-left: 2px solid var(--line-2); margin: 6px 0; padding-left: 10px; color: var(--fg-4); }
.msg.out .m-bubble blockquote { border-color: rgba(255,255,255,.35); color: rgba(255,255,255,.8); }

/* Collapsed signature / quoted-history toggles */
.m-toggle {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 7px;
  font-size: 11px; font-weight: 600; color: var(--fg-4);
  padding: 2px 9px; border-radius: 999px; border: 1px dashed var(--line-2);
  transition: color .15s, border-color .15s;
}
.m-toggle svg { width: 11px; height: 11px; }
.m-toggle:hover { color: var(--blue-ink); border-color: var(--blue); }
.msg.out .m-toggle { color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.4); }
.msg.out .m-toggle:hover { color: #fff; border-color: #fff; }
.m-toggle.open { border-style: solid; }
.m-sig, .m-quoted {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2);
  font-size: 12.5px; color: var(--fg-3);
}
.msg.out .m-sig, .msg.out .m-quoted { border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.85); }
.m-sig img, .m-quoted img { max-width: 100%; border-radius: 8px; }
.m-quoted { color: var(--fg-4); font-size: 12px; }

/* Optimistic send states */
.msg.sending .m-bubble { opacity: .72; }
.msg.sending.failed .m-bubble { opacity: 1; outline: 1px solid var(--red); }
.send-state { display: flex; align-items: center; gap: 6px; }
.link-btn { font-size: 10.5px; font-weight: 650; color: var(--blue-ink); }
.link-btn:hover { text-decoration: underline; }

/* ---------- Composer ---------- */
.composer {
  border-top: 1px solid var(--line); flex: none;
  padding: var(--s-3) var(--s-5) var(--s-4);
  background: var(--card-2);
}
/* Unified composer card: toolbar sits atop the editor inside one bordered box. */
.composer-box {
  border: 1px solid var(--line-2); border-radius: var(--r-card); background: var(--card);
  overflow: hidden; transition: border-color .16s, box-shadow .16s;
}
.composer-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--tint-blue); }

/* AI summary popup */
.aisum-top { display: flex; align-items: center; gap: 16px; padding: 2px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.aisum-sec { margin-bottom: 14px; }
.aisum-sec:last-of-type { margin-bottom: 0; }
.aisum-sec h4 { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 5px; }
.aisum-sec p { font-size: 13px; line-height: 1.55; color: var(--fg-2); }
.aisum-sec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.aisum-sec li { font-size: 13px; line-height: 1.5; color: var(--fg-2); }
/* Lead-intel drawer header */
.intel-drawer-head { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--fg); margin: 0 0 var(--s-3); }

/* Sidebar collapse toggle — bigger tap target, pulled toward the sidebar edge. */
.topbar-collapse { flex: none; width: 40px; height: 40px; margin-left: -6px; border-radius: 11px; }
.topbar-collapse svg { width: 21px; height: 21px; }
/* Small by default so the conversation gets the room; grows with the text you write. */
.composer .editor {
  width: 100%; min-height: 60px; max-height: 300px; overflow-y: auto;
  border: none; border-radius: 0; background: transparent;
  padding: var(--s-3) var(--s-4); font-size: 14px; line-height: 1.6; outline: none;
  color: var(--fg-2);
}
.thread-actions-hidden, .composer-hidden { display: none !important; }
.composer .editor:empty::before { content: attr(data-placeholder); color: var(--fg-4); pointer-events: none; }
.composer-format {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--card-2);
}
.composer-format .btn.icon { padding: 5px; border-radius: 8px; }
.composer-format .divider { width: 1px; height: 16px; background: var(--line-2); margin: 0 6px; }
.composer-tools { display: flex; align-items: center; gap: 6px; margin-top: var(--s-2); flex-wrap: wrap; }
.composer-tools .from { font-size: 11px; color: var(--fg-4); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.attach-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--s-2); }
.draft-banner {
  display: flex; align-items: center; gap: 8px; margin-bottom: var(--s-2);
  padding: 7px 11px; border-radius: 10px; font-size: 12px; font-weight: 600;
  background: var(--tint-blue); color: var(--blue-ink);
}
.draft-banner span { display: flex; align-items: center; gap: 6px; }
.draft-banner svg { width: 13px; height: 13px; }
.draft-banner .link-btn { margin-left: auto; }

/* ---------- Intel pane ---------- */
/* Lead-intel panel: a right slide-in drawer, opened from the thread header.
   Keeps the conversation + composer full-width until you actually want the detail. */
.intel-pane {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(380px, 92vw); transform: translateX(102%);
  transition: transform .3s var(--ease);
  border-left: 1px solid var(--line); overflow-y: auto;
  padding: 52px var(--s-4) var(--s-6); background: var(--card);
  box-shadow: var(--shadow-float);
}
.intel-pane.open { transform: translateX(0); }
.intel-scrim {
  position: fixed; inset: 0; z-index: 59; background: rgba(15, 23, 42, .28);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
  backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
}
.intel-scrim.open { opacity: 1; pointer-events: auto; }
:root[data-theme="dark"] .intel-scrim { background: rgba(4, 8, 16, .5); }
.intel-close {
  display: grid; position: fixed; top: 12px; right: 12px; z-index: 61;
  width: 34px; height: 34px; border-radius: 50%; place-items: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card);
}
.intel-close svg { width: 16px; height: 16px; }
.intel-block { margin-bottom: var(--s-4); }
.intel-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-4); margin-bottom: var(--s-2); display: flex; align-items: center; gap: 6px;
}
.intel-title svg { width: 13px; height: 13px; }
.intel-title .right { margin-left: auto; }
.intel-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-3); font-size: 12.5px; box-shadow: var(--shadow-card); }
.score-ring { position: relative; width: 62px; height: 62px; flex: none; }
.score-ring .s-val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--fg); }
.kv { display: flex; justify-content: space-between; gap: var(--s-2); padding: 4px 0; font-size: 12.5px; }
.kv .k { color: var(--fg-4); flex: none; }
.kv .v { font-weight: 600; color: var(--fg); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: var(--s-3); overflow-x: auto; flex: 1; min-height: 0; padding: var(--s-4) var(--s-5) var(--s-5); align-items: stretch; }
.kcol { min-width: 268px; width: 268px; flex: none; display: flex; flex-direction: column; min-height: 0; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: var(--s-1) var(--s-2) var(--s-2); flex: none; }
.kcol-head .k-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.kcol-head .k-name { font-size: 12.5px; font-weight: 700; color: var(--fg); }
.kcol-head .k-count { font-size: 11px; color: var(--fg-4); background: var(--bg-2); padding: 0 7px; border-radius: 999px; }
.kcol-body {
  display: flex; flex-direction: column; gap: var(--s-2);
  flex: 1; min-height: 60px; overflow-y: auto;
  padding: 3px 3px var(--s-3); border-radius: var(--r-card);
  transition: background .18s;
}
.kcol-body.dragover { background: var(--tint-blue); outline: 2px dashed var(--blue); outline-offset: -2px; }
.kcard { padding: var(--s-3); cursor: grab; user-select: none; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; transform: rotate(2deg) scale(.98); }
.kcard.settle { animation: kanban-settle .34s var(--ease); }
@keyframes kanban-settle {
  0% { transform: scale(1.04); box-shadow: 0 10px 26px rgba(0, 0, 0, .18); }
  60% { transform: scale(.99); }
  100% { transform: scale(1); box-shadow: none; }
}
.kcard .k-lead { font-weight: 650; font-size: 13px; color: var(--fg); display: flex; align-items: center; gap: 7px; min-width: 0; }
.kcard .k-lead span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .k-co { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .k-meta { display: flex; align-items: center; gap: 5px; margin-top: var(--s-2); flex-wrap: wrap; }
.kcard .k-foot { display: flex; align-items: center; gap: 8px; margin-top: var(--s-2); font-size: 10.5px; color: var(--fg-4); }
.kcard .k-score { margin-left: auto; font-weight: 750; font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- Modal / drawer / palette ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: grid; place-items: center;
  animation: fade-in .18s var(--ease);
}
:root[data-theme="dark"] .overlay { background: rgba(4, 8, 16, .6); }
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: 86dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow-float);
  animation: modal-in .26s var(--ease);
}
.modal.wide { width: min(680px, calc(100vw - 32px)); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: var(--s-4) var(--s-5) 0; }
.modal-head h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-head svg { width: 16px; height: 16px; }
.modal-body { padding: var(--s-3) var(--s-5) var(--s-5); }
.modal .x { margin-left: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(470px, 94vw);
  background: var(--card); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-float);
  animation: drawer-in .3s var(--ease);
  display: flex; flex-direction: column; min-height: 0;
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); border-bottom: 1px solid var(--line); flex: none; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-4) var(--s-4) var(--s-6); }

.field { margin-bottom: var(--s-3); }
.field label { display: block; font-size: 11.5px; font-weight: 650; color: var(--fg-3); margin-bottom: 5px; }
.field-row { display: flex; gap: var(--s-3); }
.field-row .field { flex: 1; min-width: 0; }

.opt-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.opt-pills button {
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line-2); color: var(--fg-3); background: var(--card);
  transition: all .15s var(--ease);
}
.opt-pills button:hover { border-color: var(--blue); color: var(--fg); }
.opt-pills button.active { background: var(--tint-blue); border-color: var(--blue); color: var(--blue-ink); }

.palette {
  width: min(600px, calc(100vw - 32px)); align-self: start; margin-top: 12vh;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow-float); overflow: hidden;
  animation: modal-in .22s var(--ease);
}
.palette input {
  width: 100%; padding: var(--s-4) var(--s-5); font-size: 15px; background: transparent; border: none; outline: none;
  border-bottom: 1px solid var(--line); color: var(--fg);
}
.palette-results { max-height: 46dvh; overflow-y: auto; padding: 7px; }
.p-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-btn); cursor: pointer; min-width: 0; }
.p-item:hover, .p-item.sel { background: var(--tint-blue); }
.p-item .p-type {
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; background: var(--bg-2); color: var(--fg-3); flex: none;
}
.p-item .p-title { font-size: 13px; font-weight: 550; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.p-item .p-sub { font-size: 11px; color: var(--fg-4); white-space: nowrap; flex: none; }
.p-item .p-kbd { font-family: var(--mono); font-size: 10px; color: var(--fg-4); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; flex: none; }
.p-item.sel .p-kbd { border-color: var(--blue); color: var(--blue-ink); }
/* Command palette (Raycast/Linear-style) */
.cmdk-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-search > svg { width: 17px; height: 17px; color: var(--fg-4); flex: none; }
.cmdk-search input { flex: 1; min-width: 0; padding: 0; font-size: 15px; background: transparent; border: none; outline: none; color: var(--fg); }
.cmdk-search .cmdk-esc { font-family: var(--mono); font-size: 10px; color: var(--fg-4); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; flex: none; }
.cmdk-head { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-4); padding: 10px 12px 4px; }
.cmdk-head:first-child { padding-top: 4px; }
.cmdk-empty { padding: 26px 16px; text-align: center; color: var(--fg-4); font-size: 13px; }
.cmdk-empty kbd { font-family: var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-float);
  padding: 11px 15px; font-size: 13px; min-width: 240px; max-width: 380px;
  animation: toast-in .3s var(--ease); color: var(--fg-2);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }
.toast.out { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.ok .t-dot { background: var(--green); }
.toast.err .t-dot { background: var(--red); }
.toast.info .t-dot { background: var(--blue); }
.toast .undo { margin-left: auto; color: var(--blue-ink); font-weight: 700; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-2); border-top-color: var(--blue);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: var(--s-8) var(--s-5); color: var(--fg-4); }
.empty .e-icon {
  width: 44px; height: 44px; margin: 0 auto var(--s-3); border-radius: 14px;
  background: var(--tint-blue); color: var(--blue-ink);
  display: grid; place-items: center;
}
.empty .e-icon svg { width: 21px; height: 21px; }
.empty .e-title { font-weight: 700; color: var(--fg); font-size: 14.5px; }
.empty .e-sub { font-size: 12.5px; margin-top: 3px; max-width: 340px; margin-left: auto; margin-right: auto; }
/* Compact inline empty (section-level, not full-page). */
.autom-empty { padding: 16px; border: 1px dashed var(--line-2); background: var(--card); color: var(--fg-3); font-size: 12.5px; line-height: 1.5; }
/* Contract share modal */
.share-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 16px; }
.share-col { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; }
.share-col input { width: 15px; height: 15px; accent-color: var(--blue); flex: none; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); }
/* Automations: on-page engine bar + per-family cards */
.autom-engine-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.autom-engine-ctl { display: flex; align-items: center; gap: 16px; flex: none; }
.atoggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--fg-2); cursor: pointer; }
.atoggle input[type="checkbox"] { width: 38px; height: 21px; appearance: none; background: var(--bg-3); position: relative; cursor: pointer; transition: background .2s var(--ease); flex: none; }
.atoggle input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.atoggle input[type="checkbox"]:checked { background: var(--blue); }
.atoggle input[type="checkbox"]:checked::after { transform: translateX(17px); }
.autom-families { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.afam { display: flex; flex-direction: column; gap: 8px; }
.afam.is-off { opacity: .62; }
.afam-head { display: flex; align-items: center; gap: 10px; }
.afam-ico { display: grid; place-items: center; width: 30px; height: 30px; background: var(--tint-blue); color: var(--blue-ink); flex: none; }
.afam-ico svg { width: 16px; height: 16px; }
.afam-name { font-weight: 650; font-size: 13.5px; color: var(--fg); flex: 1; min-width: 0; }
.afam-desc { font-size: 12px; color: var(--fg-3); line-height: 1.5; }
.afam-count { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; margin-top: auto; padding-top: 2px; }

/* ---------- Utilities ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.muted { color: var(--fg-4); font-size: 12px; }
.mono { font-family: var(--mono); }
.mt8 { margin-top: var(--s-2); } .mt12 { margin-top: var(--s-3); } .mt16 { margin-top: var(--s-4); } .mt20 { margin-top: 20px; }
.icon-sm { width: 18px; height: 18px; flex: none; color: var(--fg-4); display: inline-grid; }
.icon-sm svg { width: 100%; height: 100%; }
.health-bar { height: 5px; border-radius: 4px; background: var(--bg-2); overflow: hidden; min-width: 60px; }
.health-bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s var(--ease); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line-2); }
.tl-item { position: relative; padding: 0 0 var(--s-4); }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--fg-4);
}
.tl-item.in::before { border-color: var(--green); background: var(--tint-green); }
.tl-item.out::before { border-color: var(--blue); background: var(--tint-blue); }
.tl-item.note::before { border-color: var(--amber); background: var(--tint-amber); }
.tl-item.stage::before { border-color: var(--violet); background: var(--tint-violet); }
.tl-time { font-size: 10.5px; color: var(--fg-4); }
.tl-title { font-size: 13px; font-weight: 650; color: var(--fg); margin-top: 1px; }
.tl-body { font-size: 12px; color: var(--fg-3); margin-top: 2px; overflow-wrap: break-word; }

/* ---------- Contact 360 page ---------- */
.contact-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.contact-hero { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); min-width: 0; }
.contact-hero .avatar { width: 52px; height: 52px; font-size: 18px; border-radius: 16px; }
.contact-hero h2 { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s-4); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--fg-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color .15s var(--ease);
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--blue-ink); border-color: var(--blue); font-weight: 700; }
.tab .count { font-size: 10.5px; background: var(--bg-2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; color: var(--fg-3); }

/* ---------- Mobile bottom sheet (nav overflow + account/logout) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
  animation: fade-in .18s var(--ease);
}
:root[data-theme="dark"] .sheet-overlay { background: rgba(4, 8, 16, .6); }
.sheet {
  width: 100%; max-height: 82dvh; overflow-y: auto;
  background: var(--card); border-radius: var(--r-panel) var(--r-panel) 0 0;
  padding: var(--s-2) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-float);
  animation: sheet-up .26s var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-grab { width: 38px; height: 4px; border-radius: 99px; background: var(--line-2); margin: var(--s-2) auto var(--s-3); }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 8px; border-radius: var(--r-btn);
  font-size: 14.5px; font-weight: 600; color: var(--fg-2); text-align: left;
}
.sheet-item:active { background: var(--tint-blue); }
.sheet-item svg { width: 19px; height: 19px; flex: none; }
.sheet-item.active { color: var(--blue-ink); background: var(--tint-blue); }
.sheet-item.danger { color: var(--red); }
.sheet-item .badge { margin-left: auto; background: var(--blue); color: #fff; font-size: 10.5px; font-weight: 650; padding: 1px 7px; border-radius: 999px; }
.sheet-sep { height: 1px; background: var(--line); margin: var(--s-2) 0; }
.sheet-user { display: flex; align-items: center; gap: 11px; padding: var(--s-2) 8px var(--s-3); }

/* ---------- Auth screen ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: var(--s-5);
  background:
    radial-gradient(120% 80% at 75% -10%, rgba(181, 220, 252, 0.6), transparent 55%),
    radial-gradient(90% 70% at 5% 105%, rgba(22, 163, 74, 0.08), transparent 60%),
    var(--bg-1);
}
:root[data-theme="dark"] .auth-screen {
  background:
    radial-gradient(120% 80% at 75% -10%, rgba(18, 50, 82, 0.9), transparent 58%),
    var(--bg-1);
}
.auth-card { width: min(400px, 100%); padding: var(--s-6) var(--s-6) var(--s-5); border-radius: var(--r-panel); }
.auth-title { font-size: 17px; font-weight: 700; text-align: center; color: var(--fg); }
.auth-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 2px 0 10px; }

/* ---------- New: chips with icons, SLA ---------- */
.chip svg { width: 11px; height: 11px; flex: none; }
.chip.sla { gap: 3px; font-variant-numeric: tabular-nums; padding: 2.5px 8px; }
.chip.sla svg { width: 10px; height: 10px; opacity: .7; }
/* Meta-row chips are compact — scale their icons down to match the 9.5px text. */
.c-meta .chip { gap: 3px; height: 18px; }
.c-meta .chip svg { width: 9px; height: 9px; }
.c-meta .chip .dot { width: 5px; height: 5px; }

/* ---------- New: seg sm ---------- */
.seg.sm { padding: 2px; }
.seg.sm button { padding: 4px 10px; font-size: 11.5px; }

/* ---------- New: inbox toolbar + filter pills ---------- */
.inbox-toolbar { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.filter-pill { cursor: pointer; transition: transform .12s var(--ease), box-shadow .16s var(--ease); border: 1px solid transparent; }
.filter-pill:hover { transform: translateY(-1px); }
.filter-pill.on { outline: none; box-shadow: 0 0 0 2px var(--blue); font-weight: 700; }

/* ---------- New: multi-select + bulk bar ---------- */
.convo-check { display: none; align-items: center; flex: none; padding-right: 2px; }
.inbox-layout.select-mode .convo-check { display: flex; }
.convo-check input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.convo.selected { background: var(--tint-blue); }
.convo.kb-active { box-shadow: inset 2px 0 0 var(--blue); background: var(--tint-blue); }
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 8px var(--s-3); border-bottom: 1px solid var(--line);
  background: var(--tint-blue); animation: page-in .2s var(--ease);
}
/* display:flex above beats the [hidden] UA rule — restore it, or an empty bar shows. */
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: 12px; font-weight: 700; color: var(--blue-ink); flex: none; }
.bulk-actions { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.bulk-actions::-webkit-scrollbar { display: none; }
.bulk-bar .btn.sm { flex: none; }

/* ---------- New: assignee chip (explicit size so it never stretches) ---------- */
.assignee {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none; box-sizing: border-box;
  line-height: 1; font-size: 9px; font-weight: 700; color: #fff; vertical-align: middle; align-self: center;
}
.assignee.sm { width: 18px; height: 18px; font-size: 8px; }
.assignee.empty {
  border: 1.5px dashed var(--line-2); color: var(--fg-4); background: transparent;
  font-weight: 600; cursor: pointer; transition: border-color .15s var(--ease), color .15s var(--ease);
}
.assignee.empty:hover { border-color: var(--blue); color: var(--blue-ink); }
.avatar.assignee-av { width: 22px; height: 22px; font-size: 9px; }
.avatar.assignee-av.sm { width: 18px; height: 18px; font-size: 8px; }
.convo .c-top .avatar, .convo .c-top .assignee { margin-left: 2px; }
.owner-cell { cursor: pointer; }
/* Empty-owner "+" is an SVG replaced element — fixed intrinsic size, never stretches. */
.owner-add { display: inline-block; vertical-align: middle; color: var(--fg-4); cursor: pointer; flex: none; }
.owner-cell:hover .owner-add { color: var(--blue-ink); }

/* ---------- New: company logo (default favicon, enriched logo overrides) ---------- */
.co-logo-wrap { display: inline-block; flex: none; overflow: hidden; }
.co-fallback { color: #fff; }
.avatar.has-photo { color: transparent; background-color: var(--bg-2); }

/* ---------- New: reusable choice menu ---------- */
.menu-modal { width: min(380px, calc(100vw - 32px)); }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: var(--r-btn); font-size: 13.5px; font-weight: 550;
  color: var(--fg-2); transition: background .13s var(--ease);
}
.menu-row:hover { background: var(--tint-blue); color: var(--fg); }
.menu-row.danger { color: var(--red); }
.menu-row svg { width: 16px; height: 16px; flex: none; color: var(--fg-4); }
.menu-row .menu-label { flex: 1; min-width: 0; }
.menu-row .menu-hint { font-size: 11px; color: var(--fg-4); flex: none; }

/* ---------- New: command palette commands + footer ---------- */
.palette-foot {
  display: flex; gap: 16px; align-items: center; justify-content: flex-start;
  padding: 8px 16px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--fg-4); background: var(--card-2);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }
.palette-foot kbd { font-family: var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.p-item .p-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--tint-blue); color: var(--blue-ink); flex: none; }
.p-item .p-ico svg { width: 14px; height: 14px; }

/* ---------- New: shortcuts help ---------- */
.shortcuts .kv { padding: 6px 0; }
.sc-kbd { font-family: var(--mono); font-size: 11px; color: var(--fg-2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 8px; background: var(--bg-2); }

/* ---------- New: dashboard needs-action panel ---------- */
.needs-action { margin-bottom: var(--s-4); }
.na-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.na-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: var(--s-4); border-radius: var(--r-card);
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-card);
  text-align: left; transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .2s var(--ease);
}
.na-card:hover { box-shadow: var(--shadow-float); border-color: var(--line-2); }
.na-card .na-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg-2); color: var(--fg-3); margin-bottom: var(--s-2); }
.na-card .na-ico svg { width: 17px; height: 17px; }
.na-card .na-num { font-size: 26px; font-weight: 780; letter-spacing: -.03em; color: var(--fg); font-variant-numeric: tabular-nums; line-height: 1.1; }
.na-card .na-label { font-size: 12px; font-weight: 600; color: var(--fg-3); }
.na-card.coral .na-ico { background: var(--tint-coral); color: var(--coral); }
.na-card.coral .na-num { color: var(--coral); }
.na-card.violet .na-ico { background: var(--tint-violet); color: var(--violet); }
.na-card.amber .na-ico { background: var(--tint-amber); color: var(--amber); }
.na-card.green .na-ico { background: var(--tint-green); color: var(--green); }
.na-list { margin-top: var(--s-3); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--s-3) var(--s-4) var(--s-4); box-shadow: var(--shadow-card); }
.na-list-title { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-4); padding: 2px 0 var(--s-2); }
.na-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 6px; border-radius: 10px; transition: background .13s var(--ease); }
.na-row + .na-row { border-top: 1px solid var(--line); border-radius: 0; }
.na-row:hover { background: var(--tint-blue); border-radius: 10px; }
.na-row-name { font-size: 12.5px; font-weight: 650; color: var(--fg); flex: none; max-width: 180px; }
.na-row-subj { font-size: 12px; flex: 1; min-width: 0; }
.na-row .chip.sla { margin-left: auto; }

/* ---------- New: reminders ---------- */
.reminder .k { display: flex; align-items: center; gap: 5px; }
.reminder.overdue .k { color: var(--red); }
.rem-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- New: settings switch row ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; font-size: 13px; font-weight: 550; color: var(--fg-2); cursor: pointer; }
.switch-row input[type="checkbox"] { width: 40px; height: 22px; appearance: none; border-radius: 999px;
  background: var(--bg-3); position: relative; cursor: pointer; transition: background .2s var(--ease); flex: none; }
.switch-row input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s var(--ease); }
.switch-row input[type="checkbox"]:checked { background: var(--blue); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }

/* ---------- New: composer post-send select ---------- */
.composer-tools .post-send { width: auto; min-width: 0; max-width: 190px; padding: 5px 26px 5px 10px;
  font-size: 12px; border-radius: 9px; }

/* ---------- New: client report modal ---------- */
.report-modal { width: min(640px, calc(100vw - 32px)); }
.rep-metric { padding: var(--s-3); border-radius: var(--r-card); background: var(--bg-1); border: 1px solid var(--line); }
.rep-reply .k { display: flex; align-items: center; gap: 6px; min-width: 0; }

/* ---------- New: empty-state action ---------- */
.empty .e-action { display: flex; justify-content: center; }

/* ---------- New: client card header (name never clips; actions wrap) ---------- */
.client-head { display: flex; align-items: center; gap: 10px; }
.client-head .avatar, .client-head .brand-logo { flex: none; }
.client-head .client-id { flex: 1; min-width: 0; }
.client-head .client-id b { line-height: 1.25; }
.client-head .btn { flex: none; margin-left: auto; }
.client-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.client-actions .btn { flex: none; }

/* Guard: action clusters that sit beside a title should wrap, never clip */
.chart-head { row-gap: 6px; }
.chart-head .row { flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================================================
   Motion & interaction polish (modern, professional, reduced-motion aware)
   ========================================================================== */

/* Staggered row entrance + optimistic collapse-out */
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.convo.removing { transition: height .28s var(--ease), opacity .2s var(--ease), margin .28s var(--ease); }

/* View Transitions: gentle cross-fade between pages / theme */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .26s; }

/* Segmented control sliding thumb */
.seg { position: relative; }
.seg-thumb {
  position: absolute; z-index: 0; border-radius: 9px; background: var(--card);
  box-shadow: 0 1px 3px rgba(20, 20, 18, 0.12); pointer-events: none;
  transition: left .24s var(--ease), width .24s var(--ease), top .24s var(--ease); opacity: 0;
}
.seg.seg-enhanced button { position: relative; z-index: 1; }
.seg.seg-enhanced button.active { background: transparent; box-shadow: none; }

/* Sortable table headers */
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; transition: color .14s var(--ease); }
.th-sort:hover { color: var(--fg-2); }
.sort-ar { display: inline-block; width: 0; height: 0; margin-left: 5px; vertical-align: middle; opacity: .28;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 5px solid currentColor; }
.th-sort.asc .sort-ar { opacity: .9; }
.th-sort.desc .sort-ar { opacity: .9; transform: rotate(180deg); }

/* Inbox row hover-actions (only on hover-capable devices) */
.convo { position: relative; }
.convo-actions {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%) translateX(6px);
  display: flex; gap: 2px; opacity: 0; pointer-events: none;
  padding-left: 20px; background: linear-gradient(90deg, transparent, var(--card-2) 34%);
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.convo-actions .btn.icon { padding: 6px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
@media (hover: hover) {
  .convo:hover .convo-actions { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
}
.inbox-layout.select-mode .convo-actions { display: none; }

/* Tactile press states */
.btn:active { transform: translateY(0.5px) scale(.99); }
.nav-item:active, .menu-row:active, .na-card:active, .sheet-item:active { transform: scale(.99); }
.nav-item.active { animation: nav-pop .24s var(--ease); }
@keyframes nav-pop { from { transform: scale(.97); } to { transform: none; } }
.na-card, .kcard, .convo, .p-item, .menu-row { transition: background .14s var(--ease), box-shadow .2s var(--ease),
  border-color .2s var(--ease), transform .12s var(--ease); }

/* Sharper focus ring for keyboard users */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.convo:focus-visible, .na-card:focus-visible { outline-offset: -2px; }

/* Sidebar hover-expand when collapsed — smooth in-flow reveal (no layout jump) */
@media (hover: hover) and (min-width: 861px) {
  .sidebar.collapsed:hover {
    width: var(--sidebar-w); padding-left: var(--s-3); padding-right: var(--s-3);
    box-shadow: var(--shadow-float);
  }
  .sidebar.collapsed:hover .brand-text, .sidebar.collapsed:hover .nav-item > span:not(.badge),
  .sidebar.collapsed:hover .foot-label, .sidebar.collapsed:hover .user-text,
  .sidebar.collapsed:hover #logoutBtn { display: block; }
  .sidebar.collapsed:hover .nav-item { justify-content: flex-start; padding: 8px var(--s-3); }
  .sidebar.collapsed:hover .nav-item .badge { position: static; }
  .sidebar.collapsed:hover [data-tip]::after { display: none; }
  .sidebar.collapsed:hover .brand { justify-content: flex-start; padding: var(--s-1) var(--s-2) var(--s-4); }
  .sidebar.collapsed:hover .user-chip { justify-content: flex-start; }
}

/* Density: Compact */
:root[data-density="compact"] .tbl td { padding: 9px var(--s-4); }
:root[data-density="compact"] .tbl th { padding: 9px var(--s-4); }
:root[data-density="compact"] .convo { padding: 9px var(--s-3); }
:root[data-density="compact"] .card-pad { padding: var(--s-3); }
:root[data-density="compact"] .metric { padding: var(--s-3) var(--s-4) var(--s-2); }
:root[data-density="compact"] .metric .m-value { font-size: 22px; }
:root[data-density="compact"] .na-card { padding: var(--s-3); }
:root[data-density="compact"] .kcard { padding: var(--s-2) var(--s-3); }
:root[data-density="compact"] .kv { padding: 3px 0; }

/* ==========================================================================
   Relationships: warmth, toolbar, accounts, contact/company 360
   ========================================================================== */
.rel-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: var(--s-4); }
.rel-toolbar .select { width: auto; min-width: 132px; }

/* Warmth track + score */
.warmth { display: inline-flex; align-items: center; gap: 7px; }
.warmth-track { width: 54px; height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; flex: none; }
.warmth-track i { display: block; height: 100%; border-radius: 999px; transition: width .5s var(--ease); }
.warmth b { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Multi-select checkbox column (hidden until select mode) */
.rel-tbl .check-col { display: none; width: 34px; }
.rel-sel .rel-tbl .check-col { display: table-cell; }
.rel-tbl .check-col input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.rel-tbl tbody tr.selected, .rel-tbl tr.selected { background: var(--tint-blue); }
.rel-tbl .nowrap { white-space: nowrap; }
/* svg is display:block in the reset — force inline so it sits beside its label. */
.rel-tbl .nowrap svg { width: 11px; height: 11px; display: inline-block; vertical-align: -2px; opacity: .7; }
.reminder .k svg, .nba-banner svg { display: inline-block; vertical-align: -2px; }
.link-cell { cursor: pointer; }
.link-cell:hover { color: var(--blue-ink); text-decoration: underline; }

/* Contact / company hero extras */
.hero-warmth { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.nba-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-4);
  padding: 10px 14px; border-radius: var(--r-card);
  background: var(--tint-blue); color: var(--blue-ink); font-size: 13px; font-weight: 550;
}
.nba-banner span { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.nba-banner svg { width: 15px; height: 15px; flex: none; }
.nba-banner b { color: var(--fg); font-weight: 700; }
.nba-banner .btn { flex: none; }

/* ---------- Deliverability (ESP matrix) ---------- */
.deliv-note { font-size: 12px; line-height: 1.55; }
/* Deliverability: actionable insight band */
.deliv-insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.di-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line-2); }
.di-card .di-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; background: var(--bg-2); color: var(--fg-3); }
.di-card .di-ico svg { width: 17px; height: 17px; }
.di-card.good .di-ico { background: var(--tint-green); color: var(--green); }
.di-card.warn .di-ico { background: var(--tint-amber); color: var(--amber); }
.di-big { font-size: 15px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.di-sub { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; }
/* Provider summary cards */
.deliv-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.dprov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dprov-head b { font-size: 14px; }
.dprov-health { font-size: 30px; font-weight: 780; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 10px 0 4px; line-height: 1; }
.dprov-health span { font-size: 11.5px; font-weight: 500; color: var(--fg-4); margin-left: 8px; letter-spacing: 0; }
.dprov-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dps-k { font-size: 10.5px; color: var(--fg-4); }
.dps-v { font-size: 15px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; margin-top: 1px; }
.cap-bar { height: 6px; background: var(--bg-2); overflow: hidden; margin-top: 12px; }
.cap-bar i { display: block; height: 100%; background: var(--blue); transition: width .5s var(--ease); }
.dps-cap { font-size: 11px; margin-top: 6px; }
/* Matrix */
.deliv-matrix { min-width: 560px; }
.deliv-matrix th { text-align: center; font-size: 11px; }
.deliv-matrix th:first-child { text-align: left; }
.deliv-matrix td { text-align: center; vertical-align: middle; border-left: 1px solid var(--line); padding: 14px 12px; }
.deliv-matrix td:first-child { border-left: none; }
.deliv-rowhead { font-weight: 700; color: var(--fg); text-align: left !important; white-space: nowrap; }
.deliv-cell .dc-replies { font-size: 20px; font-weight: 750; color: var(--fg); font-variant-numeric: tabular-nums; line-height: 1.1; }
.deliv-cell .dc-replies span { font-size: 10px; font-weight: 500; color: var(--fg-4); }
.deliv-cell .dc-pos { font-size: 12px; font-weight: 650; margin-top: 3px; }
.deliv-cell .dc-out { font-size: 11px; margin-top: 2px; }

/* ---------- Active-filter banner + clear ---------- */
.filter-note {
  display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-3);
  padding: 9px 14px; border-radius: var(--r-card);
  background: var(--tint-amber); color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  font-size: 12.5px;
}
.filter-note span { flex: 1; min-width: 0; color: var(--fg-2); }
.filter-note b { color: var(--fg); }
.filter-note svg { width: 16px; height: 16px; flex: none; }
.filter-note .btn { flex: none; }
.filter-clear { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.filter-clear:hover { border-color: var(--amber); background: var(--tint-amber); }

/* ---------- Notification center ---------- */
.notif-bell { position: relative; }
.notif-badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  line-height: 15px; text-align: center; box-shadow: 0 0 0 2px var(--nav-bg);
}
.notif-bell.has-unread svg { color: var(--blue-ink); }
.notif-overlay { position: fixed; inset: 0; z-index: 80; animation: fade-in .12s var(--ease); }
.notif-panel {
  position: fixed; top: 62px; right: 14px; width: min(390px, calc(100vw - 20px));
  max-height: min(560px, calc(100dvh - 80px)); display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: var(--shadow-float); overflow: hidden;
  animation: notif-in .24s var(--ease);
}
@keyframes notif-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); flex: none; }
.notif-head b { font-size: 14px; }
.notif-enable {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 10px var(--s-4); background: var(--tint-blue); color: var(--blue-ink);
  font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--line); flex: none;
}
.notif-enable svg { width: 15px; height: 15px; flex: none; }
.notif-list { flex: 1; min-height: 0; overflow-y: auto; padding: 5px; }
.notif-item { display: flex; gap: 11px; width: 100%; text-align: left; padding: 10px 11px; border-radius: var(--r-btn); transition: background .13s var(--ease); }
.notif-item:hover { background: var(--card-2); }
.notif-item.unread { background: var(--tint-blue); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--tint-blue) 70%, var(--card-2)); }
.notif-ico { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--bg-2); color: var(--fg-3); }
.notif-ico svg { width: 15px; height: 15px; }
.notif-ico.pos { background: var(--sc-tint-positive); color: var(--sc-positive); }
.notif-ico.meeting { background: var(--sc-tint-meeting); color: var(--sc-meeting); }
.notif-ico.warm { background: var(--sc-tint-warm); color: var(--sc-warm); }
.notif-ico.neg { background: var(--tint-coral); color: var(--coral); }
.notif-ico.blue { background: var(--tint-blue); color: var(--blue-ink); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.notif-title { font-size: 12.5px; font-weight: 650; color: var(--fg); }
.notif-sub { font-size: 11.5px; color: var(--fg-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time { font-size: 10.5px; color: var(--fg-4); margin-top: 2px; }
.notif-foot { padding: 8px var(--s-4); border-top: 1px solid var(--line); text-align: center; flex: none; }
@media (max-width: 860px) {
  .notif-panel { top: 56px; right: 8px; left: 8px; width: auto; }
  /* Swipe-to-reveal quick actions on a conversation row. */
  .convo > .avatar, .convo > .c-body, .convo > .convo-check { transition: transform .2s var(--ease); }
  .convo.swiped > .avatar, .convo.swiped > .c-body, .convo.swiped > .convo-check { transform: translateX(-124px); }
  .convo.swiped .convo-actions { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
  .convo.swiped .convo-actions .btn.icon { background: var(--card); }
}

/* ---------- Reply templates ---------- */
.empty-mini { padding: 14px 8px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.tmpl-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.tmpl-item { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--card); transition: border-color .13s var(--ease), background .13s var(--ease); }
.tmpl-item:hover { border-color: var(--blue); background: var(--tint-blue); }
.tmpl-item-top { display: flex; align-items: center; gap: 8px; }
.tmpl-item-top b { font-size: 13px; }
.chip.sm { font-size: 9.5px; padding: 1px 6px; }
.tmpl-subj { font-size: 11.5px; font-weight: 600; color: var(--fg-2); }
.tmpl-preview { font-size: 11.5px; color: var(--fg-3); white-space: pre-wrap; word-break: break-word; }
.tmpl-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-4); margin: 14px 0 7px; }
.tmpl-group-label:first-child { margin-top: 0; }
.tmpl-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-btn); margin-bottom: 7px; background: var(--card); }
.tmpl-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tmpl-row-main b { font-size: 13px; }
.tmpl-row-actions { display: flex; gap: 4px; flex: none; }

/* ---------- API tokens / code blocks / MCP guide ---------- */
.code-block { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 10px 12px; overflow-x: auto; margin-top: 8px; }
.code-block pre { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--fg-2); white-space: pre; }
.code-copy { position: absolute; top: 7px; right: 7px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 10.5px; font-weight: 650; border-radius: 7px; background: var(--card); border: 1px solid var(--line); color: var(--fg-3); box-shadow: var(--shadow-card); }
.code-copy:hover { color: var(--blue-ink); border-color: var(--blue); }
.code-copy svg { width: 11px; height: 11px; }
.set-tab[data-settab="api"] .card-title svg { width: 15px; height: 15px; vertical-align: -2px; }
.set-tab[data-settab="api"] .muted svg { width: 12px; height: 12px; vertical-align: -1px; }
.guide-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.guide-step > div { flex: 1; min-width: 0; }
.guide-step b { font-size: 13px; }
.guide-num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--tint-blue); color: var(--blue-ink); font-size: 11.5px; font-weight: 700; margin-top: 1px; }
.tool-groups { display: flex; flex-direction: column; gap: 9px; }
.tool-group { display: flex; gap: 9px; align-items: baseline; }
.tool-group .chip { flex: none; }
.prompt-list { display: flex; flex-direction: column; gap: 6px; }
.prompt-ex { font-size: 12.5px; color: var(--fg-2); padding: 7px 11px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r-btn); font-style: italic; }
.tok-reveal { margin-top: 12px; padding: 12px; border: 1px solid var(--sc-positive); border-radius: var(--r-btn); background: var(--sc-tint-positive); }
.tok-reveal input { flex: 1; min-width: 0; }
.tok-reveal svg { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- Internal comments + @mentions ---------- */
.comment-list { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; margin-bottom: 10px; }
.comment { display: flex; gap: 9px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; flex: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 7px; }
.comment-meta b { font-size: 12px; }
.comment-meta .muted { font-size: 10.5px; }
.comment-text { font-size: 12.5px; color: var(--fg-2); line-height: 1.5; word-break: break-word; margin-top: 1px; }
.mention { color: var(--blue-ink); background: var(--tint-blue); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.comment-compose { position: relative; display: flex; gap: 7px; align-items: flex-end; }
.comment-compose textarea { resize: none; min-height: 36px; line-height: 1.4; }
.comment-compose .btn { flex: none; }
.mention-pop { position: absolute; bottom: calc(100% + 6px); left: 0; right: 40px; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-btn); box-shadow: var(--shadow-float);
  overflow: hidden; max-height: 200px; overflow-y: auto; }
.mention-pop[hidden] { display: none; }
.mention-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 11px; font-size: 12.5px; transition: background .12s var(--ease); }
.mention-opt:hover { background: var(--tint-blue); }
.flash-in { animation: flash-in .9s var(--ease); }
@keyframes flash-in { 0% { background: var(--tint-blue); } 100% { background: transparent; } }

/* ---------- Priority queue (smart inbox digest) ---------- */
.prio-list .na-list-title svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.prio-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.prio-score { min-width: 30px; justify-content: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.prio-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.prio-name { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.prio-reason { font-size: 11px; }
.prio-stage { flex: none; }
@media (max-width: 640px) { .prio-stage { display: none; } }

/* ---------- Goals ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.goal-card { padding: var(--s-4); display: flex; flex-direction: column; gap: 12px; }
.goal-top { display: flex; align-items: center; gap: 14px; }
.goal-ring { position: relative; flex: none; display: grid; place-items: center; }
.goal-ring-val { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; }
.goal-meta { flex: 1; min-width: 0; }
.goal-metric { font-size: 13px; font-weight: 650; color: var(--fg); }
.goal-count { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; margin: 1px 0; }
.goal-count .muted { font-size: 14px; font-weight: 500; }
.goal-sub { font-size: 11px; }
.goal-del { flex: none; align-self: flex-start; }
.goal-bar { height: 7px; border-radius: 5px; background: var(--bg-2); overflow: hidden; }
.goal-bar i { display: block; height: 100%; border-radius: 5px; }
.goal-done { align-self: flex-start; }

/* ---------- Sentiment & intent trends ---------- */
.chart-draw .ln-stroke { will-change: stroke-dashoffset; }
.intent-bars { display: flex; flex-direction: column; gap: 9px; }
.intent-row { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 12px; }
.intent-label { font-size: 12px; color: var(--fg-2); }
.intent-track { height: 9px; border-radius: 5px; background: var(--bg-2); overflow: hidden; }
.intent-track i { display: block; height: 100%; border-radius: 5px; background: var(--blue); }
.intent-count { font-size: 12px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); }
@media (max-width: 640px) { .intent-row { grid-template-columns: 110px 1fr 40px; gap: 8px; } }

/* ---------- AI meeting brief ---------- */
.brief-loading { display: flex; align-items: center; gap: 10px; padding: 30px 6px; justify-content: center; }
.brief-headline { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--fg); }
.brief-goal { margin-top: 8px; padding: 9px 12px; border-radius: var(--r-btn); background: var(--tint-green); color: var(--fg); font-size: 12.5px; }
.brief-goal-label { font-weight: 700; color: var(--green); text-transform: uppercase; font-size: 10px; letter-spacing: .04em; margin-right: 6px; }
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; margin-top: 16px; }
.brief-sec h4 { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-3); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.brief-sec h4 svg { width: 13px; height: 13px; }
.brief-sec p { font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
.brief-sec ul { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 4px; }
.brief-sec li { font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
@media (max-width: 620px) { .brief-grid { grid-template-columns: 1fr; } }

/* ---------- Mobile ---------- */
.mobile-nav { display: none; }

@media (max-width: 1180px) {
  .inbox-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .chart-card, .chart-card.third { grid-column: span 6; }
  /* minmax(0,1fr) — a bare 1fr has an automatic min-content floor, so a wide table
     (min-width:640px) or a nowrap value would force the column past the viewport. */
  .contact-layout { grid-template-columns: minmax(0, 1fr); }
  .contact-layout > * { min-width: 0; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .sidebar { display: none; }
  .shell { flex-direction: column; padding: 0; gap: 0; }
  .main { height: calc(100dvh - 58px); border: none; border-radius: 0; box-shadow: none; }
  .content { padding: var(--s-4) var(--s-4) 90px; }
  .topbar { padding: var(--s-2) var(--s-4); min-height: 54px; flex-wrap: wrap; }
  .page-sub { display: none; }
  .topbar-collapse { display: none; }   /* no sidebar on mobile */
  .searchbar { min-width: 0; flex: 1; }
  .searchbar span { display: none; }
  /* Page tabs drop to their own scrollable row below the title/search/bell. */
  .topbar-right { flex-wrap: wrap; row-gap: 8px; }
  .topbar-seg-slot {
    display: block; order: 5; flex: 1 1 100%; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .topbar-seg-slot::-webkit-scrollbar { display: none; }
  .topbar-seg-slot .seg { width: max-content; min-width: 100%; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--nav-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .mobile-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 9.5px; font-weight: 650; color: var(--fg-4); padding: 4px 10px;
    border-radius: 10px; transition: color .15s;
  }
  .mobile-nav button svg { width: 20px; height: 20px; }
  .mobile-nav button.active { color: var(--blue-ink); }
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-list { display: flex; }
  .inbox-layout.thread-open .inbox-list { display: none; }
  .thread-pane { display: none; }
  .inbox-layout.thread-open .thread-pane { display: flex; }
  .msg { max-width: 92%; }

  /* Thread open = fullscreen composing room; the back arrow returns to the list. */
  body.thread-open .mobile-nav { display: none; }
  body.thread-open .main { height: 100dvh; }
  /* Header: keep it from cramping/overlapping */
  .thread-head { padding: var(--s-2) var(--s-3); gap: var(--s-2); }
  .thread-head .avatar { width: 30px; height: 30px; font-size: 11px; }
  #replyJump { display: none; }               /* composer is right there on mobile */
  .thread-head .th-info .chip { font-size: 9.5px; padding: 1px 6px; }
  /* Composer: all AI tools reachable via horizontal scroll instead of clipping */
  .composer { padding: var(--s-2) var(--s-3) calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .composer-format {
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
    margin: 0 calc(var(--s-3) * -1) var(--s-2); padding: 0 var(--s-3) 2px;
  }
  .composer-format::-webkit-scrollbar { display: none; }
  .composer-format .btn { flex: none; white-space: nowrap; }
  .composer .editor { min-height: 64px; }
  .composer-tools { gap: 8px; }
  .composer-tools .from { max-width: 44%; }

  .intel-pane { width: min(340px, 92vw); }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card, .chart-card.third, .chart-card.full { grid-column: span 1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* minmax(0,1fr), not 1fr: the automatic min-content floor of a bare 1fr lets
     nowrap values / wide tables push cards past the viewport edge. */
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > *, .grid-3 > *, .chart-grid > * { min-width: 0; }
  .kanban { padding: var(--s-3) var(--s-4) 100px; }
  .drawer { width: 100vw; }
  .filterbar .input, .filterbar .dates .input { width: 100%; }

  /* Thread header on a phone: keep only the primary actions inline and move the
     rest behind "…", so the contact name isn't squeezed to nothing and the stage
     chip can't spill over the icons. */
  .thread-actions { flex: none; gap: 2px; }
  .thread-actions .btn { flex: none; }
  #assignBtn, #followBtn, #meetBtn, #starBtn { display: none; }
  .thread-more { display: inline-flex; }
  .thread-head .th-info .chip { display: none; }   /* redundant: shown in list + intel */
  .thread-head .th-info { flex: 1; min-width: 0; }
  .na-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .na-row-name { max-width: 40vw; }
  .menu-modal, .report-modal { width: calc(100vw - 24px); }

  /* Topbar: the title, search and any page control (e.g. People/Companies) were
     colliding. Collapse search to an icon and let the title ellipsis. */
  .searchbar { flex: none; width: 38px; padding: 8px; justify-content: center; }
  .searchbar kbd { display: none; }
  .page-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { min-width: 0; flex-shrink: 1; gap: 4px; }
  .topbar-right .seg button { padding: 4px 9px; font-size: 11.5px; }
  /* Sync lives in the More sheet on mobile — drop it here so the page control fits. */
  #syncBtn { display: none; }

  /* Contact / company hero must wrap instead of shoving the action button off-screen */
  .contact-hero { flex-wrap: wrap; }
  .contact-hero h2 { font-size: 18px; }
  .contact-hero .btn, .hero-warmth { margin-left: auto; }

  /* Relationships table: drop low-priority columns so it's readable on a phone.
     Company is dropped too — the domain is already visible in the email. */
  .rel-tbl th:nth-child(3), .rel-tbl td:nth-child(3),   /* Company */
  .rel-tbl th:nth-child(5), .rel-tbl td:nth-child(5),   /* Owner */
  .rel-tbl th:nth-child(7), .rel-tbl td:nth-child(7),   /* Replies */
  .rel-tbl th:nth-child(8), .rel-tbl td:nth-child(8),   /* Next touch */
  .rel-tbl th:nth-child(9), .rel-tbl td:nth-child(9) {  /* Last activity */
    display: none;
  }
  .rel-tbl .warmth-track { width: 40px; }
  table.rel-tbl { min-width: 0; }   /* beat table.tbl{min-width:640px} so it fits the screen */
  .rel-tbl td:nth-child(2) { max-width: 46vw; }
  .rel-tbl td:nth-child(2) .row > div { min-width: 0; }
}

/* ---------------- Automations queue ---------------- */
.input.sm { padding: 6px 9px; font-size: 12.5px; border-radius: 8px; }
.autom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.autom-card { margin: 0; }
.autom-note {
  margin-top: 10px; padding: 9px 11px; font-size: 12px; line-height: 1.5;
  color: var(--fg-2); background: var(--bg-2); border: 1px solid var(--line);
  border-left: 2px solid var(--blue); border-radius: 8px; white-space: pre-wrap;
}
@media (max-width: 640px) { .autom-grid { grid-template-columns: 1fr; } }
.autom-ic { display: inline-flex; }
.autom-ic svg { width: 15px; height: 15px; vertical-align: -3px; color: var(--fg-3); }

/* Automations queue tables + detail/help */
.autom-tbl td { vertical-align: middle; }
.autom-tbl tbody tr:hover { background: var(--bg-2); }
.autom-help {
  margin-top: 14px; padding: 11px 13px; font-size: 12px; line-height: 1.55;
  color: var(--fg-2); background: var(--tint-blue); border-radius: 10px;
}
.autom-help svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--blue); }
.hiw-p { font-size: 12.5px; line-height: 1.6; color: var(--fg-2); margin: 0 0 12px; }
.hiw-item { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--fg-2); margin-bottom: 10px; }
.hiw-item svg { width: 16px; height: 16px; color: var(--blue); flex: none; margin-top: 1px; }
.hiw-item b { color: var(--fg); }
.autom-msg {
  margin-top: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6;
  color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; white-space: normal;
}
.autom-msg-subj { font-weight: 650; margin-bottom: 6px; color: var(--fg); }

/* Automations analytics cards + expandable rows */
.autom-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.astat-label { font-size: 11.5px; color: var(--fg-3); font-weight: 550; }
.astat-num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; }
.astat-num.green { color: var(--green); }
.astat-sub { font-size: 11px; }
.autom-tbl .chev-col { width: 26px; text-align: center; }
.autom-tbl .chev { display: inline-block; color: var(--fg-4); transition: transform .15s var(--ease); font-size: 15px; }
.autom-tbl .chev svg { width: 14px; height: 14px; }
.autom-row.open .chev { transform: rotate(90deg); color: var(--fg-2); }
.autom-row.open { background: var(--bg-2); }
.autom-detail-row > td { background: var(--bg-2); padding: 0; }
.autom-detail-inner { padding: 14px 16px 16px; }
@media (max-width: 900px) { .autom-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .autom-stats { grid-template-columns: 1fr; } }

/* Automations expanded detail (skimmable) */
.autom-detail-inner { padding: 16px 18px 18px; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px 24px; }
.ad-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ad-k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-4); font-weight: 600; }
.ad-v { font-size: 12.5px; color: var(--fg); font-weight: 550; overflow-wrap: anywhere; }
.ad-row { margin-top: 14px; }
.ad-row .ad-k { display: block; margin-bottom: 4px; }
.ad-quote { font-size: 12.5px; font-style: italic; color: var(--fg-2); }
.ad-msg-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-4); font-weight: 600; margin: 16px 0 6px; display: flex; align-items: center; gap: 5px; }
.ad-msg-label svg { width: 12px; height: 12px; color: var(--blue); }
.ad-msg-empty { font-size: 12px; color: var(--fg-3); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ad-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ad-help { font-size: 11px; color: var(--fg-3); line-height: 1.5; margin: 0; max-width: 62ch; }

/* ---------------- Relationships (curated) ---------------- */
.one-liner { font-size: 12px; color: var(--fg-2); max-width: 300px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bkt { font-size: 11.5px; color: var(--fg-2); }
.bkt small { color: var(--fg-4); }
.rel-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.rel-form .field.full { grid-column: 1 / -1; }
.rel-form .note { font-size: 11px; color: var(--fg-4); margin-top: 4px; }
.rel-linkres { max-height: 200px; overflow-y: auto; }
.rel-linkopt { padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; cursor: pointer; transition: background .12s var(--ease); }
.rel-linkopt:hover { background: var(--bg-2); border-color: var(--line-2); }
.rel-linked { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--green-soft); background: var(--tint-green); border-radius: 10px; padding: 9px 12px; margin-top: 6px; }
.rel-linked svg { width: 14px; height: 14px; flex: none; }
.rel-linked .link-btn { margin-left: auto; }
@media (max-width: 680px) { .rel-form { grid-template-columns: 1fr; } }
.rel-form .input, .rel-form .select { width: 100%; min-width: 0; }

/* ---------------- Matching + Intros ---------------- */
.fm-target { margin-top: 4px; padding: 12px 14px; background: var(--tint-blue); border: 1px solid rgba(0,95,160,.15); border-radius: 12px; }
.fm-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-4); margin: 18px 0 8px; }
.cand-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 9px; }
.cand-row:hover { border-color: rgba(0,95,160,.3); background: var(--card-2); }
.warm-n { font-weight: 700; color: var(--green); font-size: 13px; min-width: 26px; text-align: right; }
.intro-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.icol { background: rgba(255,255,255,.5); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 220px; }
:root[data-theme="dark"] .icol { background: rgba(255,255,255,.03); }
.icol-h { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); padding: 4px 6px 10px; }
.idot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.icard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin-bottom: 10px; box-shadow: var(--shadow-card); cursor: pointer; transition: border-color .12s var(--ease); }
.icard:hover { border-color: var(--line-2); }
.imeta { font-size: 10px; color: var(--fg-4); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: 8px; }
.icard .person { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.iarrow { color: var(--fg-4); font-size: 10.5px; margin: 1px 0 1px 32px; }
.ifoot { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--fg-4); }
@media (max-width: 1100px) { .intro-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .intro-board { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════════════
   Sharp-corner theme — 0px radius across the whole app.
   Only genuinely circular indicators (dots, avatars, spinner, toggle)
   stay round; every rectangular surface is squared off.
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { border-radius: 0 !important; }
.avatar, .avatar img, .user-chip .avatar, .assignee, .brand-mark, .kg-mark,
.live-dot, .sync-dot, .c-stage-dot, .idot, .toast .t-dot, .chip .dot,
.warm-dots .wd, .stage-tab .k-dot, .kcol-head .k-dot, .k-dot,
.convo.unread .c-name::before, .tl-item::before, .guide-num, .spinner,
.switch-row input[type="checkbox"], .switch-row input[type="checkbox"]::after,
.atoggle input[type="checkbox"], .atoggle input[type="checkbox"]::after {
  border-radius: 999px !important;
}
