/* =========================================================
   零号算力中转站 · Design System
   ========================================================= */

:root {
  --font-sans: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --topbar-height: 70px;
  --sidebar-width: 252px;
}

:root[data-theme='dark'] {
  --bg: #080b13;
  --bg-soft: #0b1020;
  --surface: #0f1523;
  --surface-2: #141c2e;
  --surface-3: #1b2438;
  --border: #1c2740;
  --border-strong: #2a3852;
  --text: #e9eefb;
  --text-2: #9aa9c4;
  --text-3: #66758f;
  --brand: #6d6cf6;
  --brand-2: #22d3ee;
  --brand-soft: rgba(109, 108, 246, 0.13);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --input-bg: #0b1220;
  --hover: rgba(255, 255, 255, 0.035);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 26px 70px rgba(0, 0, 0, 0.52);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 48%, #22d3ee 100%);
  --gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(34, 211, 238, 0.06));
  --code-bg: #070b15;
  --scrollbar: #24314a;
  --glass: rgba(15, 21, 35, 0.82);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f5f8fd;
  --surface-3: #eaeff8;
  --border: #e2e8f2;
  --border-strong: #cfd9e8;
  --text: #0e1728;
  --text-2: #58677f;
  --text-3: #8794a9;
  --brand: #5b5bd6;
  --brand-2: #0891b2;
  --brand-soft: rgba(91, 91, 214, 0.09);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.09);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.09);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --input-bg: #ffffff;
  --hover: rgba(15, 23, 42, 0.035);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.15);
  --gradient: linear-gradient(135deg, #5b5bd6 0%, #7c3aed 48%, #0891b2 100%);
  --gradient-soft: linear-gradient(135deg, rgba(91, 91, 214, 0.1), rgba(8, 145, 178, 0.05));
  --code-bg: #0d1424;
  --scrollbar: #cbd5e4;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(99, 102, 241, 0.32);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
  background-clip: content-box;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* =========================================================
   Layout
   ========================================================= */

.app-shell {
  min-height: 100vh;
  position: relative;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
}

.ambient-glow.g1 {
  width: 480px;
  height: 480px;
  background: #4f46e5;
  top: -220px;
  left: 18%;
}

.ambient-glow.g2 {
  width: 380px;
  height: 380px;
  background: #06b6d4;
  bottom: -200px;
  right: 8%;
  opacity: 0.12;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 24px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text span {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-3);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  margin: 0 -2px;
}

.nav-group {
  margin-bottom: 18px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 12px 7px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--brand-soft), transparent);
  color: var(--text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 17px;
  transform: translateY(-50%);
  border-radius: 3px;
  background: var(--gradient);
}

.nav-item.active .nav-icon {
  color: var(--brand-2);
}

.nav-icon {
  display: flex;
  color: var(--text-3);
  transition: color 0.16s ease;
}

.nav-item:hover .nav-icon {
  color: var(--text-2);
}

.nav-kbd {
  margin-left: auto;
  font-size: 9px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.02em;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-card {
  position: relative;
  overflow: hidden;
  padding: 13px 15px 12px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--gradient-soft);
}

.balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-2);
}

.balance-value {
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 3px 0 7px;
  font-variant-numeric: tabular-nums;
}

.balance-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 9.5px;
  color: var(--text-3);
}

.balance-foot a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--brand-2);
}

.balance-shine {
  position: absolute;
  left: 20%;
  right: -20%;
  bottom: -70px;
  height: 100px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 70%);
  filter: blur(22px);
  pointer-events: none;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  transition: background 0.16s ease;
}

.side-user:hover {
  background: var(--hover);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-weight: 650;
  font-size: 13px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 12px;
}

.avatar-top {
  border: 2px solid var(--border);
  margin-left: 4px;
  transition: transform 0.16s ease;
}

.avatar-top:hover {
  transform: scale(1.04);
}

.side-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}

.side-user-info strong {
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-user-info span {
  font-size: 9.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-user-more {
  color: var(--text-3);
  display: flex;
}

.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

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

.topbar-title h1 {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.3;
}

.topbar-title p {
  font-size: 11px;
  color: var(--text-3);
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.topbar-doc {
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.mobile-menu {
  display: none;
}

.bell-btn {
  position: relative;
}

.bell-dot {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 2px var(--bg);
}

.view {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  flex: 1;
  animation: viewIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.view-chat {
  padding: 0;
  max-width: none;
  height: auto;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.main.chat-mode {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar-scrim {
  display: none;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 30px;
  text-align: center;
  background: var(--bg);
  color: var(--text);
}

.boot-screen img {
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.35);
  animation: pulseSoft 2.2s ease-in-out infinite;
}

.boot-brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.boot-loader {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-3);
}

.boot-loader .spinner {
  border-color: var(--border-strong);
  border-top-color: var(--brand);
}

@keyframes pulseSoft {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

/* =========================================================
   Typography / page header
   ========================================================= */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 9px;
}

.page-head h1 {
  font-size: 29px;
  line-height: 1.18;
  font-weight: 650;
  letter-spacing: -0.035em;
  margin: 0 0 6px;
}

.page-head h1 .wave {
  display: inline-block;
  animation: wave 2.4s ease-in-out infinite;
  transform-origin: 70% 70%;
}

.page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  max-width: 640px;
}

.page-sub strong {
  color: var(--text);
  font-weight: 600;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
  animation: pulseDot 2s infinite;
  flex: none;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, color 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 5px 18px rgba(99, 102, 241, 0.32);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.42);
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--text-3);
}

.btn-ghost {
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 5px 18px rgba(248, 113, 113, 0.28);
}

.btn-danger:hover {
  filter: brightness(1.05);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 33px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 8px;
}

.btn-xs {
  height: 27px;
  padding: 0 9px;
  font-size: 10.5px;
  border-radius: 7px;
  gap: 4px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
}

.btn-icon.btn-xs {
  width: 25px;
  height: 25px;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.danger-hover:hover {
  color: var(--danger) !important;
  background: var(--danger-soft) !important;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex: none;
}

.spin .icon,
.spin {
  animation: spin 0.8s linear infinite;
}

/* =========================================================
   Cards / tables / badges
   ========================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.card-head h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-head p {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 2px 0 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.table-wrap.borderless {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background 0.14s ease;
}

.data-table tbody tr:hover td {
  background: var(--hover);
}

.data-table .clickable {
  cursor: pointer;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted {
  color: var(--text-3);
}

.nowrap {
  white-space: nowrap;
}

.align-right {
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.18);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.18);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.18);
}

.badge-brand {
  background: var(--brand-soft);
  color: var(--brand-2);
  border-color: rgba(99, 102, 241, 0.2);
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}

.badge.live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 1.4s infinite;
}

.tag-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10px;
  white-space: nowrap;
}

.tag-more {
  color: var(--brand-2);
  border-color: rgba(99, 102, 241, 0.2);
  background: var(--brand-soft);
}

/* =========================================================
   Forms
   ========================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.field > span em {
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-3);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.65;
}

.textarea.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input.compact,
.select.compact {
  height: 34px;
  font-size: 11.5px;
  padding: 0 10px;
}

.select.compact {
  padding-right: 28px;
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  display: flex;
  pointer-events: none;
}

.input.has-icon {
  padding-left: 35px;
}

.input.has-action {
  padding-right: 40px;
}

.input-action {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
}

.input-action:hover {
  color: var(--text);
  background: var(--hover);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.switch-copy strong {
  font-size: 12px;
  font-weight: 550;
}

.switch-copy em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-3);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 2;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--brand);
  border-color: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #fff;
}

.switch input:disabled + .switch-track {
  opacity: 0.45;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.segmented button {
  height: 27px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 11px 0 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text-3);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  width: 270px;
  max-width: 100%;
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

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

.search-box.grow {
  width: auto;
  flex: 1;
  min-width: 220px;
}

.color-input {
  display: flex;
  gap: 7px;
}

.color-input input[type='color'] {
  width: 42px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  cursor: pointer;
  flex: none;
}

/* =========================================================
   Modal / Drawer / Toast / Menu
   ========================================================= */

.modal-layer,
.drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-layer.open,
.drawer-layer.open {
  opacity: 1;
}

.modal-backdrop,
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 15, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 17px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.modal-layer.open .modal {
  transform: none;
}

.modal-sm {
  max-width: 430px;
}

.modal-md {
  max-width: 580px;
}

.modal-lg {
  max-width: 740px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 14px;
  flex: none;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 3px 0 0;
}

.modal-body {
  padding: 2px 22px 20px;
  overflow-y: auto;
  min-height: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}

.confirm-message {
  margin: 2px 0 4px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.75;
}

.drawer-layer {
  justify-content: flex-end;
  padding: 0;
}

.drawer {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.drawer-layer.open .drawer {
  transform: none;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.drawer-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.drawer-subtitle {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-3);
  margin: 4px 0 0;
  word-break: break-all;
}

.drawer-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.drawer-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(380px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--success);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-info {
  border-left-color: var(--brand-2);
}

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--success-soft);
  color: var(--success);
  flex: none;
}

.toast-error .toast-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast-warning .toast-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.toast-info .toast-icon {
  background: var(--brand-soft);
  color: var(--brand-2);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 1px;
}

.toast-message {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.55;
  word-break: break-word;
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 2px;
  display: flex;
  flex: none;
}

.toast-close:hover {
  color: var(--text);
}

.floating-menu {
  position: fixed;
  z-index: 150;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.floating-menu.open {
  opacity: 1;
  transform: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
}

.menu-item:hover {
  background: var(--hover);
  color: var(--text);
}

.menu-item.is-danger {
  color: var(--danger);
}

.menu-item.is-danger:hover {
  background: var(--danger-soft);
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 3px;
}

.menu-hint {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--text-3);
}

.announcement-body {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-2);
  padding: 2px 0 6px;
  white-space: pre-wrap;
}

/* =========================================================
   Empty / loading / skeleton
   ========================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 24px;
  gap: 5px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-2);
  margin-bottom: 8px;
  border: 1px solid rgba(99, 102, 241, 0.16);
}

.empty-state h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
}

.empty-state p {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 2px 0 12px;
  max-width: 380px;
  line-height: 1.65;
}

.empty-state.compact {
  padding: 30px 16px;
}

.empty-state.span-all {
  grid-column: 1 / -1;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 12px;
}

.loading-block .spinner {
  border-color: var(--border-strong);
  border-top-color: var(--brand);
}

.chat-loading,
.chat-loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 12px;
}

.chat-loading {
  height: 100%;
  min-height: 360px;
}

.chat-loading .spinner,
.chat-loading-inline .spinner {
  border-color: var(--border-strong);
  border-top-color: var(--brand);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
}

.skeleton-line {
  height: 10px;
  margin-bottom: 10px;
}

.skeleton-title {
  height: 28px;
  width: 260px;
  margin-bottom: 10px;
}

.w-100 {
  width: 100px;
}

.w-120 {
  width: 120px;
}

.w-280 {
  width: 280px;
}

.skeleton-stat {
  height: 126px;
  border-radius: 16px;
}

.skeleton-card {
  height: 340px;
  border-radius: 16px;
}

.skeleton-model {
  height: 300px;
  border-radius: 16px;
}

.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 420px;
  gap: 4px;
}

.page-error h2 {
  font-size: 17px;
  margin: 4px 0 0;
}

.page-error p {
  font-size: 12px;
  color: var(--text-3);
  margin: 2px 0 14px;
}

/* =========================================================
   Dashboard
   ========================================================= */

.admin-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  font-size: 10.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.admin-strip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-2);
  font-weight: 600;
  white-space: nowrap;
}

.admin-strip-items {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  flex: 1;
}

.admin-strip-items b {
  color: var(--text);
  font-weight: 600;
  margin-right: 2px;
}

.admin-strip-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand-2);
  white-space: nowrap;
}

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

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 17px 18px 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: #818cf8;
}

.accent-cyan .stat-icon {
  background: rgba(34, 211, 238, 0.1);
  color: #22d3ee;
}

.accent-violet .stat-icon {
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}

.accent-emerald .stat-icon {
  background: var(--success-soft);
  color: var(--success);
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-2);
}

.stat-chip {
  margin-left: auto;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.035em;
  margin: 12px 0 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 2px;
}

.stat-foot {
  font-size: 10.5px;
  color: var(--text-3);
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stat-delta.up {
  color: var(--success);
}

.stat-delta.down {
  color: var(--danger);
}

.stat-delta.warn {
  color: var(--warning);
}

.stat-delta.flat {
  color: var(--text-3);
}

.stat-delta em {
  font-style: normal;
  opacity: 0.72;
  margin-left: 2px;
}

.stat-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.24), transparent 68%);
  pointer-events: none;
}

.accent-cyan .stat-glow {
  background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 68%);
}

.accent-violet .stat-glow {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 68%);
}

.accent-emerald .stat-glow {
  background: radial-gradient(circle, rgba(52, 211, 153, 0.16), transparent 68%);
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.dash-grid.lower {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
}

.chart-card {
  min-width: 0;
}

.chart-toolbar {
  display: flex;
  justify-content: flex-end;
}

.metric-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.metric-tabs button {
  height: 25px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 10.5px;
}

.metric-tabs button:hover {
  color: var(--text);
}

.metric-tabs button.active {
  color: var(--text);
  background: var(--surface-2);
}

.chart-wrap {
  margin-top: 4px;
}

.chart-canvas {
  position: relative;
}

.area-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 6;
  opacity: 0.75;
}

.chart-axis-label {
  fill: var(--text-3);
  font-size: 9.5px;
  font-family: var(--font-sans);
}

.chart-line {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: drawLine 1.1s ease forwards;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 9px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(-6px);
}

.chart-tooltip-date {
  font-size: 9px;
  color: var(--text-3);
  margin-bottom: 2px;
}

.chart-tooltip-value {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  display: inline-block;
  flex: none;
}

.chart-legend-inline {
  display: none;
}

.donut-card {
  display: flex;
  flex-direction: column;
}

.donut-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.donut-chart {
  position: relative;
  width: 172px;
  height: 172px;
  margin: 4px auto 0;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
}

.donut-center strong {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.donut-center span {
  font-size: 9.5px;
  color: var(--text-3);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.donut-legend-item {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
}

.donut-legend-name {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donut-legend-value {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.donut-legend-pct {
  color: var(--text-3);
  width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  font-size: 10.5px;
  width: 100%;
}

.card-link:hover {
  color: var(--brand-2);
}

.model-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-cell > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.model-cell strong {
  font-size: 12px;
  font-weight: 550;
}

.model-cell em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--text-3);
}

.model-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.recent-card .table-wrap {
  margin: 0 -6px;
}

.dash-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.quick-card {
  position: relative;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--gradient-soft);
  overflow: hidden;
}

.quick-card::after {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  right: -70px;
  top: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.22), transparent 70%);
  pointer-events: none;
}

.quick-orb {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
  margin-bottom: 13px;
}

.quick-card h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.quick-card p {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0 0 13px;
}

.quick-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.quick-code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 9px;
  color: var(--text-3);
  min-width: 0;
}

.quick-code > span {
  letter-spacing: 0.08em;
  flex: none;
}

.quick-code code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.code-copy.inline {
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 2px;
  display: flex;
}

.mini-overview {
  padding: 18px;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mini-grid > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mini-grid span {
  font-size: 9.5px;
  color: var(--text-3);
}

.mini-grid strong {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Models
   ========================================================= */

.toolbar {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 180px;
}

.filter-chip {
  height: 27px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--hover);
  color: var(--text);
}

.filter-chip.active {
  background: var(--brand-soft);
  border-color: rgba(99, 102, 241, 0.18);
  color: var(--text);
}

.toolbar-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
}

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

.model-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.model-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.model-card.is-disabled {
  opacity: 0.58;
}

.model-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  border: 1px solid transparent;
  flex: none;
}

.model-logo-lg {
  width: 54px;
  height: 54px;
  font-size: 22px;
  border-radius: 15px;
}

.model-identity {
  flex: 1;
  min-width: 0;
}

.model-identity h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-identity span {
  display: block;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-desc {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-2);
  margin: 0;
  min-height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.model-specs > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.model-specs span {
  font-size: 9px;
  color: var(--text-3);
  white-space: nowrap;
}

.model-specs strong {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.model-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

.provider-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.model-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.model-detail-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.model-detail-head p {
  font-size: 12px;
  color: var(--text-2);
  margin: 7px 0 0;
  line-height: 1.7;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  min-width: 0;
}

.detail-cell span {
  font-size: 9.5px;
  color: var(--text-3);
}

.detail-cell strong {
  font-size: 11.5px;
  font-weight: 600;
  word-break: break-word;
}

.detail-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 14px 0 7px;
}

/* =========================================================
   API Keys
   ========================================================= */

.key-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--gradient-soft);
  flex-wrap: wrap;
}

.key-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--brand-2);
  flex: none;
}

.key-banner-main {
  flex: 1;
  min-width: 200px;
}

.key-banner h3 {
  font-size: 12.5px;
  margin: 0;
}

.key-banner p {
  font-size: 10.5px;
  color: var(--text-3);
  margin: 2px 0 7px;
}

.base-url {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.base-url code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}

.mini-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  min-width: 0;
}

.mini-stat-icon {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-2);
  display: grid;
  place-items: center;
  flex: none;
}

.mini-stat > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mini-stat span {
  font-size: 9.5px;
  color: var(--text-3);
}

.mini-stat strong {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.key-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 120px;
}

.key-name strong {
  font-size: 12px;
  font-weight: 550;
}

.key-name span {
  font-size: 9.5px;
  color: var(--text-3);
}

.key-preview {
  display: flex;
  align-items: center;
  gap: 3px;
}

.key-preview code {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}

.quota-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 108px;
}

.quota-cell > span {
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.quota-cell em {
  font-style: normal;
  color: var(--text-3);
}

.progress {
  display: block;
  height: 4px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--gradient);
}

.progress > span.ghost {
  background: var(--border-strong);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.secret-value {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  flex-wrap: wrap;
}

.secret-value code {
  flex: 1;
  min-width: 190px;
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

.key-warning {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 13px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 9px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.6;
}

.key-warning svg {
  flex: none;
  margin-top: 1px;
}

/* =========================================================
   Logs
   ========================================================= */

.filter-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 12px;
  margin-bottom: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.filter-row .search-box.grow {
  flex: 1;
  min-width: 220px;
}

.filter-row .select.compact {
  width: auto;
  min-width: 150px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
}

.date-range .input {
  width: 138px;
}

.date-sep {
  font-size: 10px;
}

.filter-hint {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--text-3);
}

.log-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 13px;
}

.log-summary > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.log-summary span {
  font-size: 9.5px;
  color: var(--text-3);
}

.log-summary strong {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.log-summary em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--text-3);
  font-weight: 400;
}

.log-model {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.log-model strong {
  font-size: 11.5px;
  font-weight: 550;
}

.log-model span {
  font-size: 9.5px;
  color: var(--text-3);
}

.chevron {
  color: var(--text-3);
  display: inline-flex;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 15px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-3);
}

.pagination-actions {
  display: flex;
  gap: 6px;
}

.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.drawer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.drawer-time {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-3);
}

.usage-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.usage-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 10.5px;
}

.usage-breakdown span {
  color: var(--text-3);
}

.usage-breakdown strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.usage-breakdown .cost {
  grid-column: span 2;
  background: var(--brand-soft);
  border-color: rgba(99, 102, 241, 0.18);
}

.error-block {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
}

.error-block svg {
  flex: none;
  margin-top: 1px;
}

.error-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
}

.detail-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--text-2);
  font-size: 10.5px;
}

.detail-note svg {
  color: var(--success);
  flex: none;
  margin-top: 1px;
}

.drawer-text {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-2);
}

/* =========================================================
   Channels
   ========================================================= */

.info-banner {
  display: flex;
  gap: 11px;
  padding: 13px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.info-banner-icon {
  color: var(--brand-2);
  flex: none;
  margin-top: 1px;
}

.info-banner h3 {
  font-size: 12px;
  margin: 0 0 2px;
}

.info-banner p {
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--text-3);
  margin: 0;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.channel-card {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color 0.16s ease;
}

.channel-card:hover {
  border-color: var(--border-strong);
}

.channel-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.channel-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  flex: none;
}

.channel-info {
  flex: 1;
  min-width: 0;
}

.channel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.channel-title h3 {
  font-size: 13px;
  margin: 0;
  font-weight: 600;
}

.channel-url {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 9.5px;
  margin-top: 3px;
  min-width: 0;
}

.channel-url code {
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-switch {
  flex: none;
  margin-top: 3px;
}

.channel-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.channel-models {
  flex: 1;
  min-width: 220px;
}

.channel-label {
  display: block;
  font-size: 9px;
  color: var(--text-3);
  margin-bottom: 5px;
}

.channel-stats {
  display: flex;
  gap: 22px;
}

.channel-stats > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.channel-stats span {
  font-size: 9px;
  color: var(--text-3);
}

.channel-stats strong {
  font-size: 11px;
  font-weight: 600;
}

.channel-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.channel-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 9px;
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 9.5px;
  line-height: 1.55;
}

.channel-error svg {
  flex: none;
  margin-top: 1px;
}

.model-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 205px;
  overflow-y: auto;
  padding: 2px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 10.5px;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.check-card:hover {
  border-color: var(--border-strong);
}

.check-card:has(input:checked) {
  border-color: rgba(99, 102, 241, 0.4);
  background: var(--brand-soft);
}

.check-card input {
  display: none;
}

.check-dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex: none;
}

.check-card input:checked + .check-dot {
  background: var(--brand);
  border-color: var(--brand);
}

.check-card input:checked + .check-dot::after {
  content: '';
  width: 6px;
  height: 3px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.check-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.check-text strong {
  font-size: 10.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-text em {
  font-style: normal;
  font-size: 8.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.advanced {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--surface-2);
}

.advanced summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  cursor: pointer;
  color: var(--text-2);
  list-style: none;
}

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

.advanced p {
  font-size: 9.5px;
  color: var(--text-3);
  margin: 7px 0 0;
  line-height: 1.6;
}

.advanced code {
  font-family: var(--font-mono);
  font-size: 9px;
}

/* =========================================================
   Users
   ========================================================= */

.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-cell > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-cell strong {
  font-size: 11.5px;
  font-weight: 550;
}

.user-cell span {
  font-size: 9.5px;
  color: var(--text-3);
}

.cell-sub {
  display: block;
  font-size: 9px;
  color: var(--text-3);
  margin-top: 1px;
  font-weight: 400;
}

.balance-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-2);
}

.balance-display strong {
  font-size: 19px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.quick-amounts {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* =========================================================
   Settings
   ========================================================= */

.settings-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.settings-nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.settings-nav-item.active {
  background: var(--brand-soft);
  color: var(--text);
}

.settings-content {
  min-width: 0;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
}

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.settings-head h2 {
  font-size: 15.5px;
  margin: 0 0 2px;
}

.settings-head p {
  font-size: 11px;
  color: var(--text-3);
  margin: 0;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--gradient-soft);
}

.profile-avatar {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--gradient);
  color: #fff;
  font-size: 19px;
  font-weight: 650;
  flex: none;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.3);
}

.profile-main {
  flex: 1;
  min-width: 170px;
}

.profile-main h3 {
  font-size: 14px;
  margin: 0 0 1px;
}

.profile-main p {
  font-size: 10.5px;
  color: var(--text-2);
  margin: 0 0 5px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 9.5px;
  color: var(--text-3);
}

.profile-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
}

.profile-balance span {
  font-size: 9.5px;
  color: var(--text-3);
}

.profile-balance strong {
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
}

.settings-section > .settings-form:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.form-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.kv-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.kv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  flex-wrap: wrap;
}

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

.kv-row > span {
  color: var(--text-3);
  min-width: 115px;
}

.kv-row code {
  font-family: var(--font-mono);
  font-size: 10px;
  flex: 1;
  word-break: break-all;
}

.kv-row strong {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
}

.text-success {
  color: var(--success) !important;
}

/* =========================================================
   Docs
   ========================================================= */

.docs-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 11px;
  border-left: 1px solid var(--border);
}

.docs-toc-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px 6px;
}

.docs-toc-item {
  text-align: left;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  font-size: 10.5px;
}

.docs-toc-item:hover {
  color: var(--text);
  background: var(--hover);
}

.docs-toc-item.active {
  color: var(--brand-2);
}

.docs-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.docs-section {
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.docs-section h2 {
  font-size: 16px;
  margin: 0 0 5px;
}

.docs-section > p {
  font-size: 11.5px;
  color: var(--text-2);
  margin: 0 0 12px;
  line-height: 1.7;
}

.docs-section > p code {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

.docs-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
}

.docs-hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  color: var(--brand-2);
  flex: none;
}

.docs-hero h2 {
  margin: 0;
}

.docs-hero p {
  font-size: 10.5px;
  color: var(--text-3);
  margin: 2px 0 0;
}

.endpoint-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--code-bg);
  margin-bottom: 13px;
}

.endpoint-banner code {
  flex: 1;
  min-width: 160px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #c9d6ea;
}

.endpoint-banner .btn {
  color: #8ea0bd;
}

.method-pill {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.method-pill.post {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.method-pill.get {
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
}

.docs-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.docs-step {
  display: flex;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}

.docs-step > span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 650;
  flex: none;
  margin-top: 1px;
}

.docs-step strong {
  font-size: 10.5px;
  font-weight: 600;
}

.docs-step p {
  font-size: 9.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 2px 0 0;
  word-break: break-word;
}

.docs-step code {
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.code-tabs {
  display: flex;
  gap: 3px;
}

.code-tabs button {
  height: 27px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--text-3);
  font-size: 10px;
}

.code-tabs button.active {
  background: var(--code-bg);
  border-color: var(--border);
  border-bottom-color: transparent;
  color: #c9d6ea;
}

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.endpoint-row code {
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.param-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.param-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 10px;
}

.param-row code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--brand-2);
  min-width: 95px;
}

.param-row span {
  color: var(--text-3);
}

.callout {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 8px;
  background: var(--brand-soft);
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.6;
}

.callout svg {
  flex: none;
  margin-top: 1px;
  color: var(--brand-2);
}

/* =========================================================
   Markdown & code
   ========================================================= */

.md {
  font-size: 13.5px;
  line-height: 1.78;
}

.md > *:first-child {
  margin-top: 0;
}

.md > *:last-child {
  margin-bottom: 0;
}

.md p {
  margin: 0 0 10px;
}

.md h1,
.md h2,
.md h3,
.md h4 {
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 18px 0 7px;
  line-height: 1.35;
}

.md h1 {
  font-size: 19px;
}

.md h2 {
  font-size: 17px;
}

.md h3 {
  font-size: 15px;
}

.md h4 {
  font-size: 13.5px;
}

.md ul,
.md ol {
  margin: 6px 0 11px;
  padding-left: 21px;
}

.md li {
  margin: 3px 0;
}

.md li::marker {
  color: var(--brand-2);
}

.md strong {
  font-weight: 650;
}

.md em {
  font-style: italic;
  color: var(--text-2);
}

.md del {
  opacity: 0.65;
}

.md a {
  color: var(--brand-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.md blockquote {
  margin: 10px 0;
  padding: 7px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 7px 7px 0;
  background: var(--brand-soft);
  color: var(--text-2);
  font-size: 12px;
}

.md blockquote p {
  margin: 0;
}

.md hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.md code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1.5px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.code-block {
  margin: 11px 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.025);
  color: #8496b4;
  font-size: 9.5px;
}

.code-lang {
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #8496b4;
  font-size: 9.5px;
  padding: 2px 4px;
}

.code-copy:hover {
  color: #e6edf7;
  background: rgba(255, 255, 255, 0.06);
}

.code-copy.copied {
  color: #34d399;
}

.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.65;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #c9d6ea;
  padding: 0;
  border: 0;
  background: none;
  white-space: pre;
}

.md-table-wrap {
  margin: 11px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.md th,
.md td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.md th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 10.5px;
}

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

/* =========================================================
   Chat
   ========================================================= */

.chat-layout {
  display: flex;
  height: 100%;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

.chat-sidebar {
  width: 294px;
  flex: 0 0 294px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 14px 10px;
  flex: none;
}

.chat-side-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}

.count-pill {
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 9px;
  color: var(--text-3);
  font-weight: 500;
}

.chat-search {
  position: relative;
  margin: 0 12px 8px;
  flex: none;
}

.chat-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.chat-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  outline: none;
  transition: border-color 0.15s ease;
}

.chat-search input:focus {
  border-color: var(--brand);
}

.chat-search input::placeholder {
  color: var(--text-3);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 10px;
  min-height: 0;
}

.conv-group {
  margin-bottom: 4px;
}

.conv-group-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 8px 4px;
}

.conv-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item.active {
  background: var(--brand-soft);
  border-color: rgba(99, 102, 241, 0.16);
}

.conv-icon {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-3);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}

.conv-item.active .conv-icon {
  background: var(--brand);
  color: #fff;
}

.conv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.conv-title {
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
  padding-right: 4px;
}

.conv-preview {
  font-size: 9.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
}

.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
  font-size: 8.5px;
  color: var(--text-3);
  padding-top: 1px;
}

.conv-pin {
  color: var(--brand-2);
  display: flex;
}

.conv-more {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-3);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.14s ease, background 0.14s ease;
  box-shadow: var(--shadow-sm);
}

.conv-item:hover .conv-more {
  opacity: 1;
}

.conv-more:hover {
  color: var(--text);
  background: var(--surface-3);
}

.conv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 12px;
  color: var(--text-3);
  font-size: 10.5px;
  text-align: center;
}

.chat-side-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex: none;
}

.chat-side-foot a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  color: var(--text-3);
  padding: 3px 5px;
  border-radius: 4px;
}

.chat-side-foot a:hover {
  color: var(--text);
  background: var(--hover);
}

.dot-sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--text-3);
}

.chat-scrim {
  display: none;
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.055), transparent 55%);
}

.chat-header {
  height: 62px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 5;
}

.chat-side-toggle {
  display: none;
}

.chat-head-info {
  flex: 1;
  min-width: 0;
}

.chat-head-info h2 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.chat-head-info p {
  font-size: 10px;
  color: var(--text-3);
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-actions {
  display: flex;
  gap: 3px;
  flex: none;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 24px 0 6px;
  scroll-behavior: smooth;
}

.chat-messages {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message {
  display: flex;
  gap: 10px;
  animation: msgIn 0.28s ease;
}

.message-user {
  justify-content: flex-end;
  padding-left: 12%;
}

.message-user .message-body {
  align-items: flex-end;
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.message-avatar {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 650;
}

.user-avatar {
  background: var(--gradient);
  color: #fff;
}

.ai-avatar {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 3px var(--bg);
}

.ai-avatar img {
  border-radius: 7px;
}

.bubble {
  font-size: 13.5px;
  line-height: 1.75;
  word-break: break-word;
}

.bubble-user {
  padding: 9px 14px;
  border-radius: 14px 14px 5px 14px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.24);
  font-size: 13px;
  max-width: 100%;
}

.message-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--text-3);
  margin-bottom: 1px;
}

.message-head strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.message-channel {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-3);
}

.message-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 9.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  min-height: 22px;
}

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

.message-actions.is-hidden {
  display: none;
}

.icon-action {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
}

.icon-action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.message-time {
  font-size: 9px;
  color: var(--text-3);
}

.message-error {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  line-height: 1.55;
  margin-top: 2px;
}

.message-error svg {
  flex: none;
  margin-top: 1px;
}

.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 10.5px;
  padding: 3px 0;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-2);
  animation: typing 1.2s infinite ease-in-out;
}

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

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

.stream-caret {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--brand-2);
  border-radius: 1.5px;
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}

.reasoning {
  margin-bottom: 8px;
  font-size: 10.5px;
  color: var(--text-3);
}

.reasoning summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  list-style: none;
  color: var(--text-3);
}

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

.reasoning-body {
  margin-top: 5px;
  padding: 7px 10px;
  border-left: 2px solid var(--border-strong);
  color: var(--text-2);
  line-height: 1.65;
}

.composer-wrap {
  flex: none;
  padding: 6px 20px 12px;
  background: linear-gradient(180deg, transparent, var(--bg) 28%);
}

.composer-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 9px 11px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), 0 12px 36px rgba(0, 0, 0, 0.2);
}

.composer-shell.is-streaming {
  border-color: rgba(248, 113, 113, 0.36);
}

#chat-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  padding: 5px 4px 3px;
  font-size: 13.5px;
  line-height: 1.6;
  max-height: 220px;
  min-height: 30px;
  color: var(--text);
}

#chat-input::placeholder {
  color: var(--text-3);
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

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

.composer-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
  max-width: 230px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.model-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.model-picker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.model-picker-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-picker-chevron {
  display: flex;
  color: var(--text-3);
}

.composer-hint {
  font-size: 9px;
  color: var(--text-3);
  white-space: nowrap;
}

.char-count {
  font-size: 9px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.send-btn {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  flex: none;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.38;
}

.send-btn.is-stop {
  background: var(--danger);
  box-shadow: 0 4px 14px rgba(248, 113, 113, 0.28);
}

.composer-note {
  max-width: 820px;
  margin: 7px auto 0;
  text-align: center;
  font-size: 9px;
  color: var(--text-3);
}

.chat-empty {
  max-width: 680px;
  margin: 7vh auto 0;
  text-align: center;
  padding: 0 6px;
  animation: fadeUp 0.5s ease;
}

.chat-empty-orb {
  width: 62px;
  height: 62px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.16);
}

.chat-empty h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 5px;
}

.chat-empty p {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 0 0 22px;
}

.chat-empty p strong {
  color: var(--text-2);
  font-weight: 600;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  text-align: left;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.suggestion-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.suggestion-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-2);
  margin-bottom: 4px;
}

.suggestion-card strong {
  font-size: 11.5px;
  font-weight: 600;
}

.suggestion-card > span:last-child {
  font-size: 9.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.chat-loading-inline {
  padding: 60px 0;
}

/* Model picker popover */

.model-popover {
  position: fixed;
  z-index: 120;
  display: flex;
  flex-direction: column;
  max-height: min(480px, calc(100vh - 40px));
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.model-popover.open {
  opacity: 1;
  transform: none;
}

.model-pop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.model-pop-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-3);
}

.model-pop-search input {
  flex: 1;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 10.5px;
}

.model-pop-count {
  font-size: 8.5px;
  color: var(--text-3);
  flex: none;
}

.model-pop-list {
  overflow-y: auto;
  padding: 4px 0;
}

.model-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.model-pop-item:hover {
  background: var(--surface-2);
}

.model-pop-item.active {
  background: var(--brand-soft);
  border-color: rgba(99, 102, 241, 0.16);
}

.model-pop-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.model-pop-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.model-pop-info strong {
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-pop-info span {
  font-size: 8.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-pop-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 9px;
  color: var(--text-2);
  flex: none;
  white-space: nowrap;
}

.model-pop-price em {
  font-style: normal;
  font-size: 7.5px;
  color: var(--text-3);
}

.model-pop-check {
  color: var(--brand-2);
  display: flex;
  flex: none;
}

.model-pop-empty {
  padding: 28px 10px;
  text-align: center;
  color: var(--text-3);
  font-size: 10.5px;
}

/* =========================================================
   Login
   ========================================================= */

.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
  background: var(--bg);
  overflow: hidden;
}

.auth-aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
}

.aurora-blob.b1 {
  width: 560px;
  height: 560px;
  background: #4f46e5;
  top: -240px;
  left: -140px;
  animation: floatBlob 20s ease-in-out infinite;
}

.aurora-blob.b2 {
  width: 460px;
  height: 460px;
  background: #0891b2;
  bottom: -220px;
  left: 28%;
  opacity: 0.3;
  animation: floatBlob2 24s ease-in-out infinite;
}

.aurora-blob.b3 {
  width: 380px;
  height: 380px;
  background: #7c3aed;
  top: 16%;
  right: -120px;
  opacity: 0.26;
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse at 35% 30%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 35% 30%, #000 10%, transparent 72%);
}

.auth-left {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: clamp(28px, 4vw, 60px);
  max-width: 860px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-brand img {
  border-radius: 11px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

.auth-brand > div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.auth-brand strong {
  font-size: 15px;
  font-weight: 650;
}

.auth-brand span {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--text-3);
  margin-top: 3px;
}

.auth-copy {
  margin-top: 14px;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 0.05em;
}

.eyebrow-badge svg {
  color: var(--brand-2);
}

.auth-copy h1 {
  font-size: clamp(36px, 4.2vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 650;
  margin: 16px 0 14px;
}

.grad-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.auth-copy p {
  max-width: 500px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text-2);
}

.auth-metrics {
  display: flex;
  gap: 38px;
  flex-wrap: wrap;
}

.auth-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.auth-metric strong {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-metric span {
  font-size: 9.5px;
  color: var(--text-3);
}

.auth-console {
  max-width: 560px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 15px;
  background: rgba(9, 14, 25, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.console-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 550;
  color: #c7d5ec;
}

.console-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  color: #66758f;
}

.console-row {
  display: grid;
  grid-template-columns: 1.15fr 1.25fr 42px 48px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 9.5px;
  color: #7f90ad;
}

.console-model {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d7e2f3;
  font-size: 10px;
}

.console-model i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-style: normal;
  font-size: 8px;
  font-weight: 700;
}

.console-path {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: #66758f;
}

.console-ok {
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.console-ms {
  color: #66758f;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.console-foot {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 8.5px;
  color: #66758f;
}

.console-foot b {
  color: #c7d5ec;
  font-weight: 600;
}

.auth-features {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 9.5px;
  color: var(--text-2);
}

.auth-feature {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.auth-feature svg {
  color: var(--brand-2);
}

.auth-footer {
  margin-top: auto;
  font-size: 9px;
  color: var(--text-3);
  padding-top: 12px;
}

.auth-right {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px clamp(22px, 4vw, 56px);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  animation: cardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme='light'] .auth-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 600;
}

.auth-card-brand img {
  border-radius: 9px;
}

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}

.auth-tab {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  transition: all 0.16s ease;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-card-head h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 3px;
}

.auth-card-head p {
  font-size: 11px;
  color: var(--text-3);
  margin: 0 0 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-submit {
  height: 41px;
  margin-top: 2px;
  font-size: 12.5px;
}

.auth-hint {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--brand-soft);
  font-size: 9.5px;
  color: var(--text-2);
}

.auth-hint svg {
  color: var(--brand-2);
  flex: none;
}

.form-error {
  padding: 8px 10px;
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.55;
}

.auth-helper {
  margin-top: 14px;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-3);
}

.auth-helper button {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--brand-2);
  font-size: 10.5px;
}

.auth-note {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 9px;
  line-height: 1.6;
  color: var(--text-3);
}

.auth-note svg {
  flex: none;
  margin-top: 1px;
}

.auth-foot-note {
  margin-top: 15px;
  font-size: 9px;
  color: var(--text-3);
  text-align: center;
}

.shake {
  animation: shake 0.42s ease;
}

/* =========================================================
   Animations
   ========================================================= */

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

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

@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes wave {
  0%,
  60%,
  100% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(14deg);
  }
  20% {
    transform: rotate(-8deg);
  }
  30% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(10deg);
  }
}

@keyframes floatBlob {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(50px, 40px) scale(1.06);
  }
}

@keyframes floatBlob2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-50px, -30px) scale(1.1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1240px) {
  .models-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid,
  .dash-grid.lower {
    grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.9fr);
  }
}

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid,
  .dash-grid.lower {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }

  .donut-chart {
    width: 150px;
    height: 150px;
    flex: none;
  }

  .donut-legend {
    flex: 1;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-left {
    display: none;
  }

  .auth-right {
    min-height: 100vh;
    padding: 32px 20px;
  }
}

@media (max-width: 1024px) {
  .mini-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
  }

  .settings-layout {
    grid-template-columns: 160px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(3, 7, 15, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .app-shell.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 0 18px;
  }

  .view {
    padding: 22px 18px 46px;
  }

  .view-chat {
    padding: 0;
    height: calc(100vh - var(--topbar-height));
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(320px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-lg);
  }

  .chat-layout.chat-sidebar-open .chat-sidebar {
    transform: none;
  }

  .chat-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 55;
    background: rgba(3, 7, 15, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .chat-layout.chat-sidebar-open .chat-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-side-toggle {
    display: inline-flex;
  }

  .chat-header {
    padding: 0 13px;
  }

  .chat-messages {
    padding: 0 16px 16px;
  }

  .composer-wrap {
    padding: 5px 12px 9px;
  }

  .composer-hint {
    display: none;
  }

  .settings-layout {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }

  .settings-nav-item {
    flex: none;
  }

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-toc {
    display: none;
  }

  .profile-card {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 62px;
  }

  :root {
    --topbar-height: 62px;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-title h1 {
    font-size: 15px;
  }

  .topbar-doc {
    display: none;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .page-sub {
    font-size: 12px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 23px;
  }

  .view {
    padding: 18px 14px 40px;
  }

  .view-chat {
    padding: 0;
  }

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

  .filter-hint {
    display: none;
  }

  .search-box {
    width: 100%;
  }

  .filter-row .search-box.grow {
    flex-basis: 100%;
  }

  .docs-steps {
    grid-template-columns: 1fr;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

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

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

  .key-banner {
    align-items: flex-start;
  }

  .mini-stat-row {
    gap: 8px;
  }

  .mini-stat {
    padding: 10px;
  }

  .mini-stat strong {
    font-size: 13.5px;
  }

  .channel-body {
    align-items: flex-start;
    flex-direction: column;
  }

  .channel-stats {
    gap: 20px;
  }

  .channel-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

  .chat-empty {
    margin-top: 4vh;
  }

  .chat-empty h2 {
    font-size: 18px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .auth-right {
    padding: 20px 14px;
  }

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

  .span-2 {
    grid-column: span 1;
  }

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

  .toast-stack {
    right: 12px;
    bottom: 12px;
  }

  .table-card .data-table {
    min-width: 640px;
  }

  .log-table {
    min-width: 620px;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .btn-ghost {
    display: none;
  }

  .topbar-actions [data-theme-toggle],
  .topbar-actions .bell-btn {
    display: inline-flex;
  }

  .bell-btn {
    display: inline-flex;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .page-actions .search-box {
    flex-basis: 100%;
  }

  .message-avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }

  .message-user {
    padding-left: 4%;
  }

  .bubble {
    font-size: 13px;
  }

  .chat-messages {
    gap: 20px;
    padding: 0 12px 14px;
  }

  .chat-header {
    height: 56px;
  }

  .chat-head-info h2 {
    font-size: 12.5px;
  }

  .composer-wrap {
    padding: 4px 8px 7px;
  }

  .composer-note {
    display: none;
  }

  .model-chip {
    max-width: 150px;
  }

  .mini-stat-row {
    grid-template-columns: 1fr 1fr;
  }

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

  .usage-breakdown {
    grid-template-columns: 1fr;
  }

  .usage-breakdown .cost {
    grid-column: span 1;
  }

  .profile-balance {
    align-items: flex-start;
    width: 100%;
  }

  .settings-section {
    padding: 17px;
  }

  .modal-layer {
    padding: 10px;
  }

  .modal {
    max-height: 92vh;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .donut-wrap {
    flex-direction: column;
  }

  .auth-copy h1 {
    font-size: 33px;
  }

  .auth-metrics {
    gap: 24px;
  }

  .date-range {
    width: 100%;
  }

  .date-range .input {
    flex: 1;
    width: auto;
  }

  .filter-row .segmented {
    flex: 1;
    justify-content: center;
  }

  .filter-row .segmented button {
    flex: 1;
  }

  .toolbar {
    gap: 9px;
  }

  .toolbar .search-box {
    flex-basis: 100%;
  }

  .toolbar-count {
    margin-left: 0;
  }
}

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