/* ============================================================
   Free LLM API Keys — Professional UI Styles
   ============================================================ */

:root {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-secondary: #a855f7;
  --color-accent: #ec4899;

  /* Light theme (default) */
  --color-bg: #f5f7fb;
  --color-bg-2: #eef2ff;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafc;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: rgba(15, 23, 42, 0.06);
  --color-border-strong: rgba(15, 23, 42, 0.12);
  --color-input: #ffffffe6;
  --color-input-border: #e2e8f0;
  --color-meta-bg: #f8fafc;
  --color-meta-border: #eef2f7;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Dark theme */
html[data-theme="dark"] {
  --color-bg: #0b1020;
  --color-bg-2: #0f172a;
  --color-surface: #121a2e;
  --color-surface-2: #1a2340;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: rgba(148, 163, 184, 0.15);
  --color-border-strong: rgba(148, 163, 184, 0.28);
  --color-input: rgba(30, 41, 59, 0.85);
  --color-input-border: rgba(148, 163, 184, 0.2);
  --color-meta-bg: rgba(30, 41, 59, 0.6);
  --color-meta-border: rgba(148, 163, 184, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(168, 85, 247, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(99, 102, 241, 0.12), transparent 60%),
    var(--color-bg);
  position: relative;
  overflow-x: hidden;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(168, 85, 247, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(99, 102, 241, 0.18), transparent 60%),
    var(--color-bg);
}

.key-mono {
  font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
  direction: ltr;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   Decorative background blobs
   ------------------------------------------------------------ */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-decor .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: floaty 18s ease-in-out infinite;
}
html[data-theme="dark"] .bg-decor .blob { opacity: 0.22; }
.bg-decor .blob-1 {
  width: 420px; height: 420px;
  top: -120px; right: -120px;
  background: radial-gradient(circle at 30% 30%, #a78bfa, #6366f1);
}
.bg-decor .blob-2 {
  width: 360px; height: 360px;
  bottom: -100px; left: -80px;
  background: radial-gradient(circle at 40% 40%, #f472b6, #a855f7);
  animation-delay: -6s;
}
.bg-decor .blob-3 {
  width: 280px; height: 280px;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 50% 50%, #60a5fa, #22d3ee);
  opacity: 0.2;
  animation-delay: -12s;
}
@keyframes floaty {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(20px, -30px) scale(1.05); }
}

#app { position: relative; z-index: 1; }

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.site-header {
  position: relative;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #db2777 100%);
  color: #fff;
  padding-bottom: 2.25rem;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
}
.site-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 200px at 10% 0%, rgba(255, 255, 255, 0.18), transparent 70%),
    radial-gradient(500px 200px at 90% 100%, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.brand-logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Live chip & buttons */
.live-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(16, 185, 129, 0.18);
  color: #d1fae5;
  border: 1px solid rgba(16, 185, 129, 0.45);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  user-select: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.live-chip:hover { background: rgba(16, 185, 129, 0.28); }
.live-chip.paused {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.4);
}
.live-chip.paused .live-dot {
  background: #94a3b8;
  box-shadow: none;
  animation: none;
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseDot 1.8s infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}
.btn-ghost:active { transform: translateY(0); }

.fav-count {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(250, 204, 21, 0.9);
  color: #78350f;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-right: 2px;
}
.fav-count.is-zero {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ------------------------------------------------------------
   Stats cards
   ------------------------------------------------------------ */
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  min-height: 82px;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.stat-indigo  .stat-icon { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.stat-purple  .stat-icon { background: linear-gradient(135deg, #a855f7, #d946ef); }
.stat-pink    .stat-icon { background: linear-gradient(135deg, #ec4899, #f472b6); }
.stat-emerald .stat-icon { background: linear-gradient(135deg, #10b981, #22d3ee); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}
.stat-value-sm {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ------------------------------------------------------------
   Filters bar
   ------------------------------------------------------------ */
.filters-bar {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
html[data-theme="dark"] .filters-bar {
  background: rgba(18, 26, 46, 0.85);
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-input);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.clear-search {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  width: 28px; height: 28px;
  border-radius: 999px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.clear-search:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary);
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-input);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  min-width: 150px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}
.filter-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.active-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border-strong);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.filter-chip button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.7rem;
}
.filter-chip button:hover { opacity: 0.7; }

/* ------------------------------------------------------------
   Grid toolbar
   ------------------------------------------------------------ */
.grid-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.toolbar-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.toolbar-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}
html[data-theme="dark"] .toolbar-btn {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

/* ------------------------------------------------------------
   Loading spinner
   ------------------------------------------------------------ */
.loader-ring {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Key cards
   ------------------------------------------------------------ */
.key-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
}
.key-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent, #6366f1), var(--accent2, #a855f7));
}
.key-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.25);
}

.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }

.model-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
  display: flex; align-items: center; gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-title i { color: var(--color-primary); flex-shrink: 0; }

.category-tag {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(99, 102, 241, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.key-display {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #86efac;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 14px 0;
  font-size: 0.78rem;
  word-break: break-all;
  border: 1px solid rgba(134, 239, 172, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}
.key-display:hover { background: linear-gradient(135deg, #1e293b, #334155); }
.key-display.revealed { color: #fbbf24; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.meta-cell {
  background: var(--color-meta-bg);
  border: 1px solid var(--color-meta-border);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
}
.meta-cell-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-weight: 500;
}
.meta-cell-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
  word-break: break-word;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.btn-copy {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}
.btn-copy.copied {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.btn-eye,
.btn-fav {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  padding: 10px 14px;
  border-radius: 10px;
  transition: all 0.2s ease;
  border: 1px solid var(--color-input-border);
  cursor: pointer;
}
.btn-eye:hover,
.btn-fav:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-primary);
}
.btn-fav.is-fav {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  border-color: #f59e0b;
}

/* Badges inside card */
.badge-new,
.badge-fav {
  position: absolute;
  top: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}
.badge-new {
  left: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
}
.badge-fav {
  right: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Card animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-anim { animation: fadeInUp 0.35s ease-out both; }

/* "New" highlight after auto-update */
@keyframes highlightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70%  { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.key-card.is-new {
  border-color: #10b981;
  animation: highlightPulse 1.8s ease-out 1;
}
.key-card.is-new::before {
  background: linear-gradient(90deg, #10b981, #22d3ee) !important;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 60;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.is-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}
.toast.is-info {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

/* ------------------------------------------------------------
   Update banner
   ------------------------------------------------------------ */
.update-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.4);
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s ease;
  z-index: 60;
}
.update-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.update-banner i { animation: shake 1s ease-in-out infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-12deg); }
  75%      { transform: rotate(12deg); }
}

/* ------------------------------------------------------------
   Scroll to top
   ------------------------------------------------------------ */
.scroll-top-btn {
  position: fixed;
  bottom: 22px;
  left: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  border: none;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
  cursor: pointer;
  z-index: 55;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
}
.scroll-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-top-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.5);
}

/* ------------------------------------------------------------
   Modal (Favorites)
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: min(720px, 100%);
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(80vh - 64px);
}
.modal-body .fav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}
.modal-body .fav-item:hover { border-color: rgba(99, 102, 241, 0.35); }
.modal-body .fav-info {
  display: flex; flex-direction: column;
  min-width: 0; flex: 1;
}
.modal-body .fav-model {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-body .fav-key {
  font-family: 'Fira Code', monospace;
  direction: ltr;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-body .fav-actions { display: flex; gap: 6px; flex-shrink: 0; }
.modal-body .fav-actions button {
  background: transparent;
  border: 1px solid var(--color-input-border);
  color: var(--color-text-muted);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-body .fav-actions button:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary);
}
.modal-body .fav-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px 20px;
}
.modal-body .fav-empty i {
  font-size: 2rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  margin-bottom: 10px;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
  margin-top: 3rem;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.footer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}
.footer-text {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.7;
}
.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ------------------------------------------------------------
   Responsive tweaks
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .stat-card { padding: 14px; min-height: auto; }
  .stat-icon { width: 40px; height: 40px; font-size: 16px; }
  .stat-value { font-size: 1.3rem; }
  .brand-logo { width: 46px; height: 46px; font-size: 18px; }
  .filter-select { min-width: auto; width: 100%; }
  .scroll-top-btn { width: 42px; height: 42px; bottom: 16px; left: 16px; }
}

/* Remove focus outline on mouse, keep for keyboard */
select:focus, input:focus, button:focus { outline: none; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-surface-2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #4f46e5, #9333ea);
}

/* ------------------------------------------------------------
   Status badge color overrides for dark mode
   ------------------------------------------------------------ */
html[data-theme="dark"] .bg-green-100  { background-color: rgba(16, 185, 129, 0.18) !important; }
html[data-theme="dark"] .text-green-800 { color: #6ee7b7 !important; }
html[data-theme="dark"] .border-green-300 { border-color: rgba(16, 185, 129, 0.4) !important; }

html[data-theme="dark"] .bg-yellow-100 { background-color: rgba(234, 179, 8, 0.18) !important; }
html[data-theme="dark"] .text-yellow-800 { color: #fde68a !important; }
html[data-theme="dark"] .border-yellow-300 { border-color: rgba(234, 179, 8, 0.4) !important; }

html[data-theme="dark"] .bg-red-100 { background-color: rgba(239, 68, 68, 0.18) !important; }
html[data-theme="dark"] .text-red-800 { color: #fca5a5 !important; }
html[data-theme="dark"] .border-red-300 { border-color: rgba(239, 68, 68, 0.4) !important; }

html[data-theme="dark"] .bg-blue-100 { background-color: rgba(59, 130, 246, 0.18) !important; }
html[data-theme="dark"] .text-blue-800 { color: #93c5fd !important; }
html[data-theme="dark"] .border-blue-300 { border-color: rgba(59, 130, 246, 0.4) !important; }

/* Dark-mode tweaks for error / empty states */
html[data-theme="dark"] #errorState {
  background-color: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
html[data-theme="dark"] #errorState .text-red-700 { color: #fca5a5 !important; }
html[data-theme="dark"] #emptyState .text-gray-600 { color: var(--color-text) !important; }
html[data-theme="dark"] #emptyState .text-gray-400 { color: var(--color-text-muted) !important; }
html[data-theme="dark"] #loadingState .text-gray-600 { color: var(--color-text) !important; }
