/* ─────────────────────────────────────────────────────────────────────────────
   style.css — shared design tokens and components used across all pages
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg:             #07090e;
  --surface:        #0e121a;
  --surface-glass:  rgba(14, 18, 26, 0.75);
  --surface2:       #141923;
  --surface3:       #1c2230;
  --surface4:       #283730;
  --sidebar-bg:     #0a0d14;
  --nav-bg:         rgba(10, 14, 22, 0.88);

  /* Card & Surfaces */
  --card-bg:        rgba(14, 18, 26, 0.75);
  --card-glass:     rgba(14, 18, 26, 0.7);
  --card-border:    rgba(255, 255, 255, 0.08);
  --card-shadow:    0 4px 20px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);

  /* Modals & Drawers */
  --drawer-bg:      #0d121c;
  --modal-bg:       #0d121c;

  /* Inputs */
  --input-bg:       rgba(20, 25, 35, 0.85);
  --input-bg-focus: rgba(20, 25, 35, 0.98);
  --input-border:   rgba(255, 255, 255, 0.12);
  --input-text:     #ffffff;

  /* Code & Panels */
  --code-bg:        #080c14;

  /* Borders */
  --border:  rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.14);

  /* Brand & Accents */
  --brand:         #5ed29c;
  --brand-glow:    rgba(94, 210, 156, 0.25);
  --brand-surface: rgba(94, 210, 156, 0.12);
  --accent:        #22c55e;
  --accent-hover:  #16a34a;
  --accent-bg:     rgba(34, 197, 94, 0.12);
  --red:           #ef4444;
  --red-bg:        rgba(239, 68, 68, 0.12);
  --orange:        #f97316;
  --orange-bg:     rgba(249, 115, 22, 0.12);
  --blue:          #3b82f6;
  --blue-bg:       rgba(59, 130, 246, 0.12);
  --purple:        #8b5cf6;
  --purple-bg:     rgba(139, 92, 246, 0.12);
  --yellow:        #eab308;
  --yellow-bg:     rgba(234, 179, 8, 0.12);
  --teal:          #14b8a6;
  --pink:          #ec4899;

  /* Text */
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-dim:      #64748b;
  --text-disabled: #475569;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  /* Layout */
  --hh: 58px; /* nav height */
  --sidebar-w: 240px;
}

/* ── Light theme ───────────────────────────────────────────────────────────── */
html[data-theme="light"],
body[data-theme="light"],
[data-theme="light"] {
  /* Backgrounds */
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-glass:  rgba(255, 255, 255, 0.9);
  --surface2:       #f1f5f9;
  --surface3:       #e2e8f0;
  --surface4:       #cbd5e1;
  --sidebar-bg:     #ffffff;
  --nav-bg:         rgba(255, 255, 255, 0.88);

  /* Card & Surfaces */
  --card-bg:        #ffffff;
  --card-glass:     rgba(255, 255, 255, 0.85);
  --card-border:    rgba(15, 23, 42, 0.08);
  --card-shadow:    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  /* Modals & Drawers */
  --drawer-bg:      #ffffff;
  --modal-bg:       #ffffff;

  /* Inputs */
  --input-bg:       #ffffff;
  --input-bg-focus: #ffffff;
  --input-border:   rgba(15, 23, 42, 0.16);
  --input-text:     #0f172a;

  /* Code & Panels */
  --code-bg:        #0f172a;

  /* Borders */
  --border:  rgba(15, 23, 42, 0.08);
  --border2: rgba(15, 23, 42, 0.14);

  /* Brand & Accents (Calibrated for contrast against white) */
  --brand:         #059669;
  --brand-glow:    rgba(5, 150, 105, 0.2);
  --brand-surface: rgba(5, 150, 105, 0.08);
  --accent:        #16a34a;
  --accent-hover:  #15803d;
  --accent-bg:     rgba(22, 163, 74, 0.08);
  --red:           #dc2626;
  --red-bg:        rgba(220, 38, 38, 0.08);
  --orange:        #ea580c;
  --orange-bg:     rgba(234, 88, 12, 0.08);
  --blue:          #2563eb;
  --blue-bg:       rgba(37, 99, 235, 0.08);
  --purple:        #7c3aed;
  --purple-bg:     rgba(124, 58, 237, 0.08);
  --yellow:        #d97706;
  --yellow-bg:     rgba(217, 119, 6, 0.1);
  --teal:          #0d9488;
  --pink:          #db2777;

  /* Text */
  --text:          #0f172a;
  --text-muted:    #475569;
  --text-dim:      #64748b;
  --text-disabled: #94a3b8;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Master Shell Layout & Top Navigation Bar ───────────────────────────────── */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  position: relative;
}

.topnav, .nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 24px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-brand, .nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand .nav-logo-icon {
  font-size: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 12px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-link.active {
  color: var(--brand);
  background: var(--brand-surface);
  font-weight: 600;
  border-color: var(--brand);
}

.nav-link.super-admin-link {
  color: var(--brand);
  font-weight: 600;
  background: var(--brand-surface);
  border-color: var(--brand);
}

.nav-actions, .nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: calc(100vh - 58px);
}

.page {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  flex: 1;
}

/* ── Universal Form Controls & Inputs ──────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label, label.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.form-help, .help {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
textarea,
select,
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 9px;
  color: var(--input-text);
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

input:focus,
textarea:focus,
select:focus,
.form-input:focus {
  border-color: var(--brand);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim, #64748b);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* ── Nav logo (shared across all pages) ────────────────────────────────────── */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
  letter-spacing: -0.3px;
}

.nav-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  object-fit: contain;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}
img.nav-logo-icon {
  display: block;
  background: transparent;
}

/* Vertical divider used in topnav layouts */
.nav-div {
  width: 1px;
  height: 22px;
  background: var(--border2);
  flex-shrink: 0;
}

/* ── Buttons (shared) ──────────────────────────────────────────────────────── */
.nav-btn, .btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-btn:hover, .btn:hover {
  background: var(--surface3);
  border-color: var(--border2);
  color: var(--text);
}
.nav-btn.primary, .btn.primary {
  background: linear-gradient(135deg, #5ed29c 0%, #38b27c 100%);
  color: #070b0a;
  border: 1px solid rgba(94, 210, 156, 0.4);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(94, 210, 156, 0.25);
}
.nav-btn.primary:hover, .btn.primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(94, 210, 156, 0.4);
}
.nav-btn.danger, .btn.danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--border);
}
.nav-btn.danger:hover, .btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red);
  color: var(--red);
}

/* ── Toast (shared) ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--card-shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(34,197,94,0.4);  color: var(--accent); }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: var(--red); }

/* ── Badge (shared across dashboard + viewer) ──────────────────────────────── */
.badge { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 10.5px; font-weight: 700; }
.badge.err  { background: var(--red-bg);  color: var(--red); }
.badge.ok   { background: var(--accent-bg);  color: var(--accent); }
.badge.warn { background: var(--orange-bg); color: var(--orange); }

/* ── Empty state (shared) ──────────────────────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Universal Slide-Over Drawer ───────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 580px;
  max-width: 92vw;
  background: var(--drawer-bg);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.35);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open {
  transform: translateX(0);
}
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  backdrop-filter: blur(12px);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg);
}
.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}

/* ── Code Tabs & Snippets ─────────────────────────────────────────────────── */
.code-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.code-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.code-tab-btn:hover {
  color: var(--text);
  background: var(--surface2);
}
.code-tab-btn.active {
  color: var(--brand);
  background: var(--brand-surface);
  border-color: var(--brand);
}
.code-container {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #e2e8f0;
  overflow-x: auto;
}
.copy-snippet-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-snippet-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #070b0a;
}

/* ── Stack Trace & Breadcrumbs ─────────────────────────────────────────────── */
.stack-trace-view {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.breadcrumb-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding-left: 20px;
}
.breadcrumb-timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 7px;
  width: 2px;
  background: var(--border2);
}
.breadcrumb-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text);
}
.breadcrumb-dot {
  position: absolute;
  left: -20px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.breadcrumb-dot.error { border-color: var(--red); background: var(--red-bg); }
.breadcrumb-dot.network { border-color: var(--blue); background: var(--blue-bg); }
.breadcrumb-dot.click { border-color: var(--brand); background: var(--brand-surface); }

/* ── Switch Toggle (Shared) ────────────────────────────────────────────────── */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--surface3);
  transition: .25s;
  border-radius: 22px;
  border: 1px solid var(--border2);
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .25s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--brand);
  border-color: var(--brand);
}
input:checked + .slider:before {
  transform: translateX(18px);
  background-color: #fff;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--text-dim);
  gap: 10px;
  text-align: center;
}
.empty-emoji { font-size: 36px; }
.empty h3    { font-size: 15px; font-weight: 700; color: var(--text-muted); }

/* ── Modals & Dialogs (universal) ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex !important;
}

.modal-box {
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}

/* ─── Universal Home Recording Card System ─────────────────────────────────── */
.home-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--card-shadow);
}

.home-card:hover {
  border-color: var(--brand);
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.home-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand), var(--card-shadow-hover);
}

.home-card-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  z-index: 10;
  opacity: 0;
  transition: all 0.15s ease;
  cursor: pointer;
}

.home-card:hover .home-card-check,
.home-card.selected .home-card-check {
  opacity: 1;
}

.home-card.selected .home-card-check {
  background: var(--brand);
  border-color: var(--brand);
  color: #070b0a;
}

.home-card-thumb {
  height: 156px;
  background: linear-gradient(145deg, var(--surface2), var(--surface3));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.home-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.home-card:hover .home-card-thumb img {
  transform: scale(1.03);
}

.home-card-placeholder-icon {
  font-size: 42px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
  transition: transform 0.2s ease;
}

.home-card:hover .home-card-placeholder-icon {
  transform: scale(1.1);
}

.home-card-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 10;
  opacity: 0.85;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
}

.home-card:hover .home-card-copy-btn {
  opacity: 1;
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.home-card-copy-btn:hover {
  background: var(--brand) !important;
  color: #070b0a !important;
  border-color: var(--brand) !important;
  transform: scale(1.12);
  box-shadow: 0 4px 14px var(--brand-glow);
}

.home-card-dur {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 0.3px;
  z-index: 5;
}

.home-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  background: var(--card-bg);
}

.home-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.home-card-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.home-card-author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.home-card-author-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
}

.home-card-folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--brand-surface);
  color: var(--brand);
  border: 1px solid var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
  flex-shrink: 0;
}

.home-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.home-card-date {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 500;
}

.home-card-tags {
  display: flex;
  gap: 6px;
  align-items: center;
}

.home-tag {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.home-tag.err {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.home-tag.ok {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.home-tag.net {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid var(--orange);
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  width: 100%;
}

.bugspray-loader,
.loader-scene {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
  width: 180px;
  height: 80px;
  margin: 0 auto;
  user-select: none;
}

.bugspray-loader.sm {
  transform: scale(0.68);
  transform-origin: center center;
  height: 52px;
}

.bugspray-loader.xs {
  transform: scale(0.48);
  transform-origin: center center;
  height: 36px;
}

.bugspray-loader.lg {
  transform: scale(1.15);
  transform-origin: center center;
  height: 92px;
}

/* Pulse glow backdrop */
.loader-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(94, 210, 156, 0.24) 0%, rgba(34, 197, 94, 0.06) 45%, transparent 70%);
  pointer-events: none;
  animation: loaderPulseGlow 2.4s infinite ease-in-out;
}

@keyframes loaderPulseGlow {
  0%, 100% { transform: scale(0.88); opacity: 0.6; }
  50% { transform: scale(1.18); opacity: 1; }
}

/* Spray Bottle / Can */
.spray-can {
  position: relative;
  display: flex;
  align-items: center;
  animation: sprayShake 1.2s infinite ease-in-out;
  transform-origin: bottom center;
}

@keyframes sprayShake {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  30% { transform: rotate(-14deg) translateY(-2px) scale(1.04); }
  60% { transform: rotate(-4deg) translateY(1px); }
}

.can-body {
  width: 28px;
  height: 46px;
  background: linear-gradient(135deg, #13241c, #07150f);
  border: 1.5px solid rgba(94, 210, 156, 0.5);
  border-radius: 7px 7px 5px 5px;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(94, 210, 156, 0.25);
}

.can-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
}

.can-top {
  position: absolute;
  top: -8px;
  left: 6px;
  width: 16px;
  height: 8px;
  background: linear-gradient(135deg, #5ed29c, #22c55e);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 8px rgba(94, 210, 156, 0.7);
}

.can-nozzle {
  position: absolute;
  top: -13px;
  right: 0px;
  width: 9px;
  height: 6px;
  background: #f1f5f9;
  border-radius: 2px;
}

/* Spray Mist */
.spray-mist {
  position: absolute;
  left: 32px;
  top: -11px;
  width: 80px;
  height: 45px;
  pointer-events: none;
}

.mist-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #5ed29c 25%, rgba(94, 210, 156, 0.4) 65%, transparent 100%);
  opacity: 0;
}

.mist-particle.p1 { width: 12px; height: 12px; animation: mistBlast 1.1s infinite 0.1s ease-out; }
.mist-particle.p2 { width: 16px; height: 16px; animation: mistBlast 1.1s infinite 0.35s ease-out; }
.mist-particle.p3 { width: 10px; height: 10px; animation: mistBlast 1.1s infinite 0.55s ease-out; }
.mist-particle.p4 { width: 20px; height: 20px; animation: mistBlast 1.1s infinite 0.75s ease-out; }
.mist-particle.p5 { width: 14px; height: 14px; animation: mistBlast 1.1s infinite 0.95s ease-out; }

@keyframes mistBlast {
  0% { transform: translate(0, 0) scale(0.2); opacity: 0.9; }
  50% { opacity: 0.75; }
  100% { transform: translate(65px, 12px) scale(1.6); opacity: 0; }
}

/* Bug Target */
.bug-target {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bug-scan-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px dashed rgba(94, 210, 156, 0.65);
  animation: spinRadarRing 3.6s linear infinite;
}

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

.bug-icon {
  font-size: 30px;
  filter: drop-shadow(0 0 12px rgba(94, 210, 156, 0.8));
  animation: bugWiggle 0.75s infinite ease-in-out alternate;
}

@keyframes bugWiggle {
  0% { transform: rotate(-7deg) scale(0.96); }
  100% { transform: rotate(9deg) scale(1.09); }
}

.bug-sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  font-size: 10px;
  color: #5ed29c;
  animation: sparkleFloat 1.3s infinite ease-in-out;
}

.sparkle.s1 { top: -4px; right: 2px; animation-delay: 0.2s; }
.sparkle.s2 { bottom: -2px; right: 6px; animation-delay: 0.65s; }
.sparkle.s3 { top: 2px; left: -6px; animation-delay: 1.05s; }

@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) scale(0.6); opacity: 0.2; }
  50% { transform: translateY(-6px) scale(1.25); opacity: 1; text-shadow: 0 0 6px #5ed29c; }
}

/* Fullscreen / Processing Overlay */
.processing-overlay,
.bugspray-loader-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 11, 10, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  animation: fadeInOverlay 0.25s ease-out;
}

[data-theme="light"] .processing-overlay,
[data-theme="light"] .bugspray-loader-overlay {
  background: rgba(248, 250, 252, 0.96);
}

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

/* ── 3D Spatial Tilt & Spotlight Helpers ──────────────────────────────────── */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.25s ease;
  will-change: transform;
}

.glow-spotlight {
  position: relative;
  overflow: hidden;
}

.glow-spotlight::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(350px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--brand, #5ed29c), transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.glow-spotlight:hover::before {
  opacity: 1;
}

