:root {
  --bg-0: #060911;
  --bg-1: #0b101d;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-card-solid: #0f172a;
  --bg-elevated: #162038;
  --bg-input: rgba(9, 14, 26, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --border-brand: rgba(56, 189, 248, 0.45);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --brand-cyan: #0ea5e9;
  --brand-indigo: #6366f1;
  --brand-gradient: linear-gradient(135deg, #0ea5e9 0%, #4f46e5 100%);
  --brand-glow: 0 10px 30px -5px rgba(14, 165, 233, 0.35);
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-0);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================================
   1. Unified Ambient Split-Screen Enterprise Login UI
   ========================================================================= */
.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 22%, rgba(14, 165, 233, 0.16), transparent 45%),
    radial-gradient(circle at 82% 52%, rgba(99, 102, 241, 0.16), transparent 48%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.08), transparent 45%),
    linear-gradient(135deg, #050811 0%, #0a1122 50%, #070c18 100%);
}

.login-split::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 85%);
  pointer-events: none;
}

.login-hero {
  position: relative;
  z-index: 2;
  padding: 56px 48px 56px 8vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  box-shadow: var(--brand-glow);
  letter-spacing: -0.03em;
}

.logo-mark.master-mark {
  background: linear-gradient(135deg, #f59e0b 0%, #e11d48 100%);
  box-shadow: 0 10px 30px -5px rgba(245, 158, 11, 0.35);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 540px;
  margin: auto 0;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 22px;
}

.hero-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

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

.hero-feature-card {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.hero-feature-card:hover {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(15, 23, 42, 0.68);
  transform: translateY(-2px);
}

.hero-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.24);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.hero-feature-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hero-feature-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.hero-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* Right Login Form Panel — Elevated Glass Card seamlessly integrated with Left */
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 8vw 48px 32px;
  position: relative;
  z-index: 2;
}

.login-box {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 22px;
  padding: 42px 38px;
  box-shadow:
    0 25px 60px -15px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  position: relative;
  overflow: hidden;
}

.login-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.7), rgba(99, 102, 241, 0.7), transparent);
}

.login-box-header {
  margin-bottom: 28px;
}

.login-box-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-box-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.input-field {
  margin-bottom: 20px;
}

.input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.input-control {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14.5px;
  outline: none;
  transition: all 0.18s ease;
}

.input-control:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.login-submit-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: 10px;
  border: none;
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--brand-glow);
  transition: transform 0.15s ease, opacity 0.15s ease;
  margin-top: 6px;
}

.login-submit-btn:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.login-submit-btn.master-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #e11d48 100%);
  box-shadow: 0 10px 30px -5px rgba(225, 29, 72, 0.4);
}

.login-security-note {
  margin-top: 28px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.login-error-alert {
  margin-bottom: 20px;
  padding: 12px 15px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px -4px rgba(244, 63, 94, 0.25);
  animation: shakeError 0.3s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* =========================================================================
   2. Enterprise Console Shell (Sidebar + Main Workspace)
   ========================================================================= */
.console-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
  background: var(--bg-0);
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

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

.sidebar-item.active {
  color: #ffffff;
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(56, 189, 248, 0.3);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.user-card {
  padding: 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}

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

.workspace-header {
  height: 68px;
  padding: 0 36px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 9, 17, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.workspace-body {
  padding: 32px 36px 64px;
  max-width: 1360px;
  width: 100%;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-gradient);
  opacity: 0.55;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Panels & Tables */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

td {
  padding: 15px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

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

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.28);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 7px;
}

.role-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(14, 165, 233, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-active {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.status-disabled {
  background: rgba(244, 63, 94, 0.14);
  color: #fb7185;
}

.quota-bar {
  width: 140px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.quota-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 999px;
}

.mono-code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  background: rgba(9, 14, 26, 0.9);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #38bdf8;
}

.code-block {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  background: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

/* Forms & Modals */
.form-group {
  margin-bottom: 16px;
  min-width: 0;
}

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

.form-row > * {
  min-width: 0;
}

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

.form-input, .form-select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--brand-cyan);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.76);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 100%;
  max-width: 540px;
  padding: 28px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.65);
}

.toast-bar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #f8fafc;
  padding: 12px 24px;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  z-index: 300;
  font-size: 13.5px;
  font-weight: 500;
}

@media (max-width: 960px) {
  .login-split {
    grid-template-columns: 1fr;
  }
  .login-hero {
    display: none;
  }
  .console-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: static;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   3. Enterprise Model Marketplace, Dedicated Account Binding & playground
   ========================================================================= */
.sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.sub-tab-btn {
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}

.sub-tab-btn.active {
  color: #fff;
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.model-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s, transform 0.15s;
}

.model-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.model-card.disabled-card {
  opacity: 0.55;
}

.vendor-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.vendor-anthropic { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.vendor-openai { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.vendor-gemini { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.vendor-deepseek { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }

.switch-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(148, 163, 184, 0.25);
  transition: .2s;
  border-radius: 22px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

.switch-toggle input:checked + .switch-slider {
  background: var(--brand-gradient);
}

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

.account-check-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.account-check-item:hover {
  border-color: var(--brand-cyan);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 999px;
}
