*, *::before, *::after {
  box-sizing: border-box;
}
[hidden] { display: none !important; }

:root {
  --brand: #2d57e8;
  --brand-dark: #1d3eb7;
  --mint: #11b7a2;
  --warm: #ff8d35;
  --text: #12233f;
  --muted: #66789a;
  --line: #d8e5fb;
  --surface: #ffffff;
  --bg: #f5f9ff;
  --bg-mint: #f4fffc;
  --bg-warm: #fff8f1;
  --shadow: 0 16px 40px rgba(30, 63, 183, 0.08);
  --shadow-soft: 0 10px 28px rgba(18, 35, 63, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
  --content-max: 1720px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: 'Onest', sans-serif;
  font-size: 15px;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 87, 232, 0.12), transparent 28%),
    radial-gradient(circle at 100% 10%, rgba(17, 183, 162, 0.12), transparent 24%),
    linear-gradient(180deg, #f6faff 0%, #fbfdff 100%);
  overflow: hidden;
}

body {
  display: flex;
  min-height: 100vh;
}

body.auth-locked .sidebar,
body.auth-locked .app-main {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.app-auth {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 18% 0%, rgba(45, 87, 232, 0.25), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(17, 183, 162, 0.2), transparent 42%),
    rgba(10, 19, 35, 0.45);
}
.app-auth[hidden] { display: none !important; }
.profile-modal[hidden] { display: none !important; }

.app-auth-box {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid rgba(216, 229, 251, 0.95);
  border-radius: 24px;
  padding: 1.4rem;
  box-shadow: 0 24px 52px rgba(18, 35, 63, 0.26);
}

.app-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.app-auth-brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.app-auth-box h2 {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
}

.app-auth-sub {
  color: var(--muted);
  margin: 0.45rem 0 1rem;
}

.app-auth-social {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.auth-slot {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  overflow: hidden;
}

.auth-slot iframe,
.auth-slot > div,
.auth-slot > div > iframe {
  max-width: 100% !important;
}

.tg-fallback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  border-radius: 10px;
  background: #229ed9;
  color: #fff;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
}

.tg-fallback-btn:hover {
  background: #1b8ec5;
}

.app-auth-divider {
  margin: 1rem 0 0.85rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  position: relative;
}

.app-auth-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line);
  z-index: 0;
}

.app-auth-divider span {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 0 0.5rem;
}

.app-auth-phone-row,
.app-auth-otp-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.88);
}

.app-auth-phone-row input,
.app-auth-otp-row input {
  border: 0;
  outline: 0;
  width: 100%;
}

.app-auth-otp-row {
  margin-top: 0.6rem;
}

.app-auth-email-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.app-auth-method-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.app-auth-switch {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app-auth-switch.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(18, 35, 63, 0.08);
}

.app-auth-email-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  margin-top: 0.6rem;
}

.app-auth-email-row input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
}

.app-auth-hint {
  min-height: 1.2rem;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.app-auth-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.app-auth-error {
  min-height: 1.25rem;
  margin: 0.6rem 0 0;
  color: #d64040;
}

.system-health {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 0.9rem;
}

.system-health.collapsed .system-health-grid { display: none; }
.system-health.collapsed .system-health-head { margin-bottom: 0; }
.system-health.collapsed #sys-health-toggle-btn { transform: rotate(-90deg); }

.system-health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

.system-health-head h3 {
  margin: 0.2rem 0 0;
  font-size: 1rem;
}

.system-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.system-health-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.system-health-item.ok {
  color: #0a7f5c;
  background: #ecfff8;
  border-color: #bcefdc;
}

.system-health-item.warn {
  color: #9a5a11;
  background: #fff8e9;
  border-color: #ffdcae;
}

.system-health-item.off {
  color: #7b879e;
  background: #f7f9ff;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  place-items: center;
  background: rgba(10, 19, 35, 0.45);
  padding: 1rem;
}

.profile-modal-box {
  width: min(720px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(216, 229, 251, 0.95);
  border-radius: 24px;
  padding: 1.2rem;
  position: relative;
  box-shadow: 0 24px 52px rgba(18, 35, 63, 0.26);
}

.profile-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.profile-user-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 0.8rem;
}

.profile-user-row p {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.linked-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.linked-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem;
  background: #fbfdff;
}

.phone-link-card {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem;
  background: #fbfdff;
}

.linked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.linked-card .auth-slot {
  margin: 0.55rem 0;
  background: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

body[data-dev-mode="0"] .dev-only,
body:not([data-dev-mode]) .dev-only {
  display: none !important;
}

body[data-db-access="0"] .db-access-only,
body:not([data-db-access]) .db-access-only {
  display: none !important;
}

/* Baza-only access (level 4): show только раздел Базы */
body[data-baza-access="0"] .baza-access-only,
body:not([data-baza-access]) .baza-access-only {
  display: none !important;
}

/* Level 4 users: hide all admin inline tabs except "База" */
body[data-db-access="0"][data-baza-access="1"] .db-tab[data-admin-page]:not([data-admin-page="anomaly"]),
body[data-db-access="0"][data-baza-access="1"] .db-tab-fullscreen {
  display: none !important;
}


body:not([data-role="admin"]) .admin-only {
  display: none !important;
}

.integrator-only {
  display: none !important;
}
body[data-role="integrator"] .integrator-only,
body[data-role="admin"] .integrator-only,
body[data-role="owner"] .integrator-only {
  display: flex !important;
}

.sidebar {
  width: 262px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(216, 229, 251, 0.9);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  transition: width 0.25s ease, left 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.3) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.6); }

.sidebar.collapsed {
  width: 92px;
}

.sidebar.collapsed .sb-logo-copy,
.sidebar.collapsed .sb-link span,
.sidebar.collapsed .sb-section,
.sidebar.collapsed .sb-user-info,
.sidebar.collapsed .dev-toggle span:first-of-type,
.sidebar.collapsed .sb-logout {
  display: none;
}

.sb-logo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.35rem 0.25rem 1rem;
}

.sb-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #4f7bff 0%, #2d57e8 60%, #1937a3 100%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  position: relative;
}

.sb-logo-mark::after {
  content: '';
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
}

.sb-logo-copy {
  display: flex;
  flex-direction: column;
}

.sb-logo-name {
  font-family: 'Unbounded', sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.sb-logo-sub {
  font-size: 0.74rem;
  color: var(--muted);
}

.sb-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sb-section {
  padding: 1rem 0.7rem 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #97a7c4;
  font-weight: 800;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  color: #5f7090;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sb-link:hover {
  background: rgba(45, 87, 232, 0.08);
  color: var(--brand);
  transform: translateX(2px);
}

.sb-link.active {
  background: linear-gradient(135deg, rgba(45, 87, 232, 0.14), rgba(17, 183, 162, 0.1));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(45, 87, 232, 0.1);
}

.sb-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.sb-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(216, 229, 251, 0.9);
}

.dev-toggle,
.sb-user,
.sb-logout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 16px;
  padding: 0.8rem 0.9rem;
}

.dev-toggle {
  color: var(--muted);
  cursor: pointer;
}

.dev-toggle input {
  display: none;
}

.toggle-track {
  margin-left: auto;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: #d6e2fb;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

input:checked ~ .toggle-track {
  background: var(--brand);
}

input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.sb-user {
  width: 100%;
  border: 0;
  background: rgba(248, 251, 255, 0.95);
  cursor: pointer;
}

.sb-avatar,
.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2d57e8, #11b7a2);
  color: #fff;
  font-weight: 800;
}

.topbar-avatar {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topbar-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(45, 87, 232, 0.3);
}

.topbar-avatar:focus-visible {
  outline: 3px solid rgba(45, 87, 232, 0.35);
  outline-offset: 2px;
}

.sb-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.sb-user-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-role {
  color: var(--muted);
  font-size: 0.78rem;
}

.sb-logout {
  color: #7b8cab;
}

.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.75rem;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(216, 229, 251, 0.9);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.topbar-menu {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-kicker {
  margin: 0 0 0.2rem;
  color: #8b9cba;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.topbar-title {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-size: 1rem;
}

.gift-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(17, 183, 162, 0.12);
  color: #0c9988;
  font-weight: 700;
  font-size: 0.8rem;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  display: block;
}

.view-inner {
  width: min(var(--content-max), 100%);
  margin: 0;
  padding: 1.75rem;
}

.scene {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding: 1.1rem;
  border: 1px solid rgba(216, 229, 251, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.scene-control {
  background: linear-gradient(145deg, #ffffff 0%, #f7fbff 55%, #f2fffb 100%);
}

.scene-control--compact {
  grid-template-columns: 1fr;
}

.scene-dialogs {
  background: linear-gradient(145deg, #f7fffd 0%, #ffffff 55%, #f8fbff 100%);
}

.scene-close,
.scene-data,
.scene-bots,
.scene-people,
.scene-launch {
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 50%, #fff8f2 100%);
}

.scene-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem;
}

.scene-copy--compact {
  justify-content: center;
}

.scene-eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #4f68aa;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene-title {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(1.35rem, 2vw, 2.15rem);
  line-height: 1.22;
}

.scene-text,
.workbench-note,
.panel-desc {
  color: var(--muted);
  line-height: 1.65;
}

.scene-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.scene-preview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.9rem;
}

.preview-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0.85rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.preview-card img {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(216, 229, 251, 0.85);
}

.preview-card--control {
  grid-row: span 2;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.preview-meta span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.preview-meta strong {
  font-size: 0.88rem;
}

.kpi-strip,
.dashboard-grid,
.dialog-layout,
.grid-2,
.grid-3-sm,
.db-stats-row {
  display: grid;
  gap: 1rem;
}

.kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.kpi-card,
.studio-card,
.workbench,
.table-wrap,
.dialog-column {
  background: #fff;
  border: 1px solid rgba(216, 229, 251, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.kpi-card {
  padding: 1.15rem 1.2rem;
}

.kpi-card--mint {
  background: linear-gradient(180deg, #f4fffc 0%, #ffffff 100%);
}

.kpi-card--warm {
  background: linear-gradient(180deg, #fff8f1 0%, #ffffff 100%);
}

.kpi-card--blue {
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.kpi-label,
.kpi-card small {
  display: block;
  color: var(--muted);
}

.kpi-label {
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
}

.kpi-value {
  display: block;
  font-family: 'Unbounded', sans-serif;
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.dashboard-grid--home {
  grid-template-columns: 1.2fr 1fr 0.9fr;
}

.dashboard-grid--ai,
.dashboard-grid--channels,
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.studio-card,
.workbench,
.dialog-column {
  padding: 1.2rem;
}

.studio-card--soft {
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
}

.studio-card--mint,
.workbench--mint {
  background: linear-gradient(145deg, #f4fffc 0%, #ffffff 100%);
}

.studio-card--warm,
.workbench--warm {
  background: linear-gradient(145deg, #fff8f1 0%, #ffffff 100%);
}

.studio-card--blue,
.workbench--blue {
  background: linear-gradient(145deg, #f6f9ff 0%, #ffffff 100%);
}

.studio-card--control,
.workbench--success {
  background: linear-gradient(145deg, #ffffff 0%, #f9fbff 45%, #f2fff9 100%);
}

.studio-head,
.workbench-head,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.studio-head--tight {
  margin-bottom: 0.8rem;
}

.studio-head h3,
.panel-head h3,
.wizard-q {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.section-chip {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(45, 87, 232, 0.1);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-chip--mint {
  background: rgba(17, 183, 162, 0.12);
  color: #0b9a88;
}

.section-chip--warm {
  background: rgba(255, 141, 53, 0.14);
  color: #d86a1a;
}

.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 14px;
  padding: 0.75rem 1.05rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-app:hover {
  transform: translateY(-1px);
}

.btn-app-primary {
  color: #fff;
  background: linear-gradient(130deg, var(--brand) 0%, #4a78ff 100%);
  box-shadow: 0 12px 28px rgba(45, 87, 232, 0.2);
}

.btn-app-primary:hover {
  background: linear-gradient(130deg, var(--brand-dark) 0%, #3d68eb 100%);
}

.btn-app-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.mini-flow,
.dialog-teasers,
.revenue-stack,
.lead-fact-list,
.agent-status-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mini-step,
.dialog-teaser,
.revenue-row,
.lead-fact,
.agent-status-item,
.dialog-feed-card,
.chat-bubble,
.brief-card,
.channel-card {
  border-radius: 18px;
  border: 1px solid rgba(216, 229, 251, 0.95);
}

.mini-step,
.dialog-teaser,
.revenue-row,
.lead-fact,
.agent-status-item,
.dialog-feed-card,
.brief-card,
.channel-card {
  background: rgba(255, 255, 255, 0.86);
  padding: 0.9rem 1rem;
}

.mini-step {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.mini-step > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.mini-step strong,
.mini-step small {
  display: inline;
  line-height: 1.25;
}

.mini-step span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7eefc;
  color: var(--brand);
  font-weight: 800;
}

.mini-step.is-active span {
  background: var(--brand);
  color: #fff;
}

.mini-step small,
.dialog-teaser p,
.lead-fact span,
.revenue-row span,
.brief-card span,
.channel-card p,
.field-row label,
.table-count,
.search-input::placeholder {
  color: var(--muted);
}

.dialog-teaser {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.avatar-dot {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.avatar-dot--mint { background: var(--mint); }
.avatar-dot--blue { background: var(--brand); }
.avatar-dot--warm { background: var(--warm); }

.dialog-teaser strong,
.revenue-row strong,
.lead-fact strong,
.brief-card strong,
.dialog-feed-head strong,
.channel-card h4 {
  display: block;
}

.dialog-teaser p {
  margin: 0.18rem 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.revenue-row,
.lead-fact {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.workbench {
  margin-top: 1rem;
}

.wizard-steps-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.wstep {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.wstep span {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e7eefc;
  color: #6f80a4;
  font-weight: 800;
}

.wstep.active span {
  background: var(--brand);
  color: #fff;
}

.wstep.done span {
  background: var(--mint);
  color: #fff;
}

.wstep small {
  color: var(--muted);
  font-size: 0.74rem;
}

.wstep-line {
  flex: 1;
  min-width: 42px;
  height: 2px;
  background: #dce7fb;
}

.niche-grid,
.volume-options,
.dest-options,
.grid-3-sm,
.db-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.niche-card,
.vol-btn,
.dest-inner {
  width: 100%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  cursor: pointer;
  padding: 1rem;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.niche-card:hover,
.vol-btn:hover,
.dest-card input:checked + .dest-inner,
.niche-card.selected,
.vol-btn.selected {
  transform: translateY(-2px);
  border-color: rgba(45, 87, 232, 0.35);
  box-shadow: 0 14px 30px rgba(45, 87, 232, 0.1);
}

.niche-card small,
.vol-btn span,
.dest-inner small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

.niche-emoji {
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #11b7a2);
}

.dest-card input {
  display: none;
}

.vol-custom,
.wizard-nav,
.toolbar-row,
.db-tabs,
.bot-tabs,
.leads-toolbar,
.ai-prompt-actions,
.db-actions,
.day-pills {
  display: flex;
  gap: 0.75rem;
}

.vol-custom,
.toolbar-row,
.leads-toolbar {
  align-items: center;
}

.wizard-nav,
.leads-toolbar,
.toolbar-row {
  justify-content: space-between;
}

.users-gate-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.9rem;
  margin: 0.5rem 0 0.8rem;
}

.users-gate-default {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.users-gate-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.users-gate-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.user-stub-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.user-stub-overlay {
  position: fixed;
  inset: 0;
  z-index: 530;
  background: rgba(10, 19, 35, 0.56);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.user-stub-overlay[hidden] {
  display: none !important;
}

.user-stub-box {
  width: min(680px, 100%);
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 55%, #f2fffb 100%);
  border: 1px solid var(--line);
  box-shadow: 0 24px 52px rgba(18, 35, 63, 0.28);
  padding: 1.2rem;
}

.user-stub-box h3 {
  margin: 0.6rem 0;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-family: 'Unbounded', sans-serif;
}

.user-stub-contacts {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.vol-custom input,
.search-input,
.field-input,
.field-textarea,
.ai-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.8rem 0.95rem;
  outline: none;
}

.field-input,
.field-textarea,
.ai-textarea,
.search-input {
  color: var(--text);
}

.field-textarea,
.ai-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

.dialog-layout {
  grid-template-columns: 0.9fr 1.15fr 0.8fr;
}

.dialog-column--feed,
.dialog-column--chat,
.dialog-column--leadcard {
  min-height: 100%;
}

.dialog-feed-card.is-active {
  border-color: rgba(17, 183, 162, 0.35);
  background: #f5fffc;
}

.dialog-feed-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dialog-feed-card p,
.dialog-feed-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.chat-bubble {
  line-height: 1.6;
  padding: 1rem 1.05rem;
}

.chat-bubble--ai {
  background: #f6f9ff;
}

.chat-bubble--client {
  background: #f4fffc;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.brief-card strong {
  margin-top: 0.35rem;
  line-height: 1.45;
}

.agent-status-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.agent-status-item > div:nth-child(2) {
  flex: 1;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d5e0f6;
  flex-shrink: 0;
}

.status-dot--on {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(17, 183, 162, 0.14);
}

.toggle-sm,
.filter-btn,
.bot-tab,
.db-tab,
.day-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.5rem 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.88rem;
}

.db-tab--unified {
  padding: 0.65rem 1.2rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.db-tab--unified:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.db-tab--unified.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.db-tab-fullscreen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  text-decoration: none;
  margin-left: auto;
}

.db-tab-fullscreen:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(45, 87, 232, 0.05);
}

.bot-tab.active,
.db-tab.active,
.filter-btn.active,
.day-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.bot-panel,
.db-panel {
  display: none;
}

.bot-panel.active,
.db-panel.active {
  display: block;
}

.field-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 0.8rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

.field-unit {
  color: var(--muted);
  padding-top: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.badge-on {
  background: rgba(17, 183, 162, 0.12);
  color: #0c9988;
}

.badge-off {
  background: rgba(103, 120, 154, 0.1);
  color: #6a7c9d;
}

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

.table-wrap--soft {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

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

.data-table th,
.data-table td {
  padding: 0.95rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-empty {
  text-align: center;
  color: var(--muted);
}

.db-stat {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(216, 229, 251, 0.95);
}

.db-stat-val {
  display: block;
  margin-bottom: 0.3rem;
  font-family: 'Unbounded', sans-serif;
  font-size: 1rem;
}

.channel-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-hub-shell {
  padding: 1rem;
}

.admin-hub-frame-wrap {
  margin-top: 0.8rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

.admin-hub-frame {
  width: 100%;
  min-height: 78vh;
  border: 0;
  background: #fff;
}

.admin-inline-shell {
  padding: 1rem;
}

.admin-inline-host {
  margin-top: 0.8rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
  min-height: 72vh;
}

.admin-inline-loading {
  padding: 1.2rem;
  color: var(--muted);
}

.admin-inline-host .top-nav {
  display: none !important;
}

.admin-inline-host #logoutBtn {
  display: none !important;
}

.db-agent-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 1rem;
  position: fixed;
  right: 12px;
  top: 94px;
  width: 340px;
  max-height: calc(100vh - 108px);
  overflow: auto;
  z-index: 20;
  box-shadow: 0 14px 34px rgba(18, 35, 63, 0.14);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
  transform: translateX(0);
  opacity: 1;
}
.db-agent-panel.db-agent-panel--hidden {
  transform: translateX(368px);
  opacity: 0;
  pointer-events: none;
}

/* Toggle button for db-agent-panel */
.db-agent-toggle {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 21;
  width: 32px;
  height: 56px;
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--line);
  border-right: none;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: -3px 0 12px rgba(18,35,63,0.08);
  transition: background 0.15s, color 0.15s, right 0.3s cubic-bezier(.4,0,.2,1);
}
.db-agent-toggle:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
/* When panel is hidden, button moves to far right edge */
.db-agent-toggle.db-agent-toggle--collapsed {
  right: 0;
  border-radius: 10px 0 0 10px;
  border-right: none;
}

body.dark .db-agent-panel {
  background: linear-gradient(180deg, #1a2236 0%, #141c2f 100%);
}
body.dark .db-agent-toggle {
  background: var(--surface);
  border-color: var(--line);
}

.db-agent-head h4 {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
}

.db-agent-welcome {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 0.6rem;
  align-items: start;
}

.db-agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #2d57e8, #11b7a2);
}

.db-agent-welcome strong {
  display: block;
  line-height: 1.25;
}

.db-agent-welcome p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.db-agent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.db-agent-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.db-agent-limits,
.db-agent-usage {
  margin-top: 0.85rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.db-agent-limits strong,
.db-agent-usage strong {
  display: block;
  margin-bottom: 0.4rem;
}

.db-agent-limits ul,
.db-agent-usage ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.db-agent-status {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.db-agent-result {
  margin: 0.55rem 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbff;
  padding: 0.65rem;
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.78rem;
  color: #2d3e5f;
}

.db-agent-shortlist {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.db-agent-short-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem;
}

.db-agent-short-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.db-agent-short-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a2e4f;
}

.db-agent-short-score {
  font-size: 0.72rem;
  border: 1px solid #bcd3f1;
  color: #204f83;
  background: #eef5ff;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

.db-agent-short-meta {
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.db-agent-short-actions {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.db-agent-short-actions button {
  border: 1px solid #bfd1e5;
  background: #fff;
  color: #234968;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.badge-warm {
  background: rgba(255, 141, 53, 0.14);
  color: #c56b17;
}

.outreach-console {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.outreach-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(45, 87, 232, 0.06), rgba(17, 183, 162, 0.06));
}

.outreach-hero h3 {
  margin: 0.35rem 0 0.35rem;
}

.outreach-hero p {
  margin: 0;
  color: var(--muted);
}

.outreach-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 0.7rem;
}

.outreach-hero-stats article {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(255,255,255,0.9);
}

.outreach-hero-stats strong {
  display: block;
  font-family: 'Unbounded', sans-serif;
  font-size: 1rem;
}

.outreach-hero-stats span {
  color: var(--muted);
  font-size: 0.8rem;
}

.outreach-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
}

.outreach-grid--lower {
  grid-template-columns: 1fr 1.1fr;
}

.outreach-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: var(--shadow-soft);
}

.outreach-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.outreach-form-grid input,
.outreach-form-grid select {
  width: 100%;
}

.outreach-form-grid--limits {
  margin-top: 0.7rem;
}

.outreach-checks {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.8rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.outreach-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.outreach-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.outreach-status {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.outreach-table-wrap {
  margin-top: 0.7rem;
}

.outreach-link-btn,
.mini-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  font-weight: 700;
  cursor: pointer;
}

.outreach-link-btn:hover,
.mini-action:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.outreach-actions-cell {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.db-agent-shortlist {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.db-agent-short-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem;
}

.db-agent-short-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.db-agent-short-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a2e4f;
}

.db-agent-short-score {
  font-size: 0.72rem;
  border: 1px solid #bcd3f1;
  color: #204f83;
  background: #eef5ff;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

.db-agent-short-meta {
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.db-agent-short-actions {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.db-agent-short-actions button {
  border: 1px solid #bfd1e5;
  background: #fff;
  color: #234968;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-modules-grid {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.admin-module-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.3rem;
  background: linear-gradient(155deg, #ffffff 0%, #f7fbff 62%, #f1fffb 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease;
}

.admin-module-card:hover {
  border-color: var(--brand);
  box-shadow: 0 12px 32px rgba(45, 87, 232, 0.12);
  transform: translateY(-2px);
}

.admin-module-card h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.admin-module-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
  font-size: 0.95rem;
}

.admin-launch-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.admin-launch-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.95rem;
  background: linear-gradient(155deg, #ffffff 0%, #f7fbff 62%, #f1fffb 100%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-launch-card h4 {
  margin: 0;
  font-size: 1rem;
}

.admin-launch-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.ch-icon {
  font-size: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #11b7a2);
}

.done-state {
  text-align: center;
  padding: 2rem 1rem;
}

.done-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--mint), #53d1c0);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
}

.mt-sm { margin-top: 0.75rem; }
.mt-md { margin-top: 1rem; }
.mt-xl { margin-top: 1.5rem; }

/* ── Wizard v2 ──────────────────────────────────────────── */
.wizard-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: #fff;
  border: 1px solid rgba(216,229,251,.95);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
}
.wizard-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.wizard-step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.wizard-body {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 1.25rem;
  align-items: start;
}
.wizard-body--narrow {
  display: block;
  max-width: 760px;
  margin: 0 auto;
}
.wizard-col-main,
.wizard-col-hint {
  min-height: 0;
}
.wiz-section {
  margin-bottom: 1.5rem;
}
.wiz-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 0.55rem;
}
.wiz-input-lg {
  font-size: 1.06rem;
  padding: 0.75rem 1rem;
}
.wiz-expand-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0;
  transition: opacity .2s;
}
.wiz-expand-toggle:hover { opacity: .75; }
.wiz-expand-toggle svg { transition: transform .25s; }
.wiz-expand-toggle.open svg { transform: rotate(180deg); }
.wiz-expandable textarea.field-input { resize: vertical; }
.niche-hint-card {
  background: linear-gradient(145deg,#f5f9ff,#fff);
  border: 1px solid rgba(216,229,251,.95);
  border-radius: 20px;
  padding: 1.4rem 1.3rem;
  box-shadow: var(--shadow-soft);
  min-height: 180px;
}
.niche-hint-card .niche-hint-icon {
  font-size: 2.2rem;
  margin-bottom: 0.7rem;
}
.niche-hint-card h4 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 800;
}
.niche-hint-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0 0 0.85rem;
}
.niche-hint-list {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.niche-hint-list li {
  font-size: 0.82rem;
  color: var(--muted);
  padding-left: 1.1rem;
  position: relative;
}
.niche-hint-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--mint);
  font-weight: 700;
}
.niche-card.niche-card--custom {
  border-style: dashed;
  color: var(--muted);
}
.wiz-custom-niche-wrap { margin-top: 0.75rem; }
.niche-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0.7rem;
}
.niche-card {
  min-height: 96px;
  padding: 0.85rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.niche-card .niche-emoji { font-size: 1.5rem; }
.niche-card small { font-size: 0.72rem; }
/* Volume cards */
.volume-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.volume-card {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
  padding: 1.3rem 1rem 1.1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.volume-card:hover,
.volume-card.selected {
  border-color: var(--brand);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(45,87,232,.12);
}
.volume-card--popular {
  border-color: rgba(45,87,232,.35);
  background: linear-gradient(145deg,#f5f9ff,#fff);
}
.volume-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  background: rgba(45,87,232,.09);
  border-radius: 100px;
  padding: 0.18rem 0.65rem;
  margin-bottom: 0.35rem;
}
.volume-card--popular .volume-card-badge {
  background: var(--brand);
  color: #fff;
}
.volume-card-num {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.volume-card-unit { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.volume-card-daily { font-size: 0.75rem; color: var(--mint); font-weight: 700; margin-top: 0.2rem; }
.volume-card-desc { font-size: 0.75rem; color: var(--muted); line-height: 1.45; margin-top: 0.4rem; }
.volume-card.selected .volume-card-num { color: var(--brand); }
.vol-custom-row { display: flex; flex-direction: column; gap: 0.5rem; }
.vol-custom-input-wrap { display: flex; align-items: center; gap: 0.75rem; }
.vol-custom-suffix { font-size: 0.86rem; color: var(--muted); white-space: nowrap; }
.vol-custom-hint { font-size: 0.8rem; color: var(--mint); font-weight: 600; margin: 0; }
/* Dest cards v2 */
.dest-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.dest-card2 { cursor: pointer; }
.dest-card2 input[type=radio] { display: none; }
.dest-card2-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  background: #fff;
  transition: border-color .2s, background .2s;
}
.dest-card2:hover .dest-card2-inner,
.dest-card2 input:checked ~ .dest-card2-inner {
  border-color: var(--brand);
  background: linear-gradient(90deg,#f5f9ff,#fff);
}
.dest-card2-icon { font-size: 1.8rem; flex-shrink: 0; width: 2.5rem; text-align: center; }
.dest-card2-inner > div:not(.dest-card2-icon):not(.dest-card2-check) { flex: 1; }
.dest-card2-inner strong { display: block; font-weight: 800; font-size: 0.95rem; margin-bottom: 0.2rem; }
.dest-card2-inner p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.dest-card2-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: all .2s;
  flex-shrink: 0;
}
.dest-card2 input:checked ~ .dest-card2-inner .dest-card2-check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.dest-extra {
  padding: 0.85rem 1.2rem 0.75rem;
  margin-top: -0.4rem;
  border: 2px solid var(--brand);
  border-top: none;
  border-radius: 0 0 16px 16px;
  background: #f5f9ff;
}
/* Done screen v2 */
.wizard-done-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 0;
}
.wizard-done-card {
  background: #fff;
  border: 1px solid rgba(216,229,251,.95);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  padding: 2.5rem 2.5rem 2rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
}
.done-anim { font-size: 3rem; margin-bottom: 1rem; }
.wizard-done-card h3 { font-size: 1.5rem; margin: 0 0 0.5rem; }
.wizard-done-card > p { color: var(--muted); margin: 0 0 1.5rem; }
.wizard-done-info {
  background: #f7f9ff;
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin: 0 0 1.5rem;
  text-align: left;
}
.wizard-done-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(216,229,251,.7);
}
.wizard-done-row:last-child { border-bottom: none; }
.wizard-done-row span { color: var(--muted); }
.wizard-done-row strong { font-weight: 700; }
.wizard-done-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
}
.btn-app-lg { padding: 0.9rem 1.8rem; font-size: 1rem; }
.wizard-done-note { font-size: 0.78rem; color: var(--muted); margin-top: 1.25rem; }
.wiz-step-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 0.5rem; }
.wiz-step-desc { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }

@media (max-width: 1180px) {
  .scene,
  .dashboard-grid--home,
  .dialog-layout,
  .dashboard-grid--ai {
    grid-template-columns: 1fr;
  }

  .scene-preview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .preview-card--control {
    grid-row: auto;
    grid-column: span 2;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-launch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-auth-social,
  .app-auth-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .app-auth-box {
    max-width: 420px;
    padding: 1rem;
  }

  .linked-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -262px;
    bottom: 0;
    z-index: 100;
    background: #ffffff;
    backdrop-filter: none;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .view-inner {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .niche-grid,
  .volume-options,
  .dest-options,
  .grid-2,
  .grid-3-sm,
  .db-stats-row,
  .brief-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .leads-toolbar,
  .toolbar-row,
  .vol-custom,
  .wizard-nav,
  .scene-actions,
  .users-gate-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .users-gate-row {
    grid-template-columns: 1fr;
  }

  .kpi-strip,
  .scene-preview-grid {
    grid-template-columns: 1fr;
  }

  .admin-launch-grid {
    grid-template-columns: 1fr;
  }

  .db-agent-panel {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 1rem;
    box-shadow: none;
  }

  .preview-card--control {
    grid-column: auto;
  }
}

@media (max-width: 1380px) {
  .db-agent-panel {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 1rem;
    box-shadow: none;
  }
}

@media (max-width: 620px) {
  .topbar-right .gift-badge {
    display: none;
  }

  .sb-logo-sub {
    display: none;
  }

  .system-health-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Sidebar overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  cursor: pointer;
}

.sidebar-overlay.active {
  display: block;
}

.sb-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.sb-close:hover {
  background: var(--hover, rgba(0,0,0,.08));
}

@media (max-width: 900px) {
  .sb-close {
    display: block;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }
}

/* ── Agents View ──────────────────────────────────────────── */
.agents-list {
  display: grid;
  gap: 0.75rem;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(216, 229, 251, 0.95);
  border-radius: 16px;
  background: #fff;
  transition: box-shadow 0.2s ease;
}

.agent-card:hover {
  box-shadow: 0 4px 16px rgba(45, 87, 232, 0.1);
}

.agent-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2d57e8, #4a78ff);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Unbounded', sans-serif;
}

.agent-card-body {
  flex: 1;
  min-width: 0;
}

.agent-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-card-meta {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  margin-top: 0.15rem;
}

.agent-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.agent-card-actions button {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 10px;
}

.agents-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted, #6b7280);
}

.agents-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #11b7a2);
}

/* ── Campaigns in Agents View ─────────────────────────────── */
.campaigns-list {
  display: grid;
  gap: 0.75rem;
}

.campaign-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(17, 183, 162, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, #f9fffd 0%, #ffffff 100%);
  transition: box-shadow 0.2s ease;
}

.campaign-card:hover {
  box-shadow: 0 4px 16px rgba(17, 183, 162, 0.12);
}

.campaign-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #11b7a2, #0d9e8c);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.campaign-card-body {
  flex: 1;
  min-width: 0;
}

.campaign-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campaign-card-meta {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  margin-top: 0.15rem;
}

.campaign-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.campaign-card-actions button {
  padding: 0.4rem 0.65rem;
  font-size: 0.79rem;
  border-radius: 10px;
}

.badge-running {
  background: rgba(17, 183, 162, 0.15);
  color: #0b9a88;
}

.badge-draft {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

.badge-paused {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.badge-stopped {
  background: rgba(229, 62, 62, 0.12);
  color: #c53030;
}

/* ── Calls History Table ───────────────────────────────────── */
.call-row:hover td { background: #f1f5f9; }
.call-transcript-row td { border-top: 1px dashed #cbd5e1; }
.badge-stopped { background: #fee2e2; color: #dc2626; }
.section-chip--blue { background: #dbeafe; color: #1d4ed8; }
.mt-md { margin-top: 1.25rem; }

/* ══════════════════════════════════════════════════════════
   AGENT DETAIL VIEW
══════════════════════════════════════════════════════════ */

.agent-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.25rem;
  flex-wrap: wrap;
}
.agent-detail-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: 1;
}
.agent-detail-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.agent-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}
.agent-detail-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.15rem;
}

/* Agent tab nav */
.agent-tab-nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid #e2e8f0;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.agent-tab-nav::-webkit-scrollbar { display: none; }
.agent-tab-nav .tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.agent-tab-nav .tab-btn:hover { color: #1e293b; }
.agent-tab-nav .tab-btn.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* Tab panes */
.agent-tab-pane { display: none; }
.agent-tab-pane.active { display: block; }

.agent-instruction-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  max-height: 400px;
  overflow-y: auto;
}

/* Knowledge items */
.knowledge-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.knowledge-item:last-child { border-bottom: none; }
.knowledge-item-body { flex: 1; min-width: 0; }
.knowledge-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 0.2rem;
}
.knowledge-item-content {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.knowledge-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Toggle switch */
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.toggle-wrap input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-wrap input:checked + .toggle-slider { background: #4f46e5; }
.toggle-wrap input:checked + .toggle-slider::after { transform: translateX(16px); }

/* Channels grid */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}
.channel-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.channel-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(99,102,241,0.08);
}
.channel-card.connected {
  border-color: #a7f3d0;
  background: #f0fdf4;
}
.channel-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.channel-card-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.channel-card-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #1e293b;
}
.channel-card-status { font-size: 0.78rem; }
/* Multi-connection channel styles */
.channel-card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}
.ch-conn-count {
  margin-left: auto;
  background: #11b7a2;
  color: #fff;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.ch-conn-list { width: 100%; }
.ch-conn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.ch-conn-row:last-child { border-bottom: none; }
.ch-conn-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}
.ch-conn-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.ch-conn-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   PROXY SETTINGS
══════════════════════════════════════════════════════════ */
.proxy-list { display: flex; flex-direction: column; gap: 0.5rem; }
.proxy-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
}
.proxy-row-addr { flex: 1; font-family: monospace; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proxy-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #cbd5e1;
}
.proxy-status-dot--ok { background: #10b981; }
.proxy-status-dot--err { background: #ef4444; }
.proxy-status-dot--checking { background: #f59e0b; animation: pulseDot 1s infinite; }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.proxy-add-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.proxy-add-row input { flex: 1; }

/* ══════════════════════════════════════════════════════════
   TEST CHAT
══════════════════════════════════════════════════════════ */
.testchat-hint {
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
  margin: auto;
  padding: 1.5rem;
}
.testchat-msg {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}
.testchat-msg--user {
  align-self: flex-end;
  background: var(--accent, #11b7a2);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.testchat-msg--agent {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 3px;
}
.testchat-msg--demo {
  align-self: flex-start;
  background: #fff8f0;
  color: #92400e;
  border: 1px solid #fde68a;
  border-bottom-left-radius: 3px;
}
.testchat-msg--error {
  align-self: flex-start;
  background: #fff0f0;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-bottom-left-radius: 3px;
}
.testchat-loading {
  align-self: flex-start;
  color: #94a3b8;
  font-size: 0.8rem;
  font-style: italic;
}
.tab-btn--test { border-color: var(--accent, #11b7a2) !important; }

/* ══════════════════════════════════════════════════════════
   BROADCASTS TABLE
══════════════════════════════════════════════════════════ */
.broadcasts-tbl td { vertical-align: middle; }
.data-table-wrap { overflow-x: auto; }

/* ══════════════════════════════════════════════════════════
   ANALYTICS
══════════════════════════════════════════════════════════ */
.analytics-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.analytics-result-card {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e8f0;
}
.analytics-result-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.3rem;
}
.analytics-result-count {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}
.analytics-result-pct {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}

/* ══════════════════════════════════════════════════════════
   LOGS
══════════════════════════════════════════════════════════ */
.logs-filter-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.logs-summary {
  font-size: 0.82rem;
  color: #64748b;
  max-width: 280px;
}
.logs-row:hover td { background: #f8fafc; cursor: pointer; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .channels-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-results-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-tab-nav .tab-btn { padding: 0.5rem 0.75rem; font-size: 0.83rem; }
}

/* ══════════════════════════════════════════════════════════
   AGENT TYPE SWITCHER
══════════════════════════════════════════════════════════ */
.agent-type-switcher {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.agent-type-btn {
  padding: 0.45rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}
.agent-type-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
  font-weight: 600;
}
.agent-type-btn:hover:not(.active) {
  border-color: #6366f1;
  color: #6366f1;
}

/* ══════════════════════════════════════════════════════════
   TEXT AGENT SETTINGS
══════════════════════════════════════════════════════════ */
.settings-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin: 1.2rem 0 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e2e8f0;
}
.interrupt-conditions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.4;
}
.toggle-label .toggle-wrap {
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   TABLES (DATA SOURCES)
══════════════════════════════════════════════════════════ */
.table-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: #fff;
  gap: 0.75rem;
}
.table-item-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.table-item-body {
  flex: 1;
  min-width: 0;
}
.table-item-name {
  font-weight: 600;
  font-size: 0.93rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-item-meta {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   DIALOGS EXPORT TOOLBAR
══════════════════════════════════════════════════════════ */
.leads-extra-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.75rem;
}
.leads-extra-filters label {
  font-size: 0.8rem;
  color: #64748b;
  margin-right: 0.2rem;
}
.leads-extra-filters .field-input {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}
.leads-extra-filters input[type="date"] {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  color: #334155;
}

/* ══════════════════════════════════════════════════════════
   DIALOGS — FIXED-HEIGHT SPLIT VIEW
══════════════════════════════════════════════════════════ */
.dialog-layout {
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  height: calc(100vh - 280px);
  min-height: 460px;
  max-height: 860px;
  align-items: stretch;
}
.dialog-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog-column--feed {
  overflow: hidden;
}
#leads-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.1rem;
}
#leads-feed::-webkit-scrollbar { width: 4px; }
#leads-feed::-webkit-scrollbar-track { background: transparent; }
#leads-feed::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dialog-feed-card {
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.dialog-feed-card:hover {
  background: #f8fbff;
  border-color: rgba(17, 183, 162, 0.2);
}
.dialog-feed-card.is-active {
  background: linear-gradient(135deg, #f0fff8 0%, #f5f9ff 100%);
  border-color: rgba(17, 183, 162, 0.4);
  box-shadow: 0 2px 8px rgba(17, 183, 162, 0.1);
}
.feed-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.feed-channel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #e8f4fd;
  color: #2563eb;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.feed-channel-badge svg { flex-shrink: 0; }
.feed-channel-badge.ch-tg { background: #e8f3fd; color: #0088cc; }
.feed-channel-badge.ch-wa { background: #e8fdf0; color: #25D366; }
.feed-channel-badge.ch-ig { background: #fef0fb; color: #E1306C; }
.feed-channel-badge.ch-voice { background: #fff3e8; color: #f97316; }
.feed-channel-badge.ch-email { background: #f3e8ff; color: #7c3aed; }
.feed-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dialog-feed-card p {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}
.dialog-feed-card small {
  display: block;
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
}
.feed-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}
/* Chat column */
.dialog-column--chat {
  border-left: 1px solid rgba(216, 229, 251, 0.6);
  border-right: 1px solid rgba(216, 229, 251, 0.6);
}
.chat-thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.75rem;
  min-height: 0;
}
.chat-thread::-webkit-scrollbar { width: 4px; }
.chat-thread::-webkit-scrollbar-track { background: transparent; }
.chat-thread::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.chat-bubble {
  max-width: 90%;
  padding: 0.7rem 0.9rem;
  line-height: 1.55;
  font-size: 0.85rem;
  border-radius: 16px;
  border: 1px solid transparent;
}
.chat-bubble--ai {
  background: #f1f5f9;
  border-color: #e2e8f0;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.chat-bubble--client {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0feff 100%);
  border-color: rgba(17, 183, 162, 0.2);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-bubble--system {
  background: #fefce8;
  border-color: #fde68a;
  align-self: center;
  font-size: 0.78rem;
  color: #92400e;
}
.chat-bubble--operator {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
  border-color: rgba(99, 102, 241, 0.18);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  color: #1e3a5f;
}
.chat-meta {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}
/* Lead card column */
.dialog-column--leadcard {
  overflow-y: auto;
}
.dialog-column--leadcard::-webkit-scrollbar { width: 4px; }
.dialog-column--leadcard::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.lead-card-actions {
  margin-top: auto;
  padding-top: 1rem;
}
.lead-log-panel {
  margin-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5rem;
}
.lead-log-toggle {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  text-align: left;
}
.lead-log-toggle:hover { color: #334155; }
.lead-log-body {
  margin-top: 0.4rem;
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  max-height: 220px;
  overflow-y: auto;
}
.lead-log-row {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.5;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.lead-log-row + .lead-log-row { margin-top: 0.25rem; }
.lead-log-key { color: #94a3b8; flex-shrink: 0; min-width: 90px; }
.lead-log-val { color: #1e293b; font-weight: 500; word-break: break-all; }

/* ══════════════════════════════════════════════════════════
   BROADCASTS TYPE SWITCHER
══════════════════════════════════════════════════════════ */
.scene-control {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.bc-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bc-type-badge--voice { background: #fff3e8; color: #f97316; }
.bc-type-badge--text { background: #e8f4fd; color: #2563eb; }

/* Channel toggle */
.channel-active-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: #64748b;
}
.channel-toggle-btn {
  position: relative;
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.channel-toggle-btn::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.channel-toggle-btn.is-on {
  background: var(--brand);
}
.channel-toggle-btn.is-on::after {
  transform: translateX(16px);
}

/* ========= DIALOGS v2: scene bar, filter drawer, feed pills, composer ========= */
.dialog-scene-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}
.dialog-scene-bar-left { display: flex; align-items: center; gap: 0.75rem; }
.dialog-scene-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.dialog-scene-bar-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* Filter drawer */
.filter-drawer {
  position: fixed;
  top: 0; left: -320px;
  width: 300px;
  height: 100vh;
  background: var(--surface, #1e2130);
  border-right: 1px solid var(--border, rgba(255,255,255,0.08));
  z-index: 1100;
  transition: left 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  overflow: hidden;
}
.filter-drawer.open { left: 0; }
.filter-drawer-inner { padding: 1.5rem 1.25rem; height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 0; }
.filter-drawer-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.filter-drawer-title { font-weight: 700; font-size: 1rem; }
.filter-drawer-close { background: none; border: none; cursor: pointer; color: var(--text-secondary, #94a3b8); font-size: 1.1rem; padding: 0.25rem 0.4rem; border-radius: 6px; }
.filter-drawer-close:hover { background: rgba(255,255,255,0.07); }
.filter-group-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary, #94a3b8); margin: 0 0 0.4rem; }
.filter-pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  transition: all 0.15s;
}
.filter-pill:hover { background: rgba(255,255,255,0.06); color: var(--text, #e2e8f0); }
.filter-pill.active { background: var(--brand, #6366f1); border-color: var(--brand, #6366f1); color: #fff; }
.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.filter-overlay.open { opacity: 1; pointer-events: all; }

/* Feed column header with status pills */
.dialog-feed-hd { padding: 0.5rem 0.75rem 0; flex-shrink: 0; }
.feed-status-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border, rgba(255,255,255,0.07)); }
.feed-pill {
  padding: 0.2rem 0.6rem;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  transition: all 0.15s;
}
.feed-pill:hover { background: rgba(255,255,255,0.05); color: var(--text, #e2e8f0); }
.feed-pill.active { background: var(--brand, #6366f1); border-color: var(--brand, #6366f1); color: #fff; }
#leads-feed { flex: 1; overflow-y: auto; padding: 0.4rem 0.5rem; }

/* Chat composer */
.chat-composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  flex-shrink: 0;
}
.composer-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 20px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text, #e2e8f0);
  outline: none;
}
.composer-input:focus { border-color: var(--brand, #6366f1); background: rgba(255,255,255,0.09); }
.composer-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.composer-btn:hover { background: rgba(255,255,255,0.07); }
.composer-btn--send { background: var(--brand, #6366f1); border-color: var(--brand, #6366f1); color: #fff; font-size: 0.9rem; }
.composer-btn--send:hover { background: var(--brand-dark, #4f46e5); }

/* Agent direction badge */
.badge-dir { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 10px; font-weight: 600; }
.badge-outgoing { background: rgba(99,102,241,0.18); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }
.badge-incoming { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-both { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }

/* Updated dialog-layout height (now without toolbar rows) */
.dialog-layout {
  height: calc(100vh - 220px) !important;
  grid-template-columns: var(--dlg-feed-w, 0.9fr) 5px var(--dlg-chat-w, 1.15fr) 5px var(--dlg-card-w, 0.8fr) !important;
  overflow: hidden;
}

/* Resizer handle */
.dialog-resizer {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  border-radius: 4px;
  transition: background .2s;
  position: relative;
  z-index: 10;
  align-self: stretch;
}
.dialog-resizer::after {
  content: '';
  position: absolute;
  inset: 6px 1px;
  background: var(--line);
  border-radius: 4px;
  transition: background .2s;
}
.dialog-resizer:hover::after,
.dialog-resizer.dragging::after {
  background: var(--brand);
}

/* Each dialog column scrolls independently */
.dialog-column--feed,
.dialog-column--chat,
.dialog-column--leadcard {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* View-level: leads view should not create outer scroll */
.view[data-view="leads"] {
  overflow: hidden;
  display: none;
}
.view[data-view="leads"].active {
  display: flex;
  flex-direction: column;
}
.view[data-view="leads"] .view-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}



/* ========= OPERATOR TAKEOVER + CALL MONITOR + DIALOG PROGRESS ========= */

/* Оператор-режим: badge и состояния */
.badge-operator { background: rgba(234,179,8,0.18); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.badge-on { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }

/* Индикатор live-звонка в карточке */
.call-monitor-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  margin: 0 0.5rem 0.5rem;
  font-size: 0.8rem;
}
.call-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}
.call-live-row { display: flex; align-items: center; gap: 0.4rem; }

/* Прогресс диалога */
.dialog-progress-hd { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #94a3b8; padding: 0.4rem 0.75rem 0.3rem; }
.dialog-stages { display: flex; align-items: center; padding: 0 0.75rem 0.75rem; gap: 0; }
.dialog-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}
.dialog-stage:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 7px; left: 50%;
  width: 100%; height: 2px;
  background: rgba(255,255,255,0.1);
}
.dialog-stage--done:not(:last-child)::after,
.dialog-stage--active:not(:last-child)::after { background: var(--brand, #6366f1); }
.stage-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  position: relative; z-index: 1;
  transition: all 0.2s;
}
.dialog-stage--done .stage-dot { background: var(--brand, #6366f1); border-color: var(--brand, #6366f1); }
.dialog-stage--active .stage-dot { background: #fff; border-color: var(--brand, #6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,0.3); }
.stage-label { font-size: 0.68rem; color: #64748b; text-align: center; }
.dialog-stage--done .stage-label, .dialog-stage--active .stage-label { color: var(--text, #e2e8f0); }

/* Модал мониторинга звонка */
.call-monitor-modal {
  width: 520px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.call-monitor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.cmon-transcript {
  flex: 1;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0,0,0,0.15);
}
.cmon-msg { font-size: 0.82rem; display: flex; gap: 0.5rem; }
.cmon-speaker { font-weight: 700; font-size: 0.72rem; padding: 0.15rem 0.45rem; border-radius: 8px; white-space: nowrap; }
.cmon-msg--ai .cmon-speaker { background: rgba(99,102,241,0.2); color: #818cf8; }
.cmon-msg--client .cmon-speaker { background: rgba(16,185,129,0.15); color: #34d399; }
.cmon-stages {
  display: flex;
  gap: 0;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.cmon-stage {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  padding: 0.3rem 0.2rem;
  color: #64748b;
  border-bottom: 2px solid transparent;
}
.cmon-stage--done { color: var(--brand, #6366f1); border-bottom-color: var(--brand, #6366f1); }
.cmon-stage--active { color: #fff; border-bottom-color: #fff; font-weight: 700; }
.cmon-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  flex-wrap: wrap;
}
.cmon-timer { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3rem; color: #ef4444; }
.cmon-btn {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.15s;
}
.cmon-btn--listen { background: transparent; border-color: rgba(255,255,255,0.15); color: #94a3b8; }
.cmon-btn--listen:hover, .cmon-btn--listen.active { background: rgba(99,102,241,0.15); border-color: var(--brand); color: var(--brand); }
.cmon-btn--join { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); color: #34d399; }
.cmon-btn--join:hover, .cmon-btn--join.active { background: #10b981; color: #fff; border-color: #10b981; }
.cmon-btn--takeover { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3); color: #818cf8; }
.cmon-btn--takeover:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.cmon-btn--end { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); color: #f87171; margin-left: auto; }
.cmon-btn--end:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.cmon-operator-hint { padding: 0.75rem 1.25rem 1rem; border-top: 1px solid var(--border, rgba(255,255,255,0.08)); }
.cmon-script-steps { display: flex; flex-direction: column; gap: 0.3rem; }
.cmon-script-step { font-size: 0.8rem; color: #64748b; padding: 0.3rem 0.6rem; border-radius: 6px; border-left: 2px solid transparent; }
.cmon-script-step--active { color: var(--text, #e2e8f0); border-left-color: var(--brand, #6366f1); background: rgba(99,102,241,0.08); }

/* Escalation rules in agent settings */
.escalation-rules-list { display: flex; flex-direction: column; gap: 0.4rem; }
.escalation-rule {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  font-size: 0.82rem;
}
.escalation-rule select, .escalation-rule input { font-size: 0.8rem; padding: 0.25rem 0.4rem; }
.escalation-rule-del { background: none; border: none; cursor: pointer; color: #ef4444; font-size: 1rem; padding: 0 0.2rem; }


/* Voice picker popup */
.voice-picker-popup {
  position: relative;
  z-index: 20;
  background: var(--surface, #1e2433);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 10px;
  padding: 0.6rem;
  margin-top: 0.4rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.voice-picker-popup .vpc-provider { font-size: 0.7rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; margin: 0.4rem 0 0.3rem; }
.voice-picker-popup .vpc-provider:first-child { margin-top: 0; }

/* Voice picker — card list layout */
.vpc-list { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.35rem; }
.vpc-voice-card {
  display: flex; align-items: center; gap: 0.3rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border,rgba(255,255,255,0.08));
  border-radius: 7px; overflow: hidden;
  transition: border-color 0.12s;
}
.vpc-voice-card:hover { border-color: var(--brand,#6366f1); }
.vpc-voice-card--custom { border-color: rgba(99,102,241,0.25); }
.vpc-voice-apply {
  flex: 1; display: flex; align-items: center; gap: 0.6rem;
  background: none; border: none; cursor: pointer; padding: 0.32rem 0.6rem; text-align: left;
}
.vpc-voice-apply .vpc-id { font-size: 0.82rem; font-weight: 600; color: var(--text,#e2e8f0); }
.vpc-voice-apply .vpc-desc { font-size: 0.7rem; color: #64748b; }
.vpc-voice-actions { display: flex; align-items: center; gap: 0.15rem; padding-right: 0.3rem; position: relative; }
.vpc-play-btn {
  background: none; border: 1px solid var(--border,rgba(255,255,255,0.12));
  border-radius: 5px; padding: 0.18rem 0.45rem; cursor: pointer;
  font-size: 0.75rem; color: #94a3b8;
  transition: background 0.12s, color 0.12s;
}
.vpc-play-btn:hover, .vpc-play-btn.vpc-play-active { background: rgba(99,102,241,0.18); color: var(--brand,#6366f1); border-color: var(--brand,#6366f1); }
.vpc-play-btn.vpc-play-loading { opacity: 0.7; cursor: wait; }
.vpc-del-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.75rem; color: #64748b; padding: 0.18rem 0.3rem;
  transition: color 0.12s;
}
.vpc-del-btn:hover { color: #ef4444; }
.vpc-section-label { font-size: 0.68rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.05em; margin: 0.1rem 0 0.2rem; }
.vpc-section-label--top { margin-top: 0.55rem; }
.vpc-preview-err {
  position: absolute; right: 0; top: -1.6rem;
  background: #1e1e2e; border: 1px solid #ef444480; color: #f87171;
  font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 5px; white-space: nowrap; z-index: 5;
}
/* Add custom voice form */
.vpc-add-section { border-top: 1px solid var(--border,rgba(255,255,255,0.08)); padding-top: 0.4rem; margin-top: 0.25rem; }
.vpc-add-toggle {
  background: none; border: none; cursor: pointer; font-size: 0.77rem; color: #64748b;
  padding: 0.1rem 0; display: flex; align-items: center; gap: 0.3rem;
  transition: color 0.12s;
}
.vpc-add-toggle:hover { color: var(--brand,#6366f1); }
.vpc-add-form-row { display: flex; gap: 0.3rem; margin-top: 0.3rem; }
.vpc-add-input {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid var(--border,rgba(255,255,255,0.12));
  border-radius: 6px; padding: 0.28rem 0.5rem; font-size: 0.75rem; color: var(--text,#e2e8f0);
  min-width: 0;
}
.vpc-add-input::placeholder { color: #475569; }
.vpc-add-input:focus { outline: none; border-color: var(--brand,#6366f1); }
.vpc-add-select {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border,rgba(255,255,255,0.12));
  border-radius: 6px; padding: 0.28rem 0.4rem; font-size: 0.75rem; color: var(--text,#e2e8f0);
}
.vpc-add-save {
  background: var(--brand,#6366f1); border: none; border-radius: 6px;
  padding: 0.28rem 0.75rem; font-size: 0.75rem; color: #fff; cursor: pointer;
  white-space: nowrap;
}
.vpc-add-save:hover { background: #4f52e0; }
/* legacy vpc-grid/vpc-voice-btn kept for compatibility */
.vpc-grid { display: none; }
.vpc-voice-btn { display: none; }
.vpc-close { float: right; background: none; border: none; cursor: pointer; color: #64748b; font-size: 1rem; padding: 0; }

/* Prompt presets dropdown */
.prompt-presets-dropdown {
  position: relative;
  z-index: 20;
  background: var(--surface, #1e2433);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 10px;
  padding: 0.5rem;
  margin-bottom: 0.4rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.ppd-item {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.45rem 0.6rem; border-radius: 7px; cursor: pointer;
  transition: background 0.12s;
}
.ppd-item:hover { background: rgba(99,102,241,0.12); }
.ppd-item-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; margin-top: 0.05rem; }
.ppd-item-body { display: flex; flex-direction: column; gap: 0.1rem; }
.ppd-item-name { font-size: 0.82rem; font-weight: 600; color: var(--text,#e2e8f0); }
.ppd-item-hint { font-size: 0.72rem; color: #64748b; }

/* SIP settings */
#sip-settings-section .settings-section-title { padding: 0.2rem 0.4rem; background: rgba(99,102,241,0.06); border-radius: 5px; }
.intg-warn { color: #f59e0b; }

/* ═══ INTEGRATIONS PAGE ═══ */
.intg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.7rem;
  margin-top: 0.5rem;
}
.intg-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}
.intg-card-icon { font-size: 1.35rem; line-height: 1; flex-shrink: 0; margin-top: 0.05rem; }
.intg-card-body { min-width: 0; }
.intg-card-name { font-size: 0.83rem; font-weight: 600; }
.intg-card-status { font-size: 0.74rem; margin-top: 0.15rem; }
.intg-ok { color: #22c55e; }
.intg-off { color: var(--muted); }
/* ElevenLabs saved key state */
.intg-key-saved {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 12px;
  background: rgba(34,197,94,0.04);
  margin-top: 0.75rem;
}
.intg-key-saved-icon { font-size: 1.4rem; flex-shrink: 0; }
.intg-key-saved-info { flex: 1; min-width: 140px; }
.intg-key-saved-info strong { display: block; font-size: 0.83rem; color: #22c55e; }
.intg-key-saved-info code { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.05em; }
.intg-key-saved-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   PLANS / PRICING PAGE
═══════════════════════════════════════════════════════ */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 14px;
  padding: 1.2rem;
  transition: border-color 0.18s, transform 0.18s;
}
.plan-card:hover { border-color: rgba(99,102,241,0.4); transform: translateY(-2px); }
.plan-card--popular { border-color: rgba(99,102,241,0.5); background: linear-gradient(160deg,rgba(99,102,241,0.09),rgba(139,92,246,0.06)); }
.plan-card--current { border-color: #22c55e; background: rgba(34,197,94,0.05); }
.plan-popular-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand,#6366f1); color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 0.18rem 0.65rem;
  border-radius: 20px; white-space: nowrap;
}
.plan-current-badge { background: #22c55e !important; }
.plan-card-header { margin-bottom: 1rem; margin-top: 0.4rem; }
.plan-card-name { font-size: 1rem; font-weight: 700; color: var(--text,#e2e8f0); margin-bottom: 0.3rem; }
.plan-card-price { font-size: 1.5rem; font-weight: 800; color: var(--text,#e2e8f0); }
.plan-card-billing { font-size: 0.72rem; color: #64748b; margin-top: 0.1rem; }
.plan-features-list {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; flex-direction: column; gap: 0.4rem; flex: 1;
}
.plan-features-list li { font-size: 0.8rem; color: #475569; display: flex; gap: 0.4rem; align-items: flex-start; }
.plan-feat-check { color: #22c55e; flex-shrink: 0; font-weight: 700; }
.plan-card-footer { margin-top: auto; }
.plan-btn { width: 100%; justify-content: center; }

.plans-current-banner {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}
.plans-banner-content { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; font-size: 0.85rem; color: #374151; }
.plans-banner-icon { font-size: 1.2rem; }
.plans-banner-balance { margin-left: auto; }

/* Usage stats */
.plans-usage-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.usage-item {}
.usage-item-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: #374151; margin-bottom: 0.3rem; }
.usage-item-nums { font-size: 0.78rem; color: #64748b; }
.usage-bar { height: 5px; background: rgba(0,0,0,0.08); border-radius: 3px; overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--brand,#6366f1); border-radius: 3px; transition: width 0.4s ease; }
.usage-bar-fill.usage-bar-warn { background: #f59e0b; }

/* Pay-per-lead features */
.plans-leads-features { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.plans-leads-feat { background: rgba(99,102,241,0.07); border: 1px solid rgba(99,102,241,0.18); border-radius: 8px; padding: 0.35rem 0.7rem; font-size: 0.8rem; color: #374151; }

/* ═══════════════════════════════════════════════════════
   PARTNER / REFERRAL PAGE
═══════════════════════════════════════════════════════ */
.partner-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.partner-stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  padding: 1rem 1.2rem;
  text-align: center;
}
.partner-stat-val { font-size: 1.6rem; font-weight: 800; color: var(--text,#e2e8f0); }
.partner-stat-label { font-size: 0.75rem; color: #64748b; margin-top: 0.2rem; }

.partner-how-grid { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.3rem; }
.partner-how-step { display: flex; align-items: flex-start; gap: 0.9rem; }
.partner-how-num {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--brand,#6366f1); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; margin-top: 0.1rem;
}

@media (max-width: 640px) {
  .plans-grid { grid-template-columns: 1fr; }
  .partner-stats-row { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   HOME DASHBOARD PLAN WIDGET
═══════════════════════════════════════════════════════ */
.home-plan-loading { color: #94a3b8; font-size: 0.85rem; padding: 0.5rem 0; }
.home-plan-name {
  font-size: 1.05rem; font-weight: 700; color: var(--text,#1e293b);
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem;
}
.home-plan-badge {
  font-size: 0.78rem; font-weight: 600;
  background: rgba(99,102,241,0.1); color: #6366f1;
  border-radius: 20px; padding: 0.15rem 0.55rem;
}
.home-plan-bars { display: flex; flex-direction: column; gap: 0.4rem; }
.home-plan-bar-row {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: #64748b; margin-top: 0.35rem;
}
.usage-bar-fill--warn { background: #f97316 !important; }
.home-plan-alert {
  margin-top: 0.9rem; font-size: 0.82rem; color: #ea580c;
  background: rgba(251,146,60,0.1); border-radius: 8px;
  padding: 0.5rem 0.75rem;
}
.home-plan-alert a { color: #6366f1; text-decoration: underline; cursor: pointer; }

/* ═══════════════════════════════════════════════════════════
   ANALYTICS USAGE CHARTS
═══════════════════════════════════════════════════════ */
.analytics-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}
.au-chart-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.au-chart-label { font-size: 0.82rem; font-weight: 600; color: #64748b; margin-bottom: 0.2rem; }
.au-bars {
  display: flex; align-items: flex-end; gap: 0.4rem;
  height: 100px; padding-bottom: 30px;
}
.au-bar-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.au-bar-fill {
  width: 100%; min-height: 4px; border-radius: 4px 4px 0 0;
  background: #6366f1; transition: height 0.3s;
}
.au-bar-fill--purple { background: #8b5cf6; }
.au-bar-fill--mint { background: #10b981; }
.au-bar-val { font-size: 0.65rem; color: #64748b; }
.au-bar-month { font-size: 0.62rem; color: #94a3b8; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════
   USAGE LIMIT BANNER
═══════════════════════════════════════════════════════ */
.usage-limit-banner {
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}
.usage-limit-banner--warn {
  background: #fef3c7;
  color: #92400e;
}
.usage-limit-banner--crit {
  background: #fee2e2;
  color: #991b1b;
}
.usage-limit-banner a {
  color: #6366f1;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   PLAN UPGRADE MODAL
═══════════════════════════════════════════════════════ */
.plan-upgrade-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.plan-upgrade-modal {
  background: #fff; border-radius: 20px;
  padding: 2rem; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.plan-upgrade-modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.2rem;
}
.plan-upgrade-modal-name { font-size: 1.3rem; font-weight: 800; color: #1e293b; }
.plan-upgrade-modal-price { font-size: 0.95rem; color: #6366f1; font-weight: 600; margin-top: 0.2rem; }
.plan-upgrade-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: #64748b; line-height: 1;
  padding: 0.2rem 0.4rem; border-radius: 6px;
}
.plan-upgrade-modal-close:hover { background: #f1f5f9; }
.plan-upgrade-modal-feats {
  list-style: none; padding: 0; margin: 0 0 1.2rem 0;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.plan-upgrade-modal-feats li { font-size: 0.87rem; color: #374151; }
.plan-upgrade-modal-note {
  font-size: 0.82rem; color: #64748b;
  background: #f8fafc; border-radius: 10px;
  padding: 0.7rem 1rem; margin: 0 0 1.2rem 0;
}
.plan-upgrade-modal-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.plan-upgrade-modal-actions .btn-app { flex: 1; text-align: center; justify-content: center; text-decoration: none; }

/* ── ADMIN PLANS TABLE ───────────────────────────── */
.admin-plans-table th,
.admin-plans-table td { vertical-align: middle; padding: 8px 6px; }
.admin-plans-table input.field-input { padding: 4px 6px; font-size: 13px; }
.admin-plans-table code { font-size: 12px; color: var(--text-secondary); background: var(--bg-secondary); padding: 2px 5px; border-radius: 4px; }
.apl-active { width: 18px; height: 18px; cursor: pointer; }

/* ── MINUTE PACKAGES ──────────────────────────────── */
.plans-minutes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
}
.plans-minute-pkg {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border-color 0.2s;
}
.plans-minute-pkg:hover { border-color: rgba(99,102,241,0.5); }
.plans-minute-pkg-mins { font-size: 1.2rem; font-weight: 800; color: #1e293b; }
.plans-minute-pkg-price { font-size: 0.95rem; font-weight: 700; color: #6366f1; }
.plans-minute-pkg-ppm { font-size: 0.75rem; color: #64748b; }
.plans-minute-pkg-btn { margin-top: 0.4rem; font-size: 0.8rem; padding: 0.35rem 0.7rem; }

/* ── PAYMENT METHODS ──────────────────────────────── */
.plans-payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-top: 0.75rem;
}
.plans-payment-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
.plans-payment-icon { font-size: 1.4rem; flex-shrink: 0; display: flex; align-items: center; color: var(--accent, #11b7a2); }
.plans-payment-item strong { font-size: 0.9rem; display: block; }

/* ── NICHE CALCULATOR ──────────────────────────────── */
.plans-niche-calc {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.plans-niche-calc-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.plans-niche-price {
  font-size: 1.5rem;
  font-weight: 900;
  color: #6366f1;
  line-height: 1;
  padding-top: 0.5rem;
}

/* Profile stats grid */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}
@media (max-width: 600px) {
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.profile-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  text-align: center;
}
.profile-stat-box span {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand, #6366f1);
  line-height: 1;
}
.profile-stat-box small {
  font-size: 0.73rem;
  color: var(--muted);
}
/* Danger zone card */
.profile-danger-zone {
  border-color: #fecaca !important;
}

/* ── Leads feed pager ─────────────────────────────────────── */
.leads-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.75rem;
}
.leads-pager-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.leads-pager-btn:hover:not(:disabled) { background: var(--surface-2, #f1f5f9); }
.leads-pager-btn:disabled { opacity: 0.35; cursor: default; }
.leads-pager-info {
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 3rem;
  text-align: center;
}

/* ── CRM Icon Styles ─────────────────────────────────────────── */
.crm-icon { display:flex; align-items:center; justify-content:center; width:48px; height:48px; border-radius:12px; margin:0 auto 8px; }
.crm-icon svg { width:26px; height:26px; }
.crm-icon--bitrix  { background:#e0e7ff; color:#4f46e5; }
.crm-icon--amo     { background:#fee2e2; color:#dc2626; }
.crm-icon--webhook { background:#f3e8ff; color:#7c3aed; }

/* ── Analytics Funnel ────────────────────────────────────────── */
.an-funnel { display:flex; flex-direction:column; gap:10px; padding:4px 0; }
.funnel-step { position:relative; border-radius:8px; overflow:hidden; padding:10px 12px; background:#f1f5f9; }
.funnel-bar { position:absolute; inset:0; border-radius:8px; opacity:.18; transition:width .5s ease; }
.funnel-step--indigo .funnel-bar { background:#6366f1; }
.funnel-step--blue   .funnel-bar { background:#3b82f6; }
.funnel-step--green  .funnel-bar { background:#10b981; }
.funnel-meta { position:relative; display:flex; align-items:center; gap:8px; }
.funnel-label { flex:1; font-size:.85rem; font-weight:600; color:var(--text); }
.funnel-count { font-size:.9rem; font-weight:700; color:var(--text); min-width:32px; text-align:right; }
.funnel-pct { font-size:.78rem; color:var(--muted); min-width:36px; text-align:right; }
.funnel-conv { margin-top:8px; font-size:.8rem; color:var(--muted); text-align:right; }
.funnel-conv strong { color:var(--brand); }

/* ── Integration Card SVG Icons ─────────────────────────────── */
.intg-card-icon { display:flex; align-items:center; justify-content:center; width:42px; height:42px; border-radius:10px; flex-shrink:0; }
.intg-card-icon svg { width:22px; height:22px; }

/* ── Status Chips ────────────────────────────────────────────── */
.status-chip { display:inline-flex; align-items:center; padding:2px 8px; border-radius:20px; font-size:0.75rem; font-weight:600; }
.status-chip--mint   { background:#dcfce7; color:#166534; }
.status-chip--warm   { background:#fef9c3; color:#854d0e; }
.status-chip--red    { background:#fee2e2; color:#991b1b; }
.status-chip--muted  { background:#f1f5f9; color:var(--muted); }

/* ── Dashboard grid 2-col ────────────────────────────────────── */
.dashboard-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media(max-width:700px){ .dashboard-grid { grid-template-columns:1fr; } }

/* ── Campaign Modal – new components ─────────────────────────── */
.radio-pill-group { display:flex; gap:0.5rem; flex-wrap:wrap; }
.radio-pill-group .radio-pill { display:flex; align-items:center; gap:0.35rem; padding:0.35rem 0.8rem; border:1.5px solid var(--border,#dde3ec); border-radius:8px; cursor:pointer; font-size:0.85rem; transition:border-color .15s,background .15s; user-select:none; }
.radio-pill-group .radio-pill input[type=radio] { accent-color:var(--accent,#2d57e8); }
.radio-pill-group .radio-pill:has(input:checked) { border-color:var(--accent,#2d57e8); background:rgba(45,87,232,.06); font-weight:600; }

.camp-settings-divider { font-size:0.72rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted,#8a93a8); margin:1rem 0 0.5rem; padding-bottom:0.3rem; border-bottom:1px solid var(--border,#dde3ec); }

.day-picker { display:flex; gap:0.35rem; flex-wrap:wrap; }
.day-picker .day-pill { display:flex; align-items:center; justify-content:center; cursor:pointer; user-select:none; }
.day-picker .day-pill input[type=checkbox] { display:none; }
.day-picker .day-pill span { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border:1.5px solid var(--border,#dde3ec); border-radius:50%; font-size:0.78rem; font-weight:600; transition:all .15s; }
.day-picker .day-pill:has(input:checked) span { background:var(--accent,#2d57e8); border-color:var(--accent,#2d57e8); color:#fff; }

.camp-details { margin-top:0.75rem; }
.camp-details summary { cursor:pointer; font-size:0.83rem; color:var(--muted,#8a93a8); font-weight:600; padding:0.3rem 0; outline:none; }
.camp-details summary:hover { color:var(--text); }
.camp-details[open] summary { color:var(--accent,#2d57e8); }

/* ── Broadcasts table – edit / channel badges ─────────────────── */
.bc-edit-btn { padding:0.2rem 0.65rem; font-size:0.79rem; }
.camp-channel-badge { display:inline-flex; align-items:center; gap:3px; font-size:0.72rem; padding:1px 7px; border-radius:4px; font-weight:600; vertical-align:middle; }
.camp-channel-badge--tg { background:#e8f4ff; color:#0088cc; }
.camp-channel-badge--sip { background:#f1f5f9; color:#64748b; }
.camp-channel-badge--both { background:#fef3c7; color:#92400e; }
.contacts-tab-btn.active { background:#f1f5f9; color:#1e40af; font-weight:600; border-bottom:2px solid #3b82f6; }

/* ── Multi-channel checkboxes ── */
.ch-check-pill { display:inline-flex; align-items:center; gap:0.35rem; padding:0.3rem 0.7rem; border:1.5px solid var(--border); border-radius:20px; cursor:pointer; font-size:0.83rem; transition:border-color 0.15s,background 0.15s,color 0.15s; user-select:none; }
.ch-check-pill input[type=checkbox] { display:none; }
.ch-check-pill.is-checked { border-color:var(--accent); background:#eff6ff; color:var(--accent); font-weight:600; }

/* ── Toggle pill switch ── */
.toggle-pill { position:relative; display:inline-block; width:40px; height:22px; flex-shrink:0; }
.toggle-pill input { opacity:0; width:0; height:0; }
.toggle-pill-slider { position:absolute; inset:0; background:#cbd5e1; border-radius:22px; transition:background 0.2s; cursor:pointer; }
.toggle-pill-slider::before { content:''; position:absolute; width:16px; height:16px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform 0.2s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.toggle-pill input:checked + .toggle-pill-slider { background:var(--accent); }
.toggle-pill input:checked + .toggle-pill-slider::before { transform:translateX(18px); }

/* ── Priority list ── */
.priority-item { display:flex; align-items:center; gap:0.45rem; background:#f8faff; border:1px solid var(--border); border-radius:8px; padding:0.4rem 0.55rem; font-size:0.82rem; margin-bottom:0.35rem; }
.priority-item-num { width:1.3rem; text-align:center; font-weight:700; color:var(--accent); font-size:0.75rem; flex-shrink:0; }
.priority-item-name { flex:1; font-weight:500; }
.priority-item-gap { display:flex; align-items:center; gap:0.3rem; font-size:0.77rem; color:var(--text-muted); white-space:nowrap; }
.priority-move-btn { background:none; border:none; cursor:pointer; padding:0.05rem 0.2rem; color:#94a3b8; font-size:0.72rem; border-radius:3px; line-height:1; }
.priority-move-btn:hover { background:#e2e8f0; color:var(--text); }

/* ── Distribution rows ── */
.dist-row { display:flex; align-items:center; gap:0.55rem; padding:0.3rem 0; font-size:0.82rem; }
.dist-bar-outer { flex:1; height:7px; background:var(--border); border-radius:3px; overflow:hidden; min-width:40px; }
.dist-bar-fill { height:100%; border-radius:3px; transition:width 0.15s; }

/* r31: drag handle, drag-over, mixed base, anti-ban */
.priority-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0 0.2rem;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}
.priority-drag-handle:active { cursor: grabbing; }
.priority-item { transition: background 0.15s; }
.priority-item.priority-drag-over {
  background: #e0f2fe;
  border-color: #38bdf8 !important;
  transform: scale(1.01);
}
/* Better checkbox pill visibility */
.ch-check-pill {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}
.ch-check-pill input[type="checkbox"] { display: none; }
.ch-check-pill:hover { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,0.08); }
.ch-check-pill.is-checked {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.12);
  color: var(--accent);
}
/* Anti-ban mode section glow when active */
#camp-antibank-mode:checked ~ .toggle-pill-slider { background: #f59e0b !important; }

/* ══ Wider campaign modal ══ */
.profile-modal-box--wide {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.4rem 1.8rem;
}

/* ══ Channels Management Page ══ */
.scene-channels { padding-bottom: 1.2rem; }
.ch-mgmt-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.ch-mgmt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}
.ch-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  text-align: center;
}
.ch-stat-card--ok { border-color: #22c55e55; background: #f0fdf4; }
.ch-stat-card--active { border-color: #6366f155; background: #eef2ff; }
.ch-stat-card--agents { border-color: #0ea5e955; background: #f0f9ff; }
.ch-stat-num { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.3rem; }
.ch-stat-label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

.ch-type-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }
.ch-type-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.7rem; border-radius: 20px;
  border: 1.5px solid color-mix(in srgb, var(--ch-color) 30%, transparent);
  background: color-mix(in srgb, var(--ch-color) 10%, transparent);
  color: var(--ch-color); font-size: 0.78rem; font-weight: 600;
}
.ch-type-pill b { font-size: 0.9em; }

.ch-accounts-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }
.ch-acc-card {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  transition: box-shadow 0.15s;
}
.ch-acc-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.ch-acc-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ch-acc-info { flex: 1; min-width: 0; }
.ch-acc-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-acc-meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; }
.ch-acc-badges { display: flex; gap: 0.4rem; flex-shrink: 0; }
.ch-acc-badge {
  padding: 0.15rem 0.5rem; border-radius: 8px; font-size: 0.72rem; font-weight: 600;
}
.ch-acc-badge--active { background: #dcfce7; color: #16a34a; }
.ch-acc-badge--idle { background: #f3f4f6; color: #6b7280; }
.ch-acc-badge--conn { background: #dbeafe; color: #2563eb; }
.ch-acc-badge--disc { background: #fee2e2; color: #dc2626; }
.ch-acc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.ch-acc-dot--on { background: #22c55e; }
.ch-acc-dot--off { background: #ef4444; }

.ch-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.7rem;
  margin-top: 0.5rem;
}
.ch-platform-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.12s;
}
.ch-platform-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.ch-platform-icon { display: flex; justify-content: center; margin-bottom: 0.5rem; }
.ch-platform-name { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.2rem; }
.ch-platform-count { font-size: 0.72rem; color: var(--muted); }

.ch-empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted);
}
.ch-empty-icon { margin-bottom: 1rem; opacity: 0.35; }
.ch-empty-state h3 { font-size: 1.1rem; margin: 0 0 0.5rem; color: var(--text); }
.ch-empty-state p { font-size: 0.88rem; }
.ch-empty-state a { color: var(--accent); }

/* ══ Anti-ban block ══ */
.antiban-block {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border: 1.5px solid #fcd34d;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
}
.antiban-block-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.antiban-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(234,179,8,0.15);
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.antiban-block-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.antiban-block-title { font-weight: 700; font-size: 0.88rem; color: #92400e; }
.antiban-block-sub { font-size: 0.74rem; color: #78350f; }
.antiban-toggle { flex-shrink: 0; }
.antiban-desc-box {
  margin-top: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.antiban-desc-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.77rem;
  color: #78350f;
  line-height: 1.4;
}
.antiban-desc-row svg { flex-shrink: 0; margin-top: 1px; }

/* ══ Campaign base upload ══ */
.base-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.base-upload-zone:hover, .base-upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,0.04);
  color: var(--accent);
}
.base-upload-hint { font-size: 0.85rem; margin: 0.4rem 0 0; }
.base-upload-hint2 { font-size: 0.73rem; color: var(--muted); margin: 0.25rem 0 0; line-height: 1.4; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

.base-preview-bar {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.base-col-map { margin-bottom: 0.5rem; }
.base-col-map-row {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  font-size: 0.8rem;
}
.base-col-map-row label { font-weight: 600; white-space: nowrap; }
.base-col-map-row .field-input { flex: 1; min-width: 100px; max-width: 160px; font-size: 0.8rem; padding: 0.25rem 0.5rem; }
.base-range-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; margin-bottom: 0.5rem; flex-wrap: wrap;
}
.base-preview-table-wrap { overflow-x: auto; max-height: 140px; overflow-y: auto; border-radius: 8px; border: 1px solid var(--border); }
.base-preview-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.base-preview-table th { background: var(--surface); padding: 0.3rem 0.5rem; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.base-preview-table td { padding: 0.25rem 0.5rem; border-bottom: 1px solid rgba(0,0,0,0.04); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══ Camp settings divider with icon ══ */
.camp-settings-divider {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  margin: 1rem 0 0.6rem;
}
.camp-settings-divider svg { opacity: 0.6; }

/* ══ Project tag badge ══ */
.project-tag-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  background: rgba(99,102,241,0.1);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ══ Channel badges for dialogs (new channels) ══ */
.ch-fb   { background: #1877f218; color: #1877f2; }
.ch-viber { background: #7360f218; color: #7360f2; }
.ch-vk   { background: #4680c218; color: #4680c2; }
.ch-max  { background: #f9731618; color: #f97316; }
.ch-avito { background: #00965e18; color: #00965e; }
.ch-web  { background: #0ea5e918; color: #0ea5e9; }

/* ══ Channels quick-add icon grid ══════════════════════════════ */
.ch-quick-add-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.ch-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.8rem;
  background: color-mix(in srgb, var(--ch-qbtn-color) 10%, var(--surface-2));
  border: 1.5px solid color-mix(in srgb, var(--ch-qbtn-color) 30%, transparent);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  min-width: 70px;
  font: inherit;
}
.ch-quick-btn:hover {
  background: color-mix(in srgb, var(--ch-qbtn-color) 22%, var(--surface-2));
  border-color: var(--ch-qbtn-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ch-qbtn-color) 25%, transparent);
}
.ch-quick-icon { display: flex; color: var(--ch-qbtn-color); }
.ch-quick-icon svg { width: 22px; height: 22px; }
.ch-quick-label { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

/* ══ Channel account card improvements ═════════════════════════ */
.ch-acc-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.ch-acc-card:last-child { margin-bottom: 0; }
.ch-acc-info { flex: 1; min-width: 120px; }
.ch-acc-assign {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 160px;
}
.ch-acc-assign-label { font-size: 0.72rem; color: var(--muted); }
.ch-acc-assign-select {
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text);
  cursor: pointer;
  max-width: 180px;
}
.ch-acc-actions { display: flex; gap: 0.4rem; }
.ch-acc-del-btn:hover { color: #e53e3e; border-color: #e53e3e; }

/* ══ Channel add modal: type picker grid ════════════════════════ */
.ch-modal-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.ch-modal-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font: inherit;
  min-width: 60px;
}
.ch-modal-type-btn:hover {
  background: color-mix(in srgb, var(--ch-color) 12%, var(--surface-1));
  border-color: var(--ch-color);
}
.ch-modal-type-btn--active {
  background: color-mix(in srgb, var(--ch-color) 18%, var(--surface-1));
  border-color: var(--ch-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ch-color) 25%, transparent);
}
.ch-modal-type-icon { display: flex; color: var(--ch-color); }
.ch-modal-type-icon svg { width: 18px; height: 18px; }
.ch-modal-type-name { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

/* ══ Channel warming status ════════════════════════════════════ */
.ch-acc-status {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}
.ch-ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  white-space: nowrap;
}
.ch-ws-badge--ws-active     { background: #dcfce7; color: #16a34a; }
.ch-ws-badge--ws-warming    { background: #fef9c3; color: #b45309; }
.ch-ws-badge--ws-banned     { background: #fee2e2; color: #dc2626; }
.ch-ws-badge--ws-disc       { background: #f1f5f9; color: #64748b; }
.ch-ws-select {
  font-size: 0.73rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-1);
  color: var(--text);
  cursor: pointer;
}

/* ══ Contact cross-channel panel ════════════════════════════════ */
#lead-contact-channels { margin-top: 0.75rem; }
.ch-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.lead-cc-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 0.25rem;
}
.lead-cc-item:hover { background: var(--surface-2); }
.lead-cc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.lead-cc-info { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.lead-cc-ch { font-size: 0.75rem; font-weight: 600; color: var(--text); }
.lead-cc-date { font-size: 0.68rem; color: var(--muted); }

/* ══ Channel Health Analytics ═══════════════════════════════ */
.ch-health-kpi-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.ch-hkpi-card {
  flex: 1;
  min-width: 90px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-align: center;
}
.ch-hkpi-card--active   { border-color: #86efac; background: #f0fdf4; }
.ch-hkpi-card--warming  { border-color: #fde68a; background: #fffbeb; }
.ch-hkpi-card--banned   { border-color: #fca5a5; background: #fef2f2; }
.ch-hkpi-num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.ch-hkpi-label { font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; }
.ch-hkpi-card--active .ch-hkpi-num  { color: #16a34a; }
.ch-hkpi-card--warming .ch-hkpi-num { color: #b45309; }
.ch-hkpi-card--banned .ch-hkpi-num  { color: #dc2626; }

/* Per-type health bars */
.ch-health-type-table { display: flex; flex-direction: column; gap: 0.5rem; }
.ch-health-type-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ch-health-type-icon { display: flex; flex-shrink: 0; }
.ch-health-type-icon svg { width: 18px; height: 18px; }
.ch-health-type-name { min-width: 80px; font-size: 0.82rem; font-weight: 500; }
.ch-health-type-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.ch-health-type-bar { height: 100%; border-radius: 3px; transition: width 0.5s; }
.ch-health-type-stats { display: flex; gap: 0.3rem; flex-wrap: wrap; }

/* Banned accounts list */
.ch-banned-hd {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #fef2f2;
  border-radius: 6px;
}
.ch-banned-list { display: flex; flex-direction: column; gap: 0.4rem; }
.ch-banned-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-1);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  flex-wrap: wrap;
}
.ch-banned-info { flex: 1; min-width: 120px; }
.ch-banned-name { font-size: 0.83rem; font-weight: 600; }
.ch-banned-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }
.ch-banned-reason {
  font-size: 0.75rem;
  color: #dc2626;
  background: #fef2f2;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  max-width: 200px;
}

/* Channel card agent stats micro-line */
.ch-acc-agent-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.ch-acc-agent-stats span { white-space: nowrap; }

/* ══ Campaign progress bar (in card) ══════════════════════ */
.camp-progress-wrap {
  margin-top: 0.4rem;
}
.camp-progress-bar {
  display: flex;
  height: 5px;
  background: var(--border, #e2e8f0);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.camp-progress-seg { height: 100%; transition: width 0.4s; }
.camp-progress-seg--done { background: #22c55e; }
.camp-progress-seg--fail { background: #ef4444; }
.camp-progress-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.camp-pstat { font-size: 0.72rem; }
.camp-pstat--qual { color: #16a34a; font-weight: 600; }
.camp-pstat--done { color: #22c55e; }
.camp-pstat--fail { color: #ef4444; }
.camp-pstat--pend { color: #94a3b8; }

/* ══ Contacts modal filter chips ══════════════════════════ */
.contacts-filter-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface-1, #f8fafc);
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.contacts-filter-chip:hover { background: var(--surface-2, #f1f5f9); }
.contacts-filter-chip.active {
  background: var(--primary, #3b82f6);
  color: #fff;
  border-color: transparent;
}

/* ══ Contacts modal progress bar ══════════════════════════ */
.cpm-progress-bar-full {
  height: 8px;
  background: var(--border, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  margin-bottom: 0.35rem;
}
.cpm-pb-seg { height: 100%; transition: width 0.4s; }
.cpm-pb-seg--done { background: #22c55e; }
.cpm-pb-seg--fail { background: #ef4444; }
.cpm-progress-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.78rem; }
.cpm-ps--done { color: #22c55e; }
.cpm-ps--fail { color: #ef4444; }
.cpm-ps--pend { color: #94a3b8; }

/* ══ Dashboard ban banner ════════════════════════════════ */
.home-ban-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: #dc2626;
  transition: background 0.15s;
}
.home-ban-banner:hover { background: #fee2e2; }
.home-ban-banner-link {
  margin-left: auto;
  font-weight: 600;
  white-space: nowrap;
}

/* ══ Home running campaigns widget ══════════════════════ */
.home-camp-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.home-camp-row:last-child { border-bottom: none; }
.home-camp-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.home-camp-name { font-size: 0.85rem; font-weight: 600; flex: 1; }
.home-camp-status {
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.home-camp-running  { background: #dcfce7; color: #16a34a; }
.home-camp-paused   { background: #fef9c3; color: #b45309; }
.home-camp-stopped  { background: #fee2e2; color: #dc2626; }
.home-camp-draft    { background: #f1f5f9; color: #64748b; }
.home-camp-done     { background: #f0fdf4; color: #16a34a; }
.home-camp-meta { display: flex; align-items: center; gap: 0.5rem; }
.home-camp-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--border, #e2e8f0);
  border-radius: 3px;
  overflow: hidden;
}
.home-camp-bar { height: 100%; background: #22c55e; border-radius: 3px; transition: width 0.4s; }
.home-camp-nums { font-size: 0.72rem; color: var(--muted, #64748b); white-space: nowrap; }

/* ══ Home activity feed ══════════════════════════════════ */
.mt-md { margin-top: 1rem; }
.home-activity-list { display: flex; flex-direction: column; gap: 0; }
.home-act-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border, #f1f5f9);
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.home-act-row:last-child { border-bottom: none; }
.home-act-time  { color: var(--muted, #94a3b8); min-width: 38px; flex-shrink: 0; }
.home-act-phone { flex: 1; min-width: 100px; font-weight: 500; }
.home-act-agent { color: var(--muted, #64748b); font-size: 0.75rem; flex: 1; min-width: 80px; }
.home-act-dur   { color: var(--muted, #94a3b8); font-size: 0.75rem; min-width: 40px; text-align: right; }
.home-act-res   { font-size: 0.75rem; font-weight: 600; min-width: 60px; text-align: right; }

/* ===== r38: Lead labels + notes + budget edit ===== */

/* Labels section in lead card */
.lead-labels-hd, .lead-notes-hd {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0.85rem 0 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lead-labels-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 1.2rem;
  margin-bottom: 0.45rem;
}
.lead-labels-preset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}
.lead-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.3);
  background: rgba(148,163,184,0.08);
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.lead-label-chip:hover {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.35);
  color: #a5b4fc;
}
.lead-label-chip--active {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.5);
  color: #c7d2fe;
}
.lead-label-chip--active:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
}

/* Labels in feed card */
.feed-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-bottom: 0.3rem;
}
.feed-label-chip {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.3);
  white-space: nowrap;
}

/* Notes section */
.lead-notes-save-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: #6366f1;
  padding: 0;
  font-weight: 600;
}
.lead-notes-save-btn:hover { color: #a5b4fc; }
.lead-notes-area {
  width: 100%;
  box-sizing: border-box;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 0.5rem;
  color: #e2e8f0;
  font-size: 0.8rem;
  padding: 0.55rem 0.75rem;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}
.lead-notes-area:focus {
  outline: none;
  border-color: rgba(99,102,241,0.5);
}

/* Inline budget edit */
.lead-fact--budget strong { display: flex; align-items: center; gap: 0.4rem; }
.lead-budget-display {
  cursor: pointer;
  border-bottom: 1px dashed rgba(148,163,184,0.35);
  transition: border-color 0.15s, color 0.15s;
}
.lead-budget-display:hover { color: #a5b4fc; border-color: rgba(99,102,241,0.5); }
.lead-budget-input {
  width: 90px;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(99,102,241,0.5);
  border-radius: 0.3rem;
  color: #e2e8f0;
  font-size: 0.82rem;
  padding: 0.15rem 0.4rem;
  font-family: inherit;
}
.lead-budget-input:focus { outline: none; border-color: #6366f1; }

/* ===== r39: Leads stats strip + autotag banner ===== */

.leads-stats-strip {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.5rem 1.25rem;
  background: rgba(15,23,42,0.4);
  border-bottom: 1px solid rgba(148,163,184,0.1);
  flex-wrap: wrap;
}
.lss-stat {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.1rem 0.6rem;
}
.lss-num {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}
.lss-num--new    { color: #60a5fa; }
.lss-num--active { color: #f59e0b; }
.lss-num--qual   { color: #34d399; }
.lss-num--rej    { color: #f87171; }
.lss-num--budget { color: #a78bfa; }
.lss-lbl {
  font-size: 0.68rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lss-div {
  width: 1px;
  height: 1.2rem;
  background: rgba(148,163,184,0.18);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

/* Auto-tag banner */
.autotag-banner {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: #6ee7b7;
  margin-bottom: 0.5rem;
}

/* ===== r40: Reminders + clone ===== */

/* Reminder section in lead card */
.lead-remind-hd {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0.85rem 0 0.4rem;
}
.lead-remind-clear {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 0.78rem;
  padding: 0 0.2rem;
  line-height: 1;
}
.lead-remind-clear:hover { color: #f87171; }
.lead-remind-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.lead-remind-input {
  font-size: 0.8rem !important;
  padding: 0.28rem 0.5rem !important;
}

/* Bell icon in feed card */
.feed-remind-bell {
  font-size: 0.75rem;
  opacity: 0.6;
  flex-shrink: 0;
}
.feed-remind-bell--due {
  opacity: 1;
  animation: bell-pulse 1.5s ease-in-out infinite;
}
@keyframes bell-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* Toast info variant */
.toast.toast-info {
  background: rgba(99,102,241,0.92);
  border-color: rgba(129,140,248,0.4);
}

/* ===== r41: Dashboard reminders widget ===== */
.home-remind-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(148,163,184,0.1);
}
.home-remind-row:last-child { border-bottom: none; }
.home-remind-bell { font-size: 1rem; flex-shrink: 0; }
.home-remind-bell--due { animation: bell-pulse 1.5s ease-in-out infinite; }
.home-remind-info { flex: 1; min-width: 0; }
.home-remind-info strong { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-remind-contact { font-size: 0.75rem; color: #64748b; }
.home-remind-time { text-align: right; font-size: 0.75rem; color: #94a3b8; flex-shrink: 0; line-height: 1.5; }

/* ===== r42: Feed add-lead button ===== */
.dialog-feed-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}
.feed-add-lead-btn {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
}

/* ===== r42: Quick status selector in feed card ===== */
.feed-quick-status {
  margin-top: 0.45rem;
  display: flex;
}
.feed-qs-select {
  font-size: 0.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,0.3);
  background: rgba(30,41,59,0.7);
  color: #cbd5e1;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.feed-qs-select:hover { border-color: #6366f1; }
.feed-qs-select[data-status="new"] { background: rgba(3,105,161,0.15); border-color: rgba(3,105,161,0.4); color: #93c5fd; }
.feed-qs-select[data-status="in_progress"] { background: rgba(161,98,7,0.15); border-color: rgba(161,98,7,0.4); color: #fde68a; }
.feed-qs-select[data-status="qualified"] { background: rgba(21,128,61,0.15); border-color: rgba(21,128,61,0.4); color: #86efac; }
.feed-qs-select[data-status="rejected"] { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.4); color: #fca5a5; }

/* ===== r42: Per-label analytics ===== */
.an-labels-list { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.25rem 0; }
.an-label-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px 60px;
  align-items: center;
  gap: 0.75rem;
}
.an-label-name { font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-label-bar-wrap { background: rgba(148,163,184,0.12); border-radius: 99px; height: 8px; overflow: hidden; }
.an-label-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #818cf8); transition: width 0.4s ease; }
.an-label-cnt { font-size: 0.78rem; color: #94a3b8; text-align: right; }
.an-label-conv { font-size: 0.78rem; color: #94a3b8; text-align: right; }
.an-label-conv--hi { color: #34d399; font-weight: 600; }

/* ===== r43: Status badge variants ===== */
.badge-prog { background: rgba(99,102,241,0.15); color: #6366f1; }

/* ===== r43: Lead card action buttons ===== */
.btn-icon { padding: 0.28rem 0.5rem !important; font-size: 1rem; line-height: 1; min-width: unset; }
.btn-danger-ghost { color: #ef4444 !important; }
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1) !important; border-color: rgba(239,68,68,0.3) !important; }

/* ===== r43: Timeline modal ===== */
.modal-box--wide { max-width: 620px; width: 96vw; max-height: 80vh; display: flex; flex-direction: column; }
.tl-list { overflow-y: auto; padding: 0.5rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.tl-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem; background: rgba(248,250,252,0.7); border: 1px solid rgba(226,232,240,0.8); border-radius: 10px; }
.tl-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; margin-top: 0.1rem; }
.tl-body { flex: 1; min-width: 0; }
.tl-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.tl-date { font-size: 0.75rem; color: #94a3b8; margin-left: auto; }
.tl-summary { font-size: 0.82rem; color: #475569; margin-top: 0.25rem; line-height: 1.4; }
.tl-meta { font-size: 0.78rem; color: #64748b; margin-top: 0.2rem; }

/* ===== r44: Global search ===== */
.topbar-btn-icon { background: none; border: 1px solid transparent; color: var(--text-muted); border-radius: 8px; padding: 0.35rem 0.5rem; cursor: pointer; display: flex; align-items: center; transition: all 0.15s; }
.topbar-btn-icon:hover { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.2); color: var(--accent); }
.gs-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15,23,42,0.55); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.gs-box { background: #fff; border-radius: 14px; width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 20px rgba(99,102,241,0.15); overflow: hidden; }
.gs-input-wrap { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid #e2e8f0; }
.gs-icon { flex-shrink: 0; color: #94a3b8; }
.gs-input { flex: 1; border: none; outline: none; font-size: 1rem; font-family: inherit; background: transparent; color: var(--text); }
.gs-input::placeholder { color: #94a3b8; }
.gs-close { background: #f1f5f9; border: none; border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.72rem; color: #64748b; cursor: pointer; white-space: nowrap; }
.gs-results { max-height: 360px; overflow-y: auto; }
.gs-hint { padding: 1.25rem 1rem; text-align: center; color: #94a3b8; font-size: 0.85rem; margin: 0; }
.gs-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background 0.1s; gap: 0.75rem; }
.gs-item:hover { background: #f8fafc; }
.gs-item-left { display: flex; align-items: center; gap: 0.6rem; }
.gs-ch { font-size: 1.1rem; }
.gs-name { font-weight: 600; font-size: 0.87rem; color: var(--text); }
.gs-contact { font-size: 0.76rem; color: #94a3b8; margin-top: 0.1rem; }

/* ===== r44: Broadcast preview ===== */
.bp-phone-wrap { display: flex; justify-content: center; padding: 1.25rem 1rem 0.5rem; }
.bp-phone { background: #e8f5e9; border-radius: 18px 18px 18px 4px; padding: 0.85rem 1rem; max-width: 300px; width: 100%; }
.bp-bubble { font-size: 0.9rem; line-height: 1.55; color: #1b1b1b; white-space: pre-wrap; word-break: break-word; }
.bp-time { font-size: 0.7rem; color: #94a3b8; margin-top: 0.35rem; text-align: right; }

/* ===== r45: Notifications ===== */
.notif-btn-wrap { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; background: #ef4444; color: #fff; font-size: 0.62rem; font-weight: 700; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 3px; pointer-events: none; z-index: 5; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 300px; background: #1e2433; border: 1px solid #2e3650; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.45); z-index: 200; overflow: hidden; }
.notif-panel-hd { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1rem 0.6rem; font-size: 0.82rem; font-weight: 600; color: #e2e8f0; border-bottom: 1px solid #2e3650; }
.notif-panel-close { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem; }
.notif-panel-close:hover { color: #e2e8f0; }
.notif-panel-list { max-height: 280px; overflow-y: auto; padding: 0.5rem 0; }
.notif-empty { text-align: center; color: #64748b; font-size: 0.8rem; padding: 1.5rem 1rem; margin: 0; }
.notif-item { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 1rem; cursor: pointer; transition: background 0.12s; }
.notif-item:hover { background: #2a3347; }
.notif-item--due .notif-item-time { color: #f87171; }
.notif-item-icon { font-size: 1.1rem; line-height: 1.4; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-name { font-size: 0.8rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { font-size: 0.72rem; color: #94a3b8; margin-top: 1px; }

/* ===== r45: Bulk actions ===== */
.leads-bulk-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.5rem 0.75rem; background: #1a2235; border-bottom: 1px solid #2e3650; }
.bulk-count { font-size: 0.78rem; color: #94a3b8; white-space: nowrap; }
.bulk-cb { width: 15px; height: 15px; accent-color: #6366f1; cursor: pointer; flex-shrink: 0; }
.dialog-feed-card.bulk-selected { background: #1e2a4a !important; box-shadow: inset 3px 0 0 #6366f1; }

/* ===== r46: Period filter pills ===== */
.period-pills { display: flex; gap: 0.3rem; align-items: center; }
.period-pill { padding: 0.22rem 0.65rem; font-size: 0.75rem; font-weight: 600; border: 1px solid #2e3650; border-radius: 999px; background: transparent; color: #94a3b8; cursor: pointer; transition: all 0.13s; }
.period-pill:hover { border-color: #6366f1; color: #a5b4fc; }
.period-pill--active { background: #6366f1; border-color: #6366f1; color: #fff; }

/* ===== r47: Lead notes log ===== */
.notes-log { max-height: 190px; overflow-y: auto; margin-bottom: 0.5rem; scrollbar-width: thin; scrollbar-color: #2e3650 transparent; }
.notes-entry { padding: 0.45rem 0.6rem; border-left: 2px solid #2e3650; margin-bottom: 0.35rem; border-radius: 0 4px 4px 0; background: #151c2c; }
.notes-entry--legacy { border-left-color: #4f68aa; }
.notes-ts { font-size: 0.68rem; color: #6366f1; font-weight: 600; margin-bottom: 0.1rem; }
.notes-text { font-size: 0.78rem; color: #cbd5e1; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.notes-empty { font-size: 0.76rem; color: #64748b; margin: 0; padding: 0.3rem 0 0.5rem; }
.notes-add-form { display: flex; gap: 0.4rem; align-items: flex-end; }
.notes-new-input { flex: 1; font-size: 0.78rem; resize: none; min-height: 54px; }

/* ===== r48: Label color classes (SVG icon chips) ===== */
.llc--hot    { --ll-c:#f97316; --ll-bg:rgba(249,115,22,0.1);  --ll-bd:rgba(249,115,22,0.3);  }
.llc--call   { --ll-c:#60a5fa; --ll-bg:rgba(96,165,250,0.1);  --ll-bd:rgba(96,165,250,0.3);  }
.llc--crm    { --ll-c:#94a3b8; --ll-bg:rgba(148,163,184,0.1); --ll-bd:rgba(148,163,184,0.25);}
.llc--done   { --ll-c:#34d399; --ll-bg:rgba(52,211,153,0.1);  --ll-bd:rgba(52,211,153,0.3);  }
.llc--reject { --ll-c:#f87171; --ll-bg:rgba(248,113,113,0.1); --ll-bd:rgba(248,113,113,0.3); }
.llc--wait   { --ll-c:#f59e0b; --ll-bg:rgba(245,158,11,0.1);  --ll-bd:rgba(245,158,11,0.3);  }
.llc--budget { --ll-c:#a78bfa; --ll-bg:rgba(167,139,250,0.1); --ll-bd:rgba(167,139,250,0.3); }

/* Lead card chips with label colors */
.lead-label-chip.llc {
  color: var(--ll-c);
  background: var(--ll-bg);
  border-color: var(--ll-bd);
}
.lead-label-chip.llc:hover {
  filter: brightness(1.15);
}
.lead-label-chip--active.llc:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
  filter: none;
}
.llc-x { opacity: 0.55; font-size: 0.65em; margin-left: 0.1rem; }

/* Feed card chips with label colors */
.feed-label-chip.llc {
  color: var(--ll-c);
  background: var(--ll-bg);
  border-color: var(--ll-bd);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* Filter drawer pills with label colors */
.filter-pill.llc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ll-c);
  border-color: var(--ll-bd);
}
.filter-pill.llc.active {
  background: var(--ll-c);
  border-color: var(--ll-c);
  color: #fff;
}
.filter-pill.llc svg { opacity: 0.85; }

/* ===== r49: Leads stats strip — white card, collapsible ===== */
.leads-stats-strip {
  background: #fff;
  border: 1px solid rgba(216,229,251,0.9);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(18,35,63,0.06);
  margin: 0.55rem 0 0.2rem;
  overflow: hidden;
}
.lss-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s, background 0.15s;
}
.lss-header:hover { background: #f7f9ff; }
.leads-stats-strip:has(.lss-body:not(.lss-body--collapsed)) .lss-header {
  border-bottom-color: rgba(216,229,251,0.7);
}
.lss-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.77rem;
  font-weight: 700;
  color: #6366f1;
  letter-spacing: 0.01em;
}
.lss-chevron { transition: transform 0.22s ease; }
.lss-chevron--open { transform: rotate(180deg); }
.lss-summary {
  font-size: 0.74rem;
  color: #94a3b8;
  flex: 1;
}
.lss-body {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  padding: 0.4rem 0.5rem 0.6rem;
  gap: 0;
}
.lss-body--collapsed { display: none; }
.lss-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  border-right: 1px solid rgba(216,229,251,0.7);
}
.lss-card:last-child { border-right: none; }
.lss-card-txt { display: flex; flex-direction: column; gap: 0.05rem; }
.lss-icon { display: inline-flex; align-items: center; color: #94a3b8; }
.lss-card--new    .lss-icon { color: #2563eb; }
.lss-card--active .lss-icon { color: #d97706; }
.lss-card--qual   .lss-icon { color: #059669; }
.lss-card--rej    .lss-icon { color: #dc2626; }
.lss-card--budget .lss-icon { color: #7c3aed; }
.lss-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}
.lss-num--new    { color: #2563eb; }
.lss-num--active { color: #d97706; }
.lss-num--qual   { color: #059669; }
.lss-num--rej    { color: #dc2626; }
.lss-num--budget { color: #7c3aed; }
.lss-lbl {
  font-size: 0.62rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.08rem;
}

/* ── r57: Reply templates ── */
.tpl-picker-wrap {
  position: relative;
}
.tpl-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 280px;
  background: var(--surface-2, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 400;
  overflow: hidden;
  display: none;
}
.tpl-picker.open { display: flex; flex-direction: column; }
.tpl-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem 0.4rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tpl-picker-head button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand, #6366f1);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
}
.tpl-picker-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.3rem 0;
}
.tpl-picker-item {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  transition: background 0.12s;
}
.tpl-picker-item:hover { background: rgba(99,102,241,0.12); }
.tpl-picker-item__name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #e2e8f0);
}
.tpl-picker-item__preview {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.tpl-picker-empty {
  padding: 0.7rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
  text-align: center;
}
.tpl-mgr-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
}
.tpl-mgr-item:last-child { border-bottom: none; }
.tpl-mgr-item__body { flex: 1; min-width: 0; }
.tpl-mgr-item__name { font-size: 0.8rem; font-weight: 600; color: var(--text, #e2e8f0); margin-bottom: 0.15rem; }
.tpl-mgr-item__text { font-size: 0.75rem; color: var(--text-secondary, #94a3b8); word-break: break-word; }
.tpl-mgr-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #ef4444;
  padding: 0.1rem 0.2rem;
  font-size: 0.9rem;
  flex-shrink: 0;
  border-radius: 4px;
  transition: background 0.12s;
}
.tpl-mgr-del:hover { background: rgba(239,68,68,0.12); }

/* ── r59: Lead score widget ── */
.lead-score-wrap {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
}
.lead-score-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lead-score-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.lead-score-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}
.lead-score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lead-score-input {
  width: 64px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 0.82rem;
  color: var(--text, #e2e8f0);
  text-align: center;
  outline: none;
}
.lead-score-input:focus { border-color: var(--brand, #6366f1); }
.lead-score-value {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 2.5ch;
}

/* ── r62: Analytics print ── */
@media print {
  .sidebar, .topbar, nav, .scene, .scene-actions, .period-pills,
  .btn-app, .an-export-btn { display: none !important; }
  .view { display: block !important; }
  body { background: #fff !important; color: #000 !important; }
  .kpi-card, .studio-card { border: 1px solid #ddd !important; background: #fff !important; box-shadow: none !important; }
  .kpi-value, .kpi-label { color: #000 !important; }
}

/* ── r55: Merge duplicates ── */
.merge-dup-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface-1, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
}
.merge-dup-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.merge-dup-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.merge-dup-meta {
  font-size: 0.75rem;
  color: #64748b;
}
.merge-dup-summary {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── r60: Email Integration ── */
.email-account-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-1, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
}
.email-account-main { flex: 1; min-width: 0; }
.email-account-name { font-weight: 600; font-size: 0.88rem; }
.email-ai-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(16,185,129,0.15);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
}

/* ── Квалия AI Widget ────────────────────────────────────────────────── */
.kvalia-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.kvalia-bubble {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, #2d57e8, #11b7a2);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 0.7rem 1.1rem 0.7rem 0.85rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(45,87,232,.38);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  transition: transform .2s, box-shadow .2s;
  animation: kvalia-pulse 3s ease-in-out infinite;
}
.kvalia-bubble:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 36px rgba(45,87,232,.48);
  animation: none;
}
.kvalia-bubble-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: rgba(255,255,255,.18);
  border-radius: 50%;
}
.kvalia-bubble-label { font-size: 0.9rem; }
@keyframes kvalia-pulse {
  0%,100% { box-shadow: 0 8px 28px rgba(45,87,232,.38); }
  50% { box-shadow: 0 8px 36px rgba(17,183,162,.55); }
}
.kvalia-panel {
  width: 360px;
  max-height: 520px;
  background: #fff;
  border: 1px solid rgba(216,229,251,.95);
  border-radius: 24px;
  box-shadow: 0 24px 56px rgba(18,35,63,.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: kvalia-slide-up .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes kvalia-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.kvalia-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #2d57e8 0%, #11b7a2 100%);
  color: #fff;
  flex-shrink: 0;
}
.kvalia-panel-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.kvalia-avatar {
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.kvalia-panel-title strong { display: block; font-size: 0.97rem; }
.kvalia-panel-title span { font-size: 0.75rem; opacity: .8; }
.kvalia-close-btn {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.kvalia-close-btn:hover { background: rgba(255,255,255,.3); }
.kvalia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.kvalia-msg { display: flex; flex-direction: column; }
.kvalia-msg--user { align-items: flex-end; }
.kvalia-msg--bot { align-items: flex-start; }
.kvalia-msg-bubble {
  max-width: 80%;
  padding: 0.65rem 0.9rem;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.55;
}
.kvalia-msg--user .kvalia-msg-bubble {
  background: linear-gradient(135deg, #2d57e8, #4c78f7);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.kvalia-msg--bot .kvalia-msg-bubble {
  background: #f2f6ff;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.kvalia-msg--bot.kvalia-msg--typing .kvalia-msg-bubble {
  color: var(--muted);
  font-style: italic;
}
.kvalia-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.kvalia-quick-btn {
  background: #fff;
  border: 1.5px solid rgba(45,87,232,.25);
  border-radius: 100px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s, border-color .18s;
}
.kvalia-quick-btn:hover {
  background: #f0f5ff;
  border-color: var(--brand);
}
.kvalia-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.kvalia-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.5rem 0.85rem;
  font-size: 0.86rem;
  font-family: inherit;
  background: #f8faff;
  outline: none;
  transition: border-color .2s;
}
.kvalia-input:focus { border-color: rgba(45,87,232,.45); }
.kvalia-send-btn, .kvalia-voice-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .2s;
}
.kvalia-send-btn {
  background: linear-gradient(135deg, #2d57e8, #11b7a2);
  color: #fff;
}
.kvalia-send-btn:hover { transform: scale(1.1); }
.kvalia-voice-btn {
  background: #f0f5ff;
  color: var(--brand);
}
.kvalia-voice-btn.recording {
  background: #fee2e2;
  color: #dc2626;
  animation: kvalia-pulse 1s ease-in-out infinite;
}

/* ── Admin API Keys Section ─────────────────────────────────────────── */
.admin-keys-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.75rem;
}
.admin-key-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8faff;
  border: 1px solid rgba(216,229,251,.95);
  border-radius: 14px;
}
.admin-key-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: default;
}
.admin-key-service-icon { font-size: 1.5rem; flex-shrink: 0; }
.admin-key-label strong { display: block; font-size: 0.88rem; font-weight: 700; }
.admin-key-label small { color: var(--muted); font-size: 0.76rem; }
.admin-key-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-key-input { flex: 1; font-family: monospace; font-size: 0.82rem; }
.admin-key-toggle { padding: 0.3rem 0.55rem; font-size: 0.85rem; flex-shrink: 0; }
.admin-key-status { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.admin-key-status.ok { color: #0a7f5c; }
.admin-key-status.err { color: #dc2626; }

/* ═══════════════════════════════════════════════════════════
   r70 — critical fixes & improvements
═══════════════════════════════════════════════════════════ */

/* ── Wizard panels: show only active ── */
.wizard-panel { display: none !important; }
.wizard-panel.active { display: block !important; }

/* ── Universal modal overlay (fixes all floating modals) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 10, 40, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-box {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(99,102,241,0.18), 0 4px 20px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem 0.9rem;
  border-bottom: 1px solid #f1f0f8;
  flex-shrink: 0;
}
.modal-head h3,
.modal-head span { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: #f4f3fc; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #64748b; transition: background 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: #ede9fe; color: var(--brand,#6366f1); }
.modal-body {
  padding: 1.1rem 1.4rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modal-foot {
  padding: 0.9rem 1.4rem;
  border-top: 1px solid #f1f0f8;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-shrink: 0;
}
.modal-box--wide { max-width: 640px !important; }
.modal-box--narrow { max-width: 380px !important; }

/* ── Niche cards: premium icon style ── */
.niche-card .niche-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
  color: #6366f1;
  margin: 0 auto 0.4rem;
  transition: transform 0.18s, background 0.18s, color 0.18s;
}
.niche-card .niche-emoji svg { width: 22px; height: 22px; }
.niche-card:hover .niche-emoji,
.niche-card.active .niche-emoji {
  transform: scale(1.12);
  background: linear-gradient(135deg, var(--brand,#6366f1) 0%, #818cf8 100%);
  color: #fff;
}
.niche-card {
  border-radius: 14px;
  border: 2px solid transparent;
  padding: 0.85rem 0.5rem;
  background: #fafaff;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}
.niche-card:hover { border-color: #c7d2fe; background: #fff; }
.niche-card.active {
  border-color: var(--brand,#6366f1);
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  box-shadow: 0 4px 16px rgba(99,102,241,0.18);
}
.niche-card span { display: block; font-weight: 600; font-size: 0.82rem; }
.niche-card small { color: var(--muted); font-size: 0.7rem; }

/* ── Wizard step 2: volume cards premium style ── */
.volume-card {
  position: relative;
  border-radius: 16px;
  border: 2px solid #e5e7eb;
  padding: 1.2rem 1rem;
  background: #fafaff;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}
.volume-card:hover { border-color: #c7d2fe; background: #fff; }
.volume-card.selected,
.volume-card.active {
  border-color: var(--brand,#6366f1);
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  box-shadow: 0 4px 20px rgba(99,102,241,0.2);
}
.volume-card-icon {
  width: 48px; height: 48px;
  margin: 0 auto 0.6rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  transition: all 0.18s;
}
.volume-card.selected .volume-card-icon,
.volume-card.active .volume-card-icon {
  background: linear-gradient(135deg, var(--brand,#6366f1) 0%, #818cf8 100%);
}
.volume-card-num { font-size: 1.7rem; font-weight: 800; color: var(--text); }
.volume-card-label { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.volume-card-price { font-size: 0.82rem; font-weight: 600; color: var(--brand,#6366f1); margin-top: 0.3rem; }
.volume-card--popular::before {
  content: 'Популярное';
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 0.67rem; font-weight: 700;
  padding: 2px 10px; border-radius: 8px;
  white-space: nowrap;
}

/* ── Wizard step 3: destination cards ── */
.dest-card2 {
  border-radius: 16px;
  border: 2px solid #e5e7eb;
  padding: 1rem;
  background: #fafaff;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  user-select: none;
}
.dest-card2:hover { border-color: #c7d2fe; background: #fff; }
.dest-card2.selected {
  border-color: var(--brand,#6366f1);
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  box-shadow: 0 4px 20px rgba(99,102,241,0.18);
}
.dest-card2-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #6366f1;
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
  transition: all 0.18s;
}
.dest-card2-icon svg { width: 22px; height: 22px; }
.dest-card2.selected .dest-card2-icon {
  background: linear-gradient(135deg, var(--brand,#6366f1) 0%, #818cf8 100%);
  color: #fff;
}
.dest-card2 span { font-weight: 600; font-size: 0.84rem; display: block; }
.dest-card2 small { color: var(--muted); font-size: 0.72rem; }
input[name="dest"] { display: none; }

/* ── Wizard: schedule section ── */
.wiz-schedule-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.wiz-days-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.35rem; }
.wiz-day-chip input { display: none; }
.wiz-day-chip span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  font-size: 0.78rem; font-weight: 600;
  background: #f1f5f9; color: #64748b;
  border: 2px solid transparent;
  cursor: pointer; transition: all 0.15s;
}
.wiz-day-chip input:checked + span { background: #ede9fe; color: #6366f1; border-color: #818cf8; }

/* ── Wizard: webhook hint ── */
.wiz-webhook-hint { margin-top: 0.75rem; }
.wiz-hint-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: #6366f1; background: none; border: none;
  cursor: pointer; padding: 0; font-weight: 500;
}
.wiz-hint-toggle svg { flex-shrink: 0; }
.wiz-hint-body {
  margin-top: 0.5rem;
  background: #f8fafc; border-radius: 10px; padding: 0.75rem 1rem;
  font-size: 0.78rem; color: #475569;
  border: 1px solid #e2e8f0;
}
.wiz-hint-body p { margin: 0.3rem 0; }
.wiz-hint-body code { background: #e2e8f0; padding: 0.1em 0.35em; border-radius: 4px; font-family: monospace; }

/* ── Квалли: attach button ── */
.kvalia-attach-btn {
  align-self: flex-end;
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(99,102,241,0.08);
  color: #6366f1;
  cursor: pointer;
  transition: background 0.15s;
}
.kvalia-attach-btn:hover { background: rgba(99,102,241,0.18); } */
.delay-row input[type="number"],
input.field-input[style*="width:62px"],
input.field-input[style*="width: 62px"] {
  padding: 0.45rem 0.4rem !important;
  text-align: center;
  font-size: 0.88rem;
}

/* ── Lead score section: russian styling ── */
.lead-score-wrap {
  background: linear-gradient(135deg, #fafaff 0%, #f0f0ff 100%);
  border: 1.5px solid #e0e7ff;
  border-radius: 14px;
  padding: 0.85rem 1rem;
}
.lead-score-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.lead-score-hd > span:first-child {
  font-weight: 700;
  font-size: 0.88rem;
}
.lead-score-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand,#6366f1);
  min-width: 2.5rem;
  text-align: right;
}
.lead-score-bar-wrap {
  height: 6px;
  background: #e0e7ff;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.lead-score-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s;
}
.lead-score-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lead-score-mode-btn {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  border: 1.5px solid #c7d2fe;
  background: #fff;
  color: var(--brand,#6366f1);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
}
.lead-score-mode-btn.auto { background: #eef2ff; border-color: var(--brand,#6366f1); }
.lead-score-mode-btn:hover { background: var(--brand,#6366f1); color: #fff; }

/* ── Kvalia: resizable panel + expand button ── */
.kvalia-panel {
  resize: both;
  min-width: 300px;
  min-height: 380px;
  max-width: min(600px, 96vw);
  max-height: 80vh;
  overflow: hidden;
}
.kvalia-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: color 0.15s, background 0.15s;
}
.kvalia-expand-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* ── Kvalia full-page view ── */
.view.active[data-view="kvalia"] {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.kvalia-full-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  padding: 1.2rem 1.5rem 0;
}
.kvalia-full-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}
.kvalia-full-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0 1.2rem;
  border-top: 1px solid #f1f0f8;
}
.kvalia-full-input-row textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid #e0e7ff;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.kvalia-full-input-row textarea:focus { border-color: var(--brand,#6366f1); }

/* ── Sidebar scrollbar ── */
.sidebar nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.3) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.3);
  border-radius: 4px;
}
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.6); }

/* ── Lead status badge: styled ── */
.lead-status-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #e0e7ff;
  border-radius: 20px;
  padding: 0.3rem 1.6rem 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lead-status-select:focus { outline: none; border-color: var(--brand,#6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.lead-status-select[data-status="new"] { background-color: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.lead-status-select[data-status="in_progress"] { background-color: #fefce8; color: #a16207; border-color: #fde68a; }
.lead-status-select[data-status="qualified"] { background-color: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.lead-status-select[data-status="rejected"] { background-color: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* ══ r73: Wizard fixes ══ */
.wizard-body { max-width: 1160px; margin: 0 auto; }

/* Dest cards: item wrapper (extra outside label) */
.dest-item { margin-bottom: 0.75rem; }
.dest-item:last-child { margin-bottom: 0; }
.dest-grid { display: flex; flex-direction: column; gap: 0; }
.dest-extra {
  margin-top: 0.5rem;
  padding: 0.9rem 1rem;
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-radius: 0 0 14px 14px;
  border-top: none;
}
.wiz-label-hint { font-weight: 400; text-transform: none; color: #94a3b8; font-size: 0.75rem; }

/* Multi-recipient rows */
.dest-recipients { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.dest-recipient-row { display: flex; gap: 0.5rem; align-items: center; }
.dest-recipient-row .field-input { flex: 1; }
.dest-recipient-del {
  width: 30px; height: 30px; flex-shrink: 0;
  border: none; background: #fee2e2; color: #ef4444;
  border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.dest-recipient-del:hover { background: #fca5a5; }
.dest-add-btn {
  margin-top: 0.5rem;
  background: none; border: 1px dashed #c7d2fe;
  color: #6366f1; border-radius: 8px;
  padding: 0.3rem 0.75rem; font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s;
}
.dest-add-btn:hover { background: #eef2ff; border-color: #818cf8; }

/* ══ Квалли AI full page ══ */
.kvalia-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f0f8;
  flex-shrink: 0; gap: 0.75rem;
}
.kvalia-header-left { display: flex; align-items: center; gap: 0.75rem; }
.kvalia-avatar {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(135deg,#6366f1,#8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff; font-weight: 800; flex-shrink: 0;
}
.kvalia-header-title { font-weight: 700; font-size: 1.05rem; }
.kvalia-header-sub { font-size: 0.78rem; color: var(--muted); }
.kvalia-header-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.kvalia-action-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: none; border: 1px solid #e5e7eb;
  color: #64748b; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.15s;
}
.kvalia-action-btn:hover, .kvalia-action-btn.active { background: #eef2ff; border-color: #c7d2fe; color: #6366f1; }

/* Info panel */
.kvalia-info-panel {
  padding: 1rem;
  background: linear-gradient(135deg,#fafbff,#f5f3ff);
  border-bottom: 1px solid #e0e7ff;
  flex-shrink: 0;
}
.kvalia-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem; margin-bottom: 0.75rem;
}
.kvalia-info-card {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: #fff; border-radius: 12px; padding: 0.65rem 0.75rem;
  border: 1px solid #e5e7eb;
}
.kvalia-info-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 10px; background: #eef2ff;
  display: flex; align-items: center; justify-content: center; color: #6366f1;
}
.kvalia-info-icon svg { width: 16px; height: 16px; }
.kvalia-info-card strong { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.2rem; }
.kvalia-info-card p { margin: 0; font-size: 0.75rem; color: #64748b; line-height: 1.4; }
.kvalia-info-examples { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.kvalia-example-chip {
  background: #fff; border: 1px solid #c7d2fe;
  border-radius: 99px; padding: 0.25rem 0.7rem;
  font-size: 0.78rem; color: #6366f1; cursor: pointer;
  transition: all 0.15s;
}
.kvalia-example-chip:hover { background: #eef2ff; border-color: #818cf8; }

/* Settings popup */
.kvalia-settings-popup {
  position: absolute; top: 60px; right: 1rem;
  width: 280px; z-index: 200;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(99,102,241,0.1);
  border: 1px solid #e0e7ff; overflow: hidden;
}
.kvalia-settings-inner { padding: 1rem; }
.kvalia-settings-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.75rem; }
.kvalia-settings-row { margin-bottom: 0.65rem; }
.kvalia-settings-label { display: block; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 0.3rem; }

/* Voice button */
.kvalia-voice-btn {
  width: 42px; height: 42px; flex-shrink: 0; align-self: flex-end;
  border-radius: 10px; border: none;
  background: #f1f5f9; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.kvalia-voice-btn:hover { background: #e0e7ff; color: #6366f1; }
.kvalia-voice-btn.recording { background: #fee2e2; color: #ef4444; animation: kvalia-pulse 1s infinite; }
@keyframes kvalia-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }

/* Send button (replaced btn-app with dedicated style) */
.kvalia-send-btn {
  width: 42px; height: 42px; flex-shrink: 0; align-self: flex-end;
  border-radius: 10px; border: none;
  background: linear-gradient(135deg,#6366f1,#8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.15s;
}
.kvalia-send-btn:hover { opacity: 0.88; }

/* ── Fix dest-card2 double-border (old CSS leaves inner border on dest-card2-inner) ── */
.dest-card2 { text-align: left; }
.dest-card2-inner {
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  transition: none !important;
}
.dest-card2:hover .dest-card2-inner,
.dest-card2 input:checked ~ .dest-card2-inner {
  border-color: transparent !important;
  background: transparent !important;
}
.dest-card2 input[type=checkbox] { display: none; }

/* ── API Keys section ── */
.api-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 0.45rem;
  background: #fafaff;
}
.api-key-row:last-child { margin-bottom: 0; }
.api-key-info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.api-key-name { font-weight: 600; font-size: 0.88rem; }
.api-key-prefix { font-family: monospace; font-size: 0.78rem; background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 6px; color: #475569; }
.api-key-date { font-size: 0.75rem; color: #94a3b8; }

/* ══════════════════════════════════════════════════════════════
   r85 — DARK THEME
══════════════════════════════════════════════════════════════ */
body.dark {
  --text: #dde6f0;
  --muted: #8a9cba;
  --line: #253450;
  --surface: #162032;
  --bg: #0d1826;
  --bg-mint: #0b1f1f;
  --bg-warm: #1c1610;
  --shadow: 0 16px 40px rgba(0,0,0,0.5);
  --shadow-soft: 0 10px 28px rgba(0,0,0,0.4);
  background: #0d1826 !important;
}
body.dark,
body.dark .app-main { color: var(--text); }
body.dark .sidebar {
  background: rgba(10,18,32,0.97);
  border-color: rgba(37,52,80,0.9);
}
body.dark .studio-card,
body.dark .studio-card--soft {
  background: var(--surface);
  border-color: var(--line);
}
body.dark .field-input,
body.dark .field-select,
body.dark select,
body.dark textarea {
  background: #0d1826;
  color: var(--text);
  border-color: var(--line);
}
body.dark .field-input::placeholder { color: var(--muted); }
body.dark .modal-box { background: #162032; border-color: var(--line); }
body.dark .modal-overlay { background: rgba(0,0,0,0.75); }
body.dark .sb-link { color: var(--muted); }
body.dark .sb-link:hover { background: rgba(45,87,232,0.15); color: var(--text); }
body.dark .sb-link.active { background: rgba(45,87,232,0.22); color: #fff; }
body.dark .sb-logo-name,
body.dark .sb-logo-sub,
body.dark .sb-user-name { color: var(--text); }
body.dark .sb-user-role { color: var(--muted); }
body.dark .sb-user { border-color: var(--line); }
body.dark .sb-user:hover { background: rgba(45,87,232,0.12); }
body.dark .sb-logout { color: var(--muted); }
body.dark .view-inner { background: transparent; }
body.dark .scene { background: transparent; }
body.dark .data-table thead th { background: rgba(255,255,255,0.04); color: var(--muted); }
body.dark .data-table tbody tr:hover { background: rgba(45,87,232,0.09); }
body.dark .data-table td,
body.dark .data-table th { border-color: var(--line); color: var(--text); }
body.dark .badge { border-color: transparent; }
body.dark .btn-app-ghost { color: var(--text); border-color: var(--line); }
body.dark .btn-app-ghost:hover { background: rgba(45,87,232,0.15); }
body.dark .section-chip { background: rgba(45,87,232,0.15); color: #7ba4ff; }
body.dark .section-chip--mint { background: rgba(17,183,162,0.15); color: #4dd8c8; }
body.dark .section-chip--purple { background: rgba(99,102,241,0.15); color: #a5b4fc; }
body.dark .section-chip--neutral { background: rgba(255,255,255,0.07); color: var(--muted); }
body.dark .toast { background: #1e3050; color: var(--text); }
body.dark code { background: rgba(255,255,255,0.06); color: #93c5fd; }
body.dark pre { background: #0d1826; border-color: var(--line); color: var(--text); }
body.dark .dev-toggle { color: var(--muted); }
body.dark .toggle-track { background: rgba(255,255,255,0.12); }
body.dark .sb-section { color: var(--muted); }
body.dark .kvalia-chat-wrap { background: var(--bg); }
body.dark .kvalia-msg.assistant { background: var(--surface); }
body.dark .kvalia-msg.user { background: rgba(45,87,232,0.25); }
body.dark .kvalia-input-bar { background: var(--surface); border-color: var(--line); }
body.dark .lead-card { background: var(--surface); border-color: var(--line); }

/* ── Dark theme toggle button ── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, color 0.18s;
  margin-bottom: 0.25rem;
}
.theme-toggle-btn:hover { background: rgba(45,87,232,0.08); color: var(--text); }
body.dark .theme-toggle-btn:hover { background: rgba(45,87,232,0.15); }

/* ══════════════════════════════════════════════════════════════
   r85 — ONBOARDING WIZARD
══════════════════════════════════════════════════════════════ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,14,26,0.8);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.onboarding-box {
  background: var(--surface);
  border-radius: 24px;
  padding: 2.5rem 2rem 2rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35);
  text-align: center;
  position: relative;
}
.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
}
.onb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.25s;
}
.onb-dot.active { background: var(--brand); }
.onb-dot.done { background: #10b981; }
.onb-line {
  width: 40px;
  height: 2px;
  background: var(--line);
}
.onb-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.onb-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.75rem;
}
.onb-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}
.onb-step { display: flex; flex-direction: column; align-items: center; }
.onb-next-btn { width: 100%; margin-top: 0; }
.onb-skip-btn {
  margin-top: 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 0;
}
.onb-skip-btn:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   r86 — DARK THEME: COMPREHENSIVE SECTION FIXES
══════════════════════════════════════════════════════════════ */

/* ── Topbar ── */
body.dark .topbar {
  background: rgba(10, 18, 32, 0.97) !important;
  border-bottom-color: var(--line);
}
body.dark .topbar-kicker { color: var(--muted); }
body.dark .topbar-title  { color: var(--text); }
body.dark .topbar-btn-icon { color: var(--muted); border-color: transparent; }
body.dark .topbar-btn-icon:hover { background: rgba(255,255,255,0.07); color: var(--text); }

/* ── KPI + all card containers ── */
body.dark .kpi-card,
body.dark .kpi-card--mint,
body.dark .kpi-card--warm,
body.dark .kpi-card--blue,
body.dark .workbench,
body.dark .table-wrap,
body.dark .dialog-column {
  background: var(--surface) !important;
  border-color: var(--line);
}

/* ── Studio card variants ── */
body.dark .studio-card--mint,
body.dark .studio-card--warm,
body.dark .studio-card--blue,
body.dark .studio-card--control,
body.dark .workbench--mint,
body.dark .workbench--warm,
body.dark .workbench--blue,
body.dark .workbench--success {
  background: var(--surface) !important;
  border-color: var(--line);
}

/* ── Table wrap soft ── */
body.dark .table-wrap--soft { background: var(--surface) !important; }

/* ── Revenue rows / dashboard items ── */
body.dark .revenue-row,
body.dark .lead-fact,
body.dark .agent-status-item,
body.dark .brief-card,
body.dark .db-stat {
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--line);
}
body.dark .mini-step {
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--line);
}
body.dark .mini-step span {
  background: rgba(45,87,232,0.2);
  color: #7ba4ff;
}
body.dark .mini-step.is-active span {
  background: var(--brand);
  color: #fff;
}

/* ── Channel cards ── */
body.dark .channel-card {
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--line);
}

/* ── Wizard header ── */
body.dark .wizard-header-bar {
  background: var(--surface) !important;
  border-color: var(--line);
}

/* ── Niche cards / volume buttons ── */
body.dark .niche-card,
body.dark .vol-btn,
body.dark .dest-inner {
  background: rgba(255,255,255,0.05) !important;
  border-color: var(--line);
  color: var(--text);
}
body.dark .niche-card:hover,
body.dark .vol-btn:hover,
body.dark .niche-card.selected,
body.dark .vol-btn.selected {
  background: rgba(45,87,232,0.15) !important;
  border-color: rgba(45,87,232,0.4);
}
body.dark .niche-hint-card {
  background: var(--surface) !important;
  border-color: var(--line);
}

/* ── Linked cards ── */
body.dark .linked-card,
body.dark .phone-link-card {
  background: rgba(255,255,255,0.04);
  border-color: var(--line);
}
body.dark .linked-card .auth-slot { background: rgba(255,255,255,0.04); }

/* ── Agent cards ── */
body.dark .agent-card {
  background: var(--surface) !important;
  border-color: var(--line);
}
body.dark .agent-type-btn {
  background: rgba(255,255,255,0.05) !important;
  border-color: var(--line);
  color: var(--muted);
}
body.dark .agent-type-btn.is-active,
body.dark .agent-type-btn:hover {
  background: rgba(45,87,232,0.2) !important;
  border-color: rgba(45,87,232,0.4);
  color: var(--text);
}

/* ── Chat bubbles ── */
body.dark .chat-bubble--ai {
  background: #1a2d42 !important;
  border-color: var(--line);
  color: var(--text);
}
body.dark .chat-bubble--client {
  background: linear-gradient(135deg, #0d2d24 0%, #0b2535 100%) !important;
  border-color: rgba(17,183,162,0.3);
  color: var(--text);
}
body.dark .chat-bubble--system {
  background: #2a1f0a !important;
  border-color: rgba(217,119,6,0.3);
  color: #d4a850;
}
body.dark .chat-bubble--operator {
  background: linear-gradient(135deg, #1a233a 0%, #182d36 100%) !important;
  border-color: rgba(99,102,241,0.25);
  color: var(--text);
}

/* ── Dialog feed cards ── */
body.dark .dialog-feed-card:hover {
  background: rgba(45,87,232,0.09) !important;
  border-color: rgba(45,87,232,0.2);
}
body.dark .dialog-feed-card.is-active {
  background: rgba(45,87,232,0.15) !important;
  border-color: rgba(45,87,232,0.35);
}
body.dark .feed-channel-badge {
  background: rgba(45,87,232,0.18) !important;
  color: #7ba4ff;
}

/* ── Dialog column borders ── */
body.dark .dialog-column--chat {
  border-left-color: var(--line);
  border-right-color: var(--line);
}

/* ── Leads stats strip ── */
body.dark .leads-stats-strip {
  background: var(--surface) !important;
  border-color: var(--line);
}
body.dark .lss-header:hover { background: rgba(255,255,255,0.04) !important; }
body.dark .leads-stats-strip:has(.lss-body:not(.lss-body--collapsed)) .lss-header {
  border-bottom-color: var(--line);
}
body.dark .lss-card { border-right-color: var(--line); }

/* ── Search input (leads, dialogs) ── */
body.dark .search-input {
  background: rgba(255,255,255,0.06) !important;
  border-color: var(--line);
  color: var(--text);
}
body.dark .search-input::placeholder { color: var(--muted); }

/* ── btn-app-ghost full fix ── */
body.dark .btn-app-ghost { background: rgba(255,255,255,0.06) !important; }

/* ── Tab buttons ── */
body.dark .tab-btn { color: var(--muted); border-color: var(--line); }
body.dark .tab-btn.active,
body.dark .tab-btn:hover { background: rgba(45,87,232,0.2); color: var(--text); }

/* ── Logs hover ── */
body.dark .logs-row:hover td { background: rgba(45,87,232,0.07) !important; }

/* ── Select dropdowns (stronger override) ── */
body.dark select,
body.dark .field-select { color-scheme: dark; }

/* ── Global scrollbar ── */
body.dark ::-webkit-scrollbar-thumb { background: #253450 !important; }
body.dark ::-webkit-scrollbar-track { background: transparent !important; }

/* ── Dialog scene bar text ── */
body.dark .dialog-scene-title { color: var(--text); }
body.dark .scene-eyebrow { color: var(--muted); }

/* ── Gift badge in topbar ── */
body.dark .gift-badge { background: rgba(45,87,232,0.2); color: #7ba4ff; border-color: rgba(45,87,232,0.3); }

/* ══════════════════════════════════════════════════════════════
   r87 — DARK THEME: Analytics channel health cards
══════════════════════════════════════════════════════════════ */
body.dark .ch-hkpi-card { background: rgba(255,255,255,0.05) !important; border-color: var(--line); }
body.dark .ch-hkpi-card--active  { background: rgba(22,163,74,0.12) !important; border-color: rgba(22,163,74,0.3); }
body.dark .ch-hkpi-card--warming { background: rgba(180,83,9,0.12) !important; border-color: rgba(180,83,9,0.3); }
body.dark .ch-hkpi-card--banned  { background: rgba(220,38,38,0.12) !important; border-color: rgba(220,38,38,0.3); }
body.dark .ch-health-type-row { background: rgba(255,255,255,0.04) !important; border-color: var(--line); }

/* ══════════════════════════════════════════════════════════════
   r88 — DARK THEME: sidebar user profile + channel cards
══════════════════════════════════════════════════════════════ */

/* Sidebar user profile — was white background when not hovered */
body.dark .sb-user {
  background: rgba(255,255,255,0.04) !important;
}
body.dark .sb-user:hover {
  background: rgba(45,87,232,0.14) !important;
}
body.dark .sb-bottom {
  border-top-color: var(--line);
}

/* Channel cards — connected state has hardcoded light green */
body.dark .channel-card.connected {
  background: rgba(17,183,162,0.1) !important;
  border-color: rgba(17,183,162,0.35) !important;
}
body.dark .channel-card-name { color: var(--text); }

/* Dev toggle in dark mode */
body.dark .toggle-track { background: var(--line); }

/* ══════════════════════════════════════════════════════════════
   r88 — DARK: channels stats strip hardcoded light backgrounds
══════════════════════════════════════════════════════════════ */
body.dark .ch-stat-card--ok    { background: rgba(34,197,94,0.1)  !important; }
body.dark .ch-stat-card--active { background: rgba(99,102,241,0.1) !important; }
body.dark .ch-stat-card--agents { background: rgba(14,165,233,0.1) !important; }

/* ══════════════════════════════════════════════════════════════
   r88c — Standalone channel badge (no agent assigned)
══════════════════════════════════════════════════════════════ */
.ch-no-agent-badge {
  display: inline-block;
  font-size: 0.74rem;
  color: var(--muted);
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 5px;
  padding: 1px 7px;
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════
   r88e — Table Editor Overlay
══════════════════════════════════════════════════════════════ */
.te-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg, #f4f6fb);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.te-container {
  max-width: 1200px; width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  box-sizing: border-box;
}
.te-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}
.te-title {
  flex: 1; font-size: 1.25rem; font-weight: 700; margin: 0;
}
.te-save-msg {
  font-size: 0.85rem; padding: 0.4rem 0.8rem;
  border-radius: 6px; margin-bottom: 0.75rem;
}
.te-save-msg--ok  { background: rgba(34,197,94,0.12); color: #16a34a; border: 1px solid rgba(34,197,94,0.3); }
.te-save-msg--err { background: rgba(239,68,68,0.12); color: #dc2626; border: 1px solid rgba(239,68,68,0.3); }

.te-top-row {
  display: flex; gap: 1rem; margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.te-top-name  { flex: 2; min-width: 200px; }
.te-top-sheet { flex: 1; min-width: 140px; }
.te-top-interval { flex: 1; min-width: 200px; }
.te-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }

/* Tabs */
.te-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--line, #e2e8f0);
  margin-bottom: 1.25rem; overflow-x: auto;
}
.te-tab {
  background: none; border: none; cursor: pointer;
  padding: 0.55rem 1.1rem; font-size: 0.9rem; font-weight: 500;
  color: var(--muted, #64748b); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s;
}
.te-tab:hover { color: var(--text, #1e293b); }
.te-tab.active { color: var(--brand, #4f46e5); border-bottom-color: var(--brand, #4f46e5); font-weight: 600; }

/* Panes */
.te-pane { display: none; }
.te-pane.active { display: block; }

/* Toggle rows */
.te-toggle-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0; cursor: pointer; font-size: 0.9rem;
}

/* Download buttons row */
.te-dl-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 1rem 0;
}

/* Refresh icon button */
.te-refresh-icon-btn {
  min-width: 36px; width: 36px; height: 36px; padding: 0;
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Columns grid */
.te-cols-wrap { overflow-x: auto; margin-top: 0.5rem; }
.te-cols-grid {
  display: flex; gap: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px 8px 0 0; overflow: hidden;
  min-width: max-content;
}
.te-col-card {
  display: flex; flex-direction: column; align-items: center;
  min-width: 100px; max-width: 160px; flex: 1;
  padding: 6px 8px; border-right: 1px solid var(--line, #e2e8f0);
  background: var(--bg2, #f8fafc);
}
.te-col-card:last-child { border-right: none; }
.te-col-menu { font-size: 0.95rem; color: var(--muted, #94a3b8); cursor: grab; margin-bottom: 4px; }
.te-col-check-wrap input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand, #4f46e5); }
.te-col-name {
  font-weight: 700; font-size: 0.82rem; text-align: center;
  margin-top: 4px; word-break: break-word;
}
.te-col-key {
  font-size: 0.72rem; color: var(--brand, #4f46e5);
  text-align: center; word-break: break-all; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Preview rows */
.te-preview-rows {
  border: 1px solid var(--line, #e2e8f0);
  border-top: none; border-radius: 0 0 8px 8px;
  overflow: hidden; min-width: max-content;
}
.te-preview-row {
  display: flex; border-bottom: 1px solid var(--line, #e2e8f0);
}
.te-preview-row:last-child { border-bottom: none; }
.te-preview-cell {
  min-width: 100px; max-width: 160px; flex: 1;
  padding: 6px 8px; font-size: 0.78rem;
  border-right: 1px solid var(--line, #e2e8f0);
  word-break: break-word;
}
.te-preview-cell:last-child { border-right: none; }
.te-preview-empty { padding: 12px; color: var(--muted); font-size: 0.82rem; text-align: center; }

/* Dark mode */
body.dark .te-overlay { background: var(--bg, #0d1826); }
body.dark .te-col-card { background: var(--surface, #162032); }
body.dark .te-cols-grid,
body.dark .te-preview-rows { border-color: var(--line); }
body.dark .te-col-card { border-color: var(--line); }
body.dark .te-preview-row { border-color: var(--line); }
body.dark .te-preview-cell { border-color: var(--line); }
body.dark .te-tabs { border-color: var(--line); }
body.dark .te-tab { color: var(--muted); }
body.dark .te-tab:hover { color: var(--text); }
body.dark .te-tab.active { color: #818cf8; border-bottom-color: #818cf8; }

/* ══════════════════════════════════════════════════════════════
   r88e — Dark Theme: Seasonal (May — Spring)
══════════════════════════════════════════════════════════════ */
body.dark {
  --brand: #34d399;
  --brand-dark: #059669;
  --brand-light: rgba(52,211,153,0.12);
  --brand-glow: rgba(52,211,153,0.25);
}
body.dark .btn-app-primary {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%) !important;
  box-shadow: 0 4px 18px rgba(52,211,153,0.28) !important;
}
body.dark .btn-app-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #10b981 100%) !important;
  box-shadow: 0 6px 24px rgba(52,211,153,0.38) !important;
}
body.dark .sb-link.active, body.dark .sb-link:hover {
  color: #34d399 !important;
  background: rgba(52,211,153,0.08) !important;
}
body.dark .section-chip {
  background: rgba(52,211,153,0.12);
  color: #34d399;
}
body.dark .te-tab.active { color: #34d399; border-bottom-color: #34d399; }
body.dark .agent-type-btn.active {
  background: rgba(52,211,153,0.15) !important;
  color: #34d399 !important;
  border-color: rgba(52,211,153,0.4) !important;
}
body.dark a { color: #34d399; }
body.dark .te-col-key { color: #34d399; }
body.dark .data-table thead th { background: rgba(52,211,153,0.1); }
body.dark input[type="checkbox"]:checked, body.dark input[type="radio"]:checked {
  accent-color: #34d399;
}
body.dark .toggle-slider {
  background: #1e3a35;
}
body.dark input[type="checkbox"]:checked + .toggle-slider,
body.dark .toggle-wrap input:checked ~ .toggle-slider {
  background: linear-gradient(90deg, #059669, #34d399) !important;
}

/* ── r88f: Пауза агента ───────────────────────────────── */
.agent-pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 8px;
  color: var(--text-secondary, #64748b);
  background: transparent;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.agent-pause-btn:hover {
  border-color: #f59e0b;
  color: #d97706;
  background: rgba(245,158,11,0.07);
}
.agent-pause-btn.agent-paused {
  border-color: #22c55e;
  color: #16a34a;
  background: rgba(34,197,94,0.08);
}
.agent-pause-btn.agent-paused:hover {
  background: rgba(34,197,94,0.15);
}
body.dark .agent-pause-btn { border-color: #334155; color: #94a3b8; }
body.dark .agent-pause-btn:hover { border-color: #f59e0b; color: #fbbf24; }
body.dark .agent-pause-btn.agent-paused { border-color: #34d399; color: #34d399; }

/* ── r88f: Тулбар инструкции ─────────────────────────── */
.instr-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  padding: 0.28rem 0.7rem;
  white-space: nowrap;
}

/* ── r88f: Дропдаун функций ──────────────────────────── */
.instr-fn-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 900;
  overflow: hidden;
}
.instr-fn-section {
  padding: 0.45rem 0.85rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary, #94a3b8);
}
.instr-fn-item {
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.83rem;
  transition: background .12s;
}
.instr-fn-item:hover { background: var(--bg2, #f8fafc); }
.instr-fn-empty { display: block; padding: 0.5rem 0.85rem; font-size: 0.8rem; color: #94a3b8; }
body.dark .instr-fn-dropdown { background: #1e293b; border-color: #334155; }
body.dark .instr-fn-item:hover { background: #273548; }

/* ── r88f: История инструкций ────────────────────────── */
.instr-history-item {
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  margin-bottom: 3px;
  transition: background .12s;
}
.instr-history-item:hover { background: var(--bg2, #f8fafc); }
.instr-history-item--active { background: rgba(var(--brand-rgb,99,102,241),0.1); }
body.dark .instr-history-item:hover { background: #273548; }
body.dark .instr-history-item--active { background: rgba(52,211,153,0.12); }
