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

:root {
  /* AI brand */
  --c-claude:  #D66A2C;
  --c-gemini:  #1A56B0;
  --c-gpt:     #0C7A48;
  --c-grok:    #6329A3;

  /* Light palette */
  --bg:        #FFFFFF;
  --panel:     #F7F7F9;
  --panel2:    #EDEDF2;
  --border:    #E0E0E8;
  --border2:   #C8C8D4;
  --text:      #111113;
  --muted:     #4A4A56;
  --muted2:    #8A8A9A;
  --accent:    #3E51E6;

  /* Typography */
  --font:      'Google Sans', 'Google Sans Text', system-ui, sans-serif;
  --mono:      'IBM Plex Mono', ui-monospace, monospace;
  --radius:    8px;
  --radius-lg: 16px;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════
   TOPBAR
═══════════════════════════════ */
.topbar {
  height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}
.topbar-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-claude), var(--c-grok));
  flex-shrink: 0;
}
.topbar-logo-sep { color: var(--muted2); font-weight: 400; }
.topbar-logo-sub { color: var(--muted);  font-weight: 400; }

.topbar-spacer { flex: 1; }

.topbar-chip {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
  transition: all 0.2s;
}

/* ═══════════════════════════════
   IDENTITY BAR
═══════════════════════════════ */
.identity-bar {
  height: 44px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.identity-bar::-webkit-scrollbar { display: none; }

.identity-label {
  font-size: 11px;
  color: var(--muted2);
  font-family: var(--mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.id-sep {
  width: 1px;
  height: 16px;
  background: var(--border2);
  flex-shrink: 0;
  margin: 0 2px;
}

.id-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.id-btn:hover {
  background: var(--panel2);
  color: var(--text);
}
.id-btn.active {
  background: var(--bg);
  border-color: var(--border2);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* Coloured dot per identity */
.id-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted2);
}
.id-btn[data-ai="Claude"] .id-dot { background: var(--c-claude); }
.id-btn[data-ai="Gemini"] .id-dot { background: var(--c-gemini); }
.id-btn[data-ai="GPT-4o"] .id-dot { background: var(--c-gpt); }
.id-btn[data-ai="Grok"]   .id-dot { background: var(--c-grok); }
.id-btn[data-ai="You"]    .id-dot { background: var(--text); }

/* Active border matches AI colour */
.id-btn.active[data-ai="Claude"] { border-color: var(--c-claude); }
.id-btn.active[data-ai="Gemini"] { border-color: var(--c-gemini); }
.id-btn.active[data-ai="GPT-4o"] { border-color: var(--c-gpt); }
.id-btn.active[data-ai="Grok"]   { border-color: var(--c-grok); }

/* ═══════════════════════════════
   MESSAGES
═══════════════════════════════ */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  scroll-behavior: smooth;
  min-height: 0;
}
.messages::-webkit-scrollbar { width: 3px; }
.messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  padding: 0 32px;
  text-align: center;
}
.empty-state-icon  { font-size: 28px; margin-bottom: 4px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-state-sub   { font-size: 13px; line-height: 1.65; color: var(--muted); max-width: 300px; }

/* Day divider */
.day-divider {
  text-align: center;
  font-size: 10px;
  color: var(--muted2);
  font-family: var(--mono);
  margin: 6px 0 14px;
  position: relative;
}
.day-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 6%; right: 6%;
  height: 1px;
  background: var(--border);
}
.day-divider span {
  background: var(--bg);
  padding: 0 10px;
  position: relative;
}

/* Message groups */
.msg-group {
  padding: 3px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: fadeUp 0.18s ease both;
}
.msg-group.from-me { flex-direction: row-reverse; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.msg-avatar[data-ai="You"]    { background: var(--muted); }
.msg-avatar[data-ai="Claude"] { background: var(--c-claude); }
.msg-avatar[data-ai="Gemini"] { background: var(--c-gemini); }
.msg-avatar[data-ai="GPT-4o"] { background: var(--c-gpt); }
.msg-avatar[data-ai="Grok"]   { background: var(--c-grok); }

/* Message column */
.msg-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 76%;
}
.msg-group.from-me .msg-col { align-items: flex-end; }

/* Sender label */
.msg-sender {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 0 3px;
  margin-bottom: 1px;
  letter-spacing: 0.2px;
}
.msg-sender[data-ai="Claude"] { color: var(--c-claude); }
.msg-sender[data-ai="Gemini"] { color: var(--c-gemini); }
.msg-sender[data-ai="GPT-4o"] { color: var(--c-gpt); }
.msg-sender[data-ai="Grok"]   { color: var(--c-grok); }

/* Bubbles */
.bubble {
  padding: 9px 13px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}
.bubble.from-other {
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  color: var(--text);
}
.bubble.from-other[data-ai="Claude"] { border-left: 2px solid var(--c-claude); }
.bubble.from-other[data-ai="Gemini"] { border-left: 2px solid var(--c-gemini); }
.bubble.from-other[data-ai="GPT-4o"] { border-left: 2px solid var(--c-gpt); }
.bubble.from-other[data-ai="Grok"]   { border-left: 2px solid var(--c-grok); }
.bubble.from-me {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-bottom-right-radius: 3px;
  color: #fff;
}
.bubble-time {
  font-size: 10px;
  color: var(--muted2);
  padding: 0 3px;
  font-family: var(--mono);
}
.msg-group.from-me .bubble-time { text-align: right; }

/* ═══════════════════════════════
   INPUT AREA
═══════════════════════════════ */
.input-area {
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  padding: 10px 18px 14px;
}

/* Copy bar */
.copy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 20px;
}
.copy-bar-label {
  font-size: 11px;
  color: var(--muted2);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.copy-bar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--panel);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.copy-bar-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(62,81,230,.05);
}
.copy-bar-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.copy-bar-btn.done {
  border-color: var(--c-gpt);
  color: var(--c-gpt);
  background: rgba(12,122,72,.06);
}

/* Attachment strip — staged file preview */
.attach-strip {
  display: none;
  margin-bottom: 8px;
}
.attach-strip.visible { display: block; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--panel);
  font-size: 12px;
  color: var(--text);
  max-width: 100%;
}
.attach-chip-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.attach-chip-size {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted2);
  white-space: nowrap;
  flex-shrink: 0;
}
.attach-chip-x {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted2);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.1s;
}
.attach-chip-x:hover { color: #D93025; }

/* Input row */
.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--panel);
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  padding: 9px 14px;
  gap: 8px;
  transition: border-color 0.2s, background 0.2s;
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap.drag-over    { border-color: var(--accent); background: rgba(62,81,230,.04); }

/* Attach button inside input */
.attach-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted2);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.attach-btn:hover { color: var(--accent); }
.attach-btn svg   { width: 15px; height: 15px; }

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}
.chat-input::placeholder { color: var(--muted2); }

/* Send button */
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  transition: transform 0.1s, opacity 0.15s;
}
.send-btn:hover  { transform: scale(1.07); }
.send-btn:active { transform: scale(0.93); }
.send-btn svg    { width: 15px; height: 15px; }

/* ═══════════════════════════════
   ATTACHMENT CARD (in bubble)
═══════════════════════════════ */
.attach-card {
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  font-size: 12px;
}
.attach-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}
.attach-card-icon  { color: var(--muted); flex-shrink: 0; }
.attach-card-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.attach-card-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted2);
  white-space: nowrap;
  flex-shrink: 0;
}
.attach-card-preview {
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
  max-height: 80px;
  overflow: hidden;
}

/* Attach card inside from-me bubble */
.bubble.from-me .attach-card             { border-color: rgba(255,255,255,.2); }
.bubble.from-me .attach-card-head        { background: rgba(255,255,255,.12); border-bottom-color: rgba(255,255,255,.15); }
.bubble.from-me .attach-card-name        { color: #fff; }
.bubble.from-me .attach-card-meta        { color: rgba(255,255,255,.6); }
.bubble.from-me .attach-card-preview     { background: rgba(0,0,0,.12); color: rgba(255,255,255,.75); }

/* ═══════════════════════════════
   MOBILE
═══════════════════════════════ */
@media (max-width: 600px) {
  .topbar       { padding: 0 14px; }
  .identity-bar { padding: 0 14px; }
  .msg-group    { padding: 3px 14px; }
  .input-area   { padding: 8px 14px 12px; }
  .msg-col      { max-width: 86%; }
  .copy-bar-label    { font-size: 10px; }
  .attach-chip-name  { max-width: 130px; }
}
