:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --user-bg: #2563eb;
  --user-ink: #ffffff;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); height: 100vh; display: flex; flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid #e5e7eb;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
}
.title { font-weight: 700; font-size: 16px; }
.subtitle { font-size: 12px; color: var(--muted); }
.status { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }

.chat { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: var(--radius); line-height: 1.55; font-size: 15px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--user-bg); color: var(--user-ink); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; margin-top: 8px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.card { background: #fafbff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.card h4 { margin: 0 0 6px; font-size: 14px; color: #3730a3; }
.card ol { margin: 6px 0; padding-left: 22px; }
.card .final { margin-top: 8px; font-weight: 700; }
.card .mistakes { font-size: 13px; color: var(--warn); margin-top: 8px; }
.typing { color: var(--muted); font-style: italic; }

.composer { display: flex; gap: 10px; padding: 14px 20px; background: var(--panel); border-top: 1px solid #e5e7eb; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 15px; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer button {
  border: none; background: var(--accent); color: #fff; padding: 0 22px; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.composer button:disabled { opacity: .5; cursor: not-allowed; }
