body.dash { min-height: 100vh; }

.dash-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.dash-nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.dash-nav .brand-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.dash-nav .org-name { font-size: 13.5px; color: var(--muted); }
.dash-nav .user-box { display: flex; align-items: center; gap: 14px; }

/* --- Auth screen --- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
  position: relative;
}
.auth-card {
  width: 100%; max-width: 420px; padding: 36px 34px;
  background: linear-gradient(180deg, rgba(21,26,40,0.7), rgba(15,20,31,0.7));
}
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 26px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 26px; background: rgba(255,255,255,0.03); border-radius: 12px; padding: 4px; }
.auth-tab {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border: none; background: transparent; font-family: inherit;
}
.auth-tab.active { color: #fff; background: rgba(99,102,241,0.25); }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; color: var(--text-strong); letter-spacing: -0.02em; }
.auth-card .sub { font-size: 13.5px; color: var(--muted); margin: 0 0 24px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.auth-foot a { color: #A5B4FC; text-decoration: none; font-weight: 600; }

/* --- App shell --- */
.dash-main { max-width: 1100px; margin: 0 auto; padding: 36px 28px 80px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.dash-head h1 { font-size: 26px; margin: 0; color: var(--text-strong); letter-spacing: -0.02em; }
.dash-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.agent-card { padding: 20px; cursor: pointer; transition: border-color .15s ease; }
.agent-card:hover { border-color: var(--border-strong); }
.agent-card .top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.agent-avatar {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 15px; flex: 0 0 auto;
}
.agent-card .name { font-weight: 600; font-size: 15.5px; color: var(--text-strong); }
.agent-card .type { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.status-pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.status-pill.published { color: #34D399; background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35); }
.status-pill.draft { color: #FBBF24; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); }
.agent-card .slug { font-family: var(--mono); font-size: 12px; color: var(--dim); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state .big { font-size: 17px; color: var(--text); margin-bottom: 8px; }

/* --- Modal --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,7,12,0.6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  width: 100%; max-width: 460px; background: #11151F; border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 28px; box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}
.modal h2 { font-size: 19px; margin: 0 0 18px; color: var(--text-strong); }
.template-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.template-pick .opt {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px; cursor: pointer;
  background: rgba(255,255,255,0.02); font-size: 13px;
}
.template-pick .opt.active { border-color: var(--indigo); background: rgba(99,102,241,0.1); }
.template-pick .opt .n { font-weight: 600; color: var(--text-strong); display: block; margin-bottom: 3px; }
.template-pick .opt .d { color: var(--muted-2); font-size: 11.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* --- Agent detail --- */
.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13.5px; margin-bottom: 18px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.detail-head .left { display: flex; align-items: center; gap: 14px; }
.detail-head h1 { font-size: 24px; margin: 0; color: var(--text-strong); }
.detail-actions { display: flex; gap: 10px; }

.detail-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; align-items: start; }
.panel { padding: 24px; margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin: 0 0 16px; color: var(--text-strong); }
.quick-replies-input { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.qr-chip {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: rgba(255,255,255,0.04); color: var(--text);
}
.qr-chip button { background: none; border: none; color: var(--dim); cursor: pointer; padding: 0; font-size: 13px; line-height: 1; }
.color-picker-row { display: flex; align-items: center; gap: 10px; }
.color-picker-row input[type="color"] {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border-strong); background: none; padding: 2px; cursor: pointer;
}

.snippet-box {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong); background: #0C1018;
}
.snippet-titlebar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.snippet-body { padding: 16px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #C7D2FE; word-break: break-all; white-space: pre-wrap; }
.snippet-note { font-size: 12.5px; color: var(--dim); margin-top: 10px; line-height: 1.5; }

.domains-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.domain-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 9px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); font-size: 13px; }
.domain-row button { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 13px; }
.add-domain-row { display: flex; gap: 8px; }
.add-domain-row input { flex: 1; }

/* --- Tabs --- */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn {
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); background: none; border: none;
  padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text-strong); border-bottom-color: var(--indigo); }

/* --- Generic list rows (knowledge / QA / products / actions) --- */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border); margin-bottom: 8px;
}
.list-row .info { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: 13.5px; color: var(--text-strong); }
.list-row .meta { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.list-row .actions { display: flex; gap: 6px; flex: 0 0 auto; }
.list-row .actions button { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12.5px; padding: 4px 6px; }
.list-row .actions button:hover { color: var(--text); }
.tag-pill {
  display: inline-block; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; margin-right: 4px;
  background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.3); color: #C4B5FD;
}

.subform { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.subform-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.subform-tabs button {
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: rgba(255,255,255,0.02); color: var(--muted); cursor: pointer;
}
.subform-tabs button.active { color: #fff; background: rgba(99,102,241,0.25); border-color: transparent; }

/* --- Flow step editor --- */
.flow-step-card { border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: rgba(255,255,255,0.02); }
.flow-step-card .step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.flow-step-card .step-head input[type="text"] { flex: 0 0 140px; font-family: var(--mono); font-size: 12.5px; }
.flow-step-btn-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.flow-step-btn-row input { flex: 1; }
.flow-step-btn-row select { width: 140px; }
.flow-step-btn-row button { flex: 0 0 auto; }

/* --- Analytics --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { padding: 16px; text-align: center; }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.02em; }
.stat-card .label { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.unanswered-row { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 9px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); font-size: 13px; margin-bottom: 6px; }
.unanswered-row .count { color: var(--dim); font-size: 12px; flex: 0 0 auto; margin-left: 10px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .label { font-size: 13.5px; color: var(--text); }
.toggle-row .desc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: rgba(255,255,255,0.12); border-radius: 999px; cursor: pointer; transition: background .15s ease;
}
.switch .track::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--indigo); }
.switch input:checked + .track::before { transform: translateX(16px); }

/* --- Branding: 2-column live-preview layout --- */
.branding-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.branding-preview-col { position: sticky; top: 88px; }

.avatar-upload-row { display: flex; align-items: center; gap: 14px; }
.avatar-circle {
  width: 60px; height: 60px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 22px;
  border: 2px solid var(--border-strong);
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.pos-toggle { display: inline-flex; background: rgba(255,255,255,0.04); border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; }
.pos-toggle button {
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 8px;
  border: none; background: none; color: var(--muted); cursor: pointer;
}
.pos-toggle button.active { color: #fff; background: rgba(99,102,241,0.3); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; width: 100%; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; display: flex;
}

/* Accordion */
.accordion { border: 1px solid var(--border); border-radius: 12px; margin-top: 18px; overflow: hidden; }
.accordion-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer;
  background: rgba(255,255,255,0.02); user-select: none;
}
.accordion-head .t { font-size: 13.5px; font-weight: 600; color: var(--text); }
.accordion-head .chev { transition: transform .18s ease; color: var(--muted); }
.accordion.open .accordion-head .chev { transform: rotate(180deg); }
.accordion-body { display: none; padding: 16px; border-top: 1px solid var(--border); }
.accordion.open .accordion-body { display: block; }

/* Live preview mock browser + floating widget */
.mock-browser {
  border-radius: 14px; overflow: hidden; border: 1px solid var(--border-strong);
  background: #0E121C; box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.mock-chrome { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.mock-chrome .dot { width: 10px; height: 10px; border-radius: 50%; }
.mock-chrome .bar { margin-left: 10px; flex: 1; height: 20px; border-radius: 6px; background: rgba(255,255,255,0.05); }
.mock-stage { position: relative; height: 380px; padding: 20px; overflow: hidden; }
.mock-skel { height: 9px; border-radius: 5px; background: rgba(255,255,255,0.05); margin-bottom: 10px; }

.lp-widget {
  position: absolute; bottom: 78px; width: 240px; border-radius: 16px; overflow: hidden;
  background: #11151F; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.lp-widget.right { right: 18px; }
.lp-widget.left { left: 18px; }
.lp-head { padding: 11px 13px; display: flex; align-items: center; gap: 9px; }
.lp-head .av { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,0.22); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; overflow: hidden; flex: 0 0 auto; }
.lp-head .av img { width: 100%; height: 100%; object-fit: cover; }
.lp-head .nm { color: #fff; font-weight: 600; font-size: 12.5px; }
.lp-head .st { color: rgba(255,255,255,0.85); font-size: 10px; display: flex; align-items: center; gap: 3px; }
.status-dot { color: #10B981; animation: pulse-dot 2s ease-in-out infinite; font-size: 12px; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.lp-body { padding: 12px 13px; background: #0E121C; }
.lp-msg { max-width: 88%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.06); padding: 8px 11px; border-radius: 3px 12px 12px 12px; font-size: 12px; line-height: 1.4; color: #D8DBE3; }
.lp-input { display: flex; gap: 6px; margin-top: 12px; }
.lp-input .f { flex: 1; height: 30px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.lp-input .s { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; }
.lp-launcher { position: absolute; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(0,0,0,0.4); }
.lp-launcher.right { right: 18px; }
.lp-launcher.left { left: 18px; }

/* Flow step collapse */
.flow-step-card .step-head .step-collapse { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; transition: transform .18s ease; }
.flow-step-card.collapsed .step-collapse { transform: rotate(-90deg); }
.flow-step-card.collapsed .step-body { display: none; }
.flow-step-card .step-del { background: none; border: none; color: var(--dim); cursor: pointer; padding: 4px; }
.flow-step-card .step-del:hover { color: var(--red); }

.test-result { margin-top: 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); padding: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
.test-result.ok { border-color: rgba(16,185,129,0.35); }
.test-result.fail { border-color: rgba(239,68,68,0.35); }

/* --- Import progress --- */
.import-progress { padding: 24px; text-align: center; }
.import-progress-header { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 16px; }
.import-progress-bar-wrap { width: 100%; height: 22px; background: var(--surface2); border-radius: 11px; overflow: hidden; position: relative; }
.import-progress-bar { height: 100%; background: linear-gradient(90deg, #6366F1, #818CF8); border-radius: 11px; transition: width 0.5s ease; min-width: 0; }
.import-progress-text { margin-top: 10px; font-size: 13px; color: var(--text-secondary); }

/* ===== Аналитика (по дизайну Analytics.dc.html) ===== */
.an-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.an-card { background: #1A1D27; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 18px 12px; text-align: center; }
.an-card .num { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.an-card .lbl { font-size: 11px; color: #8B92A5; margin-top: 6px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 5px; }
.an-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.an-banner { margin-top: 16px; background: linear-gradient(120deg, rgba(53,221,161,0.10) 0%, rgba(53,221,161,0.02) 45%, rgba(26,29,39,0) 100%), #161C22; border: 1px solid rgba(53,221,161,0.28); border-radius: 14px; padding: 20px 22px; display: flex; align-items: center; gap: 18px; box-shadow: 0 8px 40px -12px rgba(53,221,161,0.25); }
.an-banner .ic { flex-shrink: 0; width: 50px; height: 50px; border-radius: 13px; background: rgba(53,221,161,0.12); border: 1px solid rgba(53,221,161,0.35); display: flex; align-items: center; justify-content: center; }
.an-banner .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #35DDA1; }
.an-banner .big { font-size: 18px; font-weight: 700; margin-top: 6px; line-height: 1.35; }
.an-banner .sub { font-size: 12.5px; color: #8B92A5; margin-top: 6px; }

.an-grid { margin-top: 16px; display: grid; gap: 16px; }
.an-grid.g64 { grid-template-columns: 60fr 40fr; }
.an-grid.g11 { grid-template-columns: 1fr 1fr; }
.an-panel { background: #1A1D27; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 22px; }
.an-panel h4 { font-size: 15px; font-weight: 600; margin: 0; }
.an-panel .desc { font-size: 12px; color: #8B92A5; margin-top: 4px; }

.an-funnel { margin-top: 20px; display: flex; flex-direction: column; gap: 15px; }
.an-frow .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.an-frow .top .name { font-size: 13px; color: #C9CFDB; }
.an-frow .top .name .pct { color: #8B92A5; }
.an-frow .top .val { font-size: 16px; font-weight: 700; }
.an-fbar { height: 14px; border-radius: 7px; background: #20232E; overflow: hidden; }
.an-fbar > div { height: 100%; border-radius: 7px; background: linear-gradient(90deg,#35DDA1,#2FC9B0); }

.an-triggers { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.an-triggers .t { font-size: 13px; font-weight: 600; color: #C9CFDB; }
.an-trow { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 13px; color: #8B92A5; }
.an-trow + .an-trow { border-top: 1px solid rgba(255,255,255,0.04); }
.an-trow .cnt { font-size: 14px; font-weight: 600; color: #fff; }

.an-donut-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 22px 0; }
.an-donut { position: relative; width: 172px; height: 172px; border-radius: 50%; }
.an-donut .hole { position: absolute; inset: 22px; border-radius: 50%; background: #1A1D27; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.an-donut .hole .p { font-size: 38px; font-weight: 800; letter-spacing: -1px; color: #35DDA1; }
.an-donut .hole .l { font-size: 11px; color: #8B92A5; margin-top: 2px; }
.an-legend { display: flex; flex-direction: column; gap: 10px; }
.an-legend .row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: #C9CFDB; }
.an-legend .row .k { display: flex; align-items: center; gap: 8px; }
.an-legend .sq { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.an-topics { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.an-tbar { height: 10px; border-radius: 5px; background: #20232E; overflow: hidden; }
.an-tbar > div { height: 100%; border-radius: 5px; background: #4F80FF; }
.an-empty { font-size: 12.5px; color: #8B92A5; margin-top: 16px; }

.an-prod { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.an-prow { display: flex; align-items: center; gap: 14px; }
.an-prow .thumb { flex-shrink: 0; width: 44px; height: 44px; border-radius: 9px; background-image: repeating-linear-gradient(45deg,#22273180 0 6px,#2A303C80 6px 12px); background-color: #20232E; border: 1px solid rgba(255,255,255,0.06); }
.an-prow .info { flex: 1; min-width: 0; }
.an-prow .info .nm { font-size: 13.5px; font-weight: 500; }
.an-prow .info .cnt { font-size: 12px; color: #8B92A5; margin-top: 2px; }
.an-prow .rank { flex-shrink: 0; font-size: 11px; font-weight: 700; color: #8B92A5; background: #20232E; border-radius: 6px; padding: 4px 8px; }

.an-unans-row { display: flex; justify-content: space-between; align-items: center; background: #161A22; border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; gap: 10px; }
.an-unans-row .q { font-size: 13px; color: #C9CFDB; flex: 1; min-width: 0; }
.an-unans-row button { flex-shrink: 0; font-family: inherit; font-size: 11.5px; font-weight: 600; color: #35DDA1; background: rgba(53,221,161,0.12); border: 1px solid rgba(53,221,161,0.3); border-radius: 6px; padding: 5px 10px; cursor: pointer; }

/* Лиды */
.leads-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leads-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.leads-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.leads-table tr:hover td { background: rgba(255,255,255,0.02); }
.leads-table .read-btn { font-family: inherit; font-size: 12px; color: #A5B4FC; background: none; border: 1px solid var(--border-strong); border-radius: 7px; padding: 4px 10px; cursor: pointer; }

.conv-modal { width: 100%; max-width: 520px; max-height: 80vh; display: flex; flex-direction: column; }
.conv-messages { overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 8px; }
.conv-msg { max-width: 85%; padding: 9px 12px; border-radius: 4px 12px 12px 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.conv-msg.user { align-self: flex-end; background: var(--indigo); color: #fff; border-radius: 12px 4px 12px 12px; }
.conv-msg.assistant { align-self: flex-start; background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text); }

@media (max-width: 800px) {
  .an-cards { grid-template-columns: repeat(3, 1fr); }
  .an-grid.g64, .an-grid.g11 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .branding-layout { grid-template-columns: 1fr; }
  .branding-preview-col { position: static; }
}
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
  .template-pick { grid-template-columns: 1fr; }
}

/* ===================== Knowledge Base tab (redesign per mockup) ===================== */
.kb { max-width: 1000px; margin: 0 auto; }
.kb-head { margin-bottom: 28px; }
.kb-head h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; color: #E8EAF0; }
.kb-head p { font-size: 15px; color: #8A8FA3; margin: 0; }

.kb-card { background: #1A1D27; border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 22px 24px; margin-bottom: 20px; }
.kb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.kb-card-head-wrap { flex-wrap: wrap; align-items: flex-start; }
.kb-card-title { font-size: 16px; font-weight: 600; color: #E8EAF0; }
.kb-card-sub { font-size: 13px; color: #8A8FA3; margin-top: 3px; }
.kb-count { color: #8A8FA3; font-weight: 400; font-size: 13px; }
.kb-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.kb-btn { display: inline-flex; align-items: center; gap: 7px; background: #3DE0A0; color: #06231A; border: none; padding: 10px 15px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; transition: filter .12s ease; }
.kb-btn:hover { filter: brightness(1.06); }
.kb-btn svg { display: block; }
.kb-btn-grow { flex: 1; justify-content: center; padding: 12px; font-size: 14px; }
.kb-btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #C7CBDA; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.kb-btn-ghost:hover { background: rgba(255,255,255,0.05); }
.kb-btn-outline { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: #E8EAF0; padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.kb-btn-outline:hover { background: rgba(255,255,255,0.1); }
.kb-mt { margin-top: 6px; }

.kb-list { display: flex; flex-direction: column; gap: 8px; }
.kb-empty { font-size: 13px; color: #565B6E; padding: 6px 2px; }

.kb-row { display: flex; align-items: center; gap: 14px; padding: 13px 15px; background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 11px; }
.kb-row-ic { width: 36px; height: 36px; border-radius: 9px; background: rgba(124,92,255,0.12); color: #9B85FF; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kb-row-main { flex: 1; min-width: 0; }
.kb-row-title { font-size: 14px; font-weight: 500; color: #E8EAF0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-row-sub { font-size: 12px; color: #8A8FA3; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-dot { width: 6px; height: 6px; border-radius: 50%; background: #3DE0A0; display: inline-block; flex-shrink: 0; }
.kb-tag { background: rgba(255,255,255,0.06); color: #A7ACC0; font-size: 11px; padding: 1px 7px; border-radius: 6px; }

.kb-icon-btn { background: transparent; border: none; color: #565B6E; cursor: pointer; padding: 6px; border-radius: 7px; display: flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0; }
.kb-icon-btn:hover { color: #9B85FF; background: rgba(255,255,255,0.05); }
.kb-icon-danger:hover { color: #C7415A; background: rgba(199,65,90,0.1); }

/* Q&A */
.kb-qa-list { gap: 7px; }
.kb-qa { background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 11px; overflow: hidden; }
.kb-qa-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.kb-qa-q { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.kb-qa-chev { color: #8A8FA3; display: flex; transition: transform .2s ease; flex-shrink: 0; }
.kb-qa.open .kb-qa-chev { transform: rotate(90deg); }
.kb-qa-qtext { font-size: 14px; font-weight: 600; color: #E8EAF0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-qa-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.kb-qa-body { padding: 0 16px 16px 42px; }
.kb-qa-answer { background: #0C0E15; border: 1px solid rgba(255,255,255,0.04); border-radius: 9px; padding: 13px 15px; font-size: 13px; color: #A7ACC0; line-height: 1.6; white-space: pre-wrap; }

/* Segmented tabs */
.kb-seg { display: inline-flex; gap: 3px; background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 9px; padding: 3px; }
.kb-seg-full { display: flex; margin-bottom: 20px; }
.kb-seg-full .kb-seg-item { flex: 1; text-align: center; }
.kb-seg-item { padding: 6px 12px; font-size: 12.5px; font-weight: 500; border-radius: 7px; cursor: pointer; color: #8A8FA3; transition: color .12s ease, background .12s ease; }
.kb-seg-item.active { color: #E8EAF0; background: rgba(255,255,255,0.07); }

/* Catalog table */
.kb-cat-head { display: grid; grid-template-columns: 1fr 130px 70px; gap: 12px; padding: 0 15px 10px; font-size: 11px; color: #565B6E; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kb-cat-head .tc { text-align: center; }
.kb-prod-row { display: grid; grid-template-columns: 1fr 130px 70px; gap: 12px; align-items: center; padding: 13px 15px; background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 11px; }
.kb-prod-name { font-size: 14px; font-weight: 500; color: #E8EAF0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kb-prod-price { font-size: 14px; font-weight: 600; color: #3DE0A0; }
.kb-prod-actions { display: flex; justify-content: center; gap: 4px; }
.kb-prod-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }
.kb-prod-more { font-size: 12px; color: #565B6E; }
.kb-btn-danger-ghost { color: #C7415A; border-color: rgba(199,65,90,0.3); padding: 8px 14px; font-size: 12.5px; }
.kb-btn-danger-ghost:hover { background: rgba(199,65,90,0.1); }

/* Drop zone */
.kb-drop { border: 1.5px dashed rgba(255,255,255,0.1); border-radius: 12px; padding: 40px; text-align: center; background: #12141D; transition: border-color .15s ease, background .15s ease; }
.kb-drop.drag { border-color: rgba(61,224,160,0.5); background: rgba(61,224,160,0.05); }
.kb-drop-ic { width: 48px; height: 48px; border-radius: 12px; background: rgba(61,224,160,0.1); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: #3DE0A0; }
.kb-drop-title { font-size: 15px; font-weight: 600; color: #E8EAF0; margin-bottom: 5px; }
.kb-drop-sub { font-size: 13px; color: #8A8FA3; margin-bottom: 16px; }

/* API import box */
.kb-api-box { background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; padding: 20px 22px; }

/* Import progress */
.kb-progress { margin-top: 16px; background: #12141D; border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; padding: 16px 18px; }
.kb-progress-head { font-size: 13px; font-weight: 600; color: #E8EAF0; margin-bottom: 10px; }
.kb-progress-track { height: 8px; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; }
.kb-progress-bar { height: 100%; background: #3DE0A0; border-radius: 6px; transition: width .3s ease; }
.kb-progress-text { font-size: 12px; color: #8A8FA3; margin-top: 8px; }

/* Drawer form fields */
.kb-label { font-size: 13px; color: #A7ACC0; font-weight: 500; display: block; margin: 18px 0 8px; }
.kb-label-first { margin-top: 0; }
.kb-input { width: 100%; background: #0C0E15; border: 1px solid rgba(255,255,255,0.08); border-radius: 9px; padding: 12px 14px; font-size: 14px; color: #E8EAF0; font-family: inherit; box-sizing: border-box; }
.kb-input:focus { outline: none; border-color: rgba(61,224,160,0.5); }
.kb-textarea { resize: vertical; line-height: 1.5; min-height: 90px; }
.kb-file { width: 100%; color: #A7ACC0; font-size: 13px; }
.kb-toggle-row { display: flex; align-items: center; justify-content: space-between; background: #0C0E15; border: 1px solid rgba(255,255,255,0.08); border-radius: 9px; padding: 12px 14px; }
.kb-toggle-row span { font-size: 13.5px; color: #C7CBDA; }
.kb-switch { width: 38px; height: 22px; border-radius: 12px; background: rgba(255,255,255,0.12); position: relative; border: none; cursor: pointer; padding: 0; transition: background .15s ease; flex-shrink: 0; }
.kb-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.kb-switch.on { background: rgba(61,224,160,0.3); }
.kb-switch.on::after { left: 19px; background: #3DE0A0; }

/* Drawer shell */
.kb-drawer { position: fixed; inset: 0; z-index: 60; }
.kb-drawer-overlay { position: absolute; inset: 0; background: rgba(6,8,14,0.6); backdrop-filter: blur(2px); animation: kbFade .2s ease; }
.kb-drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw; background: #14161F; border-left: 1px solid rgba(255,255,255,0.07); box-shadow: -20px 0 60px rgba(0,0,0,0.4); display: flex; flex-direction: column; animation: kbDrawerIn .28s cubic-bezier(0.16,1,0.3,1); }
.kb-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.kb-drawer-title { font-size: 17px; font-weight: 700; color: #E8EAF0; }
.kb-drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.kb-drawer-foot { padding: 18px 24px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; gap: 10px; }
@keyframes kbDrawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes kbFade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 720px) {
  .kb-card-head { flex-direction: column; align-items: stretch; }
  .kb-head-right { justify-content: space-between; }
}
