.chat-widget {
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 1.25rem;
}

.chat-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.chat-kicker {
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.chat-title {
  font-size: 1.25rem;
  margin: 0.15rem 0 0;
}

.chat-network-note {
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 8px;
  color: #bae6fd;
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
}

.chat-quick-actions {
  align-items: center;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(11rem, 1fr) repeat(3, auto);
  margin-bottom: 0.75rem;
}

.chat-service-select {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  color: #e2e8f0;
  min-height: 2.25rem;
  padding: 0.35rem 2rem 0.35rem 0.6rem;
  width: 100%;
}

.chat-service-select:focus {
  border-color: rgba(74, 222, 128, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.12);
  outline: 0;
}

.chat-messages {
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: clamp(15rem, 32vh, 24rem);
  overflow-y: auto;
  padding: 0.85rem;
}

.chat-message {
  border-radius: 8px;
  line-height: 1.45;
  max-width: min(85%, 48rem);
  overflow-wrap: anywhere;
  padding: 0.65rem 0.75rem;
  white-space: pre-wrap;
}

.chat-message[data-role="assistant"] {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.chat-message[data-role="user"] {
  align-self: flex-end;
  background: rgba(21, 128, 61, 0.32);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.chat-confirmation {
  align-self: flex-start;
  background: rgba(69, 10, 10, 0.72);
  border: 1px solid rgba(248, 113, 113, 0.42);
  border-radius: 8px;
  max-width: min(92%, 42rem);
  padding: 0.8rem;
}

.chat-confirmation-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.chat-confirmation-warning {
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-confirmation-countdown {
  color: #cbd5e1;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.chat-confirmation-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.chat-status {
  color: #cbd5e1;
  font-size: 0.85rem;
  min-height: 1.6rem;
  padding: 0.35rem 0.1rem 0;
}

.chat-status[data-kind="error"] {
  color: #fca5a5;
}

.chat-status[data-kind="busy"] {
  color: #fde68a;
}

.chat-form {
  margin-top: 0.2rem;
}

.chat-input {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  color: #e2e8f0;
  display: block;
  line-height: 1.4;
  max-height: 11rem;
  min-height: 5rem;
  padding: 0.7rem 0.8rem;
  resize: vertical;
  width: 100%;
}

.chat-input:focus {
  border-color: rgba(74, 222, 128, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.12);
  outline: 0;
}

.chat-actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

@media (max-width: 575.98px) {
  .chat-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
  }

  .chat-message {
    max-width: 94%;
  }

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

  .chat-quick-actions .btn {
    width: 100%;
  }

  .chat-actions .btn {
    flex: 1 1 0;
  }
}
