:root {
  color-scheme: dark;
  --bg: #080908;
  --surface: #111311;
  --surface-raised: #191c19;
  --surface-hover: #202420;
  --border: #303630;
  --border-strong: #4a514a;
  --text: #f4f5ef;
  --text-soft: #b8beb8;
  --text-muted: #858b85;
  --accent: #76d3a3;
  --accent-strong: #9be5bc;
  --accent-ink: #07150d;
  --danger: #ff8e8e;
  --danger-bg: #35191b;
  --warning: #efc477;
  --app-height: 100vh;
  --viewport-top: 0px;
  --content-width: 780px;
  --composer-height: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

@supports (height: 100dvh) {
  :root { --app-height: 100dvh; }
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  min-width: 280px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  position: fixed;
  z-index: 0;
  top: var(--viewport-top);
  right: 0;
  left: 0;
  width: 100%;
  height: var(--app-height);
  min-height: 320px;
  overflow: hidden;
  background: var(--bg);
}

.screen,
.chat-screen {
  position: relative;
  width: 100%;
  height: 100%;
}

.screen--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
}

.boot-label {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.screen--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(32px, calc(24px + env(safe-area-inset-top))) max(24px, calc(20px + env(safe-area-inset-right))) max(28px, calc(20px + env(safe-area-inset-bottom))) max(24px, calc(20px + env(safe-area-inset-left)));
  overscroll-behavior: contain;
}

.auth-panel {
  width: min(100%, 390px);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 42px;
}

.brand-lockup--compact {
  margin-bottom: 32px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: #0d0f0d;
}

.brand-mark__logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.brand-mark span {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 37px;
  line-height: 1;
}

.brand-mark i {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  height: 3px;
  background: var(--accent);
}

.brand-mark--small {
  width: 44px;
  height: 44px;
}

.brand-mark--small span {
  font-size: 29px;
}

.brand-mark--small i {
  right: 9px;
  bottom: 9px;
  left: 9px;
  height: 2px;
}

.brand-name {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.auth-heading {
  margin-bottom: 30px;
}

.auth-heading h1 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.12;
}

.auth-heading p,
.modal__surface > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field > span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 14px;
  font-size: 16px;
  transition: border-color 140ms ease, background 140ms ease;
}

.field input:hover {
  border-color: var(--border-strong);
}

.field input:focus {
  border-color: var(--accent);
  background: #141714;
}

.field input:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.code-input {
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 25px !important;
}

.form-message {
  min-height: 20px;
  margin: 2px 0 14px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.danger-button,
.drawer-new-button,
.logout-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.primary-button--compact {
  width: auto;
  min-width: 104px;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-hover);
}

.danger-button {
  border: 1px solid #9c4248;
  background: #7d3036;
  color: #fff;
}

.danger-button:hover {
  background: #963a42;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.logout-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.danger-button:active:not(:disabled),
.drawer-new-button:active:not(:disabled) {
  transform: translateY(1px);
}

.text-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 8px 0;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  color: #c1f2d7;
}

.text-button--muted {
  color: var(--text-muted);
}

.text-button--muted:hover {
  color: var(--text-soft);
}

.auth-panel form + .text-button {
  margin-top: 12px;
}

.privacy-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.chat-screen {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--bg);
}

.top-bar {
  position: relative;
  z-index: 5;
  display: grid;
  flex: 0 0 auto;
  min-height: calc(58px + env(safe-area-inset-top));
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: end;
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 7px max(8px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(255, 255, 255, .055);
  background: rgba(8, 9, 8, .96);
}

.conversation-title-area {
  position: relative;
  min-width: 0;
  align-self: center;
}

.conversation-title-heading {
  min-width: 0;
  margin: 0;
}

.conversation-title-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 10px;
  cursor: pointer;
}

.conversation-title-button:hover,
.conversation-title-button[aria-expanded="true"] {
  background: var(--surface-hover);
}

.conversation-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}

.top-bar > .chat-notice {
  display: grid;
  grid-column: 3;
  grid-row: 1;
  place-items: center;
  align-self: center;
  justify-self: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.menu-icon span,
.menu-icon span::before,
.menu-icon span::after {
  display: block;
  width: 19px;
  height: 1.5px;
  background: currentColor;
  content: "";
}

.menu-icon span::before { transform: translateY(-6px); }
.menu-icon span::after { transform: translateY(4.5px); }

.plus-icon span {
  display: block;
  height: 28px;
  font-size: 28px;
  font-weight: 300;
  line-height: 24px;
}

.close-icon span {
  height: 29px;
  font-size: 30px;
  font-weight: 250;
  line-height: 25px;
}

.connection-strip,
.chat-notice {
  flex: 0 0 auto;
  padding: 8px max(18px, calc(12px + env(safe-area-inset-right))) 8px max(18px, calc(12px + env(safe-area-inset-left)));
  background: #3a2c17;
  color: #f8dca8;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
}

.chat-notice {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 2px max(12px, calc(8px + env(safe-area-inset-right))) 2px max(12px, calc(8px + env(safe-area-inset-left)));
  background: transparent;
}

.notice-indicator,
.scroll-to-latest {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #48634f;
  border-radius: 50%;
  background: #16241a;
  color: #b7e8cc;
  cursor: pointer;
}

.notice-indicator span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.notice-indicator:hover,
.scroll-to-latest:hover {
  border-color: var(--accent);
  background: #1d3023;
  color: #d6f5e1;
}

.transcript {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px max(16px, calc(12px + env(safe-area-inset-right))) 12px max(16px, calc(12px + env(safe-area-inset-left)));
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scrollbar-color: var(--border) transparent;
}

.empty-state {
  display: flex;
  width: min(100%, var(--content-width));
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 22px;
  margin: 0 auto;
  padding: 48px 12px 82px;
  text-align: center;
}

.brand-mark--empty {
  width: 52px;
  height: 52px;
  border-color: var(--border);
  background: transparent;
}

.brand-mark--empty span { font-size: 33px; }
.brand-mark--empty i { right: 11px; bottom: 10px; left: 11px; }

.empty-state h2 {
  max-width: 310px;
  margin: 0;
  color: #dddfd8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.25;
}

.message {
  position: relative;
  width: min(100%, var(--content-width));
  margin: 0 auto 24px;
  font-size: 16px;
  line-height: 1.62;
}

.message--user {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  justify-content: flex-end;
}

.message__body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message--user .message__body {
  max-width: min(86%, 620px);
  border: 1px solid #303630;
  border-radius: 8px;
  background: #1b1e1b;
  padding: 10px 14px;
  color: var(--text);
}

.message--assistant {
  padding-right: 40px;
}

.message--assistant .message__body {
  color: #e5e7e1;
}

.message__timestamp {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  color: #747b74;
  font-size: 10px;
  line-height: 1.25;
  text-align: right;
}

.message--assistant .message__timestamp {
  padding-right: 40px;
}

.reasoning-summary {
  margin: 0 0 12px;
  border-left: 2px solid #3f6953;
  padding-left: 12px;
  color: var(--text-soft);
}

.reasoning-summary summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: #a8cfb9;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  list-style-position: inside;
}

.reasoning-summary__content {
  overflow-wrap: anywhere;
  padding: 0 0 9px;
  color: #b9c2bb;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.web-search-status {
  display: flex;
  min-height: 28px;
  align-items: center;
  margin: 0 0 8px;
  color: #a8cfb9;
  font-size: 13px;
  font-weight: 600;
}

.message-sources {
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding-top: 11px;
}

.message-sources h3 {
  margin: 0 0 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.message-sources ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.message-sources a {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #a8cfb9;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: underline;
  text-decoration-color: #527561;
  text-underline-offset: 3px;
}

.message-sources a:hover {
  color: var(--accent-strong);
}

.message--pending .message__body {
  opacity: .74;
}

.message--failed .message__body {
  border-color: #6e393d;
}

.message--unknown .message__body {
  border-color: #8a6a36;
  border-style: dashed;
}

.message__status {
  max-width: min(86%, 620px);
  margin: 6px 0 0;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.message__status--assistant {
  max-width: 100%;
  color: var(--warning);
  text-align: left;
}

.load-older-messages {
  display: block;
  min-height: 44px;
  margin: 0 auto 22px;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.load-older-messages:hover {
  color: var(--text-soft);
}

.message-copy {
  position: absolute;
  top: -9px;
  right: -4px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}

.message:hover .message-copy,
.message-copy:focus-visible {
  opacity: 1;
}

.message-copy:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.copy-glyph {
  position: relative;
  width: 14px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.copy-glyph::before {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 11px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right: 0;
  border-bottom: 0;
  border-radius: 2px 0 0;
  content: "";
}

.typing {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
}

.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: typing 1.25s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 130ms; }
.typing span:nth-child(3) { animation-delay: 260ms; }

@keyframes typing {
  0%, 65%, 100% { opacity: .3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.send-error {
  width: min(calc(100% - 32px), var(--content-width));
  flex: 0 0 auto;
  margin: 0 auto 8px;
  border-left: 3px solid var(--danger);
  background: var(--danger-bg);
  padding: 10px 13px;
}

.send-error p {
  margin: 0;
  color: #ffd1d1;
  font-size: 13px;
  line-height: 1.4;
}

.send-error__actions {
  display: flex;
  gap: 18px;
  margin-top: 2px;
}

.chat-settings {
  flex: 0 0 auto;
  border-top: 1px solid rgba(255, 255, 255, .055);
  background: transparent;
  padding: 12px 4px;
}

.chat-settings__controls {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin: 0 auto;
}

.settings-panel {
  min-width: 0;
}

.settings-panel__heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  margin: -4px 0 8px;
}

.settings-panel__heading .title-settings__title {
  grid-column: 2;
  margin: 0;
  text-align: center;
}

.settings-back-button {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.settings-back-button span {
  width: 10px;
  height: 10px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.settings-nav-button {
  display: flex;
  min-width: 0;
  min-height: 52px;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 7px 12px;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}

.settings-nav-button > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.settings-nav-button strong {
  font-size: 12px;
  font-weight: 650;
}

.settings-nav-button small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-nav-button > i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.settings-field {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  gap: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.settings-field select,
.settings-field input,
.domain-editor__add input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}

.settings-field select:focus-visible,
.settings-field input:focus-visible,
.domain-editor__add input:focus-visible,
.settings-nav-button:focus-visible,
.settings-back-button:focus-visible,
.settings-text-button:focus-visible,
.domain-list__item button:focus-visible,
.domain-editor__add button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.settings-location-grid {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.settings-location-grid .settings-text-button {
  grid-column: 1 / -1;
}

.settings-text-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.domain-editor {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.domain-editor[data-active="true"] {
  border-top-color: rgba(83, 222, 137, .45);
}

.domain-editor__heading,
.domain-list__item,
.domain-editor__add {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.domain-editor__heading {
  color: var(--text-soft);
  font-size: 12px;
}

.domain-editor__heading span {
  color: var(--text-muted);
}

.domain-list {
  display: grid;
  gap: 4px;
}

.domain-list__item {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding-left: 10px;
}

.domain-list__item span {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 12px;
}

.domain-list__item button,
.domain-editor__add button {
  min-width: 64px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
}

.domain-editor__add input {
  flex: 1 1 auto;
}

.settings-validation {
  margin: 10px 0 0;
  color: #ffb4b4;
  font-size: 11px;
  line-height: 1.4;
}

.settings-nav-button:disabled,
.settings-text-button:disabled,
.domain-list__item button:disabled,
.domain-editor__add button:disabled {
  cursor: default;
  opacity: .58;
}

.compact-select {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 8px 0 10px;
}

.compact-select > span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.compact-select select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.compact-select:focus-within {
  border-color: #687268;
}

.thinking-toggle {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 44px;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 10px;
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
}

.thinking-toggle input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.thinking-toggle__track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid #505650;
  border-radius: 10px;
  background: #272b27;
  transition: background 140ms ease, border-color 140ms ease;
  pointer-events: none;
}

.thinking-toggle__track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c5c9c5;
  transition: transform 140ms ease, background 140ms ease;
}

.thinking-toggle input:checked + .thinking-toggle__track {
  border-color: var(--accent);
  background: #24553a;
}

.thinking-toggle input:checked + .thinking-toggle__track i {
  background: var(--accent-strong);
  transform: translateX(14px);
}

.thinking-toggle input:focus-visible + .thinking-toggle__track {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.thinking-toggle:has(input:disabled),
.compact-select:has(select:disabled) {
  cursor: default;
  opacity: .58;
}

.setting-option {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  gap: 4px;
}

.setting-option__description {
  margin: 0 3px;
  color: #747b74;
  font-size: 11px;
  line-height: 1.3;
}

.web-settings__controls > .setting-option__description {
  width: 100%;
  min-width: 0;
  max-width: none;
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.web-settings__controls .setting-option,
.web-settings__controls .settings-field,
.web-settings__controls .settings-nav-button,
.web-settings__controls .settings-location-grid {
  width: 100%;
  min-width: 0;
}

.chat-settings__description {
  width: 100%;
  margin: 7px 0 0;
  color: #747b74;
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
}

.composer {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  margin-top: auto;
  padding: 4px max(8px, calc(6px + env(safe-area-inset-right))) max(4px, env(safe-area-inset-bottom)) max(8px, calc(6px + env(safe-area-inset-left)));
  background: var(--bg);
}

.composer__surface {
  display: flex;
  width: min(calc(100% - 2px), var(--content-width));
  min-height: 52px;
  align-items: flex-end;
  gap: 8px;
  margin: 0 auto;
  border: 1px solid #5f866c;
  border-radius: 22px;
  background: var(--surface);
  padding: 6px 6px 6px 15px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.composer__surface:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(118, 211, 163, .28);
}

.scroll-to-latest {
  position: absolute;
  z-index: 8;
  bottom: calc(var(--composer-height) + max(4px, env(safe-area-inset-bottom)) + 8px);
  left: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .35);
  transform: translateX(-50%);
}

.scroll-to-latest span {
  width: 11px;
  height: 11px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.composer textarea {
  width: 100%;
  min-height: 38px;
  max-height: 170px;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 0 7px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

.composer textarea::placeholder {
  color: var(--text-muted);
}

.composer textarea:disabled {
  opacity: .6;
}

.send-button,
.cancel-stream-button {
  position: relative;
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.send-button span {
  position: relative;
  width: 14px;
  height: 14px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(3px) rotate(45deg);
}

.send-button span::after {
  position: absolute;
  top: 5px;
  left: -3px;
  width: 17px;
  height: 2px;
  background: currentColor;
  content: "";
  transform: rotate(-45deg);
  transform-origin: center;
}

.cancel-stream-button {
  border: 1px solid var(--border-strong);
  background: #d8dbd5;
  color: #171a17;
}

.cancel-stream-button span {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: currentColor;
}

.send-button:hover:not(:disabled) { background: var(--accent-strong); }
.cancel-stream-button:hover:not(:disabled) { background: #f0f2ed; }
.send-button:active:not(:disabled),
.cancel-stream-button:active:not(:disabled) { transform: scale(.96); }
.send-button:disabled,
.cancel-stream-button:disabled { cursor: default; opacity: .24; }

dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(2px);
}

.drawer {
  width: min(88vw, 360px);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 auto 0 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  padding: 0;
  transform: translateX(-102%);
  transition: transform 190ms ease, display 190ms allow-discrete, overlay 190ms allow-discrete;
}

.drawer[open] {
  transform: translateX(0);
}

@starting-style {
  .drawer[open] { transform: translateX(-102%); }
}

.drawer__panel {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
  padding: max(8px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border-right: 1px solid var(--border);
  background: #0e100e;
  overscroll-behavior: contain;
}

.drawer__header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 0 8px;
}

.drawer__header h2,
.modal h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
}

.drawer-new-button {
  width: 100%;
  justify-content: flex-start;
  gap: 11px;
  margin: 8px 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.drawer-new-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.drawer-new-button > span[aria-hidden="true"] {
  color: var(--accent);
  font-size: 24px;
  font-weight: 300;
}

.conversation-nav {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 0 16px;
  overscroll-behavior: contain;
}

.title-settings {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 50%;
  width: min(340px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(var(--app-height) - env(safe-area-inset-top) - 76px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #111411;
  padding: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .48);
  transform: translateX(-50%);
  overscroll-behavior: contain;
}

.title-settings__title {
  margin: 0 2px 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 680;
}

.title-settings .chat-settings__controls {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.title-settings .thinking-toggle {
  grid-column: 1 / -1;
}

.conversation-list {
  display: grid;
  gap: 3px;
}

.conversation-item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  align-items: center;
  border-radius: 6px;
}

.conversation-item:hover,
.conversation-item--active {
  background: var(--surface-hover);
}

.conversation-open,
.conversation-action {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.conversation-open {
  min-width: 0;
  overflow: hidden;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.conversation-action {
  display: grid;
  width: 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 18px;
}

.conversation-action:hover {
  color: var(--text);
}

.conversation-action--delete:hover {
  color: var(--danger);
}

.edit-glyph {
  width: 14px;
  height: 4px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  transform: rotate(-45deg);
}

.trash-glyph {
  position: relative;
  width: 12px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}

.trash-glyph::before {
  position: absolute;
  top: -4px;
  left: -3px;
  width: 15px;
  height: 1.5px;
  background: currentColor;
  content: "";
}

.conversation-empty {
  padding: 28px 12px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.load-more-button {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.drawer__footer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding: 12px 4px 0 8px;
}

.account-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.account-summary span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.language-selector {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.language-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
}

.language-button:hover {
  background: var(--surface-hover);
}

.language-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(83, 222, 137, .1);
}

.language-button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.logout-button {
  min-width: 78px;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.logout-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal {
  width: min(calc(100% - 32px), 420px);
  max-width: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0;
}

.modal__surface {
  margin: 0;
  padding: 22px;
}

.modal__surface--compact {
  max-width: 360px;
}

.modal--help {
  width: min(calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)), 560px);
  max-height: min(calc(var(--app-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 720px);
  overflow: hidden;
}

.help-dialog__surface {
  display: flex;
  max-height: inherit;
  flex-direction: column;
  padding: 0;
}

.help-dialog__header {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 8px 20px;
}

.help-dialog__header h2 {
  margin: 0;
}

.help-dialog__content {
  overflow-y: auto;
  padding: 16px 20px 22px;
  overscroll-behavior: contain;
}

.help-dialog__intro {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.help-dialog__content details {
  border-top: 1px solid var(--border);
}

.help-dialog__content summary {
  min-height: 44px;
  padding: 12px 22px 12px 0;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 680;
}

.help-dialog__content details > div {
  padding: 0 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.help-dialog__content p {
  margin: 0 0 10px;
}

.settings-help-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.settings-help-button:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.modal h2 {
  margin-bottom: 18px;
}

.modal__surface > p {
  margin: -6px 0 18px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.modal__actions .secondary-button,
.modal__actions .danger-button {
  min-width: 92px;
}

.toast-region {
  position: fixed;
  z-index: 50;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  left: max(12px, env(safe-area-inset-left));
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  width: min(100%, 420px);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #202420;
  padding: 11px 14px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .35);
  color: var(--text);
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  animation: toast-in 180ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 800px) {
  .top-bar {
    padding-right: 20px;
    padding-left: 20px;
  }

  .transcript {
    padding-top: 34px;
  }

  .message {
    margin-bottom: 29px;
  }

  .composer {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (min-width: 600px) {
  .chat-settings__controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(170px, 1.2fr);
  }

  .thinking-toggle {
    grid-column: auto;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .screen--auth {
    justify-content: flex-start;
  }

  .brand-lockup {
    flex-direction: row;
    align-items: center;
    margin-bottom: 20px;
  }

  .auth-heading {
    margin-bottom: 18px;
  }

  .chat-settings__description {
    display: none;
  }

  .empty-state {
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

@media (max-width: 360px) {
  .auth-heading h1 {
    font-size: 28px;
  }

  .conversation-title {
    font-size: 14px;
  }

  .message--user .message__body {
    max-width: 92%;
  }

  .composer {
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

}

@media (hover: none) {
  .message-copy {
    opacity: .74;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
