:root {
  --bg: #f2f3f5;
  --panel: #f8f8f9;
  --panel-solid: #ffffff;
  --sidebar: #eaebee;
  --raised: #ffffff;
  --subtle: #eef0f3;
  --hover: #e2e5e9;
  --text: #181a1f;
  --text-soft: #575c66;
  --text-faint: #7b818d;
  --line: #d9dce2;
  --line-strong: #c5c9d1;
  --accent: #516b91;
  --accent-soft: #e2e8f1;
  --accent-ink: #3e577c;
  --success: #367159;
  --success-soft: #dfece5;
  --warning: #a36225;
  --warning-soft: #f3e7d7;
  --danger: #a5433f;
  --danger-soft: #f3dfdc;
  --shadow-menu: 0 18px 48px rgb(34 31 27 / 14%), 0 2px 8px rgb(34 31 27 / 8%);
  --shadow-composer: 0 12px 36px rgb(39 35 30 / 8%);
  --sidebar-width: 264px;
  --content-width: 880px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* User-curated cloud model library */
.model-catalog-open {
  display: grid;
  width: calc(100% - 16px);
  min-height: 48px;
  margin: 6px 8px 3px;
  padding: 8px 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--text-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.model-catalog-open:hover,
.model-catalog-open:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  background: var(--hover);
}

.model-catalog-open > span:first-child {
  color: var(--accent);
  font-size: 1.15rem;
  text-align: center;
}

.model-catalog-open strong,
.model-catalog-open small {
  display: block;
}

.model-catalog-open strong {
  font-size: .75rem;
}

.model-catalog-open small {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: .63rem;
}

.model-catalog-dialog {
  width: min(660px, calc(100vw - 28px));
  max-height: min(780px, calc(100dvh - 28px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
}

.model-catalog-dialog::backdrop {
  background: rgb(5 6 5 / 62%);
}

.model-catalog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.model-catalog-head h2 {
  margin: 3px 0 7px;
  font-size: 1.25rem;
  font-weight: 600;
}

.model-catalog-head p:last-child {
  max-width: 480px;
  margin: 0;
  color: var(--text-muted);
  font-size: .78rem;
  line-height: 1.55;
}

.model-catalog-search-wrap {
  position: relative;
  margin: 18px 22px 10px;
}

.model-catalog-search-wrap svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.5;
  transform: translateY(-50%);
  pointer-events: none;
}

.model-catalog-search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: var(--panel);
}

.model-catalog-search-wrap input:focus {
  border-color: var(--accent);
}

.model-catalog-list {
  max-height: min(500px, calc(100dvh - 260px));
  padding: 6px 14px 12px;
  overflow: auto;
}

.model-catalog-item {
  position: relative;
  display: grid;
  min-height: 66px;
  padding: 10px 12px;
  grid-template-columns: 34px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.model-catalog-item:hover {
  background: var(--hover);
}

.model-catalog-glyph {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  font-size: .71rem;
  font-weight: 700;
}

.model-catalog-copy strong,
.model-catalog-copy small {
  display: block;
}

.model-catalog-copy strong {
  font-size: .82rem;
  font-weight: 600;
}

.model-catalog-copy small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .69rem;
  line-height: 1.35;
}

.model-catalog-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.model-catalog-switch {
  position: relative;
  width: 34px;
  height: 19px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  transition: background .18s ease, border-color .18s ease;
}

.model-catalog-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform .18s ease, background .18s ease;
}

.model-catalog-item input:checked + .model-catalog-switch {
  border-color: var(--accent);
  background: var(--accent);
}

.model-catalog-item input:checked + .model-catalog-switch::after {
  background: var(--bg);
  transform: translateX(15px);
}

.model-catalog-empty {
  padding: 42px 16px;
  color: var(--text-muted);
  text-align: center;
}

.model-catalog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: .72rem;
}

.model-catalog-foot button {
  min-width: 88px;
  height: 36px;
  border: 1px solid var(--text);
  border-radius: 7px;
  color: var(--bg);
  background: var(--text);
  cursor: pointer;
}

@media (max-width: 600px) {
  .model-catalog-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .model-catalog-head {
    padding: 21px 20px 16px;
  }

  .model-catalog-search-wrap {
    margin-inline: 14px;
  }

  .model-catalog-list {
    padding-inline: 7px;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0f12;
  --panel: #111317;
  --panel-solid: #181b20;
  --sidebar: #090b0e;
  --raised: #1d2026;
  --subtle: #1b1e24;
  --hover: #22262d;
  --text: #f0f1f3;
  --text-soft: #adb2bb;
  --text-faint: #737a86;
  --line: #282c33;
  --line-strong: #3a3f49;
  --accent: #91a8ca;
  --accent-soft: #202a39;
  --accent-ink: #b5c5dc;
  --success: #78b697;
  --success-soft: #1f392d;
  --warning: #d79a5f;
  --warning-soft: #402e1d;
  --danger: #df8880;
  --danger-soft: #442522;
  --shadow-menu: 0 20px 52px rgb(0 0 0 / 34%), 0 2px 8px rgb(0 0 0 / 26%);
  --shadow-composer: 0 12px 36px rgb(0 0 0 / 20%);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0d0f12;
    --panel: #111317;
    --panel-solid: #181b20;
    --sidebar: #090b0e;
    --raised: #1d2026;
    --subtle: #1b1e24;
    --hover: #22262d;
    --text: #f0f1f3;
    --text-soft: #adb2bb;
    --text-faint: #737a86;
    --line: #282c33;
    --line-strong: #3a3f49;
    --accent: #91a8ca;
    --accent-soft: #202a39;
    --accent-ink: #b5c5dc;
    --success: #78b697;
    --success-soft: #1f392d;
    --warning: #d79a5f;
    --warning-soft: #402e1d;
    --danger: #df8880;
    --danger-soft: #442522;
    --shadow-menu: 0 20px 52px rgb(0 0 0 / 34%), 0 2px 8px rgb(0 0 0 / 26%);
    --shadow-composer: 0 12px 36px rgb(0 0 0 / 20%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
  background: var(--bg);
}

button,
textarea,
input {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

button:not(:disabled),
a,
select {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--text);
  background: var(--accent-soft);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 50%;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: var(--panel-solid);
  background: var(--text);
  font-size: .82rem;
  font-weight: 650;
  text-decoration: none;
  transform: translate(-50%, -160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: .98rem;
  font-weight: 710;
  letter-spacing: -.025em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  color: var(--panel-solid);
  background: var(--text);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: none;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: var(--text-soft);
  background: transparent;
  transition: color 140ms ease, background 140ms ease;
}

.icon-button:hover {
  color: var(--text);
  background: var(--hover);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.sidebar-close {
  display: none;
}

.new-chat-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  margin: 3px 12px 18px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel);
  font-size: .83rem;
  font-weight: 620;
  text-align: left;
  transition: border 140ms ease, background 140ms ease, transform 140ms ease;
}

.new-chat-button:hover {
  border-color: var(--text-faint);
  background: var(--panel-solid);
}

.new-chat-button:active {
  transform: translateY(1px);
}

.new-chat-button svg {
  width: 17px;
  height: 17px;
}

.new-chat-button span {
  flex: 1;
}

.new-chat-button kbd {
  color: var(--text-faint);
  font-family: var(--font);
  font-size: .69rem;
  font-weight: 500;
}

.history-heading {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px 0 19px;
  color: var(--text-faint);
  font-size: .69rem;
  font-weight: 680;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.history-heading .icon-button {
  width: 30px;
  height: 30px;
}

.history-heading .icon-button svg {
  width: 15px;
  height: 15px;
}

.history-search {
  position: relative;
  margin: 2px 12px 9px;
}

.history-search svg {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.history-search input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--panel);
  font-size: .78rem;
}

.history-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.history-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.history-group + .history-group {
  margin-top: 14px;
}

.history-group-title {
  display: block;
  padding: 7px 10px 5px;
  color: var(--text-faint);
  font-size: .69rem;
  font-weight: 560;
}

.history-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  border-radius: 9px;
}

.history-item:hover,
.history-item.is-active {
  background: var(--hover);
}

.history-open {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 10px 34px 10px 10px;
  color: var(--text-soft);
  background: transparent;
  font-size: .79rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item.is-active .history-open {
  color: var(--text);
  font-weight: 570;
}

.history-delete {
  position: absolute;
  right: 4px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 7px;
  color: var(--text-faint);
  background: var(--hover);
  opacity: 0;
}

.history-item:hover .history-delete,
.history-delete:focus-visible {
  opacity: 1;
}

.history-delete:hover {
  color: var(--danger);
}

.history-delete svg {
  width: 14px;
  height: 14px;
}

.history-empty {
  margin: 16px 10px;
  color: var(--text-faint);
  font-size: .77rem;
  line-height: 1.5;
}

.sidebar-footer {
  padding: 9px 11px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.local-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 11px;
  color: var(--text-faint);
  font-size: .68rem;
  line-height: 1.35;
}

.local-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.sidebar-action {
  display: flex;
  width: 100%;
  height: 37px;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--text-soft);
  background: transparent;
  font-size: .77rem;
  text-align: left;
}

.sidebar-action:hover {
  color: var(--text);
  background: var(--hover);
}

.sidebar-action > svg {
  width: 16px;
  height: 16px;
}

.sidebar-action-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-size: .64rem;
  font-weight: 720;
  text-align: center;
}

.toolbox-dialog {
  width: min(840px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
}

.toolbox-dialog::backdrop {
  background: rgb(0 0 0 / 58%);
  backdrop-filter: blur(5px);
}

.toolbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.toolbox-head h2 {
  margin: 4px 0 8px;
  font-size: 1.35rem;
  letter-spacing: -.03em;
}

.toolbox-head p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: var(--text-soft);
  font-size: .8rem;
  line-height: 1.55;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 20px 28px;
}

.tool-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
}

.tool-card:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.tool-card--ready {
  border-color: color-mix(in srgb, var(--success) 45%, var(--line));
  background: var(--success-soft);
}

.tool-card strong {
  font-size: .88rem;
}

.tool-card small {
  color: var(--text-soft);
  font-size: .72rem;
  line-height: 1.45;
}

.tool-card-status {
  color: var(--text-faint);
  font-size: .62rem;
  font-weight: 720;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tool-card--ready .tool-card-status {
  color: var(--success);
}

.toolbox-footnote {
  margin: 0;
  padding: 0 28px 26px;
  color: var(--text-faint);
  font-size: .68rem;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .toolbox-grid {
    grid-template-columns: 1fr;
  }

  .toolbox-head,
  .toolbox-grid {
    padding-right: 18px;
    padding-left: 18px;
  }

  .toolbox-footnote {
    padding-right: 18px;
    padding-left: 18px;
  }
}

.theme-icon,
.theme-icon svg {
  width: 16px;
  height: 16px;
}

.moon-icon {
  display: none;
}

:root[data-theme="dark"] .sun-icon {
  display: none;
}

:root[data-theme="dark"] .moon-icon {
  display: block;
}

.sidebar-scrim {
  display: none;
}

.main-panel {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px 8px 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 93%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-leading,
.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
}

.topbar-leading {
  gap: 10px;
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 9px;
}

.menu-button {
  display: none;
}

.conversation-identity {
  min-width: 0;
}

.conversation-identity h1 {
  overflow: hidden;
  margin: 0 0 3px;
  font-size: .86rem;
  font-weight: 650;
  letter-spacing: -.012em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-line {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: .67rem;
  line-height: 1.2;
  white-space: nowrap;
}

.route-line svg {
  width: 11px;
  height: 11px;
}

.route-node {
  color: var(--accent-ink);
  font-weight: 650;
}

.status-pill {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: transparent;
  font-size: .69rem;
  font-weight: 590;
  white-space: nowrap;
}

.status-pill:hover {
  border-color: var(--line-strong);
  background: var(--subtle);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.status-pill--checking .status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
  animation: soft-pulse 1.3s ease-in-out infinite;
}

.status-pill--offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.status-pill--busy .status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.mode-picker {
  position: relative;
}

.mode-trigger {
  display: flex;
  min-width: 174px;
  height: 47px;
  align-items: center;
  gap: 9px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-solid);
  text-align: left;
  transition: border 140ms ease, background 140ms ease;
}

.mode-trigger:hover,
.mode-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--raised);
}

.mode-symbol,
.option-glyph {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text-soft);
  background: var(--subtle);
  font-size: .66rem;
  font-weight: 760;
}

.mode-symbol,
.option-glyph--auto {
  border-color: transparent;
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.mode-trigger-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.mode-trigger-copy > span {
  font-size: .77rem;
  font-weight: 670;
  line-height: 1;
}

.mode-trigger-copy small {
  overflow: hidden;
  color: var(--text-faint);
  font-size: .61rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  transition: transform 140ms ease;
}

.mode-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(354px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 92px));
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
  transform-origin: top right;
  animation: menu-in 130ms ease-out;
}

.mode-menu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 9px 9px;
}

.mode-menu-head span {
  color: var(--text);
  font-size: .74rem;
  font-weight: 680;
}

.mode-menu-head small {
  color: var(--text-faint);
  font-size: .62rem;
}

.mode-menu-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--line);
}

.mode-menu-section {
  margin: 7px 8px 4px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: .59rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.mode-option {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.mode-option:hover,
.mode-option:focus-visible {
  background: var(--subtle);
}

.mode-option > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.mode-option strong {
  font-size: .76rem;
  font-weight: 680;
}

.mode-option small {
  color: var(--text-faint);
  font-size: .65rem;
}

.mode-option .check {
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
}

.mode-option[aria-selected="true"] .check {
  opacity: 1;
}

.mode-route-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: .63rem;
  line-height: 1.4;
}

.preview-label {
  flex: 0 0 auto;
  color: var(--accent-ink);
  font-weight: 710;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.conversation {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 max(24px, calc((100% - var(--content-width)) / 2));
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  scroll-behavior: smooth;
}

.empty-state {
  display: flex;
  width: min(100%, 720px);
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  padding: 58px 0 68px;
}

.empty-mark {
  display: grid;
  width: 39px;
  height: 39px;
  margin-bottom: 23px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--panel-solid);
}

.empty-mark svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-ink);
  font-size: .68rem;
  font-weight: 720;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.empty-state h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.45rem);
  font-weight: 400;
  letter-spacing: -.047em;
  line-height: 1;
}

.empty-copy {
  max-width: 565px;
  margin: 18px 0 30px;
  color: var(--text-soft);
  font-size: .9rem;
  line-height: 1.65;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.prompt-card {
  position: relative;
  display: flex;
  min-height: 94px;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 38px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  transition: border 140ms ease, background 140ms ease, transform 140ms ease;
}

.prompt-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-solid);
  transform: translateY(-1px);
}

.prompt-card span {
  font-size: .76rem;
  font-weight: 660;
  line-height: 1.3;
}

.prompt-card small {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: .64rem;
  line-height: 1.35;
}

.prompt-card svg {
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.message-list {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 32px 0 12px;
}

.message {
  position: relative;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  column-gap: 13px;
  padding: 17px 0 24px;
}

.message + .message {
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.message--user {
  display: flex;
  justify-content: flex-end;
  padding: 18px 0 22px;
  border-top: 0 !important;
}

.message-avatar {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--panel-solid);
}

.message-avatar svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
}

.message-column {
  min-width: 0;
}

.message-meta {
  display: flex;
  min-height: 27px;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: .65rem;
}

.message-meta strong {
  color: var(--text);
  font-size: .73rem;
  font-weight: 680;
}

.model-tag {
  overflow: hidden;
  max-width: 300px;
  padding: 3px 7px;
  border-radius: 99px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-size: .59rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-actions {
  display: flex;
  gap: 3px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 120ms ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
}

.message-action {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  color: var(--text-faint);
  background: transparent;
}

.message-action:hover {
  color: var(--text);
  background: var(--subtle);
}

.message-action svg {
  width: 14px;
  height: 14px;
}

.message-body {
  color: var(--text);
  font-size: .88rem;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.message--user .message-column {
  max-width: min(78%, 650px);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 15px 15px 5px 15px;
  background: var(--subtle);
}

.message--user .message-body {
  line-height: 1.56;
  white-space: pre-wrap;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.message-attachment {
  display: inline-flex;
  max-width: 240px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-soft);
  background: var(--panel);
  font-size: .63rem;
}

.message-attachment svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.message-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-body p {
  margin: 0 0 .8em;
}

.message-body p:last-child,
.message-body ul:last-child,
.message-body ol:last-child,
.message-body pre:last-child,
.message-body blockquote:last-child {
  margin-bottom: 0;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
  margin: 1.25em 0 .55em;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.message-body h1 { font-size: 1.3rem; }
.message-body h2 { font-size: 1.14rem; }
.message-body h3,
.message-body h4 { font-size: 1rem; }

.message-body ul,
.message-body ol {
  margin: .5em 0 1em;
  padding-left: 1.5em;
}

.message-body li + li {
  margin-top: .3em;
}

.message-body a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.message-body code {
  padding: .12em .34em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--subtle);
  font-family: var(--mono);
  font-size: .82em;
}

.message-body pre {
  position: relative;
  overflow: auto;
  margin: .8em 0 1em;
  padding: 38px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--sidebar);
  line-height: 1.55;
  scrollbar-width: thin;
}

.message-body pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: .76rem;
  white-space: pre;
}

.code-head {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: 30px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  font-family: var(--font);
  font-size: .59rem;
}

.copy-code {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--text-faint);
  background: transparent;
  font-size: .59rem;
}

.copy-code:hover {
  color: var(--text);
  background: var(--hover);
}

.message-body blockquote {
  margin: .8em 0 1em;
  padding: .2em 0 .2em 13px;
  border-left: 2px solid var(--accent);
  color: var(--text-soft);
}

.message-body hr {
  margin: 1.3em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.message-error {
  padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 36%, var(--line));
  border-radius: 10px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: .78rem;
  line-height: 1.5;
}

.message-error button {
  margin: 8px 0 0;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  font-size: .68rem;
  font-weight: 650;
}

.stream-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  border-radius: 2px;
  vertical-align: -.12em;
  background: var(--accent);
  animation: caret-blink .9s step-end infinite;
}

.route-activity {
  display: flex;
  width: min(100%, var(--content-width));
  align-items: center;
  gap: 9px;
  margin: 0 auto;
  padding: 6px 0 26px 44px;
  color: var(--text-faint);
  font-size: .67rem;
}

.route-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.scroll-anchor {
  height: 24px;
}

.composer-dock {
  position: relative;
  z-index: 15;
  padding: 10px max(24px, calc((100% - var(--content-width)) / 2)) max(13px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--panel) 0%, transparent), var(--panel) 17px);
}

.backend-notice {
  display: flex;
  width: 100%;
  min-height: 35px;
  align-items: center;
  gap: 8px;
  margin: 0 auto 7px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--line));
  border-radius: 9px;
  color: var(--text-soft);
  background: var(--warning-soft);
  font-size: .67rem;
}

.backend-notice svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--warning);
}

.backend-notice span {
  flex: 1;
}

.backend-notice button {
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-solid) 60%, transparent);
  font-size: .63rem;
  font-weight: 650;
}

.attachment-tray {
  display: flex;
  width: 100%;
  gap: 7px;
  overflow-x: auto;
  margin: 0 auto 7px;
  scrollbar-width: none;
}

.attachment-chip {
  display: grid;
  min-width: 0;
  max-width: 230px;
  flex: 0 0 auto;
  grid-template-columns: 28px minmax(0, 1fr) 23px;
  align-items: center;
  gap: 7px;
  padding: 5px 5px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-solid);
}

.attachment-thumb {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.attachment-thumb img,
.attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-thumb svg {
  width: 14px;
  height: 14px;
}

.attachment-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.attachment-copy strong,
.attachment-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy strong {
  font-size: .64rem;
  font-weight: 620;
}

.attachment-copy small {
  color: var(--text-faint);
  font-size: .57rem;
}

.attachment-remove {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 6px;
  color: var(--text-faint);
  background: transparent;
}

.attachment-remove:hover {
  color: var(--danger);
  background: var(--subtle);
}

.attachment-remove svg {
  width: 12px;
  height: 12px;
}

.composer {
  width: 100%;
  margin: 0 auto;
  padding: 10px 10px 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
  box-shadow: var(--shadow-composer);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line));
  box-shadow: var(--shadow-composer), 0 0 0 2px var(--accent-soft);
}

.composer.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 72%, transparent);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 30px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  padding: 2px 3px 6px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: .86rem;
  line-height: 1.55;
  scrollbar-width: thin;
}

.composer textarea::placeholder {
  color: var(--text-faint);
}

.composer-toolbar {
  display: flex;
  min-height: 33px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.composer-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.composer-icon-button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--text-soft);
  background: transparent;
}

.composer-icon-button:hover {
  color: var(--text);
  background: var(--subtle);
}

.composer-icon-button svg {
  width: 18px;
  height: 18px;
}

.composer-control-button,
.composer-model-control,
.composer-model-trigger {
  display: inline-flex;
  height: 31px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  background: var(--subtle);
  font-size: .66rem;
  font-weight: 640;
}

.composer-control-button {
  padding: 0 9px;
}

.composer-control-button:hover,
.composer-model-control:hover,
.composer-model-trigger:hover,
.composer-model-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--hover);
}

.composer-control-button svg {
  width: 15px;
  height: 15px;
}

.composer-model-control {
  position: relative;
  max-width: min(250px, 42vw);
  padding: 0 7px 0 9px;
}

.composer-model-picker {
  position: relative;
  min-width: 0;
  max-width: min(250px, 42vw);
}

.composer-model-trigger {
  max-width: 100%;
  padding: 0 8px 0 9px;
  white-space: nowrap;
}

.composer-model-trigger > span:not(.route-pulse) {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.composer-model-trigger .chevron {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  transition: transform 140ms ease;
}

.composer-model-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.composer-model-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 90;
  width: min(326px, calc(100vw - 30px));
  max-height: min(650px, calc(100dvh - 92px));
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
  transform-origin: bottom left;
  animation: menu-in 130ms ease-out;
}

.composer-model-menu-head {
  display: flex;
  align-items: center;
  padding: 7px 12px 10px;
}

.composer-model-menu-head strong {
  color: var(--text);
  font-size: .86rem;
  font-weight: 680;
}

.composer-model-search {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  margin: 0 6px 10px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--hover);
}

.composer-model-search:focus-within {
  border-color: var(--line-strong);
}

.composer-model-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--text-faint);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.composer-model-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 500 .76rem/1 system-ui, sans-serif;
}

.composer-model-search input::placeholder {
  color: var(--text-faint);
}

.composer-model-back {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.composer-model-back:hover {
  background: var(--hover);
}

.composer-model-back > span {
  color: var(--text-faint);
  font-size: 1.35rem;
  line-height: 1;
}

.composer-model-back strong {
  overflow: hidden;
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-divider {
  height: 1px;
  margin: 0 6px 7px;
  background: var(--line);
}

.composer-model-option {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 32px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--text-soft);
  background: transparent;
  text-align: left;
}

.composer-model-option:hover,
.composer-model-option:focus-visible {
  color: var(--text);
  background: var(--hover);
}

.composer-model-option[aria-selected="true"] {
  color: var(--text);
  background: var(--accent-soft);
}

.composer-model-option > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.composer-model-option strong {
  overflow: hidden;
  font-size: .76rem;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-option small {
  overflow: hidden;
  color: var(--text-faint);
  font-size: .66rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-glyph {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #f4f4f4;
  background: #080909;
  font-size: .7rem;
  font-weight: 760;
}

.composer-model-glyph--cloud {
  color: #f4f4f4;
  background: #080909;
}

.composer-model-family-option {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.composer-model-family-count {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: .64rem;
  white-space: nowrap;
}

.composer-model-family-count b {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
}

.composer-model-empty {
  margin: 0;
  padding: 22px 12px;
  color: var(--text-faint);
  font-size: .7rem;
  text-align: center;
}

.composer-model-option .check {
  width: 15px;
  height: 15px;
  color: var(--accent);
  opacity: 0;
}

.composer-model-option[aria-selected="true"] .check {
  opacity: 1;
}

.composer-model-control select {
  min-width: 0;
  max-width: 205px;
  height: 29px;
  padding: 0 18px 0 0;
  overflow: hidden;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: .66rem;
  font-weight: 650;
  appearance: none;
  color-scheme: dark;
  text-overflow: ellipsis;
}

.composer-model-control select option {
  color: var(--text);
  background: var(--panel-solid);
}

.composer-model-control .chevron {
  position: absolute;
  right: 6px;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.composer-reasoning-control {
  max-width: 112px;
}

.composer-reasoning-control select {
  max-width: 82px;
}

.active-route {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: .62rem;
}

.route-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.is-streaming .route-pulse {
  animation: soft-pulse 1.05s ease-in-out infinite;
}

.send-button {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--panel-solid);
  background: var(--text);
  transition: opacity 130ms ease, transform 130ms ease, background 130ms ease;
}

.send-button:disabled {
  color: var(--text-faint);
  background: var(--subtle);
  opacity: .72;
}

.send-button:not(:disabled):hover {
  transform: translateY(-1px);
}

.send-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.stop-icon {
  display: none;
  fill: currentColor;
  stroke: none;
}

.is-streaming .send-icon {
  display: none;
}

.is-streaming .stop-icon {
  display: block;
}

.composer-caption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 7px 5px 0;
  color: var(--text-faint);
  font-size: .58rem;
  line-height: 1.25;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: flex;
  width: min(340px, calc(100vw - 36px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
  font-size: .72rem;
  line-height: 1.4;
  animation: toast-in 180ms ease-out;
}

.noscript-message {
  position: fixed;
  z-index: 1000;
  right: 16px;
  bottom: 16px;
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: 9px;
  color: var(--danger);
  background: var(--danger-soft);
  font: 13px/1.4 sans-serif;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes soft-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

@keyframes caret-blink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), calc(100vw - 52px));
    max-width: 320px;
    transform: translateX(-102%);
    transition: transform 190ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 48px rgb(0 0 0 / 18%);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    background: rgb(12 12 11 / 42%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 190ms ease;
  }

  body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close,
  .menu-button {
    display: inline-grid;
  }

  .main-panel {
    width: 100%;
    height: 100vh;
    height: 100dvh;
  }

  .topbar {
    padding-left: 12px;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 59px;
    padding: 6px 10px;
  }

  .topbar-leading {
    flex: 1;
    overflow: hidden;
  }

  .conversation-identity {
    max-width: min(36vw, 180px);
  }

  .route-line {
    display: none;
  }

  .conversation-identity h1 {
    margin: 0;
    font-size: .79rem;
  }

  .status-pill {
    width: 29px;
    padding: 0;
    justify-content: center;
  }

  .status-pill #status-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .mode-trigger {
    min-width: 0;
    width: 42px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }

  .mode-trigger-copy,
  .mode-trigger .chevron {
    display: none;
  }

  .conversation {
    padding: 0 14px;
  }

  .empty-state {
    justify-content: flex-start;
    padding: max(44px, 8vh) 2px 48px;
  }

  .empty-mark {
    margin-bottom: 19px;
  }

  .empty-state h2 {
    font-size: 2.45rem;
  }

  .empty-copy {
    margin: 15px 0 24px;
    font-size: .82rem;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .prompt-card {
    min-height: 60px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .message-list {
    padding-top: 20px;
  }

  .message {
    grid-template-columns: 27px minmax(0, 1fr);
    column-gap: 9px;
  }

  .message-avatar {
    width: 26px;
    height: 26px;
  }

  .message--user .message-column {
    max-width: 88%;
  }

  .message-body {
    font-size: .84rem;
  }

  .model-tag {
    max-width: 150px;
  }

  .route-activity {
    padding-left: 36px;
  }

  .composer-dock {
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  }

  .composer {
    border-radius: 15px;
  }

  .composer-caption {
    display: none;
  }

  .active-route {
    max-width: 180px;
  }

  .active-route span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.composer-tool-toggle {
  display: inline-flex;
  height: 31px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-faint);
  background: transparent;
  font-size: .68rem;
  font-weight: 580;
}

.composer-tool-toggle svg {
  width: 15px;
  height: 15px;
}

.composer-tool-toggle:hover {
  border-color: var(--line);
  color: var(--text-soft);
  background: var(--subtle);
}

.composer-tool-toggle.is-active {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.research-sources {
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.research-sources > summary {
  width: max-content;
  cursor: pointer;
  list-style: none;
  color: var(--text-faint);
  font-size: .64rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.research-sources > summary::-webkit-details-marker {
  display: none;
}

.research-sources > summary::after {
  content: " +";
}

.research-sources[open] > summary::after {
  content: " −";
}

.research-sources > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.research-sources a {
  display: inline-grid;
  max-width: 250px;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 2px 7px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--panel-solid) 55%, transparent);
  font-size: .65rem;
  text-decoration: none;
}

.research-sources a:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--panel-solid);
}

.research-sources a > span:first-child {
  display: grid;
  width: 18px;
  height: 18px;
  grid-row: 1 / span 2;
  place-items: center;
  border-radius: 5px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-size: .57rem;
  font-weight: 700;
}

.research-sources a > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-sources small {
  color: var(--text-faint);
  font-size: .55rem;
  text-transform: capitalize;
}

.message-body pre.code-block {
  padding: 40px 15px 15px;
  background: #0b0d10;
}

.message-body pre.code-block code.hljs {
  padding: 0;
  overflow: visible;
  background: transparent;
  color: #d8dee9;
}

.diagram-block {
  overflow: hidden;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fb;
}

.diagram-block figcaption {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 0 13px;
  border-bottom: 1px solid var(--line);
  color: #555c68;
  background: #eef0f4;
  font-size: .62rem;
}

.diagram-block figcaption > span:last-child {
  display: flex;
  gap: 5px;
}

.diagram-block button {
  padding: 4px 7px;
  border-radius: 6px;
  color: #555c68;
  background: transparent;
  font-size: .59rem;
}

.diagram-block button:hover:not(:disabled) {
  color: #191c22;
  background: #dfe3e9;
}

.diagram-block button:disabled {
  opacity: .45;
}

.diagram-canvas {
  display: grid;
  min-height: 120px;
  place-items: center;
  overflow: auto;
  padding: 18px;
  color: #4a4f59;
  font-size: .72rem;
}

.diagram-canvas svg,
.diagram-canvas img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 640px;
}

.diagram-source {
  display: none;
}

@media (max-width: 780px) {
  .composer-tool-toggle span {
    display: none;
  }

  .composer-tool-toggle {
    width: 31px;
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 420px) {
  .conversation-identity {
    display: none;
  }

  .mode-menu-head small {
    display: none;
  }

  .mode-menu {
    position: fixed;
    top: 64px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .active-route {
    max-width: 125px;
  }

  .composer-control-button span {
    display: none;
  }

  .composer-control-button {
    width: 31px;
    padding: 0;
    justify-content: center;
  }

  .composer-model-control {
    max-width: 35vw;
  }

  .composer-model-control select {
    max-width: 27vw;
  }

  .composer-reasoning-control {
    max-width: 76px;
  }

  .composer-reasoning-control select {
    max-width: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .status-dot,
  .route-pulse {
    border: 1px solid currentColor;
  }

  .send-button,
  .brand-mark {
    border: 1px solid currentColor;
  }
}

/* Quiet visual system: restrained surfaces, typography first, no ornamental AI chrome. */
.brand-row {
  min-height: 62px;
  padding-inline: 17px 14px;
}

.brand {
  gap: 10px;
  font-size: .95rem;
  font-weight: 690;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 25px;
  height: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  font-size: .7rem;
  font-weight: 760;
  letter-spacing: -.04em;
}

.new-chat-button {
  min-height: 40px;
  margin: 4px 10px 20px;
  border-color: var(--line);
  border-radius: 9px;
  background: transparent;
}

.history-heading {
  padding-left: 18px;
  font-size: .64rem;
  letter-spacing: .08em;
}

.sidebar-footer {
  padding-inline: 10px;
}

.local-note {
  padding-inline: 9px;
  font-size: .64rem;
}

.topbar {
  min-height: 62px;
  padding: 7px 20px 7px 24px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(18px);
}

.topbar .mode-picker {
  display: none;
}

.conversation-identity h1 {
  margin-bottom: 4px;
  font-size: .84rem;
  font-weight: 610;
}

.route-line {
  gap: 5px;
  font-size: .64rem;
}

.route-node {
  color: var(--text-faint);
  font-weight: 560;
}

.status-pill {
  height: 28px;
  border-color: transparent;
  color: var(--text-faint);
  font-size: .65rem;
}

.status-pill:hover {
  border-color: var(--line);
}

.status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.conversation {
  padding-inline: max(26px, calc((100% - var(--content-width)) / 2));
}

.empty-state {
  width: min(100%, 760px);
  align-items: flex-start;
  padding: 64px 0 82px;
}

.empty-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 25px;
  color: var(--text-faint);
  font-size: .7rem;
  font-weight: 590;
}

.empty-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.empty-state h2 {
  max-width: 680px;
  font-family: var(--font);
  font-size: clamp(2.15rem, 4.6vw, 3.6rem);
  font-weight: 590;
  letter-spacing: -.055em;
  line-height: 1.03;
}

.empty-copy {
  max-width: 510px;
  margin: 18px 0 35px;
  color: var(--text-soft);
  font-size: .9rem;
  line-height: 1.62;
}

.prompt-grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.prompt-card {
  min-height: 88px;
  padding: 15px 16px;
  border-color: var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-solid) 52%, transparent);
  transform: none;
}

.prompt-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-solid);
  transform: none;
}

.prompt-card span {
  font-size: .78rem;
  font-weight: 620;
}

.prompt-card small {
  max-width: 180px;
  margin-top: 7px;
  font-size: .65rem;
  line-height: 1.45;
}

.prompt-card svg {
  display: none;
}

.message-list {
  padding-top: 34px;
}

.message {
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 14px;
  padding: 20px 0 27px;
}

.message + .message {
  border-top-color: color-mix(in srgb, var(--line) 58%, transparent);
}

.message-avatar {
  width: 27px;
  height: 27px;
  border-color: var(--line-strong);
  border-radius: 7px;
  color: var(--text-soft);
  background: transparent;
  font-size: .66rem;
  font-weight: 740;
}

.message-meta {
  min-height: 25px;
  gap: 9px;
  margin-bottom: 5px;
}

.message-meta strong {
  font-size: .72rem;
  font-weight: 640;
}

.model-tag {
  padding: 2px 0;
  border-radius: 0;
  color: var(--text-faint);
  background: transparent;
  font-size: .61rem;
  font-weight: 550;
}

.message-body {
  max-width: 820px;
  font-size: .9rem;
  line-height: 1.72;
}

.message--user .message-column {
  max-width: min(76%, 680px);
  padding: 11px 15px;
  border-color: transparent;
  border-radius: 16px 16px 5px 16px;
  background: var(--subtle);
}

.route-activity {
  color: var(--text-faint);
  font-size: .68rem;
}

.composer-dock {
  padding-top: 12px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.composer {
  border-color: var(--line-strong);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: 0 10px 34px rgb(0 0 0 / 16%);
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line-strong));
  box-shadow: 0 12px 36px rgb(0 0 0 / 20%);
}

.composer textarea {
  min-height: 54px;
  padding-top: 16px;
  font-size: .92rem;
}

.composer-control-button,
.composer-model-control {
  border-color: transparent;
  background: transparent;
}

.composer-control-button:hover,
.composer-model-control:hover {
  border-color: var(--line);
  background: var(--subtle);
}

.send-button {
  border-radius: 9px;
}

.composer-caption {
  color: var(--text-faint);
  font-size: .62rem;
}

.toolbox-dialog {
  border-radius: 16px;
}

.toolbox-head {
  padding: 26px 26px 19px;
}

.tool-card {
  border-radius: 10px;
  background: transparent;
}

.tool-card--ready {
  background: color-mix(in srgb, var(--success-soft) 62%, transparent);
}

@media (max-width: 680px) {
  .topbar {
    min-height: 58px;
    padding-inline: 10px;
  }

  .conversation {
    padding-inline: 15px;
  }

  .empty-state {
    padding: max(42px, 8vh) 1px 54px;
  }

  .empty-status {
    margin-bottom: 20px;
  }

  .empty-state h2 {
    font-size: 2.35rem;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .prompt-card {
    min-height: 64px;
  }

  .message {
    grid-template-columns: 25px minmax(0, 1fr);
    column-gap: 10px;
  }

  .message-avatar {
    width: 24px;
    height: 24px;
  }

  .message--user .message-column {
    max-width: 90%;
  }
}

/* Fleet monitor */
.fleet-dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: min(780px, calc(100dvh - 32px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
}

.fleet-dialog::backdrop {
  background: rgb(4 6 9 / 58%);
  backdrop-filter: blur(5px);
}

.fleet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 28px 23px;
  border-bottom: 1px solid var(--line);
}

.fleet-head .eyebrow {
  margin: 0 0 8px;
  color: var(--text-faint);
  font-size: .64rem;
  font-weight: 680;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fleet-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fleet-title-row h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -.035em;
}

.fleet-head > div > p:last-child {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: .76rem;
  line-height: 1.5;
}

.fleet-state,
.fleet-model-state {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-faint);
  background: var(--subtle);
  font-size: .59rem;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.fleet-state--ready,
.fleet-model-state.is-ready {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  color: var(--success);
  background: color-mix(in srgb, var(--success-soft) 72%, transparent);
}

.fleet-state--warming,
.fleet-state--loading {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
  color: var(--warning);
  background: color-mix(in srgb, var(--warning-soft) 72%, transparent);
}

.fleet-state--offline {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 72%, transparent);
}

.fleet-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.fleet-metric {
  min-width: 0;
  padding: 19px 22px;
}

.fleet-metric + .fleet-metric {
  border-left: 1px solid var(--line);
}

.fleet-metric span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-faint);
  font-size: .62rem;
}

.fleet-metric strong {
  display: block;
  overflow: hidden;
  font-size: .82rem;
  font-weight: 650;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 28px 12px;
}

.fleet-section-head > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.fleet-section-head span {
  font-size: .72rem;
  font-weight: 660;
}

.fleet-section-head small {
  color: var(--text-faint);
  font-size: .61rem;
}

.fleet-section-head button {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: transparent;
  font-size: .64rem;
  font-weight: 620;
}

.fleet-section-head button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--subtle);
}

.fleet-section-head button svg {
  width: 14px;
  height: 14px;
}

.fleet-models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  padding: 0 28px 24px;
}

.fleet-model {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 65%, transparent);
}

.fleet-model.is-ready {
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
}

.fleet-model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.fleet-model-head > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.fleet-model-head strong {
  overflow: hidden;
  font-size: .78rem;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-model-head small {
  color: var(--text-faint);
  font-size: .61rem;
  text-transform: capitalize;
}

.fleet-model-state {
  flex: 0 0 auto;
  min-height: 21px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-model dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
}

.fleet-model dl div {
  min-width: 0;
}

.fleet-model dt {
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: .58rem;
}

.fleet-model dd {
  margin: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: .64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-empty {
  grid-column: 1 / -1;
  padding: 32px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--text-faint);
  font-size: .72rem;
  text-align: center;
}

.fleet-footnote {
  margin: 0;
  padding: 13px 28px 17px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: .6rem;
  line-height: 1.5;
}

@media (max-width: 680px) {
  .fleet-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 14px;
  }

  .fleet-head {
    padding: 22px 20px 19px;
  }

  .fleet-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fleet-metric {
    padding: 15px 18px;
  }

  .fleet-metric:nth-child(3) {
    border-left: 0;
  }

  .fleet-metric:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .fleet-section-head {
    padding-inline: 20px;
  }

  .fleet-models {
    grid-template-columns: 1fr;
    padding-inline: 20px;
  }

  .fleet-footnote {
    padding-inline: 20px;
  }
}

/* Editorial workspace pass: flat hierarchy, quiet surfaces, utility-first copy. */
:root {
  --bg: #f1f1ef;
  --panel: #f7f7f5;
  --panel-solid: #fcfcfa;
  --sidebar: #e8e8e5;
  --raised: #fcfcfa;
  --subtle: #ececea;
  --hover: #dfdfdc;
  --text: #1c1d1b;
  --text-soft: #555851;
  --text-faint: #7d8178;
  --line: #d6d6d1;
  --line-strong: #bfc0b9;
  --accent: #53677d;
  --accent-soft: #e2e7eb;
  --accent-ink: #465b70;
  --sidebar-width: 248px;
  --content-width: 820px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 9px;
  --shadow-menu: 0 18px 50px rgb(24 25 22 / 16%);
  --shadow-composer: none;
}

:root[data-theme="dark"] {
  --bg: #111210;
  --panel: #151614;
  --panel-solid: #191a18;
  --sidebar: #0c0d0c;
  --raised: #1d1e1b;
  --subtle: #1e201d;
  --hover: #242622;
  --text: #e8e9e4;
  --text-soft: #a7aaa1;
  --text-faint: #777b72;
  --line: #292b27;
  --line-strong: #3b3e38;
  --accent: #8fa2b7;
  --accent-soft: #222b33;
  --accent-ink: #aab9c8;
  --shadow-menu: 0 22px 60px rgb(0 0 0 / 40%);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #111210;
    --panel: #151614;
    --panel-solid: #191a18;
    --sidebar: #0c0d0c;
    --raised: #1d1e1b;
    --subtle: #1e201d;
    --hover: #242622;
    --text: #e8e9e4;
    --text-soft: #a7aaa1;
    --text-faint: #777b72;
    --line: #292b27;
    --line-strong: #3b3e38;
    --accent: #8fa2b7;
    --accent-soft: #222b33;
    --accent-ink: #aab9c8;
    --shadow-menu: 0 22px 60px rgb(0 0 0 / 40%);
  }
}

.brand-row {
  min-height: 58px;
  padding-inline: 17px 13px;
}

.brand {
  font-size: .88rem;
  font-weight: 680;
  letter-spacing: -.015em;
}

.brand-mark {
  display: none;
}

.brand-mark.brand-mark--astra {
  display: grid;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
}

.brand-mark.brand-mark--astra svg {
  width: 25px;
  height: 25px;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark.brand-mark--astra svg path {
  fill: none;
}

.brand-mark.brand-mark--astra svg path:nth-child(2) {
  stroke-width: 1.15;
}

/* Account workspace */
.brand-mark.brand-mark--astra svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.brand-mark.brand-mark--astra svg .astra-spark {
  fill: none;
  stroke: var(--accent, #ef5c3f);
  stroke-width: 2.4;
}

.workspace-nav {
  display: grid;
  gap: 3px;
  padding: 3px 10px 10px;
  border-bottom: 1px solid var(--line);
}

.workspace-nav-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 37px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font: 560 .75rem inherit;
  cursor: pointer;
}

.workspace-nav-item:hover,
.workspace-nav-item.is-active {
  color: var(--text);
  background: var(--hover);
}

.workspace-nav-item svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-nav-item small {
  font: 500 .55rem ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.account-card {
  margin: 0 0 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel-solid) 55%, transparent);
}

.account-card-head {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.account-avatar {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #ef5c3f;
  font: 700 .65rem ui-monospace, monospace;
}

.account-card-head > span:nth-child(2) {
  min-width: 0;
}

.account-card-head strong,
.account-card-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-head strong { font-size: .68rem; }
.account-card-head small { margin-top: 2px; color: var(--muted); font-size: .56rem; }
.account-card-head b { color: #ef5c3f; font: 650 .52rem ui-monospace, monospace; letter-spacing: .08em; }

.credit-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: .56rem;
}

.credit-row strong { color: var(--text); font-weight: 600; }
.credit-meter { height: 3px; margin-top: 7px; overflow: hidden; background: var(--line); }
.credit-meter i { display: block; width: 0; height: 100%; background: #ef5c3f; transition: width .5s ease; }

.account-card-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.account-card-actions a,
.account-card-actions button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: none;
  font: 550 .56rem inherit;
  text-decoration: none;
  cursor: pointer;
}

.account-card-actions a:hover,
.account-card-actions button:hover { color: var(--text); }

.mode-option.is-locked,
.composer-model-option.is-locked {
  opacity: .42;
}

.mode-option.is-locked::after,
.composer-model-option.is-locked::after {
  content: "ПОДПИСКА";
  margin-left: auto;
  color: var(--muted);
  font: 600 .5rem ui-monospace, monospace;
  letter-spacing: .08em;
}

.model-catalog-item.is-locked { opacity: .55; }
.model-catalog-item.is-locked input { pointer-events: none; }

/* Owner controls and final interface polish. */
[hidden] { display: none !important; }

.mode-menu,
.composer-model-menu {
  width: min(390px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 96px));
  overscroll-behavior: contain;
  scrollbar-width: thin;
  animation: astra-menu-in 180ms cubic-bezier(.2, .75, .2, 1);
  transform-origin: top right;
}

.mode-option,
.composer-model-option,
.model-catalog-item {
  text-align: left;
}

.mode-option > span:nth-child(2),
.composer-model-option > span:nth-child(2),
.model-catalog-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
}

.mode-option strong,
.composer-model-option strong,
.model-catalog-copy strong {
  line-height: 1.25;
  letter-spacing: -.012em;
}

.mode-option small,
.composer-model-option small,
.model-catalog-copy small {
  line-height: 1.35;
  white-space: normal;
  text-wrap: pretty;
}

.message-copy,
.empty-copy,
.route-line,
.account-card,
.admin-head p {
  text-wrap: pretty;
}

.admin-dialog {
  width: min(1120px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow-menu);
  animation: astra-panel-in 220ms cubic-bezier(.2, .8, .2, 1);
}

.admin-dialog::backdrop { background: rgb(0 0 0 / 58%); backdrop-filter: blur(6px); }
.admin-head { min-height: 112px; padding: 24px 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.admin-head h2 { margin: 3px 0 6px; font-family: Georgia, serif; font-size: clamp(1.65rem, 3vw, 2.3rem); font-weight: 500; letter-spacing: -.035em; }
.admin-head p:not(.eyebrow) { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.5; }
.admin-summary { padding: 16px 26px; display: grid; grid-template-columns: 130px 130px minmax(220px, 1fr) auto; align-items: end; gap: 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.admin-summary > div { display: grid; gap: 4px; }
.admin-summary span, .admin-summary label span, .admin-user label span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; }
.admin-summary strong { font-family: Georgia, serif; font-size: 1.65rem; font-weight: 500; }
.admin-summary label { display: grid; gap: 6px; }
.admin-summary input,
.admin-user input,
.admin-user select { min-height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text); background: var(--raised); outline: none; }
.admin-summary input:focus,
.admin-user input:focus,
.admin-user select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.admin-summary button,
.admin-user > button { min-height: 38px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text); background: var(--raised); cursor: pointer; transition: transform 140ms ease, border-color 140ms ease, background 140ms ease; }
.admin-summary button:hover,
.admin-user > button:hover { border-color: var(--accent); background: var(--hover); transform: translateY(-1px); }
.admin-users { height: calc(100% - 186px); overflow: auto; padding: 12px 26px 28px; }
.admin-user { display: grid; grid-template-columns: 38px minmax(150px, 1.5fr) 72px minmax(110px, .7fr) minmax(120px, .8fr) minmax(110px, .8fr) 150px; align-items: end; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); animation: astra-row-in 220ms both; }
.admin-user-avatar { width: 36px; height: 36px; align-self: center; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; }
.admin-user-identity { min-width: 0; align-self: center; display: grid; gap: 3px; }
.admin-user-identity strong, .admin-user-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-identity small, .admin-user-usage small { color: var(--muted); }
.admin-user-role { align-self: center; width: max-content; padding: 4px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-user label, .admin-user-usage { display: grid; gap: 6px; }
.admin-user-usage { align-self: center; font-size: .76rem; }
.admin-user-actions { display: grid; gap: 8px; }
.admin-user label { min-width: 0; }
.admin-user input, .admin-user select { width: 100%; min-width: 0; box-sizing: border-box; }
.admin-user-actions button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text); background: var(--raised); cursor: pointer; }
.admin-user-actions button:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
.admin-user-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.admin-user-actions button:disabled { opacity: .55; cursor: wait; }
.admin-user-actions .admin-block-button { color: var(--text); border-color: color-mix(in srgb, #d84949 60%, var(--line)); }
.admin-user-status { color: var(--muted); font-size: .75rem; }
.admin-user-status.is-blocked { color: var(--text); font-weight: 600; }
.admin-user-status.is-blocked::before { content: "● "; color: #d84949; }
.admin-owner-protected { max-width: 130px; color: var(--muted); font-size: .7rem; text-align: center; }
.admin-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.admin-dialog .admin-users { height: auto; min-height: 0; }
@media (max-width: 1040px) {
  .admin-user { grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; }
  .admin-user label, .admin-user-usage, .admin-user-actions { grid-column: 2 / -1; }
}
.admin-empty { margin: 50px auto; max-width: 480px; color: var(--muted); text-align: center; }
.admin-empty--error { color: #ef8d80; }

@keyframes astra-menu-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes astra-panel-in { from { opacity: 0; transform: translateY(14px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes astra-row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .admin-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .admin-summary { grid-template-columns: 1fr 1fr; }
  .admin-summary label { grid-column: 1 / -1; }
  .admin-users { height: calc(100% - 250px); padding-inline: 16px; }
  .admin-user { grid-template-columns: 38px 1fr auto; align-items: center; }
  .admin-user label, .admin-user-usage, .admin-user > button { grid-column: 2 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .mode-menu, .composer-model-menu, .admin-dialog, .admin-user { animation: none !important; }
}

.new-chat-button {
  min-height: 38px;
  margin: 2px 9px 20px;
  padding-inline: 10px;
  border-radius: 5px;
  background: transparent;
  font-size: .77rem;
}

.new-chat-button:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.history-item,
.history-open,
.history-delete,
.sidebar-action,
.icon-button {
  border-radius: 5px;
}

.history-item:hover,
.history-item.is-active {
  background: color-mix(in srgb, var(--hover) 75%, transparent);
}

.topbar {
  min-height: 58px;
  padding: 6px 20px 6px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: none;
}

.conversation-identity h1 {
  margin: 0;
  font-size: .8rem;
  font-weight: 620;
  letter-spacing: -.01em;
}

.route-line {
  display: none;
}

.status-pill {
  height: 27px;
  padding-inline: 8px;
  border-radius: 4px;
  font-size: .62rem;
}

.conversation {
  padding-inline: max(28px, calc((100% - var(--content-width)) / 2));
}

.empty-state {
  width: min(100%, 680px);
  min-height: 100%;
  justify-content: flex-start;
  padding: clamp(70px, 12vh, 120px) 0 84px;
}

.empty-status {
  gap: 7px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: .59rem;
  font-weight: 540;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.empty-status span {
  width: 5px;
  height: 5px;
}

.empty-state h2 {
  max-width: 620px;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  font-weight: 570;
  letter-spacing: -.045em;
  line-height: 1.08;
}

.empty-copy {
  max-width: 520px;
  margin: 14px 0 29px;
  font-size: .82rem;
  line-height: 1.6;
}

.prompt-grid {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.prompt-card {
  display: grid;
  min-height: 58px;
  grid-template-columns: 42px minmax(130px, 170px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 6px 0 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transform: none;
}

.prompt-card::before {
  content: attr(data-index);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .58rem;
}

.prompt-card:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--hover) 48%, transparent);
  transform: none;
}

.prompt-card span {
  font-size: .74rem;
  font-weight: 630;
}

.prompt-card small {
  max-width: none;
  margin: 0;
  color: var(--text-faint);
  font-size: .65rem;
  line-height: 1.4;
}

.prompt-card svg {
  display: none;
}

.message-list {
  padding-top: 18px;
}

.message {
  display: block;
  padding: 25px 0 30px;
}

.message + .message {
  border-top: 1px solid var(--line);
}

.message-avatar {
  display: none;
}

.message--user {
  display: block;
  margin: 10px 0 8px;
  padding: 16px 0 17px 18px;
  border-top: 0 !important;
  border-left: 2px solid var(--line-strong);
}

.message--user .message-column {
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.message-meta {
  min-height: 0;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: .57rem;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.message-meta strong {
  font-size: .59rem;
  font-weight: 650;
}

.model-tag {
  max-width: 300px;
  padding: 0;
  color: var(--text-faint);
  font-size: .57rem;
  font-weight: 520;
  text-transform: none;
}

.message-body {
  max-width: 790px;
  font-size: .88rem;
  line-height: 1.72;
}

.message-actions {
  opacity: .45;
}

.route-activity {
  padding-left: 0;
}

.composer-dock {
  padding-top: 13px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer {
  padding: 9px 9px 7px 13px;
  border-color: var(--line-strong);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: none;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.composer textarea {
  min-height: 43px;
  padding-top: 8px;
  font-size: .86rem;
}

.composer-icon-button,
.composer-control-button,
.composer-tool-toggle,
.composer-model-control,
.send-button {
  border-radius: 5px;
}

.composer-control-button,
.composer-model-control,
.composer-tool-toggle {
  border-color: transparent;
  background: transparent;
}

.composer-model-control {
  padding-left: 8px;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.route-pulse {
  display: none;
}

.composer-tool-toggle.is-active {
  border-color: var(--line-strong);
  color: var(--accent-ink);
  background: transparent;
}

.send-button {
  width: 31px;
  height: 31px;
}

.composer-caption {
  margin-top: 6px;
  font-size: .56rem;
}

.toolbox-dialog,
.fleet-dialog {
  border-radius: 8px;
}

.toolbox-dialog::backdrop,
.fleet-dialog::backdrop {
  background: rgb(5 6 5 / 62%);
  backdrop-filter: none;
}

.toolbox-head {
  padding: 25px 28px 20px;
}

.toolbox-head h2 {
  font-size: 1.12rem;
  font-weight: 650;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 4px 28px 20px;
}

.tool-card,
.tool-card--ready {
  display: grid;
  min-height: 62px;
  grid-template-columns: 130px 190px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.tool-card:first-child {
  border-top: 1px solid var(--line);
}

.tool-card:hover,
.tool-card--ready:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--hover) 42%, transparent);
}

.tool-card-status {
  font-family: var(--mono);
  font-size: .55rem;
  font-weight: 540;
  letter-spacing: .025em;
}

.tool-card strong {
  font-size: .75rem;
  font-weight: 640;
}

.tool-card small {
  font-size: .66rem;
  line-height: 1.45;
}

.fleet-model {
  border-radius: 5px;
  background: transparent;
}

@media (max-width: 680px) {
  .topbar {
    min-height: 54px;
    padding-inline: 10px;
  }

  .conversation {
    padding-inline: 16px;
  }

  .empty-state {
    padding: 38px 0 54px;
  }

  .empty-state h2 {
    font-size: 2rem;
  }

  .prompt-card {
    min-height: 72px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 3px 9px;
    padding-block: 10px;
  }

  .prompt-card::before {
    grid-row: 1 / 3;
  }

  .prompt-card small {
    grid-column: 2;
  }

  .message {
    padding-block: 21px 25px;
  }

  .message--user {
    padding: 14px 0 15px 14px;
  }

  .composer-dock {
    padding-top: 9px;
  }

  .composer {
    border-radius: 7px;
  }

  .composer-control-button {
    width: 31px;
    justify-content: center;
    padding: 0;
  }

  .composer-control-button span {
    display: none;
  }

  .tool-card,
  .tool-card--ready {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-block: 14px;
  }
}

/* Conversation polish: calm at rest, useful controls revealed after an answer. */
.message-action--text {
  width: auto;
  padding-inline: 6px;
  color: var(--text-faint);
  font-family: var(--font);
  font-size: .6rem;
  text-transform: none;
}

.message-followups {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.message-followups button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-faint);
  background: transparent;
  font-size: .63rem;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.message-followups button:hover,
.message-followups button:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--hover);
}

.usage-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.usage-dialog::backdrop { background: rgb(0 0 0 / .62); backdrop-filter: blur(3px); }
.usage-dialog-head, .usage-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.usage-dialog-head h2, .usage-dialog-head p { margin: 0; }
.usage-dialog-head > div > p:last-child { margin-top: 4px; color: var(--muted); }
.usage-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-bottom: 1px solid var(--line); background: var(--line); }
.usage-summary article { padding: 15px 18px; background: var(--surface); }
.usage-summary span, .usage-summary strong { display: block; }
.usage-summary span { color: var(--muted); font-size: 11px; }
.usage-summary strong { margin-top: 5px; font-size: 20px; }
.usage-table-wrap { max-height: 470px; overflow: auto; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.usage-table th, .usage-table td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.usage-table th { position: sticky; top: 0; color: var(--muted); background: var(--surface); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.usage-table td:nth-child(n+3), .usage-table th:nth-child(n+3) { text-align: right; }
.usage-dialog-foot { border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); }
.usage-dialog-foot button { border: 1px solid var(--line); border-radius: 6px; padding: 7px 11px; color: var(--text); background: transparent; }
#cost-hint:not(:empty)::after { margin: 0 7px; color: var(--line-strong); content: "·"; }
#cost-hint.is-high { color: var(--warning, #d6a650); }
@media (max-width: 640px) { .usage-summary { grid-template-columns: repeat(2, 1fr); } .usage-table th:first-child, .usage-table td:first-child { display: none; } }

.compare-dialog { width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 14px; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); }
.compare-dialog::backdrop { background: rgb(0 0 0 / .62); backdrop-filter: blur(3px); }
.compare-controls { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.compare-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.compare-controls select, .compare-controls button { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; color: var(--text); background: var(--surface-soft); }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; min-height: 360px; max-height: 620px; overflow: auto; }
.compare-grid article { min-width: 0; padding: 16px 20px 24px; }
.compare-grid article + article { border-left: 1px solid var(--line); }
.compare-grid article > header { margin-bottom: 12px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
@media (max-width: 760px) { .compare-grid { grid-template-columns: 1fr; } .compare-grid article + article { border-top: 1px solid var(--line); border-left: 0; } }

@media (max-width: 680px) {
  .message-followups { display: grid; }
}
