:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --paper: #fff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #0071e3;
  --accent-ink: #0071e3;
  --accent-soft: #eaf3ff;
  --glass: #ffffff99;
  --sidebar: #fafafc;
  --control: #f0f0f3;
  --field-line: #d2d2d7;
  --secondary-ink: #515156;
  --danger-bg: #fff1f0;
  --danger-ink: #b42324;
  --success: #32704b;
  --warning-ink: #795412;
  --warning-bg: #fff7e9;
  --warning-line: #eee0bc;
  --blue-line: #b9d8fa;
  --blue-bg: #f5f9ff;
  --shadow: 0 12px 48px #1d1d1f09, 0 1px 3px #1d1d1f05;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --paper: #1c1c1e;
  --ink: #f5f5f7;
  --muted: #a1a1aa;
  --line: #353538;
  --accent: #0071e3;
  --accent-ink: #70b7ff;
  --accent-soft: #152e49;
  --glass: #1c1c1ee6;
  --sidebar: #171719;
  --control: #2c2c30;
  --field-line: #48484e;
  --secondary-ink: #d1d1d6;
  --danger-bg: #3b2022;
  --danger-ink: #ff9b98;
  --success: #82d4a3;
  --warning-ink: #f1ca84;
  --warning-bg: #332a1c;
  --warning-line: #615039;
  --blue-line: #31577d;
  --blue-bg: #182b40;
  --shadow: 0 12px 48px #0003, 0 1px 3px #0002;
}
:root[data-theme="dark"] .brand-mark {
  background: #353538;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
button:hover {
  filter: brightness(0.97);
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #0071e34d;
  outline-offset: 3px;
}
input,
textarea,
select {
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--paper);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
textarea {
  resize: vertical;
  min-height: 104px;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-ink);
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: 0 0 20px;
  padding: 0;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
h1,
h2,
h3 {
  letter-spacing: -0.035em;
}
p {
  line-height: 1.6;
}
.secondary {
  background: var(--control) !important;
  color: var(--ink) !important;
}
.danger {
  color: var(--danger-ink) !important;
  background: var(--danger-bg) !important;
}
.eyebrow,
.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.auth-card {
  width: min(460px, calc(100% - 32px));
  margin: 8vh auto;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: clamp(32px, 5vw, 42px);
  line-height: 1.12;
  font-weight: 650;
  margin: 20px 0 14px;
}
.auth-card > p {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 28px;
}
.auth-card form,
.entity-form,
#deleteForm {
  display: grid;
  gap: 16px;
}
.auth-card label,
.entity-form > label:not(.check-label),
#deleteForm label {
  display: grid;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.auth-card .settings-explain {
  font-size: 12px;
  margin: 24px 0 0;
}
#authError,
.form-error {
  color: var(--danger-ink);
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
#authError:empty,
.form-error:empty {
  display: none;
}
.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 32px 24px;
}
.brand-mark {
  height: 38px;
  width: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -3px;
  padding-right: 3px;
}
.brand-mark span {
  display: none;
}
.brand strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.08em;
}
.brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.sidebar-content {
  padding: 12px;
  flex: 1;
}
.sidebar-title {
  margin: 0 12px 14px;
}
.agents {
  display: grid;
  gap: 5px;
}
.agent {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  text-align: left;
  color: var(--secondary-ink);
  background: transparent;
  border: 1px solid transparent;
  font-weight: 400;
}
.agent:hover {
  background: var(--control);
  filter: none;
}
.agent.active {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 2px 7px #00000004;
}
.agent-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--line);
  font-size: 20px;
  font-weight: 400;
}
.agent.active .agent-icon {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.agent-icon svg {
  width: 22px;
  height: 22px;
}
.google-button {
  width: 100%;
  margin: 12px 0 20px;
  min-height: 48px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}
.google-account-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.google-account-dialog h2 {
  font-size: 23px;
  line-height: 1.25;
  margin: 0 0 16px;
}
.google-account-dialog form {
  display: grid;
  gap: 14px;
}
.google-account-dialog label {
  display: grid;
  gap: 6px;
}
.google-account-dialog .check-label {
  display: flex;
  gap: 10px;
}
.google-account-dialog button {
  min-height: 44px;
}
.google-account-dialog .result-tabs {
  flex-wrap: wrap;
}
.avatar svg {
  width: 28px;
  height: 28px;
}
.agent strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.agent small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.sidebar-note {
  margin: 32px 12px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.sidebar-note strong {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}
.sidebar-note p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 0;
}
.tiny-sun {
  display: none;
}
.sidebar-footer {
  padding: 20px 24px 28px;
  border-top: 1px solid var(--line);
}
.sidebar-footer > span {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.nav-link {
  background: transparent;
  color: var(--secondary-ink);
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.main {
  min-width: 0;
  min-height: 100dvh;
  padding-bottom: 20px;
}
.topbar {
  min-height: 76px;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
}
.breadcrumb {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
  line-height: 1.5;
}
.breadcrumb span {
  color: #c7c7cc;
  padding: 0 10px;
}
.breadcrumb strong {
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0;
  font-size: 13px;
}
.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.status-chip {
  color: var(--success);
  font-size: 11px;
  white-space: nowrap;
}
.status-chip.off {
  color: var(--warning-ink);
}
.settings-mini {
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--secondary-ink);
  font-size: 20px;
}
.welcome {
  width: min(860px, calc(100% - 80px));
  margin: 44px auto 28px;
}
.welcome h1 {
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.15;
  font-weight: 600;
  margin: 14px 0 12px;
}
.welcome > p {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
}
.has-history .welcome {
  display: none;
}
.conversation {
  width: min(860px, calc(100% - 80px));
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.has-history .conversation {
  margin-top: 32px;
}
.chat-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 23px;
}
.chat-head-text {
  flex: 1;
  min-width: 0;
}
.chat-header h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.chat-header p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0 0;
}
.voice-button {
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 24px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
  font-size: 13px;
}
.voice-button span:first-child {
  margin-right: 5px;
}
.voice-button.on {
  background: var(--danger-bg);
  color: var(--danger-ink);
}
.messages {
  height: clamp(250px, 38dvh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  scroll-behavior: auto;
  overflow-anchor: none;
}
.has-history .messages {
  height: clamp(300px, 57dvh, 680px);
}
.bubble {
  max-width: 86%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border-bottom-right-radius: 6px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--bg);
  border-bottom-left-radius: 6px;
}
.source {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.empty-chat {
  margin: auto;
  text-align: center;
  max-width: 470px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.empty-chat > p {
  margin: 0 0 20px;
}
.starter-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.starter-chip,
.example-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--secondary-ink);
  font-size: 13px;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 22px;
}
.starter-chip:hover,
.example-chip:hover {
  color: var(--accent-ink);
  border-color: var(--blue-line);
  background: var(--blue-bg);
  filter: none;
}
.composer {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.composer textarea {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  max-height: 160px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.5;
}
.composer textarea:focus {
  border-color: var(--blue-line);
  outline: 0;
  box-shadow: 0 0 0 3px #0071e312;
}
.composer button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin-bottom: 2px;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 400;
}
.disclaimer {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  padding: 0 24px 18px;
  margin: 0;
}
.onboarding {
  width: min(860px, calc(100% - 80px));
  margin: 16px auto 0;
  padding: 0 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.onboarding > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.onboarding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.onboarding button {
  font-size: 12px;
  min-height: 40px;
  padding: 9px 12px;
}
.voice-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 22px 0;
  padding: 18px;
  border: 1px solid var(--blue-line);
  background: var(--blue-bg);
  border-radius: 16px;
}
.voice-banner strong {
  font-size: 14px;
}
.voice-banner p {
  font-size: 12px;
  color: var(--muted);
  max-width: 370px;
  margin: 5px 0 0;
}
.stop-btn {
  margin-left: auto;
  background: #1d1d1f;
  font-size: 12px;
}
.voice-pulse {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 32px;
}
.voice-pulse span {
  width: 4px;
  height: 10px;
  border-radius: 4px;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
.voice-pulse span:nth-child(2n) {
  animation-delay: 0.2s;
}
.voice-pulse span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes pulse {
  50% {
    height: 28px;
  }
}
#retryTranscripts,
#newRequestBtn {
  display: block;
  margin: 12px 22px;
  max-width: calc(100% - 44px);
  background: var(--warning-bg);
  color: var(--warning-ink);
  border: 1px solid var(--warning-line);
  font-size: 13px;
}
.overlay {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 16px;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background: transparent;
}
.overlay[open] {
  display: flex;
  justify-content: center;
  align-items: center;
}
.overlay:not([open]) {
  display: none;
}
dialog::backdrop {
  background: #1d1d1f55;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.settings-panel {
  width: min(600px, 100%);
  max-height: 90dvh;
  padding: 32px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 100px #00000026;
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.settings-header h2 {
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
  margin: 8px 0 0;
}
.close-btn,
.results-dialog header button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: var(--control);
  color: var(--muted);
  border-radius: 50%;
  font-size: 25px;
  font-weight: 400;
}
.settings-tabs,
.result-tabs {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--control);
  border-radius: 13px;
  margin: 0 0 28px;
}
.settings-tabs button,
.result-tabs button {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border-radius: 9px;
  padding: 8px;
  color: var(--secondary-ink);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
}
.settings-tabs [aria-selected="true"],
.result-tabs [aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 4px #00000012;
}
.settings-panel h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 12px;
  line-height: 1.3;
}
.settings-explain {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 20px;
}
.settings-panel .entity-form {
  margin: 24px 0;
  gap: 16px;
}
.entity-form > label[for="memoryInput"] {
  margin-bottom: -7px;
}
.field-hint {
  margin: -6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
}
.memory-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.example-chip {
  font-size: 12px;
  padding: 9px 12px;
}
fieldset {
  min-inline-size: 0;
  border: 0;
  margin: 12px 0 0;
  padding: 0;
}
legend {
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
  float: none;
  max-width: 100%;
}
fieldset > .field-hint {
  margin: -2px 0 12px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
}
.check-label {
  display: flex !important;
  align-items: flex-start;
  gap: 12px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.check-label + .check-label {
  margin-top: 12px;
}
.check-label input {
  margin-top: 1px;
}
#settingsConversation > .settings-explain {
  margin-top: 16px;
}
#settingsConversation h3:not(:first-child) {
  margin-top: 32px;
}
.mode-select {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.mode-select label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
}
.memory-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.memory-item,
.result-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sidebar);
}
.memory-item p,
.result-item p {
  width: 100%;
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
}
.memory-item small,
.result-item small {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}
.memory-item button,
.result-item button {
  min-height: 40px;
  padding: 8px 12px;
  background: var(--paper);
  color: var(--secondary-ink);
  border: 1px solid var(--line);
  font-size: 12px;
}
.privacy-actions {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}
.privacy-actions button {
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
  font-size: 14px;
}
.results-dialog,
.consent-dialog {
  width: min(650px, calc(100% - 32px));
  padding: 32px;
  max-height: 90dvh;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.results-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.results-dialog h2,
.consent-dialog h2 {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}
.results-dialog > p,
.consent-dialog > p {
  color: var(--muted);
  font-size: 14px;
  margin: 16px 0 24px;
}
.result-tabs {
  margin: 24px 0;
}
#entityList {
  display: grid;
  gap: 12px;
  margin-top: 28px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.consent-dialog > button {
  margin: 0 6px 10px 0;
}
.toast {
  position: fixed;
  z-index: 100;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(440px, calc(100% - 32px));
  padding: 16px 20px;
  border-radius: 16px;
  color: #fff;
  background: #29292e;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 8px 32px #00000020;
}
.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: 1000px) and (min-width: 761px) {
  .app {
    grid-template-columns: 224px minmax(0, 1fr);
  }
  .topbar {
    padding: 16px 24px;
  }
  .welcome,
  .conversation,
  .onboarding {
    width: calc(100% - 48px);
  }
  .breadcrumb {
    font-size: 0;
  }
  .breadcrumb span {
    display: none;
  }
}
@media (max-width: 760px) {
  .app {
    display: flex;
    flex-direction: column;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .brand,
  .sidebar-title,
  .sidebar-note,
  .sidebar-footer {
    display: none;
  }
  .sidebar-content {
    padding: 0;
    min-width: 0;
  }
  .agents {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 12px 16px;
    scrollbar-width: none;
  }
  .agents::-webkit-scrollbar {
    display: none;
  }
  .agent {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
    min-height: 44px;
    gap: 7px;
  }
  .agent small {
    display: none;
  }
  .agent-icon {
    width: 22px;
    height: 24px;
    flex-basis: 22px;
    font-size: 19px;
    background: transparent;
  }
  .agent.active .agent-icon {
    background: transparent;
  }
  .agent strong {
    font-size: 12px;
  }
  .main {
    min-height: calc(100dvh - 70px);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .topbar {
    min-height: 64px;
    padding: 10px 16px;
    gap: 8px;
  }
  .breadcrumb {
    font-size: 0;
  }
  .breadcrumb span {
    display: none;
  }
  .breadcrumb strong {
    font-size: 14px;
  }
  .topbar-right {
    gap: 10px;
  }
  .settings-mini {
    width: 44px;
  }
  .status-chip {
    font-size: 10px;
  }
  .welcome {
    width: calc(100% - 40px);
    margin: 26px auto 22px;
  }
  .welcome h1 {
    font-size: 31px;
    margin: 10px 0;
  }
  .welcome > p {
    font-size: 14px;
    line-height: 1.55;
  }
  .conversation {
    width: calc(100% - 24px);
    border-radius: 20px;
  }
  .has-history .conversation {
    margin-top: 16px;
  }
  .chat-header {
    padding: 16px;
    gap: 10px;
  }
  .chat-header p {
    font-size: 11px;
  }
  .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 11px;
  }
  .voice-button {
    min-height: 46px;
    padding: 10px 13px;
    font-size: 12px;
  }
  .messages {
    padding: 20px 16px;
    height: clamp(200px, 29dvh, 340px);
  }
  .has-history .messages {
    height: clamp(250px, 48dvh, 620px);
  }
  .empty-chat {
    font-size: 13px;
  }
  .empty-chat > p {
    margin-bottom: 16px;
  }
  .starter-options {
    gap: 7px;
  }
  .starter-chip {
    font-size: 12px;
    padding: 9px 12px;
  }
  .bubble {
    max-width: 94%;
    font-size: 15px;
    padding: 12px 15px;
  }
  .composer {
    padding: 14px 16px;
    gap: 10px;
  }
  .disclaimer {
    font-size: 10px;
    padding: 0 18px 16px;
  }
  .onboarding {
    width: calc(100% - 40px);
    margin-top: 16px;
    gap: 10px;
  }
  .onboarding > p {
    font-size: 12px;
  }
  .onboarding-actions {
    width: 100%;
  }
  .onboarding button {
    font-size: 12px;
  }
  .auth-card {
    margin: 24px auto;
    padding: 28px 24px;
  }
  .auth-card h1 {
    font-size: 36px;
  }
  .overlay {
    padding: 10px;
  }
  .settings-panel {
    width: 100%;
    max-height: 94dvh;
    padding: 24px 20px;
    border-radius: 22px;
  }
  .settings-header {
    gap: 12px;
  }
  .settings-header h2 {
    font-size: 23px;
  }
  .check-grid {
    grid-template-columns: 1fr;
  }
  .check-grid label {
    font-size: 14px;
  }
  .results-dialog,
  .consent-dialog {
    padding: 24px 20px;
  }
  .results-dialog h2,
  .consent-dialog h2 {
    font-size: 24px;
  }
  .voice-banner {
    margin: 12px 16px 0;
    padding: 16px;
  }
}
@media (max-width: 360px) {
  .chat-header {
    flex-wrap: wrap;
  }
  .chat-actions {
    width: 100%;
  }
  .voice-button {
    width: 100%;
  }
  .settings-panel {
    padding: 20px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.hidden {
  display: none !important;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger-ink);
  outline-color: #b423244d;
}
.settings-header {
  position: sticky;
  top: -1px;
  z-index: 2;
  background: var(--paper);
  padding-bottom: 12px;
}

.thinking-status {
  margin: 0;
  padding: 14px 22px;
  color: var(--secondary-ink);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--blue-bg);
  border-top: 1px solid var(--line);
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking 1.4s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.thinking-dots i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes thinking {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.assistant-guide {
  width: min(860px, calc(100% - 80px));
  margin: 20px auto 0;
  padding: 0 2px;
}
.assistant-guide summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--secondary-ink);
  line-height: 1.5;
}
.assistant-guide summary:focus-visible {
  outline: 3px solid var(--blue-line);
  outline-offset: 3px;
  border-radius: 8px;
}
.assistant-guide p {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 12px;
}
.assistant-guide .guide-hint {
  font-size: 12px;
}
.guide-examples {
  display: grid;
  gap: 8px;
  padding: 4px 0 12px;
}
.guide-examples button {
  text-align: left;
  border-radius: 12px;
  padding: 14px 16px;
}
#themeSelect {
  margin-top: 8px;
}
@media (max-width: 760px) {
  .assistant-guide {
    width: calc(100% - 40px);
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-dots i {
    animation: none;
    opacity: 1;
  }
}

.messages:focus-visible {
  outline: 2px solid var(--blue-line);
  outline-offset: -2px;
}
.composer .attach-button {
  background: var(--control);
  color: var(--secondary-ink);
  font-size: 26px;
}
.attach-menu {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}
.attach-menu button {
  margin: 0 8px 8px 0;
}
.attach-menu p,
.attachment-note {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 6px 0 0;
}
.attachment-panel {
  padding: 16px 22px;
  background: var(--blue-bg);
  border-top: 1px solid var(--line);
}
#attachmentStatus {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 12px;
}
.attachment-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.attachment-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.attachment-item > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}
.remove-attachment {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  color: var(--secondary-ink);
  background: var(--control);
  font-size: 22px;
}
.attachment-panel .check-label {
  font-size: 13px;
  line-height: 1.5;
}
.message-attachments {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--blue-line);
  white-space: normal;
}
.message-attachments small {
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 760px) {
  .composer {
    gap: 8px;
  }
  .attachment-panel,
  .attach-menu {
    padding: 16px;
  }
  .composer .attach-button {
    flex-basis: 36px;
    width: 36px;
  }
}
.has-attachments .welcome {
  display: none;
}
.has-attachments .conversation {
  margin-top: 24px;
}
.has-attachments .messages:has(.empty-chat) {
  height: 120px;
}
.has-attachments .empty-chat .starter-options {
  display: none;
}
.has-attachments .empty-chat > p {
  margin: 0;
}
@media (max-width: 760px) {
  .has-attachments .conversation {
    margin-top: 16px;
  }
  .has-attachments .messages:has(.empty-chat) {
    height: 100px;
  }
}
.has-attachments.has-history .messages {
  height: clamp(180px, 30dvh, 360px);
}
@media (max-width: 760px) {
  .has-attachments.has-history .messages {
    height: clamp(140px, 24dvh, 260px);
  }
}
.bubble .memory-action {
  display: block;
  margin-top: 12px;
  padding: 8px 12px;
  min-height: 44px;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  white-space: normal;
  background: var(--paper);
  color: var(--accent-ink);
  border: 1px solid var(--line);
}
.memory-draft-notice {
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--blue-line);
  border-radius: 14px;
  background: var(--blue-bg);
}
.memory-draft-notice strong {
  display: block;
  font-size: 15px;
  line-height: 1.5;
}
.memory-draft-notice p {
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--secondary-ink);
}
.memory-draft-notice summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font-size: 13px;
  color: var(--accent-ink);
}
#memorySourceText {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
#memoryCounter {
  margin: -8px 0 0;
  text-align: right;
  font-size: 12px;
}

.search-permission {
  margin: 0;
  padding: 4px 20px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.search-permission button {
  display: inline;
  min-height: 44px;
  padding: 4px 0;
  background: transparent;
  color: var(--accent-ink);
  border: 0;
  font-size: inherit;
}

.citation {
  color: var(--accent-ink);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.search-intro {
  width: min(860px, calc(100% - 80px));
  margin: 0 auto 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.has-history .search-intro {
  margin-top: 24px;
}
.has-history .search-intro:not(.hidden) + .conversation {
  margin-top: 0;
}
.search-intro h2 {
  font-size: 23px;
  line-height: 1.3;
  margin: 10px 0 12px;
  letter-spacing: -0.4px;
}
.search-intro p {
  line-height: 1.6;
  margin: 12px 0;
}
.search-intro .search-intro-privacy {
  font-size: 13px;
  color: var(--secondary-ink);
}
.search-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 12px;
}
.search-intro .search-intro-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
}
.search-intro .form-error:empty {
  display: none;
}
@media (max-width: 640px) {
  .search-intro {
    width: calc(100% - 24px);
    padding: 20px;
  }
  .search-intro h2 {
    font-size: 21px;
  }
  .search-intro-actions {
    flex-direction: column;
  }
  .search-intro-actions button {
    width: 100%;
  }
}

.message-menu {
  margin-top: 8px;
}
.message-menu summary {
  color: var(--muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  list-style: none;
}
.message-menu summary::-webkit-details-marker {
  display: none;
}
.auto-memory-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.auto-memory-note button {
  display: inline-block;
  min-height: 44px;
  background: transparent;
  color: var(--accent-ink);
  border: 0;
  padding: 4px 8px;
  font-size: 12px;
}
.auto-memory-list {
  margin: 20px 0;
}
#manualMemoryEditor > summary,
.auto-memory-blocked > summary {
  min-height: 44px;
  cursor: pointer;
  padding: 12px 0;
  color: var(--accent-ink);
}
#manualMemoryEditor[open] > summary {
  margin-bottom: 16px;
}
.memory-item select {
  width: 100%;
  margin: 12px 0;
}

.auto-memory-note small {
  font-size: 12px;
  line-height: 1.5;
}
