@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

/* =========================================
   1. Design System Tokens
   ========================================= */
:root {
  /* 主色调 - 从 Indigo 转为 Blue-Violet */
  --primary: #7c5cfc;
  --primary-hover: #6a4de8;
  --primary-light: rgba(124, 92, 252, 0.12);
  --primary-glow: rgba(124, 92, 252, 0.3);

  /* 强调色 - 更柔和的色调 */
  --accent-purple: #a78bfa;
  --accent-pink: #f472b6;
  --accent-cyan: #22d3ee;
  --accent-blue: #60a5fa;
  --accent-green: #34d399;
  --accent-orange: #fbbf24;
  --accent-red: #f87171;

  /* 背景色 - 更温暖的深色调 */
  --bg-body: #0c0e1a;
  --bg-surface: rgba(22, 27, 45, 0.85);
  --bg-surface-hover: rgba(35, 42, 65, 0.7);
  --bg-elevated: rgba(30, 36, 58, 0.9);
  --bg-sidebar: rgba(14, 17, 30, 0.95);

  /* 文字色 */
  --text-main: #eef0f6;
  --text-secondary: #8b92a8;
  --text-muted: #5a6178;

  /* 边框色 */
  --border-color: rgba(139, 146, 168, 0.1);
  --border-highlight: rgba(139, 146, 168, 0.2);

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 24px rgba(124, 92, 252, 0.12);

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* 过渡 */
  --transition-fast: all 0.15s ease;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. Reset & Base Styles
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(124, 92, 252, 0.06) 0%, transparent 60%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Scrollbar Polish */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(139, 146, 168, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 146, 168, 0.4);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* =========================================
   3. Sidebar
   ========================================= */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.3);
}

.sidebar-header .title {
  font-size: 1.15rem;
  font-weight: 600;
  background: linear-gradient(to right, #eef0f6, var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-menu {
  flex: 1;
  list-style: none;
  padding: 0 12px;
  margin-top: 10px;
}

.sidebar-item {
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.sidebar-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-footer {
  padding: 24px 20px;
  border-top: 1px solid var(--border-highlight);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-footer-stats {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.footer-stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.footer-stat-item:last-child {
  margin-bottom: 0;
}

.footer-stat-label {
  color: var(--text-muted);
}

.footer-stat-value {
  font-weight: 600;
  color: var(--text-main);
}

.footer-stat-value.normal {
  color: var(--accent-green);
}

.footer-stat-value.abnormal {
  color: var(--accent-red);
}

/* =========================================
   4. Main Content Area
   ========================================= */
.main-content {
  flex: 1;
  margin-left: 260px;
  /* matches sidebar width */
  padding: var(--space-xl) var(--space-2xl);
  animation: fadeUp 0.5s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-section {
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-section h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.header-section p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* =========================================
   5. Components: Cards & Stats
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-info .label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.stat-info .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition);
}

.stat-icon.total {
  background: rgba(96, 165, 250, 0.12);
  color: var(--accent-blue);
}

.stat-icon.normal {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-green);
}

.stat-icon.abnormal {
  background: rgba(248, 113, 113, 0.12);
  color: var(--accent-red);
}

.stat-icon.selected {
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent-purple);
}

/* =========================================
   6. Components: Tables & Lists
   ========================================= */
.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* For rounded corners on table */
  box-shadow: var(--shadow-sm);
}

.toolbar {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-elevated);
  flex-wrap: wrap;
  gap: 16px;
}

/* Tabs inside Toolbar */
.filter-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-highlight);
}

.tab-item {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  transition: var(--transition);
}

.tab-item:hover {
  color: var(--text-main);
}

.tab-item.active {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Table Styles */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1000px;
}

/* 账号管理表格自适应 */
.accounts-table {
  table-layout: fixed;
  min-width: 0;
}

.accounts-table th,
.accounts-table td {
  word-break: break-word;
}

.accounts-table .col-token .token-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.95rem;
  vertical-align: middle;
  transition: background 0.1s;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(139, 146, 168, 0.05);
}

/* Tokens / Monospaced text */
.token-text {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-highlight);
}

/* Status Badges & Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.tag-free {
  background: rgba(52, 211, 153, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.platform-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-kiro {
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent-cyan);
}

.badge-orchids {
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent-purple);
}

.badge-antigravity {
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent-orange);
}

/* Progress Bars */
.usage-progress-container {
  width: 120px;
  height: 6px;
  background: rgba(139, 146, 168, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.usage-progress-bar {
  height: 100%;
  border-radius: 3px;
}

.usage-progress-bar.green {
  background: var(--accent-green);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.usage-progress-bar.orange {
  background: var(--accent-orange);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.usage-progress-bar.red {
  background: var(--accent-red);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.3);
}

/* =========================================
   7. Buttons & Inputs
   ========================================= */


/* Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  background: rgba(12, 14, 26, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Form input inside wrapper with icon */
.input-wrapper .form-input {
  padding-left: 44px;
  /* Icon spacing */
}

.form-input:focus {
  background: rgba(12, 14, 26, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Toggle Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--bg-surface-hover);
  border-radius: 99px;
  transition: .3s;
  border: 1px solid var(--border-color);
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.toggle input:checked+.toggle-slider:before {
  transform: translateX(19px);
}

/* =========================================
   7.5 Button Polish
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover), #5b3dd4);
  box-shadow: 0 6px 16px rgba(124, 92, 252, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-highlight);
  color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
  color: white;
}

.btn-danger-outline {
  background: rgba(248, 113, 113, 0.05);
  border-color: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.btn-danger-outline:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
  color: #fca5a5;
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.2);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.action-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-style: normal;
}

.action-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* =========================================
   8. Grok Tools
   ========================================= */
.grok-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.grok-panel {
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.grok-panel h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.grok-panel p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.grok-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.grok-form-grid .full {
  grid-column: span 4;
}

.grok-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.grok-kv strong {
  color: var(--text-main);
  font-weight: 600;
}

.imagine-grid {
  columns: 4 260px;
  column-gap: 12px;
  margin-top: 12px;
}

.imagine-card {
  break-inside: avoid;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.imagine-card img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.imagine-meta {
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.cache-list {
  margin-top: 12px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.cache-list table {
  width: 100%;
}

.cache-list th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elevated);
}

.cache-list td code {
  color: var(--accent-cyan);
}

/* =========================================
   9. Modals & Toasts
   ========================================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xl);
  padding: 0;
  /* Remove default padding, use inner sections */
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.03);
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.modal-header {
  padding: 24px;
  padding-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.modal form {
  padding: 24px;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.toast {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: min(420px, calc(100vw - 32px));
  word-break: break-word;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  z-index: 200;
  pointer-events: none;
}

/* =========================================
   10. Login Page Specifics (Migrated)
   ========================================= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xl);
  padding: 48px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeUp 0.6s ease-out;
}

.login-body .toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
}

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

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: pulse 10s infinite alternate;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: var(--accent-purple);
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.2;
  }

  100% {
    transform: scale(1.1);
    opacity: 0.35;
  }
}

/* =========================================
   10.5 Visual Refresh
   ========================================= */
:root {
  --primary: #d7ff64;
  --primary-hover: #c2f043;
  --primary-light: rgba(215, 255, 100, 0.14);
  --primary-glow: rgba(215, 255, 100, 0.18);
  --accent-purple: #7dd3fc;
  --accent-pink: #fb7185;
  --accent-cyan: #67e8f9;
  --accent-blue: #93c5fd;
  --accent-green: #6ee7b7;
  --accent-orange: #fdba74;
  --accent-red: #fda4af;
  --bg-body: #0a0d10;
  --bg-surface: rgba(17, 22, 27, 0.9);
  --bg-surface-hover: rgba(28, 35, 42, 0.9);
  --bg-elevated: rgba(20, 26, 33, 0.96);
  --bg-sidebar: rgba(9, 12, 16, 0.96);
  --text-main: #f4f7f2;
  --text-secondary: #99a69c;
  --text-muted: #667269;
  --border-color: rgba(186, 199, 188, 0.1);
  --border-highlight: rgba(215, 255, 100, 0.18);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.14);
  --shadow-md: 0 18px 40px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.32);
  --shadow-glow: 0 0 0 1px rgba(215, 255, 100, 0.05), 0 18px 40px rgba(0, 0, 0, 0.18);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

body {
  font-family: 'Outfit', "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(215, 255, 100, 0.08), transparent 26%),
    radial-gradient(circle at 85% 18%, rgba(125, 211, 252, 0.08), transparent 22%),
    linear-gradient(180deg, #080a0d 0%, #0d1116 56%, #0a0d10 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 38%, transparent 95%);
  pointer-events: none;
  opacity: 0.3;
  z-index: -2;
}

.sidebar {
  width: 284px;
  background:
    linear-gradient(180deg, rgba(14, 18, 23, 0.98), rgba(8, 11, 14, 0.98)),
    var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-header {
  padding: 28px 22px 20px;
  align-items: flex-start;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(215, 255, 100, 0.95), rgba(125, 211, 252, 0.92));
  color: #0a0d10;
  box-shadow: 0 14px 30px rgba(215, 255, 100, 0.18);
}

.sidebar-header .title {
  font-size: 1.24rem;
  color: var(--text-main);
  background: none;
  -webkit-text-fill-color: initial;
}

.sidebar-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-menu {
  padding: 10px 14px 0;
  margin-top: 12px;
}

.sidebar-item {
  margin-bottom: 8px;
}

.sidebar-link {
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
  color: #ebffd7;
  background:
    linear-gradient(135deg, rgba(215, 255, 100, 0.12), rgba(103, 232, 249, 0.08));
  border-color: rgba(215, 255, 100, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-link.active::before {
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
}

.nav-glyph {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-link.active .nav-glyph,
.sidebar-link:hover .nav-glyph {
  color: #f7ffe0;
  border-color: rgba(215, 255, 100, 0.18);
  background: rgba(215, 255, 100, 0.08);
}

.nav-glyph-small {
  min-width: 32px;
  height: 32px;
  font-size: 0.64rem;
}

.sidebar-footer {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.16));
}

.sidebar-footer-stats {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-logout {
  width: 100%;
  margin-top: 16px;
  justify-content: center;
}

.main-content {
  margin-left: 284px;
  padding: 36px 42px 42px;
}

.header-section {
  margin-bottom: 32px;
}

.header-section h1 {
  font-size: clamp(2rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.header-section p {
  max-width: 720px;
}

.stat-card,
.content-card,
.models-filter-panel,
.grok-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012)),
    var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  min-height: 142px;
  border-radius: 24px;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -24px auto;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(215, 255, 100, 0.12), transparent 66%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-6px);
  border-color: rgba(215, 255, 100, 0.16);
}

.stat-icon {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.toolbar {
  padding: 18px 20px;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
}

.filter-tabs {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
}

.tab-item {
  border-radius: 10px;
}

.tab-item.active {
  color: #10150f;
  background: linear-gradient(135deg, var(--primary), #a9f0ff);
  box-shadow: none;
}

th {
  background: rgba(255, 255, 255, 0.025);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

td {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.022);
}

.token-text {
  background: rgba(255, 255, 255, 0.035);
}

.form-input {
  background: rgba(3, 6, 8, 0.36);
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

.input-wrapper .form-input {
  padding-left: 54px;
}

.input-icon {
  left: 14px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-input:focus {
  background: rgba(10, 14, 18, 0.76);
  border-color: rgba(215, 255, 100, 0.4);
  box-shadow: 0 0 0 4px rgba(215, 255, 100, 0.08);
}

.btn {
  min-height: 42px;
  border-radius: 14px;
}

.btn-primary {
  color: #11150f;
  background: linear-gradient(135deg, var(--primary), #b6f86a);
  box-shadow: 0 10px 24px rgba(215, 255, 100, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ebff99, var(--primary-hover));
  box-shadow: 0 16px 32px rgba(215, 255, 100, 0.18);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.025);
}

.btn-icon {
  border-radius: 12px;
}

.toast {
  background: rgba(18, 22, 27, 0.95);
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.08);
}

.toast-mark {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(251, 113, 133, 0.14);
  color: #fecdd3;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-body {
  background:
    radial-gradient(circle at 18% 20%, rgba(215, 255, 100, 0.09), transparent 26%),
    radial-gradient(circle at 80% 16%, rgba(125, 211, 252, 0.08), transparent 18%),
    linear-gradient(180deg, #080a0d 0%, #0b1015 100%);
}

.grid-orbit {
  position: absolute;
  inset: 8% 12%;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 32px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.35;
}

.blob {
  filter: blur(120px);
  opacity: 0.18;
}

.blob-1 {
  background: #d7ff64;
}

.blob-2 {
  background: #67e8f9;
}

.login-card {
  position: relative;
  max-width: 500px;
  padding: 40px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    rgba(14, 18, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(215, 255, 100, 0.08), transparent 28%, transparent 70%, rgba(125, 211, 252, 0.08));
  pointer-events: none;
}

.login-brand,
.login-hero,
.login-links,
#loginForm {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand .title {
  font-size: 1.45rem;
  font-weight: 700;
}

.login-brand-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-hero {
  margin-bottom: 30px;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(215, 255, 100, 0.08);
  border: 1px solid rgba(215, 255, 100, 0.16);
  color: #e8ffac;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-hero h1 {
  margin-bottom: 8px;
  font-size: 2rem;
}

.login-hero p {
  color: var(--text-secondary);
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  margin-top: 8px;
}

.login-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.login-links a {
  color: #e8ffac;
}

@media (max-width: 900px) {
  .sidebar {
    width: 284px;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }
}

.metric-positive {
  color: var(--accent-green);
}

.metric-negative {
  color: var(--accent-red);
}

.metric-accent {
  color: var(--accent-purple);
}

.toolbar-compact {
  padding: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-actions-spread {
  flex: 1;
  justify-content: flex-end;
}

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

.toolbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--border-highlight);
}

.empty-state-panel {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.empty-state-mark {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e8ffac;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.pagination-shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.compact-select {
  width: auto;
  margin: 0;
}

.btn-page {
  min-width: 32px;
  padding: 4px 10px;
}

.btn-page-current {
  justify-content: center;
}

.config-tabs-shell {
  padding: 16px 24px 0;
  border-bottom: 1px solid var(--border-color);
}

.config-section-shell {
  padding: 24px;
}

.config-grid {
  display: grid;
  gap: 24px;
}

.config-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 32px;
}

.config-grid-gap-sm {
  gap: 20px;
  margin-bottom: 20px;
}

.config-subsection {
  margin-top: 12px;
}

.input-actions {
  position: absolute;
  right: 12px;
  top: 50%;
  display: flex;
  gap: 8px;
  transform: translateY(-50%);
}

.settings-panel {
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.settings-panel-spaced {
  margin-top: 24px;
}

.settings-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.settings-panel-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}

.settings-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.mini-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.1);
  color: var(--accent-blue);
  font-size: 0.78rem;
  font-weight: 600;
}

.meta-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meta-text-xs {
  font-size: 0.8rem;
}

.estimate-panel {
  padding: 12px;
  background: rgba(12, 14, 26, 0.5);
  border-radius: 12px;
}

.estimate-title {
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.estimate-card {
  padding: 8px;
  border-radius: 10px;
}

.estimate-card-green {
  background: rgba(52, 211, 153, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.1);
}

.estimate-card-blue {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.1);
}

.estimate-card-purple {
  background: rgba(167, 139, 250, 0.05);
  border: 1px solid rgba(167, 139, 250, 0.1);
}

.estimate-caption {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.estimate-value {
  font-weight: 700;
}

.estimate-value-green {
  color: var(--accent-green);
}

.estimate-value-blue {
  color: var(--accent-blue);
}

.estimate-value-purple {
  color: var(--accent-purple);
}

.estimate-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  gap: 12px;
  flex-wrap: wrap;
}

.btn-xs {
  min-height: 34px;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.save-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
}

.btn-save {
  padding: 10px 48px;
  font-weight: 600;
}

.doc-shell {
  padding: 24px;
}

.doc-callout {
  margin-bottom: 32px;
  padding: 18px 20px;
  border-radius: 18px;
}

.doc-callout-inline {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.doc-callout-cyan {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.15);
}

.doc-callout-amber {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.doc-callout-green {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.doc-callout-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.doc-mark {
  min-width: 44px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.doc-mark-cyan {
  background: var(--accent-cyan);
  color: #081013;
}

.doc-mark-amber {
  background: rgba(251, 191, 36, 0.18);
  color: var(--accent-orange);
}

.doc-mark-green {
  background: rgba(52, 211, 153, 0.16);
  color: var(--accent-green);
}

.doc-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.doc-code-block {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(12, 14, 26, 0.4);
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
}

.doc-strong {
  font-weight: 700;
}

.doc-strong-amber {
  color: var(--accent-orange);
}

.doc-strong-red {
  color: var(--accent-red);
}

.doc-strong-green {
  color: var(--accent-green);
}

.doc-inline-code {
  padding: 2px 6px;
  border-radius: 8px;
}

.doc-inline-code-amber {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-orange);
}

.doc-inline-code-red {
  background: rgba(248, 113, 113, 0.1);
  color: var(--accent-red);
}

.doc-inline-code-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
}

.doc-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(12, 14, 26, 0.5);
}

.doc-link-code {
  color: var(--accent-cyan);
}

.doc-model-code {
  color: var(--accent-green);
}

.tag-mini {
  font-size: 0.7rem;
}

.protocol-tag-claude {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.protocol-tag-openai {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-warp {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.badge-grok {
  background: rgba(244, 114, 182, 0.15);
  color: var(--accent-pink);
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.badge-bolt {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-puter {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

@media (max-width: 900px) {
  .config-grid-two,
  .estimate-grid {
    grid-template-columns: 1fr;
  }

  .doc-callout-inline,
  .pagination-shell,
  .settings-panel-head,
  .settings-panel-foot,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions-spread {
    justify-content: flex-start;
  }
}

/* =========================================
   11. Responsiveness
   ========================================= */
@media (max-width: 1200px) {
  .grok-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grok-form-grid .full {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .grok-form-grid {
    grid-template-columns: 1fr;
  }

  .grok-form-grid .full {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
    padding: var(--space-md);
  }

  .header-section {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .toolbar {
    padding: var(--space-md);
  }
}
