/* === UZKIRO CRM: CLEAN OBSIDIAN WORKSPACE DESIGN SYSTEM === */
:root {
  --bg: #080c14;
  --panel: #0f1623;
  --panel2: #151e2f;
  --panel3: #1b263b;
  --ink: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --muted: #8b9bb4;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(56, 189, 248, 0.38);
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.18);
  --accent-ink: #07101f;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #60a5fa 100%);
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --purple: #a78bfa;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #080c14;
  --panel: #0f1623;
  --panel2: #151e2f;
  --panel3: #1b263b;
  --ink: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --muted: #8b9bb4;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(56, 189, 248, 0.38);
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.18);
  --accent-ink: #07101f;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #60a5fa 100%);
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --purple: #a78bfa;
  color-scheme: dark;
}

* { box-sizing: border-box; }
.crm [hidden] { display: none !important; }

body.reactvibe-crm {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  caret-color: var(--accent);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.reactvibe-crm ::selection {
  background: rgba(56, 189, 248, 0.26);
  color: #fff;
}
body.reactvibe-crm a { text-underline-offset: 3px; }

/* === 1. REACTVIBE SPOTLIGHT & SINE WAVE CANVAS === */
.reactvibe-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.reactvibe-dots-base {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.reactvibe-dots-spotlight {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(56, 189, 248, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle 340px at var(--mouse-x, 50vw) var(--mouse-y, 30vh), black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle 340px at var(--mouse-x, 50vw) var(--mouse-y, 30vh), black 0%, transparent 100%);
}
.reactvibe-radial-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(56, 189, 248, 0.09) 0%, transparent 70%),
    radial-gradient(circle at 10% 90%, rgba(167, 139, 250, 0.05) 0%, transparent 45%);
}

#vibeWavesCanvas {
  display: none;
}

/* === 2. CRM MAIN CONTAINER & SURFACES === */
.crm {
  position: relative;
  z-index: 2;
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

.crm-muted { color: var(--muted); }
.crm h1, .crm h2, .crm h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
.crm h1 { font-size: 20px; }
.crm h2 { font-size: 17px; margin-bottom: 4px; }
.crm h3 { font-size: 14px; }
.crm p { margin-top: 6px; margin-bottom: 10px; }

.crm-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease;
}
.crm-panel:hover {
  border-color: rgba(148, 163, 184, 0.24);
}
.crm-view > .crm-panel + .crm-panel {
  margin-top: 16px;
}

/* === 3. HEADER & BRAND BAR === */
.crm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.crm-brand b {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 16px;
}
.crm-brand h1 {
  font-size: 18px;
  color: var(--ink);
}

.crm-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crm-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}
.crm-nav-link:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.crm-gsearch {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}
.crm-gsearch input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  transition: all 0.2s ease;
}
.crm-gsearch input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.crm-gsearch::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.6;
  pointer-events: none;
}
.crm-gresults {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  display: grid;
  gap: 4px;
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(10, 14, 26, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  backdrop-filter: none;
}

.crm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* === 4. TABS NAVIGATION === */
.crm-tabs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow: visible;
  padding: 6px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.crm-tabs-more {
  position: relative;
  margin-left: auto;
}
.crm-more-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.crm-more-summary::-webkit-details-marker { display: none; }
.crm-tabs-more.has-active .crm-more-summary,
.crm-tabs-more[open] .crm-more-summary {
  color: var(--accent);
  border-color: var(--line-strong);
  background: rgba(56, 189, 248, 0.1);
}
.crm-tabs-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 196px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
}
.crm-tabs-menu button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.crm-tabs button {
  flex: none;
  min-height: 36px;
  padding: 6px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.crm-tabs button:hover {
  color: var(--ink);
  background: var(--panel2);
}
.crm-tabs button.on {
  background: var(--accent-gradient);
  color: var(--accent-ink);
  font-weight: 600;
}

/* === 5. BUTTONS, INPUTS, BADGES === */
.crm button, .crm select, .crm input, .crm textarea {
  font: inherit;
  color: var(--ink);
}
.crm label {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}
.crm select option {
  background: var(--panel);
  color: var(--ink);
}
.crm .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  cursor: pointer;
  min-height: 38px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}
.crm .btn:hover {
  background: var(--panel3);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--ink);
}
.crm .btn.primary {
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
}
.crm .btn.primary:hover {
  filter: brightness(1.06);
  color: var(--accent-ink);
}
.crm .btn.on {
  border-color: var(--line-strong);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}
.crm .btn.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.28);
}
.crm .btn.danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: var(--danger);
}

.crm input, .crm select, .crm textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b101b;
  min-height: 40px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.crm input:focus, .crm select:focus, .crm textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.crm textarea { min-height: 90px; resize: vertical; }

.crm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.crm-badge.on { border-color: var(--accent); color: var(--accent); background: rgba(56, 189, 248, 0.1); }
.crm-badge.warn { border-color: var(--warn); color: var(--warn); background: rgba(251, 191, 36, 0.1); }
.crm-badge.danger { border-color: var(--danger); color: var(--danger); background: rgba(248, 113, 113, 0.1); }
.crm-badge.ok { border-color: var(--ok); color: var(--ok); background: rgba(52, 211, 153, 0.1); }

/* === 6. METRICS & KPI TELEMETRY CARDS === */
.crm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.crm-stat {
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.crm-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.8;
}
.crm-stat strong {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* === 7. KANBAN SALES PIPELINE BOARD === */
.crm-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
}
.crm-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  min-width: 0;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.crm-col h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.crm-col h3 span:last-child {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.crm-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  margin-bottom: 10px;
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.crm-card:hover {
  border-color: var(--line-strong);
  background: var(--panel3);
}
.crm-card > *,
.crm-card .crm-row { min-width: 0; }
.crm-card strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.crm-card select {
  min-height: 34px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}
.crm-card-customer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.crm-card-customer-row .btn,
.crm-card .crm-row .btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s ease;
}
.crm-link-icon:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
}

/* === 8. CUSTOMER GRID & DRAWER === */
.crm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.crm-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
}
.crm-row > * { flex: 1 1 160px; }
.crm-row > .btn { flex: none; }

.crm-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.crm-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}
.crm-item:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  transform: translateX(2px);
}
.crm-item.has-avatar {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "av name ago" "av sub end";
  align-items: center;
  gap: 2px 14px;
}
.crm-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.crm-unread {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* === 9. TIMELINE & CHAT MESSENGER === */
.crm-timeline {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.crm-note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.crm-note small { display: block; color: var(--muted); margin-top: 4px; }
.crm-note.system {
  border-color: rgba(167, 139, 250, 0.26);
  background: rgba(167, 139, 250, 0.06);
}

.crm-chat {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 4px;
}
.crm-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}
.crm-msg.out {
  justify-self: end;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 500;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.crm-msg small { display: block; opacity: 0.75; font-size: 10px; margin-top: 4px; }

/* === 10. REPORt BARS & TABLES === */
.crm-bars { display: grid; gap: 10px; }
.crm-bar {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.crm-bar i {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-gradient);
  box-shadow: 0 0 10px var(--accent-glow);
}

.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table th, .crm-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.crm-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.crm-empty {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 48px 18px;
  color: var(--muted);
}
.crm-empty-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  font-size: 32px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .crm-grid { grid-template-columns: 1fr; }
  .crm-board { grid-template-columns: repeat(6, 260px); }
}
@media (max-width: 600px) {
  .crm { padding: 12px; }
  .crm-top { flex-direction: column; align-items: stretch; }
  .crm-user { justify-content: space-between; }
}

/* === CRM ACTIONS & QUICK SHIFT BUTTONS === */
.crm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.crm-shift-row { display: flex; gap: 6px; margin: 4px 0; align-items: center; }
.btn-shift {
  padding: 3px 8px !important;
  font-size: 11px !important;
  min-height: 26px !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--line) !important;
  color: var(--muted) !important;
}
.btn-shift:hover {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: rgba(56, 189, 248, 0.12) !important;
}
.btn-shift.next {
  margin-left: auto;
  color: var(--accent) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
  background: rgba(56, 189, 248, 0.08) !important;
}


/* === 2026-11 refresh (owner: "redesign the CRM page and other panel pages too") ===
   Same language as the home page, Anime Watch and the panel: Manrope, AMOLED black, neutral layered cards with a lit top
   edge and no backdrop blur, the cyan-to-indigo gradient on primary actions. Borders are neutral; cyan marks what is active. */
:root, html[data-theme="light"] {
  --bg: #000; --panel: #0a0c10; --line: rgba(255, 255, 255, 0.09); --line-strong: rgba(56, 189, 248, 0.42);
  --accent-ink: #031019; --accent-gradient: linear-gradient(120deg, #38bdf8, #6d8bff 62%, #a78bfa);
  --ux-card: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
}
body.reactvibe-crm, body.reactvibe-crm :is(button, input, select, textarea) {
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.reactvibe-crm :is(h1, h2, h3) { letter-spacing: -0.028em; }
.crm-top, .crm-tabs, .crm-panel, .crm-col {
  background: var(--ux-card), #0a0c10; -webkit-backdrop-filter: none; backdrop-filter: none;
  border-color: var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.crm-gresults { background: #0b0d11; -webkit-backdrop-filter: none; backdrop-filter: none; }
.crm-gresults:empty { display: none; }  /* an empty result box used to show as a stray bar under the search */
.crm-top, .crm-panel { border-radius: 22px; }
.crm-tabs button { border-radius: 12px; font-weight: 700; }
.crm-tabs button.on { background: rgba(56, 189, 248, 0.13); color: #8ad8ff; border-color: rgba(56, 189, 248, 0.34); box-shadow: none; }
.crm .btn.primary, .crm button.primary { box-shadow: 0 10px 26px -14px rgba(56, 189, 248, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35); font-weight: 800; }
.crm-nav-link { border-radius: 12px; }

/* Phone: the header was taller than half the screen and wider than the page (28px sideways scroll). */
@media (max-width: 600px) {
  .crm-top { padding: 12px; gap: 10px; }
  .crm-top > * { min-width: 0; max-width: 100%; }
  .crm-brand { flex-wrap: wrap; row-gap: 10px; }
  .crm-nav-links { display: flex; gap: 6px; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .crm-nav-links::-webkit-scrollbar { display: none; }
  .crm-nav-link { flex: 0 0 auto; white-space: nowrap; }
  .crm-gsearch { flex: 0 0 auto; width: 100%; max-width: none; }  /* flex: 1 made it 260px tall in the column layout */
  .crm-user { flex-wrap: wrap; gap: 8px; }
  .crm-table { display: block; max-width: 100%; overflow-x: auto; }  /* a wide table scrolls in its own box, not the page */
}
/* The public inquiry form's anti-spam field must stay off screen (the rule was lost in the CRM rebuild, so customers saw
   an extra empty field, and a message typed into it is dropped as spam). */
.crm-hide { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.crm .crm-top .crm-gsearch input { padding-left: 38px; }  /* keep the text clear of the search icon */

/* === 9. AI LEAD SCORING & AUTO FOLLOW-UP ENGINE === */
.crm-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.crm-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.crm-lead-hot {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}
.crm-lead-warm {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
.crm-lead-cold {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

.crm-followup-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 8px 0;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.crm-badge-overdue {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  font-weight: 700;
  animation: crmPulse 2.5s infinite;
}
.crm-badge-pending {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fcd34d !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}
.crm-badge-active {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(52, 211, 153, 0.35) !important;
}

.crm-followup-btn {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}
.crm-followup-btn:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.crm-followup-alert-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.14) 0%, rgba(245, 158, 11, 0.08) 100%), #0a0c10;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.12);
}
.crm-followup-alert-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.crm-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: crmPulse 1.5s infinite;
}

@keyframes crmPulse {
  0% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.6; transform: scale(0.95); }
}

/* Modal for AI Follow-up & Reminder */
.crm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: crmFadeIn 0.2s ease-out;
}
.crm-modal {
  width: 100%;
  max-width: 540px;
  background: #090b10;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  animation: crmSlideUp 0.25s ease-out;
}
@keyframes crmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes crmSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.crm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.crm-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.crm-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.crm-modal-close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}
.crm-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.crm-modal-summary {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.crm-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.crm-modal-title {
  font-size: 15px;
  color: #fff;
}
.crm-modal-customer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-secondary);
}
.crm-modal-reasons {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
}
.crm-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.crm-followup-textarea {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 90px;
  box-sizing: border-box;
}
.crm-followup-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.crm-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}


/* Loan applications and the per-role AI helper */
.crm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; min-width: 0; }
.crm-chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.25)); background: rgba(148, 163, 184, 0.08); color: var(--ink); max-width: 100%; overflow-wrap: anywhere; }
.crm-chip i { font-style: normal; color: var(--muted, #94a3b8); }
.crm-card-title-row .crm-card-title { min-width: 0; }
.crm-credit { min-width: 0; max-width: 100%; }
.crm-credit > * { min-width: 0; max-width: 100%; }
.crm-credit .crm-list { margin-top: 8px; }
.crm-credit .crm-row { flex-wrap: wrap; }
.crm-credit .crm-row .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-credit small, .crm-credit .crm-note { overflow-wrap: anywhere; }
.crm-ai-out:empty { display: none; }
.crm-ai-text { white-space: pre-wrap; line-height: 1.55; margin: 8px 0; overflow-wrap: anywhere; }

/* Bugun: the member's work list */
.crm-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; align-items: start; }
.crm-today-box .crm-item.has-avatar { cursor: default; grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "av name" "av sub" "act act"; gap: 2px 12px; }
.crm-today-box .crm-item > .crm-avatar { grid-area: av; }
.crm-today-box .crm-item > strong { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
.crm-today-box .crm-item > small { grid-area: sub; min-width: 0; overflow-wrap: anywhere; }
.crm-today-box .crm-item > .crm-end { grid-area: act; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; margin-top: 8px; }

/* Loan documents and repayments */
.crm-docs { margin-top: 8px; }
.crm-docs > summary { cursor: pointer; padding: 6px 0; }
.crm-docs a { color: var(--accent); overflow-wrap: anywhere; }
.crm-upload { position: relative; overflow: hidden; margin-top: 6px; }
.crm-upload .crm-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* === Deft UI Craft & Accessibility Polish === */
.crm-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  padding: 8px 14px;
  border-radius: 10px;
  background: #38bdf8;
  color: #030712;
  font-weight: 700;
  text-decoration: none;
}
.crm-skip-link:focus-visible {
  left: 16px;
  outline: 2px solid #f8fafc;
  outline-offset: 2px;
}
body.reactvibe-crm :is(h1, h2, h3) {
  text-wrap: balance;
}
.crm :is(.crm-stat, .crm-kpi-num, .crm-badge, .crm-lead-badge, .crm-table, .crm-credit, td, th) {
  font-variant-numeric: tabular-nums;
}
.crm :is(button, a, summary, select, input, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.crm-followup-btn {
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
@media (prefers-reduced-motion: reduce) {
  #vibeWavesCanvas { display: none; }
  .crm *, .crm *::before, .crm *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* member's reply to the customer's Telegram/Instagram chat */
.crm-chat-reply { display: grid; gap: 8px; margin-top: 10px; }
.crm-chat-reply textarea { width: 100%; box-sizing: border-box; resize: vertical; }

/* Services & auto-offer catalog manager */
.crm-svc-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 14px;
}
.crm-svc-head-text { min-width: 0; flex: 1 1 320px; }
.crm-svc-head-text h2 { margin-bottom: 4px; }
.crm-svc-head-text p { margin: 0; }
.crm-svc-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.crm-svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 12px;
  margin-top: 12px;
}
.crm-svc-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel2);
  min-width: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.crm-svc-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.crm-svc-card.is-hidden { opacity: 0.68; }
.crm-svc-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
}
.crm-svc-card-title { min-width: 0; flex: 1 1 200px; }
.crm-svc-card-title strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.crm-svc-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.crm-chip.is-accent {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}
.crm-chip.is-muted { opacity: 0.72; }
.crm-svc-snippet {
  margin: 0;
  font-size: 13px;
  line-height: 1.48;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.crm-svc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.crm-svc-actions .btn.on {
  border-color: rgba(56, 189, 248, 0.48);
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
}
.crm-svc-card.is-editing {
  border-color: var(--line-strong);
}
.crm-svc-editor-wrap,
.crm-svc-inline-edit {
  margin-top: 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.crm-svc-form-box {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.crm-svc-form-box label {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.crm-svc-form-box input,
.crm-svc-form-box select,
.crm-svc-form-box textarea {
  width: 100%;
  box-sizing: border-box;
}
.crm input[aria-invalid="true"],
.crm textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16);
}
.crm-svc-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.crm-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.crm-svc-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.crm-svc-trio {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 12px;
}
.crm-svc-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.crm-toggle-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  cursor: pointer;
  min-height: 40px;
  box-sizing: border-box;
}
.crm-toggle-pill input {
  width: auto !important;
  margin: 0;
  accent-color: var(--accent);
}
.crm-svc-preview {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.05);
}
.crm-svc-preview-text {
  margin: 6px 0 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.crm-svc-form-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
@media (max-width: 720px) {
  .crm-svc-presets > small { flex-basis: 100%; }
  .crm-svc-grid2,
  .crm-svc-trio { grid-template-columns: 1fr; }
  .crm-svc-actions .btn,
  .crm-svc-form-foot .btn { min-height: 44px; }
}

/* Settings 2-column Bento Layout */
.crm-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.crm-settings-grid > .crm-panel { margin-top: 0 !important; min-width: 0; }
.crm-settings-span2 { grid-column: 1 / -1; }
.crm-settings-stack { display: grid; gap: 16px; min-width: 0; }
.crm-settings-stack > .crm-panel { margin-top: 0 !important; min-width: 0; }
.crm-settings-audit .crm-scroll { max-height: 340px; overflow: auto; }
.crm-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 12px 0;
}
.crm-compact-grid > .crm-err { grid-column: 1 / -1; margin: 0; }
.crm-inline-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
@media (max-width: 960px) {
  .crm-settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .crm-compact-grid { grid-template-columns: 1fr; }
}

/* Bank Loans, Tariffs & Offerts Quick View + Inline Calculator & Graphics */
.crm-bank-panel,
.crm-calc-studio { display: grid; gap: 14px; }
.crm-bank-inline { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.crm-bank-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.crm-bank-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.crm-bank-search { flex: 1 1 240px; min-width: 180px; max-width: 340px; }
.crm-bank-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(56, 189, 248, 0.06);
}
.crm-bank-meta { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; }
.crm-bank-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}
.crm-bank-card.is-chosen { border-color: rgba(52, 211, 153, 0.38); }
.crm-chip.is-ok {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
}

.crm-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #0b101b;
  border: 1px solid var(--line);
}
.crm-seg .btn {
  flex: 1 1 auto;
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
}
.crm-seg .btn.on {
  background: var(--accent-gradient);
  color: var(--accent-ink);
  font-weight: 600;
}
.crm-calc-studio input[type="range"] {
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}
.crm-calc-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 12px;
}
.crm-chart-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel2);
  display: grid;
  gap: 10px;
  min-width: 0;
}
.crm-chart-card h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-secondary); }
.crm-chart-svg { width: 100%; height: auto; display: block; }
.crm-donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.crm-donut svg { width: 112px; height: 112px; flex: none; }
.crm-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 12px;
  min-width: 0;
}
.crm-chart-legend.inline { display: flex; flex-wrap: wrap; gap: 12px; }
.crm-chart-legend li { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.crm-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.crm-chart-legend b { margin-left: auto; padding-left: 8px; }
.crm-calc-schedule > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-secondary); padding: 6px 0; }
.crm-calc-table-wrap { max-height: 320px; overflow: auto; margin-top: 8px; }
.crm-calc-table-wrap td, .crm-calc-table-wrap th { font-variant-numeric: tabular-nums; }

/* === 2026-11 Obsidian SaaS & WCAG 2.2 AA CRM Polish === */
:root, html[data-theme="light"] {
  --bg: #080c14;
  --panel: #0f1623;
  --panel2: #151e2f;
  --panel3: #1b263b;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(56, 189, 248, 0.42);
  --accent: #38bdf8;
  --accent-ink: #04111d;
  --accent-gradient: #38bdf8;
}
.reactvibe-bg, #vibeWavesCanvas { display: none !important; }
body.reactvibe-crm { background: #080c14; color: var(--ink); }
.crm :is(.sx-emoji, .sx-emoji-img) { display: none !important; }
.crm-top, .crm-tabs, .crm-panel, .crm-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
}
.crm-gresults {
  background: var(--panel);
  border-color: var(--line);
}
.crm-brand b {
  background: var(--panel2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  box-shadow: none;
}
.crm-avatar {
  background: var(--panel2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  box-shadow: none;
}
.crm-unread {
  font-size: 12px;
  box-shadow: none;
}
.crm .btn,
.crm button {
  min-height: 40px;
}
.crm .btn.primary,
.crm button.primary,
.crm-seg .btn.on {
  background: #38bdf8;
  color: #04111d;
  border-color: transparent;
  font-weight: 700;
  box-shadow: none;
}
.crm .btn.primary:hover,
.crm button.primary:hover {
  background: #7dd3fc;
}
.crm-tabs button {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.crm-tabs button.on {
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.36);
}
.crm-lead-hot,
.crm-lead-warm { box-shadow: none; }
.crm-badge,
.crm-lead-badge,
.crm-msg small,
.crm-chip { font-size: 12px !important; }
.crm-skip-link {
  position: fixed;
  left: -9999px;
  top: 12px;
  z-index: 9999;
  padding: 10px 16px;
  border-radius: 8px;
  background: #38bdf8;
  color: #04111d;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.crm-skip-link:focus,
.crm-skip-link:focus-visible {
  left: 16px;
  outline: 2px solid #f8fafc;
  outline-offset: 2px;
}
