@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-base: #070710;
  --bg-surface: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.15);
  --crimson: #c8102e;
  --crimson-rgb: 200, 16, 46;
  --transition: 150ms ease;
  
  --text-primary: #f0f0ff;
  --text-secondary: rgba(240, 240, 255, 0.6);
  --text-muted: rgba(240, 240, 255, 0.3);

  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  
  --tg-color: #3b82f6;
  --ig-color: #8b5cf6;
  --x-color: #a1a1aa;
  --mym-color: #10b981;
  --of-color: #f59e0b;
  --test-color: #71717a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 14px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  outline: none;
}

a { color: inherit; text-decoration: none; }

/* ─── Layout ─── */
.shell {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.side {
  width: var(--sidebar-w);
  background: rgba(13, 13, 26, 0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px;
  flex-shrink: 0;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

/* ─── Sidebar ─── */
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-dot { color: var(--crimson); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-section-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 16px;
  margin-bottom: 4px;
  padding-left: 12px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  text-align: left;
}
.nav button svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav button:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.nav button.active {
  background: rgba(200, 16, 46, 0.15);
  color: var(--crimson);
  box-shadow: inset 3px 0 0 var(--crimson);
}
.nav-badge {
  margin-left: auto;
  background: var(--crimson);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 100px;
}
.nav-badge.orange {
  background: #f59e0b;
}

/* ─── Buttons & Inputs ─── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.button svg { width: 16px; height: 16px; }
.button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.button.primary {
  background: var(--crimson);
  color: #fff;
  border-color: transparent;
}
.button.primary:hover:not(:disabled) {
  background: #a30d25;
}
.button.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.button.danger:hover { background: rgba(239, 68, 68, 0.25); }
.button.sm { padding: 6px 10px; font-size: 0.75rem; }

input, select, textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-strong);
}

/* ─── Badges & Status ─── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.tg { background: var(--tg-color); }
.dot.ig { background: var(--ig-color); }
.dot.x { background: var(--x-color); }
.dot.mym { background: var(--mym-color); }
.dot.of { background: var(--of-color); }
.dot.test { background: var(--test-color); }

/* ─── Views & Cards ─── */
.view { display: none; padding: 30px; height: 100%; flex-direction: column; }
.view.active { display: flex; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; }
.muted { color: var(--text-muted); font-size: 0.85rem; }

/* ─── Inbox Layout ─── */
.inbox-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  height: 100%;
  overflow: hidden;
}

.inbox-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: 100%;
}

.inbox-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); }

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.conv-item:hover { background: rgba(255, 255, 255, 0.06); }
.conv-item.active {
  background: rgba(200, 16, 46, 0.1);
  border-color: rgba(200, 16, 46, 0.3);
}
.conv-avatar {
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.conv-time { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; }
.needs-human-indicator {
  width: 8px; height: 8px; border-radius: 50%; background: #ef4444; flex-shrink: 0;
}

/* ─── Chat Area ─── */
.chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.2);
}
.chat-header-info { display: flex; align-items: center; gap: 12px; }
.chat-header-actions { display: flex; gap: 8px; }

.messages-scroll {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.messages-scroll::-webkit-scrollbar { width: 4px; }
.messages-scroll::-webkit-scrollbar-thumb { background: var(--border); }

.bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.bubble-wrap.them { align-self: flex-start; }
.bubble-wrap.me { align-self: flex-end; align-items: flex-end; }

.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.bubble.them {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.bubble.me {
  background: rgba(200, 16, 46, 0.15);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}
.bubble.draft {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.draft-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-zone {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.input-zone textarea {
  resize: none;
  height: 40px;
  max-height: 120px;
  min-height: 40px;
  padding: 10px 12px;
}
.input-info {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

/* ─── Other sections basics ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }

