:root {
  color-scheme: dark; font-family: system-ui, "Segoe UI", sans-serif;
  --bg: #090f1b; --panel: #111d2d; --edge: #233a51; --text: #e8f4ff;
  --muted: #9eb5cb; --accent: #73e5f6; --ok: #8cebc0; --error: #ff9a9d;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; color: var(--text); background: radial-gradient(ellipse at 42% 0%, #142840 0, var(--bg) 67%) fixed }
button, input, textarea { font: inherit }
button { cursor: pointer; min-height: 42px; padding: 8px 13px; border: 1px solid var(--edge);
  border-radius: 9px; color: var(--text); background: #142337 }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
button:hover { border-color: #4a7892 }
button:disabled { opacity: .57; cursor: default }
button.primary { background: var(--accent); color: #0a2330; border-color: transparent; font-weight: 720 }
button.quiet { color: var(--muted); background: transparent }
button[aria-pressed=true] { border-color: #55a6bc; background: #18374a; color: var(--accent) }
a { color: var(--accent); overflow-wrap: anywhere }
h1, h2, p { margin: 0 }
h1 { font-size: 1.25rem; letter-spacing: -.025em }
h2 { font-size: 1rem }
.shell { max-width: 860px; padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left)); margin: 0 auto }
header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  letter-spacing: .18em; font-weight: 750 }
.brand img { width: 42px; height: 42px }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .79rem }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #7196ac }
.connection.online i { background: var(--ok); box-shadow: 0 0 11px #8cebc088 }
.connection.offline i { background: #e5a377 }
.login { width: min(100%, 400px); margin: clamp(24px, 12vh, 105px) auto 22px; background: var(--panel);
  padding: clamp(20px, 6vw, 36px); border: 1px solid var(--edge); border-radius: 18px }
.login img { width: 78px; height: 78px; display: block; margin: 0 auto 13px }
.login h1 { text-align: center; margin-bottom: 24px }
.login form, .login label { display: grid; gap: 9px }
.login form { gap: 15px }
.login label { color: var(--muted); font-size: .9rem }
input, textarea { width: 100%; color: var(--text); background: #0b1524; border: 1px solid var(--edge);
  border-radius: 8px; padding: 10px 12px; outline: none; font-size: 16px }
input:focus, textarea:focus { border-color: var(--accent) }
nav { display: flex; gap: 7px; margin-bottom: 12px }
nav .quiet { margin-left: auto }
.voice-bar { display: grid; grid-template-columns: min-content 1fr max-content; align-items: center;
  gap: 10px; background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 4px 11px }
.voice-bar p { font-size: .8rem; color: var(--muted); margin-top: 4px }
.voice-bar canvas { width: 62px; height: 62px }
#chat { height: clamp(150px, calc(100dvh - 321px), 790px); min-height: 140px; overflow: auto;
  overscroll-behavior: contain; padding: 13px 0; scrollbar-color: #365875 transparent }
#empty { text-align: center; margin-top: clamp(16px, 10vh, 84px); color: var(--muted) }
#older { display: block; margin: 0 auto 11px }
#messages { display: grid; gap: 9px }
.bubble { max-width: min(92%, 610px); color: var(--text); background: var(--panel); border: 1px solid var(--edge); padding: 12px 14px; border-radius: 12px; overflow-wrap: anywhere }
.bubble.user { justify-self: end; background: #143347; border-color: #24566a }
.bubble p { line-height: 1.52; white-space: pre-wrap }
.bubble small { display: block; color: var(--muted); margin-bottom: 5px }
.bubble ul { margin: 9px 0 0; padding-left: 18px }
.bubble img { display: block; width: min(100%, 540px); height: auto; margin: 10px 0; border-radius: 7px }
.notice, #pending { color: #e6ba86; font-size: .83rem }
#composer { border: 1px solid var(--edge); border-radius: 12px; background: var(--panel); padding: 9px; margin-bottom: 13px }
#composer p:empty, .error:empty { display: none }
#composer p { margin: 5px 0 }
.attachments, .message-entry, #attached { display: flex; gap: 7px; align-items: center }
.message-entry { margin-top: 8px }
.message-entry textarea { resize: none; line-height: 1.24 }
#attached { margin-top: 7px; color: var(--muted); justify-content: space-between; overflow-wrap: anywhere }
#cancel { margin-left: auto }
.error { color: var(--error); font-size: .86rem }
#statusPanel { display: grid; gap: 12px; padding: 5px 0 20px }
#gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px }
.card { border-radius: 11px; border: 1px solid var(--edge); background: var(--panel); padding: 13px }
.gauge strong { display: block; margin: 8px 0 5px; font-size: 1.35rem }
.gauge small { display: block; min-height: 1.2em; color: var(--muted) }
progress { display: block; width: 100%; height: 7px; accent-color: var(--accent); margin: 7px 0 }
#services { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 0 }
#services dd { margin: 0; text-align: end; color: var(--ok); overflow-wrap: anywhere }
#models { margin-bottom: 0; padding-left: 18px; color: var(--muted) }
@media (max-width: 365px) {
  .shell { padding-inline: 9px }
  button { padding-inline: 9px }
  .voice-bar { gap: 6px }
}
