:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1d2632;
  --line: #2d3745;
  --text: #edf2f7;
  --muted: #9eacba;
  --accent: #75a7ff;
  --accent-2: #9ac0ff;
  --ok: #4fd18b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top, #172235 0, var(--bg) 42%); color: var(--text); min-height: 100vh; }
.shell { width: min(1020px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 20px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.brand { font-size: clamp(28px, 5vw, 44px); font-weight: 760; letter-spacing: -0.04em; }
.subtitle { margin-top: 7px; color: var(--muted); }
.status { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted); white-space: nowrap; }
.status.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok), transparent 55%); }
.departments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0 12px; }
.department { padding: 15px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); cursor: pointer; }
.department strong { display: block; font-size: 16px; }
.department span { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.department.active { border-color: var(--accent); background: linear-gradient(145deg, #1d2d48, #182232); }
.note { min-height: 44px; border-radius: 12px; padding: 11px 14px; background: #111823; border: 1px solid var(--line); color: var(--muted); }
.messages { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 24px 0; min-height: 360px; }
.empty { margin: auto; color: var(--muted); text-align: center; max-width: 520px; line-height: 1.6; }
.message { max-width: 88%; border-radius: 16px; padding: 14px 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; background: #27508a; }
.message.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.sources { display: grid; gap: 8px; margin-top: 12px; }
.source { padding: 10px 11px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.source b { color: var(--accent-2); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); position: sticky; bottom: 12px; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #0f151e; color: var(--text); padding: 12px; font: inherit; resize: vertical; }
button { border: 0; border-radius: 10px; padding: 0 20px; background: var(--accent); color: #07111f; font-weight: 700; cursor: pointer; }
button:disabled { opacity: .55; cursor: progress; }
footer { color: var(--muted); text-align: center; font-size: 12px; margin-top: 18px; }
dialog { width: min(430px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); padding: 24px; }
dialog::backdrop { background: rgb(0 0 0 / .72); }
dialog button { width: 100%; min-height: 44px; margin-top: 12px; }
.error { color: #ff9a9a; min-height: 22px; margin-top: 8px; }
@media (max-width: 680px) {
  .topbar { display: block; }
  .status { display: inline-block; margin-top: 14px; }
  .departments { grid-template-columns: 1fr; }
  .message { max-width: 96%; }
  .composer { grid-template-columns: 1fr; }
  .composer button { min-height: 46px; }
}
