:root {
  color-scheme: light;
  --canvas: #f6f7f9;
  --canvas-strong: #eceff3;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #ffffff;
  --surface-muted: #f3f4f6;
  --sidebar: #f3f4f6;
  --sidebar-muted: #5d6b7a;
  --ink: #1a1f2b;
  --muted: #5d6777;
  --line: #e5e7eb;
  --accent: #10a37f;
  --accent-dark: #0d8b6f;
  --accent-pale: #d9f8f1;
  --danger: #d75a57;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.07);
  --sidebar-width: 286px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 200ms ease, color 200ms ease;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #070b10;
  --canvas-strong: #101821;
  --surface: rgba(15, 23, 34, 0.84);
  --surface-strong: #111827;
  --surface-muted: #0f1726;
  --sidebar: rgba(12, 17, 25, 0.92);
  --sidebar-muted: #a7b5c8;
  --ink: #edf4ff;
  --muted: #9aa9ba;
  --line: rgba(148, 163, 184, 0.17);
  --accent: #5de2c2;
  --accent-dark: #2ec9a9;
  --accent-pale: #113d36;
  --danger: #f1827d;
  --shadow: 0 24px 70px rgba(2, 6, 18, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8f9fb 0%, #eef2f7 100%);
  color: var(--ink);
  overflow: hidden;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top, rgba(93, 226, 194, 0.11), transparent 28%),
    linear-gradient(180deg, #070b10 0%, #0d141d 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(14, 117, 106, 0.25);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100%;
  gap: 0;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 14px 16px 14px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(12, 17, 25, 0.98), rgba(9, 13, 20, 0.95)),
    rgba(9, 13, 20, 0.9);
  border-right-color: rgba(148, 163, 184, 0.18);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand-row,
.brand,
.topbar,
.composer-actions,
.settings-header,
.settings-actions,
.config-banner,
.conversation-row {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  gap: 10px;
  color: inherit;
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark,
.welcome-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-family: Georgia, serif;
  font-weight: 700;
}

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

.close-sidebar,
.menu-button,
.dialog-close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.close-sidebar {
  display: none;
  color: var(--sidebar-muted);
  font-size: 25px;
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(93, 226, 194, 0.22);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(93, 226, 194, 0.12), rgba(255, 255, 255, 0.92));
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(45, 201, 169, 0.06);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

:root[data-theme="dark"] .new-chat-button {
  background: linear-gradient(135deg, rgba(93, 226, 194, 0.14), rgba(17, 24, 39, 0.74));
  border-color: rgba(93, 226, 194, 0.3);
}

.new-chat-button:hover {
  border-color: rgba(45, 201, 169, 0.45);
  box-shadow: 0 12px 28px rgba(45, 201, 169, 0.16);
  transform: translateY(-1px);
}

.search-box {
  display: block;
  margin-top: 10px;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.search-box input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
}

.search-box input::placeholder {
  color: var(--muted);
}

.history-heading {
  margin: 12px 8px 6px;
  color: #858e88;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.conversation-list {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3d4440 transparent;
}

.conversation-row {
  gap: 2px;
  margin-bottom: 2px;
  border-radius: 10px;
  transition: background 150ms ease, transform 150ms ease;
}

.conversation-row:hover,
.conversation-row.active {
  background: rgba(14, 165, 160, 0.08);
}

.conversation-row:hover {
  transform: translateX(2px);
}

.conversation-select {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  padding: 7px 4px 7px 8px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.conversation-delete {
  visibility: hidden;
  border: 0;
  background: transparent;
  color: #969e99;
  cursor: pointer;
  font-size: 11px;
  padding: 5px;
}

.conversation-row:hover .conversation-delete,
.conversation-row:focus-within .conversation-delete {
  visibility: visible;
}

.empty-history {
  margin: 10px 8px;
  color: #7f8882;
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sidebar-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  border-radius: 8px;
  font-size: 13px;
}

.sidebar-footer p {
  margin: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.main-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 74px minmax(0, 1fr) auto;
  background: rgba(255, 255, 255, 0.18);
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  padding: 0 31px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(15px);
}

:root[data-theme="dark"] .topbar {
  background: rgba(15, 23, 42, 0.52);
}

.menu-button {
  display: none;
  font-size: 22px;
}

.model-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.model-summary button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
}

:root[data-theme="dark"] .model-summary button {
  background: rgba(17, 24, 39, 0.64);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aaa;
  box-shadow: 0 0 0 3px rgba(170, 170, 170, 0.15);
}

.connected .connection-dot,
.connection-dot.connected {
  background: #38a171;
  box-shadow: 0 0 0 3px rgba(56, 161, 113, 0.15);
}

.disconnected .connection-dot,
.connection-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(182, 66, 50, 0.14);
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease;
}

.theme-toggle:hover {
  color: var(--ink);
}

.theme-icon {
  display: inline-block;
  transition: transform 300ms ease;
}

.chat-scroll {
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.welcome-view {
  display: flex;
  width: min(760px, calc(100% - 40px));
  min-height: 100%;
  margin: 0 auto;
  flex-direction: column;
  justify-content: center;
  padding: 50px 0 65px;
}

.welcome-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 24px;
  border-radius: 13px 13px 13px 3px;
  box-shadow: 0 10px 28px rgba(14, 117, 106, 0.2);
  font-size: 23px;
}

.welcome-view h1 {
  max-width: 620px;
  margin: 11px 0 11px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.03;
}

.welcome-copy {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 36px;
}

.suggestion-grid button {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 17px 18px;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.02);
}

.suggestion-grid button:hover {
  border-color: rgba(16, 163, 127, 0.38);
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.06);
}

:root[data-theme="dark"] .suggestion-grid button {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.78), rgba(12, 17, 25, 0.9));
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 16px 32px rgba(2, 6, 18, 0.25);
}

:root[data-theme="dark"] .suggestion-grid button:hover {
  border-color: rgba(93, 226, 194, 0.28);
  background: linear-gradient(180deg, rgba(20, 31, 45, 0.92), rgba(12, 17, 25, 0.98));
}

.suggestion-grid span,
.suggestion-grid small {
  display: block;
}

.suggestion-grid span {
  margin-bottom: 7px;
  font-weight: 750;
}

.suggestion-grid small {
  color: var(--muted);
  line-height: 1.4;
}

.message-list {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.message {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 0 26px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.message-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 3px;
  background: var(--surface);
  color: var(--accent);
  font-family: Georgia, serif;
  font-weight: 700;
}

.message-body {
  min-width: 0;
}

.message.user .message-body {
  max-width: min(680px, 87%);
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #dff8f5 0%, #e7f0ff 100%);
  padding: 14px 16px;
  border: 1px solid rgba(16, 163, 127, 0.12);
  box-shadow: 0 10px 20px rgba(16, 163, 127, 0.08);
}

.message:not(.user) .message-body {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
}

.message.user .message-body,
.message:not(.user) .message-body {
  backdrop-filter: blur(4px);
}

:root[data-theme="dark"] .message.user .message-body {
  background: linear-gradient(135deg, rgba(31, 94, 83, 0.9), rgba(24, 78, 117, 0.88));
  border-color: rgba(93, 226, 194, 0.2);
  box-shadow: 0 18px 36px rgba(18, 87, 77, 0.22);
}

:root[data-theme="dark"] .message:not(.user) .message-body {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.8), rgba(12, 17, 25, 0.92));
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 24px rgba(2, 6, 18, 0.25);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 12px;
}

.message.user .message-meta {
  display: none;
}

.message-author {
  font-weight: 780;
}

.message-time {
  color: var(--muted);
}

.message-content {
  font-size: 15px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.message-content .markdown-body {
  display: block;
}

.message-content p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 800;
}

.message-content em {
  font-style: italic;
}

.message-content del {
  color: inherit;
  opacity: 0.78;
  text-decoration: line-through;
}

.message-content a {
  color: #0d5d92;
  text-decoration: underline;
}

.message-content ul,
.message-content ol {
  margin: 12px 0;
  padding-left: 22px;
}

.message-content li + li {
  margin-top: 6px;
}

.message-content blockquote {
  margin: 14px 0;
  border-left: 3px solid rgba(14, 117, 106, 0.5);
  background: rgba(14, 117, 106, 0.05);
  color: var(--ink);
  padding: 10px 12px 10px 14px;
}

.message-content blockquote p {
  margin: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 16px 0 10px;
  line-height: 1.25;
}

.message-content h1 { font-size: 1.7em; }
.message-content h2 { font-size: 1.4em; }
.message-content h3 { font-size: 1.2em; }
.message-content h4,
.message-content h5,
.message-content h6 { font-size: 1.05em; }

.message-content table {
  margin: 16px 0;
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #d9d4ca;
  border-radius: 6px;
  overflow: hidden;
  font-size: 14px;
}

.message-content table thead {
  background: #f2ede4;
}

.message-content table thead th {
  padding: 11px 13px;
  text-align: left;
  font-weight: 700;
  color: #202522;
  border-right: 1px solid #d9d4ca;
  border-bottom: 1px solid #d9d4ca;
}

.message-content table thead th:last-child {
  border-right: none;
}

.message-content table tbody tr {
  border-bottom: 1px solid #e8e3d9;
}

.message-content table tbody tr:last-child {
  border-bottom: none;
}

.message-content table tbody td {
  padding: 10px 13px;
  border-right: 1px solid #d9d4ca;
  color: #202522;
}

.message-content table tbody td:last-child {
  border-right: none;
}

.message-content table tbody tr:nth-child(even) {
  background: rgba(245, 241, 233, 0.3);
}

.message-content pre {
  margin: 14px 0;
  border: 1px solid #343a36;
  border-radius: 8px;
  background: #1b1f1d;
  color: #e8eee9;
  overflow-x: auto;
  padding: 15px;
  white-space: pre;
}

.message-content code {
  border-radius: 4px;
  background: rgba(16, 24, 21, 0.06);
  color: #1c2624;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  padding: 2px 5px;
}

.message-content .katex-display {
  margin: 14px 0;
  overflow-x: auto;
}

.message-content .katex-inline {
  display: inline-block;
}

.message-content pre code {
  background: transparent;
  color: #e8eee9;
  padding: 0;
}

.message-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.message-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.message-actions button:hover {
  color: var(--accent-dark);
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 8px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 150ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 300ms;
}

@keyframes pulse {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.composer-area {
  position: relative;
  z-index: 4;
  padding: 10px max(22px, calc((100% - 820px) / 2)) 15px;
  background: linear-gradient(to bottom, rgba(245, 246, 247, 0), rgba(245, 246, 247, 0.9) 28%, var(--canvas) 100%);
}

:root[data-theme="dark"] .composer-area {
  background: linear-gradient(to bottom, rgba(7, 11, 16, 0), rgba(7, 11, 16, 0.92) 24%, rgba(7, 11, 16, 0.98) 100%);
}

.composer {
  border: 1px solid rgba(16, 163, 127, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .composer {
  background: linear-gradient(180deg, rgba(15, 23, 34, 0.88), rgba(11, 16, 23, 0.96));
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 18px 40px rgba(2, 6, 18, 0.42);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 190px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.55;
  padding: 16px 17px 8px;
  font-size: 15px;
}

.composer textarea::placeholder {
  color: #8a939c;
}

.composer-actions {
  min-height: 48px;
  justify-content: flex-end;
  gap: 10px;
  padding: 7px 9px 9px 16px;
}

.composer-hint {
  margin-right: auto;
  color: #959a96;
  font-size: 11px;
}

.send-button,
.stop-button,
.primary-button,
.secondary-button {
  min-height: 36px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 720;
  padding: 0 14px;
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.send-button,
.primary-button {
  border: 1px solid rgba(16, 163, 127, 0.2);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(16, 163, 127, 0.22);
}

.send-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

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

.stop-button {
  border: 1px solid #c18c84;
  background: #fff7f5;
  color: #9b3529;
}

.disclaimer {
  margin: 8px 0 0;
  color: #8d928e;
  font-size: 10px;
  text-align: center;
}

.sidebar-backdrop {
  display: none;
}

.settings-dialog {
  width: min(600px, calc(100% - 30px));
  max-height: calc(100vh - 42px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 0;
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .settings-dialog {
  background: linear-gradient(180deg, rgba(14, 20, 29, 0.98), rgba(10, 15, 22, 0.98));
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: 0 24px 60px rgba(2, 6, 18, 0.58);
}

.settings-dialog::backdrop {
  background: rgba(17, 21, 19, 0.55);
  backdrop-filter: blur(3px);
}

.settings-panel {
  max-height: calc(100vh - 42px);
  overflow-y: auto;
  padding: 25px;
}

.settings-panel .field input,
.settings-panel .field textarea {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.settings-header {
  justify-content: space-between;
  margin-bottom: 20px;
}

.settings-header h2 {
  margin: 4px 0 0;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 500;
}

.dialog-close {
  width: 36px;
  height: 36px;
  color: var(--muted);
  font-size: 25px;
}

.config-banner {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface-muted);
  padding: 13px 14px;
}

.config-banner .connection-dot {
  margin-top: 5px;
}

.config-banner strong,
.config-banner p {
  display: block;
}

.config-banner strong {
  font-size: 13px;
}

.config-banner p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field {
  display: block;
  margin-bottom: 17px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 740;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

.field input[readonly] {
  background: var(--surface-muted);
  color: var(--muted);
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.settings-actions {
  justify-content: flex-end;
  gap: 9px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
}

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

.toast {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100% - 44px));
  border-radius: 8px;
  background: #1b201d;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  padding: 12px 15px;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
  line-height: 1.45;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), calc(100% - 45px));
    transform: translateX(-102%);
    transition: transform 200ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .close-sidebar,
  .menu-button {
    display: block;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 15;
    inset: 0;
    background: rgba(17, 21, 19, 0.5);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main-panel {
    height: 100%;
    grid-template-rows: 62px minmax(0, 1fr) auto;
  }

  .topbar {
    padding: 0 17px;
  }

  .model-summary {
    margin-right: auto;
  }
}

@media (max-width: 560px) {
  .status-pill span:last-child {
    display: none;
  }

  .welcome-view,
  .message-list {
    width: calc(100% - 28px);
  }

  .welcome-view {
    justify-content: flex-start;
    padding-top: 54px;
  }

  .welcome-view h1 {
    font-size: 39px;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }

  .suggestion-grid button {
    min-height: 76px;
  }

  .message {
    grid-template-columns: 39px minmax(0, 1fr);
    gap: 10px;
  }

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

  .message.user .message-body {
    max-width: 94%;
  }

  .composer-area {
    padding-right: 10px;
    padding-left: 10px;
  }

  .composer-hint {
    display: none;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .settings-panel {
    padding: 20px;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

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