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

:root {
  --bg:        #0d0d0d;
  --surface:   #161616;
  --surface2:  #1f1f1f;
  --border:    #2a2a2a;
  --accent:    #1a73e8;
  --accent-h:  #1557b0;
  --text:      #e8e8e8;
  --text-muted:#888;
  --user-bg:   #1a73e8;
  --bot-bg:    #1f1f1f;
  --radius:    14px;
  --font:      'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 820px;
  margin: 0 auto;
}

/* Header */
#header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
#header img {
  height: 32px;
  width: auto;
  object-fit: contain;
}
#header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}
#header-title {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}
#status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
#status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
#messages::-webkit-scrollbar { display: none; }

/* Welcome */
#welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
}
#welcome-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#welcome-logo img { width: 36px; height: auto; }
#welcome h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
#welcome p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}
#suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.suggestion {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.suggestion:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(26,115,232,0.1);
}

/* Message bubbles */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: fadeUp .25s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.user  { align-self: flex-end;   align-items: flex-end; }
.msg.bot   { align-self: flex-start; align-items: flex-start; }

.bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.msg.user .bubble {
  background: var(--user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.bot .bubble {
  background: var(--bot-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
}
.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}
.msg-status {
  font-size: 11px;
  color: var(--text-muted);
  transition: color .3s;
}
.msg-status.read {
  color: #1a73e8;
}

/* Typing */
.typing-bubble {
  background: var(--bot-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  padding: 14px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
  align-self: flex-start;
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: .2s; }
.typing-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Input area */
#input-area {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
#input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  transition: border-color .2s;
}
#input-row:focus-within {
  border-color: var(--accent);
}
#input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  height: 24px;
  max-height: 120px;
  line-height: 1.2;
}
#input::placeholder { color: var(--text-muted); }
#send-btn {
  width: 32px;
  height: 32px;
  padding-bottom: 2px;
  border-radius: 8px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .1s;
  color: white;
  font-size: 16px;
}
#send-btn:hover { background: var(--accent-h); }
#send-btn:active { transform: scale(.95); }
#send-btn:disabled { background: var(--border); cursor: not-allowed; }
#input-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  opacity: .6;
}

@media (max-width: 600px) {
  .msg { max-width: 88%; }
  #messages { padding: 16px 14px; }
  #input-area { padding: 12px 14px 16px; }
}

#clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
  margin-left: 12px;
}
#clear-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}