:root {
  --bg: #05070d;
  --bg-elevated: #10141f;
  --bg-card: #141a2a;
  --border: #232b40;
  --text: #eef1fa;
  --text-muted: #8b93a8;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-3: #a855f7;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

body { min-height: 100vh; position: relative; }

.hidden { display: none !important; }

a { color: var(--accent-2); text-decoration: none; }

/* ---------- Animated aurora background ---------- */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform;
}
.blob-1 {
  width: 620px; height: 620px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  animation: drift1 22s ease-in-out infinite;
}
.blob-2 {
  width: 560px; height: 560px;
  top: 20%; right: -180px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  animation: drift2 26s ease-in-out infinite;
}
.blob-3 {
  width: 500px; height: 500px;
  bottom: -160px; left: 30%;
  background: radial-gradient(circle, var(--accent-3), transparent 70%);
  animation: drift3 30s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 80px) scale(1.15); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-70px, 50px) scale(1.1); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -60px) scale(1.2); }
}

#login-screen, #app-shell, .toast, .modal-overlay { position: relative; z-index: 1; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(99, 102, 241, 0.55); filter: brightness(1.08); }
.btn-glow { position: relative; }
.btn-glow::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  z-index: -1;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.2s ease;
}
.btn-glow:hover::after { opacity: 0.7; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-small {
  padding: 6px 10px;
  font-size: 12px;
}

input, select, textarea {
  font-family: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent-2);
  text-shadow: 0 0 10px var(--accent-2), 0 0 20px rgba(34, 211, 238, 0.5);
  animation: logoSpin 6s linear infinite;
}
@keyframes logoSpin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}
.brand-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.accent-cyan {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-lg .logo-mark { font-size: 22px; }
.brand-lg .brand-text { font-size: 24px; }

/* ---------- Login Screen ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(20, 26, 42, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 34px;
  box-shadow: var(--shadow), 0 0 60px rgba(99, 102, 241, 0.1);
}
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { font-size: 20px; margin: 0; }
.login-card p.subtitle { color: var(--text-muted); font-size: 13px; margin: 4px 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input { width: 100%; }
#login-error {
  color: #fca5a5;
  font-size: 13px;
  margin: -8px 0 16px;
  min-height: 16px;
}

/* ---------- App Shell ---------- */
#app-shell { display: flex; min-height: 100vh; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(168,85,247,0.14));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.3);
}
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.nav-item.active .dot {
  background: var(--accent-2);
  opacity: 1;
  box-shadow: 0 0 8px var(--accent-2);
}

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-footer button { width: 100%; }

.main {
  flex: 1;
  padding: 26px 34px 100px;
  max-width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.topbar h2 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

/* Single-page layout: all sections stacked and always present.
   Sidebar links smooth-scroll to the matching section (see app.js). */
.page-section {
  scroll-margin-top: 24px;
  margin-bottom: 56px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.page-section.in-view { opacity: 1; transform: translateY(0); }
.page-section:last-child { margin-bottom: 0; }
.page-section + .page-section { padding-top: 8px; border-top: 1px solid var(--border); }

/* ---------- Stat Cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: linear-gradient(160deg, var(--bg-card), rgba(20,26,42,0.6));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), transparent 60%);
  pointer-events: none;
}
.stat-card::after {
  content: '';
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  top: -40px; right: -40px;
  filter: blur(30px);
  opacity: 0.5;
  pointer-events: none;
}
.stat-card.glow-1::after { background: var(--accent); }
.stat-card.glow-2::after { background: var(--accent-2); }
.stat-card.glow-3::after { background: var(--accent-3); }
.stat-card.glow-4::after { background: var(--success); }
.stat-card .label {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}
.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
  position: relative;
  letter-spacing: -0.01em;
}
.stat-card .value .unit { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.stat-card .sub { margin-top: 6px; font-size: 12px; color: var(--text-muted); position: relative; }
.stat-card .sub.mock { color: var(--warning); }
.stat-card .sub.live { color: var(--success); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.green { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge.yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge.red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

/* ---------- Panels ---------- */
.panel {
  background: rgba(20, 26, 42, 0.65);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  transition: border-color 0.2s ease;
}
.panel:hover { border-color: rgba(99,102,241,0.25); }
.panel h3 { margin: 0 0 16px; font-size: 15px; }
.panel .panel-desc { color: var(--text-muted); font-size: 12.5px; margin: -12px 0 16px; }

/* ---------- Key banner ---------- */
.key-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 13.5px;
}
.key-banner.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

/* ---------- Search bar ---------- */
.search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.search-row select, .search-row input { flex-shrink: 0; }
.search-row input[type="text"] { flex: 1; min-width: 200px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
thead th {
  text-align: left;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(99,102,241,0.06); }
.level-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.level-info { background: rgba(34,211,238,0.15); color: #67e8f9; }
.level-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.level-error { background: rgba(239,68,68,0.15); color: #f87171; }
.level-critical { background: rgba(239,68,68,0.28); color: #fca5a5; }

.msg-cell { max-width: 420px; }

/* ── Structured field chips (IntelX-style log display) ── */
.detail-cell { max-width: 560px; vertical-align: middle; padding: 8px 10px !important; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-start; }
.chip-raw { font-size: 12px; color: var(--text-muted); font-family: 'Consolas', monospace; word-break: break-all; }

.log-chip {
  display: inline-flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  font-family: 'Consolas', 'SFMono-Regular', Menlo, monospace;
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 11.5px;
  max-width: 100%;
}
.chip-lbl {
  padding: 2px 5px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip-val {
  padding: 2px 7px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.82);
  word-break: break-all;
  display: flex;
  align-items: center;
}
.log-chip-blue   .chip-lbl { background: rgba(99,102,241,0.28);  color: #818cf8; }
.log-chip-red    .chip-lbl { background: rgba(239,68,68,0.22);   color: #f87171; }
.log-chip-purple .chip-lbl { background: rgba(168,85,247,0.22);  color: #c084fc; }
.log-chip-teal   .chip-lbl { background: rgba(20,184,166,0.22);  color: #2dd4bf; }
.log-chip-green  .chip-lbl { background: rgba(34,197,94,0.22);   color: #4ade80; }
.log-chip-gray   .chip-lbl { background: rgba(148,163,184,0.18); color: #94a3b8; }
.log-chip-pink   .chip-lbl { background: rgba(236,72,153,0.22);  color: #f472b6; }
.log-chip-muted  .chip-lbl { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.38); }

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 9px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(99,102,241,0.10);
  border: 1px solid rgba(99,102,241,0.22);
  color: #818cf8;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.dl-btn:hover { background: rgba(99,102,241,0.22); color: #a5b4fc; }

.td-muted  { color: var(--text-muted) !important; }
.td-victim { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 11.5px; }

/* Category source tags with color coding */
.cat-stealer  { color: #fb923c !important; }
.cat-mail     { color: #2dd4bf !important; }
.cat-instagram{ color: #f472b6 !important; }
.cat-discord  { color: #818cf8 !important; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination .info { color: var(--text-muted); font-size: 12.5px; }
.pagination .controls { display: flex; gap: 6px; align-items: center; }
.pagination button { padding: 7px 12px; font-size: 13px; }
.pagination span.page-num { font-size: 13px; padding: 0 6px; color: var(--text-muted); }

.source-tag { color: var(--accent-2); font-size: 12.5px; }
.mono { font-family: 'Consolas', 'SFMono-Regular', Menlo, monospace; }

/* ---------- Keys table ---------- */
.keys-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.keys-actions input { flex: 1; min-width: 180px; }

/* ---------- Sandbox ---------- */
.sandbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .sandbox-grid { grid-template-columns: 1fr; } }
.sandbox-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.sandbox-row select, .sandbox-row input { flex: 1; min-width: 140px; }
pre.response-box {
  background: #05070d;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 12.5px;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.status-line { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 13px; flex-wrap: wrap; }
.status-line .code-200 { color: #4ade80; }
.status-line .code-400, .status-line .code-401, .status-line .code-403, .status-line .code-500, .status-line .code-503 { color: #f87171; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5,7,12,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow), 0 0 60px rgba(99,102,241,0.15);
}
.modal-box h3 { margin-top: 0; }
.key-display {
  background: #05070d;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 14px;
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  margin: 14px 0;
  color: var(--accent-2);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.warn-text { color: var(--warning); font-size: 12.5px; }

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  background: rgba(16,20,31,0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  min-width: 240px;
  animation: slideIn 0.2s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13.5px; }

@media (max-width: 760px) {
  #app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 14px; }
  .sidebar .brand { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 20px; }
}
/* ===================== AUTH & API KEY MANAGEMENT STYLES ===================== */

/* Login Screen */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0a0a0a, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.brand-lg {
  margin-bottom: 1.5rem;
}

.brand-lg .logo-mark {
  font-size: 2rem;
}

.brand-lg .brand-text {
  font-size: 1.5rem;
  font-weight: 700;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.subtitle {
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.field {
  margin-bottom: 1rem;
  text-align: left;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #ccc;
}

.field input {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 1rem;
}

.field input:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

#login-error {
  color: #ff4757;
  margin: 1rem 0;
  font-size: 0.9rem;
  min-height: 1rem;
}

/* API Key Management */
.new-key-panel {
  background: linear-gradient(135deg, #1e3a8a, #3730a3);
  border: 2px solid #60a5fa;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
  animation: slideIn 0.3s ease;
}

.new-key-panel h4 {
  color: #fbbf24;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.warning-text {
  color: #fcd34d;
  margin-bottom: 1rem;
  font-weight: 500;
}

.key-display {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.key-display code {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: #00ff88;
  word-break: break-all;
  padding: 0.5rem;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 4px;
}

.keys-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.keys-actions input,
.keys-actions select {
  flex: 1;
  min-width: 200px;
}

.keys-actions select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.75rem;
  border-radius: 6px;
}

.keys-actions select option {
  background: #1a1a2e;
  color: #fff;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-active {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.permissions-list {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.permission-tag {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
  font-size: 0.7rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.usage-counter {
  font-weight: 600;
  color: #fbbf24;
}

/* Action Buttons */
.action-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.action-btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.action-btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.action-btn-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.action-btn-info:hover {
  background: rgba(59, 130, 246, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .keys-actions {
    flex-direction: column;
  }
  
  .keys-actions input,
  .keys-actions select,
  .keys-actions button {
    width: 100%;
  }
  
  .key-display {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Animation */
@keyframes slideIn {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Enhanced Glow Effects */
.btn-glow:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.hidden {
  display: none !important;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #00d4ff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===================== API DOCS SECTION ===================== */
.doc-auth-grid { display: flex; flex-direction: column; gap: 10px; }
.doc-auth-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.doc-label {
  min-width: 72px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-top: 1px;
}
.doc-code {
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  font-size: 12.5px;
  color: var(--accent-2);
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  word-break: break-all;
  flex: 1;
}
.doc-snippet-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.doc-snippet {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
}
.doc-copy-btn {
  background: rgba(99,102,241,0.12);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.doc-copy-btn:hover { background: rgba(99,102,241,0.22); }

/* Endpoints */
.doc-endpoint {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.doc-endpoint:last-child { margin-bottom: 0; }
.doc-ep-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  flex-wrap: wrap;
}
.doc-ep-header:hover { background: rgba(99,102,241,0.07); }
.method-badge {
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.method-get { background: rgba(34,197,94,0.15); color: #4ade80; }
.method-post { background: rgba(99,102,241,0.18); color: #818cf8; }
.ep-path {
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}
.ep-perm {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(168,85,247,0.15);
  color: #c084fc;
  flex-shrink: 0;
}
.ep-desc { font-size: 12.5px; color: var(--text-muted); flex: 1; }
.ep-toggle { margin-left: auto; color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

.doc-ep-body { padding: 16px; border-top: 1px solid var(--border); }

/* Params table */
.doc-params { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.doc-param-row {
  display: grid;
  grid-template-columns: 120px 80px 1fr;
  gap: 10px;
  font-size: 12.5px;
  padding: 7px 10px;
  background: rgba(99,102,241,0.04);
  border-radius: 6px;
}
.doc-param-row code {
  font-family: 'Consolas','SFMono-Regular',monospace;
  color: var(--accent-2);
  font-size: 12px;
}
.doc-param-row span:nth-child(2) { color: var(--accent-3); font-size: 11.5px; }
.doc-param-row span:nth-child(3) { color: var(--text-muted); }

.doc-example-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Error codes */
.doc-errors { display: flex; flex-direction: column; gap: 6px; }
.doc-error-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
}
.error-code {
  font-family: 'Consolas','SFMono-Regular',monospace;
  font-size: 13px;
  font-weight: 700;
  color: #f87171;
  min-width: 38px;
}
.doc-error-row span:last-child { color: var(--text-muted); }

/* ===================== UPLOAD SECTION ===================== */
.upload-form { display: flex; flex-direction: column; gap: 16px; }

.upload-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: rgba(99, 102, 241, 0.03);
}
.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.07);
}
.upload-icon-wrap {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--accent);
  opacity: 0.7;
}
.upload-drop-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.upload-drop-formats { margin: 0; font-size: 12px; color: var(--text-muted); }

.upload-file-name {
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent-2);
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  min-height: 18px;
}

/* ── Upload tabs ── */
.upload-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}
.upload-tab {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.upload-tab:hover { color: var(--text); }
.upload-tab.active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  color: #a5b4fc;
}
.upload-tab-panel { margin-bottom: 0; }

/* ── AI Format Preview ── */
.upload-preview-wrap {
  margin-top: 20px;
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 12px;
  background: rgba(99,102,241,0.04);
  padding: 16px 18px;
}
.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.preview-ai-badge {
  background: rgba(99,102,241,0.2);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #a5b4fc;
}
.preview-file-info { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.preview-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.preview-meta strong { color: var(--text); }
.preview-fields { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.preview-table-wrap { overflow-x: auto; margin-bottom: 10px; }
.preview-table {
  width: 100%;
  font-size: 11.5px;
  border-collapse: collapse;
  font-family: 'Consolas', monospace;
}
.preview-table th {
  text-align: left;
  padding: 5px 10px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.preview-table td {
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.75);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-note { font-size: 11.5px; color: var(--text-muted); margin: 0; }
.preview-note strong { color: var(--accent-2); }

/* ── Rich progress block ── */
.upload-progress-wrap {
  margin-top: 20px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 12px;
  background: rgba(99,102,241,0.04);
  padding: 16px 18px;
}
.uprog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.uprog-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}
.uprog-pct-label {
  font-size: 16px;
  font-weight: 700;
  color: #818cf8;
  font-family: 'Consolas', monospace;
}
.uprog-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.uprog-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.uprog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.uprog-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 90px;
  flex: 1;
}
.uprog-stat-lbl { font-size: 10.5px; color: var(--text-muted); margin-bottom: 3px; white-space: nowrap; }
.uprog-stat-val { font-size: 14px; font-weight: 700; color: var(--text); font-family: 'Consolas', monospace; }
.uprog-msg {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Server path tab ── */
.path-tab-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.6;
}
.path-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-family: 'Consolas', monospace;
  color: var(--text);
  transition: border-color 0.15s;
}
.path-input:focus { border-color: var(--accent); outline: none; }
.field-hint { margin: 5px 0 0; font-size: 11.5px; color: var(--text-muted); }

/* Legacy compat (keep old class name working) */
.upload-progress {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.upload-progress-bar-wrap {
  flex: 1; height: 6px; background: var(--bg-elevated);
  border-radius: 999px; overflow: hidden; border: 1px solid var(--border);
}
.upload-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px; transition: width 0.4s ease;
}
.upload-progress-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.upload-result {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.upload-result.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.upload-result.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.upload-result span { font-size: 12px; color: var(--text-muted); }

/* Format guide */
.format-guide { display: flex; flex-direction: column; gap: 10px; }
.format-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.format-ext {
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  white-space: nowrap;
  min-width: 80px;
  padding-top: 1px;
}
.format-desc { color: var(--text-muted); line-height: 1.5; }
.format-desc code {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  font-size: 11.5px;
}

/* Multiple file tags */
.upload-file-name { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 18px; }
.upload-file-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  color: var(--accent-2);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-size { color: var(--text-muted); font-size: 11px; }

/* Per-file upload results */
.upload-file-results { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.upload-file-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.upload-file-result.error-row { background: rgba(239,68,68,0.06); }
.ufr-name {
  font-family: 'Consolas','SFMono-Regular',monospace;
  color: var(--text);
  font-size: 12px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ufr-stat { color: #4ade80; font-size: 12px; white-space: nowrap; }
.ufr-err  { color: #f87171; font-size: 12px; white-space: nowrap; }