.app {
  min-height: 100svh;
  width: 100%;
  overflow-x: clip;
  background: var(--surface-page);
  color: var(--text-strong);
}

.onboarding,
.shell {
  min-height: 100svh;
  min-width: 0;
}

.onboarding {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}

.onboarding__chrome,
.appbar,
.chat-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup,
.appbar__leading,
.chat-appbar__leading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup__text,
.appbar__title,
.chat-appbar__title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-lockup__text strong,
.appbar__title h2,
.chat-appbar__title strong {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-lockup__text span,
.appbar__title span,
.chat-appbar__title span,
.surface-badge,
.panel__label,
.status-panel__time,
.panel__foot,
.status-text,
.empty-state,
.message-bubble time,
.message-bubble__sender,
.mini-pill,
.chat-overview,
.nav-button span {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-strong);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.brand-mark svg,
.icon-button svg,
.nav-button svg,
.search-field__icon svg,
.chat-overview__pin svg,
.send-button svg,
.summary-chip svg,
.mini-panel__icon svg,
.profile-meta svg,
.chat-overview svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.brand-mark--small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.surface-badge,
.summary-chip,
.status-chip,
.mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-base);
}

.onboarding__hero,
.onboarding__panel,
.pane {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-base);
}

.onboarding__hero,
.onboarding__panel {
  padding: 20px 18px;
}

.onboarding__hero {
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.onboarding__hero h1,
.panel__heading h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.onboarding__hero h1 {
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 0.96;
}

.onboarding__summary {
  margin: 0;
  max-width: 24rem;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.summary-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-chip {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--text-soft);
  font-weight: 600;
}

.summary-chip--active {
  border-color: var(--border-contrast);
  background: var(--text-strong);
  color: #fff;
}

.panel__heading {
  display: grid;
  gap: 6px;
}

.panel__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.onboarding__form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: var(--text-muted);
}

.field input,
.search-field input,
.composer textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-base);
  color: var(--text-strong);
  padding: 13px 14px;
  outline: none;
}

.field input::placeholder,
.search-field input::placeholder,
.composer textarea::placeholder {
  color: #a0a7b1;
}

.text-action,
.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.send-button,
.nav-button,
.mini-panel {
  appearance: none;
  cursor: pointer;
  border: 0;
  font: inherit;
}

.text-action {
  justify-self: start;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
}

.primary-button {
  min-height: 48px;
  border-radius: 12px;
  background: var(--text-strong);
  color: #fff;
  font-weight: 700;
}

.secondary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
}

.secondary-button {
  background: var(--text-strong);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  border: 1px solid var(--border-subtle);
  background: var(--surface-base);
  color: var(--text-soft);
}

.primary-button:disabled,
.send-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.panel__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.status-text {
  margin: 14px 0 0;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.pane {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 12px;
  min-width: 0;
  width: 100%;
  min-height: 100svh;
  border-radius: 0;
  overflow: hidden;
}

.pane--list {
  padding: 18px 16px 0;
}

.pane--chat {
  padding: 18px 16px 14px;
  border-left: 0;
}

.pane--hidden {
  display: none;
}

.appbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar-strip::-webkit-scrollbar {
  display: none;
}

.toolbar-strip__group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.toolbar-strip__group--actions {
  margin-left: auto;
}

.toolbar-strip--utility {
  justify-content: flex-start;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-base);
  color: var(--text-soft);
}

.icon-button--ghost {
  background: var(--surface-muted);
}

.icon-button--soft {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.status-chip {
  color: var(--text-soft);
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface-muted);
}

.text-action--quiet {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9ca3af;
}

.status-chip--connecting .status-dot,
.status-chip--idle .status-dot {
  background: #f59e0b;
}

.status-chip--connected .status-dot {
  background: #1f9d55;
}

.status-chip--fallback .status-dot {
  background: #2563eb;
}

.search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
}

.search-field__icon {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.search-field input {
  border: 0;
  padding: 12px 0;
  background: transparent;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-grid--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-panel {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface-base);
  text-align: left;
}

.mini-panel__icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

.mini-panel strong {
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.mini-panel span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.conversation-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  min-width: 0;
  padding-bottom: 16px;
}

.conversation-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-base);
  text-align: left;
}

.search-results,
.saved-section,
.saved-section__body {
  display: grid;
  gap: 8px;
}

.saved-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.saved-section__header strong {
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.saved-section__header span {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.search-result {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-base);
  text-align: left;
}

.search-result__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-result__topline strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__topline time,
.search-result span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.search-result p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.conversation-row--active {
  background: var(--surface-selected);
  border-color: var(--border-strong);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.avatar--header {
  width: 34px;
  height: 34px;
}

.conversation-row__body,
.conversation-row__topline,
.conversation-row__meta,
.conversation-row__tail {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.conversation-row__topline {
  justify-content: space-between;
}

.conversation-row__topline strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-row__topline time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.conversation-row__meta {
  justify-content: space-between;
}

.conversation-row__meta span {
  min-width: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-row__tail {
  flex: none;
  justify-content: flex-end;
}

.conversation-row__tail em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--text-strong);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}

.row-pin {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--text-muted);
}

.chat-appbar__title strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-overview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 32px;
}

.chat-overview span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-overview__pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
}

.message-stream {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  min-width: 0;
  padding: 4px 0 12px;
}

.message-stream--empty {
  align-content: center;
  justify-items: center;
}

.empty-state {
  margin: 0;
  text-align: center;
}

.empty-state--inline {
  padding: 10px 4px;
  text-align: left;
}

.empty-panel,
.profile-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-base);
}

.empty-panel strong,
.profile-card__body strong {
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.empty-panel p,
.profile-card__body span {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.empty-panel--chat {
  align-self: center;
}

.empty-panel__actions,
.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-panel--soft {
  background: var(--surface-muted);
}

.profile-card__hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.avatar--profile {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.profile-card__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.profile-meta {
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-meta div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.profile-meta dt,
.profile-meta dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-meta dt {
  color: var(--text-muted);
}

.profile-meta dd {
  color: var(--text-soft);
}

.message-bubble {
  display: grid;
  gap: 4px;
  max-width: 78%;
}

.message-bubble--mine {
  justify-self: end;
}

.message-bubble__sender {
  margin: 0;
}

.message-bubble__body {
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-muted);
}

.message-bubble--mine .message-bubble__body {
  background: var(--surface-chat-mine);
}

.message-bubble__body p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.54;
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.composer-shortcuts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer__field {
  display: block;
}

.composer textarea {
  min-height: 48px;
  max-height: 120px;
  resize: none;
}

.send-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--text-strong);
  color: #fff;
}

.bottom-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.98);
}

.bottom-bar--shell {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
}

.nav-button {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 6px 4px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
}

.nav-button span {
  font-size: 11px;
  line-height: 1.2;
}

.nav-button--active {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.nav-button--active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  width: 64%;
  height: 2px;
  border-radius: 999px;
  background: var(--text-strong);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  z-index: 30;
}

@media (max-width: 899px) {
  .onboarding__chrome,
  .appbar,
  .chat-appbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .status-panel__time {
    white-space: nowrap;
  }

  .chat-appbar__leading {
    gap: 10px;
  }

  .mini-pill {
    padding: 0 10px;
  }

  .quick-grid--triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .onboarding {
    max-width: 1200px;
    margin: 0 auto;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 400px);
    align-items: stretch;
    padding: 24px;
  }

  .shell {
    max-width: 1480px;
    margin: 0 auto;
    grid-template-columns: 88px 340px minmax(640px, 1fr);
    gap: 18px;
    align-items: stretch;
    padding: 18px;
    padding-bottom: 18px;
  }

  .pane {
    min-height: calc(100svh - 36px);
    margin: 0;
    border-radius: 14px;
  }

  .pane--list {
    padding-bottom: 16px;
  }

  .pane--chat {
    display: grid;
  }

  .pane--hidden {
    display: grid;
  }

  .bottom-bar--shell {
    position: sticky;
    inset: 0 auto auto 0;
    width: auto;
    height: calc(100svh - 36px);
    padding: 12px 10px;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface-base);
  }

  .toast {
    right: 24px;
    left: auto;
    max-width: 360px;
  }

  .bottom-bar {
    justify-content: stretch;
  }

  .nav-button {
    min-height: 58px;
    padding: 8px 4px;
    border-radius: 12px;
    gap: 4px;
  }

  .bottom-bar--shell .nav-button span {
    display: block;
    font-size: 10px;
  }

  .appbar__title span,
  .chat-appbar__title span {
    display: none;
  }

  .appbar,
  .chat-appbar {
    min-height: 48px;
  }

  .toolbar-strip {
    overflow: visible;
    flex-wrap: wrap;
  }

  .conversation-list {
    gap: 6px;
  }

  .search-results,
  .saved-section,
  .saved-section__body {
    gap: 6px;
  }
}
