:root {
  --orange: #e07528;
  --orange-dark: #c4611b;
  --orange-soft: #fdf0e6;
  --ink: #231f20;
  --muted: #6b6566;
  --bg: #f7f6f5;
  --card: #ffffff;
  --line: #e8e4e2;
}

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

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.app {
  max-width: 860px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--card);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 3px solid var(--orange);
  background: #fff;
}
.logo { height: 46px; width: auto; }
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2fb66b; box-shadow: 0 0 0 3px rgba(47,182,107,.2); }

/* Chat area */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome { margin: auto; text-align: center; max-width: 520px; }
.welcome-icon { width: 84px; height: 84px; margin-bottom: 14px; }
.welcome h1 {
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.dark { color: var(--ink); }
.orange { color: var(--orange); }
.welcome p { color: var(--muted); margin-bottom: 22px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--orange); color: var(--orange-dark); background: var(--orange-soft); }

/* Messages */
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 85%; animation: pop .2s ease-out; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: #fff; border: 2px solid var(--orange);
  display: grid; place-items: center; overflow: hidden;
}
.avatar img { width: 26px; height: 26px; }
.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 15px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.bot .bubble { background: #f3f1f0; color: var(--ink); border-bottom-left-radius: 4px; }
.msg.user .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.error .bubble { background: #fdecea; color: #a1281b; }
.bubble p + p, .bubble ul, .bubble ol, .bubble pre { margin-top: 8px; }
.bubble ul, .bubble ol { padding-left: 20px; }
.bubble code { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.bubble pre { background: var(--ink); color: #f5f5f5; padding: 12px; border-radius: 10px; overflow-x: auto; }
.bubble pre code { background: none; padding: 0; }
.bubble strong { color: inherit; }
.msg.bot .bubble a { color: var(--orange-dark); }

/* Typing indicator */
.typing { display: flex; gap: 5px; padding: 4px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* Composer */
.composer {
  display: flex;
  gap: 10px;
  padding: 14px 22px 8px;
  border-top: 1px solid var(--line);
  background: #fff;
}
#input {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  max-height: 160px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(224,117,40,.15); }
#send {
  width: 48px; height: 48px; flex-shrink: 0; align-self: flex-end;
  border: none; border-radius: 14px;
  background: var(--orange); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, transform .1s;
}
#send:hover { background: var(--orange-dark); }
#send:active { transform: scale(.95); }
#send:disabled { background: #d9d4d2; cursor: not-allowed; }

.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 12px; }

@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .logo { height: 36px; }
  .status { font-size: 12px; }
  .chat { padding: 18px 16px; }
  .composer { padding: 12px 16px 6px; }
  .msg { max-width: 92%; }
  .welcome h1 { font-size: 25px; }
}
