:root {
  color-scheme: dark;
  --bg: #0c1217;
  --panel: #151f26;
  --panel-raised: #1b2931;
  --border: #2b3c43;
  --text: #e5f0ec;
  --muted: #9aaea7;
  --green: #69d4a3;
  --green-deep: #14392c;
  --red: #ff9b9b;
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at top left, #14251f 0, var(--bg) 48rem) fixed;
}
button, input, textarea { font: inherit; }
.shell { max-width: 1180px; margin: 0 auto; padding: 26px 28px 18px; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:18px; padding-bottom:22px; border-bottom:1px solid #24343a; }
.brand-lockup { display:flex; align-items:center; gap:13px; }
.brand-mark { display:grid; place-items:center; width:42px; height:42px; border-radius:13px; color:#092117; background:var(--green); font-weight:800; font-size:21px; }
.brand-name { font-weight:700; letter-spacing:.01em; font-size:18px; }
.brand-subtitle, .footer { color:var(--muted); font-size:12px; margin-top:4px; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.model-badge { color:#b9edcf; background:#18382c; border:1px solid #285540; border-radius:999px; padding:8px 12px; font:12px Consolas, monospace; }
main { min-height:calc(100vh - 145px); display:flex; flex-direction:column; }
.login-wrap { flex:1; display:grid; place-items:center; padding:42px 0; }
.login-card { width:min(100%, 440px); padding:34px; border:1px solid var(--border); border-radius:22px; background:linear-gradient(145deg, #1a282f, #111a20); box-shadow:0 25px 80px #0006; }
.eyebrow { color:var(--green); font-size:10px; font-weight:800; letter-spacing:.16em; }
h1 { margin:9px 0 8px; font-size:25px; line-height:1.2; }
.intro { color:var(--muted); margin:0 0 27px; line-height:1.55; font-size:14px; }
.field-label { display:block; margin:0 0 8px; color:#c8d5d0; font-size:12px; font-weight:600; }
.text-input { width:100%; border:1px solid #354951; border-radius:11px; background:#0e171c; color:var(--text); outline:none; padding:13px 14px; transition:border-color .15s, box-shadow .15s; }
.text-input:focus { border-color:var(--green); box-shadow:0 0 0 3px #69d4a31c; }
.button { min-height:44px; border:1px solid transparent; border-radius:11px; padding:0 16px; color:var(--text); cursor:pointer; font-weight:700; transition:filter .15s, transform .15s, border-color .15s; }
.button:hover:not(:disabled) { filter:brightness(1.08); }
.button:active:not(:disabled) { transform:translateY(1px); }
.button:disabled { opacity:.55; cursor:wait; }
.button-primary { color:#082116; background:var(--green); }
.button-secondary { color:#dce9e4; background:#203038; border-color:#344851; }
.button-wide { width:100%; margin-top:14px; }
.error-message { min-height:20px; margin:10px 0 0; color:var(--red); font-size:13px; }
.security-note { margin-top:18px; padding-top:16px; border-top:1px solid #293a40; color:var(--muted); font-size:11px; }
.security-note span { color:var(--green); font-size:9px; margin-right:5px; }
.workspace { display:grid; grid-template-columns:minmax(0, 1fr) 310px; gap:16px; padding:24px 0; flex:1; min-height:0; }
.chat-card, .console-card { border:1px solid var(--border); border-radius:18px; background:linear-gradient(155deg, #18242b, #121b21); box-shadow:0 16px 50px #0003; }
.chat-card { min-height:590px; display:flex; flex-direction:column; padding:22px; }
.chat-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:16px; border-bottom:1px solid #293940; }
.chat-heading h1 { font-size:20px; margin:6px 0 0; }
.connection-status, .live-indicator { display:flex; align-items:center; gap:7px; color:var(--muted); font-size:11px; }
.status-dot { width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 10px #69d4a360; }
.messages { flex:1; min-height:280px; overflow-y:auto; padding:18px 2px; display:flex; flex-direction:column; gap:13px; }
.message { max-width:min(88%, 760px); border:1px solid #2a3b42; border-radius:14px; padding:12px 15px; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; }
.message.user { align-self:flex-end; color:#dff8e9; background:#173a2b; border-color:#2b6247; }
.message.assistant { align-self:flex-start; background:#1d2c33; }
.message-label { color:var(--green); font-size:10px; font-weight:800; letter-spacing:.08em; margin-bottom:5px; }
.message-content { margin:0; font-size:14px; }
.composer { display:grid; grid-template-columns:minmax(0,1fr) 120px; gap:10px; align-items:stretch; padding-top:13px; border-top:1px solid #293940; }
.message-input { min-height:66px; resize:vertical; line-height:1.45; }
.send-button { min-height:66px; }
.composer-hint { color:#82958e; font-size:10px; text-align:right; margin-top:7px; }
.console-card { min-height:0; display:flex; flex-direction:column; padding:18px 16px; }
.console-heading { display:flex; justify-content:space-between; align-items:center; padding-bottom:14px; border-bottom:1px solid #293940; }
.console-heading h2 { margin:5px 0 0; font-size:15px; }
.console-body { min-height:0; flex:1; overflow:auto; padding-top:12px; color:#9be3b9; font:11px/1.6 Consolas, "Cascadia Mono", monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
.console-line { margin:0 0 6px; }
.console-time { color:#6f9984; }
.console-error { color:#ff9b9b; }
.footer { display:flex; justify-content:center; gap:6px; padding-top:12px; border-top:1px solid #24343a; }
.footer span { color:#c4d5ce; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

@media (max-width: 820px) {
  .shell { padding:18px 15px; }
  .workspace { grid-template-columns:1fr; }
  .chat-card { min-height:520px; padding:17px; }
  .console-card { min-height:180px; }
}
@media (max-width: 480px) {
  .brand-subtitle { font-size:10px; }
  .topbar { align-items:flex-start; }
  .topbar-right { align-items:flex-end; flex-direction:column; }
  .model-badge { max-width:180px; overflow:hidden; text-overflow:ellipsis; }
  .login-card { padding:25px 20px; }
  .composer { grid-template-columns:1fr; }
  .send-button { min-height:46px; }
  .composer-hint { text-align:left; }
  .chat-heading { align-items:flex-start; }
}
