:root {
  --bg: #f1f4ff;       --surface: #ffffff;     --surface-tint: #f8faff;
  --border: #cbd2ea;   --border-strong: #b3bad3;
  --text: #0f1d37;     --muted: #5d6c7b;
  --brand: #3980ff;    --brand-hover: #1e5ed7; --brand-light: #ebf4ff;
  --green: #74d184;    --green-light: #e2fbea; --green-deep: #2f8d4e;
  --red: #fe566b;      --red-light: #fff5f6;   --red-deep: #c53345;
  --yellow: #efc42c;   --yellow-light: #fffae9; --yellow-deep: #a98c14;
  --font-display: 'Didact Gothic', sans-serif;
  --font-sans: 'Inter Tight', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 28px; }
.brand .divider { width: 1px; height: 28px; background: var(--border); }
.brand .title { font-family: var(--font-display); font-size: 20px; }
.brand .tagline { font-size: 11px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

/* Buttons / pills */
.btn { padding: 9px 18px; border-radius: 6px; font-size: 13px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: inline-block; font-family: var(--font-sans); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { color: var(--brand); border-color: var(--brand); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pill-info { background: var(--brand-light); color: var(--brand-hover); }
.pill-warn { background: var(--yellow-light); color: var(--yellow-deep); }
.pill-err  { background: var(--red-light); color: var(--red-deep); }

/* Chat layout */
body.app { display: flex; flex-direction: column; overflow: hidden; }
.chat { max-width: 820px; width: 100%; margin: 0 auto; padding: 24px 16px 0;
  display: flex; flex-direction: column; flex: 1; min-height: 0; }
.status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
  font-size: 12px; color: var(--muted); }
.log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 460px; }
.empty h1 { font-family: var(--font-display); font-weight: 400; font-size: 26px; color: var(--text); margin: 0 0 8px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

.msg { max-width: 88%; padding: 12px 16px; border-radius: 10px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--brand-light); border: 1px solid var(--border); }
.msg.bot  { align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15,29,55,0.03); }
.msg.err  { align-self: flex-start; background: var(--red-light); color: var(--red-deep); border: 1px solid var(--red); }
.msg .meta { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  font-size: 11px; color: var(--muted); white-space: normal; }
.thinking { color: var(--muted); font-style: italic; }

.composer { display: flex; gap: 10px; padding: 14px 0 20px; border-top: 1px solid var(--border); background: var(--bg); }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px; font-size: 14px; font-family: var(--font-sans); color: var(--text); outline: none; transition: all 0.15s; }
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(57,128,255,0.12); }

/* Phone width: keep the header on one line */
@media (max-width: 600px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand { gap: 10px; min-width: 0; }
  .brand img { height: 22px; }
  .brand .divider { height: 22px; }
  .brand .title { font-size: 18px; }
  .brand .tagline, .brand .divider, .who .who-name, .who .pill { display: none; }
  .brand .title { white-space: nowrap; }
  .who { gap: 8px; flex-shrink: 0; }
  .who .btn { padding: 7px 12px; }
  .chat { padding: 16px 16px 0; }
  .msg { max-width: 94%; }
}

/* Login */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,29,55,0.06); padding: 36px; max-width: 420px; width: 100%; text-align: center; }
.login-card img { height: 32px; margin-bottom: 20px; }
.login-card h1 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.login-card .dev { margin-top: 18px; font-size: 12px; }
