:root {
  --bg: #0d0f11;
  --sidebar-bg: #0d0f11;
  --card-bg: #14171a;
  --border: #212529;
  --border-hover: #343a40;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #4ade80;
  --accent-hover: #22c55e;
  --accent-subtle: rgba(74, 222, 128, 0.1);
  --danger: #ef4444;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --overlay-1: rgba(255,255,255,0.01);
  --overlay-2: rgba(255,255,255,0.02);
  --overlay-3: rgba(255,255,255,0.03);
  --overlay-5: rgba(255,255,255,0.05);
  --overlay-6: rgba(255,255,255,0.06);
  --overlay-8: rgba(255,255,255,0.08);
  --overlay-15: rgba(255,255,255,0.15);
  --shadow-color: rgba(0,0,0,0.5);
}

body.light-theme {
  --bg: #f8fafc;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-subtle: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --overlay-1: rgba(0,0,0,0.02);
  --overlay-2: rgba(0,0,0,0.04);
  --overlay-3: rgba(0,0,0,0.06);
  --overlay-5: rgba(0,0,0,0.08);
  --overlay-6: rgba(0,0,0,0.1);
  --overlay-8: rgba(0,0,0,0.12);
  --overlay-15: rgba(0,0,0,0.2);
  --shadow-color: rgba(0,0,0,0.1);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── APP LAYOUT ─── */
.app-layout { 
  display: flex; 
  flex-direction: row; 
  height: 100vh; 
  width: 100vw; 
}

.nav-menu-btn { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; }

.nav-profile {
  background: var(--overlay-3);
  border: 1px solid var(--overlay-8);
  color: var(--text);
  height: 34px;
  padding: 0 14px 0 4px;
  border-radius: 99px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: all 0.2s;
}
.nav-profile:hover { background: var(--overlay-8); border-color: var(--overlay-15); }
.nav-profile .avatar {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-weight: 600; font-size: 11px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.profile-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 8px; width: 180px; box-shadow: 0 4px 20px var(--shadow-color);
  z-index: 100; overflow: hidden; display: flex; flex-direction: column;
}
.profile-menu.hidden { display: none; }
.menu-item {
  width: 100%; text-align: left; background: none; border: none;
  padding: 12px 16px; color: var(--text); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: background 0.2s;
}
.menu-item:hover { background: var(--overlay-5); }
.menu-item.danger { color: #ef4444; }
.menu-item.danger:hover { background: rgba(239,68,68,0.1); }
.menu-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ─── MAIN BODY ─── */
.main-body { display: flex; flex: 1; overflow: hidden; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 340px; min-width: 340px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%;
}
.sidebar-scrollable { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px 20px; }
.sidebar-scrollable::-webkit-scrollbar { width: 4px; }
.sidebar-scrollable::-webkit-scrollbar-track { background: transparent; }
.sidebar-scrollable::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }

.sidebar-hero { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.hero-text h1 { font-size: 16px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.badge { background: rgba(74,222,128,0.15); color: var(--accent); font-size: 10px; padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(74,222,128,0.3); font-weight: 600; }
.hero-text p { font-size: 11.5px; color: var(--muted); line-height: 1.5; max-width: 200px; }
.hero-graphic { width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(74,222,128,0.4); display: flex; align-items: center; justify-content: center; position: relative; }
.hero-graphic::after { content: ""; position: absolute; width: 120%; height: 30%; border: 1px solid var(--accent); border-radius: 50%; transform: rotate(-20deg); }
.hero-graphic svg { width: 30px; height: 30px; color: var(--muted); }

.filter-actions-row { display: flex; gap: 12px; margin-bottom: 24px; }
.action-btn { 
  flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--muted); 
  padding: 8px; border-radius: 6px; font-size: 11px; font-weight: 500; cursor: pointer; 
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s;
}
.action-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--overlay-2); }

/* ─── FILTER GROUPS ─── */
.filter-group { margin-bottom: 8px; }
.filter-header { 
  display: flex; justify-content: space-between; align-items: center; cursor: pointer; 
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 16px; transition: border-color 0.2s;
}
.filter-header:hover { border-color: rgba(74,222,128,0.3); }
.filter-header h3 { font-size: 12px; color: var(--text); font-weight: 500; display: flex; align-items: center; gap: 10px; }
.filter-header h3 .emoji { font-size: 14px; width: 18px; text-align: center; }
.chevron { color: var(--muted); font-size: 11px; transition: transform 0.2s; }
.filter-body { padding: 12px 16px; background: var(--overlay-1); border: 1px solid var(--border); border-top: none; border-radius: 0 0 6px 6px; margin-top: -6px; padding-top: 18px; margin-bottom: 8px; }

/* ─── CHIPS ─── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { position: relative; }
.chip input, .chip-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip label, .chip-label {
  display: inline-flex; align-items: center;
  padding: 6px 12px; background-color: var(--bg);
  border: 1px solid var(--border); border-radius: 99px;
  font-size: 11.5px; color: var(--muted); cursor: pointer;
  transition: all 0.2s; user-select: none;
}
.chip label:hover, .chip-label:hover { border-color: var(--border-hover); color: var(--text); }
.chip input:checked + label, .chip-label:has(input:checked) {
  background: var(--accent-subtle); border-color: var(--accent); color: var(--accent);
}
.chip.chip-custom label { padding-right: 28px; }
.chip.chip-custom .chip-remove {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--muted); font-size: 10px; cursor: pointer;
}
.chip.chip-custom .chip-remove:hover { background: var(--danger); color: #fff; }

/* ─── INPUTS ─── */
.input-row { display: flex; gap: 6px; }
.custom-input {
  flex: 1; min-width: 0; background: rgba(0,0,0,0.2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; color: var(--text);
  font-family: var(--font-sans); font-size: 12px;
  transition: border-color 0.2s;
}
.custom-input:focus { outline: none; border-color: var(--accent); }
.add-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  width: 34px; border-radius: 6px; cursor: pointer; font-size: 16px; transition: all 0.2s;
}
.add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── OPTIONS ─── */
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; margin-bottom: 12px; }
.checkbox-row:hover { color: var(--text); }
.checkbox-row input { display: none; }
.checkbox-box {
  width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 4px;
  background: rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center;
}
.checkbox-row input:checked + .checkbox-box { background: var(--accent); border-color: var(--accent); }
.checkbox-row input:checked + .checkbox-box::after { content: "✓"; color: #000; font-size: 9px; font-weight: bold; }

.date-btn {
  width: 100%; padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: all 0.2s;
}
.date-btn:hover { border-color: var(--border-hover); background: var(--overlay-2); }
.indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); transition: background 0.2s; }
.date-btn.active .indicator { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ─── SIDEBAR FOOTER ─── */
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--sidebar-bg); }
.footer-buttons { display: flex; gap: 12px; }
.generate-btn {
  flex: 1; padding: 12px; border: none; border-radius: 6px;
  background: var(--accent); color: #000; font-weight: 600; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.2s;
}
.generate-btn:hover { opacity: 0.9; }
.secondary-btn {
  padding: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; font-weight: 500; font-size: 12px; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 8px;
}
.secondary-btn:hover { border-color: var(--border-hover); background: var(--overlay-2); }

.tips-box {
  margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--overlay-1);
}
.tips-box h4 { font-size: 11px; color: #fff; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tips-box p { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1; display: flex; flex-direction: column; background: var(--bg);
}
.results-header {
  padding: 24px 32px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.results-header h2 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.results-header h2 svg { color: var(--accent); }
.results-actions { display: flex; align-items: center; gap: 16px; }
.copy-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all 0.2s;
}
.copy-btn:hover { border-color: var(--border-hover); }

.results-container { flex: 1; overflow-y: auto; padding: 32px; }

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center;
}
.empty-graphic {
  position: relative; width: 120px; height: 120px; margin-bottom: 24px;
}
.empty-graphic svg { width: 100%; height: 100%; color: var(--accent); }
.empty-state h3 { color: #fff; font-size: 20px; margin-bottom: 12px; font-weight: 500; }
.empty-state h3 strong { color: var(--accent); font-weight: 600; }
.empty-state p { color: var(--muted); font-size: 13px; max-width: 300px; line-height: 1.6; }
.empty-state p strong { color: var(--accent); font-weight: 500; }

.main-footer {
  padding: 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted); text-align: center;
}
.main-footer a { color: var(--accent); text-decoration: none; }
.main-footer svg { color: var(--accent); vertical-align: middle; margin: 0 4px; }

/* ─── RESULT CARDS ─── */
.qcard {
  background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 20px; margin-bottom: 12px; transition: border-color 0.2s;
}
.qcard:hover { border-color: var(--border-hover); }
.qtag { font-size: 10px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: block; font-weight: 600; }
.qtext { font-family: var(--font-mono); font-size: 13px; color: var(--text); line-height: 1.6; word-break: break-all; margin-bottom: 16px; }
.qactions { display: flex; gap: 8px; }
.qbtn {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 11.5px;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.qbtn:hover { border-color: var(--border-hover); background: var(--overlay-2); }
.qbtn.primary { background: #fff; color: #000; border: none; font-weight: 500; }
.qbtn.primary:hover { opacity: 0.9; }

/* ─── MODAL ─── */
.modal { background: transparent; border: none; margin: auto; }
.modal::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.modal-content {
  background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; width: 400px; max-width: 90vw; color: var(--text);
}
.modal-content h3 { font-size: 16px; margin-bottom: 8px; }
.modal-desc { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }
.primary-btn { background: var(--accent); color: #000; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; }
.primary-btn:hover { opacity: 0.9; }

/* ─── RESPONSIVE ─── */
.nav-menu-btn { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: var(--shadow-color); z-index: 40; backdrop-filter: blur(4px); }

@media (max-width: 900px) {
  .nav-menu-btn { display: block !important; background: transparent; border: none; color: var(--text); cursor: pointer; padding: 4px; }
  .sidebar {
    position: fixed; top: 0; left: -100%; height: 100vh; width: 85vw; max-width: 340px;
    z-index: 50; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border); box-shadow: 4px 0 24px var(--shadow-color);
  }
  .sidebar.show { left: 0; }
  .sidebar-overlay.show { display: block; top: 0; }
  .nav-profile span { display: none; }
  .results-header { flex-direction: column !important; align-items: flex-start !important; gap: 16px; }
  .results-container { padding: 20px; }
}

/* --- INLINE STYLES MOVED --- */
#app-loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; font-family: var(--font-sans); text-align: center; }
.hidden { display: none !important; }
.pqc-login-btn { display: inline-flex; align-items: center; gap: 10px; background: var(--card-bg); color: var(--text); text-decoration: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; border: 1px solid var(--border); transition: all 0.2s ease; }
.pqc-login-btn:hover { background: var(--border-hover); border-color: var(--border-hover); }
.pqc-login-btn img { width: 24px; height: 24px; border-radius: 4px; }
.suggestions-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 36px; background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 6px; z-index: 999; max-height: 200px; overflow-y: auto; margin-top: 4px; box-shadow: 0 4px 12px var(--shadow-color); }
.suggestion-item { padding: 8px 12px; cursor: pointer; color: var(--text); font-size: 13px; }
.suggestion-item:hover { background: var(--overlay-5); }
.result-section { margin-bottom: 20px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.result-section-header { padding: 16px 20px; background: var(--card-bg); cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; user-select: none; border-bottom: 1px solid var(--border); }
.result-section-header:hover { background: var(--border-hover); }
.result-section-header h3 { margin: 0; font-size: 16px; color: var(--text); }
.result-section-content { padding: 20px; background: var(--bg); }
