/* Linknlink AI Platform —— 暗色 glass 风格（参照 codexproxy 设计语言）
   设计 token：
   - 背景：深蓝紫 #0a0f1d + 蓝紫双光晕径向渐变
   - 卡片：半透明玻璃 + backdrop-filter blur + 顶部高光线
   - 主色：蓝 #3b82f6  辅色：紫 #8b5cf6  渐变 brand
   - 字体：Inter（CDN preconnect）+ -apple-system 兜底
*/

:root {
  --bg-dark:        #0a0f1d;
  --bg-card:        rgba(30, 41, 59, 0.55);
  --surface-2:      rgba(255, 255, 255, 0.035);
  --surface-hover:  rgba(255, 255, 255, 0.06);
  --text-main:      #f1f5f9;
  --text-muted:     #94a3b8;
  --text-faint:     #64748b;
  --primary:        #3b82f6;
  --primary-hover:  #2563eb;
  --accent:         #8b5cf6;
  --danger:         #ef4444;
  --success:        #34d399;
  --warn:           #fb923c;
  --border:         rgba(148, 163, 184, 0.14);
  --border-strong:  rgba(148, 163, 184, 0.26);
  --shadow-soft:    0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.22);
  --radius:         16px;
  --radius-sm:      10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--text-main);
  background: var(--bg-dark);
  background-image:
    radial-gradient(circle at 78% -10%, rgba(59, 130, 246, 0.14), transparent 42%),
    radial-gradient(circle at 12% 108%, rgba(139, 92, 246, 0.10), transparent 45%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  margin: 0;
  padding: 0;
}
#app.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 15px;
}
.lang-switcher {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}
.lang-switcher select {
  min-width: 120px;
  width: auto;
  margin: 0;
  padding: 6px 10px;
}

/* ===== 顶部导航 ===== */
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  margin-bottom: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.nav::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  pointer-events: none;
}
.nav::after {
  content: 'Linknlink AI Platform';
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
  margin-right: 18px;
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  order: -1;
}
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s, color .18s;
}
.nav a:hover { color: var(--text-main); background: var(--surface-hover); }
.nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59,130,246,.22), rgba(139,92,246,.10));
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.25);
}
.nav .right {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav .right a { padding: 4px 10px; font-size: 12.5px; }

/* ===== 卡片 ===== */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  animation: fadeIn .3s ease;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  pointer-events: none;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

h2 {
  margin: 0 0 18px;
  font-weight: 650;
  font-size: 1.15rem;
  letter-spacing: -.01em;
  color: var(--text-main);
}

/* ===== 表单行 ===== */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  flex-wrap: wrap;
}
.row label {
  width: 88px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 13px;
}

input, select, textarea {
  font: inherit;
  padding: 9px 12px;
  background: rgba(2, 6, 23, .45);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-main);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  min-width: 160px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 64px; width: 100%; min-width: 280px; }

button {
  font: inherit;
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: box-shadow .18s, transform .12s, background .18s;
  box-shadow: 0 4px 14px rgba(59,130,246,.30);
}
button:hover { box-shadow: 0 6px 20px rgba(59,130,246,.45); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
button.ghost {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.ghost:hover {
  background: rgba(255,255,255,.12);
  border-color: var(--border-strong);
  box-shadow: none;
}

/* ===== 表格 ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: transparent;
}
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td button { padding: 5px 12px; font-size: 12px; box-shadow: none; }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
}
.tag.pending  { background: rgba(251,146,60,.12);  color: var(--warn);    border-color: rgba(251,146,60,.30); }
.tag.approved { background: rgba(52,211,153,.12);  color: var(--success); border-color: rgba(52,211,153,.30); }
.tag.rejected { background: rgba(239,68,68,.12);   color: var(--danger);  border-color: rgba(239,68,68,.30); }
.tag.disabled { background: rgba(148,163,184,.12); color: var(--text-muted); border-color: var(--border); }

/* ===== 错误 / 辅助 ===== */
.error {
  color: #fca5a5;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.30);
  border-radius: 9px;
  padding: 10px 14px;
  margin: 10px 0 16px;
  font-size: 13px;
}
.muted { color: var(--text-faint); font-size: 12.5px; }

/* ===== 登录卡片居中 ===== */
#app:has(> .card:only-child) { display: flex; align-items: center; justify-content: center; }
#app > .card:only-child { max-width: 460px; width: 100%; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  #app { padding: 16px 14px 48px; }
  .nav { flex-wrap: wrap; padding: 12px 14px; }
  .nav::after { width: 100%; margin-bottom: 6px; }
  .nav .right { width: 100%; margin-left: 0; justify-content: flex-end; }
  .row label { width: 100%; }
  table { font-size: 12px; }
  th, td { padding: 10px 8px; }
}

/* ========== 登录页（参照 codexproxy auth-card） ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px 32px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(99,102,241,.12);
  position: relative;
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
}
.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 24px rgba(59,130,246,.40);
  color: #fff;
}
.auth-logo svg { width: 28px; height: 28px; }
.auth-brand {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .3px;
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s, color .18s;
}
.auth-tab:hover { color: var(--text-main); }
.auth-tab.active {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.30);
}
.login-mode-tabs {
  display: flex;
  gap: 18px;
  margin: 0 0 14px;
  font-size: 13px;
}
.login-mode {
  cursor: pointer;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
}
.login-mode:hover { color: var(--text-main); }
.login-mode.active { color: var(--primary); border-bottom-color: var(--primary); }

.auth-field {
  position: relative;
  margin-bottom: 14px;
}
.auth-field .field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: rgba(2, 6, 23, .5);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  min-width: 0;
}
.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}

/* 密码明文/密文切换眼睛 */
.auth-field input.has-eye {
  padding-right: 40px;
}
.auth-field .field-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
}
.auth-field .field-eye:hover { color: var(--text-main); }
.auth-field .field-eye svg { width: 18px; height: 18px; }

.code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

/* 手机号与国家码 */
.phone-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.phone-row .cc-input {
  width: 86px;
  flex-shrink: 0;
  padding: 12px 12px;
  background: rgba(2, 6, 23, .5);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  text-align: center;
}
.phone-row .cc-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.phone-row .phone-field {
  flex: 1;
  margin-bottom: 0;
}
.code-row input {
  flex: 1;
  padding: 12px 14px;
  background: rgba(2, 6, 23, .5);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
}
.code-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.code-row button {
  flex-shrink: 0;
  padding: 0 16px;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: none;
  white-space: nowrap;
}
.code-row button:hover {
  background: rgba(255,255,255,.12);
  border-color: var(--border-strong);
}

.auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 600;
  margin-top: 6px;
}
.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.auth-switch:hover { text-decoration: underline; }

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(14px);
  color: var(--text-main);
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 1000;
  animation: toastIn .25s ease;
}
.toast.error { border-color: rgba(239,68,68,.40); color: #fca5a5; }
.toast.success { border-color: rgba(52,211,153,.40); color: var(--success); }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ========== 已登录态：header + sidebar 布局 ========== */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0)), var(--bg-card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.32);
}
.topbar-logo svg { width: 18px; height: 18px; }
.topbar-brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.btn-apply-partner {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, .35);
  background: linear-gradient(135deg, rgba(59,130,246,.18), rgba(139,92,246,.22));
  color: #e0e7ff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(139,92,246,.18);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.btn-apply-partner:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, .55);
  box-shadow: 0 6px 18px rgba(139,92,246,.30);
}
.topbar-user { color: var(--text-main); }
.topbar-logout {
  color: var(--text-muted);
  text-decoration: none;
}
.topbar-logout:hover { color: var(--primary); }

.shell-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
  gap: 24px;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  align-self: stretch;
  min-height: calc(100vh - 88px - 48px);
  position: sticky;
  top: 88px;
}
.sidebar .sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .menu-item {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar .menu-item:hover { background: var(--surface-hover); color: var(--text-main); }
.sidebar .menu-item.active {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.30);
}
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 内容卡片内的创建表单一行 */
.create-row {
  display: flex;
  gap: 10px;
  margin: 8px 0 18px;
  flex-wrap: wrap;
}
.create-row input { flex: 1; min-width: 180px; }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin-bottom: 6px;
}
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(2, 6, 23, .28);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(100px, 140px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin: 0 0 16px;
  background: rgba(2, 6, 23, .32);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.inline-form.compact {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) auto;
}
.inline-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.inline-form .field input {
  width: 100%;
  min-width: 0;
}
.inline-form .field-sm {
  max-width: 160px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.notice {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, .30);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}
.notice.danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, .08);
  border-color: rgba(239, 68, 68, .28);
}
.notice strong {
  margin-right: 4px;
  color: var(--text-main);
}
.table-wrap {
  overflow-x: auto;
}
.empty-state {
  padding: 22px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  background: rgba(2, 6, 23, .24);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.hourly-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.subsection-title {
  margin: 0 0 12px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
}
.table-search {
  width: 100%;
  max-width: 320px;
  margin: 0 0 12px;
}
.api-key-usage-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2, 6, 23, .20);
}
.recharge-amount-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.recharge-amount-btn {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2, 6, 23, .24);
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
  box-shadow: none;
}
.recharge-amount-btn.active {
  border-color: var(--primary);
  background: rgba(129, 140, 248, .12);
  color: #e0e7ff;
}

/* 操作列 */
.col-ops { white-space: nowrap; width: 1%; }
.col-ops .op {
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text-main);
  box-shadow: none;
  margin-right: 6px;
  cursor: pointer;
}
.col-ops .op:last-child { margin-right: 0; }
.col-ops .op:hover { border-color: var(--border-strong); background: rgba(255,255,255,.10); }
.col-ops .op.danger { color: #fca5a5; border-color: rgba(239,68,68,.30); }
.col-ops .op.danger:hover { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.55); }

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-main);
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, .68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: maskIn .18s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  animation: cardIn .22s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text-main); }
.modal-close {
  font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--text-muted); padding: 0 4px;
}
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 4px 22px 18px; }
.modal-body input,
.modal-body textarea {
  width: 100%;
  margin-top: 10px;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.modal-form .field input {
  margin-top: 0;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 22px 18px;
}
.modal-foot button { min-width: 100px; }
.modal-foot button.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: 1px solid rgba(239,68,68,.50);
  box-shadow: 0 4px 14px rgba(239,68,68,.32);
}
.modal-tip {
  font-size: 12.5px;
  color: var(--text-muted);
  background: rgba(251,146,60,.10);
  border: 1px solid rgba(251,146,60,.30);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.key-show {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(2, 6, 23, .55);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.key-show code {
  flex: 1;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #93c5fd;
  word-break: break-all;
}
.btn-copy {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: 8px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-main);
  box-shadow: none;
  cursor: pointer;
}
.btn-copy:hover { background: rgba(255,255,255,.12); border-color: var(--border-strong); }

/* 响应式：窄屏堆叠 */
@media (max-width: 860px) {
  .shell-body { flex-direction: column; padding: 16px; gap: 16px; }
  .sidebar {
    width: 100%; position: static;
    flex-direction: row; overflow-x: auto;
  }
  .sidebar .menu-item { flex: 1; text-align: center; white-space: nowrap; }
  .topbar { padding: 12px 16px; }
  .btn-apply-partner { padding: 6px 12px; font-size: 12px; }
  .topbar-user { display: none; }
  .section-head,
  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .inline-form,
  .inline-form.compact {
    grid-template-columns: 1fr;
  }
  .inline-form .field-sm {
    max-width: none;
  }
  .form-actions {
    justify-content: flex-start;
  }
}

/* ===== Partner 申请摘要 ===== */
.apply-summary {
  margin: 12px 0 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .35);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
}
.apply-form { margin-top: 12px; }
.apply-form .row { margin-top: 10px; }

/* ---- 侧栏底部用户卡（参考 codexproxy）---- */
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer .user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-avatar {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}
.sidebar-footer .user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-footer .user-name {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sidebar-footer .role-badge {
  align-self: flex-start;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59,130,246,0.18);
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-footer .cur-user {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.sidebar-footer .logout-btn {
  padding: 9px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-size: 13px;
  transition: border-color .2s, color .2s;
}
.sidebar-footer .logout-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ---- 合作伙伴管理：汇总统计 + tab ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.stat-cell {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .35);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-cell .stat-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}
.stat-cell .stat-label {
  font-size: 12px;
  color: var(--text-muted);
}
.stat-cell.ok   .stat-val { color: #34d399; }
.stat-cell.warn .stat-val { color: #fbbf24; }
.stat-cell.danger .stat-val { color: #f87171; }

.tab-bar {
  display: flex;
  gap: 4px;
  margin: 12px 0 14px;
  border-bottom: 1px solid var(--border);
}
.tab-bar .tab {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-bar .tab:hover { color: var(--text-main); }
.tab-bar .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== 首登角色选择页（一左一右） ===== */
.role-choice-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}
.role-choice-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}
.role-choice-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.role-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 320px));
  gap: 24px;
  width: 100%;
  max-width: 720px;
}
.role-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.role-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
}
.role-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  margin-bottom: 4px;
}
.role-card-icon svg { width: 30px; height: 30px; }
.role-card.partner .role-card-icon {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}
.role-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}
.role-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 40px;
}
.role-card-cta {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}
.role-card.partner .role-card-cta { color: #fbbf24; }
.role-choice-logout {
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-muted);
}
.role-choice-logout a {
  margin-left: 8px;
  color: var(--primary);
  text-decoration: none;
}
.role-choice-logout a:hover { text-decoration: underline; }

/* ===== Playground / 功能测试 ===== */
.pg-viewport {
  margin-top: 14px;
  height: 420px;
  overflow-y: auto;
  background: rgba(2, 6, 23, .55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}
.pg-msg {
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.pg-msg.pg-system {
  color: var(--text-faint);
  font-style: italic;
  background: transparent;
  padding: 0;
}
.pg-msg.pg-user {
  background: rgba(59, 130, 246, .12);
  border-color: rgba(59, 130, 246, .35);
  color: var(--text-main);
}
.pg-msg.pg-assistant {
  background: rgba(16, 185, 129, .08);
  border-color: rgba(16, 185, 129, .28);
  color: var(--text-main);
}
.pg-msg.pg-error {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .35);
  color: #fca5a5;
}
.pg-image-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(2, 6, 23, .35);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.pg-image-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.pg-image-meta {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
}
.pg-image-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.pg-compose {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.pg-compose textarea {
  flex: 1;
  min-height: 56px;
  min-width: 0;
}

/* 用量信息页：汇总卡片 + 明细表 */
.usage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.usage-summary-box {
  padding: 10px 12px;
  background: rgba(2, 6, 23, .35);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.usage-table th,
.usage-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.usage-table th:first-child,
.usage-table td:first-child {
  text-align: left;
  white-space: nowrap;
}
.usage-table th {
  color: var(--text-faint);
  font-weight: 500;
  background: rgba(2, 6, 23, .35);
  position: sticky;
  top: 0;
}
.usage-table tbody tr:hover {
  background: rgba(59, 130, 246, .06);
}

.tab-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

