:root { font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: #17181b; background: #f7f7f8; --accent: #002fa7; --line: #dedee3; --muted: #666873; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, input, select { min-height: 42px; }
button, input, select, textarea { border-radius: 4px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app { display: grid; grid-template-columns: 254px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; height: 100dvh; min-height: 480px; background: #fff; border-inline: 1px solid var(--line); }
.sidebar { display: flex; flex-direction: column; padding: 32px 25px 22px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 54px; }
.brand-mark { width: 8px; height: 28px; background: var(--accent); }
h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.7px; }
label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
input, select { width: 100%; padding: 9px 10px; color: inherit; background: #fff; border: 1px solid #c8c9d0; }
select { margin-bottom: 18px; }
.account { color: var(--accent); font-size: 12px; line-height: 1.6; margin: 10px 0 28px; min-height: 20px; }
.secondary { width: 100%; background: #f7f7f8; border: 1px solid var(--line); color: #292b31; font-size: 13px; }
.settings-note { margin-top: 22px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.sidebar-footer { margin-top: auto; padding-top: 30px; display: flex; flex-direction: column; gap: 9px; color: var(--muted); font-size: 11px; }
#connection { color: var(--accent); }
.conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.conversation-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin: 0 40px; padding: 27px 0 25px; gap: 12px; }
.eyebrow { color: var(--muted); font-size: 12px; margin: 0 0 7px; }
h2 { margin: 0; font-size: 29px; letter-spacing: -1px; font-weight: 500; }
.text-button { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 8px; }
.text-button:hover { color: var(--accent); }
.messages { flex: 1; overflow-y: auto; min-height: 0; padding: 30px 40px 24px; scroll-behavior: smooth; }
.empty { padding: 70px 0; border-top: 1px solid var(--line); margin-top: 25px; }
.empty h3 { font-size: 22px; font-weight: 400; margin: 0 0 13px; letter-spacing: -.5px; }
.empty p { font-size: 13px; color: var(--muted); margin: 0; }
.message { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 17px; }
.message.user { align-items: flex-end; margin-top: 24px; margin-bottom: 24px; }
.message-label { font-size: 11px; color: var(--muted); margin: 0 0 7px; }
.message-actions, .history-actions { display: flex; align-items: center; gap: 10px; }
.message-actions .text-button { min-height: 30px; padding: 4px 0; font-size: 11px; }
.message-body { max-width: min(78%, 600px); padding: 12px 16px; background: #f7f7f8; border: 1px solid #eeeeF1; border-radius: 3px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; font-size: 15px; }
.user .message-body { background: var(--accent); color: #fff; border-color: var(--accent); }
.notice { margin: 0 40px 12px; padding: 12px 14px; border: 1px solid #bbc7e9; background: #f7f7f8; color: #292b31; font-size: 13px; line-height: 1.7; }
.composer { margin: 0 40px; border: 1px solid #c8c9d0; padding: 14px 15px 12px; border-radius: 5px; }
.composer:focus-within { border-color: var(--accent); }
textarea { display: block; width: 100%; min-height: 56px; max-height: 160px; padding: 0; resize: vertical; border: 0; background: #fff; color: inherit; line-height: 1.7; font-size: 15px; }
textarea:focus-visible { outline: none; }
textarea::placeholder { color: #92949e; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.keyboard-hint { color: var(--muted); font-size: 11px; }
.primary { background: var(--accent); color: #fff; border: 0; min-width: 82px; padding: 9px 22px; font-size: 13px; }
.conversation-footer { display: flex; justify-content: space-between; gap: 10px; min-height: 43px; margin: 0 40px; padding: 11px 0 15px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) {
  .app { display: flex; flex-direction: column; min-height: 0; border: 0; }
  .sidebar { padding: 15px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 15px; }
  h1 { font-size: 17px; }
  .brand-mark { height: 20px; width: 6px; }
  #settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 7px 10px; }
  #settings label[for="uid"] { grid-column: 1; grid-row: 1; }
  #settings label[for="actor"] { grid-column: 2; grid-row: 1; }
  #uid { grid-column: 1; grid-row: 2; }
  #actor { grid-column: 2; grid-row: 2; }
  #load { grid-column: 3; grid-row: 2; padding: 0 12px; }
  #account { grid-column: 1 / -1; grid-row: 3; margin: 0; }
  #settings label, select { margin-bottom: 0; }
  .settings-note, .sidebar-footer { display: none; }
  .conversation { flex: 1; }
  .conversation-header { padding: 15px 0; margin-inline: 18px; }
  h2 { font-size: 23px; }
  .messages { padding: 18px; }
  .message-body { max-width: 88%; }
  .composer, .conversation-footer, .notice { margin-inline: 18px; }
  .keyboard-hint { font-size: 10px; }
  .empty { padding-top: 28px; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .messages { scroll-behavior: auto; } }
[hidden] { display: none !important; }
.gate { min-height: 100dvh; padding: 7vh 24px; display: grid; align-content: center; }
.gate-card { width: 100%; max-width: 400px; margin: 0 auto; padding: 30px; background: #fff; border: 1px solid var(--line); }
.gate .brand { margin-bottom: 38px; }
.gate h2 { font-size: 27px; }
.gate-intro { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 28px; }
.gate input { margin-bottom: 20px; }
.gate .text-button { padding-left: 0; margin-top: 12px; }
.full { width: 100%; }
.form-error { color: var(--accent); font-size: 13px; line-height: 1.6; }
.field-hint { text-align: right; font-size: 12px; color: var(--muted); margin-top: -13px; }
.boot-status { margin: 12vh 8vw; color: var(--muted); }
.account-name { font-size: 22px; font-weight: 500; margin: 0; }
.account { margin-bottom: 15px; }
.actor-label { margin-top: 30px; }
.voice-toggle { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 12px; }
.voice-toggle input { width: 16px; min-height: 16px; accent-color: var(--accent); margin: 0; }
.admin-link { color: var(--accent); text-decoration: none; font-size: 13px; margin-top: 20px; }
.sidebar-footer .text-button { text-align: left; padding-left: 0; align-self: flex-start; }
.message-body { text-align: left; min-height: 0; }
button.message-body:hover { border-color: #9cadd9; }
.audio-state { color: var(--muted); font-size: 11px; margin-top: 5px; min-height: 17px; }
.message[data-audio-state="playing"] .audio-state, .message[data-audio-state="replaying"] .audio-state { color: var(--accent); }
@media (max-width: 700px) {
  .gate { padding: 30px 18px; }
  .gate-card { padding: 25px 22px; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 12px; }
  .sidebar .brand { grid-column: 1; grid-row: 1; margin: 0; }
  .account-name { grid-column: 2; grid-row: 1; font-size: 17px; align-self: center; text-align: right; }
  .account { display: none; }
  #edit-nickname { grid-column: 3; grid-row: 1; width: auto; padding: 4px 10px; font-size: 11px; min-height: 32px; }
  .actor-label { display: none; }
  #actor { grid-column: 1; grid-row: 2; min-width: 0; }
  .voice-toggle { grid-column: 2; grid-row: 2; margin: 0; justify-self: end; font-size: 11px; }
  #enable-audio { grid-column: 2; grid-row: 3; margin: 0; }
  .sidebar-footer { display: block; grid-column: 3; grid-row: 2; padding: 0; margin: 0; }
  #connection { display: none; }
  #logout { padding: 4px; min-height: 36px; font-size: 11px; }
  .admin-link { grid-column: 1; grid-row: 3; margin: 3px 0 0; font-size: 11px; }
}

/* Keep the press target stable while recording controls and transcription change. */
.voice-controls { position: relative; flex-shrink: 0; border-top: 1px solid var(--line); padding: 12px 0; margin-inline: 40px; }
.input-modes { display: flex; gap: 16px; }
.input-modes button { border: 0; border-bottom: 2px solid transparent; background: none; color: #6b7280; padding: 6px 0; font: inherit; cursor: pointer; }
.input-modes button[aria-pressed=true] { color: var(--accent); border-bottom-color: var(--accent); }
.speech-status { font-size: 12px; color: #667085; margin: 8px 0; }
#speech-status { height: 2.8em; line-height: 1.4; overflow: auto; }
.recognition-draft { position: absolute; z-index: 2; bottom: calc(100% + 8px); inset-inline: 0; max-height: min(24vh, 140px); overflow-y: auto; border: 1px solid var(--line); border-left: 3px solid var(--accent); background: #f7f7f8; padding: 10px 12px; margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.voice-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 12px; }
#voice-hold, #continuous-toggle { flex: 1; min-width: 0; width: auto; }
#voice-hold { user-select: none; -webkit-user-select: none; touch-action: none; }
.voice-controls[data-mode=continuous] #finish-speech[hidden] { display: block !important; visibility: hidden; pointer-events: none; }
#voice-hold.recording { background: var(--accent); color: white; }
#voice-hold.cancelling { background: #667085; color: white; }
@media (max-width: 700px) {
  .voice-controls { padding: 8px 0; margin-inline: 18px; }
  .voice-actions button { min-height: 42px; }
  .speech-status { margin: 4px 0; }
}
