:root {
  color-scheme: light;
  --page: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --ink: #15181e;
  --ink-soft: #4c5665;
  --muted: #818a98;
  --line: #e3e8ef;
  --line-strong: #cbd5e1;
  --rail: #101317;
  --rail-soft: #1b2027;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: #e6f7f4;
  --blue: #3461d9;
  --amber: #b47612;
  --rose: #c2415a;
  --danger: #d92d20;
  --shadow-soft: 0 16px 42px rgba(25, 33, 46, 0.08);
  --shadow-strong: 0 24px 70px rgba(25, 33, 46, 0.14);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background:
    linear-gradient(180deg, #ffffff 0, rgba(255, 255, 255, 0) 330px),
    var(--page);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 430px);
  gap: 22px;
  width: min(100%, 980px);
  align-items: stretch;
}

.login-preview,
.login-card {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-strong);
}

.login-preview {
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(52, 97, 217, 0.08)),
    #ffffff;
}

.preview-window {
  width: min(100%, 520px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.preview-bar {
  display: flex;
  gap: 7px;
  padding: 13px 15px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
}

.preview-bar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d7dde7;
}

.preview-thread {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.preview-line {
  max-width: 88%;
  padding: 13px 15px;
  border-radius: 8px;
  line-height: 1.65;
}

.preview-line.user {
  justify-self: end;
  color: #ffffff;
  background: var(--rail);
}

.preview-line.assistant {
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.preview-line.assistant strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
}

.preview-line.assistant p {
  margin: 0;
  color: var(--ink-soft);
}

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

.preview-pills span {
  padding: 6px 9px;
  color: var(--ink-soft);
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 34px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 850;
}

.logo-mark,
.rail-logo,
.welcome-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background: var(--rail);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
}

.login-copy h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.08;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
}

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

.field span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 760;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.primary-button {
  height: 48px;
  color: #ffffff;
  background: var(--rail);
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button:hover {
  background: #05070a;
}

.primary-button:disabled,
.new-chat-button:disabled,
.send-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-error {
  padding: 11px 12px;
  color: #9f1d17;
  background: #fff1f0;
  border: 1px solid #ffd0cc;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch button {
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  font-weight: 850;
}

.auth-switch button:hover {
  color: var(--rail);
}

.auth-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 344px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.rail {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 0;
  padding: 14px 10px;
  background: var(--rail);
}

.rail-logo {
  width: 46px;
  height: 46px;
  background: #ffffff;
  border: 0;
  color: var(--rail);
}

.rail-actions {
  display: grid;
  align-content: start;
  gap: 9px;
}

.rail-button,
.rail-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #aeb7c4;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.rail-button:hover,
.rail-button.active {
  color: #ffffff;
  background: var(--rail-soft);
  border-color: rgba(255, 255, 255, 0.08);
}

.rail-avatar {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  font-weight: 900;
}

.account-menu {
  position: absolute;
  left: 58px;
  bottom: 14px;
  z-index: 50;
  display: grid;
  gap: 4px;
  width: 238px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.account-menu-head {
  display: grid;
  gap: 2px;
  padding: 8px 9px 9px;
  border-bottom: 1px solid var(--line);
}

.account-menu-head strong {
  color: var(--ink);
  font-size: 14px;
}

.account-menu-head small {
  color: var(--muted);
  font-size: 12px;
}

.account-menu button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 7px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.account-menu button:hover {
  background: var(--panel-soft);
}

.account-menu button span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-menu button strong,
.account-menu button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu button strong {
  font-size: 13px;
}

.account-menu button small {
  color: var(--muted);
  font-size: 11px;
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.account-menu-danger strong {
  color: var(--danger);
}

.account-menu-danger .menu-icon {
  color: var(--danger);
  background: #fff4f2;
}

.history-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px 14px 12px;
  background: rgba(255, 255, 255, 0.9);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 14px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-head h2 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  color: #ffffff;
  background: var(--rail);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.new-chat-button:hover {
  background: #05070a;
}

.search-box {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 42px;
  margin: 12px 0;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-box input {
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.conversation-list {
  min-height: 0;
  margin: 0 -4px;
  padding: 0 4px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.conversation-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.conversation-group {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.conversation-group-label {
  padding: 8px 4px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.conversation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.conversation-item:hover {
  background: #f7f9fc;
  border-color: var(--line);
}

.conversation-item.active {
  background: var(--accent-soft);
  border-color: #bde8df;
  box-shadow: 0 1px 0 rgba(13, 148, 136, 0.08);
}

.conversation-open {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  min-height: 70px;
  padding: 11px 0 11px 11px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.conversation-delete {
  display: grid;
  place-items: center;
  align-self: center;
  width: 34px;
  height: 34px;
  margin-right: 7px;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  opacity: 0.9;
}

.conversation-delete svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.15;
}

.conversation-delete:hover {
  color: var(--danger);
  background: #fff4f2;
  border-color: #fac5bd;
  opacity: 1;
}

.conversation-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--accent-strong);
  background: #dff4ef;
  border-radius: 8px;
}

.conversation-dot svg {
  width: 16px;
  height: 16px;
}

.conversation-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.conversation-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-snippet {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  display: flex;
  gap: 8px;
  color: #9aa4b2;
  font-size: 11px;
}

.main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 12px 30px;
  background: rgba(245, 247, 251, 0.86);
  border-bottom: 1px solid rgba(227, 232, 239, 0.86);
  backdrop-filter: blur(18px);
}

.title-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title-block h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-block span {
  flex: 0 0 auto;
  padding: 4px 9px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid #bde8df;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button,
.model-kind-wrap,
.reasoning-select-wrap,
.send-button {
  display: inline-grid;
  place-items: center;
  height: 40px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button,
.send-button {
  width: 40px;
}

.icon-button:hover,
.model-kind-wrap:hover,
.reasoning-select-wrap:hover {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line-strong);
}

.model-kind-wrap {
  grid-template-columns: 20px minmax(0, 1fr);
  justify-content: start;
  gap: 8px;
  min-width: 278px;
  padding: 0 13px;
}

.model-kind-wrap svg {
  width: 17px;
  height: 17px;
}

.reasoning-select-wrap {
  min-width: 96px;
  padding: 0 9px;
}

.model-kind-select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  outline: 0;
  white-space: nowrap;
}

.model-select {
  width: 100%;
  min-width: 72px;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  outline: 0;
  font-weight: 800;
}

.danger:hover {
  color: var(--danger);
  border-color: #fac5bd;
  background: #fff4f2;
}

.mobile-only {
  display: none;
}

.chat-view {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.messages {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 34px 30px 158px;
}

.welcome-panel {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 252px);
  gap: 24px;
}

.welcome-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--rail), var(--accent-strong));
  font-size: 17px;
  box-shadow: 0 14px 36px rgba(13, 148, 136, 0.18);
}

.welcome-panel h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: 1.1;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 760px);
  margin: 0 auto;
}

.starter-grid button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(25, 33, 46, 0.03);
}

.starter-grid button:hover {
  background: #ffffff;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.starter-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.starter-icon svg {
  width: 19px;
  height: 19px;
}

.starter-icon.blue {
  color: var(--blue);
  background: #eaf0ff;
}

.starter-icon.green {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.starter-icon.amber {
  color: var(--amber);
  background: #fff4dc;
}

.starter-icon.rose {
  color: var(--rose);
  background: #fff0f3;
}

.starter-grid button > span:last-child {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 15px;
  padding: 25px 0;
}

.message + .message {
  border-top: 1px solid rgba(227, 232, 239, 0.9);
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #ffffff;
  background: var(--rail);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.message.assistant .message-avatar {
  background: var(--accent);
}

.message-content {
  min-width: 0;
  padding-top: 5px;
  color: #242b35;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
}

.generated-image {
  display: block;
  max-width: min(100%, 520px);
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.message.user .message-content {
  justify-self: end;
  max-width: min(680px, 100%);
  padding: 13px 16px;
  color: #1c2430;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(25, 33, 46, 0.07);
}

.typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  height: 24px;
}

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

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.composer-dock {
  position: sticky;
  bottom: 0;
  padding: 18px 30px 30px;
  background: linear-gradient(180deg, rgba(245, 247, 251, 0), var(--page) 32%);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 9px;
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 9px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 20px 58px rgba(25, 33, 46, 0.13);
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 20px 58px rgba(25, 33, 46, 0.14), 0 0 0 4px rgba(13, 148, 136, 0.12);
}

textarea {
  width: 100%;
  min-height: 28px;
  max-height: 190px;
  padding: 9px 4px;
  resize: none;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  line-height: 1.58;
}

textarea::placeholder,
.search-box input::placeholder {
  color: #8f99a7;
}

.send-button {
  align-self: end;
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.send-button:hover {
  background: var(--accent-strong);
}

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

textarea:disabled,
.model-select:disabled {
  cursor: wait;
  opacity: 0.64;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 19, 23, 0.48);
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #17342e;
  background: #eefaf7;
  border: 1px solid #bde8df;
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
  font-size: 14px;
  line-height: 1.5;
}

.toast.error {
  color: #971c16;
  background: #fff1f0;
  border-color: #ffd0cc;
}

.quota-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 19, 23, 0.58);
  backdrop-filter: blur(7px);
}

.quota-dialog {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 26px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(16, 19, 23, 0.28);
}

.quota-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.quota-dialog-close:hover {
  color: var(--ink);
  background: var(--panel-soft);
  border-color: var(--line);
}

.quota-dialog-close svg {
  width: 18px;
  height: 18px;
}

.quota-dialog-top {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-right: 34px;
}

.quota-dialog-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border-radius: 8px;
  font-size: 20px;
  font-weight: 950;
}

.quota-dialog-top small,
.quota-summary-grid span,
.quota-meter-head span,
.quota-stats-grid span,
.quota-support span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.quota-dialog h2 {
  margin: 2px 0 4px;
  font-size: 26px;
  line-height: 1.18;
}

.quota-dialog p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

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

.quota-summary-grid > div,
.quota-meter-card,
.quota-stats-grid > div,
.quota-support {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quota-summary-grid > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 16px;
}

.quota-summary-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--accent-strong);
  font-size: 30px;
  line-height: 1;
}

.quota-summary-grid small {
  color: var(--ink-soft);
  font-size: 12px;
}

.quota-meter-list {
  display: grid;
  gap: 10px;
}

.quota-meter-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.quota-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quota-meter-head strong {
  color: var(--ink);
  font-size: 13px;
}

.quota-meter {
  height: 10px;
  overflow: hidden;
  background: #e8edf4;
  border-radius: 999px;
}

.quota-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: inherit;
  transition: width 180ms ease;
}

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

.quota-stats-grid > div {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.quota-stats-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.quota-support {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 13px;
  background: #fffdf7;
  border-color: #f2dfaa;
}

.quota-support span {
  grid-column: 1 / -1;
  color: #7a5c16;
}

.quota-support strong {
  min-width: 0;
  padding: 10px 12px;
  color: #7a5c16;
  background: #fff6d8;
  border: 1px dashed #dfbe60;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  user-select: all;
}

.quota-copy-button {
  min-height: 42px;
  padding: 0 14px;
  color: #7a5c16;
  background: #ffffff;
  border: 1px solid #dfbe60;
  border-radius: 8px;
  font-weight: 850;
}

.quota-copy-button:hover {
  color: #ffffff;
  background: #a87914;
  border-color: #a87914;
}

.quota-support small {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
}

.quota-dialog-primary {
  min-height: 48px;
  color: #ffffff;
  background: var(--rail);
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.quota-dialog-primary:hover {
  background: #05070a;
}

.help-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 19, 23, 0.54);
  backdrop-filter: blur(6px);
}

.help-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 13px;
  width: min(420px, calc(100vw - 32px));
  padding: 30px 26px 24px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(16, 19, 23, 0.26);
  text-align: center;
}

.help-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.help-dialog-close:hover {
  color: var(--ink);
  background: var(--panel-soft);
  border-color: var(--line);
}

.help-dialog-close svg {
  width: 18px;
  height: 18px;
}

.help-dialog-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
}

.help-dialog h2 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.help-dialog p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.help-dialog-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
}

.help-dialog-copy-row strong {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 9px 14px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px dashed #8fd9cf;
  border-radius: 8px;
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
  user-select: all;
}

.help-dialog-copy-status {
  min-height: 18px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}

.help-dialog-copy,
.help-dialog-primary {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 850;
}

.help-dialog-copy {
  padding: 0 15px;
  color: var(--accent-strong);
  background: #ffffff;
  border: 1px solid #8fd9cf;
}

.help-dialog-copy:hover {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.help-dialog-primary {
  width: 100%;
  color: #ffffff;
  background: var(--rail);
  border: 0;
}

.help-dialog-primary:hover {
  background: #05070a;
}

.redeem-dialog {
  width: min(480px, calc(100vw - 32px));
  text-align: left;
}

.redeem-dialog h2,
.redeem-dialog p {
  width: 100%;
  text-align: center;
}

.redeem-dialog-icon {
  margin-inline: auto;
}

.redeem-dialog-field {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.redeem-dialog-field span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.redeem-dialog-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  text-transform: uppercase;
}

.redeem-dialog-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.redeem-dialog-actions {
  width: 100%;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    transform: scale(0.72);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
    width: min(100%, 440px);
  }

  .login-preview {
    display: none;
  }

  .login-card {
    min-height: auto;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(92vw, 360px);
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

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

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

  .topbar,
  .messages,
  .composer-dock {
    padding-inline: 18px;
  }
}

@media (max-width: 680px) {
  .auth-screen {
    padding: 16px;
  }

  .login-card {
    padding: 24px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .model-kind-wrap {
    min-width: min(100%, 244px);
  }

  .reasoning-select-wrap {
    min-width: 88px;
  }

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

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

  .message.user .message-avatar {
    grid-column: 1;
  }

  .message.user .message-content {
    justify-self: stretch;
  }

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

  .composer {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .quota-dialog {
    padding: 22px 18px;
  }

  .quota-summary-grid,
  .quota-stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .help-dialog {
    padding-inline: 20px;
  }

  .help-dialog-copy-row,
  .quota-support {
    grid-template-columns: 1fr;
  }
}
