/* === REVOLVR CRM — base + 3 themes ============================== */

* { box-sizing: border-box; }

.crm-root {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 232px 1fr;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  font-feature-settings: "ss01", "cv11";
  transition: grid-template-columns .22s cubic-bezier(.2,.7,.3,1);
}
.crm-root[data-sidebar-collapsed="true"] {
  grid-template-columns: 60px 1fr;
}
.crm-root[data-sidebar-collapsed="true"] .crm-side {
  overflow: hidden;
}
.crm-root[data-sidebar-collapsed="true"] .crm-brand,
.crm-root[data-sidebar-collapsed="true"] .crm-nav-section,
.crm-root[data-sidebar-collapsed="true"] .crm-nav-item span:not(.ic),
.crm-root[data-sidebar-collapsed="true"] .crm-nav-item .badge,
.crm-root[data-sidebar-collapsed="true"] .crm-accounts {
  display: none;
}
.crm-root[data-sidebar-collapsed="true"] .crm-side {
  padding-top: 16px;
}
.crm-root[data-sidebar-collapsed="true"] .crm-nav-item {
  justify-content: center;
  padding: 8px;
}
.crm-root[data-sidebar-collapsed="true"] .crm-nav-item .ic {
  display: flex;
  width: 100%; justify-content: center;
}
.crm-root[data-sidebar-collapsed="true"] .crm-side-collapsed-mark {
  display: grid !important;
}
.crm-side-collapsed-mark {
  display: none;
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--accent-grad, var(--accent));
  color: white;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  margin: 0 auto 16px;
}
.sidebar-toggle {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-s);
  cursor: pointer;
  color: var(--text-2);
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ---------- shared tokens (overridden per theme) ----------------- */
.crm-root {
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --font-display: "Geist", ui-sans-serif, system-ui, sans-serif;
}

/* ============ Theme A — "Atrio" (clean pro, deep brand teal) ===== */
.crm-root[data-theme="atrio"] {
  --bg: #f7f9fa;
  --surface: #ffffff;
  --surface-2: #eff3f5;
  --border: #e1e6ea;
  --border-strong: #c8d0d6;
  --text: #0d1419;
  --text-2: #4d5b66;
  --text-3: #8593a0;
  --accent: #0e7a9a;
  --accent-2: #22b4c6;
  --accent-grad: linear-gradient(135deg, #0e7a9a 0%, #22b4c6 100%);
  --accent-soft: #def0f4;
  --accent-ink: #07435a;
  --danger: #b3361f;
  --danger-soft: #fbe9e5;
  --warning: #b56b00;
  --warning-soft: #fbf0d8;
  --info: #2a5dab;
  --info-soft: #e6edf9;
  --radius-s: 5px;
  --radius-m: 7px;
  --radius-l: 10px;
  --shadow-card: 0 1px 0 rgba(15,40,55,.02), 0 2px 8px -4px rgba(15,40,55,.08);
  --shadow-pop: 0 12px 36px -8px rgba(10,40,55,.22), 0 0 0 1px rgba(15,40,55,.06);
  --row-h: 36px;
  --density: 1;
  --tab-style: underline;
}

/* ============ Theme B — "Reposo" (warm light, muted teal) ======== */
.crm-root[data-theme="reposo"] {
  --bg: #f6f3ec;
  --surface: #fdfaf3;
  --surface-2: #ede9df;
  --border: #ddd6c5;
  --border-strong: #c6bda7;
  --text: #1d2730;
  --text-2: #5c6770;
  --text-3: #95938b;
  --accent: #128299;
  --accent-2: #2eb0c1;
  --accent-grad: linear-gradient(135deg, #128299 0%, #2eb0c1 100%);
  --accent-soft: #e0eef1;
  --accent-ink: #064654;
  --danger: #a83a2b;
  --danger-soft: #f4dfd9;
  --warning: #a47200;
  --warning-soft: #f6ecc7;
  --info: #3e6294;
  --info-soft: #e3eaf3;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --shadow-card: 0 1px 0 rgba(70,50,20,.03), 0 4px 14px -6px rgba(70,50,20,.08);
  --shadow-pop: 0 18px 48px -10px rgba(70,50,20,.18), 0 0 0 1px rgba(70,50,20,.06);
  --row-h: 44px;
  --density: 1.1;
  --tab-style: pill;
}

/* ============ Theme C — "Aurora" (electric brand cyan) =========== */
.crm-root[data-theme="aurora"] {
  --bg: #f6fbfd;
  --surface: #ffffff;
  --surface-2: #ebf5f8;
  --border: #d9e6eb;
  --border-strong: #b6cdd6;
  --text: #07141a;
  --text-2: #455761;
  --text-3: #7e8e98;
  --accent: #16a9be;
  --accent-2: #5fd4e1;
  --accent-grad: linear-gradient(135deg, #0d7d96 0%, #16a9be 50%, #5fd4e1 100%);
  --accent-soft: #d8f0f4;
  --accent-ink: #064654;
  --danger: #c4244c;
  --danger-soft: #fbe2ea;
  --warning: #a26500;
  --warning-soft: #f8e9c5;
  --info: #1f5fc2;
  --info-soft: #e2ecfb;
  --radius-s: 6px;
  --radius-m: 9px;
  --radius-l: 14px;
  --shadow-card: 0 1px 0 rgba(10,40,55,.02), 0 6px 20px -8px rgba(10,80,100,.15);
  --shadow-pop: 0 20px 56px -12px rgba(10,80,100,.28), 0 0 0 1px rgba(15,80,100,.07);
  --row-h: 38px;
  --density: 1.02;
  --tab-style: bar;
}

/* ============ Sidebar =========================================== */
.crm-side {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.crm-root[data-theme="reposo"] .crm-side { background: var(--surface-2); }

.crm-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 18px 16px 14px;
}
.crm-brand-logo {
  width: auto;
  max-width: 180px;
  height: 44px;
  object-fit: contain;
  object-position: left center;
  display: block;
}
.crm-brand-name {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
}

.crm-nav { padding: 6px 8px; display: flex; flex-direction: column; gap: 1px; }
.crm-nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); font-weight: 600;
  padding: 14px 10px 6px;
}
.crm-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  border: 0; background: transparent; text-align: left;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.crm-nav-item:hover { background: var(--surface-2); color: var(--text); }
.crm-nav-item[data-active="true"] {
  background: var(--surface-2);
  color: var(--text);
}
.crm-root[data-theme="aurora"] .crm-nav-item[data-active="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.crm-nav-item .ic { color: var(--text-3); flex: 0 0 auto; }
.crm-nav-item[data-active="true"] .ic { color: var(--accent); }
.crm-nav-item .badge {
  margin-left: auto;
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

/* account list at bottom of sidebar */
.crm-accounts { margin-top: auto; padding: 8px; border-top: 1px solid var(--border); }
.crm-acct {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--radius-s);
  cursor: pointer; transition: background .12s;
}
.crm-acct:hover { background: var(--surface-2); }
.crm-acct-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.crm-acct-meta { min-width: 0; flex: 1; }
.crm-acct-handle {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-acct-status {
  font-size: 10.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 4px;
}
.crm-acct-status::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.crm-acct-status[data-state="expiring"]::before { background: var(--warning); }
.crm-acct-status[data-state="error"]::before { background: var(--danger); }

/* ============ Main panel ======================================== */
.crm-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0; min-height: 0;
}

.crm-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.crm-page-title {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px;
}
.crm-page-title .crumb {
  color: var(--text-3); font-weight: 500;
}
.crm-page-title .sep { color: var(--text-3); }
.crm-search {
  margin-left: auto; position: relative;
  display: flex; align-items: center;
}
.crm-search input {
  width: 240px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 7px 10px 7px 30px;
  font-family: inherit; font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color .12s, background .12s;
}
.crm-search input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}
.crm-search .ic-search {
  position: absolute; left: 9px; color: var(--text-3); pointer-events: none;
}
.crm-search kbd {
  position: absolute; right: 6px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}

.crm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.crm-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.crm-btn[data-variant="primary"] {
  background: var(--accent); color: white; border-color: var(--accent);
}
.crm-btn[data-variant="primary"]:hover { filter: brightness(1.06); }
.crm-btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--text-2); }
.crm-btn[data-variant="ghost"]:hover { background: var(--surface-2); color: var(--text); }

/* tabs */
.crm-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.crm-tab {
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-2);
  padding: 11px 12px;
  border: 0; background: transparent;
  cursor: pointer;
  position: relative;
  border-radius: 4px 4px 0 0;
}
.crm-tab:hover { color: var(--text); }
.crm-tab[data-active="true"] { color: var(--text); }
.crm-tab[data-active="true"]::after {
  content: ""; position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px; background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.crm-root[data-theme="reposo"] .crm-tab[data-active="true"] {
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: var(--radius-m) var(--radius-m) 0 0;
}
.crm-root[data-theme="reposo"] .crm-tab[data-active="true"]::after { display: none; }

.crm-content {
  min-height: 0; min-width: 0;
  overflow: auto;
  background: var(--bg);
}

/* ============ Pipeline / Kanban ================================ */
.kanban-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.kanban-toolbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid transparent;
  cursor: pointer;
}
.chip:hover { background: var(--surface); border-color: var(--border); }
.chip[data-active="true"] {
  background: var(--accent-soft); color: var(--accent-ink);
  border-color: transparent;
}
.chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 12px;
  padding: 16px 20px 20px;
  width: max-content;
  min-width: 100%;
  align-items: start;
}
.crm-root[data-theme="reposo"] .kanban { grid-auto-columns: 296px; gap: 14px; }

/* horizontal scroll container for the kanban */
.pipeline-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  scrollbar-gutter: stable;
}
.pipeline-scroll::-webkit-scrollbar {
  height: 14px;
  width: 14px;
}
.pipeline-scroll::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.pipeline-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 3px solid var(--surface-2);
  min-width: 60px;
}
.pipeline-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
/* Firefox */
.pipeline-scroll {
  scrollbar-width: auto;
  scrollbar-color: var(--border-strong) var(--surface-2);
}

/* nav arrows floating over the scroll container */
.pipeline-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.02);
  z-index: 4;
  transition: background .12s, color .12s, transform .12s, opacity .12s;
}
.pipeline-nav-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.06);
}
.pipeline-nav-btn[data-side="left"]  { left: 12px; }
.pipeline-nav-btn[data-side="right"] { right: 12px; }
.pipeline-nav-btn:disabled {
  opacity: 0; pointer-events: none;
}

.kan-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 220px);
  min-height: 240px;
}
.crm-root[data-theme="atrio"] .kan-col {
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.kan-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
  letter-spacing: -.005em;
  position: relative;
}
.kan-col-head .count {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--text-3); font-weight: 500;
  background: var(--surface);
  border-radius: 3px;
  padding: 1px 6px;
  border: 1px solid var(--border);
}
.kan-col-head .stage-dot {
  width: 10px; height: 10px; border-radius: 50%;
  cursor: pointer;
  border: 1.5px solid var(--surface);
  outline: 1px solid var(--border);
  transition: transform .12s;
  flex: 0 0 auto;
}
.kan-col-head .stage-dot:hover {
  transform: scale(1.18);
  outline-color: var(--accent);
}
.kan-col-head .title-text {
  flex: 1;
  cursor: text;
  padding: 2px 4px;
  border-radius: 3px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kan-col-head .title-text:hover { background: var(--surface); }
.kan-col-head .title-input {
  flex: 1;
  font: inherit; font-weight: 600;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 4px;
  outline: none;
  min-width: 0;
}
.kan-col-head .col-kebab {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--text-3);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.kan-col:hover .kan-col-head .col-kebab,
.kan-col-head:has(.col-menu) .col-kebab,
.kan-col-head:has(.color-pop) .col-kebab { opacity: 1; }
.kan-col-head .col-kebab:hover { background: var(--surface-2); color: var(--text); }

/* column menu */
.col-menu {
  position: absolute;
  top: 100%; right: 4px;
  margin-top: 4px;
  background: var(--surface);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  padding: 4px;
  min-width: 180px;
  z-index: 6;
}
.col-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0; background: transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.col-menu button:hover { background: var(--surface-2); }
.col-menu .danger { color: var(--danger); }
.col-menu .danger:hover { background: var(--danger-soft); }
.col-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.col-menu .swatch-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px;
}
.col-menu .swatch-row .sw {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.col-menu .swatch-row .sw:hover { transform: scale(1.15); }
.col-menu .swatch-row .sw[data-active="true"] { border-color: var(--text); }

/* add stage tile */
.kan-add-col {
  align-self: stretch;
  width: 220px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--text-3);
  font-family: inherit; font-size: 13px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  cursor: pointer;
  min-height: 240px;
  transition: background .12s, color .12s, border-color .12s;
}
.kan-add-col:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.kan-add-col small {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
}
.kan-add-col:hover small { color: var(--accent-ink); }

/* New-stage form popover */
.new-stage-form {
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 10px;
  align-self: center;
}
.new-stage-form .label {
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  font-weight: 600;
}
.new-stage-form input {
  font: inherit; font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.new-stage-form input:focus { border-color: var(--accent); }
.new-stage-form .swatch-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.new-stage-form .swatch-row .sw {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.new-stage-form .swatch-row .sw:hover { transform: scale(1.15); }
.new-stage-form .swatch-row .sw[data-active="true"] { border-color: var(--text); }
.new-stage-form .actions {
  display: flex; gap: 6px; justify-content: flex-end;
}

/* Delete confirm modal */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, .35);
  z-index: 50;
  display: grid; place-items: center;
  animation: fade .14s ease;
}
.confirm-modal {
  width: 440px;
  background: var(--surface);
  border-radius: var(--radius-l);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  padding: 22px;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
.confirm-modal h3 {
  margin: 0 0 8px;
  font-size: 17px; font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.confirm-modal p {
  margin: 0 0 14px;
  font-size: 13px; line-height: 1.5;
  color: var(--text-2);
}
.confirm-modal select {
  width: 100%;
  margin-bottom: 14px;
  font: inherit; font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
}
.confirm-modal .actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.kan-col-body {
  padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}
.kan-col-body.is-over {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: var(--radius-m);
}

.kan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 10px 11px;
  cursor: grab;
  transition: box-shadow .14s, transform .14s, border-color .12s;
  position: relative;
}
.kan-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}
.kan-card.dragging {
  opacity: .4;
  cursor: grabbing;
}
.kan-card .top-row {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 6px;
}
.kan-card .ig-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
}
.kan-card .name {
  font-size: 13px; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.kan-card .name small {
  font-weight: 500; color: var(--text-3); margin-left: 4px;
}
.kan-card .biz {
  font-size: 11.5px; color: var(--text-2);
  line-height: 1.35;
  margin-bottom: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kan-card .msg {
  font-size: 11.5px;
  color: var(--text-2);
  padding: 7px 8px;
  background: var(--surface-2);
  border-radius: var(--radius-s);
  border-left: 2px solid var(--border-strong);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 7px;
}
.kan-card .meta-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.kan-card .origin-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  letter-spacing: .02em;
  text-transform: lowercase;
}
.kan-card .origin-badge[data-origin="historia"] { background: #fce3ec; color: #9c1f59; }
.kan-card .origin-badge[data-origin="reel"]     { background: #ede1fb; color: #5c2799; }
.kan-card .origin-badge[data-origin="carrusel"] { background: #fcedcc; color: #8a5300; }
.kan-card .origin-badge[data-origin="dm"]       { background: #def0fd; color: #19498f; }

.kan-card .meta-row .ig-acct {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--text-3);
}
.kan-card .meta-row .time { margin-left: auto; font-variant-numeric: tabular-nums; }
.kan-card .meta-row .unread {
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 14px;
  text-align: center;
}
.kan-card .ideal {
  position: absolute; top: 9px; right: 9px;
  width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--accent);
}

.kan-col-add {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
  padding: 7px;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.kan-col-add:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text-3);
}

/* ============ Drawer ============================================ */
.drawer-back {
  position: absolute; inset: 0;
  background: rgba(20, 18, 12, .22);
  z-index: 20;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(620px, 70%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  z-index: 21;
  display: grid; grid-template-rows: auto auto 1fr;
  animation: slide .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes slide { from { transform: translateX(20px); opacity: 0 } }

.drawer-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .ig-avatar-lg {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 17px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.drawer-head .who { flex: 1; min-width: 0; }
.drawer-head .who h2 {
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 2px;
}
.drawer-head .who .handle {
  font-size: 12.5px; color: var(--text-3);
}
.drawer-head .who .handle a {
  color: inherit; text-decoration: none;
}
.drawer-head .who .handle a:hover { color: var(--accent); }
.drawer-head .actions { display: flex; gap: 6px; align-items: center; }
.drawer-head .close-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  border-radius: var(--radius-s); cursor: pointer;
  color: var(--text-2);
}
.drawer-head .close-btn:hover { background: var(--surface-2); color: var(--text); }

.drawer-meta {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.crm-root[data-theme="atrio"] .drawer-meta { background: var(--surface); }
.drawer-meta .field { min-width: 0; }
.drawer-meta .field .lbl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 600;
  margin-bottom: 4px;
}
.drawer-meta .field .val {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  display: flex; align-items: center; gap: 5px;
}

.drawer-body { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.drawer-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-tab {
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  padding: 10px 12px;
  border: 0; background: transparent;
  cursor: pointer; position: relative;
}
.drawer-tab[data-active="true"] { color: var(--text); }
.drawer-tab[data-active="true"]::after {
  content: ""; position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--accent);
}
.drawer-tab .pill {
  margin-left: 5px;
  background: var(--surface-2);
  font-size: 10px; padding: 1px 5px; border-radius: 999px;
  color: var(--text-3);
}
.drawer-pane { overflow: auto; min-height: 0; }

/* IG conversation */
.conv {
  padding: 16px 20px 80px;
  display: flex; flex-direction: column; gap: 10px;
}
.conv-day {
  align-self: center;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 3px 9px; border-radius: 999px;
  margin: 4px 0;
  border: 1px solid var(--border);
}
.conv-msg {
  max-width: 78%;
  padding: 9px 12px;
  font-size: 13px; line-height: 1.4;
  border-radius: 14px;
  word-wrap: break-word;
  position: relative;
}
.conv-msg.them {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.conv-msg.us {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.crm-root[data-theme="aurora"] .conv-msg.us {
  background: var(--accent-grad);
}
.crm-root[data-theme="reposo"] .conv-msg.us {
  background: var(--accent);
}
.conv-msg .ts {
  font-size: 10px; opacity: .6;
  margin-left: 8px;
}
.conv-msg .ts.below {
  display: block; margin: 4px 0 0 0; opacity: .55;
}
.conv-readonly-banner {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2);
  margin-top: auto;
}

/* notes pane */
.notes-pane { padding: 16px 20px; }
.note-item {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-m);
  margin-bottom: 8px;
  border-left: 2px solid var(--accent);
}
.note-item .note-h {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-3);
  margin-bottom: 4px;
}
.note-item .note-body {
  font-size: 13px; line-height: 1.45;
}
.note-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 10px 12px;
  font-family: inherit; font-size: 13px;
  color: var(--text);
  resize: vertical;
  min-height: 70px;
  outline: none;
  margin-top: 10px;
}
.note-input:focus { border-color: var(--accent); }

/* history pane */
.hist-list { padding: 16px 20px; }
.hist-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.hist-item::before {
  content: ""; position: absolute;
  left: 7px; top: 22px; bottom: -8px;
  width: 1px; background: var(--border);
}
.hist-item:last-child::before { display: none; }
.hist-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--text-3);
  margin-top: 6px;
}
.hist-dot[data-kind="created"] { border-color: var(--info); }
.hist-dot[data-kind="stage"] { border-color: var(--accent); }
.hist-dot[data-kind="note"] { border-color: var(--warning); }
.hist-dot[data-kind="msg"] { border-color: var(--text-3); }
.hist-text { font-size: 12.5px; line-height: 1.4; }
.hist-text .e { font-weight: 600; }
.hist-text .det { color: var(--text-2); }
.hist-text .ts { color: var(--text-3); font-size: 11px; margin-top: 1px; }

/* ============ Tabla resumen ===================================== */
.table-wrap { padding: 16px 20px; }
.tbl {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  border-spacing: 0;
  font-size: 12.5px;
  overflow: hidden;
}
.tbl thead th {
  text-align: left;
  font-weight: 600; color: var(--text-2);
  padding: 9px 12px;
  font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.tbl .name-cell {
  display: flex; align-items: center; gap: 8px;
}
.tbl .stage-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--surface-2);
}
.tbl .stage-pill .d { width: 6px; height: 6px; border-radius: 50%; }

/* ============ Analítica ========================================== */
.analytics {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.metric-card .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 600;
}
.metric-card .val {
  font-family: var(--font-sans);
  font-size: 30px; line-height: 1.1;
  letter-spacing: -.02em;
  margin-top: 6px;
  font-weight: 600;
  color: var(--text);
}
.metric-card .delta {
  font-size: 11px; font-weight: 500;
  margin-top: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.delta[data-dir="up"] { color: var(--accent); }
.delta[data-dir="down"] { color: var(--danger); }
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.chart-card h3 {
  font-size: 13px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.chart-card h3 small { font-weight: 500; color: var(--text-3); font-size: 11px; }

/* funnel */
.funnel {
  display: flex; flex-direction: column; gap: 8px;
  font-size: 12px;
}
.funnel-row {
  display: grid; grid-template-columns: 130px 1fr 60px;
  gap: 10px; align-items: center;
}
.funnel-bar {
  background: var(--surface-2);
  border-radius: var(--radius-s);
  height: 28px;
  position: relative;
  overflow: hidden;
}
.funnel-bar .fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: var(--radius-s);
  display: flex; align-items: center;
  padding-left: 10px;
  color: white;
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.funnel-row .pct {
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text-2); font-weight: 500;
}

/* ============ Conexiones / OAuth =============================== */
.conn-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.conn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 10px;
}
.conn-card .head {
  display: flex; align-items: center; gap: 10px;
}
.conn-card .ig-avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 14px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.conn-card .head .meta { min-width: 0; flex: 1; }
.conn-card h4 {
  font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -.01em;
}
.conn-card h4 small { color: var(--text-3); font-weight: 500; }
.conn-card .status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.conn-card .status-pill[data-state="expiring"] {
  background: var(--warning-soft); color: var(--warning);
}
.conn-card .status-pill[data-state="error"] {
  background: var(--danger-soft); color: var(--danger);
}
.conn-card .status-pill .d {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.conn-card .grid2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-top: 4px;
  font-size: 11.5px;
}
.conn-card .grid2 .l { color: var(--text-3); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.conn-card .grid2 .v { color: var(--text); font-weight: 500; }
.conn-card .actions { display: flex; gap: 6px; margin-top: 6px; }

.conn-add {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-m);
  min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit; font-size: 13px;
  transition: background .12s, color .12s, border-color .12s;
}
.conn-add:hover { background: var(--surface); color: var(--text); border-color: var(--text-3); }

/* ============ Toast (new message simulated) ===================== */
.toast-stack {
  position: absolute; right: 18px; bottom: 18px;
  z-index: 30;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 11px 12px 11px 11px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  min-width: 280px; max-width: 360px;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { transform: translateY(8px); opacity: 0 } }
.toast .ig-avatar-md {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 13px;
  display: grid; place-items: center;
}
.toast .t-body { min-width: 0; }
.toast .t-title {
  font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 1px;
}
.toast .t-title .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.toast .t-msg {
  font-size: 12px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.toast button {
  border: 0; background: transparent;
  font-family: inherit; font-size: 11.5px;
  color: var(--accent); font-weight: 600;
  padding: 0 6px;
  cursor: pointer;
  align-self: start;
}

/* ============ OAuth modal mock ================================== */
.oauth-overlay {
  position: absolute; inset: 0;
  background: rgba(20, 18, 12, .35);
  z-index: 40;
  display: grid; place-items: center;
  animation: fade .16s ease;
}
.oauth-modal {
  width: 420px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.4);
  font-family: var(--font-sans);
  color: #1c1c1e;
}
.oauth-fb-bar {
  background: #1877f2;
  color: white;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.oauth-body { padding: 22px 22px 18px; }
.oauth-body h3 {
  margin: 0 0 6px; font-size: 16px; font-weight: 600;
}
.oauth-body p { margin: 0 0 14px; font-size: 13px; color: #4a4a4c; line-height: 1.45; }
.oauth-perms {
  background: #f5f5f7;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 16px;
}
.oauth-perms .perm { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; }
.oauth-perms .perm .ck { color: #10b981; font-weight: 700; margin-top: 1px; flex: 0 0 auto; }
.oauth-perms .perm .t { color: #1c1c1e; }
.oauth-perms .perm .d { color: #6a6a6c; font-size: 11.5px; }
.oauth-acct-pick {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.oauth-acct-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid #e5e5ea;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.oauth-acct-row:hover { background: #f9f9fb; }
.oauth-acct-row[data-sel="true"] {
  border-color: #1877f2;
  background: #eaf2fe;
}
.oauth-acct-row .ig-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 13px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.oauth-acct-row .info { flex: 1; min-width: 0; font-size: 12.5px; }
.oauth-acct-row .info .h { font-weight: 600; }
.oauth-acct-row .info .s { color: #6a6a6c; font-size: 11.5px; }
.oauth-acct-row .radio {
  width: 18px; height: 18px; border: 2px solid #d0d0d4;
  border-radius: 50%; flex: 0 0 auto; position: relative;
}
.oauth-acct-row[data-sel="true"] .radio { border-color: #1877f2; }
.oauth-acct-row[data-sel="true"] .radio::after {
  content: ""; position: absolute; inset: 3px;
  background: #1877f2; border-radius: 50%;
}
.oauth-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 22px 22px;
}
.oauth-actions button {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
}
.oauth-actions .cancel { background: transparent; color: #4a4a4c; border-color: #e5e5ea; }
.oauth-actions .submit { background: #1877f2; color: white; }

.oauth-success {
  padding: 36px 28px 22px; text-align: center;
}
.oauth-success .check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  display: grid; place-items: center;
  margin: 0 auto 14px;
  color: white;
}
.oauth-success h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.oauth-success p { font-size: 13px; color: #4a4a4c; margin: 0 0 16px; }

/* ============ Empty / small helpers ============================= */
.empty {
  display: grid; place-items: center;
  padding: 40px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.kbd-hint {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ============ Post popover (origin click) ======================= */
.post-overlay {
  position: absolute; inset: 0;
  background: rgba(20, 18, 12, .32);
  z-index: 35;
  display: grid; place-items: center;
  animation: fade .14s ease;
  padding: 24px;
}
.post-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 720px; width: 100%;
  overflow: hidden;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
.post-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  display: grid; place-items: center;
  color: rgba(255,255,255,.85);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 84px;
  letter-spacing: -.04em;
  overflow: hidden;
}
.post-thumb[data-type="carrusel"] {
  aspect-ratio: 1 / 1;
  align-self: center;
}
.post-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.55) 100%);
}
.post-thumb .type-chip {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,.92);
  color: #15131e;
  font-size: 10.5px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  text-transform: uppercase; letter-spacing: .04em;
  z-index: 2;
}
.post-thumb .play-overlay {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.post-thumb .hook-overlay {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  z-index: 2;
  color: white;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px; line-height: 1.25;
  letter-spacing: -.01em;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.post-info {
  padding: 22px 24px;
  display: flex; flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.post-info .head { display: flex; align-items: center; gap: 9px; }
.post-info .head .ig-avatar-md {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 11px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.post-info .head .meta { font-size: 12px; }
.post-info .head .meta .h { font-weight: 600; color: var(--text); }
.post-info .head .meta .s { color: var(--text-3); font-size: 11px; }
.post-info h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 18px; line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--text);
}
.post-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.post-stat .lbl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 600;
}
.post-stat .v {
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.post-stat .v small { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.post-info .conv-callout {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 12.5px;
}
.post-info .conv-callout .big {
  font-family: var(--font-sans);
  font-size: 22px; line-height: 1; letter-spacing: -.02em;
  font-weight: 600;
}
.post-info .actions {
  display: flex; gap: 8px; margin-top: auto;
}
.post-info .actions a, .post-info .actions button {
  flex: 1; text-align: center;
}

/* DM (no post) variant */
.post-modal.is-dm {
  grid-template-columns: 1fr;
  max-width: 460px;
}
.post-modal.is-dm .post-info { padding: 28px 28px 24px; }
.post-modal.is-dm .post-info h3 { font-size: 20px; }
.dm-icon-frame {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white;
  display: grid; place-items: center;
  margin-bottom: 4px;
}

/* Origin badge clickable affordance */
.origin-clickable {
  cursor: pointer;
  transition: filter .12s, transform .08s;
}
.origin-clickable:hover { filter: brightness(.93); }
.origin-clickable:active { transform: scale(.97); }

/* ============ Top posts (analytics) ============================= */
.toppost-list {
  display: flex; flex-direction: column;
}
.toppost-row {
  display: grid;
  grid-template-columns: auto 48px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  border-radius: var(--radius-s);
}
.toppost-row:hover { background: var(--surface-2); }
.toppost-row:last-child { border-bottom: 0; }
.toppost-row .rank {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--text-3); font-weight: 500;
  width: 28px; text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.toppost-row .mini-thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-s);
  display: grid; place-items: center;
  color: rgba(255,255,255,.9);
  font-family: var(--font-sans); font-weight: 600;
  font-size: 18px;
  position: relative;
  overflow: hidden;
}
.toppost-row .mini-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.4) 100%);
}
.toppost-row .body { min-width: 0; }
.toppost-row .cap {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toppost-row .sub {
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
}
.toppost-row .sub .type-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 600; text-transform: lowercase;
  padding: 1px 6px; border-radius: 3px;
  font-size: 10px; letter-spacing: .02em;
}
.toppost-row .sub .type-tag[data-type="reel"]     { background: #ede1fb; color: #5c2799; }
.toppost-row .sub .type-tag[data-type="historia"] { background: #fce3ec; color: #9c1f59; }
.toppost-row .sub .type-tag[data-type="carrusel"] { background: #fcedcc; color: #8a5300; }
.toppost-row .convs {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.toppost-row .convs .n {
  font-family: var(--font-sans);
  font-size: 18px; font-weight: 600; line-height: 1;
  letter-spacing: -.01em;
  color: var(--text);
}
.toppost-row .convs .l {
  font-size: 10.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  margin-top: 1px;
}

/* ============ Date range chips ================================== */
.daterange-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 20px 0;
  flex-wrap: wrap;
}
.daterange-bar .lbl {
  font-size: 11.5px; color: var(--text-3);
  margin-right: 4px;
}
.daterange-bar .sep {
  width: 1px; height: 16px; background: var(--border); margin: 0 4px;
}

/* ============ Responsive (container queries on .crm-root) ======= */
/* When the CRM container is narrow (mobile artboard or shrunken browser),
   collapse the sidebar to an overlay, simplify the topbar, stack analytics
   in 2 cols, full-width drawer / modals, toast at top. */

/* ============ Mobile (separate MobileCRMApp) =================== */
/* Simplified mobile app: just pipeline + tap-to-open conversation +
   button to jump to the Instagram profile. No analytics/connections/OAuth. */

.crm-m {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
  font-feature-settings: "ss01", "cv11";
}

/* Topbar */
.crm-m-top {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.crm-m-top .logo {
  height: 24px;
  flex: 1; min-width: 0;
  object-fit: contain; object-position: left center;
}
.crm-m-top .bell-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  border-radius: var(--radius-s);
  color: var(--text-2);
  cursor: pointer; position: relative;
  flex: 0 0 auto;
}
.crm-m-top .bell-btn:active { background: var(--surface-2); }
.crm-m-top .bell-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--surface);
}

/* Stage pills (horizontal scroll) */
.crm-m-pills {
  display: flex; gap: 6px;
  padding: 10px 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.crm-m-pills::-webkit-scrollbar { display: none; }
.crm-m-pill {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.crm-m-pill[data-active="true"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.crm-m-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.crm-m-pill .n {
  background: rgba(0,0,0,.06);
  color: var(--text-2);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.crm-m-pill[data-active="true"] .n {
  background: rgba(255,255,255,.22);
  color: white;
}

/* Stage header (shown above the card list) */
.crm-m-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 6px;
}
.crm-m-header h2 {
  margin: 0;
  font-size: 18px; font-weight: 700; letter-spacing: -.015em;
  display: flex; align-items: center; gap: 8px;
}
.crm-m-header h2 .dot {
  width: 9px; height: 9px; border-radius: 50%;
}
.crm-m-header .count {
  margin-left: auto;
  font-size: 12px; color: var(--text-3);
}

/* Card list */
.crm-m-list {
  overflow-y: auto;
  padding: 8px 12px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.crm-m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px 13px;
  position: relative;
  display: flex; flex-direction: column; gap: 7px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.crm-m-card:active { background: var(--surface-2); }
.crm-m-card .head {
  display: flex; align-items: center; gap: 10px;
}
.crm-m-card .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 13px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.crm-m-card .who {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.crm-m-card .who .name {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.crm-m-card .who .name .ideal {
  color: var(--accent);
}
.crm-m-card .who .h {
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-m-card .right {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.crm-m-card .right .time {
  font-size: 10.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.crm-m-card .right .unread {
  background: var(--accent);
  color: white; font-weight: 700;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.crm-m-card .biz {
  font-size: 12.5px; color: var(--text-2);
  line-height: 1.4;
}
.crm-m-card .msg {
  font-size: 13px;
  color: var(--text-2);
  padding: 9px 11px;
  background: var(--surface-2);
  border-radius: var(--radius-s);
  border-left: 2px solid var(--border-strong);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.crm-m-card .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-3);
}
.crm-m-card .origin-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .02em;
  padding: 2px 7px; border-radius: 4px;
}
.crm-m-card .origin-tag[data-origin="historia"] { background: #fce3ec; color: #9c1f59; }
.crm-m-card .origin-tag[data-origin="reel"]     { background: #ede1fb; color: #5c2799; }
.crm-m-card .origin-tag[data-origin="carrusel"] { background: #fcedcc; color: #8a5300; }
.crm-m-card .origin-tag[data-origin="dm"]       { background: #def0fd; color: #19498f; }

.crm-m-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* Conversation view (full-screen takeover) */
.crm-m-conv {
  position: absolute; inset: 0;
  background: var(--bg);
  z-index: 25;
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: convIn .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes convIn { from { opacity: 0; transform: translateX(16px); } }

.crm-m-conv-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.crm-m-conv-head .back-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--text);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.crm-m-conv-head .back-btn:active { background: var(--surface-2); }
.crm-m-conv-head .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 13px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.crm-m-conv-head .who { flex: 1; min-width: 0; }
.crm-m-conv-head .who .name {
  font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.crm-m-conv-head .who .h { font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-m-conv-head .stage-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  flex: 0 0 auto;
}
.crm-m-conv-head .stage-pill .d { width: 6px; height: 6px; border-radius: 50%; }

.crm-m-conv-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  padding: 10px 16px 4px;
  font-size: 11px;
}
.crm-m-conv-meta .l {
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
  font-size: 10px; font-weight: 600;
}
.crm-m-conv-meta .v {
  color: var(--text); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px;
}

.crm-m-conv-body {
  overflow-y: auto;
  padding: 14px 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.crm-m-conv-day {
  align-self: center;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 3px 10px; border-radius: 999px;
  margin: 6px 0 2px;
  border: 1px solid var(--border);
}
.crm-m-conv-msg {
  max-width: 80%;
  padding: 9px 12px;
  font-size: 13.5px; line-height: 1.4;
  border-radius: 16px;
  position: relative;
}
.crm-m-conv-msg.them {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.crm-m-conv-msg.us {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.crm-m-conv-msg .ts {
  display: block; font-size: 10px; opacity: .55; margin-top: 3px;
}

/* Bottom CTA bar */
.crm-m-conv-cta {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.crm-m-conv-cta .read-hint {
  font-size: 11px; color: var(--text-3);
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.crm-m-conv-cta .ig-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #fd8d4f 0%, #d83384 35%, #a532d3 70%, #5b51d8 100%);
  color: white;
  font: inherit; font-size: 14px; font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(180,60,170,.5);
  text-decoration: none;
  text-align: center;
}
.crm-m-conv-cta .ig-btn:active { transform: scale(.98); }
.crm-m-conv-cta .secondary-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.crm-m-conv-cta .secondary-row .crm-btn {
  justify-content: center;
  font-size: 12.5px;
  padding: 9px;
}

/* Mobile toast */
.crm-m .crm-m-toast {
  position: absolute; top: 12px; left: 12px; right: 12px;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  animation: pop .2s cubic-bezier(.2,.9,.3,1.1);
}
.crm-m .crm-m-toast .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a8b8 0%, #c66cce 50%, #6a52d9 100%);
  color: white; font-weight: 600; font-size: 12px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.crm-m .crm-m-toast .t-body { flex: 1; min-width: 0; }
.crm-m .crm-m-toast .t-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.crm-m .crm-m-toast .t-name::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.crm-m .crm-m-toast .t-msg {
  font-size: 12px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.3;
}
.crm-m .crm-m-toast .x {
  border: 0; background: transparent; color: var(--text-3);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}
.crm-content::-webkit-scrollbar,
.kan-col-body::-webkit-scrollbar,
.drawer-pane::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.crm-content::-webkit-scrollbar-thumb,
.kan-col-body::-webkit-scrollbar-thumb,
.drawer-pane::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
.crm-content::-webkit-scrollbar-thumb:hover,
.kan-col-body::-webkit-scrollbar-thumb:hover,
.drawer-pane::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ============ Pipeline period chip label ======================== */
.kanban-toolbar .period-lbl {
  font-size: 11.5px;
  color: var(--text-3);
  margin-right: 4px;
}

/* ============ Actions menu (bulk actions popover) =============== */
.actions-menu { position: relative; }
.actions-menu .crm-btn[data-open="true"] {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.actions-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: 0 12px 36px rgba(20,24,32,.12), 0 2px 8px rgba(20,24,32,.06);
  padding: 6px;
  display: flex; flex-direction: column;
}
.actions-popover .ap-header {
  font-size: 11px;
  color: var(--text-3);
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.actions-popover .ap-header strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.actions-popover .ap-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background .12s;
}
.actions-popover .ap-item:hover:not(:disabled) {
  background: var(--surface-2);
}
.actions-popover .ap-item:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.actions-popover .ap-item .ic {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--radius-s);
  font-size: 12px;
  flex: 0 0 auto;
}
.actions-popover .ap-item .lbl { flex: 1; }
.actions-popover .ap-item .meta {
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.actions-popover hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* System toast (action feedback) */
.toast.system {
  border-left: 3px solid var(--accent);
}
.toast.system[data-kind="error"] { border-left-color: var(--danger); }
.toast.system[data-kind="warn"]  { border-left-color: var(--warning); }

/* ============ Stage column drag handle / reorder ================ */
.kan-col-head {
  position: relative;
  cursor: grab;
}
.kan-col-head:active { cursor: grabbing; }
.kan-col-head .title-input,
.kan-col-head input { cursor: text; }
.kan-col-head .col-grip {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  color: var(--text-3);
  opacity: 0;
  flex: 0 0 auto;
  margin-right: -2px;
  transition: opacity .12s, color .12s;
  pointer-events: none;
}
.kan-col-head:hover .col-grip { opacity: 1; }
.kan-col-head:hover .col-grip { color: var(--text-2); }
.kan-col.stage-dragging { opacity: .45; }
.kan-col-head.stage-drop-target {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
  border-radius: var(--radius-s);
}

/* ============ Date range filter / calendar popover ============== */
.date-filter { position: relative; }
.date-filter .date-clear {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  margin-left: 4px;
  background: rgba(255,255,255,.22);
  font-size: 12px; line-height: 1;
  font-weight: 600;
  transition: background .12s;
}
.date-filter .date-clear:hover { background: rgba(255,255,255,.38); }

.date-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  width: 296px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 32px rgba(20,24,32,.12), 0 2px 8px rgba(20,24,32,.06);
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.dp-presets {
  display: flex; gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dp-preset {
  font: inherit;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.dp-preset:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: transparent;
}
.dp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
}
.dp-title {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
  flex: 1; text-align: center;
}
.dp-nav {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  color: var(--text-2);
  font: inherit; font-size: 16px; line-height: 1;
  cursor: pointer;
}
.dp-nav:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-grid-head span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 0;
}
.dp-empty { height: 32px; }
.dp-day {
  font: inherit;
  font-size: 12px;
  height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.dp-day:hover { background: var(--surface-2); }
.dp-day[data-today="true"] {
  font-weight: 700;
  color: var(--accent);
}
.dp-day[data-between="true"] {
  background: var(--accent-soft);
  border-radius: 0;
}
.dp-day[data-from="true"],
.dp-day[data-to="true"] {
  background: var(--accent);
  color: white;
  font-weight: 600;
}
.dp-day[data-from="true"][data-to="true"] {
  /* single-day selection */
  border-radius: var(--radius-s);
}
.dp-day[data-from="true"]:not([data-to="true"]) {
  border-radius: var(--radius-s) 0 0 var(--radius-s);
}
.dp-day[data-to="true"]:not([data-from="true"]) {
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
.dp-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ============ Calls (Llamadas agendadas) view =================== */
.calls-wrap {
  padding: 24px 28px;
  max-width: 980px;
  margin: 0 auto;
}
.calls-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.calls-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.calls-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.calls-groups { display: flex; flex-direction: column; gap: 22px; }
.calls-group { display: flex; flex-direction: column; gap: 8px; }
.calls-day {
  display: flex; align-items: baseline; gap: 10px;
  padding: 4px 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.calls-day .day-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.calls-day .day-count {
  font-size: 11.5px;
  color: var(--text-3);
}
.call-card {
  display: grid;
  grid-template-columns: 80px 36px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.call-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(20,24,32,.05);
}
.call-time {
  display: flex; flex-direction: column; align-items: flex-start;
  border-right: 1px solid var(--border);
  padding-right: 14px;
}
.call-time .t-hh {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -.01em;
}
.call-time .t-dur {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.call-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 12.5px;
}
.call-meta { min-width: 0; }
.call-meta .call-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.call-meta .call-name small {
  font-weight: 400;
  color: var(--text-3);
  font-size: 11.5px;
}
.call-meta .call-biz {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
}
.call-meta .call-msg {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 480px;
}
.call-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.call-side .call-acct {
  font-size: 11px;
  color: var(--text-3);
}
.call-side .call-actions {
  display: flex; gap: 6px;
}
.calls-empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-m);
  color: var(--text-3);
  text-align: center;
}
.calls-empty .t {
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  margin-top: 6px;
}
.calls-empty .d {
  font-size: 12px;
  color: var(--text-3);
}

/* =================================================================
   CALENDLY CRM — estilos nuevos
   ================================================================= */

/* ---- Avatares genéricos (iniciales) ---- */
.rv-avatar {
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  display: grid; place-items: center;
  flex: 0 0 auto;
  letter-spacing: .01em;
}
.rv-avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.rv-avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.rv-avatar.lg { width: 44px; height: 44px; font-size: 16px; }

/* ---- Login ---- */
.login-screen {
  grid-column: 1 / -1;
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  background:
    radial-gradient(1200px 600px at 70% -10%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  padding: 28px 26px 22px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { height: 40px; object-fit: contain; }
.login-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3); margin-top: 8px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field > span {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em;
}
.login-input {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--text-3);
  transition: border-color .12s, background .12s;
}
.login-input:focus-within { border-color: var(--accent); background: var(--surface); }
.login-input input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--text);
  padding: 10px 0;
}
.login-error {
  font-size: 12px; color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-s);
  padding: 7px 10px;
}
.login-submit { justify-content: center; padding: 10px; margin-top: 2px; font-size: 13px; }
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 12px;
  color: var(--text-3); font-size: 11px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.login-quick { display: flex; flex-direction: column; gap: 6px; }
.login-quick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  cursor: pointer; text-align: left;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.login-quick-row:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.login-quick-row:disabled { opacity: .5; cursor: not-allowed; }
.lq-meta { min-width: 0; }
.lq-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.lq-off {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--danger); background: var(--danger-soft); padding: 1px 5px; border-radius: 3px;
}
.lq-role { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.login-foot { font-size: 11.5px; color: var(--text-3); }
.login-foot code {
  font-family: var(--font-mono); background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}

/* ---- Switch de pipeline por closer (sidebar) ---- */
.crm-pipes {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.crm-pipes-h {
  font-size: 10.5px; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 8px 8px 6px;
}
.crm-pipe {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border: 0; background: transparent;
  border-radius: var(--radius-s);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.crm-pipe:hover { background: var(--surface-2); color: var(--text); }
.crm-pipe[data-active="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.crm-pipe .pipe-name {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-pipe .pipe-n {
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 6px; min-width: 20px; text-align: center;
}
.crm-pipe[data-active="true"] .pipe-n { color: var(--accent-ink); border-color: transparent; }
.crm-pipe .pipe-all {
  width: 20px; height: 20px; display: grid; place-items: center;
  background: var(--surface-2); border-radius: 50%; font-weight: 700; color: var(--text-2);
  flex: 0 0 auto; font-size: 13px;
}
.crm-root[data-sidebar-collapsed="true"] .crm-pipes { display: none; }

/* ---- User menu (topbar) ---- */
.crm-search { margin-left: auto; }
.user-menu { position: relative; margin-left: 10px; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.user-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.ub-meta { text-align: left; line-height: 1.1; }
.ub-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ub-role { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.user-pop {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 240px; z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 6px;
}
.user-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.up-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; }
.up-name { font-size: 13px; font-weight: 600; color: var(--text); }
.up-email { font-size: 11px; color: var(--text-3); }
.up-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent;
  border-radius: var(--radius-s); cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text); text-align: left;
}
.up-item:hover { background: var(--surface-2); }

/* scope tag in page title */
.scope-tag {
  font-size: 11px; font-weight: 600;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 2px 9px; border-radius: 999px;
  letter-spacing: 0;
}

/* ---- Source badge ---- */
.source-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--src) 12%, transparent);
  color: color-mix(in srgb, var(--src) 72%, #000);
}
.source-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--src); }
.source-badge[data-size="lg"] { font-size: 12px; padding: 3px 10px; }

/* ---- Kanban card extras ---- */
.kan-card .top-row .status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; margin-left: auto;
  border: 1.5px solid var(--surface); outline: 1px solid var(--border);
}
.kan-card .evt {
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  margin-bottom: 7px;
}
.kan-card .closer-chip {
  font-size: 10px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 999px; font-weight: 500;
}
.kan-card .meta-row .time {
  margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  font-variant-numeric: tabular-nums; color: var(--text-3);
}

/* ---- Status pill (drawer / calls) ---- */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--st) 14%, transparent);
  color: color-mix(in srgb, var(--st) 72%, #000);
}
.status-pill .d { width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.call-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--st) 14%, transparent);
  color: color-mix(in srgb, var(--st) 72%, #000);
}
.call-status .d { width: 5px; height: 5px; border-radius: 50%; background: var(--st); }

/* mini select inside drawer meta */
.mini-select {
  font: inherit; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text);
  padding: 2px 6px; cursor: pointer; max-width: 100%;
}

/* ---- Drawer detail pane ---- */
.detail-pane { padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.dp-section h4 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.dp-rows { display: flex; flex-direction: column; gap: 2px; }
.info-row {
  display: grid; grid-template-columns: 22px 130px 1fr; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .ir-ic { color: var(--text-3); display: grid; place-items: center; }
.info-row .ir-label { color: var(--text-3); font-size: 12px; }
.info-row .ir-value { color: var(--text); font-weight: 500; }
.dp-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.dp-link:hover { text-decoration: underline; }
.wa-link { display: inline-flex; align-items: center; gap: 7px; }
.wa-tag {
  font-size: 9.5px; font-weight: 600; letter-spacing: .02em;
  padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, #25D366 16%, transparent); color: #128C3E;
  text-decoration: none;
}
.phone-value { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phone-value .phone-num { font-weight: 500; color: var(--text); user-select: all; font-variant-numeric: tabular-nums; }
.phone-value .phone-copy {
  font: inherit; font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  transition: background .12s, color .12s;
}
.phone-value .phone-copy:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.phone-value .phone-wa {
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-decoration: none;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, #25D366 16%, transparent); color: #128C3E;
}
.phone-value .phone-wa:hover { background: color-mix(in srgb, #25D366 26%, transparent); }
.dp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-cell {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 10px 12px;
}
.form-cell.wide { grid-column: 1 / -1; }
.form-cell .fc-label {
  font-size: 10.5px; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 5px; margin-bottom: 4px;
}
.form-cell .fc-ic { color: var(--text-3); display: inline-grid; place-items: center; }
.form-cell .fc-value { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; }
.dp-utm { display: flex; flex-wrap: wrap; gap: 8px; }
.utm-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 5px 10px;
  font-family: var(--font-mono); font-size: 11.5px;
}
.utm-chip .k { color: var(--text-3); }
.utm-chip .v { color: var(--text); font-weight: 500; }

/* ---- Analítica: agendas por fuente ---- */
.src-bars { display: flex; flex-direction: column; gap: 12px; }
.src-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; }
.src-row .src-name {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--text);
}
.src-row .src-name .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.src-track { height: 22px; background: var(--surface-2); border-radius: var(--radius-s); overflow: hidden; }
.src-fill { height: 100%; border-radius: var(--radius-s); min-width: 4px; transition: width .3s; }
.src-row .src-val {
  font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
  min-width: 90px; text-align: right;
}
.src-row .src-val small { font-weight: 400; color: var(--text-3); font-size: 11px; }

/* ---- Analítica: desempeño por closer ---- */
.closer-perf { display: flex; flex-direction: column; gap: 2px; }
.cp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.cp-row:last-child { border-bottom: 0; }
.cp-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.cp-stats { display: flex; gap: 28px; }
.cp-stat { text-align: right; min-width: 56px; }
.cp-stat .n { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.cp-stat .l { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }

/* ---- Usuarios ---- */
.users-wrap { padding: 24px 28px; max-width: 1000px; margin: 0 auto; }
.users-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.users-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.users-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.role-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
}
.role-pill[data-role="admin"] { background: #0d14191a; color: var(--text); }
.role-pill[data-role="closer"] { background: var(--accent-soft); color: var(--accent-ink); }
.toggle-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 11.5px; font-weight: 600;
  padding: 4px 10px 4px 5px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-3); cursor: pointer;
}
.toggle-pill .knob {
  width: 26px; height: 15px; border-radius: 999px;
  background: var(--border-strong); position: relative; transition: background .15s;
  flex: 0 0 auto;
}
.toggle-pill .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%; background: #fff;
  transition: transform .15s;
}
.toggle-pill[data-on="true"] { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.toggle-pill[data-on="true"] .knob { background: var(--accent); }
.toggle-pill[data-on="true"] .knob::after { transform: translateX(11px); }

/* ---- Costos por lead + editor de inversión ---- */
.cpl-grid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.cpl-cards.four { grid-template-columns: repeat(4, 1fr); }

/* Editor de inversión — horizontal (arriba, bajo el periodo) */
.spend-editor-h {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.spend-editor-h .seh-head {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); display: flex; align-items: center; gap: 8px;
}
.spend-editor-h .seh-fields { display: flex; align-items: flex-end; gap: 18px; flex: 1; flex-wrap: wrap; }
.spend-editor-h .se-field { flex-direction: column; gap: 5px; min-width: 150px; }
.spend-editor-h .seh-total {
  margin-left: auto; display: flex; flex-direction: column; gap: 2px;
  padding-left: 18px; border-left: 1px solid var(--border);
}
.spend-editor-h .seh-total span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.spend-editor-h .seh-total strong { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.spend-editor {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.se-head {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); display: flex; align-items: center; gap: 8px;
}
.se-edit {
  font-size: 9.5px; font-weight: 600; text-transform: none; letter-spacing: 0;
  background: var(--accent-soft); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px;
}
.se-edit.ro { background: var(--surface); color: var(--text-3); border: 1px solid var(--border); }
.se-field { display: flex; flex-direction: column; gap: 5px; }
.se-label { font-size: 12px; font-weight: 500; color: var(--text); display: flex; align-items: baseline; gap: 6px; }
.se-hint { font-size: 10.5px; color: var(--text-3); font-weight: 400; }
.se-input {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 0 10px;
}
.se-input:focus-within { border-color: var(--accent); }
.se-cur { color: var(--text-3); font-size: 13px; }
.se-input input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--text);
  padding: 9px 0;
}
.se-input input:disabled { color: var(--text-2); }
.se-total {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px;
  font-size: 12px; color: var(--text-3);
}
.se-total strong { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.cpl-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cpl-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 14px 16px;
  border-left: 3px solid var(--border-strong);
}
.cpl-card[data-accent="paid"] { border-left-color: #2c6fe0; }
.cpl-card[data-accent="organic"] { border-left-color: var(--accent); }
.cpl-card .l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.cpl-card .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: var(--text); margin-top: 6px; font-variant-numeric: tabular-nums; }
.cpl-card .d { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.src-name .paid-tag {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: #2c6fe01a; color: #2c6fe0; padding: 1px 5px; border-radius: 3px; margin-left: 4px;
}
.cp-stat.hi .n { color: var(--accent); }

/* ---- Resumen global de operación de closers ---- */
.ops-summary {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.ops-stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 12px 14px;
}
.ops-stat .n { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.ops-stat .n small { font-size: 15px; }
.ops-stat .l { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.ops-stat.hi { background: var(--accent-soft); border-color: transparent; }
.ops-stat.hi .n { color: var(--accent-ink); }
.ops-stat.hi .l { color: var(--accent-ink); opacity: .8; }

/* ---- Badge de venta en la tarjeta del pipeline ---- */
.sale-badge {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 7px; padding: 6px 8px;
  background: color-mix(in srgb, #059669 10%, transparent);
  border: 1px solid color-mix(in srgb, #059669 28%, transparent);
  border-radius: var(--radius-s);
  font-size: 10.5px;
}
.sale-badge .sb-prog { font-weight: 600; color: var(--text); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-badge .sb-amt { font-weight: 700; color: #047857; font-variant-numeric: tabular-nums; }
.sale-badge .sb-pay {
  font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning);
}
.sale-badge[data-paid="true"] .sb-pay { background: color-mix(in srgb, #059669 16%, transparent); color: #047857; }

/* ---- Sección de venta en la ficha ---- */
.sale-section {
  background: color-mix(in srgb, #059669 6%, var(--surface));
  border: 1px solid color-mix(in srgb, #059669 22%, transparent);
  border-radius: var(--radius-m); padding: 14px 16px;
}
.sale-section h4 { display: flex; align-items: center; gap: 8px; }
.pay-pill {
  font-size: 9.5px; font-weight: 600; text-transform: none; letter-spacing: 0;
  padding: 2px 8px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning);
}
.pay-pill[data-paid="true"] { background: color-mix(in srgb, #059669 16%, transparent); color: #047857; }
.sale-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sale-field { display: flex; flex-direction: column; gap: 5px; }
.sale-field.wide { grid-column: 1 / -1; }
.sale-field > span { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.sale-field input {
  font: inherit; font-size: 13px; border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 8px 10px; background: var(--surface); color: var(--text); outline: none;
}
.sale-field input:focus { border-color: var(--accent); }
.sale-money { display: flex; align-items: center; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0 10px; }
.sale-money:focus-within { border-color: var(--accent); }
.sale-money i { color: var(--text-3); font-style: normal; font-size: 13px; }
.sale-money input { border: 0; padding: 8px 0; font-family: var(--font-mono); flex: 1; }
.sale-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; }
.sale-toggle button {
  flex: 1; font: inherit; font-size: 12px; font-weight: 500; padding: 8px 6px;
  border: 0; background: var(--surface); color: var(--text-2); cursor: pointer;
}
.sale-toggle button + button { border-left: 1px solid var(--border); }
.sale-toggle button[data-on="true"] { background: var(--accent); color: #fff; }
.sale-saldo {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600; padding: 8px 10px;
  background: var(--warning-soft); color: var(--warning); border-radius: var(--radius-s);
}
.sale-saldo[data-paid="true"] { background: color-mix(in srgb, #059669 14%, transparent); color: #047857; }
.sale-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---- Barra de periodo en analítica ---- */
.analytics-periodbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 10px 14px;
}
.analytics-periodbar .period-lbl { font-size: 11.5px; color: var(--text-3); margin-right: 2px; }

/* ---- Indicador de posición al arrastrar (drop line) ---- */
.kan-card-slot { transition: margin .18s cubic-bezier(.2,.8,.3,1); }
.drop-line {
  height: 3px; margin: 1px 2px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
              0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
  position: relative;
  transform-origin: left center;
  animation: dropline-in .16s cubic-bezier(.2,.8,.3,1.2);
}
.drop-line::before {
  content: ""; position: absolute; left: -2px; top: 50%;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); transform: translateY(-50%);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent);
}
@keyframes dropline-in {
  from { opacity: 0; transform: scaleX(.55); }
  to   { opacity: 1; transform: scaleX(1); }
}

/* Aterrizaje del lead al soltarlo: se ve dónde cae (settle suave y premium) */
.kan-card.just-landed { animation: card-land .5s cubic-bezier(.16,.84,.28,1); z-index: 2; }
@keyframes card-land {
  0%   { transform: scale(1.04) translateY(-14px); box-shadow: 0 18px 34px -10px rgba(15,40,55,.28); }
  60%  { transform: scale(1.012) translateY(0); box-shadow: 0 8px 20px -8px rgba(15,40,55,.18); }
  100% { transform: scale(1) translateY(0); box-shadow: var(--shadow-card); }
}

/* ── Integraciones (solo admin) ──────────────────────────────── */
.integraciones-wrap {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
}
.integ-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.integ-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.integ-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.integ-field-group { display: flex; flex-direction: column; gap: 14px; }
.integ-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.integ-input-row { display: flex; gap: 8px; align-items: center; }
.integ-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text);
  font-family: inherit;
}
.integ-input.mono { font-family: var(--font-mono); font-size: 12px; }

.integ-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.integ-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.integ-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.integ-table tr:last-child td { border-bottom: none; }
.integ-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
}
.integ-group-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  color: var(--text-2);
}
.integ-badge {
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
}
.integ-badge.req { background: #fef3c7; color: #92400e; }
.integ-badge.opt { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
.integ-footnote {
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.6;
}
.integ-footnote code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.integ-closer-list { display: flex; flex-direction: column; gap: 10px; }
.integ-closer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: opacity .2s;
}
.integ-closer-row[data-inactive="true"] { opacity: .45; }
.integ-closer-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.integ-orden-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 20px;
  padding: 2px 9px;
}
.integ-toggle { position: relative; display: inline-block; width: 36px; height: 20px; flex: 0 0 auto; }
.integ-toggle input { opacity: 0; width: 0; height: 0; }
.integ-toggle-track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
.integ-toggle input:checked + .integ-toggle-track { background: var(--accent); }
.integ-toggle-track::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
}
.integ-toggle input:checked + .integ-toggle-track::after { transform: translateX(16px); }
.integ-info-box {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--text-2);
}
.integ-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px;
  color: var(--text-3);
  text-align: center;
}
.integ-empty .t { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.integ-empty .d { font-size: 12px; }

@keyframes progress-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ── Notas: editar y borrar ── */
.note-h { display: flex; align-items: center; justify-content: space-between; }
.note-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.note-item:hover .note-actions { opacity: 1; }
.note-action-btn {
  background: none; border: none; cursor: pointer;
  padding: 2px 5px; border-radius: 4px; font-size: 12px;
  color: var(--text-3); transition: background .15s;
}
.note-action-btn:hover { background: var(--border); color: var(--text-1); }
.note-action-btn.danger:hover { background: #fee2e2; color: #ef4444; }
.note-edit-wrap { display: flex; flex-direction: column; margin-top: 4px; }
