:root {
  --bg: #ffffff;
  --panel: #f6f4f8;
  --line: #e2dde7;
  --text: #1b1b1f;
  --muted: #6b6672;
  --accent: #723079;
  --accent-ink: #ffffff;
  --navy: #1F3864;
  --me: #efe6f1;
  --error: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b1f; --panel: #26242b; --line: #3a3741; --text: #f1eef5; --muted: #a8a2b1;
    --accent: #b77bbd; --accent-ink: #1c1b1f; --navy: #9db4e0; --me: #33293a; --error: #f97066;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font: 13px/1.45 "Segoe UI", Aptos, -apple-system, BlinkMacSystemFont, sans-serif;
}
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent); }
button { font: inherit; cursor: pointer; }
button.link { background: none; border: 0; color: var(--muted); padding: 2px 4px; }
button.link:hover { color: var(--accent); }
.item { padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.item-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item-subject { font-weight: 600; overflow-wrap: anywhere; }
.item-from { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
main { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.msg.me { background: var(--me); align-self: flex-end; }
.msg.bot { background: var(--panel); border: 1px solid var(--line); }
.msg.error { color: var(--error); border: 1px solid var(--error); background: transparent; }
.step { color: var(--muted); font-size: 12px; padding-left: 4px; }
.step::before { content: "› "; color: var(--accent); }
.meta { color: var(--muted); font-size: 11px; padding-left: 4px; }
.hint { color: var(--muted); font-size: 12px; text-align: center; margin: auto 8px; }
.working { display: inline-flex; gap: 3px; padding: 4px; }
.working i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.working i:nth-child(2) { animation-delay: .2s; } .working i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.draft-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); font-size: 12px; }
.draft-bar button, #send { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 600; }
.draft-bar button:hover, #send:hover { filter: brightness(1.08); }
#send:disabled { opacity: .5; cursor: default; }
footer { border-top: 1px solid var(--line); padding: 10px 12px 12px; }
textarea { width: 100%; resize: vertical; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; color: var(--text); background: var(--bg); }
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cost { color: var(--muted); font-size: 11px; }
