:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --panel: #12161d;
  --panel-2: #181e27;
  --line: #2a3340;
  --text: #f5f7fa;
  --muted: #9ca8b7;
  --accent: #f0b84b;
  --accent-2: #ffd77f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #202838 0, var(--bg) 42%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
.shell {
  width: min(1040px, calc(100% - 28px));
  margin: 28px auto;
  background: rgba(18, 22, 29, .94);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.38);
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .14em; font-size: .72rem; }
h1 { margin: 5px 0 3px; font-size: clamp(1.45rem, 3vw, 2.15rem); }
h1 span { color: var(--accent-2); font-size: .55em; vertical-align: top; }
p { margin: 0; color: var(--muted); }
button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--accent);
  color: #16120a;
  font-weight: 800;
}
button:disabled { opacity: .55; cursor: wait; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.security {
  margin: 18px 24px 0;
  padding: 15px;
  background: #10151c;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.security label { display: block; font-weight: 750; margin-bottom: 8px; }
.security-row { display: flex; gap: 9px; }
.security input {
  flex: 1;
  min-width: 0;
  background: #0b0f15;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
.security small { display: block; color: var(--muted); margin-top: 8px; }
.chat {
  height: min(58vh, 610px);
  min-height: 390px;
  overflow-y: auto;
  padding: 24px;
}
.message { display: flex; margin: 0 0 15px; }
.message.user { justify-content: flex-end; }
.bubble {
  max-width: min(78%, 720px);
  white-space: pre-wrap;
  line-height: 1.55;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}
.user .bubble { background: #292314; border-color: #5c4a22; }
.error .bubble { background: #2b1518; border-color: #6a2930; }
.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
}
textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 180px;
  background: #0b0f15;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
}
.statusline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 25px 18px;
  color: var(--muted);
  font-size: .84rem;
}
@media (max-width: 700px) {
  .shell { margin: 0 auto; width: 100%; min-height: 100vh; border-radius: 0; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .security-row { flex-direction: column; }
  .chat { min-height: 50vh; }
  .bubble { max-width: 92%; }
  .composer { grid-template-columns: 1fr; }
  .statusline { flex-direction: column; }
}
