:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-muted: #f5f8fb;
  --line: #d8e1ea;
  --text: #12202f;
  --muted: #718094;
  --blue: #2aabee;
  --blue-dark: #168acd;
  --green: #40b76a;
  --vk: #4c75a3;
  --max: #7961ff;
  --web: #f49b32;
  --shadow: 0 18px 55px rgba(30, 45, 70, 0.14);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(42, 171, 238, 0.12), transparent 34rem),
    linear-gradient(135deg, #e7f0f6, #f8fbfd 50%, #e9f3ef);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 5fr);
  height: 100vh;
  max-height: 100vh;
  padding: 18px;
  gap: 14px;
}

.mobile-view-tabs,
.mobile-dialogs-back {
  display: none;
}

.sidebar,
.chat-panel,
.leads-panel {
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 225, 234, 0.9);
  box-shadow: var(--shadow);
}

.sidebar,
.leads-panel {
  border-radius: 8px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 8px;
  background:
    linear-gradient(rgba(236, 244, 248, 0.82), rgba(236, 244, 248, 0.82)),
    repeating-linear-gradient(45deg, rgba(42, 171, 238, 0.09) 0 2px, transparent 2px 18px);
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.leads-panel {
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
}

.lead-panel-view,
.lead-card-view {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.lead-panel-view {
  display: flex;
  flex-direction: column;
}

.sidebar-header,
.leads-header,
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.sidebar-header {
  justify-content: space-between;
}

.leads-header {
  display: block;
}

.lead-filters {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.lead-filter-tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  white-space: nowrap;
}

.lead-filter-tabs::-webkit-scrollbar {
  height: 4px;
}

.lead-filter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-muted);
}

.lead-filter[hidden] {
  display: none;
}

.lead-filter-settings-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #ffffff;
}

.lead-filter-settings-button:hover,
.lead-filter-settings-button[aria-expanded="true"] {
  color: var(--blue-dark);
  border-color: #9bcdf0;
  background: #eef8ff;
}

.lead-filter-settings-panel {
  position: absolute;
  z-index: 12;
  top: calc(100% - 4px);
  right: 12px;
  width: min(260px, calc(100% - 24px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(20, 38, 58, 0.18);
}

.lead-filter-settings-panel[hidden] {
  display: none;
}

.lead-filter-settings-panel > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

#leadFilterSettingsOptions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

#leadFilterSettingsOptions label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #405168;
  font-size: 12px;
  font-weight: 700;
}

#leadFilterSettingsOptions input {
  accent-color: var(--blue);
}

.lead-filter:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.lead-filter span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-filter strong {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--text);
  font-size: 11px;
  text-align: center;
  background: #ffffff;
}

.lead-filter.active {
  color: var(--blue-dark);
  background: #e3f4fd;
}

.lead-filter.status-new.active {
  color: #256b93;
  background: #e4f3fb;
}

.lead-filter.status-work.active {
  color: #5f4b9a;
  background: #ece8ff;
}

.lead-filter.status-unassigned.active {
  color: #6f4a12;
  background: #fff1d6;
}

.lead-filter.response-needed.active {
  color: #9a4b17;
  background: #ffead7;
}

.lead-filter.response-answered.active {
  color: #32775a;
  background: #e1f5ea;
}

.lead-filter.sla-overdue.active {
  color: #9f2f2f;
  background: #ffe1df;
}

.lead-filter.sla-warning.active {
  color: #8a5c0a;
  background: #fff4c7;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
}

.icon-button,
.icon-link,
.send-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #314256;
  background: var(--panel-muted);
  text-decoration: none;
}

.icon-button:hover,
.icon-link:hover,
.send-button:hover {
  background: #e6eef5;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 14px;
  padding: 0 12px;
  height: 42px;
  color: var(--muted);
  background: #edf3f8;
  border-radius: 999px;
}

.search-box input,
.composer input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: transparent;
}

.tab.active {
  color: var(--blue-dark);
  background: #e3f4fd;
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: #506172;
  font-size: 11px;
  font-weight: 900;
  background: #edf2f7;
}

.tab.active .tab-count {
  color: #ffffff;
  background: var(--blue);
}

.conversation-list {
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 10px;
}

.lead-queue {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.lead-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  min-height: 100%;
}

.lead-column {
  min-width: 0;
  min-height: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(245, 248, 251, 0.78);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.lead-column.drag-over {
  border-color: var(--blue);
  background: #e9f6fd;
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.12);
}

.lead-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.lead-column-header h3 {
  margin: 0;
  font-size: 14px;
}

.lead-column-header strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--blue-dark);
  font-size: 12px;
  background: #dff2fc;
}

.lead-column-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.lead-column-empty {
  margin: 0;
  padding: 26px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.lead-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  background: var(--panel-muted);
}

.lead-card:hover,
.lead-card.active {
  border-color: rgba(42, 171, 238, 0.45);
  background: #e9f6fd;
}

.lead-card.is-new,
.lead-card.is-new:hover,
.lead-card.is-new.active {
  border-color: #86d4a2;
  background: #eafaf0;
  box-shadow: inset 4px 0 0 #28a745;
}

.lead-card.is-dragging {
  opacity: 0.45;
}

.lead-card-top,
.lead-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lead-card-top {
  justify-content: space-between;
}

.lead-card-top strong,
.lead-card-phone,
.lead-card-assignee {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-card-top time,
.lead-card-meta,
.lead-card-assignee {
  color: var(--muted);
  font-size: 12px;
}

.lead-card-phone {
  font-size: 13px;
  font-weight: 800;
}

.conversation {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  text-align: left;
  color: inherit;
  background: transparent;
}

.conversation:hover {
  background: #f1f6fa;
}

.conversation.active {
  color: #ffffff;
  background: var(--blue);
}

.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  background: linear-gradient(145deg, #3fb7f1, #2784c6);
}

.avatar.has-photo {
  background: #dbe8f1;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.compact {
  width: 46px;
  height: 46px;
}

.conversation-body,
.conversation-top,
.conversation-preview {
  min-width: 0;
}

.conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.conversation-top strong,
.conversation-preview span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.conversation.active .conversation-preview,
.conversation.active time {
  color: rgba(255, 255, 255, 0.82);
}

.channel-pill {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.channel-pill.vk {
  background: var(--vk);
}

.channel-pill.max,
.channel-pill.max-personal {
  background: var(--max);
}

.channel-pill.telegram,
.channel-pill.telegram-personal {
  background: #229ed9;
}

.channel-pill.web {
  background: var(--web);
}

.kind-pill {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.kind-pill.dialog {
  color: #5c6675;
  background: #e8edf3;
}

.kind-pill.lead {
  color: #1f6b3a;
  background: #dff4e6;
}

.response-pill,
.sla-pill {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.response-pill.needs-response {
  color: #8a3d0a;
  background: #fff0d8;
}

.response-pill.answered {
  color: #4b6477;
  background: #e8eff4;
}

.sla-pill.ok {
  color: #24673b;
  background: #dff4e6;
}

.sla-pill.warning {
  color: #8a5c0a;
  background: #fff4c7;
}

.sla-pill.overdue {
  color: #9f2f2f;
  background: #ffe1df;
}

.sla-pill.answered {
  color: #4b6477;
  background: #e8eff4;
}

.conversation.active .kind-pill.dialog,
.conversation.active .kind-pill.lead,
.conversation.active .response-pill,
.conversation.active .sla-pill {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
}

.inbox-source {
  flex: 0 0 auto;
  max-width: 118px;
  overflow: hidden;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #465364;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f4f7fb;
}

.inbox-source.marquiz {
  color: #8a245d;
  border-color: #f3c1dc;
  background: #fff0f7;
}

.inbox-source.leadform {
  color: #216e58;
  border-color: #bfe8d9;
  background: #effaf5;
}

.inbox-source.multi {
  color: #27364a;
  border-color: #bed0ec;
  background: #eef4ff;
}

.conversation.active .inbox-source {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.16);
}

.unread {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  background: var(--green);
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.chat-title p {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.create-lead-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #1597d4;
  border-radius: 10px;
  color: #ffffff;
  background: #24a7e5;
  font-weight: 800;
  cursor: pointer;
}

.create-lead-button:hover:not(:disabled) {
  background: #138fca;
}

.create-lead-button:disabled {
  color: #6f8298;
  border-color: var(--line);
  background: #edf3f8;
  cursor: default;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.message-date-separator {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 12px;
  margin: 8px 0;
  color: #718096;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.message-date-separator::before,
.message-date-separator::after {
  flex: 1;
  height: 1px;
  background: rgba(113, 128, 150, 0.25);
  content: '';
}

.message-date-separator span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 4px rgba(20, 38, 58, 0.06);
}

.message {
  align-self: flex-start;
  max-width: min(620px, 74%);
  padding: 10px 12px 7px;
  border-radius: 8px 8px 8px 2px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(20, 38, 58, 0.08);
}

.message.mine {
  align-self: flex-end;
  border-radius: 8px 8px 2px 8px;
  background: #d9fdd3;
}

.message p {
  line-height: 1.42;
  white-space: pre-line;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.message-attachment {
  overflow: hidden;
  border-radius: 8px;
  color: inherit;
}

.message-attachment.media {
  display: grid;
  gap: 5px;
}

.message-attachment img,
.message-attachment video {
  display: block;
  width: min(420px, 100%);
  max-height: 360px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.06);
}

.message-attachment.document {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid rgba(100, 120, 140, 0.2);
  background: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}

.message-attachment.document > span:first-child {
  font-size: 24px;
}

.message-attachment.document strong,
.message-attachment.document small {
  display: block;
  overflow: hidden;
  max-width: 280px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment.document small {
  margin-top: 2px;
  color: var(--muted);
}

.message-source {
  display: inline-grid;
  place-items: center;
  min-height: 20px;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.delivery-status {
  display: block;
  margin-top: 6px;
  color: #4f6d57;
  font-size: 11px;
  font-weight: 800;
}

.delivery-status.failed {
  color: #a34242;
}

.delivery-status.queued {
  color: #7a6541;
}

.delivery-status.sending {
  color: #246d9b;
}

.message-source.site {
  background: var(--web);
}

.message-source.marquiz {
  background: #e04f9f;
}

.message-source.leadform {
  background: #2d9c7c;
}

.message-source.multi {
  color: #27364a;
  border: 1px solid var(--line);
  background: #eef4ff;
}

.message time {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(30, 45, 70, 0.1);
}

.ai-composer-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 12px;
  align-items: center;
  overflow-x: auto;
  min-height: 16px;
  padding: 0 8px;
}

.ai-composer-actions button,
.ai-insert-button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #0878bd;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  background: transparent;
}

.ai-composer-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ai-composer-actions button:hover,
.ai-composer-actions button:focus-visible {
  text-decoration: underline;
}

.ai-composer-panel {
  display: grid;
  gap: 8px;
  margin: 0 14px 10px;
  padding: 12px 14px;
  border: 1px solid #b9dcf3;
  border-radius: 12px;
  background: linear-gradient(145deg, #eff9ff, #ffffff);
  box-shadow: 0 8px 24px rgba(30, 101, 146, 0.12);
}

.ai-composer-panel[hidden] {
  display: none;
}

.ai-composer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #0878bd;
}

.ai-composer-heading button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #eef3f8;
}

.ai-composer-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.ai-composer-panel small {
  color: var(--muted);
  line-height: 1.35;
}

.ai-insert-button {
  justify-self: start;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #b9dcf3;
  border-radius: 999px;
  font-size: 11px;
  background: #eff9ff;
}

.visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.attachment-preview {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.attachment-preview[hidden] {
  display: none;
}

.attachment-chip {
  display: grid;
  grid-template-columns: 38px minmax(90px, 160px) auto;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-muted);
}

.attachment-chip img,
.attachment-file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: #ffffff;
}

.attachment-chip strong,
.attachment-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip strong {
  font-size: 12px;
}

.attachment-chip small,
.attachment-hint,
.attachment-status {
  color: var(--muted);
  font-size: 10px;
}

.attachment-chip button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #ffffff;
}

.attachment-status,
.attachment-hint {
  align-self: center;
  flex: 0 0 auto;
  margin: 0;
}

.attachment-status.error {
  color: #a34242;
  font-weight: 700;
}

.send-button {
  color: #ffffff;
  background: var(--blue);
}

.send-button:hover {
  background: var(--blue-dark);
}

.crm-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.status-strip div,
.crm-section,
.ai-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.status-strip div {
  padding: 12px;
}

.status-strip span,
dt {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.status-strip strong,
.status-select,
dd {
  font-size: 14px;
}

.status-select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  font-weight: 800;
  background: transparent;
}

.crm-section,
.ai-card {
  margin-top: 14px;
  padding: 14px;
}

.contact-edit-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.contact-edit-form label {
  display: grid;
  gap: 5px;
}

.contact-edit-form label span {
  color: var(--muted);
  font-size: 12px;
}

.contact-edit-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  font: inherit;
  background: #ffffff;
}

.contact-edit-form input:focus {
  border-color: rgba(42, 171, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.1);
}

dl {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
}

dd {
  margin: 0;
  font-weight: 700;
}

.ai-card {
  background: linear-gradient(145deg, #f0f7ff, #ffffff);
}

.ai-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-card-title span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
}

.ai-card p {
  color: #3c4d62;
  line-height: 1.45;
}

.secondary-button {
  width: 100%;
  height: 38px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  background: var(--blue);
}

.ghost-button {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-dark);
  font-weight: 800;
  background: #ffffff;
}

.ghost-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  color: #7d8794;
  border-color: var(--line);
  background: #eef2f6;
}

.knowledge-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.knowledge-block h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

#knowledgeList {
  display: grid;
  gap: 8px;
}

.knowledge-item,
.lead-comment,
.activity-item,
.empty-state {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.knowledge-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.knowledge-item p {
  color: #526175;
  font-size: 12px;
  line-height: 1.35;
}

.comment-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment-form textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  color: var(--text);
  background: #ffffff;
}

.lead-comments,
.lead-activity {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.lead-comment p,
.activity-item p {
  color: #3c4d62;
  font-size: 13px;
  line-height: 1.35;
}

.lead-comment span,
.activity-item span,
.empty-state {
  color: var(--muted);
  font-size: 12px;
}

.activity-item {
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  align-items: start;
}

.activity-meta {
  display: grid;
  gap: 3px;
}

.activity-meta time,
.activity-meta small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.activity-meta small {
  font-weight: 700;
}

.activity-item p {
  margin: 0;
}

.lead-card-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

.lead-modal-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  background: var(--blue);
}

.dialog-button:hover {
  background: var(--blue-dark);
}

.lead-back-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
  background: #ffffff;
}

.lead-back-button:hover {
  color: var(--blue-dark);
  border-color: var(--blue);
  background: #eef8fe;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 5fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    gap: 0;
  }

  .mobile-view-tabs {
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 5px 18px rgba(30, 45, 70, 0.08);
  }

  .mobile-view-tabs button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    background: var(--panel-muted);
  }

  .mobile-view-tabs button.active {
    color: #ffffff;
    background: var(--blue);
  }

  .sidebar,
  .leads-panel {
    display: none;
  }

  .chat-panel {
    display: none;
    min-height: 0;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .app-shell[data-mobile-view="leads"] .leads-panel {
    display: flex;
    align-self: stretch;
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .app-shell[data-mobile-view="dialogs"][data-mobile-dialog="list"] .sidebar {
    display: grid;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .app-shell[data-mobile-view="dialogs"][data-mobile-dialog="chat"] .chat-panel {
    display: grid;
  }

  .mobile-dialogs-back {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    color: var(--blue-dark);
    font-size: 24px;
    background: var(--panel-muted);
  }

  .lead-board {
    grid-template-columns: repeat(3, minmax(250px, 1fr));
    min-width: 772px;
  }

  .lead-queue {
    overflow: auto;
  }

  .message {
    max-width: 86%;
  }

}
