* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #111827;
  color: #e5e7eb;
}

button,
input,
textarea {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  height: 100vh;
}

.sidebar {
  border-right: 1px solid #273244;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  padding: 20px;
  border-bottom: 1px solid #273244;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand span {
  color: #94a3b8;
  font-size: 13px;
}

.search {
  margin: 14px;
  padding: 11px 12px;
  border: 1px solid #334155;
  border-radius: 9px;
  background: #111827;
  color: white;
  outline: none;
}

.filters {
  display: grid;
  gap: 4px;
  padding: 0 14px;
}

.filter {
  text-align: left;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
}

.filter:hover,
.filter.active {
  background: #1e293b;
  color: white;
}

.mode-filters {
  display: flex;
  gap: 8px;
  padding: 14px;
}

.chip {
  border: 1px solid #334155;
  background: #111827;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}

.conversation-list {
  overflow-y: auto;
  border-top: 1px solid #273244;
}

.conversation-item {
  padding: 14px;
  border-bottom: 1px solid #1e293b;
  cursor: pointer;
}

.conversation-item:hover,
.conversation-item.active {
  background: #1e293b;
}

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

.conversation-name {
  font-weight: 700;
}

.conversation-time {
  color: #64748b;
  font-size: 12px;
}

.conversation-preview {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badges {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge {
  border-radius: 999px;
  font-size: 11px;
  padding: 4px 7px;
  background: #334155;
}

.badge.ai {
  background: #064e3b;
}

.badge.human {
  background: #7c2d12;
}

.badge.channel {
  background: #1e3a8a;
}

.unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #2563eb;
  font-size: 11px;
  padding: 0 6px;
}

.chat-panel {
  background: #111827;
  min-width: 0;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  color: #64748b;
}

.chat-view {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hidden {
  display: none !important;
}

.chat-header {
  min-height: 78px;
  border-bottom: 1px solid #273244;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: #0f172a;
}

.chat-header h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.chat-meta {
  color: #94a3b8;
  font-size: 13px;
}

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

.mode-badge {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.mode-badge.ai {
  background: #064e3b;
  color: #a7f3d0;
}

.mode-badge.human {
  background: #7c2d12;
  color: #fed7aa;
}

.primary-button,
.send-button {
  border: 0;
  background: #2563eb;
  color: white;
  border-radius: 8px;
  padding: 9px 13px;
  cursor: pointer;
}

.messages {
  overflow-y: auto;
  padding: 22px;
}

.message {
  display: flex;
  margin-bottom: 14px;
}

.message.inbound {
  justify-content: flex-start;
}

.message.outbound {
  justify-content: flex-end;
}

.bubble {
  max-width: 72%;
  padding: 11px 13px;
  border-radius: 12px;
  background: #1e293b;
  line-height: 1.4;
}

.message.outbound .bubble {
  background: #1d4ed8;
}

.message-meta {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 11px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #273244;
  background: #0f172a;
}

.composer textarea {
  resize: none;
  min-height: 45px;
  max-height: 120px;
  border: 1px solid #334155;
  background: #111827;
  color: white;
  border-radius: 9px;
  padding: 10px 12px;
}

.context-panel {
  border-left: 1px solid #273244;
  background: #0f172a;
  overflow-y: auto;
  padding: 14px;
}

.card {
  background: #111827;
  border: 1px solid #273244;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.row {
  margin-bottom: 9px;
}

.label {
  display: block;
  color: #64748b;
  font-size: 11px;
  margin-bottom: 2px;
}

.value {
  font-size: 13px;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 280px 1fr;
  }

  .context-panel {
    display: none !important;
  }
}
