:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f7f8;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --line: #e7e7eb;
  --line-strong: #d8d8de;
  --text: #111111;
  --muted: #6e6e73;
  --accent: #111111;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sidebar-width: 320px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.minimal-shell {
  min-height: 100vh;
  background: var(--bg);
}

.chat-page {
  width: min(860px, calc(100% - 24px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(10px, env(safe-area-inset-top)) 0 calc(18px + env(safe-area-inset-bottom));
}

.minimal-topbar,
.topbar-left,
.topbar-right,
.sidebar-topbar,
.sidebar-brand,
.sidebar-footer {
  display: flex;
  align-items: center;
}

.minimal-topbar {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 8px;
}

.topbar-left,
.topbar-right,
.sidebar-topbar,
.sidebar-brand,
.sidebar-footer {
  gap: 12px;
}

.wordmark-text.solo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon-button,
.composer-icon-button,
.saved-chats-button,
.secondary,
.clear-link,
.send-button,
.sidebar-chat-item,
.attachment-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button,
.composer-icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.saved-chats-button,
.secondary {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.saved-chats-button {
  font-size: 0.95rem;
  color: var(--muted);
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 24px 0 12px;
}

.empty-state-inner {
  width: 100%;
  max-width: 460px;
  text-align: center;
  display: grid;
  gap: 14px;
  align-self: center;
  margin-top: clamp(40px, 16vh, 140px);
}

.empty-logo-wrap {
  display: grid;
  place-items: center;
}

.empty-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.6rem);
  letter-spacing: -0.03em;
}

.empty-state p,
.bubble-text,
.bubble-next-step,
.meta,
.status-chip,
.brand-subtitle {
  color: var(--muted);
  line-height: 1.5;
}

.chat-shell {
  min-height: 0;
  padding: 12px 0;
}

.simple-thread {
  display: grid;
  gap: 14px;
  align-content: start;
}

.chat-bubble {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 20px;
  max-width: min(92%, 720px);
}

.user-bubble {
  justify-self: end;
  background: #f1f1f4;
  color: var(--text);
}

.assistant-bubble {
  justify-self: start;
  background: transparent;
  border: 1px solid var(--line);
}

.bubble-text {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 1rem;
}

.bubble-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.bubble-meta-copy {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: capitalize;
}

.bubble-next-step {
  font-size: 0.9rem;
}

.bubble-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.citation-chip,
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.inline-answer-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.inline-answer-badge.strong {
  color: #0d7a43;
  background: #e9f8ef;
}

.inline-answer-badge.partial {
  color: #8a5a00;
  background: #fff3dd;
}

.inline-answer-badge.weak {
  color: #9d2f2f;
  background: #fde9e9;
}

.inline-answer-badge.clarify {
  color: #1f5faa;
  background: #e9f1ff;
}

.inline-answer-badge.unknown {
  color: var(--muted);
  background: #f2f2f5;
}

.composer-shell {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0.92) 25%, rgba(255,255,255,1));
  padding-top: 18px;
}

.bottom-composer {
  display: grid;
  gap: 10px;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-remove {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
}

.composer-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.input-wrap {
  min-width: 0;
}

.input-wrap textarea {
  width: 100%;
  min-height: 24px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 10px 4px;
  line-height: 1.45;
}

.input-wrap textarea::placeholder {
  color: #9a9aa0;
}

.round-send {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  display: inline-grid;
  place-items: center;
}

.composer-icon-button.listening {
  background: #111111;
  color: #ffffff;
}

.composer-subrow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 6px;
}

.clear-link {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-chip {
  min-height: 20px;
  font-size: 0.9rem;
}

.status-chip.visible.loading {
  color: #8a5a00;
}

.status-chip.visible.success {
  color: #0d7a43;
}

.status-chip.visible.error {
  color: #9d2f2f;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(var(--sidebar-width), calc(100vw - 24px));
  z-index: 40;
  border-right: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.sidebar-inner {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 18px;
}

.sidebar-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.sidebar-section-title,
.meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.recent-chats-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.sidebar-chat-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid transparent;
}

.sidebar-chat-item.active {
  border-color: var(--line-strong);
  background: #efeff3;
}

.sidebar-footer {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #111111;
}

.brand-mark {
  font-weight: 600;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.24);
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .chat-page {
    width: min(100% - 16px, 100%);
  }

  .empty-state-inner {
    margin-top: clamp(24px, 10vh, 80px);
  }

  .composer-row {
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    padding: 8px;
  }

  .chat-bubble {
    max-width: 100%;
  }

  .saved-chats-button {
    padding: 9px 12px;
    font-size: 0.88rem;
  }
}
