:root {
  --bg: #f0f2f5;
  --sidebar: #111b21;
  --panel: #202c33;
  --panel-alt: #111b21;
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #25d366;
  --input: #2a3942;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  padding: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  margin-bottom: 20px;
}

.sidebar-header strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.sidebar-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.tab-button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-button.active,
.tab-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.search-box {
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--text);
}

.list {
  overflow-y: auto;
  padding-right: 4px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s ease;
}

.list-item:hover,
.list-item.active {
  background: rgba(255, 255, 255, 0.08);
}

.list-item strong {
  display: block;
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.list-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

.chat-area {
  background: #e5ddd5;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: #f0f2f5;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-title {
  font-size: 1.3rem;
  color: #111;
}

.chat-subtitle {
  color: #667781;
  margin-top: 4px;
  font-size: 0.95rem;
}

.chat-window {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  margin: auto;
  color: #54656f;
  text-align: center;
}

.message-row {
  display: flex;
  gap: 10px;
  max-width: 70%;
}

.message-row.incoming {
  align-self: flex-start;
}

.message-row.outgoing {
  align-self: flex-end;
  justify-content: flex-end;
}

.message-bubble {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message-row.outgoing .message-bubble {
  background: #dcf8c6;
}

.message-meta {
  font-size: 0.75rem;
  color: #657b83;
  margin-top: 6px;
}

.chat-input-row {
  background: #ffffff;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 12px;
}

.chat-input-row input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 24px;
  padding: 12px 16px;
  font-size: 1rem;
}

.chat-input-row button {
  background: var(--accent);
  border: none;
  color: white;
  border-radius: 24px;
  padding: 12px 18px;
  cursor: pointer;
}

.config-block {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.config-block label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.config-block input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: none;
  background: var(--panel);
  color: var(--text);
}

.config-block button {
  width: 100%;
  margin-top: 12px;
  border: none;
  border-radius: 14px;
  padding: 12px;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

.status-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.qr-container {
  min-height: 220px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
}

.info-row strong {
  color: var(--text);
}

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

  .sidebar {
    max-height: 420px;
    overflow-y: auto;
  }
}
