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

/* ===== Login Screen ===== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, rgba(99,102,241,0.08), transparent 60%);
}

.login-box {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 48px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  text-align: center;
  animation: loginIn 0.6s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
  background: #fff;
}

.login-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.2s;
}

.login-error.show {
  opacity: 1;
}

.login-submit {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.35);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.login-submit.loading .login-btn-text { opacity: 0.7; }
.login-submit.loading .login-btn-spinner { display: block; }

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

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --bg: #f0f2f8;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(99,102,241,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --radius: 16px;
  --radius-sm: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Background */
.bg-decorations {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #818cf8, transparent 70%);
  top: -100px;
  right: -80px;
  animation: float 12s ease-in-out infinite;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #c084fc, transparent 70%);
  bottom: -80px;
  left: -60px;
  animation: float 15s ease-in-out infinite reverse;
}

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

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 48px;
}

/* ===== App Layout (Sidebar + Main) ===== */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
  flex: 1;
}

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

.nav-item:hover {
  background: rgba(99,102,241,0.06);
  color: var(--primary-dark);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.08));
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--primary);
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.sidebar-link:hover {
  color: var(--primary);
}

.logout-btn:hover {
  color: #ef4444;
}

.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-x: auto;
  min-width: 0;
}

/* ===== Tab Panels ===== */
.tab-panel {
  display: none;
  animation: fadeInUp 0.25s ease;
}

.tab-panel.active {
  display: block;
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 6px 16px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  background: rgba(99,102,241,0.06);
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-dark);
  text-decoration: none;
  transition: all 0.2s;
}

.back-link:hover {
  background: rgba(99,102,241,0.12);
  border-color: var(--primary-light);
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.accounts {
  background: rgba(99,102,241,0.1);
  color: var(--primary);
}

.stat-icon.keys {
  background: rgba(16,185,129,0.1);
  color: var(--success);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* Panel */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

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

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.panel-title svg {
  color: var(--primary);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 8px 20px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

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

.data-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
  white-space: nowrap;
}

.data-table thead th:first-child { border-radius: 8px 0 0 0; }
.data-table thead th:last-child { border-radius: 0 8px 0 0; }

.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}

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

.data-table tbody tr:hover {
  background: rgba(99,102,241,0.03);
}

.data-table tbody td.text-right { text-align: right; }
.data-table tbody td.text-center { text-align: center; }

.phone-cell {
  font-weight: 600;
  color: var(--text);
}

.name-cell {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.key-cell {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--primary-dark);
}

.action-cell {
  white-space: nowrap;
  text-align: right;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 4px;
  vertical-align: middle;
}

.icon-btn.delete:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.2);
}

.icon-btn.keys:hover {
  color: var(--primary);
  background: rgba(99,102,241,0.1);
  border-color: var(--primary-light);
}

.empty-row {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed var(--border);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease;
}

.modal-wide {
  max-width: 460px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 8px;
  font-weight: 500;
}

.form-hint-small {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.key-label {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title-row .modal-title {
  margin-bottom: 0;
}

/* ===== 自动删除开关 ===== */
.auto-delete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  user-select: none;
  margin-left: 2px;
}

.auto-delete-label {
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
}

.switch-mini {
  display: inline-flex;
  align-items: center;
  width: 34px;
  height: 18px;
  border-radius: 10px;
  background: #d1d5db;
  transition: background 0.2s ease;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.switch-mini.on {
  background: #f59e0b;
}

.switch-mini-knob {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  margin-left: 2px;
  transition: margin-left 0.2s ease;
}

.switch-mini.on .switch-mini-knob {
  margin-left: 18px;
}

.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

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

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

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

/* Key count badge */
.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(99,102,241,0.1);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 28px 14px 36px; }
  .stats-row { flex-direction: column; }
  .panel { padding: 18px 14px; }
  .data-table { font-size: 12px; }
  .data-table thead th, .data-table tbody td { padding: 8px 10px; }
}

/* ===== Password Cell ===== */
.password-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

.pwd-dots {
  letter-spacing: 2px;
}

.pwd-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.pwd-toggle:hover {
  color: var(--primary);
  border-color: var(--primary-light);
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.status-active {
  background: rgba(16,185,129,0.1);
  color: #059669;
}

.status-badge.status-paused {
  background: rgba(245,158,11,0.1);
  color: #d97706;
}

.status-badge.status-expired {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}

.text-muted {
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Key Count Cell ===== */
.key-count-cell {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.key-count-full {
  color: var(--danger);
}

.key-max {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}

/* ===== Form Row Modal ===== */
.form-row-modal {
  display: flex;
  gap: 12px;
}

.form-row-modal .form-group {
  flex: 1;
}

/* ===== Live Controls ===== */
.live-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.live-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.key-search-input {
  width: 220px;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: monospace;
}

.key-search-input:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

.key-search-input::placeholder {
  font-family: inherit;
  font-size: 12px;
}

/* ===== Key Meta Row (账号状态+定时更新+统计) ===== */
.key-meta-row {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.key-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.key-meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.key-meta-value {
  font-weight: 700;
  color: var(--text);
}

.key-meta-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

/* 定时更新开关 (Key管理行内版) */
.auto-update-inline-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auto-update-inline-wrap .auto-update-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.auto-update-inline-wrap .auto-update-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.auto-update-inline-wrap .auto-update-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 20px;
  transition: 0.3s;
}

.auto-update-inline-wrap .auto-update-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.auto-update-inline-wrap .auto-update-switch input:checked + .auto-update-slider {
  background: var(--primary);
}

.auto-update-inline-wrap .auto-update-switch input:checked + .auto-update-slider::before {
  transform: translateX(16px);
}

.auto-update-inline-wrap .interval-input {
  width: 45px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  color: var(--text);
  background: #fff;
}

.auto-update-inline-wrap .interval-unit {
  font-size: 11px;
  color: var(--text-muted);
}

.live-select {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  cursor: pointer;
}

.live-select:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

/* ===== Live Result ===== */
.live-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.live-error {
  padding: 20px;
  text-align: center;
  color: var(--danger);
  font-size: 14px;
  background: rgba(239,68,68,0.06);
  border-radius: 10px;
  border: 1px solid rgba(239,68,68,0.15);
}

.live-summary {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.live-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.summary-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.summary-value.cost {
  color: var(--danger);
}

/* ===== Live Table extras ===== */
.live-table .key-cell {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--primary-dark);
}

.badge-bound {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(16,185,129,0.1);
  color: #059669;
}

.badge-unbound {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(148,163,184,0.1);
  color: #64748b;
}

.row-has-cost {
  background: rgba(239,68,68,0.02);
}

.amount-cost {
  color: var(--danger);
  font-weight: 700;
}

.quota-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(99,102,241,0.1);
  color: var(--primary-dark);
}

/* ===== Usage Bar ===== */
.usage-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.usage-bar-track {
  flex: 1;
  height: 6px;
  background: #eef2f7;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.usage-bar-fill.low { background: linear-gradient(90deg, #34d399, #10b981); }
.usage-bar-fill.mid { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.usage-bar-fill.high { background: linear-gradient(90deg, #f87171, #ef4444); }

.usage-bar-pct {
  font-size: 12px;
  font-weight: 700;
  font-family: "SF Mono", "Fira Code", monospace;
  white-space: nowrap;
}

.usage-bar-pct.low { color: #10b981; }
.usage-bar-pct.mid { color: #f59e0b; }
.usage-bar-pct.high { color: #ef4444; }

/* ===== Live Note ===== */
.live-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.live-note svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* ===== Mini Spinner ===== */
.mini-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

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

/* ===== Order Modal - Create Loading ===== */
.order-create-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.order-create-loading p {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.order-create-loading .loading-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 4px;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(99,102,241,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Order Result Box ===== */
.order-result-box {
  margin-top: 8px;
}

.order-success {
  background: rgba(16,185,129,0.04);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: 12px;
  padding: 20px;
}

.order-success-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.order-success-title {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 16px;
}

.order-success-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}

.detail-value.key-value {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--primary-dark);
  background: rgba(99,102,241,0.06);
  padding: 4px 8px;
  border-radius: 4px;
}

.order-success-copy {
  margin-top: 14px;
  text-align: center;
}

.btn-copy-key {
  padding: 8px 20px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  background: rgba(99,102,241,0.06);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-key:hover {
  background: rgba(99,102,241,0.12);
  border-color: var(--primary-light);
}

/* ===== Label Required ===== */
.label-required {
  color: var(--danger);
}

/* ===== Form Textarea ===== */
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.form-group textarea:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

/* ===== Key Name & Remark in Live Table ===== */
.key-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  margin-bottom: 2px;
}

.key-id {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--primary-dark);
  background: rgba(99,102,241,0.04);
  padding: 1px 6px;
  border-radius: 3px;
}

.remark-cell {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-valid {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.text-expired {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
  text-decoration: line-through;
}

.text-warning {
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
}

/* ===== Limit Adjuster (+/-) ===== */
.limit-adjuster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.limit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.limit-btn:hover:not(:disabled) {
  background: rgba(99,102,241,0.1);
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.limit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.limit-plus:hover:not(:disabled) {
  background: rgba(16,185,129,0.1);
  border-color: var(--success);
  color: var(--success);
}

.limit-minus:hover:not(:disabled) {
  background: rgba(239,68,68,0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.limit-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 50px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99,102,241,0.06);
}

/* Dark spinner for limit cell */
.mini-spinner.dark {
  border-color: rgba(99,102,241,0.2);
  border-top-color: var(--primary);
}

/* ===== Unbind Button ===== */
.btn-unbind {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 6px;
  background: rgba(245,158,11,0.06);
  color: #f59e0b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-unbind:hover:not(:disabled) {
  background: rgba(245,158,11,0.12);
  border-color: #f59e0b;
}

.btn-unbind:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-delete-unbound {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 6px;
  background: rgba(239,68,68,0.08);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-delete-unbound:hover:not(:disabled) {
  background: rgba(239,68,68,0.15);
  border-color: var(--danger);
}
.btn-delete-unbound:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Usage Cell (for targeted update) ===== */
.usage-cell {
  min-width: 110px;
}

/* ===== Action Group (adjust + unbind) ===== */
.action-group {
  display: inline-flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-adjust {
  padding: 4px 12px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px;
  background: rgba(99,102,241,0.06);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-adjust:hover {
  background: rgba(99,102,241,0.12);
  border-color: var(--primary-light);
}

/* ===== Limit Display Value (plain text, no +/- buttons) ===== */
.limit-display-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99,102,241,0.06);
  display: inline-block;
}

/* ===== Badge Mini (inline next to key) ===== */
.badge-mini {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(16,185,129,0.1);
  color: #059669;
  margin-left: 4px;
  vertical-align: middle;
}

.badge-mini.unbound {
  background: rgba(148,163,184,0.1);
  color: #64748b;
}

/* ===== Quick Capacity Buttons ===== */
.quick-cap-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-cap-btn {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-cap-btn:hover {
  border-color: var(--primary-light);
  background: rgba(99,102,241,0.06);
  color: var(--primary-dark);
}

.quick-cap-btn.active {
  border-color: var(--primary);
  background: rgba(99,102,241,0.1);
  color: var(--primary-dark);
}

/* ===== Inline Code ===== */
.inline-code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--primary-dark);
  background: rgba(99,102,241,0.06);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ===== Confirm Modal ===== */
.modal-confirm {
  max-width: 400px;
}

.confirm-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  padding: 16px;
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.12);
  border-radius: 10px;
  margin-bottom: 8px;
  white-space: pre-line;
}

.confirm-body strong {
  color: var(--danger);
}

/* ===== Danger Button ===== */
.btn-danger {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Name Cell ===== */
.name-cell {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

/* ===== Detail Row (second row per key) ===== */
.detail-row {
  background: #fafbfc;
}

.detail-row:hover {
  background: #f5f7fa;
}

.detail-cell {
  padding: 8px 14px !important;
  border-bottom: 1px solid var(--border) !important;
}

.detail-grid {
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-key {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.detail-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.detail-usage {
  flex: 1;
  min-width: 140px;
}

/* ===== Summary Sub (inline suffix in summary) ===== */
.summary-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ===== Key Cards Layout ===== */
.key-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.key-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.key-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-color: rgba(99,102,241,0.2);
}

.key-card.has-cost {
  border-left: 3px solid rgba(239,68,68,0.4);
}

.key-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.key-card-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.key-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.key-card-account {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.key-account-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  line-height: 1.5;
}

.key-account-name {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
  font-weight: 500;
}

.key-account-phone {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.key-account-remark {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

.key-account-project {
  background: rgba(14, 165, 233, 0.08);
  color: #0284c7;
}

.key-account-project.team-project {
  background: rgba(168, 85, 247, 0.1);
  color: #9333ea;
}

.key-card-id {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--primary-dark);
  background: rgba(99,102,241,0.06);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: help;
}

.key-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.key-card-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px 20px;
}

.key-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.key-stat-wide {
  grid-column: span 2;
}

.key-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.key-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.key-remark {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Last saved data row ===== */
.last-data-row {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.last-data-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.last-data-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.last-data-tag b {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
}

/* ===== 创建日期标签 ===== */
.key-created-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

/* ===== 倍率编辑 ===== */
.rate-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-edit-rate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-edit-rate:hover {
  color: #6366f1;
  background: rgba(99,102,241,0.12);
}

/* ===== 内联复制按钮 ===== */
.btn-copy-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-copy-inline:hover {
  color: #6366f1;
  background: rgba(99,102,241,0.12);
}
.btn-copy-inline.copied {
  color: #10b981;
  background: rgba(16,185,129,0.1);
}

/* ===== 历史用量统计按钮 ===== */
.btn-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-history-toggle:hover:not(:disabled) {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.3);
}
.btn-history-toggle:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* 历史用量行 — 独占一行 */
.history-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.history-monthly-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.history-total-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(239,68,68,0.08));
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.6;
}
.history-total-row b {
  font-size: 13px;
  color: #f59e0b;
  margin-right: 6px;
}

.history-monthly-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-month-tag {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(168,85,247,0.04));
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
  min-width: 90px;
}
.history-month-tag b {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 2px;
}

/* ===== Key Tags (validity badges) ===== */
.key-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-valid {
  background: rgba(16,185,129,0.1);
  color: #059669;
}

.tag-warning {
  background: rgba(245,158,11,0.1);
  color: #d97706;
}

.tag-expired {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}

/* ===== Responsive for key cards ===== */
@media (max-width: 768px) {
  .key-card-header {
    flex-direction: column;
    gap: 10px;
  }
  .key-card-actions {
    align-self: flex-end;
  }
  .key-card-body {
    grid-template-columns: repeat(2, 1fr);
  }
  .key-stat-wide {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .key-card-body {
    grid-template-columns: 1fr;
  }
  .key-stat-wide {
    grid-column: span 1;
  }
}

/* ===== Key Status Tags (启用/禁用) ===== */
.key-tag.tag-enabled {
  background: rgba(16,185,129,0.12);
  color: #059669;
}

.key-tag.tag-disabled {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}

.key-tag.tag-transferred {
  background: rgba(245,158,11,0.12);
  color: #d97706;
  cursor: help;
}

.key-tag.tag-unknown {
  background: rgba(148,163,184,0.12);
  color: #64748b;
}

/* ===== Copy Button ===== */
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.3);
  color: var(--primary);
}

.btn-copy:active {
  transform: scale(0.94);
}

.btn-copy.copied {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.3);
  color: var(--success);
}

/* ===== Auto Update Toggle Switch ===== */
.auto-update-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

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

.auto-update-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 20px;
  transition: 0.3s;
}

.auto-update-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.auto-update-switch input:checked + .auto-update-slider {
  background: var(--primary);
}

.auto-update-switch input:checked + .auto-update-slider::before {
  transform: translateX(16px);
}

.auto-update-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auto-update-interval {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auto-update-interval.hidden {
  display: none;
}

.auto-update-interval .interval-input {
  width: 52px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.2s;
}

.auto-update-interval .interval-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

.auto-update-interval .interval-unit {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== Validity Edit Button ===== */
.btn-edit-valid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 4px;
  padding: 0;
  line-height: 1;
}

.btn-edit-valid:hover {
  background: rgba(99,102,241,0.08);
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ===== Key Card Alert States ===== */
.key-card.key-alert {
  background: rgba(239,68,68,0.05);
  border-color: rgba(239,68,68,0.3);
  border-left: 3px solid var(--danger);
}

.key-card.key-alert .key-card-name {
  color: var(--danger);
}

/* ===== Key Card Disabled State ===== */
.key-card.key-disabled {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
  opacity: 0.6;
}

.key-card.key-disabled .key-card-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ===== Valid Days Row ===== */
.valid-days-row {
  display: flex;
  gap: 8px;
}

.valid-days-row select {
  flex: 1;
}

.valid-days-row input[type="date"] {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  font-family: inherit;
}

.valid-days-row input[type="date"]:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

/* ===== 创建Key按钮（查询月份行） ===== */
.btn-create-key-top {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
  white-space: nowrap;
}

.btn-create-key-top:hover {
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-create-key-top:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 套餐状态显示行 ===== */
.package-status-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  background: rgba(99,102,241,0.03);
  border: 1px solid rgba(99,102,241,0.08);
  border-radius: 10px;
  flex-wrap: wrap;
}

.package-status-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.package-status-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.package-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(99,102,241,0.08);
  color: var(--primary-dark);
  border: 1px solid rgba(99,102,241,0.12);
  white-space: nowrap;
}

.package-tag.pkg-mcp {
  background: rgba(168,85,247,0.08);
  color: #7c3aed;
  border-color: rgba(168,85,247,0.15);
}

.package-tag.pkg-time {
  background: rgba(245,158,11,0.08);
  color: #d97706;
  border-color: rgba(245,158,11,0.15);
}

.package-tag.pkg-week {
  background: rgba(14,165,233,0.08);
  color: #0284c7;
  border-color: rgba(14,165,233,0.15);
}

/* ===== 类型显示 ===== */
.type-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== Coding Plan Key 额度查询 ===== */
.cp-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}
.cp-hint svg { color: #6366f1; }

.cp-key-input {
  flex: 1;
  min-width: 280px;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'SF Mono', 'Consolas', monospace;
  background: #fff;
  transition: border-color .2s;
}
.cp-key-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.cp-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px;
  color: #6b7280;
  font-size: 14px;
}
.spinner-small {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(99,102,241,0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cp-error-box {
  padding: 20px 24px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 10px;
  color: #b91c1c;
  font-size: 14px;
  line-height: 1.6;
}

.cp-result-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cp-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.cp-key-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cp-key-code {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 14px;
  color: #374151;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 6px;
}

.cp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.cp-badge-personal {
  background: rgba(16,185,129,0.1);
  color: #059669;
  border: 1px solid rgba(16,185,129,0.2);
}
.cp-badge-team {
  background: rgba(99,102,241,0.1);
  color: #4f46e5;
  border: 1px solid rgba(99,102,241,0.2);
}
.cp-badge-unknown {
  background: rgba(107,114,128,0.1);
  color: #4b5563;
  border: 1px solid rgba(107,114,128,0.2);
}

.cp-level-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(245,158,11,0.1);
  color: #b45309;
  letter-spacing: 0.5px;
}

.btn-copy-cp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.btn-copy-cp:hover {
  border-color: #6366f1;
  color: #6366f1;
}

.cp-usage-grid {
  display: grid;
  gap: 20px;
}

.cp-usage-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cp-usage-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.cp-usage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cp-usage-bar {
  flex: 1;
  height: 10px;
  background: #f3f4f6;
  border-radius: 5px;
  overflow: hidden;
}

.cp-usage-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .5s ease;
}

.cp-usage-pct {
  font-size: 18px;
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

.cp-usage-detail {
  font-size: 12px;
  color: #9ca3af;
}

.cp-no-data {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

.cp-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  font-size: 12px;
  color: #9ca3af;
}

/* ===== 批量查询结果样式 ===== */
.cp-batch-header {
  margin-bottom: 20px;
}

.cp-batch-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

.cp-batch-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cp-batch-stat {
  font-size: 13px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 12px;
  border-radius: 6px;
}

.cp-stat-cp {
  color: #6366f1;
  background: #eef2ff;
}

.cp-stat-other {
  color: #6b7280;
  background: #f9fafb;
}

.cp-batch-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  padding-left: 8px;
  border-left: 3px solid #6366f1;
}

.cp-section-other {
  border-left-color: #d1d5db;
  margin-top: 24px;
}

.cp-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.cp-batch-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow 0.2s;
}

.cp-batch-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cp-batch-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cp-batch-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cp-usage-compact {
  margin-bottom: 0;
}

/* 团队版Key管理 - 项目标签 */
.cp-batch-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cp-project-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  white-space: nowrap;
}

.cp-project-tag.team {
  background: rgba(168, 85, 247, 0.12);
  color: #9333ea;
}

.cp-platform-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  white-space: nowrap;
}

.cp-key-name-inline {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.cp-usage-compact .cp-usage-label {
  min-width: 32px;
  font-size: 12px;
}

.cp-usage-compact .cp-usage-bar-wrap {
  flex: 1;
}

.cp-usage-compact .cp-usage-bar {
  height: 6px;
}

.cp-usage-compact .cp-usage-detail {
  font-size: 11px;
}

.cp-key-name {
  font-size: 13px;
  color: #6b7280;
  display: block;
  margin-bottom: 8px;
}

.btn-copy-cp-mini {
  margin-left: auto;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 3px 6px;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.btn-copy-cp-mini:hover {
  color: #6366f1;
  border-color: #6366f1;
}

.cp-non-cp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cp-non-cp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 6px;
}

.cp-badge-payg {
  background: #f3f4f6;
  color: #6b7280;
}

.cp-badge-invalid {
  background: #fef2f2;
  color: #ef4444;
}
