:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #ededeb;
  --surface-3: #e4e4e1;
  --text: #1f1f1f;
  --muted: #6b6b66;
  --soft: #8a8a84;
  --line: #d9d9d5;
  --line-strong: #c7c7c2;
  --accent: #0f6b4f;
  --accent-2: #0b5f47;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  --sidebar: #f0f0ed;
  --composer: rgba(255, 255, 255, 0.92);
  --radius: 8px;
  --sidebar-width: 286px;
  --topbar-height: 58px;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #212121;
  --surface: #2f2f2f;
  --surface-2: #3a3a3a;
  --surface-3: #4a4a4a;
  --text: #ececec;
  --muted: #b4b4b4;
  --soft: #8c8c8c;
  --line: #454545;
  --line-strong: #5b5b5b;
  --accent: #19c37d;
  --accent-2: #12a66a;
  --danger: #ff6b62;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --sidebar: #171717;
  --composer: rgba(47, 47, 47, 0.94);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

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

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-width: 0;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition:
    transform 180ms ease,
    visibility 180ms ease;
}

.app-shell.sidebar-collapsed .sidebar {
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-100%);
}

.brand-row,
.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-row {
  justify-content: space-between;
  gap: 8px;
}

.brand {
  gap: 10px;
  padding: 5px 4px;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.brand-copy strong,
.brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.primary-action,
.sidebar-link,
.session-item,
.quick-prompt,
.ghost-button,
.solid-button,
.chip-button,
.icon-button,
.avatar-button,
.send-button,
.auth-tab {
  border: 0;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

.primary-action:active,
.sidebar-link:active,
.session-item:active,
.quick-prompt:active,
.ghost-button:active,
.solid-button:active,
.chip-button:active,
.icon-button:active,
.avatar-button:active,
.send-button:active,
.auth-tab:active {
  transform: scale(0.98);
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
}

.primary-action:hover,
.sidebar-link:hover,
.session-item:hover,
.quick-prompt:hover,
.icon-button:hover,
.chip-button:hover,
.avatar-button:hover,
.ghost-button:hover,
.auth-tab:hover {
  background: var(--surface-2);
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(127, 127, 127, 0.08);
  color: var(--muted);
}

.sidebar-search:focus-within {
  border-color: var(--line-strong);
  background: var(--surface);
}

.sidebar-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.history-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.section-label {
  padding: 8px 9px 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.session-list {
  display: grid;
  gap: 2px;
}

.session-list.compact:empty::after,
.session-list:empty::after {
  content: attr(data-empty);
  display: block;
  padding: 9px;
  color: var(--soft);
  font-size: 12px;
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 3px 4px 3px 10px;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
}

.session-item.active {
  background: var(--surface-2);
}

.session-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.session-meta {
  color: var(--soft);
  font-size: 11px;
}

.session-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.session-icon:hover {
  background: rgba(127, 127, 127, 0.12);
  color: var(--text);
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
}

.chat-main {
  position: relative;
  display: grid;
  min-width: 0;
  height: 100%;
  min-height: 0;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
  background: var(--bg);
}

.topbar,
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.topbar {
  min-height: var(--topbar-height);
  padding: 0 18px;
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

#openSidebar {
  display: none;
}

.app-shell.sidebar-collapsed #openSidebar {
  display: inline-grid;
}

.select-wrap select,
.field select,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: var(--surface);
  color: var(--text);
}

.select-wrap select {
  min-height: 38px;
  padding: 0 32px 0 12px;
  font-weight: 650;
}

.select-wrap select:focus,
.field select:focus,
.field input:focus,
.field textarea:focus,
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.icon-button,
.avatar-button,
.chip-button {
  display: inline-grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
}

.icon-button {
  font-weight: 700;
}

.avatar-button {
  width: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
}

.chip-button {
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
}

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

.welcome {
  display: grid;
  width: min(820px, calc(100% - 32px));
  min-height: 100%;
  margin: 0 auto;
  place-content: center;
  padding: 52px 0 130px;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.14;
  text-align: center;
  font-weight: 760;
}

.welcome p {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  text-align: center;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.quick-prompt {
  min-height: 70px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.quick-prompt strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.quick-prompt span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.message-stack {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 170px;
}

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

.message-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.message.user .message-avatar {
  background: var(--text);
  color: var(--bg);
}

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

.message-role {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.message-content {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 15px;
}

.message.user .message-content {
  width: fit-content;
  max-width: min(680px, 100%);
  margin-left: auto;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--surface-2);
}

.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.typing-caret::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--text);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  justify-items: center;
  width: 100%;
  padding: 0 16px 14px;
  background: linear-gradient(to top, var(--bg) 70%, color-mix(in srgb, var(--bg) 0%, transparent));
}

.quick-prompts {
  display: flex;
  width: min(820px, 100%);
  gap: 8px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-prompts .quick-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.quick-prompts .quick-chip:hover {
  color: var(--text);
  background: var(--surface-2);
}

.composer {
  display: grid;
  grid-template-columns: 38px 38px minmax(0, 1fr) 38px;
  align-items: end;
  width: min(820px, 100%);
  min-height: 54px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--composer);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.composer textarea {
  max-height: 190px;
  min-height: 38px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.45;
  padding: 9px 6px;
}

.send-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
}

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

.send-button .stop-icon,
.is-generating .send-button .send-icon {
  display: none;
}

.is-generating .send-button .stop-icon {
  display: block;
}

.fine-print,
.copyright {
  width: min(820px, 100%);
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 12px;
  text-align: center;
}

.copyright {
  margin-top: 2px;
  font-size: 11px;
}

.modal {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(3px);
}

.modal-card {
  display: grid;
  gap: 18px;
  width: 100%;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-card.small {
  width: min(430px, 100%);
  margin: 0 auto;
}

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

.modal-header h2,
.admin-topbar h1,
.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

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

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.field.wide {
  grid-column: 1 / -1;
}

.field input,
.field select {
  min-height: 42px;
  padding: 0 11px;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
  padding: 11px;
}

.modal-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
}

.ghost-button,
.solid-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 650;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
}

.ghost-button.danger {
  color: var(--danger);
}

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

.center-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.helper-text,
.help-list p {
  margin: 0;
  color: var(--muted);
}

.help-list {
  display: grid;
  gap: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.auth-tab {
  min-height: 34px;
  border-radius: 7px;
  background: transparent;
}

.auth-tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.only-mobile {
  display: none;
}

.backdrop {
  display: none;
}

body.is-generating .send-button {
  background: var(--surface-3);
  color: var(--text);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100vw;
  min-height: 100vh;
  background: var(--bg);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 22px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav a {
  min-height: 38px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 650;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

.admin-main {
  min-width: 0;
  overflow: auto;
  padding: 0 0 48px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 18px 26px;
}

.admin-topbar p,
.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.admin-section {
  width: min(1040px, calc(100% - 40px));
  margin: 22px auto 0;
}

.admin-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-card {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 30px;
  line-height: 1;
}

.env-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

code {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  font-size: 12px;
}

.admin-session-list {
  display: grid;
  gap: 8px;
}

.admin-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.admin-session-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-session-row span {
  color: var(--muted);
  font-size: 12px;
}

.deploy-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.deploy-list li + li {
  margin-top: 8px;
}

.account-grid {
  display: grid;
  gap: 14px;
}

.account-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 20px;
  font-weight: 800;
}

.profile-head h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.profile-head p {
  margin: 2px 0;
  color: var(--muted);
}

.account-links,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.plan-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 188px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.plan-card.featured {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.plan-card h3,
.plan-card p {
  margin: 0;
}

.plan-card strong {
  font-size: 32px;
  line-height: 1;
}

.plan-card p {
  color: var(--muted);
}

.admin-actions.left {
  justify-content: flex-start;
}

.task-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-list span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
}

.permission-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.permission-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.permission-table th,
.permission-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.permission-table th {
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}

.permission-table tr:last-child td {
  border-bottom: 0;
}

.filter-field {
  max-width: 260px;
}

.record-list {
  display: grid;
  gap: 8px;
}

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.record-row strong,
.record-row span {
  display: block;
}

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

.record-amount.plus {
  color: var(--accent);
}

.record-amount.minus {
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 36px));
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 860px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(310px, calc(100vw - 52px));
    transform: translateX(-105%);
    transition: transform 210ms ease;
    box-shadow: var(--shadow);
  }

  .app-shell.sidebar-collapsed .sidebar {
    pointer-events: auto;
    visibility: visible;
    transform: translateX(-105%);
  }

  .sidebar.open,
  .app-shell.sidebar-collapsed .sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  .backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.44);
  }

  .backdrop.show {
    display: block;
  }

  .only-mobile {
    display: inline-grid;
  }

  #openSidebar {
    display: inline-grid;
  }

  .topbar {
    padding: 0 10px;
  }

  .select-wrap select {
    max-width: 180px;
  }

  .chip-button {
    min-width: 34px;
    padding: 0 8px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .conversation {
    overflow-x: hidden;
  }

  .welcome,
  .message-stack {
    width: min(100% - 22px, 820px);
  }

  .welcome {
    padding-top: 34px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

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

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

  .composer-wrap {
    padding: 0 10px 10px;
  }

  .fine-print {
    font-size: 11px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-main {
    overflow: visible;
  }

  .admin-topbar {
    position: static;
    padding: 18px 16px;
  }

  .admin-section {
    width: calc(100% - 24px);
  }

  .metric-grid,
  .settings-grid,
  .account-grid.two,
  .account-links,
  .plan-grid,
  .task-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 5px;
  }

  .select-wrap select {
    max-width: 138px;
    padding-left: 9px;
    font-size: 13px;
  }

  .avatar-button,
  .icon-button {
    min-width: 34px;
    width: 34px;
    height: 34px;
  }

  .chip-button {
    height: 34px;
    font-size: 12px;
  }

  .welcome h1 {
    font-size: 28px;
  }

  .welcome p {
    font-size: 14px;
  }

  .quick-prompts {
    display: none;
  }

  .composer {
    grid-template-columns: 34px 34px minmax(0, 1fr) 34px;
    min-height: 50px;
    padding: 6px;
  }

  .send-button {
    width: 34px;
    height: 34px;
  }

  .modal-card,
  .admin-card {
    padding: 16px;
  }

  .modal-actions,
  .admin-actions {
    justify-content: stretch;
  }

  .modal-actions > *,
  .admin-actions > * {
    flex: 1 1 100%;
  }

  .metric-grid {
    gap: 8px;
  }
}
