:root {
  color-scheme: dark;
  --bg: #07090f;
  --bg-2: #090c13;
  --surface: #0e121b;
  --surface-2: #141a26;
  --surface-3: #1b2433;
  --surface-solid: #0e121b;
  --surface-elevated: rgba(17, 22, 33, 0.94);
  --surface-muted: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --control: #0c1018;
  --code-bg: #080b12;
  --line: rgba(220, 226, 255, 0.1);
  --line-strong: rgba(220, 226, 255, 0.17);
  --text: #f7f8fc;
  --text-soft: #dce1ec;
  --muted: #97a2b6;
  --muted-2: #707b90;
  --accent: #8b5cf6;
  --accent-2: #b197fc;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --success: #46d7b0;
  --danger: #ff6f89;
  --warn: #f5c56b;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 18px 52px rgba(0, 0, 0, 0.32);
  --accent-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18), 0 16px 48px rgba(90, 49, 190, 0.18);
  --radius: 18px;
  --radius-lg: 26px;
  --topbar-h: 72px;
  --banner-h: 0px;
  --content: 1180px;
  --chat: 780px;
  --sidebar: 300px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fc;
  --bg-2: #edf1f8;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --surface-3: #e6ebf5;
  --surface-solid: #ffffff;
  --surface-elevated: rgba(255, 255, 255, 0.94);
  --surface-muted: rgba(71, 79, 112, 0.055);
  --surface-hover: rgba(71, 79, 112, 0.09);
  --control: #f8f9fd;
  --code-bg: #111522;
  --line: rgba(50, 59, 89, 0.14);
  --line-strong: rgba(50, 59, 89, 0.22);
  --text: #171927;
  --text-soft: #33394d;
  --muted: #657087;
  --muted-2: #7b8498;
  --accent: #7651dc;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(118, 81, 220, 0.11);
  --cyan: #078aa5;
  --cyan-soft: rgba(8, 145, 178, 0.1);
  --success: #087e66;
  --danger: #c43b59;
  --warn: #9a6412;
  --shadow: 0 28px 70px rgba(50, 58, 82, 0.18);
  --shadow-soft: 0 14px 40px rgba(50, 58, 82, 0.11);
  --accent-shadow: 0 0 0 1px rgba(118, 81, 220, 0.13), 0 16px 42px rgba(91, 61, 175, 0.11);
}

* {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  overflow-y: scroll;
  scrollbar-color: var(--surface-3) transparent;
  scrollbar-width: thin;
}
body {
  margin: 0;
  background:
    radial-gradient(
      circle at 16% -8%,
      rgba(139, 92, 246, 0.17),
      transparent 28%
    ),
    radial-gradient(
      circle at 92% 4%,
      rgba(34, 211, 238, 0.075),
      transparent 24%
    ),
    linear-gradient(180deg, var(--bg-2), var(--bg) 45%, var(--bg));
  color: var(--text);
  font:
    15px/1.55 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.modal-open {
  overflow: hidden;
}
body::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
body::-webkit-scrollbar-track {
  background: transparent;
}
body::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
body::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  border: 3px solid transparent;
  background-clip: content-box;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  appearance: none;
}
::selection {
  background: rgba(139, 92, 246, 0.36);
}
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 10px;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}

/* Layout */
main {
  display: block;
}
.page {
  display: none;
  width: 100%;
  min-height: calc(100dvh - var(--topbar-h) - var(--banner-h));
}
.page.active {
  display: flex;
  animation: page-in 0.24s ease both;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.app-page {
  padding: 46px clamp(18px, 5vw, 84px);
  flex-direction: column;
}
.app-page.active {
  display: flex;
}
.page-head {
  width: min(var(--content), 100%);
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.page-head :is(h1, h2) {
  margin: 6px 0;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.045em;
}
.page-head p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.65;
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.grid.two {
  width: min(var(--content), 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 18px;
}
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface-solid));
  box-shadow: var(--shadow-soft);
}
.card:hover {
  border-color: var(--line-strong);
}
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.card-title h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.015em;
}
.card-title span {
  font-size: 13px;
}
.eyebrow {
  display: inline-flex;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Navigation */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 5vw, 96px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.38));
}
.logo img {
  width: 100%;
  height: 100%;
  display: block;
}
.logo.big {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  border-radius: 19px;
  filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.44));
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.theme-toggle {
  flex: 0 0 auto;
}
.theme-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-icon-moon,
:root[data-theme="light"] .theme-icon-sun {
  display: none;
}
:root[data-theme="light"] .theme-icon-moon {
  display: block;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 26px;
  color: var(--muted);
  font-size: 15px;
}
.topbar nav a,
.topbar nav button {
  white-space: nowrap;
}
.topbar nav a:not(.button) {
  position: relative;
  transition: color 0.16s;
}
.topbar nav a:not(.button):hover,
.topbar nav a:not(.button).active {
  color: var(--text);
}
.topbar nav a:not(.button).active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  box-shadow: 0 0 12px color-mix(in srgb, var(--cyan) 52%, transparent);
}
.mobile-menu.icon-btn,
.mobile-panel {
  display: none;
}
.mobile-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--banner-h) + 10px);
  right: 14px;
  z-index: 80;
  width: min(280px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: panel-in 0.18s ease both;
}
.mobile-panel a {
  display: flex;
  padding: 13px 14px;
  border-radius: 13px;
  color: var(--text-soft);
}
.mobile-panel a:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.mobile-panel .button {
  margin-top: 8px;
}
.mobile-menu[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, 0.4);
  background: var(--accent-soft);
}

/* Buttons and controls */
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: linear-gradient(145deg, #9b74ff, var(--accent));
  color: #fff;
  font-weight: 760;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform 0.16s,
    border-color 0.16s,
    background 0.16s,
    box-shadow 0.16s,
    color 0.16s;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 34px rgba(139, 92, 246, 0.28), 0 0 20px rgba(34, 211, 238, 0.08);
}
.button:active {
  transform: scale(0.975);
}
.button:disabled,
.button[data-loading] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.button.ghost {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--text-soft);
}
.button.ghost:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  box-shadow: none;
  color: var(--text);
}
.button.small {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 12px;
}
.button.large {
  min-height: 50px;
  padding: 13px 20px;
  border-radius: 15px;
}
.button.full {
  width: 100%;
}
.button[data-loading]::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
  transition:
    transform 0.16s,
    border-color 0.16s,
    background 0.16s,
    color 0.16s;
}
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.38);
  background: var(--accent-soft);
  color: var(--text);
}
.icon-btn:active {
  transform: scale(0.96);
}
.copy-control {
  height: 30px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 780;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s,
    transform 0.14s;
}
.copy-control:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.32);
  color: var(--text);
  transform: none;
}
.copy-control:active {
  transform: scale(0.98);
}

/* Home */
.hero {
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  gap: clamp(36px, 7vw, 96px);
  padding: clamp(46px, 7vw, 92px) clamp(22px, 7vw, 120px);
}
.hero::before {
  content: "";
  position: absolute;
  width: 540px;
  height: 540px;
  right: 4vw;
  top: 7vh;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.12),
    transparent 62%
  );
  filter: blur(4px);
  pointer-events: none;
}
.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}
.hero-copy {
  max-width: 690px;
  flex: 1;
}
.hero h1,
.docs-content h1 {
  margin: 16px 0 18px;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.058em;
}
.hero p,
.lead {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}
.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
  color: #c8d0df;
}
.hero-proof span {
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.032);
  font-size: 12px;
  font-weight: 760;
}
.hero-card {
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface), #11141b);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(139, 92, 246, 0.08);
}
.terminal-head {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.terminal-head i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #465069;
}
.terminal-head span {
  margin-left: auto;
}
.hero.active .eyebrow {
  animation: reveal-up 0.45s 0.04s both;
}
.hero.active h1 {
  animation: reveal-up 0.55s 0.1s both;
}
.hero.active .hero-copy > p {
  animation: reveal-up 0.5s 0.17s both;
}
.hero.active .actions {
  animation: reveal-up 0.5s 0.23s both;
}
.hero.active .hero-proof {
  animation: reveal-up 0.5s 0.29s both;
}
.hero.active .hero-card {
  animation: reveal-scale 0.62s 0.14s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

/* Forms and auth */
.hero-copy-control {
  height: 28px;
  margin-left: 8px;
  background: rgba(255, 255, 255, 0.035);
}
.auth-page {
  align-items: center;
  justify-content: center;
  padding: 54px 22px;
}
.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1fr minmax(360px, 430px);
  gap: 18px;
  align-items: stretch;
}
.auth-aside {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(
    145deg,
    rgba(139, 92, 246, 0.16),
    rgba(23, 26, 33, 0.88) 48%,
    rgba(87, 210, 176, 0.07)
  );
  box-shadow: var(--shadow-soft);
}
.auth-aside::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.17);
  filter: blur(14px);
}
.auth-aside h2 {
  position: relative;
  margin: 16px 0 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.052em;
}
.auth-aside p {
  position: relative;
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}
.auth-points {
  position: relative;
  display: grid;
  gap: 10px;
  margin-top: 30px;
}
.auth-points span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-weight: 680;
}
.auth-points span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(87, 210, 176, 0.1);
}
.auth-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 30px;
  border-radius: 28px;
}
.auth-card :is(h1, h2) {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.035em;
}
.auth-card p,
.auth-card small {
  margin: 0;
  color: var(--muted);
}
.auth-card a {
  color: #cbbcff;
  font-weight: 760;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 680;
}
.auth-card .button {
  width: 100%;
  min-height: 48px;
}
.auth-card input,
.system-input,
.modal-field input,
.docs-jump {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #11141b;
  color: var(--text);
  outline: 0;
  transition:
    border-color 0.16s,
    box-shadow 0.16s,
    background 0.16s;
}
.auth-card input,
.modal-field input {
  height: 46px;
  padding: 0 14px;
}
.auth-card input:focus,
.system-input:focus,
.modal-field input:focus,
.docs-jump:focus {
  border-color: rgba(139, 92, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
  background: #141822;
}
.password-field {
  position: relative;
  display: flex;
}
.password-field input {
  padding-right: 86px;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
}
.password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.auth-card .field-hint {
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 500;
}
.optional {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
}
.form-error {
  display: none;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}
.form-error.show {
  display: block;
}
.auth-page.active .auth-aside {
  animation: reveal-up 0.5s 0.06s both;
}
.auth-page.active .auth-card {
  animation: reveal-up 0.5s 0.14s both;
}

/* Dashboard */
.metrics {
  width: min(var(--content), 100%);
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.metric {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(33, 38, 49, 0.92),
    rgba(22, 25, 33, 0.92)
  );
  box-shadow: var(--shadow-soft);
}
.metric::after {
  content: "";
  position: absolute;
  right: -38px;
  top: -38px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.085);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.04em;
}
.metric-sub {
  display: block;
  margin-top: 3px;
  color: var(--success);
  font-size: 13px;
  font-style: normal;
}
.token-metrics {
  grid-template-columns: repeat(3, 1fr);
}
.balance-primary {
  border-color: rgba(139, 92, 246, 0.38);
  background: linear-gradient(145deg, rgba(104, 67, 196, 0.3), rgba(22, 25, 33, 0.95));
}
.billing-ledger-card {
  width: min(var(--content), 100%);
  margin: 18px auto 0;
}
.security-grid {
  align-items: start;
}
.security-card,
.security-form {
  display: grid;
  gap: 16px;
}
.security-card label,
.security-form label {
  display: grid;
  gap: 8px;
  font-weight: 680;
}
.security-card input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: #11141b;
  color: var(--text);
}
.security-card input:focus {
  border-color: rgba(139, 92, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}
.mfa-secret {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.07);
}
.mfa-secret code {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.06em;
}
#mfa-status {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}
#mfa-status.active {
  border-color: rgba(73, 208, 145, 0.35);
  background: rgba(73, 208, 145, 0.09);
  color: var(--success);
}
[data-theme="light"] .security-card input {
  background: rgba(255, 255, 255, 0.86);
}
.period-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.period-tabs button {
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 680;
  cursor: pointer;
}
.period-tabs button:hover,
.period-tabs button.active {
  color: var(--text);
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.22),
    rgba(139, 92, 246, 0.12)
  );
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.22);
}
#model-chart.bars:not(.empty-state) {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 3fr auto;
  align-items: center;
  gap: 12px;
}
.bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
}
.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #242a35;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  animation: bar-grow 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.empty-state,
.error-state {
  min-height: 168px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed rgba(139, 92, 246, 0.18);
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.045),
    rgba(255, 255, 255, 0.012)
  );
  color: var(--muted);
  text-align: center;
}
.error-state {
  align-content: center;
  gap: 6px;
  border-color: rgba(255, 111, 137, 0.25);
  background: rgba(255, 111, 137, 0.045);
}
.error-state strong {
  color: var(--text-soft);
}
.error-state span {
  font-size: 13px;
}
.table-error {
  height: 92px;
  color: var(--danger);
  text-align: center;
}
.skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.09),
    rgba(255, 255, 255, 0.04)
  );
  background-size: 220% 100%;
  animation: shimmer 1.35s infinite;
}
#page-dashboard.active .metric {
  animation: reveal-up 0.42s both;
}
#page-dashboard.active .metric:nth-child(2) {
  animation-delay: 0.05s;
}
#page-dashboard.active .metric:nth-child(3) {
  animation-delay: 0.1s;
}
#page-dashboard.active .metric:nth-child(4) {
  animation-delay: 0.15s;
}
#page-dashboard.active .grid > .card,
#page-keys.active .key-onboarding,
#page-keys.active .key-card {
  animation: reveal-up 0.45s 0.12s both;
}
.table-wrap {
  overflow: auto;
  border-radius: 14px;
}
.table-wrap::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar,
.settings-menu::-webkit-scrollbar,
.model-menu::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.table-wrap::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb,
.settings-menu::-webkit-scrollbar-thumb,
.model-menu::-webkit-scrollbar-thumb {
  background: #384156;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
td {
  color: var(--text-soft);
}
tbody tr {
  transition: background 0.14s;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
.status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(87, 210, 176, 0.13);
  color: var(--success);
  font-size: 12px;
}
.status.bad {
  background: rgba(255, 111, 137, 0.13);
  color: var(--danger);
}
.status.warn {
  background: rgba(245, 197, 107, 0.13);
  color: var(--warn);
}

/* Administration */
.account-banner {
  position: sticky;
  top: var(--topbar-h);
  z-index: 45;
  padding: 8px clamp(14px, 4vw, 72px);
  border-bottom: 1px solid rgba(167, 139, 250, 0.24);
  background: rgba(24, 27, 37, 0.96);
  color: var(--text-soft);
  font-size: 13px;
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}
.account-banner.level-info {
  border-color: rgba(139, 92, 246, 0.32);
  background: linear-gradient(90deg, rgba(34, 27, 55, 0.97), rgba(24, 27, 37, 0.97));
}
.account-banner.level-warning {
  border-color: rgba(245, 197, 107, 0.38);
  background: linear-gradient(90deg, rgba(61, 46, 20, 0.97), rgba(28, 29, 34, 0.97));
}
.account-banner.level-critical {
  border-color: rgba(255, 111, 137, 0.42);
  background: linear-gradient(90deg, rgba(70, 28, 40, 0.98), rgba(31, 27, 34, 0.98));
}
.notification-inner {
  width: min(var(--content), 100%);
  min-height: 42px;
  margin: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.notification-marker {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(167, 139, 250, 0.32);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.16);
  color: #d9ceff;
  font-weight: 850;
}
.level-warning .notification-marker {
  border-color: rgba(245, 197, 107, 0.34);
  background: rgba(245, 197, 107, 0.13);
  color: #ffe0a0;
}
.level-critical .notification-marker {
  border-color: rgba(255, 111, 137, 0.38);
  background: rgba(255, 111, 137, 0.14);
  color: #ffc1cc;
}
.notification-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
  gap: 3px;
}
.notification-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-copy strong {
  overflow-wrap: anywhere;
}
.notification-copy span {
  max-height: 4.5em;
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}
.notification-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
}
.notification-copy span {
  color: var(--text-soft);
}
.notification-copy small {
  color: var(--muted);
  font-size: 11px;
}
.notification-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}
.notification-nav,
.notification-dismiss {
  height: 32px;
  min-width: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
  cursor: pointer;
}
.notification-nav {
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.notification-nav:hover,
.notification-dismiss:hover {
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(139, 92, 246, 0.12);
  color: #fff;
}
.notification-nav:disabled {
  opacity: 0.34;
  cursor: default;
}
.notification-count {
  min-width: 46px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.notification-dismiss {
  margin-left: 3px;
  font-size: 11px;
  font-weight: 720;
}
.admin-tabs,
.admin-panel,
.admin-filter,
.admin-workspace,
.admin-policy-grid {
  width: min(var(--content), 100%);
  margin-inline: auto;
}
.announcement-create-form {
  margin-bottom: 18px;
}
.admin-fields.announcement-main-fields {
  grid-template-columns: minmax(180px, 0.7fr) minmax(160px, 0.6fr) minmax(260px, 1.7fr);
}
.announcement-filter {
  margin-top: 18px;
}
.admin-workspace.announcement-workspace {
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.8fr);
}
.announcement-message-preview {
  max-width: 320px;
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement-title-button {
  max-width: 320px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.button.danger {
  color: var(--danger);
}
.status.level-info {
  background: rgba(139, 92, 246, 0.13);
  color: #cbbcff;
}
.status.level-warning {
  background: rgba(245, 197, 107, 0.13);
  color: var(--warn);
}
.status.level-critical {
  background: rgba(255, 111, 137, 0.13);
  color: var(--danger);
}
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}
.admin-tabs button {
  min-height: 38px;
  padding: 8px 15px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 720;
  cursor: pointer;
}
.admin-tabs button:hover,
.admin-tabs button.active {
  background: var(--accent-soft);
  color: var(--text);
}
.admin-panel {
  display: none;
}
.admin-panel.active {
  display: block;
  animation: page-in 0.2s ease both;
}
.admin-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 17px;
  border-radius: 20px;
}
.admin-filter label,
.admin-form label,
.admin-model-card > label,
.admin-fields label,
.admin-detail-form label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 680;
}
.admin-filter input,
.admin-filter select,
.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-model-card input,
.inline-filter input,
.admin-detail-form input,
.admin-detail-form select,
.admin-detail-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #11141b;
  color: var(--text);
  outline: 0;
}
.admin-form textarea,
.admin-detail-form textarea {
  min-height: 76px;
  resize: vertical;
}
.admin-filter input:focus,
.admin-filter select:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.admin-model-card input:focus,
.inline-filter input:focus,
.admin-detail-form input:focus,
.admin-detail-form select:focus,
.admin-detail-form textarea:focus {
  border-color: rgba(139, 92, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}
.admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.9fr);
  gap: 18px;
  align-items: start;
}
.admin-list-card,
.admin-detail,
.admin-form,
.admin-model-card,
.admin-audit-card {
  min-width: 0;
}
.admin-detail {
  position: sticky;
  top: calc(var(--topbar-h) + var(--banner-h) + 18px);
  max-height: calc(100dvh - var(--topbar-h) - var(--banner-h) - 36px);
  overflow: auto;
  scroll-margin-top: calc(var(--topbar-h) + var(--banner-h) + 14px);
}
.admin-empty {
  min-height: 230px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}
.admin-empty strong {
  color: var(--text-soft);
}
.admin-user-button {
  border: 0;
  background: transparent;
  color: #cbbcff;
  font-weight: 720;
  cursor: pointer;
}
.admin-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}
.admin-policy-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}
.admin-form {
  display: grid;
  gap: 15px;
}
.admin-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.admin-switch {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  white-space: nowrap;
}
.admin-switch input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}
.admin-model-card > label {
  margin-bottom: 14px;
}
.admin-row-actions {
  display: flex;
  gap: 6px;
}
.admin-row-actions .button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}
.admin-row-actions .danger {
  color: var(--danger);
}
.inline-filter {
  display: flex;
  gap: 8px;
}
.inline-filter input {
  min-width: 220px;
}
.admin-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.admin-detail-head h3 {
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.admin-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.admin-detail-stats div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.admin-detail-stats span,
.admin-detail-stats strong {
  display: block;
}
.admin-detail-stats span {
  color: var(--muted);
  font-size: 11px;
}
.admin-detail-form {
  display: grid;
  gap: 10px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.admin-detail-form h4 {
  margin: 0;
}
.admin-detail-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.admin-detail-section {
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.admin-detail-section h4 {
  margin: 0 0 9px;
}
.admin-mini-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.admin-mini-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.admin-diff {
  max-width: 260px;
  color: var(--muted);
  font-size: 11px;
}
.admin-diff summary {
  width: max-content;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.admin-diff[open] summary {
  margin-bottom: 7px;
  border-color: rgba(139, 92, 246, 0.3);
  background: var(--accent-soft);
}
.admin-diff div {
  width: min(260px, 65vw);
  max-height: 180px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #11141b;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-diff code {
  font-family: ui-monospace, monospace;
}

/* API keys */
.key-alert,
.key-onboarding,
.key-cards,
.key-table-card {
  width: min(var(--content), 100%);
  margin-inline: auto;
}
.key-alert {
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.14),
    rgba(139, 92, 246, 0.07)
  );
  box-shadow: var(--shadow-soft);
  animation: panel-in 0.2s ease;
}
.key-alert-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.key-alert-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  font-weight: 850;
}
.key-alert p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}
.key-alert-value {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.key-alert-value code {
  flex: 1;
  min-width: 220px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101319;
  word-break: break-all;
  user-select: all;
}
.key-alert-value .copy-control {
  height: 36px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.045);
}
.key-onboarding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 22px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1),
    rgba(255, 255, 255, 0.018)
  );
  box-shadow: var(--shadow-soft);
}
.key-onboarding strong {
  display: block;
  font-size: 16px;
}
.key-onboarding p {
  max-width: 780px;
  margin: 4px 0 0;
  color: var(--muted);
}
.key-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.key-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(23, 26, 33, 0.86);
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.18s,
    border-color 0.18s,
    background 0.18s;
}
.key-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.28);
  background: rgba(29, 33, 42, 0.92);
}
.key-card.revoked {
  opacity: 0.66;
}
.key-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.key-card-head > div {
  min-width: 0;
}
.key-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}
.prefix-copy {
  display: inline-flex;
  margin-top: 7px;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #dbe4f5;
  cursor: pointer;
}
.prefix-copy:hover {
  border-color: var(--accent-2);
  color: var(--text);
}
.prefix-copy code {
  color: inherit;
}
.key-badge {
  height: 26px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}
.key-badge.active {
  background: rgba(87, 210, 176, 0.13);
  color: var(--success);
}
.key-badge.bad {
  background: rgba(255, 111, 137, 0.13);
  color: var(--danger);
}
.key-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.key-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.key-empty {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.key-table-card .card-title {
  margin-bottom: 12px;
}

/* Chat shell */
.chat-page {
  overflow: hidden;
  background: #0f1015;
}
.chat-page.active {
  display: block;
  height: calc(100dvh - var(--topbar-h) - var(--banner-h));
  min-height: 0;
}
.chat-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  overscroll-behavior: contain;
}
.chat-topbar {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(14px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: rgba(15, 16, 21, 0.82);
  backdrop-filter: blur(16px);
}
.chat-title {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.01em;
}
.topbar-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.chat-sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #111319, #0f1117);
  transition:
    margin-left 0.26s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
.chat-page.sidebar-closed .chat-sidebar {
  margin-left: calc((var(--sidebar) + 1px) * -1);
}
.sidebar-icon {
  display: block;
  font-size: 21px;
  line-height: 1;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-foot {
  margin-top: auto;
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.link-dim {
  display: block;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  transition: color 0.15s;
}
.link-dim:hover {
  color: var(--text);
}
#sidebar-toggle[aria-expanded="true"],
#settings-toggle[aria-expanded="true"],
#model-button[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, 0.4);
  background: var(--accent-soft);
  color: var(--text);
}
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-empty {
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.history-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.14s,
    border-color 0.14s,
    transform 0.14s;
}
.history-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
}
.history-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.28);
  color: var(--text);
}
.history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 650;
}
.history-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11.5px;
}
.history-item.active small {
  color: #bca9ff;
}
.chat-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 44px 22px 18px;
  scroll-behavior: smooth;
}
.welcome-message {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 9vh;
  text-align: center;
  animation: welcome-in 0.3s ease both;
}
.welcome-message h2 {
  margin: 18px 0 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}
.welcome-message p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
}
.suggestions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.chip {
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.chip:hover {
  border-color: rgba(139, 92, 246, 0.34);
  background: rgba(139, 92, 246, 0.1);
  color: var(--text);
}
.message {
  max-width: var(--chat);
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
}
.message.fresh {
  animation: msg-in 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.message.user {
  align-items: flex-end;
}
.bubble {
  max-width: 100%;
  border-radius: 18px;
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.72;
  word-break: break-word;
}
.message.user .bubble {
  max-width: min(78%, 620px);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #252a35;
  color: #f7f7f8;
  white-space: pre-wrap;
}
.message.assistant .bubble {
  padding: 0;
  background: transparent;
  color: #f1f3f6;
}
.message.has-error .bubble {
  padding: 13px 16px;
  border: 1px solid rgba(255, 111, 137, 0.42);
  background: rgba(255, 111, 137, 0.1);
  color: #ffd7df;
}
.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(-2px);
  transition:
    opacity 0.15s,
    transform 0.15s;
}
.message:hover .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
  transform: none;
}
.msg-action {
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.msg-action:hover {
  background: var(--surface-2);
  color: var(--text);
}
.msg-action:disabled {
  opacity: 0.58;
  cursor: wait;
}
.msg-action.warn {
  color: var(--danger);
}
.message-copy.copy-control {
  position: static;
  height: 28px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  border-radius: 9px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.message-copy.copy-control:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

/* Composer and settings */
.composer-area {
  position: relative;
  flex: 0 0 auto;
  padding: 16px max(18px, calc((100% - var(--chat)) / 2)) 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  background: linear-gradient(
    180deg,
    rgba(15, 16, 21, 0),
    rgba(15, 16, 21, 0.92) 25%,
    var(--bg)
  );
  backdrop-filter: blur(12px);
  overflow: visible;
}
.composer {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: rgba(30, 34, 43, 0.92);
  box-shadow:
    0 22px 75px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition:
    border-color 0.16s,
    box-shadow 0.16s,
    background 0.16s;
}
.composer:hover {
  border-color: rgba(255, 255, 255, 0.16);
}
.composer:focus-within {
  border-color: rgba(139, 92, 246, 0.44);
  box-shadow:
    0 0 0 4px rgba(139, 92, 246, 0.12),
    0 22px 75px rgba(0, 0, 0, 0.45);
  background: #20242d;
}
.composer textarea {
  flex: 1;
  align-self: center;
  min-height: 40px;
  max-height: 180px;
  padding: 9px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
  resize: none;
  line-height: 1.55;
}
.composer textarea::placeholder {
  color: #8e96a8;
}
.composer-btns {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.send-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #9b72ff, #8758f7);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.28);
  transition:
    transform 0.16s ease,
    filter 0.16s ease,
    box-shadow 0.18s ease;
}
.send-btn:hover,
.send-btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.34), 0 0 20px rgba(34, 211, 238, 0.12);
}
.send-btn:active {
  transform: scale(0.94);
}
.send-btn.hidden {
  display: none !important;
}
#chat-stop {
  border-radius: 999px;
  background: rgba(255, 111, 137, 0.12);
  border-color: rgba(255, 111, 137, 0.35);
  color: var(--danger);
}
.chat-footer {
  max-width: var(--chat);
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 12.5px;
}
.model-settings-control {
  height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.composer-model-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 760;
  letter-spacing: -0.01em;
  pointer-events: none;
  user-select: none;
}
.settings-popover {
  position: relative;
  display: flex;
}
.tool-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background 0.16s,
    border-color 0.16s,
    transform 0.16s;
}
.tool-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(139, 92, 246, 0.38);
  transform: translateY(-1px);
}
.model-settings-btn {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 0;
  background: rgba(255, 255, 255, 0.045);
}
.model-settings-btn .settings-model-icon,
.model-settings-btn .settings-gear {
  position: absolute;
  transition:
    opacity 0.16s,
    transform 0.16s;
}
.model-settings-btn .settings-model-icon {
  inset: 5px;
}
.model-settings-btn .settings-gear {
  opacity: 0;
  transform: scale(0.72);
  font-size: 14px;
}
.model-settings-btn:hover .settings-model-icon {
  opacity: 0;
  transform: scale(0.72);
}
.model-settings-btn:hover .settings-gear {
  opacity: 1;
  transform: scale(1);
}
.settings-menu {
  position: absolute;
  right: max(18px, calc((100% - var(--chat)) / 2));
  bottom: calc(100% + 10px);
  z-index: 60;
  width: min(430px, calc(100vw - 36px));
  max-height: min(
    540px,
    calc(100dvh - var(--topbar-h) - var(--banner-h) - var(--composer-height, 116px) - 90px)
  );
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  background: linear-gradient(
    180deg,
    rgba(29, 33, 42, 0.98),
    rgba(20, 23, 31, 0.98)
  );
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(139, 92, 246, 0.08);
  backdrop-filter: blur(18px);
  transform-origin: bottom right;
  animation: popover-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.028);
}
.settings-title {
  display: block;
  margin-bottom: 9px;
  color: #aeb7c9;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.settings-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.model-button {
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
}
.model-button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(139, 92, 246, 0.38);
}
#model-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 720;
}
.chevron {
  margin-left: auto;
  color: var(--muted);
}
.model-menu {
  width: 100%;
  max-height: min(230px, 32dvh);
  overflow: auto;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background: rgba(9, 11, 16, 0.42);
}
.model-group {
  padding: 4px 0 8px;
}
.model-group + .model-group {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 10px;
}
.model-group-title {
  padding: 9px;
  color: #aab3c4;
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.model-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.12s;
}
.model-option + .model-option {
  margin-top: 2px;
}
.model-option:hover,
.model-option.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.28);
}
.model-option:active {
  transform: scale(0.985);
}
.model-option span:nth-child(2) {
  min-width: 0;
}
.model-option b {
  display: block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  line-height: 1.2;
}
.model-option small {
  display: none;
}
.model-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.16);
  color: #d8c9ff;
  font-size: 11px;
  font-weight: 850;
}
.model-logo img,
.model-logo svg {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}
.model-logo.openai,
.model-logo.claude,
.model-logo.grok {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  background: transparent;
  border-radius: 0;
}
.model-logo.openai img,
.model-logo.claude img,
.model-logo.grok img,
.settings-model-icon img {
  width: 24px;
  height: 24px;
}
.model-option .model-logo {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}
.model-option .model-logo img {
  width: 24px;
  height: 24px;
}
.stream-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s;
}
.stream-pill.full {
  width: 100%;
  min-height: 54px;
  justify-content: flex-start;
  margin: 0 0 10px;
  padding: 11px 12px;
  border-radius: 18px;
}
.stream-pill:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.25);
  color: var(--text);
}
.stream-pill input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}
.stream-pill.full span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stream-pill.full b {
  color: var(--text);
  font-size: 13.5px;
}
.stream-pill.full small {
  color: var(--muted);
  font-size: 12px;
}
.system-settings {
  padding: 0 !important;
  overflow: hidden;
}
.system-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.system-settings summary::-webkit-details-marker {
  display: none;
}
.system-settings summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
}
.system-settings[open] summary::after {
  content: "-";
}
.system-settings summary span {
  color: var(--text);
  font-weight: 760;
}
.system-settings summary small {
  color: var(--muted);
  font-size: 12px;
}
.system-input {
  min-height: 118px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
}
.system-settings .system-input {
  width: calc(100% - 28px);
  margin: 0 14px;
  background: rgba(9, 11, 16, 0.55);
  border-radius: 16px;
}
.system-settings .settings-hint {
  margin: 8px 14px 14px;
}
.scroll-bottom {
  position: absolute;
  right: max(18px, calc((100% - var(--chat)) / 2));
  bottom: calc(var(--composer-height, 116px) + 14px);
  z-index: 20;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(29, 33, 42, 0.94);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition:
    opacity 0.16s,
    transform 0.16s;
}
.scroll-bottom:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.38);
}
/* Markdown and code */
pre {
  position: relative;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0d1016;
  color: #dfe3ed;
  padding: 20px;
  font-size: 13.5px;
  line-height: 1.7;
}
pre code {
  font: inherit;
}
pre > code.hljs,
.bubble pre > code.hljs {
  overflow: visible;
  padding: 0;
  background: transparent;
}
.hero-card pre {
  border: 0;
  border-radius: 0;
  padding: 28px !important;
  background: #0f1218;
}
.bubble p {
  margin: 0 0 13px;
}
.bubble p:last-child {
  margin-bottom: 0;
}
.bubble h1,
.bubble h2,
.bubble h3 {
  margin: 20px 0 10px;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.bubble ul,
.bubble ol {
  margin: 8px 0 13px;
  padding-left: 24px;
}
.bubble li {
  margin: 5px 0;
}
.bubble blockquote {
  margin: 14px 0;
  padding: 8px 0 8px 15px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.bubble a {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bubble code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.92em;
}
.bubble pre {
  margin: 15px 0;
  padding: 18px;
  border-color: #282e3a;
  background: #0f1218;
}
.bubble pre code {
  padding: 0;
  background: transparent;
}
.bubble table {
  display: block;
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border-collapse: collapse;
}
.bubble th,
.bubble td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  white-space: normal;
}
.copy-code.copy-control {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  opacity: 0;
}
.bubble pre:hover > .copy-code.copy-control,
.bubble pre:focus-within > .copy-code.copy-control,
pre:hover > .copy-code.copy-control,
pre:focus-within > .copy-code.copy-control {
  opacity: 1;
}
.copy-code.copy-control.compact {
  height: 28px;
  padding: 0 10px;
  background: rgba(20, 23, 31, 0.82);
  backdrop-filter: blur(10px);
}
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  animation: type-bounce 1.35s infinite both;
}
.typing i:nth-child(2) {
  animation-delay: 0.18s;
}
.typing i:nth-child(3) {
  animation-delay: 0.36s;
}
.caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  border-right: 2px solid var(--text);
  animation: caret-blink 1s infinite;
  vertical-align: -2px;
}

/* Docs */
.docs-page.active {
  display: grid;
  grid-template-columns: 280px 1fr;
  background: linear-gradient(180deg, #101116, #0f1015);
}
.docs-nav {
  position: sticky;
  top: calc(var(--topbar-h) + var(--banner-h));
  height: calc(100dvh - var(--topbar-h) - var(--banner-h));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 32px 24px;
  border-right: 1px solid var(--line);
  background: #111319;
  color: var(--muted);
}
.docs-nav strong {
  margin-bottom: 8px;
  color: var(--text);
}
.docs-nav a {
  padding: 9px 10px;
  border-radius: 11px;
  transition:
    background 0.14s,
    color 0.14s;
}
.docs-nav a.active,
.docs-nav a:hover {
  background: rgba(139, 92, 246, 0.11);
  color: var(--text);
}
.docs-content {
  max-width: 980px;
  padding: 52px clamp(22px, 5vw, 72px);
  color: var(--text-soft);
}
.docs-content section {
  margin: 42px 0;
  scroll-margin-top: calc(var(--topbar-h) + var(--banner-h) + 28px);
}
.docs-content h2 {
  font-size: 28px;
  letter-spacing: -0.035em;
}
.docs-content p {
  line-height: 1.75;
}
.docs-content :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: #ddd6fe;
  font-size: 0.92em;
}
.docs-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 24px 0 8px;
  padding: 16px 18px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 18px;
  background: rgba(139, 92, 246, 0.07);
}
.docs-callout strong {
  white-space: nowrap;
}
.docs-callout span {
  color: var(--muted);
}
.endpoint {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.018)
  );
}
.endpoint p {
  color: var(--muted);
}
.docs-jump {
  display: none;
  height: 44px;
  margin-bottom: 22px;
  padding: 0 12px;
  color: var(--text);
}
.docs-content pre {
  margin: 14px 0;
  border-radius: 18px;
  border-color: #2b3240;
  background: #0d1016;
}
.docs-content pre.has-code-head {
  padding-top: 52px;
}
.code-head {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 120px 0 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: rgba(255, 255, 255, 0.022);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.docs-content pre > .copy-code.copy-control {
  top: 0;
  right: 0;
  height: 36px;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 16px 0 12px;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 1;
}
.docs-content pre > .copy-code.copy-control:hover {
  background: rgba(139, 92, 246, 0.1);
  border-left-color: rgba(139, 92, 246, 0.28);
}
.docs-content pre:not(.has-code-head) {
  padding-right: 118px;
}
.docs-content pre:not(.has-code-head) > .copy-code.copy-control {
  top: 8px;
  right: 8px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background: rgba(20, 23, 31, 0.82);
  text-transform: none;
  letter-spacing: 0.02em;
}

/* Docs motion */
.docs-page.active .docs-content > *,
.docs-page.active .docs-content section {
  animation: reveal-up 0.4s both;
}
.docs-page.active .docs-content section:nth-of-type(2) {
  animation-delay: 0.04s;
}
.docs-page.active .docs-content section:nth-of-type(3) {
  animation-delay: 0.08s;
}
.docs-page.active .docs-content section:nth-of-type(4) {
  animation-delay: 0.12s;
}
.docs-page.active .docs-content section:nth-of-type(5) {
  animation-delay: 0.16s;
}

/* Modals and feedback */
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 22px;
}
.modal.hidden {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
  animation: fade-in 0.16s ease;
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-height: calc(100dvh - 44px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, #1b1f28, #151820);
  box-shadow: var(--shadow);
  overflow: auto;
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.35, 1);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-head h3 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}
.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-soft);
  font-weight: 680;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 17px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(36, 41, 54, 0.94);
  color: #fff;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.22s,
    transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: rgba(107, 36, 51, 0.94);
}
/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes reveal-scale {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes welcome-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes type-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.62);
    opacity: 0.36;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes caret-blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Visual refinements live in css/tokens.css and css/premium.css. */

/* Responsive */
@media (max-width: 1100px) {
  body.private-nav-active #private-nav {
    display: none !important;
  }
  body.private-nav-active .mobile-menu.icon-btn {
    display: grid;
    margin-left: auto;
  }
  body.private-nav-active .mobile-panel:not(.hidden) {
    display: block !important;
  }
}
@media (max-width: 1000px) {
  .admin-workspace,
  .admin-workspace.announcement-workspace,
  .admin-policy-grid {
    grid-template-columns: 1fr;
  }
  .admin-detail {
    position: static;
    max-height: none;
  }
  .admin-filter {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: stretch;
  }
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    min-height: 0;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .key-onboarding {
    align-items: flex-start;
    flex-direction: column;
  }
  .key-onboarding .button {
    width: 100%;
  }
  .docs-page.active {
    grid-template-columns: 1fr;
  }
  .docs-nav {
    display: none;
  }
  .docs-content {
    padding: 42px 22px;
  }
  .docs-callout {
    flex-direction: column;
    gap: 6px;
  }
  .docs-callout strong {
    white-space: normal;
  }
  .docs-jump {
    display: block;
  }
  .chat-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 25;
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.38);
  }
  .settings-menu {
    max-height: calc(
      100dvh - var(--topbar-h) - var(--banner-h) - var(--composer-height, 116px) - 78px
    );
  }
  .chat-page.sidebar-closed .chat-sidebar {
    margin-left: calc((var(--sidebar) + 24px) * -1);
  }
  .msg-actions {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 700px) {
  :root {
    --topbar-h: 64px;
    --sidebar: 286px;
  }
  .topbar {
    height: var(--topbar-h);
    padding: 0 14px;
  }
  .brand span:last-child {
    display: none;
  }
  .topbar nav {
    display: none !important;
  }
  .account-banner {
    padding: 8px 12px;
  }
  .notification-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  .notification-marker {
    display: none;
  }
  .notification-copy {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .notification-copy strong,
  .notification-copy span,
  .notification-copy small {
    grid-column: auto;
  }
  .notification-copy span {
    max-height: 4.5em;
  }
  .notification-controls {
    justify-content: flex-end;
  }
  .notification-nav,
  .notification-dismiss {
    height: 38px;
    min-width: 38px;
  }
  .mobile-menu.icon-btn {
    display: grid;
    margin-left: auto;
  }
  .mobile-panel:not(.hidden) {
    display: block !important;
  }
  .hero {
    padding: 34px 18px 48px;
  }
  .hero h1,
  .docs-content h1 {
    font-size: clamp(38px, 12vw, 48px);
    letter-spacing: -0.052em;
  }
  .hero p,
  .lead {
    font-size: 17px;
  }
  .hero-card {
    border-radius: 20px;
  }
  .hero-card pre {
    font-size: 12px;
  }
  .hero-proof span {
    height: 30px;
    font-size: 11px;
  }
  .auth-page {
    padding: 24px 14px;
  }
  .auth-aside {
    display: none;
  }
  .auth-card {
    padding: 24px;
    border-radius: 24px;
  }
  .app-page {
    padding: 30px 14px;
  }
  .admin-tabs {
    overflow-x: auto;
  }
  .admin-tabs button {
    flex: 1;
    white-space: nowrap;
  }
  .admin-filter,
  .admin-fields,
  .admin-fields.announcement-main-fields,
  .admin-detail-form .form-row {
    grid-template-columns: 1fr;
  }
  .admin-filter .button {
    width: 100%;
  }
  .admin-detail-stats {
    grid-template-columns: 1fr;
  }
  .admin-pager {
    justify-content: center;
    flex-wrap: wrap;
  }
  .admin-pager .muted {
    flex-basis: 100%;
    order: -1;
    text-align: center;
  }
  .inline-filter {
    width: 100%;
  }
  .inline-filter input {
    min-width: 0;
  }
  .page-actions .button {
    flex: 1;
    min-width: 0;
  }
  .page-actions .period-tabs {
    order: -1;
    flex-basis: 100%;
    justify-content: space-between;
  }
  .period-tabs button {
    flex: 1;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metric {
    min-height: 106px;
  }
  .grid.two {
    gap: 14px;
  }
  .key-onboarding {
    padding: 16px;
  }
  .key-cards {
    grid-template-columns: 1fr;
  }
  .key-table-card {
    display: none;
  }
  .key-alert-value code {
    min-width: 100%;
  }
  .chat-topbar {
    height: 64px;
    flex-basis: 64px;
    padding: 10px 12px;
  }
  .topbar-group #new-chat {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    display: inline-flex;
    padding: 0;
    border-radius: 12px;
    font-size: 18px;
  }
  .new-chat-label {
    display: none;
  }
  .messages {
    padding: 24px 16px 14px;
  }
  .welcome-message {
    padding-top: 8vh;
  }
  .welcome-message h2 {
    font-size: 27px;
  }
  .message.user .bubble {
    max-width: 90%;
  }
  .composer-area {
    padding: 12px 12px 14px;
  }
  .composer {
    min-height: 58px;
    border-radius: 22px;
  }
  .chat-footer {
    justify-content: center;
  }
  .chat-footer span:last-child {
    display: none;
  }
  .settings-menu {
    right: 12px;
    bottom: calc(100% + 8px);
    width: calc(100vw - 24px);
    max-height: calc(
      100dvh - var(--topbar-h) - var(--banner-h) - var(--composer-height, 116px) - 68px
    );
  }
  .settings-menu .model-menu {
    max-height: 30dvh;
  }
  .scroll-bottom {
    right: 18px;
    bottom: calc(var(--composer-height, 104px) + 12px);
  }
  .docs-content {
    padding: 32px 16px;
  }
  .docs-content pre {
    font-size: 12.5px;
  }
  .docs-content pre:not(.has-code-head) {
    padding-right: 20px;
    padding-bottom: 54px;
  }
  .docs-content pre:not(.has-code-head) > .copy-code.copy-control {
    top: auto;
    bottom: 10px;
  }
  .docs-jump {
    position: sticky;
    top: calc(var(--topbar-h) + var(--banner-h) + 10px);
    z-index: 12;
  }
  .modal-card {
    max-height: calc(100dvh - 44px);
    overflow: auto;
  }
  .modal-actions .button {
    flex: 1;
  }
}
@media (pointer: coarse) {
  .notification-nav,
  .notification-dismiss {
    min-width: 44px;
    min-height: 44px;
  }
}
@media (max-width: 520px) {
  .composer {
    flex-direction: column;
    align-items: stretch;
  }
  .composer textarea {
    width: 100%;
    align-self: stretch;
  }
  .composer-btns {
    align-self: stretch;
    justify-content: flex-end;
  }
  .model-settings-control {
    max-width: 170px;
    padding-left: 10px;
  }
  .composer-model-name {
    max-width: 82px;
  }
  .settings-menu {
    right: 12px;
    width: calc(100vw - 24px);
  }
}
@media (max-width: 460px) {
  .button.large {
    width: 100%;
  }
  .composer-model-name {
    max-width: 74px;
  }
  .key-alert-value .copy-control {
    flex: 1;
  }
  .modal {
    padding: 14px;
  }
  .modal-actions .button {
    width: 100%;
  }
  .docs-content pre > .copy-code.copy-control {
    padding: 0 9px;
    font-size: 10.5px;
  }
}
@media (hover: none), (pointer: coarse) {
  .copy-code.copy-control {
    opacity: 1;
  }
  .bubble pre {
    padding-top: 52px;
  }
  .msg-actions {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
