:root {
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f8fb;
  color: #17202a;
}
body { margin: 0; }
a { color: inherit; text-decoration: none; }
main { max-width: 1120px; margin: 0 auto; padding: 28px 18px 60px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid #d9dee7; background: #ffffff;
}
.brand { font-weight: 800; letter-spacing: .02em; }
nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
nav form { display: inline; }
h1 { margin-top: 0; font-size: 28px; }
h2 { margin-top: 0; font-size: 20px; }
button, input, select, textarea {
  font: inherit; border: 1px solid #c8d0dc; border-radius: 8px; padding: 10px 12px; background: #fff; color: #17202a;
}
button { cursor: pointer; background: #145c9e; border-color: #145c9e; color: white; font-weight: 650; }
button.secondary { background: #fff; color: #17202a; border-color: #8996a8; }
.button-link { display: inline-block; padding: 10px 12px; border-radius: 8px; background: #145c9e; color: #fff; font-weight: 650; }
section, article {
  background: #fff; border: 1px solid #d9dee7; border-radius: 8px; padding: 20px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; background: transparent; border: 0; padding: 0; }
.narrow { max-width: 440px; margin: 40px auto; }
.stack, .inline, .toolbar, .chatbox { display: flex; gap: 10px; }
.stack { flex-direction: column; }
.inline, .toolbar { flex-wrap: wrap; align-items: center; }
.inline input[name="content"] { min-width: 320px; flex: 1; }
table { width: 100%; border-collapse: collapse; margin-top: 18px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #e5e9f0; }
.list { display: grid; gap: 10px; margin-top: 18px; }
.row { display: grid; gap: 4px; padding: 14px; border: 1px solid #e1e6ef; border-radius: 8px; background: #fbfcfe; }
.messages { display: grid; gap: 12px; margin: 18px 0; }
.message { border-left: 4px solid #8996a8; padding: 10px 14px; background: #fbfcfe; }
.message.assistant { border-color: #1e8a5a; }
.message.user { border-color: #145c9e; }
.message.system { border-left: 0; background: transparent; color: #627083; text-align: center; font-size: 14px; }
.message.is-draft p::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: currentColor; animation: pulse 1.1s ease-in-out infinite; }
.message-sources { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.message-sources a, .message p a { color: #145c9e; text-decoration: underline; }
.chatbox textarea { flex: 1; resize: vertical; }
.muted { color: #627083; }
.error { color: #b42318; }
.pair-code { font-size: 42px; font-weight: 800; letter-spacing: .14em; text-align: center; padding: 24px; border: 1px dashed #8996a8; border-radius: 8px; }
.log { min-height: 280px; white-space: pre-wrap; background: #101828; color: #d1fadf; border-radius: 8px; padding: 14px; overflow: auto; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.provider-form { padding: 18px 0; border-top: 1px solid #e5e9f0; }
.provider-form label { display: grid; gap: 6px; }
.voice-workspace { max-width: 760px; margin: 0 auto; }
.voice-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.voice-header label { display: grid; gap: 6px; }
.voice-control { min-height: 300px; display: grid; place-items: center; align-content: center; gap: 24px; }
.record-button { width: 176px; height: 176px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 10px; border: 0; background: #087fdd; }
.record-button:hover { background: #0569b8; }
.record-button.is-recording { background: #c72828; }
.record-button:disabled { background: #8996a8; cursor: wait; }
.record-icon { width: 30px; height: 44px; border: 5px solid #fff; border-radius: 18px; position: relative; box-sizing: border-box; }
.record-icon::after { content: ""; position: absolute; left: 50%; bottom: -17px; width: 45px; height: 24px; border: 5px solid #fff; border-top: 0; border-radius: 0 0 24px 24px; transform: translateX(-50%); box-sizing: border-box; }
.voice-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.voice-text-composer { margin-top: 18px; align-items: center; }
.voice-text-composer input { min-width: 15rem; flex: 1; }
@media (max-width: 680px) {
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .stack, .inline, .toolbar, .chatbox { flex-direction: column; align-items: stretch; }
  .voice-header { flex-direction: column; }
}
