body {
  background: #eef1f5;
}

.nav-actions {
  gap: 8px;
}

.contacts-table,
.customer-list {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.filter-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: start;
}

.settings-panel {
  margin-bottom: 90px;
}

.settings-token-actions .btn {
  white-space: nowrap;
}

.token-input {
  grid-column: span 2;
}

.list-actions {
  gap: 8px;
  align-items: center;
}

.customer-row {
  display: grid;
  grid-template-columns: 28px minmax(150px, 1fr) minmax(120px, 220px);
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #edf0f3;
  margin: 0;
  cursor: pointer;
}

.customer-row:hover {
  background: #f8fafc;
}

.customer-row small {
  display: block;
  color: #6c757d;
}

.customer-row .labels {
  text-align: right;
}

.response-results {
  max-height: 360px;
  overflow: auto;
}

.response-row {
  padding: 12px 16px;
  border-top: 1px solid #edf0f3;
}

.response-row small {
  color: #6c757d;
}

.response-row pre {
  margin: 8px 0 0;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f9fb;
  border: 1px solid #e2e7ee;
  border-radius: 4px;
  padding: 8px;
  color: #263241;
  font-size: 12px;
}

.send-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  background: #ffffff;
  border-top: 1px solid #d9dde3;
  box-shadow: 0 -8px 24px rgba(25, 36, 54, 0.12);
}

.send-title {
  font-weight: 700;
}

.send-status {
  color: #5f6b7a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.send-progress {
  height: 12px;
  margin: 0;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: calc(100vh - 130px);
  background: #ffffff;
  border: 1px solid #dfe4ea;
}

.chat-sidebar {
  border-right: 1px solid #dfe4ea;
  min-width: 0;
  background: #f7f9fb;
}

.chat-sidebar-header,
.chat-window-header {
  min-height: 68px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #dfe4ea;
  background: #ffffff;
}

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

.chat-sidebar-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.chat-sidebar-header span {
  color: #6c757d;
}

.chat-thread-list {
  max-height: calc(100vh - 200px);
  overflow: auto;
}

.chat-thread {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  color: #17212b;
  border-bottom: 1px solid #edf0f3;
}

.chat-thread:hover,
.chat-thread.active {
  color: #17212b;
  text-decoration: none;
  background: #e9f7f0;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #00a884;
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

.chat-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

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

.chat-thread-top,
.chat-thread-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-thread-top strong,
.chat-thread-bottom span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-top small,
.chat-thread-bottom span {
  color: #667781;
}

.chat-thread-bottom b {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #25d366;
  font-size: 12px;
}

.chat-window {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #efeae2;
}

.chat-window-header small {
  display: block;
  color: #667781;
}

.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 18px;
}

.chat-bubble-row {
  display: flex;
  margin-bottom: 8px;
}

.chat-bubble-row.outbound {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: min(680px, 78%);
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 1px rgba(11, 20, 26, 0.14);
}

.chat-bubble-row.outbound .chat-bubble {
  background: #d9fdd3;
}

.chat-bubble p {
  margin: 0 0 4px;
  color: #111b21;
  white-space: normal;
  word-break: break-word;
}

.chat-attachment {
  margin-bottom: 8px;
}

.chat-attachment img,
.chat-attachment video {
  display: block;
  max-width: min(320px, 100%);
  border-radius: 8px;
  background: #dfe5ec;
}

.chat-audio-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(320px, 100%);
}

.chat-audio-card audio {
  width: min(320px, 100%);
}

.chat-audio-label {
  color: #3d4f5d;
  font-size: 13px;
}

.chat-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(17, 27, 33, 0.06);
  color: #111b21;
}

.chat-attachment-file:hover {
  color: #111b21;
  text-decoration: none;
}

.chat-attachment-meta {
  display: block;
  margin: 4px 0;
  color: #667781;
  font-size: 11px;
}

.chat-message-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  color: #667781;
  font-size: 11px;
}

.chat-status-text {
  font-weight: 600;
  color: #3d7a52;
}

.chat-reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #d8d2c8;
  background: #f0f2f5;
  align-items: center;
}

.chat-reply-form textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

.chat-reply-form button {
  width: 46px;
  height: 42px;
  border-radius: 50%;
}

.chat-file-picker {
  width: 46px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-record-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-reply-form input[type="file"] {
  display: none;
}

.chat-file-status {
  grid-column: 1 / -1;
  color: #667781;
  font-size: 13px;
  min-height: 18px;
}

.chat-selection-preview,
.chat-recording-preview {
  grid-column: 1 / -1;
}

.chat-selection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d8dfe6;
}

.chat-selection-media img,
.chat-selection-media video {
  display: block;
  width: 120px;
  max-width: 100%;
  border-radius: 8px;
}

.chat-selection-media audio {
  width: min(320px, 100%);
}

.chat-selection-file {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-selection-file i {
  font-size: 22px;
  color: #00a884;
}

.chat-selection-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-selection-details strong {
  color: #111b21;
  word-break: break-word;
}

.chat-selection-details small {
  color: #667781;
}

.chat-recording-preview audio {
  width: min(360px, 100%);
}

.chat-placeholder,
.chat-empty-list,
.chat-empty-window {
  color: #667781;
  text-align: center;
}

.chat-placeholder {
  margin: auto;
  padding: 24px;
}

.chat-placeholder i {
  font-size: 54px;
  color: #00a884;
  margin-bottom: 12px;
}

.chat-empty-list {
  padding: 24px;
}

@media (max-width: 768px) {
  .customer-row {
    grid-template-columns: 28px 1fr;
  }

  .customer-row .labels {
    grid-column: 2;
    text-align: left;
  }

  .send-panel {
    grid-template-columns: 1fr;
  }

  .token-input {
    grid-column: span 1;
  }

  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    border-right: 0;
    border-bottom: 1px solid #dfe4ea;
  }

  .chat-window {
    min-height: 560px;
  }

  .chat-reply-form {
    grid-template-columns: 1fr;
  }

  .chat-compose-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .chat-selection-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
