: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;
  --danger-hover: #dc2626;
  --success: #34d399;
  --credit: #c084fc;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.22);
  --radius: 16px;
  --radius-sm: 10px;
}

/* RateLimit 额度颜色 */
.pct-ok { color: #4ade80; }
.pct-warn { color: #fb923c; font-weight: 600; }
.pct-danger { color: #f87171; font-weight: 700; }

* { box-sizing: border-box; }
[v-cloak] { display: none; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  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;
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, rgba(17, 25, 44, 0.92), rgba(12, 17, 32, 0.92));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand::before {
  content: '';
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
  -webkit-text-fill-color: initial;
}

.menu {
    flex: 1;
    padding: 12px 12px 20px;
    overflow-y: auto;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

.language-switch {
  padding: 12px 20px 0;
}
.language-switch select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
}

.menu-item {
  padding: 11px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
  position: relative;
}

.menu-item:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}
.menu-item:active { transform: scale(0.98); }

.menu-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.10));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}
.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #60a5fa, #c084fc);
}
.menu-item.active .nav-icon { color: #93c5fd; }

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 28px;
  overflow-y: auto;
  min-width: 0;
}

.panel {
  animation: fadeIn 0.3s ease;
}

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

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-right: 130px; /* 避开右上角固定的语言切换 */
}

.header h2 {
  margin: 0;
  font-weight: 650;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #f1f5f9, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* 登录方式切换 */
.login-mode-tabs { display: flex; gap: 18px; margin-bottom: 14px; font-size: 13px; }
.login-mode { cursor: pointer; color: var(--text-muted); padding-bottom: 4px; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.login-mode:hover { color: var(--text-main); }
.login-mode.active { color: var(--primary); border-bottom-color: var(--primary); }

/* 注册分步提示 */
.step-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; text-align: center; }

.auth-bar input {
  padding: 10px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  outline: none;
  width: 250px;
}
.auth-bar input:focus { border-color: var(--primary); }
.key-input { width: 350px !important; }

/* Cards & Layout */
.card {
  position: relative;
  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);
  padding: 24px 26px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
}
.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,0.18), transparent);
  pointer-events: none;
}

.center-card {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  margin-top: 60px;
}

.desc { color: var(--text-muted); margin-bottom: 24px; font-size: 0.95rem; line-height: 1.5; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { margin: 0; font-weight: 600; font-size: 1.05rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s ease; }
tr:hover td { background: var(--surface-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.small { font-size: 0.85em; color: var(--text-muted); }
.empty { text-align: center; color: var(--text-faint); padding: 44px !important; }

/* 紧凑型表格（账号列表专用） */
table.compact th, table.compact td { padding: 8px 10px; vertical-align: middle; }
table.compact th { font-size: 0.8rem; line-height: 1.25; }
table.compact .th-sub { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: normal; }

/* 套餐收益设置表格 */
table.plan-revenue-table th, table.plan-revenue-table td { padding: 18px 16px; vertical-align: middle; }
table.plan-revenue-table .plan-name { font-weight: 600; color: var(--text-main); font-size: 0.95rem; }
.amount-input { display: inline-flex; align-items: center; gap: 10px; }
.amount-input input {
  width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2);
  color: var(--text-main);
  font-size: 0.95rem;
  text-align: right;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.amount-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.amount-input .unit { color: var(--text-muted); font-size: 0.92rem; white-space: nowrap; }

/* 开关（toggle switch） */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch .slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
table.accounts-table { table-layout: auto; font-size: 0.88rem; }
table.accounts-table .name-cell .name { font-weight: 500; color: var(--text-main); }
table.accounts-table .muted { color: var(--text-muted); font-size: 0.78rem; }
table.accounts-table .actions-cell button { padding: 4px 10px; font-size: 0.78rem; margin-right: 4px; }
table.accounts-table tr.row-overquota td { background: rgba(245, 158, 11, 0.06); }

/* Forms & Buttons */
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-actions input, .inline-actions select, .inline-input {
  padding: 9px 12px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.inline-actions input:focus, .inline-actions select:focus, .inline-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.inline-input { max-width: 140px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)); }
.stat-label { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { color: var(--success); font-size: 1.5rem; font-weight: 700; }
.ok-text { color: #34d399; }
.warn-text { color: #fbbf24; }
.danger-text { color: #f87171; }
.internal-state-card { border-color: rgba(96, 165, 250, 0.20); }
.internal-state-actions { justify-content: flex-end; }
.internal-token-input { width: 230px; max-width: 100%; }
.node-state-grid { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.node-state-grid .stat-value { color: var(--text-main); }
.node-state-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; line-height: 1.6; }
.node-state-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.node-state-unavailable { margin-top: 18px; }
.node-state-subtitle { color: var(--text-main); font-weight: 600; margin-bottom: 8px; }
.compact-empty { padding: 18px !important; border: 1px dashed var(--border); border-radius: 8px; }
.supplier-table td { vertical-align: top; }
.payment-cell { min-width: 220px; }
.payment-card-mini {
  display: inline-flex;
  flex-direction: column;
  gap: 7px;
  min-width: 210px;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.10), rgba(139, 92, 246, 0.06));
}
.payment-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.payment-method-pill {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.28);
  color: #bfdbfe;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.payment-holder { color: var(--text-main); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-account { color: var(--text-muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supplier-actions { white-space: nowrap; }
.supplier-actions button { margin: 0 4px 6px 0; }
button.ghost-btn { color: #93c5fd; border-color: rgba(96, 165, 250, 0.28); background: rgba(59, 130, 246, 0.08); }
button.ghost-btn:hover { color: #fff; border-color: rgba(96, 165, 250, 0.55); background: rgba(59, 130, 246, 0.20); }

/* 供货商登记信息展示 */
.reg-info p { margin: 0 0 10px; color: var(--text-main); font-size: 0.92rem; }
.reg-info p { display: flex; gap: 6px; }
.reg-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 18px; line-height: 1.5; }
.form-actions { display: flex; gap: 10px; align-items: center; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 0.9rem; }
.form-group input {
  width: 100%; padding: 12px 14px; background: rgba(2, 6, 23, 0.45);
  border: 1px solid var(--border); border-radius: 9px; color: var(--text-main);
  transition: border 0.18s, box-shadow 0.18s;
}
.form-group input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.form-group select {
  width: 100%; padding: 12px 14px; background: rgba(2, 6, 23, 0.45);
  border: 1px solid var(--border); border-radius: 9px; color: var(--text-main);
  transition: border 0.18s, box-shadow 0.18s;
}
.form-group select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }

button {
  background: var(--surface-hover); color: var(--text-main); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; transition: all 0.18s ease;
  font-size: 0.88rem; font-weight: 500;
}
button:hover { background: rgba(255,255,255,0.12); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(135deg, var(--primary), #6366f1); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,0.30); }
button.primary:hover { box-shadow: 0 6px 20px rgba(59,130,246,0.45); }
button.danger { background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.3); color: var(--danger); box-shadow: none; }
button.danger:hover { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.block-btn { width: 100%; padding: 12px; font-size: 1rem; }

/* Result Box */
.result-box { margin-top: 30px; padding: 20px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 8px; }
.success-msg { color: #10b981; margin-bottom: 12px; font-weight: 500; }
.key-display { font-size: 1.2rem; padding: 16px; background: rgba(0,0,0,0.3); border-radius: 6px; margin-bottom: 16px; word-break: break-all; }
.actions { display: flex; gap: 10px; justify-content: center; }

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-chat {
  margin: auto;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.message { display: flex; gap: 16px; max-width: 80%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar { font-size: 1.5rem; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); border-radius: 50%; }
.content { padding: 16px 20px; border-radius: 12px; font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;}
.message.user .content { background: var(--primary); color: #fff; border-top-right-radius: 2px; }
.message.assistant .content { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-top-left-radius: 2px; }

.chat-input {
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: center;
}

.chat-input textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  resize: none;
  height: 50px;
  outline: none;
  padding: 12px 0;
}
.chat-input button { height: 50px; padding: 0 24px; font-size: 1rem; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(2,6,23,0.65); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: linear-gradient(180deg, #1e293b, #18233a); border: 1px solid var(--border-strong); border-radius: 16px; width: 500px; max-width: 90%; box-shadow: 0 24px 60px rgba(0,0,0,0.5); animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.supplier-detail-modal { width: 760px; max-width: min(94vw, 760px); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 0.85rem; }
.modal-header .close { background: transparent; border: none; font-size: 1.5rem; padding: 0; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.supplier-detail-body { padding: 20px; }
.supplier-detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr); gap: 16px; }
.detail-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.22);
  padding: 16px;
}
.detail-section-title { color: #e2e8f0; font-weight: 700; margin-bottom: 14px; }
.detail-list { display: flex; flex-direction: column; gap: 10px; }
.detail-item { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.10); }
.detail-item:last-child { border-bottom: none; padding-bottom: 0; }
.detail-item span { color: var(--text-muted); font-size: 0.82rem; }
.detail-item strong { color: var(--text-main); font-size: 0.9rem; text-align: right; word-break: break-word; }
.payment-detail-card { border-radius: 14px; padding: 16px; background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(139, 92, 246, 0.10)); border: 1px solid rgba(96, 165, 250, 0.22); }
.payment-method-large { display: inline-flex; padding: 5px 10px; border-radius: 999px; margin-bottom: 14px; background: rgba(96, 165, 250, 0.18); color: #dbeafe; font-weight: 800; font-size: 0.8rem; }
.payment-detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,0.08); }
.payment-detail-row span { color: var(--text-muted); font-size: 0.82rem; }
.payment-detail-row strong { color: var(--text-main); text-align: right; word-break: break-all; }
.payment-hint { color: var(--text-muted); font-size: 0.82rem; line-height: 1.6; margin: 12px 2px 0; }
.selectable { user-select: text; }
@media (max-width: 780px) { .supplier-detail-grid { grid-template-columns: 1fr; } }
.wizard-steps { display: flex; gap: 10px; margin-bottom: 24px; }
.step { flex: 1; text-align: center; padding: 8px 0; font-size: 0.85rem; color: var(--text-muted); border-bottom: 2px solid rgba(255,255,255,0.1); }
.step.active { color: var(--primary); border-color: var(--primary); }
.step.completed { color: #10b981; border-color: #10b981; }
.alert { padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; line-height: 1.5; }
.alert.warn { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.alert.warn a { color: #fde68a; text-decoration: underline; font-weight: 600; }
.alert.warn a:hover { color: #fffbeb; }
.center { text-align: center; }
.auth-link a { display: block; padding: 12px; background: rgba(0,0,0,0.3); border-radius: 8px; color: var(--primary); text-decoration: none; word-break: break-all; margin: 16px 0; }
.auth-code { font-size: 2rem; font-weight: bold; letter-spacing: 4px; margin: 20px 0; color: #fff; }
.expire-text { color: var(--text-muted); margin-bottom: 20px; }

/* Spinners */
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-radius: 50%; border-top-color: var(--primary); animation: spin 1s ease-in-out infinite; margin: 20px auto; }
.spinner.small { width: 24px; height: 24px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid transparent; }
.badge.active, .badge.ready, .badge.available, .badge.healthy { background: rgba(16, 185, 129, 0.14); color: #34d399; border-color: rgba(16,185,129,0.25); }
.badge.rate_limited, .badge.pending, .badge.degraded, .badge.cycle_quota_exceeded, .badge.weekly_quota_exceeded, .badge.concurrency_full, .badge.transient_skipped { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.badge.error, .badge.disabled, .badge.unhealthy, .badge.circuit_open { background: rgba(239, 68, 68, 0.14); color: #f87171; border-color: rgba(239,68,68,0.25); }
.badge.need_reauth { background: rgba(239, 68, 68, 0.22); color: #fca5a5; border-color: rgba(239,68,68,0.5); cursor: help; animation: reauthPulse 1.8s ease-in-out infinite; }
@keyframes reauthPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); } }
.reauth-detail-link { display: inline-block; margin-left: 6px; font-size: 0.72rem; color: #f87171; cursor: pointer; text-decoration: underline; white-space: nowrap; }
.reauth-detail-link:hover { color: #fca5a5; }
.reauth-meta { font-size: 0.9rem; line-height: 1.9; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-strong); }
.reauth-meta .reauth-k { display: inline-block; min-width: 64px; color: var(--text-muted, #94a3b8); margin-right: 6px; }
.reauth-advice .reauth-warn { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 10px 12px; line-height: 1.6; color: #fca5a5; margin: 0 0 12px; }
.reauth-advice .reauth-steps-title { font-weight: 700; margin: 0 0 6px; }
.reauth-advice .reauth-step { margin: 0 0 5px; line-height: 1.6; color: var(--text, #e2e8f0); }
.err-msg { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }

/* Toast */
.toast { position: fixed; bottom: -60px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: rgba(30, 41, 59, 0.96); color: #fff; padding: 13px 18px 13px 26px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); border: 1px solid var(--border-strong); backdrop-filter: blur(10px); transition: bottom 0.35s cubic-bezier(0.16,1,0.3,1); z-index: 1000; font-size: 0.92rem; max-width: 70vw; }
.toast.show { bottom: 24px; }
.toast.error { background: rgba(220, 38, 38, 0.96); border-color: rgba(248,113,113,0.4); }
.toast .toast-msg { white-space: pre-line; line-height: 1.4; }
.toast .toast-close { cursor: pointer; font-size: 1.2rem; line-height: 1; opacity: 0.7; flex-shrink: 0; padding: 0 2px; }
.toast .toast-close:hover { opacity: 1; }

/* 计费规则卡片 */
.rate-card {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(192, 132, 252, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: 10px;
}
.rate-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}
.rate-card-head .info-icon { flex-shrink: 0; }
.rate-card-title { color: var(--text-main); font-weight: 600; }
.rate-card-head .rate-link {
  margin-left: auto;
  color: var(--credit);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px dashed rgba(192, 132, 252, 0.5);
}
.rate-card-head .rate-link:hover { color: #d8b4fe; border-bottom-color: #d8b4fe; }
.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.rate-table th, .rate-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(192, 132, 252, 0.15);
}
.rate-table thead th {
  color: var(--text-muted);
  font-weight: 600;
}
.rate-table th .per {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.8;
}
.rate-table tbody td { color: var(--text-main); }
.rate-table tbody tr:last-child td { border-bottom: none; }
.rate-table b { color: var(--credit); font-weight: 700; }
.rate-note {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Credit 用量列 */
.credit-cell .credit-h5 { color: var(--credit); font-weight: 600; }
.credit-cell .muted { color: var(--text-muted); font-size: 0.78rem; }

/* 消耗金额列 */
.cost-cell .cost-h5 { color: #34d399; font-weight: 600; }
.cost-cell .muted { color: var(--text-muted); font-size: 0.78rem; }
.cost-cell .cost-toggle {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #93c5fd;
  cursor: pointer;
  user-select: none;
}
.cost-cell .cost-toggle:hover { color: #bfdbfe; text-decoration: underline; }
.cost-cell .cost-detail {
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.cost-cell .cost-detail .cd-win { white-space: nowrap; }
.cost-cell .cost-detail .cd-label {
  display: inline-block;
  min-width: 26px;
  color: #93c5fd;
  font-weight: 600;
}

/* 视觉打磨：粘性表头 + 滚动条 + 卡片细节 */
table.accounts-table thead th {
  position: sticky;
  top: 0;
  background: rgba(13, 19, 36, 0.97);
  z-index: 2;
  backdrop-filter: blur(8px);
}
.card { transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.card:hover { border-color: var(--border-strong); }
.main-content::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 8px; height: 8px; }
.main-content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; }
.main-content::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
.main-content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track { background: transparent; }

/* 历史查询：使用百分比范围输入 */
.history-filters .pct-input { width: 72px; }
.history-filters .pct-sep { color: #888; padding: 0 2px; }

/* ---- 登录/注册页 ---- */
.auth-page {
  flex: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-page::before,
.auth-page::after {
  content: '';
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
.auth-page::before {
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: -160px;
  right: -120px;
  animation: authFloat 14s ease-in-out infinite;
}
.auth-page::after {
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
  bottom: -180px;
  left: -120px;
  animation: authFloat 18s ease-in-out infinite reverse;
}
@keyframes authFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, 40px); }
}
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 36px 32px 30px;
}
.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}
.auth-logo svg { width: 28px; height: 28px; color: #fff; }
.auth-brand {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 22px;
}
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}
.auth-tab:hover { color: var(--text-main); }
.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.auth-body .form-group { margin-bottom: 14px; }
/* 带图标输入框 */
.auth-field { position: relative; }
.auth-field .field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-main);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input::placeholder { color: #64748b; }
.auth-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.auth-field:focus-within .field-icon { color: var(--primary); }
/* 密码明文切换按钮 */
.auth-field .pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.2s;
}
.auth-field .pwd-toggle:hover { color: var(--primary); }
.auth-field .pwd-toggle svg { width: 18px; height: 18px; }
.auth-field:has(.pwd-toggle) input { padding-right: 42px; }
.auth-body .code-row { display: flex; gap: 10px; }
.auth-body .code-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-main);
  font-size: 14px;
}
.auth-body .code-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.auth-body .code-row button {
  white-space: nowrap;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}
.auth-body .code-row button:hover:not(:disabled) { background: rgba(59, 130, 246, 0.15); }
.auth-body .code-row button:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-submit {
  width: 100%;
  display: block;
  margin-top: 6px;
  padding: 13px 0;
  border: none;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.auth-submit:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(59, 130, 246, 0.5); }
.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-switch {
  margin-top: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.auth-switch:hover { color: var(--primary); }

/* ---- 全局语言切换（右上角） ---- */
.lang-fixed {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lang-fixed svg { width: 16px; height: 16px; color: var(--text-muted); }
.lang-fixed select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.lang-fixed select option { background: #1e293b; color: var(--text-main); }

@media (prefers-reduced-motion: reduce) {
  .auth-page::before, .auth-page::after { animation: none; }
  .auth-submit, .auth-tab, .auth-field input { transition: none; }
}

/* ---- 侧栏底部：用户与退出 ---- */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 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;
}
.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 .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 .logout-btn {
  padding: 9px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.sidebar-footer .logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* Hourly usage chart */
.usage-dashboard-card {
  overflow: hidden;
  border-color: rgba(96, 165, 250, 0.20);
  background:
    radial-gradient(circle at 12% 0%, rgba(59, 130, 246, 0.16), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(192, 132, 252, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(15, 23, 42, 0.52));
}
.usage-dashboard-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.usage-dashboard-head h3 { margin: 3px 0 6px; font-size: 1.18rem; letter-spacing: -0.02em; }
.usage-dashboard-head p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.eyebrow { color: #93c5fd; text-transform: uppercase; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; }
.usage-dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.usage-dashboard-actions select,
.usage-dashboard-actions button { min-height: 38px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.22); background: rgba(2, 6, 23, 0.52); color: var(--text-main); }
.usage-dashboard-actions button { cursor: pointer; background: linear-gradient(135deg, rgba(59,130,246,0.82), rgba(139,92,246,0.75)); border-color: rgba(147, 197, 253, 0.28); }
.usage-dashboard-actions button:disabled { opacity: 0.65; cursor: wait; }
.usage-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(132px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.usage-kpi { padding: 14px 15px; border-radius: 15px; border: 1px solid rgba(148, 163, 184, 0.14); background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); }
.usage-kpi span { display: block; color: var(--text-muted); font-size: 0.78rem; margin-bottom: 7px; }
.usage-kpi strong { display: block; color: var(--text-main); font-size: 1.34rem; line-height: 1.1; }
.usage-kpi em { display: block; margin-top: 6px; color: var(--text-faint); font-size: 0.74rem; font-style: normal; }
.usage-kpi.blue strong { color: #60a5fa; }
.usage-kpi.cyan strong { color: #34d399; }
.usage-kpi.violet strong { color: #fb923c; }
.usage-kpi.credit strong { color: #e879f9; }
.usage-chart-wrap { position: relative; min-height: 360px; border-radius: 18px; border: 1px solid rgba(148, 163, 184, 0.13); background: linear-gradient(180deg, rgba(2, 6, 23, 0.42), rgba(2, 6, 23, 0.18)); overflow: hidden; }
.usage-chart { width: 100%; height: 360px; display: block; }
.usage-grid-line { stroke: rgba(148, 163, 184, 0.16); stroke-width: 1; stroke-dasharray: 4 7; }
.usage-axis-text { fill: rgba(203, 213, 225, 0.70); font-size: 11px; }
.credit-axis { fill: rgba(216, 180, 254, 0.78); }
.usage-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.usage-line.uncached { stroke: #2563eb; stroke-width: 3.2; }
.usage-line.cached { stroke: #10b981; stroke-width: 2.8; stroke-dasharray: 7 5; }
.usage-line.output { stroke: #f97316; stroke-width: 3; }
.usage-line.credit-line { stroke: #d946ef; stroke-width: 3.4; stroke-dasharray: 3 5; }
.usage-line.request-line { stroke: #f59e0b; stroke-width: 3.2; }
.usage-hover-line { stroke: rgba(226, 232, 240, 0.46); stroke-width: 1; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.usage-dot { stroke: #0f172a; stroke-width: 2.5; }
.usage-dot.uncached { fill: #2563eb; }
.usage-dot.cached { fill: #10b981; }
.usage-dot.output { fill: #f97316; }
.usage-dot.credit-dot { fill: #d946ef; }
.usage-dot.request-dot { fill: #f59e0b; }
.usage-empty-title { fill: rgba(226,232,240,0.85); font-size: 18px; font-weight: 700; }
.usage-empty-sub { fill: rgba(148,163,184,0.78); font-size: 13px; }
.usage-tooltip { position: absolute; min-width: 210px; padding: 12px 14px; border: 1px solid rgba(226,232,240,0.18); border-radius: 14px; background: rgba(15, 23, 42, 0.92); box-shadow: 0 18px 42px rgba(0,0,0,0.36); backdrop-filter: blur(12px); color: var(--text-main); font-size: 12px; pointer-events: none; }
.tooltip-title { font-weight: 700; margin-bottom: 8px; color: #e0f2fe; }
.usage-tooltip .muted { margin-top: 7px; color: var(--text-muted); }
.usage-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; color: var(--text-muted); font-size: 0.82rem; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; box-shadow: 0 0 10px currentColor; }
.legend-dot.uncached { background: #2563eb; color: #2563eb; }
.legend-dot.cached { background: #10b981; color: #10b981; }
.legend-dot.output { background: #f97316; color: #f97316; }
.legend-dot.credit { background: #d946ef; color: #d946ef; }
.legend-dot.request { background: #f59e0b; color: #f59e0b; }
.usage-legend.clickable button { display: inline-flex; align-items: center; gap: 0; border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 999px; background: rgba(15, 23, 42, 0.42); color: var(--text-muted); padding: 7px 11px; cursor: pointer; transition: color .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease; }
.usage-legend.clickable button:hover { color: var(--text-main); border-color: rgba(226, 232, 240, 0.32); background: rgba(30, 41, 59, 0.58); }
.usage-legend.clickable button.disabled { opacity: 0.42; text-decoration: line-through; background: rgba(15, 23, 42, 0.22); }
.request-chart-section { margin-top: 22px; }
.request-chart-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.request-chart-head h4 { margin: 0 0 5px; font-size: 1rem; }
.request-chart-head p { margin: 0; color: var(--text-muted); font-size: 0.82rem; }
.request-chart-head strong { color: #fbbf24; font-size: 1.05rem; white-space: nowrap; }
.request-chart-wrap { min-height: 280px; }
.request-chart { height: 280px; }
@media (max-width: 1200px) { .usage-dashboard-head { flex-direction: column; } .usage-dashboard-actions { justify-content: flex-start; } .usage-kpi-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); } }
@media (max-width: 720px) { .usage-kpi-grid { grid-template-columns: 1fr; } .usage-dashboard-actions select, .usage-dashboard-actions button { width: 100%; } }
