:root {
  --accent: #0f766e;
  --accent-soft: #dff3f0;
  --accent-text: #ffffff;
  --background: #f7f7f4;
  --border: #d8d8d2;
  --danger: #b42318;
  --muted: #65675f;
  --panel: #ffffff;
  --composer-height: 9.75rem;
  --sidebar-width: 17rem;
  --soft: #eeeeea;
  --text: #171815;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #5eead4;
  --accent-soft: #123f3b;
  --accent-text: #06201d;
  --background: #111313;
  --border: #303436;
  --danger: #ffb4ab;
  --muted: #a0a5a1;
  --panel: #181b1b;
  --soft: #202424;
  --text: #f0f3ef;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

button,
input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 0;
  color: inherit;
  font: inherit;
}

button {
  background: var(--panel);
  cursor: pointer;
  height: 2.35rem;
  padding: 0 0.75rem;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 80ms ease;
}

button:disabled {
  color: var(--muted);
  cursor: default;
}

button:not(:disabled):hover,
.chat-row:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

button:not(:disabled):active,
button.click-confirm,
button.click-confirm:disabled,
.chat-row:active,
.chat-row.click-confirm {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  color: var(--accent-text);
  transform: translateY(1px);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-0.18rem);
  }
}

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

.app.sidebar-collapsed {
  --sidebar-width: 0rem;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 1rem;
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
}

.app.sidebar-collapsed .sidebar {
  border-right: 0;
  padding-left: 0;
  padding-right: 0;
  pointer-events: none;
  visibility: hidden;
}

.sidebar-title {
  align-items: center;
  color: inherit;
  display: inline-flex;
  font-size: 1.1rem;
  font-weight: 700;
  gap: 0.5rem;
  height: 2.25rem;
  text-decoration: none;
  text-transform: lowercase;
}

.brand-logo {
  background: var(--accent);
  display: block;
  flex: 0 0 auto;
  height: 1.42rem;
  mask: url("/nully_mark.svg") center / contain no-repeat;
  -webkit-mask: url("/nully_mark.svg") center / contain no-repeat;
  width: 1.06rem;
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem 0;
}

.chat-section {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  margin: 0.85rem 0 0.4rem;
  text-transform: lowercase;
}

.chat-section:first-child {
  margin-top: 0.1rem;
}

.chat-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  color: inherit;
  display: grid;
  gap: 0.15rem;
  min-height: 3.4rem;
  margin: 0 0 0.35rem;
  overflow: hidden;
  padding: 0.45rem 0.65rem;
  text-align: left;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 80ms ease;
  width: 100%;
}

.chat-row-title,
.chat-row-meta {
  display: block;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-row[aria-current="true"] {
  background: var(--soft);
  border-color: var(--accent);
}

.chat-row.click-confirm .chat-row-meta,
.chat-row:active .chat-row-meta {
  color: var(--accent-text);
}

.sidebar-controls {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.45rem;
  padding-bottom: 3.1rem;
  padding-top: 0.75rem;
}

.chat-actions {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chat-actions button {
  min-width: 0;
  padding: 0 0.4rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2rem 1.5rem 4rem;
  position: relative;
}

.app:not(.has-chat) .main {
  justify-content: center;
  padding-bottom: 8rem;
}

.app.has-chat .main {
  padding-bottom: calc(var(--composer-height) + 2rem);
}

.home-title {
  font-size: 3.25rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 20vh auto 1.5rem;
}

.app:not(.has-chat) .home-title {
  margin: 0 auto 1.5rem;
}

.home-brand {
  align-items: center;
  display: inline-flex;
  gap: 0.8rem;
}

.home-brand .brand-logo {
  height: 3.4rem;
  width: 2.54rem;
}

.output {
  margin: 0 auto;
  max-width: 58rem;
  width: 100%;
}

.message {
  margin: 1rem 0;
  overflow-wrap: anywhere;
}

.message-item.user-message {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  margin: 1rem 0;
}

.message-item.user-message .message.user {
  flex: 0 1 auto;
  margin: 0;
}

.message.user {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--accent-text);
  margin-left: auto;
  max-width: min(42rem, 85%);
  padding: 0.65rem 0.8rem;
  width: fit-content;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  margin-top: 0;
  opacity: 0;
  order: -1;
  pointer-events: none;
  transition: opacity 0.12s ease;
  width: 3.85rem;
}

.message-item.user-message:hover .message-actions,
.message-item.user-message:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.message-action {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--muted);
  display: inline-grid;
  height: 1.8rem;
  padding: 0;
  place-items: center;
  width: 1.8rem;
}

.message-action:hover,
.message-action:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.message-action::before {
  background: currentColor;
  content: "";
  height: 1rem;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  width: 1rem;
}

.message-action[data-message-action="edit"]::before {
  mask-image: url("/edit.svg");
  -webkit-mask-image: url("/edit.svg");
}

.message-action[data-message-action="retry"]::before {
  mask-image: url("/retry.svg");
  -webkit-mask-image: url("/retry.svg");
}

.response-loading {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 0.3rem;
  justify-content: flex-start;
  margin: 0.25rem 0 1rem;
  min-height: 1.15rem;
  padding-left: 0.2rem;
}

.response-loading span {
  animation: loading-pulse 1s ease-in-out infinite;
  background: currentColor;
  border-radius: 0;
  height: 0.36rem;
  width: 0.36rem;
}

.response-loading span:nth-child(2) {
  animation-delay: 0.12s;
}

.response-loading span:nth-child(3) {
  animation-delay: 0.24s;
}

.message.assistant {
  color: var(--text);
}

.message.error {
  color: var(--danger);
  white-space: pre-wrap;
}

.message p,
.message blockquote {
  margin: 0.45rem 0;
}

.message ul,
.message ol {
  margin: 0.45rem 0;
  padding-left: 1.5rem;
}

.message h1,
.message h2,
.message h3,
.message h4,
.message h5,
.message h6 {
  font-size: 1rem;
  margin: 0.75rem 0 0.35rem;
}

.message blockquote {
  border-left: 2px solid var(--border);
  color: var(--muted);
  padding-left: 0.75rem;
}

.message table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
}

.message th,
.message td {
  border: 1px solid var(--border);
  padding: 0.25rem 0.45rem;
}

.message pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  margin: 0.75rem 0;
  overflow-x: auto;
  padding: 0.75rem;
  white-space: pre;
}

.message code,
.reasoning pre {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message :not(pre) > code {
  background: var(--soft);
  border-radius: 0;
  padding: 0.08rem 0.25rem;
}

.code-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  margin: 0.75rem 0;
  overflow: hidden;
}

.code-block pre {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
}

.reasoning {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--muted);
  margin: 0.75rem 0;
  overflow: hidden;
}

.reasoning summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.45rem;
  list-style: none;
  min-height: 2.15rem;
  padding: 0.45rem 0.65rem;
}

.reasoning summary::-webkit-details-marker {
  display: none;
}

.reasoning summary::before {
  background: var(--accent);
  border-radius: 0;
  content: "";
  height: 0.45rem;
  opacity: 0.75;
  width: 0.45rem;
}

.reasoning[open] summary {
  border-bottom: 1px solid var(--border);
}

.reasoning pre {
  background: var(--background);
  margin: 0;
  overflow-x: auto;
  padding: 0.65rem;
  white-space: pre-wrap;
}

.composer {
  background: var(--background);
  bottom: 0;
  left: var(--sidebar-width);
  padding: 0.75rem 1.5rem 1.5rem;
  position: fixed;
  right: 0;
  z-index: 4;
}

.app:not(.has-chat) .composer {
  bottom: auto;
  left: var(--sidebar-width);
  margin: 0 auto;
  padding-top: 0;
  position: static;
  width: min(44rem, calc(100vw - var(--sidebar-width) - 3rem));
  z-index: auto;
}

.app:not(.has-chat) .chat-form,
.app:not(.has-chat) .composer-controls,
.app:not(.has-chat) .status-line {
  max-width: 44rem;
}

.chat-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  display: flex;
  gap: 0.5rem;
  margin: 0 auto;
  max-width: 58rem;
  min-height: 3.25rem;
  padding: 0.45rem;
  width: 100%;
}

#prompt {
  background: transparent;
  border: 0;
  flex: 1;
  min-height: 2.25rem;
  outline: 0;
  padding: 0.45rem 0.55rem;
  resize: none;
}

#send {
  align-self: flex-end;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  display: grid;
  min-width: 2.35rem;
  padding: 0;
  place-items: center;
  position: relative;
  width: 2.35rem;
}

#send svg {
  fill: none;
  height: 1.1rem;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 1.1rem;
}

#send.is-loading svg {
  opacity: 0;
}

#send.is-loading::after {
  animation: spin 0.75s linear infinite;
  border: 2px solid currentColor;
  border-radius: 0;
  border-right-color: transparent;
  content: "";
  height: 1rem;
  position: absolute;
  width: 1rem;
}

.composer-controls {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  margin: 0.45rem auto 0;
  max-width: 58rem;
  width: 100%;
}

.composer-model {
  display: flex;
  flex: 0 1 18rem;
  min-width: 0;
}

.composer-model select {
  background: var(--panel);
  height: 2.35rem;
  max-width: 100%;
  padding: 0 0.55rem;
  width: 100%;
}

.composer-config-button {
  display: grid;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
}

.composer-config-button {
  width: 2.35rem;
}

.composer-config-button svg {
  fill: none;
  height: 1.15rem;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 1.15rem;
}

.agent-toggle {
  flex: 0 0 auto;
  font-weight: 700;
  min-width: 4.5rem;
  text-transform: lowercase;
}

.agent-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.agent-trace {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  margin: 0.75rem 0;
  overflow: hidden;
}

.agent-trace > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 0.5rem;
  list-style: none;
  min-height: 2.15rem;
  padding: 0.45rem 0.65rem;
}

.agent-trace > summary::-webkit-details-marker {
  display: none;
}

.agent-trace[open] > summary {
  border-bottom: 1px solid var(--border);
}

.agent-trace-body {
  display: grid;
}

.agent-tool-row {
  border-bottom: 1px solid var(--border);
  color: inherit;
}

.agent-tool-row[open] {
  background: var(--background);
}

.agent-tool-summary {
  align-items: start;
  display: grid;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  gap: 0.55rem;
  grid-template-columns: 0.45rem minmax(6.4rem, 7.25rem) minmax(0, 1fr);
  line-height: 1.35;
  list-style: none;
  min-height: 1.9rem;
  padding: 0.42rem 0.65rem;
}

.agent-tool-summary::-webkit-details-marker {
  display: none;
}

.agent-tool-summary::before {
  background: transparent;
  content: "";
  height: 0.45rem;
  transform: translateY(0.28rem);
  width: 0.45rem;
}

.agent-tool-row[data-active="true"] .agent-tool-summary::before {
  background: var(--accent);
}

.agent-tool-row:last-child {
  border-bottom: 0;
}

.agent-tool-row[data-ok="false"] {
  color: var(--danger);
}

.agent-tool-name {
  color: var(--text);
  font-size: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-tool-detail {
  color: var(--muted);
  font-size: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-tool-full {
  background: var(--soft);
  border-top: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 0;
  max-height: 24rem;
  overflow: auto;
  padding: 0.65rem;
  white-space: pre-wrap;
}

.model-config-panel label {
  display: grid;
  gap: 0.3rem;
}

.model-config-panel input,
.model-config-panel select {
  background: var(--background);
  height: 2.35rem;
  padding: 0 0.55rem;
  width: 100%;
}

.model-config-panel input[type="checkbox"] {
  height: auto;
}

.model-config-grid {
  grid-template-columns: 1fr;
}

.advanced-settings {
  padding: 0;
}

.advanced-settings summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 1.1rem;
  font-weight: 700;
  gap: 1rem;
  justify-content: space-between;
  list-style: none;
  min-height: 2.45rem;
  padding: 0.55rem 0.75rem;
}

.advanced-settings summary::-webkit-details-marker {
  display: none;
}

.advanced-settings-chevron {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  color: var(--muted);
  flex: 0 0 auto;
  height: 0.48rem;
  transform: rotate(45deg) translateY(-0.1rem);
  transition: transform 0.12s ease;
  width: 0.48rem;
}

.advanced-settings[open] .advanced-settings-chevron {
  transform: rotate(225deg) translate(-0.1rem, -0.05rem);
}

.advanced-settings-body {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.number-row {
  align-items: center;
  display: grid !important;
  gap: 0.75rem !important;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
}

.number-control {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: 2.35rem minmax(0, 1fr) 2.35rem;
}

.number-control button {
  font-weight: 700;
  padding: 0;
  width: 2.35rem;
}

.number-control input {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.status-line {
  color: var(--danger);
  display: block;
  margin: 0.5rem auto 0;
  max-width: 58rem;
  min-height: 1.2rem;
}

.status-line:empty {
  display: none;
  margin-top: 0;
  min-height: 0;
}

.to-bottom {
  bottom: calc(var(--composer-height) + 0.75rem);
  left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
  position: fixed;
  transform: translateX(-50%);
  z-index: 5;
}

.sidebar-bottom-controls {
  bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  left: 1rem;
  position: fixed;
  width: calc(var(--sidebar-width) - 2rem);
  z-index: 6;
}

.sidebar-bottom-controls #settings-button {
  flex: 1;
  min-width: 0;
}

.app.sidebar-collapsed .sidebar-bottom-controls {
  width: auto;
}

.app.sidebar-collapsed .sidebar-bottom-controls #settings-button {
  display: none;
}

.sidebar-toggle {
  display: grid;
  padding: 0;
  place-items: center;
  width: 2.35rem;
}

.sidebar-toggle svg {
  fill: none;
  height: 1.25rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 1.25rem;
}

.settings-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2rem 1.5rem 4rem;
}

.onboarding-page,
.upgrade-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2rem 1.5rem 4rem;
}

.settings-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 58rem;
  width: 100%;
}

.settings-header h1 {
  align-items: center;
  display: inline-flex;
  font-size: 2rem;
  gap: 0.65rem;
  margin: 0;
}

.settings-header .brand-logo {
  height: 1.85rem;
  width: 1.38rem;
}

.settings-tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.35rem;
  margin: 1rem auto 0;
  max-width: 58rem;
  overflow-x: auto;
  width: 100%;
}

.settings-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  flex: 0 0 auto;
  font-weight: 700;
  height: 2.45rem;
  min-width: 7rem;
  padding: 0 0.8rem;
}

.settings-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.settings-tab:not(:disabled):hover,
.settings-tab:not(:disabled):active,
.settings-tab.click-confirm {
  background: transparent;
  border-color: transparent transparent var(--accent);
  box-shadow: none;
  color: var(--text);
  transform: none;
}

.settings-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem auto 0;
  max-width: 58rem;
  width: 100%;
}

.onboarding-progress {
  display: grid;
  gap: 0.65rem;
  margin: 1rem auto 0;
  max-width: 58rem;
  width: 100%;
}

.onboarding-progress progress {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--accent);
  height: 0.65rem;
  overflow: hidden;
  width: 100%;
}

.onboarding-progress progress::-webkit-progress-bar {
  background: var(--soft);
}

.onboarding-progress progress::-webkit-progress-value {
  background: var(--accent);
  transition: width 180ms ease;
}

.onboarding-progress progress::-moz-progress-bar {
  background: var(--accent);
}

.onboarding-progress-steps {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboarding-progress-steps li {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 0.4rem;
  min-width: 0;
}

.onboarding-progress-steps span {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 0;
  display: inline-flex;
  flex: 0 0 auto;
  height: 1.4rem;
  justify-content: center;
  width: 1.4rem;
}

.onboarding-progress-steps li[data-state="complete"],
.onboarding-progress-steps li[data-state="current"] {
  color: var(--text);
}

.onboarding-progress-steps li[data-state="complete"] span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.onboarding-progress-steps li[data-state="current"] span {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.onboarding-progress-text {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.onboarding-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.5rem auto 0;
  max-width: 58rem;
  width: 100%;
}

.onboarding-page[data-step="account"] .onboarding-grid {
  grid-template-columns: 1fr;
  margin-top: 2rem;
  max-width: 30rem;
}

.onboarding-page[data-step="account"] .onboarding-progress {
  display: none;
}

.settings-section,
.plan-option,
.upgrade-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.settings-section h2,
.plan-option h2,
.upgrade-panel h2 {
  font-size: 1.1rem;
  margin: 0;
}

.settings-section label,
.plan-option label {
  display: grid;
  gap: 0.3rem;
}

.settings-section input,
.settings-section select,
.plan-option input {
  background: var(--background);
  height: 2.35rem;
  padding: 0 0.55rem;
  width: 100%;
}

.plan-option p {
  color: var(--muted);
  margin: 0;
}

.plan-option-head {
  align-items: start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.onboarding-account,
.onboarding-models,
.onboarding-grid > .settings-status {
  grid-column: 1 / -1;
}

.onboarding-account {
  justify-self: center;
  max-width: 44rem;
  width: 100%;
}

.onboarding-page[data-step="account"] .onboarding-account {
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 0;
  justify-items: center;
  max-width: none;
  padding: 0;
}

.onboarding-page[data-step="account"] .account-step-head,
.onboarding-page[data-step="account"] .onboarding-account > .settings-actions,
.onboarding-page[data-step="account"] .onboarding-grid > .settings-status {
  display: none;
}

.model-example-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}

.model-example-button {
  align-items: start;
  display: grid;
  gap: 0.1rem;
  height: auto;
  min-height: 3.35rem;
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.model-example-button strong,
.model-example-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-example-button span {
  color: var(--muted);
  font-size: 0.78rem;
}

.model-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.7rem;
}

.model-pill,
.model-empty {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  padding: 0.2rem 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-empty {
  border-style: dashed;
}

.upgrade-panel {
  margin: 1.5rem auto 0;
  max-width: 58rem;
  width: 100%;
}

.settings-status {
  color: var(--muted);
  min-height: 1.2rem;
}

.account-summary {
  align-items: center;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 4.25rem;
  padding: 0.75rem;
}

.account-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.account-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-detail,
.account-plan {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  min-height: 2.35rem;
  min-width: 2.35rem;
}

.account-menu:empty {
  display: none;
}

.account-onboarding {
  gap: 0.75rem;
}

.secret-menu {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.secret-menu summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 0.75rem;
  justify-content: space-between;
  list-style: none;
  min-height: 2.6rem;
  padding: 0.55rem 0.7rem;
}

.secret-menu summary::-webkit-details-marker {
  display: none;
}

.secret-menu summary span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: fit-content;
}

.secret-menu-body {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
}

.clerk-sign-in-panel {
  display: grid;
  justify-items: center;
  min-height: 18rem;
  width: 100%;
}

.clerk-sign-in-panel > * {
  max-width: 30rem;
  width: 100%;
}

.billing-head {
  align-items: start;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.billing-head h2 {
  margin-bottom: 0.15rem;
}

.billing-detail,
.billing-meter-text,
.onboarding-status {
  color: var(--muted);
}

.billing-plan-name {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 0;
  font-weight: 700;
  min-width: 4.5rem;
  padding: 0.25rem 0.55rem;
  text-align: center;
}

.billing-meter {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0;
  height: 0.7rem;
  overflow: hidden;
  width: 100%;
}

.billing-meter-fill {
  background: var(--accent);
  height: 100%;
  transition: width 160ms ease;
  width: 0%;
}

.billing-credit-summary {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.billing-credit-summary div {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.55rem 0.65rem;
}

.billing-credit-summary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.billing-credit-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-meter-text,
.onboarding-status {
  min-height: 1.2rem;
}

.check-row {
  align-items: center;
  display: flex !important;
  gap: 0.5rem;
}

.check-row input {
  height: auto;
  width: auto;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

[hidden] {
  display: none !important;
}

html[data-initial-route="settings"] #chat-page:not([hidden]) {
  display: none !important;
}

html[data-initial-route="settings"] #settings-page[hidden] {
  display: flex !important;
}

@media (max-width: 760px) {
  .app {
    --sidebar-width: 100%;
    grid-template-columns: 1fr;
  }

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

  .app.sidebar-collapsed {
    --sidebar-width: 0rem;
  }

  .app.sidebar-collapsed .sidebar {
    display: none;
  }

  .composer,
  .app:not(.has-chat) .composer {
    left: 0;
    right: 0;
    width: auto;
  }

  .to-bottom {
    left: 50%;
  }

  .settings-page,
  .onboarding-page,
  .upgrade-page {
    padding: 1.25rem 1rem 4rem;
  }

  .composer-controls {
    align-items: stretch;
  }

  .composer-model {
    flex: 1 1 auto;
  }

  .settings-tab {
    flex: 1 0 auto;
  }

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

  .model-config-grid {
    grid-template-columns: 1fr;
  }

  .number-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .account-summary {
    grid-template-columns: 1fr;
  }

  .billing-head {
    grid-template-columns: 1fr;
  }

  .billing-credit-summary {
    grid-template-columns: 1fr;
  }

  .billing-plan-name {
    width: fit-content;
  }

  .account-menu {
    justify-content: flex-start;
  }
}
