/* ============================================
   Anvi's Learning Hub — Refined Design System v2
   ============================================ */

:root {
  /* Surface — warmer dark with depth */
  --bg: #0b0d12;
  --bg-elev-1: #11141b;
  --bg-elev-2: #161a23;
  --bg-elev-3: #1c2130;
  --bg-card: #13171f;
  --bg-card-hover: #181d28;
  --bg-input: #0f131a;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-active: rgba(52, 211, 153, 0.4);

  /* Text */
  --text: #f0f2f7;
  --text-2: #b4bac9;
  --text-3: #7c8499;
  --text-4: #545b70;

  /* Brand — emerald with depth, plus accent cycle */
  --emerald: #10b981;
  --emerald-2: #34d399;
  --emerald-glow: rgba(16, 185, 129, 0.15);

  --teal: #14b8a6;
  --sky: #38bdf8;
  --indigo: #818cf8;
  --violet: #a78bfa;
  --rose: #fb7185;
  --amber: #fbbf24;
  --orange: #fb923c;

  /* Functional */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --info: #3b82f6;

  /* Gradients */
  --grad-emerald: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  --grad-violet: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --grad-sky: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --grad-amber: linear-gradient(135deg, #f59e0b 0%, #fb7185 100%);
  --grad-rose: linear-gradient(135deg, #fb7185 0%, #ec4899 100%);
  --grad-hero: radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.15), transparent 50%),
               radial-gradient(circle at 80% 50%, rgba(139, 92, 246, 0.1), transparent 50%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-emerald: 0 0 0 1px rgba(16, 185, 129, 0.3), 0 8px 32px rgba(16, 185, 129, 0.12);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 0 1px rgba(255,255,255,0.02);

  /* Geometry */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;

  --sidebar-w: 272px;
  --header-h: 64px;
  --max: 1320px;
}

[data-theme="light"] {
  --bg: #fafaf8;
  --bg-elev-1: #ffffff;
  --bg-elev-2: #f6f6f4;
  --bg-elev-3: #f0f0ec;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f8f5;
  --bg-input: #f4f4f1;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --border-active: rgba(16, 185, 129, 0.4);
  --text: #0a0a0a;
  --text-2: #525252;
  --text-3: #737373;
  --text-4: #a3a3a3;
  --emerald-glow: rgba(16, 185, 129, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(0,0,0,0.04);
  --grad-hero: radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.1), transparent 50%),
               radial-gradient(circle at 80% 50%, rgba(139, 92, 246, 0.06), transparent 50%);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Soft glow background on body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--grad-hero);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--emerald-2); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--emerald); }

::selection { background: var(--emerald-glow); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ============================================
   LAYOUT
   ============================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: rgba(11, 13, 18, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
[data-theme="light"] .sidebar { background: rgba(250, 250, 248, 0.85); }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  height: var(--header-h);
  background: rgba(11, 13, 18, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}
[data-theme="light"] .header { background: rgba(250, 250, 248, 0.85); }

.content {
  padding: 32px 40px 96px;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--grad-emerald);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
}

.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav { padding: 12px 12px; flex: 1; }

.nav-section { margin-bottom: 20px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.12s ease;
  margin-bottom: 1px;
  cursor: pointer;
  position: relative;
}

.nav-item:hover { background: var(--bg-elev-2); color: var(--text); }

.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
  color: var(--emerald-2);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--emerald);
  border-radius: 0 2px 2px 0;
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.nav-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-2);
  letter-spacing: 0.3px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

/* ============================================
   HEADER
   ============================================ */
.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin-right: 20px;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--emerald);
  background: var(--bg-elev-1);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

.search-input::placeholder { color: var(--text-4); }

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: flex;
}

.kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.022em;
}

h1 { font-size: 36px; margin-bottom: 8px; letter-spacing: -0.03em; }
h2 {
  font-size: 28px;
  margin-top: 56px;
  margin-bottom: 18px;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 14px;
}
h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}
h3 { font-size: 19px; margin-top: 28px; margin-bottom: 10px; color: var(--text); letter-spacing: -0.02em; }
h4 { font-size: 15px; margin-top: 18px; margin-bottom: 6px; }
h5 { font-size: 12px; margin-top: 16px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); font-weight: 700; }

p { margin-bottom: 12px; color: var(--text-2); line-height: 1.65; }
p strong { color: var(--text); font-weight: 600; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-elev-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--emerald-2);
  border: 1px solid var(--border);
  font-weight: 500;
}

pre {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
pre code { background: transparent; border: none; padding: 0; color: var(--text); }

ul, ol { margin: 10px 0 14px 22px; color: var(--text-2); }
li { margin-bottom: 5px; line-height: 1.65; }
li::marker { color: var(--emerald); }

blockquote {
  border-left: 3px solid var(--emerald);
  background: var(--emerald-glow);
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 12px 12px 0;
  color: var(--text);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--emerald-2);
  background: var(--emerald-glow);
  padding: 5px 11px;
  border-radius: 100px;
  margin-bottom: 16px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.page-subtitle {
  font-size: 17px;
  color: var(--text-2);
  max-width: 720px;
  font-weight: 400;
  line-height: 1.55;
  margin-top: 8px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 22px;
}
.breadcrumbs a { color: var(--text-3); transition: color 0.15s; }
.breadcrumbs a:hover { color: var(--emerald-2); }
.breadcrumbs .sep { opacity: 0.4; }

/* ============================================
   HERO (homepage)
   ============================================ */
.hero {
  padding: 32px 0 8px;
  position: relative;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--emerald-2);
  background: var(--emerald-glow);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero-title {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
  max-width: 920px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 40%, var(--emerald-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-2);
  max-width: 720px;
  line-height: 1.55;
  margin-bottom: 28px;
}

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================
   BENTO GRID (domains)
   ============================================ */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.bento-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.bento-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-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.25s;
}

.bento-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
}

.bento-item:hover::before { opacity: 1; }

.bento-item.span-2 { grid-column: span 2; }
.bento-item.span-3 { grid-column: span 3; }
.bento-item.span-4 { grid-column: span 4; }
.bento-item.span-6 { grid-column: span 6; }

.bento-item.tall { min-height: 280px; }
.bento-item.feature { min-height: 240px; }

/* Color variants for bento */
.bento-emerald::before { background: linear-gradient(135deg, rgba(16, 185, 129, 0.5), transparent); }
.bento-emerald:hover { box-shadow: 0 12px 40px rgba(16, 185, 129, 0.12); }
.bento-emerald .bento-icon { background: var(--grad-emerald); color: white; box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25); }

.bento-violet::before { background: linear-gradient(135deg, rgba(167, 139, 250, 0.5), transparent); }
.bento-violet:hover { box-shadow: 0 12px 40px rgba(139, 92, 246, 0.12); }
.bento-violet .bento-icon { background: var(--grad-violet); color: white; box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25); }

.bento-sky::before { background: linear-gradient(135deg, rgba(56, 189, 248, 0.5), transparent); }
.bento-sky:hover { box-shadow: 0 12px 40px rgba(56, 189, 248, 0.12); }
.bento-sky .bento-icon { background: var(--grad-sky); color: white; box-shadow: 0 8px 24px rgba(14, 165, 233, 0.25); }

.bento-amber::before { background: linear-gradient(135deg, rgba(251, 191, 36, 0.5), transparent); }
.bento-amber:hover { box-shadow: 0 12px 40px rgba(251, 191, 36, 0.12); }
.bento-amber .bento-icon { background: var(--grad-amber); color: white; box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25); }

.bento-rose::before { background: linear-gradient(135deg, rgba(251, 113, 133, 0.5), transparent); }
.bento-rose:hover { box-shadow: 0 12px 40px rgba(251, 113, 133, 0.12); }
.bento-rose .bento-icon { background: var(--grad-rose); color: white; box-shadow: 0 8px 24px rgba(236, 72, 153, 0.25); }

.bento-teal::before { background: linear-gradient(135deg, rgba(20, 184, 166, 0.5), transparent); }
.bento-teal:hover { box-shadow: 0 12px 40px rgba(20, 184, 166, 0.12); }
.bento-teal .bento-icon { background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%); color: white; box-shadow: 0 8px 24px rgba(20, 184, 166, 0.25); }

.bento-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.bento-icon svg { width: 22px; height: 22px; }

.bento-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
}

.bento-feature .bento-title { font-size: 22px; }

.bento-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
  flex: 1;
}

.bento-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

.bento-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-elev-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all 0.25s;
  opacity: 0.5;
}
.bento-item:hover .bento-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
  background: var(--emerald-glow);
  color: var(--emerald-2);
}

/* Stat band (compressed bento) */
.stat-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-tile::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.3;
}

.stat-tile.t-emerald::before { background: var(--emerald); }
.stat-tile.t-violet::before { background: var(--violet); }
.stat-tile.t-sky::before { background: var(--sky); }
.stat-tile.t-amber::before { background: var(--amber); }

.stat-tile-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 6px;
  position: relative;
}

.stat-tile-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-feature-settings: 'tnum';
  letter-spacing: -0.025em;
  position: relative;
}
.stat-tile-unit { font-size: 16px; color: var(--text-3); font-weight: 600; margin-left: 3px; }

.stat-tile-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  position: relative;
}

/* ============================================
   GENERIC CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.2s;
}

.card:hover { border-color: var(--border-strong); }

.card-link { display: block; color: inherit; cursor: pointer; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .bento { grid-template-columns: repeat(4, 1fr); }
  .bento-item.span-3 { grid-column: span 2; }
  .bento-item.span-4 { grid-column: span 4; }
  .bento-item.span-6 { grid-column: span 4; }
  .stat-band { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .bento-item.span-2, .bento-item.span-3, .bento-item.span-4, .bento-item.span-6 { grid-column: span 1; }
  .stat-band { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}
.badge-emerald { background: rgba(16, 185, 129, 0.12); color: var(--emerald-2); }
.badge-violet  { background: rgba(167, 139, 250, 0.12); color: var(--violet); }
.badge-sky     { background: rgba(56, 189, 248, 0.12); color: var(--sky); }
.badge-amber   { background: rgba(251, 191, 36, 0.12); color: var(--amber); }
.badge-rose    { background: rgba(251, 113, 133, 0.12); color: var(--rose); }
.badge-neutral { background: var(--bg-elev-2); color: var(--text-2); }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

/* ============================================
   Q&A
   ============================================ */
.qa {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all 0.2s;
}

.qa:hover { border-color: var(--border-strong); }
.qa.open {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15), 0 8px 24px rgba(16, 185, 129, 0.05);
}

.qa-question {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-weight: 600;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  transition: background 0.15s;
  user-select: none;
}

.qa-question:hover { background: var(--bg-card-hover); }

.qa-q-num {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--emerald-2);
  background: var(--emerald-glow);
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.qa-q-text { flex: 1; }

.qa-toggle {
  flex-shrink: 0;
  color: var(--text-3);
  transition: transform 0.2s;
  font-size: 16px;
}

.qa.open .qa-toggle { transform: rotate(180deg); color: var(--emerald-2); }

.qa-answer {
  display: none;
  padding: 0 20px 20px;
  color: var(--text-2);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: -1px;
  font-size: 14px;
  line-height: 1.65;
}

.qa.open .qa-answer { display: block; }

.qa-answer p:first-child { margin-top: 0; }
.qa-answer p:last-child { margin-bottom: 0; }

/* ============================================
   CALLOUTS
   ============================================ */
.callout {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 18px 0;
  background: var(--bg-card);
  display: flex;
  gap: 14px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.callout::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.callout-body { flex: 1; min-width: 0; }
.callout-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 14px; letter-spacing: -0.01em; }
.callout-body p { margin-bottom: 8px; font-size: 14px; line-height: 1.6; }
.callout-body p:last-child { margin-bottom: 0; }
.callout-body ul { margin: 6px 0 0 20px; }
.callout-body li { font-size: 14px; }

.callout-warning::before { background: var(--warning); }
.callout-warning .callout-icon { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.callout-warning { background: linear-gradient(90deg, rgba(245, 158, 11, 0.06), transparent); border-color: rgba(245, 158, 11, 0.2); }

.callout-danger::before { background: var(--danger); }
.callout-danger .callout-icon { background: rgba(244, 63, 94, 0.12); color: var(--danger); }
.callout-danger { background: linear-gradient(90deg, rgba(244, 63, 94, 0.06), transparent); border-color: rgba(244, 63, 94, 0.2); }

.callout-info::before { background: var(--info); }
.callout-info .callout-icon { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.callout-info { background: linear-gradient(90deg, rgba(59, 130, 246, 0.06), transparent); border-color: rgba(59, 130, 246, 0.2); }

.callout-success::before { background: var(--emerald); }
.callout-success .callout-icon { background: rgba(16, 185, 129, 0.12); color: var(--emerald-2); }
.callout-success { background: linear-gradient(90deg, rgba(16, 185, 129, 0.06), transparent); border-color: rgba(16, 185, 129, 0.2); }

.callout-tip::before { background: var(--violet); }
.callout-tip .callout-icon { background: rgba(167, 139, 250, 0.12); color: var(--violet); }
.callout-tip { background: linear-gradient(90deg, rgba(167, 139, 250, 0.06), transparent); border-color: rgba(167, 139, 250, 0.2); }

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  background: var(--bg-elev-2);
  color: var(--text-3);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
  line-height: 1.55;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hover); color: var(--text); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-decoration: none;
  letter-spacing: -0.005em;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-primary {
  background: var(--grad-emerald);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
  filter: brightness(1.08);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-elev-2); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============================================
   FLASHCARD
   ============================================ */
.flashcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  margin: 20px 0;
  overflow: hidden;
}
.flashcard::after {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 60%; height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06), transparent 70%);
  pointer-events: none;
}

.flashcard:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 12px 40px rgba(16, 185, 129, 0.1);
}

.flashcard-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--emerald-2);
  margin-bottom: 18px;
  position: relative;
}

.flashcard-content {
  font-size: 19px;
  line-height: 1.55;
  color: var(--text);
  flex: 1;
  position: relative;
  letter-spacing: -0.01em;
}

.flashcard-hint {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-size: 12px;
  color: var(--text-4);
}

.flashcard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 16px;
}

.flashcard-counter {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  font-feature-settings: 'tnum';
}

/* ============================================
   TOC
   ============================================ */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 22px 0;
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
@media (max-width: 720px) { .toc ol { columns: 1; } }

.toc li {
  counter-increment: toc;
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  break-inside: avoid;
}

.toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-4);
  font-weight: 600;
  min-width: 22px;
}

.toc a { color: var(--text-2); font-size: 13.5px; }
.toc a:hover { color: var(--emerald-2); }

/* ============================================
   ENTITY (company/tool) CARDS
   ============================================ */
.entity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all 0.2s;
  position: relative;
}

.entity-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.entity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.entity-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.entity-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.4;
}

.entity-tier {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.tier-filter { background: rgba(244, 63, 94, 0.12); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.2); }
.tier-plus   { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.tier-nice   { background: rgba(59, 130, 246, 0.12); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.2); }
.tier-free   { background: rgba(16, 185, 129, 0.12); color: var(--emerald-2); border: 1px solid rgba(16, 185, 129, 0.2); }

.entity-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 14px;
  flex: 1;
}

.entity-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.entity-meta-row { display: flex; gap: 8px; align-items: baseline; }
.entity-meta-label { color: var(--text-4); font-weight: 600; min-width: 70px; flex-shrink: 0; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 1px; }
.entity-meta-value { color: var(--text-2); flex: 1; line-height: 1.5; }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 24px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-chip {
  padding: 6px 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.filter-chip:hover {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--emerald-2);
}

.filter-chip.active {
  background: var(--grad-emerald);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* ============================================
   SEARCH RESULTS
   ============================================ */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.search-results.active { display: block; }

.search-result {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: block;
  color: var(--text);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-card-hover); color: var(--text); }

.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; letter-spacing: -0.01em; }
.search-result-desc { font-size: 12px; color: var(--text-3); }
.search-result-cat { font-size: 10px; color: var(--emerald-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }

.search-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }

/* ============================================
   PROGRESS
   ============================================ */
.progress-bar { width: 100%; height: 6px; background: var(--bg-elev-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad-emerald); border-radius: 3px; transition: width 0.3s ease; }

/* ============================================
   UTILITY
   ============================================ */
.text-muted { color: var(--text-3); }
.text-accent { color: var(--emerald-2); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-success { color: var(--emerald-2); }

.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

.divider { height: 1px; background: var(--border); margin: 32px 0; }

/* Mobile menu */
.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px; height: 36px;
  border-radius: 9px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; top: 0; left: 0; width: var(--sidebar-w); z-index: 100; box-shadow: var(--shadow-lg); }
  .sidebar.open { display: flex; }
  .content { padding: 24px 20px 60px; }
  .header { padding: 0 20px; }
  .menu-btn { display: flex; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .search-box { max-width: none; margin-right: 12px; }
}

@media (max-width: 640px) {
  .content { padding: 20px 16px 40px; }
  .card { padding: 18px; }
}

/* Print */
@media print {
  .sidebar, .header { display: none; }
  .app { grid-template-columns: 1fr; }
  .content { padding: 0; max-width: none; }
  body { background: white; color: black; font-size: 11pt; }
  body::before { display: none; }
  .qa-answer { display: block !important; }
  .card, .qa { break-inside: avoid; }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes shimmer {
  from { background-position: -200% center; }
  to { background-position: 200% center; }
}
