/* rnkd.org design system
   Aesthetic: dark base + vibrant gradient accents (Linear/Vercel/Stripe energy)
   Spec: docs/superpowers/specs/2026-08-05-rnkd-subproject-1-design.md */

:root {
  /* Base */
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.15);

  /* Text */
  --text: #ffffff;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  /* Primary gradient: purple → pink */
  --primary-from: #8b5cf6;
  --primary-to: #ec4899;
  --primary-gradient: linear-gradient(135deg, var(--primary-from), var(--primary-to));

  /* Secondary gradient: cyan → blue */
  --secondary-from: #06b6d4;
  --secondary-to: #3b82f6;
  --secondary-gradient: linear-gradient(135deg, var(--secondary-from), var(--secondary-to));

  /* Rank accents */
  --rank-gold: #f59e0b;
  --rank-silver: #c0c0c0;
  --rank-bronze: #cd7f32;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4rem;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 3rem;
  --text-4xl: 4rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at top left, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.10), transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }

.mono, .metric {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
a:hover { border-bottom-color: var(--text); }

.source-link {
  color: var(--text-muted);
  font-size: var(--text-xs);
  border-bottom: 1px dotted var(--text-dim);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
}
.site-header nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.site-header .logo {
  font-weight: 800;
  font-size: var(--text-lg);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.site-header a {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.site-header a:hover { color: var(--text); }

/* Active/current page marker in the top nav. Matches both `.active`
   (legacy class) and `[aria-current="page"]` (modern, accessibility-first). */
.site-header a.active,
.site-header a[aria-current="page"] {
  color: var(--text);
  position: relative;
}
.site-header a.active::after,
.site-header a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: -0.4rem;
  height: 2px;
  border-radius: 2px;
  background: var(--primary-gradient);
}
.site-header a.nav-hot-list[aria-current="page"]::after,
.site-header a.nav-hot-list.active::after {
  /* Hot list already has the 🔥 ::before — leave room for it. */
  left: 1.25rem;
}

/* Social dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-dropdown-trigger:hover { color: var(--text); }
.nav-dropdown-trigger::after {
  content: "▾";
  font-size: 0.7em;
  opacity: 0.6;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
  min-width: 160px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
}
.nav-dropdown-menu a {
  padding: 8px 18px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown-menu a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.nav-dropdown-menu a:first-child { border-radius: 8px 8px 0 0; }
.nav-dropdown-menu a:last-child { border-radius: 0 0 8px 8px; }

/* Header nav badge for Hot List */
.nav-hot-list {
  position: relative;
}
.nav-hot-list::before {
  content: "🔥";
  font-size: 0.7em;
  margin-right: 2px;
}

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5);
  text-align: center;
}
.hero h1 {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-from) 50%, var(--primary-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-3);
}
.hero .tagline {
  color: var(--text-muted);
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto var(--space-5);
}
.hero .last-refresh {
  color: var(--text-dim);
  font-size: var(--text-sm);
}

/* Bento grid */
.bento {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-5);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 900px) { .bento { grid-template-columns: 1fr; } }

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.bento-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.15);
}
.bento-card.large { grid-column: span 2; }
@media (max-width: 900px) { .bento-card.large { grid-column: span 1; } }

.bento-card h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.bento-card .subtitle {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

/* Tables */
.rankings-table {
  width: 100%;
  max-width: 1200px;
  margin: var(--space-4) auto;
  padding: 0 var(--space-5);
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.rankings-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  position: sticky;
  top: 64px;
  border-bottom: 1px solid var(--border);
}
.rankings-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.rankings-table tr:last-child td { border-bottom: none; }
.rankings-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.rank-badge {
  display: inline-block;
  min-width: 2.5rem;
  text-align: center;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.rank-badge.rank-1 { color: var(--rank-gold); text-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.rank-badge.rank-2 { color: var(--rank-silver); }
.rank-badge.rank-3 { color: var(--rank-bronze); }

.score { font-weight: 700; color: var(--text); }
.score-bar {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: var(--space-2);
}
.score-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.4s ease;
}

/* Badges */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.badge.ai-validated {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: none;
  background: transparent;
  color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--primary-gradient);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(139, 92, 246, 0.35); }
.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-bright); }

/* Formula panel */
.formula-panel {
  max-width: 1200px;
  margin: var(--space-4) auto;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}
.formula-expression {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-lg);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: var(--space-2) 0;
}
.formula-factors {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.factor {
  flex: 1;
  min-width: 180px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.factor .name { font-weight: 600; }
.factor .weight { color: var(--primary-from); font-family: 'JetBrains Mono', monospace; }

/* Your-rank dashboard */
.rank-hero {
  max-width: 900px;
  margin: var(--space-5) auto;
  padding: var(--space-6);
  text-align: center;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  background-clip: padding-box;
  position: relative;
  backdrop-filter: blur(12px);
}
.rank-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 2px;
  background: var(--primary-gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.composite-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 5rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin: var(--space-3) 0;
}
.factor-bars { max-width: 700px; margin: var(--space-5) auto; }
.factor-bar { margin: var(--space-3) 0; }
.factor-bar .label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}
.factor-bar .bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.factor-bar .fill {
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.6s ease;
}

/* Form */
.form-card {
  max-width: 600px;
  margin: var(--space-5) auto;
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-card input {
  width: 100%;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
}
.form-card input:focus {
  outline: none;
  border-color: var(--primary-from);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Footer */
.site-footer {
  max-width: 1200px;
  margin: var(--space-7) auto var(--space-5);
  padding: 0 var(--space-5);
  color: var(--text-dim);
  font-size: var(--text-sm);
  text-align: center;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.6s ease both; }

/* ==========================================================================
   rnkd.org — Main page discover section + search dropdown + preview strip
   ========================================================================== */

.discover {
  max-width: 960px;
  margin: 3rem auto 2rem;
  padding: 0 1.5rem;
  text-align: center;
}

.discover h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.discover .tagline {
  color: var(--text-muted, #a1a1aa);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.search-wrap {
  position: relative;
  margin: 0 auto 2rem;
  max-width: 720px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted, #a1a1aa);
  font-size: 1.1rem;
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 0.85rem 5rem 0.85rem 2.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text, #fff);
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.search-submit-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  width: auto;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  opacity: 0.7;
  z-index: 2;
  pointer-events: auto;
  /* Pin the button so it never drifts when sibling content changes */
  inset-inline-end: 0.5rem;
  inset-block-start: 50%;
}
.search-submit-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.search-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.search-dropdown {
  position: static;
  background: rgba(20, 20, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  backdrop-filter: blur(16px);
  max-height: 480px;
  overflow-y: auto;
  z-index: 50;
  text-align: left;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.search-chips {
  background: rgba(20, 20, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  text-align: left;
}
.search-chips[hidden] { display: none; }
.search-chips-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #a1a1aa);
  margin-right: 0.25rem;
}
.search-chip {
  background: rgba(139, 92, 246, 0.1);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.search-chip:hover { background: rgba(139, 92, 246, 0.22); color: #fff; }

.search-dropdown .group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #a1a1aa);
  padding: 0.75rem 1rem 0.4rem;
}

.search-row {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 0.65rem 1rem;
  cursor: pointer;
  color: var(--text, #fff);
  font-family: inherit;
  transition: background 0.1s;
}

.search-row:hover,
.search-row.focused {
  background: rgba(139, 92, 246, 0.12);
}

.search-row .row-main {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.search-row .row-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted, #a1a1aa);
}

a.search-row { text-decoration: none; }
a.search-row .row-main { color: #93c5fd; }
.search-row-wiki .row-main { color: #93c5fd; }

.search-dropdown .empty,
.search-dropdown .error {
  padding: 1rem;
  color: var(--text-muted, #a1a1aa);
  text-align: center;
  font-size: 0.9rem;
}

/* ==========================================================================
   .sub-form (shared between index.html + submissions.html)
   ========================================================================== */

.sub-form {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 0 auto 2rem;
  max-width: 720px;
  text-align: left;
  backdrop-filter: blur(12px);
}

.sub-tabs {
  display: flex;
  justify-content: center;             /* center the tab group, don't stretch */
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.sub-tab {
  background: none;
  border: none;
  color: var(--text-muted, #a1a1aa);
  padding: 0.7rem 1.25rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  border-radius: 7px;
  min-width: 6rem;                       /* keeps "category" / "entity" / "fact" visually balanced */
  transition: background 0.15s, color 0.15s;
}

.sub-tab:hover {
  color: var(--text, #fff);
  background: rgba(255, 255, 255, 0.04);
}

.sub-tab:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 2px;
}

.sub-tab.active {
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}

.sub-form h2 {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
}

.sub-form .sub-url-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 1rem 0;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(139, 92, 246, 0.14));
  border: 1px solid rgba(110, 231, 183, 0.35);
  color: var(--text, #fff);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: border-color 0.15s, transform 0.15s;
  word-break: break-all;
  animation: sub-url-banner-in 0.25s ease-out;
}
.sub-form .sub-url-banner:hover {
  border-color: rgba(110, 231, 183, 0.7);
  transform: translateY(-1px);
}
.sub-form .sub-url-banner-label {
  color: #6ee7b7;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.7rem;
}
.sub-form .sub-url-banner-url {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.82rem;
  color: var(--text, #fff);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sub-form .sub-url-banner-arrow {
  margin-left: auto;
  font-size: 0.95rem;
  color: #6ee7b7;
  flex-shrink: 0;
}
@keyframes sub-url-banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sub-form .field { margin-bottom: 1rem; }

.sub-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 0.3rem;
}

.sub-form input,
.sub-form select,
.sub-form textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}

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

.sub-form .submit-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  border: none;
  color: #fff;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sub-form .submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.3);
}

.sub-form .submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   .preview-strip (top proposals on main page)
   ========================================================================== */

.preview-strip {
  max-width: 920px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.preview-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.preview-header .see-all {
  font-size: 0.9rem;
  color: var(--text-muted, #a1a1aa);
  text-decoration: none;
  transition: color 0.15s;
}

.preview-header .see-all:hover { color: var(--text, #fff); }

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.preview-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  transition: border-color 0.2s;
}

.preview-row.promoted {
  border-color: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
}

.preview-row .vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 44px;
}

.preview-row .vote-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.preview-row .vote-btn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
}

.preview-row .vote-btn.voted {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  border-color: transparent;
}

.preview-row .vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
}

.preview-row .body .title {
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.preview-row .body .meta {
  font-size: 0.78rem;
  color: var(--text-muted, #a1a1aa);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.preview-empty {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted, #a1a1aa);
}

.preview-empty a {
  color: #ec4899;
  text-decoration: none;
}

/* Proposal sections */
.proposal-section {
  margin-bottom: 1.5rem;
}
.proposal-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.proposal-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #fff);
}
.proposal-section-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.live-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.pending-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.proposal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.6rem;
}
.proposal-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.proposal-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
  transform: translateY(-1px);
}
.proposal-card.live {
  border-left: 3px solid #10b981;
}
.proposal-card.pending {
  border-left: 3px solid #f59e0b;
}
.proposal-card-top {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.proposal-card .vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 36px;
  flex-shrink: 0;
}
.proposal-card .vote-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.proposal-card .vote-btn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
}
.proposal-card .vote-btn.voted {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border-color: transparent;
}
.proposal-card .vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
}
.proposal-card-body {
  flex: 1;
  min-width: 0;
}
.proposal-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.proposal-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}
.proposal-card-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.proposal-card-time {
  font-size: 0.72rem;
  color: var(--text-dim, #71717a);
}

/* ==========================================================================
   .flash (success/error toast)
   ========================================================================== */

.flash {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  z-index: 100;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.flash.success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #10b981;
}

.flash.error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #ef4444;
}

/* ==========================================================================
   .sub-toolbar (sort + live-only controls on submissions page)
   ========================================================================== */

.sub-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.sub-toolbar .left,
.sub-toolbar .right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sub-toolbar select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-family: inherit;
}

.sub-toolbar label {
  font-size: 0.875rem;
  color: var(--text-muted, #a1a1aa);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* ==========================================================================
   .sub-list + .sub-row (full list of proposals on submissions page)
   ========================================================================== */

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sub-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  transition: all 0.3s;
}

.sub-row.promoted {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.sub-row .vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 50px;
}

.sub-row .vote-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.sub-row .vote-btn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
}

.sub-row .vote-btn.voted {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  border-color: transparent;
}

.sub-row .vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
}

.sub-row .body .title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.sub-row .body .meta {
  font-size: 0.8rem;
  color: var(--text-muted, #a1a1aa);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.sub-list-note {
  color: var(--text-muted, #a1a1aa);
  text-align: center;
  padding: 2rem;
}

/* ==========================================================================
   Submissions list debug rows
   ========================================================================== */

.sub-row.debug-active {
  border-color: rgba(139, 92, 246, 0.2);
}

.sub-row-actions {
  display: flex;
  align-items: center;
}

.detail-link {
  font-size: 0.78rem;
  color: #93c5fd;
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

.detail-link:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.5);
}

.sub-row-debug {
  grid-column: 1 / -1;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(139, 92, 246, 0.15);
  margin-top: 0.35rem;
}

.sub-row-debug[hidden] {
  display: none;
}

.debug-row-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.72rem;
}

.debug-tag {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  color: var(--text-muted, #a1a1aa);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.debug-tag.ai {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.debug-tag.mono {
  font-family: 'JetBrains Mono', monospace;
}

.comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted, #a1a1aa);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  cursor: default;
}

/* Submissions page — tighter than site defaults */
.submissions-main {
  max-width: 920px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.hero--compact {
  margin-bottom: 1.5rem;
}

.search-wrap--compact {
  margin: 0 auto 1.5rem;
}

/* ==========================================================================
   .pill (status badges for kind + status)
   ========================================================================== */

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.pill.live {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.pill.rejected {
  background: rgba(113, 113, 130, 0.15);
  color: #71717a;
}
/* --- AI answer card (above search results) --- */
.ai-answer-card {
  max-width: 960px;
  margin: 0 auto 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
  line-height: 1.45;
  overflow: hidden;
  text-align: left;
}
.ai-answer-card[hidden] { display: none; }
.ai-answer-card.streaming .ai-answer-body::after {
  content: "▍";
  animation: ai-blink 1s steps(2) infinite;
}
.ai-answer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 0.4rem;
}
.ai-answer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text, #e4e4e7);
  text-transform: capitalize;
}
.ai-answer-title[hidden] { display: none; }
.ai-answer-body {
  overflow-x: auto;
  overflow-y: hidden;
  word-break: break-word;
}
.ai-answer-cancel {
  margin-left: auto;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  user-select: none;
}
.ai-answer-cancel:hover { opacity: 1; }
.ai-answer-sources {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
}
.ai-answer-sources li a {
  display: inline-block;
  font-size: 0.75rem;
  opacity: 0.75;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  color: inherit;
  text-decoration: none;
}
.ai-answer-sources li a:hover { opacity: 1; }
@keyframes ai-blink { 50% { opacity: 0; } }

/* AI stage progress indicators */
.ai-stage-progress {
  margin: 0.5rem 0;
  padding: 0.5rem 0;
}
.ai-stage-progress[hidden] { display: none; }
.stage-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
}
.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: stage-pulse 1.5s ease-in-out infinite;
}
@keyframes stage-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.stage-check {
  color: #10b981;
  font-weight: 700;
}
.stage-complete .stage-check { color: #10b981; }
.stage-all-done {
  color: #10b981;
  font-weight: 600;
}
.stage-text {
  flex: 1;
}

/* Stage progress indicator */
.ai-stage-progress {
  margin: 0.5rem 0;
  padding: 0.4rem 0;
}
.ai-stage-progress[hidden] { display: none; }

/* Progress bar */
.stage-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.stage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.stage-bar-fill.stage-bar-done {
  background: #10b981;
}

/* Stage indicator row */
.stage-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
}
.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b5cf6;
  animation: stage-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.stage-indicator.stage-complete .stage-dot {
  display: none;
}
.stage-indicator.stage-complete .stage-check {
  display: flex;
}
.stage-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.stage-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  opacity: 0.6;
  min-width: 1.5rem;
}
.stage-text {
  flex: 1;
}
.stage-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #8b5cf6;
  min-width: 3rem;
  text-align: right;
}
.stage-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #10b981;
  min-width: 3rem;
  text-align: right;
}

/* Timing summary */
.stage-timing {
  font-size: 0.78rem;
}
.timing-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.timing-name {
  min-width: 5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted, #a1a1aa);
}
.timing-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
}
.timing-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  border-radius: 2px;
}
.timing-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  min-width: 3rem;
  text-align: right;
  color: var(--text-muted, #a1a1aa);
}
.timing-total {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.2rem;
  padding-top: 0.3rem;
}
.timing-total .timing-name {
  color: var(--text, #fff);
  font-weight: 600;
}
.timing-total .timing-val {
  color: var(--text, #fff);
  font-weight: 600;
}

@keyframes stage-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Table rendering inside the AI answer body */
.ai-answer-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 0.25rem;
  font-size: 0.88rem;
}
.ai-answer-body th,
.ai-answer-body td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.ai-answer-body th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}
.ai-answer-body tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}
.ai-answer-body sup {
  font-size: 0.7em;
  opacity: 0.75;
  margin-left: 0.1em;
}
.ai-answer-body a {
  color: #93c5fd;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Stored table container (for hot list / recent search table views) */
#stored-table {
  max-width: 960px;
  margin: 0 auto 1rem;
  padding: 0 1rem;
}

/* AI-curated table card (shown when user picks an AI-curated search row) */
.ai-curated-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.85rem 1rem 1rem;
  margin: 0.5rem 0;
}
.ai-curated-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.copy-table-btn {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.copy-table-btn:hover { background: rgba(139, 92, 246, 0.22); color: #e0d4fc; border-color: rgba(139, 92, 246, 0.5); }
.copy-table-btn.copied { background: rgba(74, 222, 128, 0.15); color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.ai-curated-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #93c5fd);
  font-weight: 700;
}
.ai-curated-title {
  font-weight: 600;
  color: var(--text, #f5f5f5);
}
.ai-curated-meta {
  font-size: 0.78rem;
  color: var(--text-muted, #a1a1aa);
  margin-left: auto;
}
.ai-curated-body {
  overflow-x: auto;
}
.ai-curated-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.ai-curated-body th,
.ai-curated-body td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.ai-curated-body th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}
.ai-curated-body tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}
.ai-curated-loading,
.ai-curated-empty,
.ai-curated-error {
  padding: 0.85rem 1rem;
  color: var(--text-muted, #a1a1aa);
  font-size: 0.9rem;
}
.ai-curated-error { color: #f87171; }

/* Cell hover highlight and selection for AI questions */
.ai-curated-body td.cell-hover {
  background: rgba(139, 92, 246, 0.15) !important;
  outline: 2px solid rgba(139, 92, 246, 0.5);
  outline-offset: -2px;
  cursor: pointer;
}
.ai-curated-body td.cell-selected {
  background: rgba(139, 92, 246, 0.25) !important;
  outline: 2px solid #8b5cf6;
  outline-offset: -2px;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}
.ai-curated-body th.cell-hover {
  background: rgba(139, 92, 246, 0.12) !important;
  outline: 2px solid rgba(139, 92, 246, 0.5);
  outline-offset: -2px;
  cursor: pointer;
}
.ai-curated-body th.cell-selected {
  background: rgba(139, 92, 246, 0.2) !important;
  outline: 2px solid #8b5cf6;
  outline-offset: -2px;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* AI Cell Question panel */
.cell-question-panel {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  animation: cell-question-slide-in 0.2s ease-out;
}
@keyframes cell-question-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.cell-question-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
}
.cell-question-context {
  display: inline-block;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  color: #c4b5fd;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-question-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.cell-question-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}
.cell-question-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}
.cell-question-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.cell-question-submit {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.cell-question-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}
.cell-question-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.cell-question-close {
  background: none;
  border: none;
  color: var(--text-muted, #a1a1aa);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.3rem;
  line-height: 1;
}
.cell-question-close:hover {
  color: var(--text, #fff);
}
.cell-question-answer {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text, #e2e8f0);
  max-height: 300px;
  overflow-y: auto;
}
.cell-question-answer.streaming {
  color: #67e8f9;
  font-style: italic;
}
.cell-question-answer.streaming::after {
  content: "▍";
  animation: ai-blink 1s steps(2) infinite;
}
.cell-question-answer.error {
  color: #f87171;
}

/* AI ranking table (rendered from JSON block) */
.ai-ranking-table {
  margin: 0.75rem 0;
  overflow-x: auto;
}
.ai-ranking-methodology {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
  margin-bottom: 0.5rem;
  text-align: center;
}
.ai-ranking-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0 auto;
}
.ai-ranking-table th,
.ai-ranking-table td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.ai-ranking-table th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #a1a1aa);
  text-align: center;
}
.ai-ranking-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}
.ai-ranking-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.06);
}
.ai-ranking-table .rank-cell {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  min-width: 2rem;
  cursor: pointer;
}
.ai-ranking-table .rank-cell:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}
.ai-ranking-table .score-cell {
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  cursor: pointer;
}
.ai-ranking-table .score-cell:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}
.ai-ranking-table .justification-cell {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
}
.ai-table-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim, #71717a);
  margin-top: 0.4rem;
  font-style: italic;
}
.ai-ranking-table td[data-entity] {
  cursor: pointer;
  transition: background 0.1s;
}
.ai-ranking-table td[data-entity]:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* Cell detail popup */
.cell-detail-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(18, 18, 26, 0.98);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  padding: 1.25rem;
  z-index: 200;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
}
.cell-detail-popup h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: #c4b5fd;
}
.cell-detail-popup .cell-context {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 0.75rem;
}
.cell-detail-popup input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text, #fff);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 0.6rem;
}
.cell-detail-popup input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
.cell-detail-popup .popup-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.cell-detail-popup .popup-search-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cell-detail-popup .popup-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.cell-detail-popup .popup-challenge-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border: none;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cell-detail-popup .popup-challenge-btn:hover {
  filter: brightness(1.1);
}
.cell-detail-popup .popup-add-col-btn {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border: none;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cell-detail-popup .popup-add-col-btn:hover {
  filter: brightness(1.1);
}
.cell-detail-popup .popup-add-col-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.popup-challenge-response {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}
.challenge-streaming {
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
}
.challenge-streaming::after {
  content: "▍";
  animation: ai-blink 1s steps(2) infinite;
}
.challenge-reply {
  color: var(--text, #fff);
}
.challenge-success {
  color: #10b981;
  margin-bottom: 0.5rem;
}
.challenge-updated {
  color: #10b981;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 6px;
  display: inline-block;
}
.challenge-error {
  color: #ef4444;
  font-size: 0.85rem;
}

/* Consolidation banner */
.consolidation-banner {
  max-width: 960px;
  margin: 0.5rem auto;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.consolidation-text {
  font-size: 0.88rem;
  color: var(--text, #fff);
  flex: 1;
}
.consolidation-text strong {
  color: #f59e0b;
}
.consolidation-actions {
  display: flex;
  gap: 0.5rem;
}
.consolidation-merge-btn {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  border: none;
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.consolidation-merge-btn:hover {
  filter: brightness(1.1);
}
.consolidation-merge-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.consolidation-keep-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}
.consolidation-success {
  color: #10b981;
  font-weight: 600;
  font-size: 0.88rem;
}
.consolidation-error {
  color: #ef4444;
  font-size: 0.85rem;
}

/* Clickable column headers */
.ai-ranking-table th[data-column] {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-ranking-table th[data-column]:hover {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
}
.scaffold-table th.clickable-th {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scaffold-table th.clickable-th:hover {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
}

/* Rank flash animation */
@keyframes rank-flash {
  0% { background: rgba(16, 185, 129, 0.3); }
  100% { background: transparent; }
}

/* Column popup specific */
.column-popup .col-name-input {
  margin-bottom: 0.5rem;
}

/* Code blocks in AI answer */
.ai-code-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted, #a1a1aa);
}

/* Re-study buttons on curated tables */
.ai-curated-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.ai-restudy-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.ai-restudy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}
.ai-restudy-prompt {
  flex: 1;
  min-width: 200px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}
.ai-restudy-prompt:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}
.ai-restudy-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.ai-restudy-status {
  width: 100%;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Copy-link button on the stored-ranking card. Sits next to Flag and
   uses the same compact pill shape but a quieter palette so it doesn't
   compete with the primary "Re-study with AI" CTA. */
.ai-share-btn {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: var(--text, #fff);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
}
.ai-share-btn:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-1px);
}
.ai-share-btn--copied {
  background: rgba(74, 222, 128, 0.18);
  border-color: rgba(74, 222, 128, 0.6);
  color: #86efac;
}
.restudy-streaming {
  color: #67e8f9;
  font-style: italic;
}
.restudy-streaming::after {
  content: "▍";
  animation: ai-blink 1s steps(2) infinite;
}
.restudy-done {
  color: #10b981;
  font-weight: 600;
}

/* Inline meta block (methodology + summary) below the table. Editable on
   click; "Saving…" / "Saved ✓" appears under the field on commit. */
.ai-curated-meta-block {
  margin-top: 0.85rem;
  padding: 0.7rem 0.9rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ai-curated-meta-block .meta-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.ai-curated-meta-block .meta-label {
  flex: 0 0 5.5rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  font-weight: 600;
}
.ai-curated-meta-block .meta-value {
  flex: 1;
  color: #e2e8f0;
  line-height: 1.45;
  padding: 0.15rem 0.35rem;
  border-radius: 5px;
  border: 1px solid transparent;
  outline: none;
  cursor: text;
}
.ai-curated-meta-block .meta-value:hover {
  border-color: rgba(99, 102, 241, 0.25);
}
.ai-curated-meta-block .meta-value:focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(99, 102, 241, 0.5);
}
.ai-curated-meta-block .meta-value:empty::before {
  content: "click to edit";
  color: #64748b;
  font-style: italic;
}
.ai-curated-meta-block .meta-status {
  font-size: 0.75rem;
  color: #67e8f9;
  font-style: italic;
  min-height: 1em;
}

/* Live transcript + summary shown during "Study with AI" / /fill. */
.restudy-transcript {
  margin-top: 0.4rem;
  padding: 0.45rem 0.55rem;
  background: rgba(15, 23, 42, 0.65);
  border-left: 2px solid #6366f1;
  border-radius: 4px;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 8rem;
  overflow-y: auto;
}
.restudy-summary {
  margin-top: 0.4rem;
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Flag button for bad tables */
.ai-flag-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  margin-left: auto;
}
.ai-flag-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
}
.ai-flag-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Search history panel */
.search-history {
  max-width: 960px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .search-history { grid-template-columns: 1fr; }
}
.history-section {
  min-width: 0;
}
.history-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.history-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #fff);
}
.history-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
  margin-left: auto;
}
.hot-toggle,
.recent-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hot-list,
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 500px;
  overflow-y: auto;
}
.hot-list[hidden],
.recent-list[hidden] { display: none; }
.history-row {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.history-row:hover {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
}
.hot-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hot-rank {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-dim, #71717a);
  min-width: 1.75rem;
  text-align: center;
  flex-shrink: 0;
}
.hot-rank.rank-1 { color: #f59e0b; text-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
.hot-rank.rank-2 { color: #c0c0c0; }
.hot-rank.rank-3 { color: #cd7f32; }
.hot-info {
  flex: 1;
  min-width: 0;
}
.hot-count {
  font-size: 0.75rem;
  color: #ec4899;
  font-weight: 600;
}
.history-query {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta {
  display: flex;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted, #a1a1aa);
  flex-wrap: wrap;
}
.history-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.history-view-btn,
.history-ask-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
  white-space: nowrap;
}
.history-view-btn:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}
.history-ask-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}
.history-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-dim, #71717a);
  font-size: 0.85rem;
}

/* ==========================================================================
   Proposal detail page (/submissions/detail?id=X)
   ========================================================================== */

.proposal-detail-main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.loading-note {
  color: var(--text-muted, #a1a1aa);
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1rem;
}

.loading-note a {
  color: #ec4899;
  text-decoration: none;
}

.loading-note a:hover {
  text-decoration: underline;
}

.detail-header {
  margin-bottom: 1.5rem;
}

.detail-back {
  color: var(--text-muted, #a1a1aa);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}

.detail-back:hover {
  color: var(--text, #fff);
}

.detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}

.detail-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detail-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 60px;
}

.detail-vote .vote-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.detail-vote .vote-btn:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
}

.detail-vote .vote-btn.voted {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  border-color: transparent;
}

.detail-vote .vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
}

.detail-title-col h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.detail-time {
  font-size: 0.8rem;
  color: var(--text-dim, #71717a);
}

.detail-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.detail-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-muted, #a1a1aa);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-field {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.detail-label {
  min-width: 140px;
  font-size: 0.85rem;
  color: var(--text-dim, #71717a);
  font-weight: 600;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--text, #fff);
  word-break: break-word;
}

.detail-value.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
}

.detail-value a {
  color: #93c5fd;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.detail-help-text {
  color: var(--text-muted, #a1a1aa);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.detail-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-actions .btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .detail-top {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .detail-vote-col {
    flex-direction: row;
    gap: 1rem;
  }

  .detail-field {
    flex-direction: column;
    gap: 0.25rem;
  }

  .detail-label {
    min-width: auto;
  }
}

/* ==========================================================================
   Editable fields (proposal detail page)
   ========================================================================== */

.edit-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.edit-label {
  font-size: 0.82rem;
  color: var(--text-dim, #71717a);
  font-weight: 600;
}

.edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.edit-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.edit-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

textarea.edit-input {
  min-height: 70px;
  resize: vertical;
}

select.edit-input {
  cursor: pointer;
}

.edit-save-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 60px;
}

.edit-save-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.edit-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edit-status {
  font-size: 0.78rem;
  min-height: 1.2em;
  transition: color 0.15s;
}

.edit-status.success {
  color: #10b981;
}

.edit-status.error {
  color: #ef4444;
}

/* ==========================================================================
   AI Evaluation result (proposal detail page)
   ========================================================================== */

.eval-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.eval-hint {
  font-size: 0.85rem;
  color: var(--text-muted, #a1a1aa);
}

.eval-result {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.eval-result[hidden] {
  display: none;
}

.eval-changes {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.eval-changes h4 {
  font-size: 0.9rem;
  color: #10b981;
  margin-bottom: 0.5rem;
}

.eval-changes ul {
  list-style: none;
  padding: 0;
}

.eval-changes li {
  padding: 0.3rem 0;
  font-size: 0.88rem;
}

.eval-old {
  color: #ef4444;
  text-decoration: line-through;
  opacity: 0.7;
}

.eval-new {
  color: #10b981;
  font-weight: 600;
}

.eval-reasoning {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.eval-reasoning h4 {
  font-size: 0.9rem;
  color: #c4b5fd;
  margin-bottom: 0.5rem;
}

.eval-reasoning p {
  font-size: 0.88rem;
  color: var(--text-muted, #a1a1aa);
  line-height: 1.5;
}

.eval-ranked {
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  color: #10b981;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.eval-ranked a {
  color: #93c5fd;
  text-decoration: underline;
}

.eval-feedback {
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  color: #f59e0b;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.eval-raw {
  margin-top: 0.75rem;
}

.eval-raw summary {
  font-size: 0.82rem;
  color: var(--text-dim, #71717a);
  cursor: pointer;
  user-select: none;
}

.eval-raw pre {
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted, #a1a1aa);
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   Debug panel (proposal detail page)
   ========================================================================== */

.debug-section {
  border-top: 2px solid rgba(139, 92, 246, 0.2);
  padding-top: 1.5rem;
}

.debug-section h2 {
  color: #c4b5fd;
}

.debug-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.debug-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.85rem;
}

.debug-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted, #a1a1aa);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.debug-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.debug-key {
  color: var(--text-dim, #71717a);
  font-weight: 600;
}

.debug-json {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.65rem;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted, #a1a1aa);
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.debug-table th,
.debug-table td {
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.5rem;
  text-align: left;
}

.debug-table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--text-dim, #71717a);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.debug-empty {
  color: var(--text-dim, #71717a);
  font-size: 0.82rem;
  font-style: italic;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
}

/* ==========================================================================
   Comments section (proposal detail page)
   ========================================================================== */

.comment-form {
  margin-bottom: 1.5rem;
}

.comment-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.comment-textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.comment-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.comment-char-count {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
}

.comment-char-count.over-limit {
  color: #ef4444;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comments-count {
  font-size: 0.82rem;
  color: var(--text-dim, #71717a);
  margin-bottom: 0.5rem;
}

.comments-loading,
.comments-empty,
.comments-error {
  padding: 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted, #a1a1aa);
}

.comments-error {
  color: #f87171;
}

.comment-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.75rem;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.comment-author {
  font-size: 0.82rem;
  color: #c4b5fd;
  font-weight: 600;
}

.comment-time {
  font-size: 0.75rem;
  color: var(--text-dim, #71717a);
}

.comment-body {
  font-size: 0.9rem;
  color: var(--text, #fff);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   Activity feed (live AI status)
   ========================================================================== */

.activity-feed {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.85rem;
}

.activity-compact {
  max-height: 300px;
  overflow-y: auto;
}

.activity-header-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(139, 92, 246, 0.08);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.activity-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.activity-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  margin-left: auto;
}

.stat-active {
  color: #10b981;
  text-decoration: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.stat-active:hover {
  background: rgba(16, 185, 129, 0.15);
  text-decoration: underline;
}
.stat-completed { color: var(--text-dim, #71717a); }
.stat-failed { color: #ef4444; }

.activity-actions {
  display: flex;
  gap: 0.35rem;
}

.activity-clear,
.activity-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
}

.activity-clear:hover,
.activity-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.activity-list[hidden] {
  display: none;
}

.activity-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-dim, #71717a);
  font-size: 0.82rem;
}

.activity-entry {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s;
}

.activity-entry:last-child {
  border-bottom: none;
}

.activity-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}

.activity-entry.status-started {
  border-left: 3px solid #10b981;
}

.activity-entry.status-streaming {
  border-left: 3px solid #3b82f6;
}

.activity-entry.status-completed,
.activity-entry.status-persisted {
  border-left: 3px solid rgba(255, 255, 255, 0.1);
}

.activity-entry.status-failed {
  border-left: 3px solid #ef4444;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.activity-icon {
  font-size: 0.85rem;
}

.activity-kind {
  font-weight: 600;
  color: var(--text, #fff);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.activity-status {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}

.activity-status.status-started {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.activity-status.status-streaming {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.activity-status.status-completed,
.activity-status.status-persisted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim, #71717a);
}

.activity-status.status-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.activity-time {
  font-size: 0.7rem;
  color: var(--text-dim, #71717a);
  margin-left: auto;
}

.activity-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.78rem;
}

.activity-query {
  color: #93c5fd;
  font-style: italic;
}

.activity-slug {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #c4b5fd;
}

.activity-detail {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-dim, #71717a);
  margin-top: 0.15rem;
}

/* Activity feed in sidebar position */
.activity-sidebar {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 360px;
  max-height: 50vh;
  z-index: 90;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .activity-sidebar {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
  }
}

/* ==========================================================================
   Status page (/status)
   ========================================================================== */

.status-main {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.status-card h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim, #71717a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.status-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text, #fff);
}

.status-section {
  margin-bottom: 2rem;
}

.status-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-muted, #a1a1aa);
}

.tables-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.table-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.table-slug {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #c4b5fd;
}

.table-meta {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
}

/* Audit-trail debug panel + click-count badge for search-history / stored
   ranking cards. Lets users (and us debugging production) see how a table
   has been used without grepping logs. Added 2026-08-24 alongside the
   /api/ai-curated/{slug}/stats endpoint. */
.click-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.08);
  border: 1px solid rgba(147, 197, 253, 0.18);
  border-radius: 4px;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.ai-curated-debug {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.debug-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim, #a1a1aa);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.debug-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #fff);
}

.debug-toggle[aria-expanded="true"] {
  background: rgba(196, 181, 253, 0.08);
  color: #c4b5fd;
  border-color: rgba(196, 181, 253, 0.25);
}

.debug-panel {
  margin-top: 0.65rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-muted, #d4d4d8);
}

.debug-panel[hidden] { display: none; }

.debug-section {
  margin-bottom: 0.55rem;
}

.debug-section:last-child { margin-bottom: 0; }

.debug-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.debug-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.debug-badge.debug-ok {
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.debug-badge.debug-missing {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.debug-counters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}

.debug-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.debug-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text, #fff);
  line-height: 1.1;
}

.debug-lbl {
  font-size: 0.68rem;
  color: var(--text-dim, #71717a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Enhanced debug panel styles */
.debug-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.debug-grid {
  margin-bottom: 0.5rem;
}

.debug-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

.debug-key {
  color: var(--text-dim, #71717a);
  font-weight: 500;
}

.debug-val {
  color: var(--text, #fff);
}

.debug-columns {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.debug-col-tag {
  display: inline-block;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #c4b5fd;
  margin: 0.15rem;
}

.debug-counters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.debug-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.debug-counter-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text, #fff);
  line-height: 1.1;
}

.debug-counter-label {
  font-size: 0.68rem;
  color: var(--text-dim, #71717a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.debug-counter-time {
  font-size: 0.65rem;
  color: var(--text-dim, #71717a);
  margin-top: 0.2rem;
}

.debug-meta-field {
  font-size: 0.78rem;
  color: var(--text-muted, #d4d4d8);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.debug-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.debug-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.debug-action-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}
  margin-top: 0.15rem;
}

.debug-section .debug-lbl {
  display: inline-block;
  margin-right: 0.3rem;
}

.debug-section code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #c4b5fd;
  background: rgba(196, 181, 253, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.debug-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.3rem 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--text-dim, #a1a1aa);
}

.debug-loading,
.debug-error {
  color: var(--text-dim, #a1a1aa);
  font-style: italic;
}

.debug-error { color: #f87171; }

/* ==========================================================================
   Editable title + column headers (contenteditable focus styles)
   ========================================================================== */

.ai-curated-title[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  cursor: text;
  padding: 0 0.15rem;
  border-radius: 3px;
  transition: background 0.15s ease;
}
.ai-curated-title[contenteditable="true"]:hover,
.ai-curated-title[contenteditable="true"]:focus {
  background: rgba(255, 255, 255, 0.04);
}
.ai-curated-body th[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  cursor: text;
}
.title-edit-status {
  font-size: 0.78rem;
  color: var(--text-dim, #a1a1aa);
  margin-left: 0.5rem;
}
.inline-error {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 6px;
  color: #fca5a5;
  font-size: 0.85rem;
}

/* ==========================================================================
   Related Web Links section (collapsible panel + suggest-link input)
   ========================================================================== */

.ai-curated-links {
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.75rem;
}
.links-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}
.links-toggle:hover { background: rgba(255, 255, 255, 0.04); }
.links-toggle[aria-expanded="true"] { background: rgba(196, 181, 253, 0.08); }
.links-count { color: var(--text-dim, #a1a1aa); font-size: 0.78rem; }
.links-panel { margin-top: 0.65rem; }
.links-fetch-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0 0 0.65rem 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.links-fetch-web-btn {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.links-fetch-web-btn:hover:not(:disabled) { background: rgba(56, 189, 248, 0.2); }
.links-fetch-web-btn:disabled { opacity: 0.6; cursor: progress; }
.links-search-self {
  color: #93c5fd;
  font-size: 0.82rem;
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(147, 197, 253, 0.2);
  border-radius: 6px;
}
.links-search-self:hover { background: rgba(147, 197, 253, 0.08); text-decoration: underline; }
.links-fetch-status {
  font-size: 0.8rem;
  color: var(--text-dim, #a1a1aa);
  font-style: italic;
}
/* Find related on rnkd section */
.ai-curated-related { margin-top: 0.85rem; }
.related-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}
.related-toggle:hover { background: rgba(255, 255, 255, 0.04); }
.related-toggle[aria-expanded="true"] { background: rgba(56, 189, 248, 0.08); }
.related-count { color: var(--text-dim, #a1a1aa); font-size: 0.78rem; }
.related-panel { margin-top: 0.65rem; }
.related-list { display: flex; flex-direction: column; gap: 0.4rem; }
.related-loading,
.related-empty {
  color: var(--text-dim, #a1a1aa);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.4rem 0;
}
.related-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.7rem;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text, #fff);
  transition: background 0.15s, border-color 0.15s;
}
.related-item:hover { background: rgba(56, 189, 248, 0.14); border-color: rgba(56, 189, 248, 0.35); }
.related-item-title { font-weight: 600; font-size: 0.9rem; color: #38bdf8; }
.related-item-score { font-size: 0.72rem; color: var(--text-dim, #a1a1aa); white-space: nowrap; }
/* AI data-source suggestions */
.ai-curated-suggestions { margin-top: 0.85rem; }
.suggestions-toggle {
  background: transparent;
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: #fbbf24;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}
.suggestions-toggle:hover { background: rgba(251, 191, 36, 0.08); }
.suggestions-toggle[aria-expanded="true"] { background: rgba(251, 191, 36, 0.12); }
.suggestions-count { color: var(--text-dim, #a1a1aa); font-size: 0.78rem; }
.suggestions-panel { margin-top: 0.65rem; }
.suggestions-help { font-size: 0.82rem; color: var(--text-dim, #a1a1aa); margin: 0 0 0.6rem; }
.suggestions-loading,
.suggestions-empty { font-size: 0.85rem; color: var(--text-dim, #a1a1aa); font-style: italic; padding: 0.3rem 0; }
.suggestions-list { display: flex; flex-direction: column; gap: 0.5rem; }
.suggestion-item {
  background: rgba(251, 191, 36, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.suggestion-head { display: flex; align-items: center; gap: 0.5rem; justify-content: space-between; }
.suggestion-head a { color: #fcd34d; font-weight: 600; text-decoration: none; }
.suggestion-head a:hover { text-decoration: underline; }
.suggestion-why { font-size: 0.82rem; color: var(--text-dim, #a1a1aa); margin-top: 0.2rem; }
.suggestion-effort {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem; border-radius: 999px; font-weight: 600;
}
.effort-low { background: rgba(74, 222, 128, 0.14); color: #4ade80; }
.effort-medium { background: rgba(251, 191, 36, 0.14); color: #fbbf24; }
.effort-high { background: rgba(248, 113, 113, 0.14); color: #f87171; }
.links-empty {
  color: var(--text-dim, #a1a1aa);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.5rem 0;
}
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
}
.links-row a { color: #93c5fd; }
.link-source {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
}
.link-source-ai {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.25);
}
.link-source-user {
  background: rgba(147, 197, 253, 0.1);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.25);
}
.link-source-web {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.link-relevance {
  font-size: 0.8rem;
  color: var(--text-dim, #a1a1aa);
  flex-basis: 100%;
}
.suggest-link-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.suggest-link-input {
  flex: 2;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.suggest-link-note {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.suggest-link-btn {
  background: rgba(196, 181, 253, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(196, 181, 253, 0.25);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.suggest-link-btn:hover { background: rgba(196, 181, 253, 0.18); }
.suggest-link-status {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-dim, #a1a1aa);
}
.link-progress { font-style: italic; }
.link-error { color: #fca5a5; }
.link-hint { color: #fde68a; }
.link-done { color: #4ade80; font-weight: 600; }

/* Keyword verification badges */
.link-keyword-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
}
.link-keyword-badge.keyword-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.link-keyword-badge.keyword-low {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.link-keywords-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a1a1aa);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}
.link-keywords-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

/* Keyword check result during suggest */
.link-keyword-result {
  padding: 0.5rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  font-size: 0.82rem;
}
.link-keyword-result.keyword-ok {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.link-keyword-result.keyword-low {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}
.keyword-detail {
  margin-top: 0.3rem;
  font-size: 0.78rem;
}
.keyword-found {
  display: inline-block;
  background: rgba(16, 185, 129, 0.2);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  margin: 0.1rem;
  font-size: 0.72rem;
}
.keyword-missing {
  display: inline-block;
  background: rgba(239, 68, 68, 0.2);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  margin: 0.1rem;
  font-size: 0.72rem;
  text-decoration: line-through;
}

/* Keywords editor popup */
.keywords-editor-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elevated, #12121a);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  z-index: 1000;
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.keywords-editor-popup h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text, #fff);
}
.keywords-help {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.keywords-current {
  margin-bottom: 1rem;
}
.keywords-current label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim, #71717a);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.keywords-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #c4b5fd;
}
.keyword-remove {
  background: none;
  border: none;
  color: var(--text-muted, #a1a1aa);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
}
.keyword-remove:hover {
  color: #ef4444;
}
.keywords-add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.keywords-add-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
}
.keywords-add-input:focus {
  outline: none;
  border-color: #8b5cf6;
}
.keywords-add-btn {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.keywords-add-btn:hover {
  background: rgba(139, 92, 246, 0.3);
}
.keywords-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.keywords-verify-btn {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.keywords-verify-btn:hover {
  background: rgba(16, 185, 129, 0.25);
}
.keywords-close-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #a1a1aa);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}
.keywords-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.keywords-status {
  margin-top: 0.75rem;
  font-size: 0.82rem;
}
.keywords-progress {
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
}
.keywords-result {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.82rem;
}
.keywords-error {
  color: #fca5a5;
}

/* Add Column Section */
.ai-curated-columns-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.columns-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
}
.add-column-btn {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.add-column-btn:hover {
  background: rgba(139, 92, 246, 0.25);
}
.columns-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.column-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted, #a1a1aa);
}
.add-column-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.add-column-name,
.add-column-desc {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}
.add-column-name:focus,
.add-column-desc:focus {
  outline: none;
  border-color: #8b5cf6;
}
.add-column-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.add-column-submit {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.add-column-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}
.add-column-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.add-column-cancel {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #a1a1aa);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
.add-column-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}
.add-column-status {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}
.add-col-progress {
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
}
.add-col-done {
  color: #10b981;
  font-weight: 600;
}
.add-col-error {
  color: #fca5a5;
}

/* Keywords Section (on /top/ page) */
.ai-curated-keywords-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.keywords-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}
.keywords-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
}
.keywords-help {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
  margin-bottom: 0.75rem;
}
.keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.keywords-empty {
  font-size: 0.82rem;
  color: var(--text-dim, #71717a);
  font-style: italic;
  padding: 0.25rem 0;
}
.keywords-edit-row {
  display: flex;
  gap: 0.5rem;
}
.keywords-edit-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
}
.keywords-edit-input:focus {
  outline: none;
  border-color: #8b5cf6;
}
.keywords-edit-btn {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}
.keywords-edit-btn:hover {
  background: rgba(139, 92, 246, 0.25);
}

/* ==========================================================================
   Title source badge (Task 11 — AI vs fallback indicator)
   ========================================================================== */

.title-source-badge {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.15em 0.55em;
  border-radius: 0.5em;
  font-size: 0.78em;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.title-source-badge.ai {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18) 0%, rgba(236, 72, 153, 0.18) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}
.title-source-badge.fallback {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #a1a1aa);
}

/* ==========================================================================
   Live slug preview strip (Task 11 — instant derive preview)
   ========================================================================== */

.slug-preview {
  display: block;
  margin-top: 0.5em;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.85em;
  color: var(--text-muted, #a1a1aa);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.4em 0.65em;
  border-left: 3px solid rgba(139, 92, 246, 0.5);
  border-radius: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}
.slug-preview:empty::before {
  content: "Type keywords above to preview slug…";
  opacity: 0.5;
  font-style: italic;
}

/* Title preview (used alongside slug-preview; lives next to the badge) */
.title-preview {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.92em;
  color: var(--text, #fff);
}

/* Add More Rows Section */
.ai-curated-add-rows-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.add-rows-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.add-rows-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
}
.add-rows-current {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.add-rows-help {
  font-size: 0.78rem;
  color: var(--text-dim, #71717a);
  margin-bottom: 0.75rem;
}
.add-rows-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.add-rows-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.add-rows-input-row label {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  white-space: nowrap;
}
.add-rows-count {
  width: 70px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}
.add-rows-count:focus {
  outline: none;
  border-color: #8b5cf6;
}
.add-rows-prompt {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  box-sizing: border-box;
}
.add-rows-prompt:focus {
  outline: none;
  border-color: #8b5cf6;
}
.add-rows-submit {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.add-rows-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.add-rows-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.add-rows-status {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}
.add-rows-progress {
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
}
.add-rows-done {
  color: #10b981;
  font-weight: 600;
}
.add-rows-error {
  color: #fca5a5;
}
.add-rows-system {
  font-size: 0.85em;
  opacity: 0.7;
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.add-rows-cancel {
  margin-left: 8px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid #999;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}
.add-rows-cancel:hover { background: rgba(0,0,0,0.05); }

/* --- Phase 5.3: AI health pill --------------------------------------------
   Mounted on every page. Fixed bottom-right corner, small + subtle.
   Color follows the latest /api/health/ai status. */
.ai-health-pill {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.92);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  user-select: none;
  cursor: default;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.ai-health-pill::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #a1a1aa;
  flex-shrink: 0;
}
.ai-health-pill--ok {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.25);
}
.ai-health-pill--ok::before {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.55);
}
.ai-health-pill--slow {
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.25);
}
.ai-health-pill--slow::before {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.55);
}
.ai-health-pill--down {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.35);
}
.ai-health-pill--down::before {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}
.ai-health-pill--unknown {
  color: #d4d4d8;
  border-color: rgba(212, 212, 216, 0.18);
}
.ai-health-pill--unknown::before {
  background: #71717a;
}

/* --- Phase 5.4: stale-view banner on /top/<slug> when AI is down --------- */
.stale-view-banner {
  margin: 0 auto 1.25rem;
  max-width: 900px;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  font-size: 0.95rem;
  line-height: 1.45;
}
.stale-view-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.stale-view-banner__msg strong {
  color: #fee2e2;
}
.stale-view-banner__btn {
  appearance: none;
  border: 1px solid rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.15);
  color: #fee2e2;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-family: inherit;
}
.stale-view-banner__btn:hover {
  background: rgba(239, 68, 68, 0.28);
}
.stale-view-banner__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.stale-view-banner__sub {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #fca5a5;
  font-style: italic;
}

/* ==========================================================================
   Wisdom card (formula + last-verified + factors)
   Surfaces the actual formula in plain language with confidence, on every
   category detail page. Drives the "show, don't just claim" trust signal.
   ========================================================================== */

.wisdom-card {
  max-width: 720px;
  margin: 0 auto 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.06),
    rgba(236, 72, 153, 0.04));
}
.wisdom-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}
.wisdom-row:last-of-type { border-bottom: none; }
.wisdom-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
  min-width: 7.5rem;
}
.wisdom-formula {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  color: #fbbf24;
  word-break: break-word;
}
.wisdom-verified {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.wisdom-factors {
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
}
.wisdom-factors summary {
  cursor: pointer;
  color: var(--primary-from);
  font-size: 0.85rem;
  font-weight: 600;
}
.wisdom-factors summary:hover { color: var(--primary-to); }
.factor-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.factor-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.factor-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.85rem;
}
.factor-weight {
  font-family: 'JetBrains Mono', monospace;
  background: var(--primary-from);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  align-self: start;
}
.factor-desc {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.wisdom-mutation {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.wisdom-mutation a { color: var(--primary-from); }

/* Entity-meta line inside the table */
.entity-meta {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

/* ==========================================================================
   Changelog page
   ========================================================================== */
.changelog-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.changelog-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}
.changelog-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}
.changelog-version {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  background: var(--primary-gradient);
  color: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
}
.changelog-slug {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-weight: 600;
}
.changelog-time {
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.changelog-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.55rem;
}
.changelog-formula summary {
  cursor: pointer;
  color: var(--primary-from);
  font-size: 0.8rem;
  font-weight: 600;
}
.changelog-formula pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #e5e7eb;
  margin: 0.5rem 0 0;
  overflow-x: auto;
}

/* ==========================================================================
   Your Rank form
   ========================================================================== */
.your-rank-form {
  max-width: 560px;
  margin: 0 auto 2rem;
  text-align: left;
}
.your-rank-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.your-rank-input-wrap {
  display: flex;
  gap: 0.5rem;
}
.your-rank-input-wrap input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.your-rank-input-wrap input:focus {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 0;
  border-color: transparent;
}
.rank-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.rank-chip {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.78rem;
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.rank-chip:hover {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.08);
}

/* =========================================================================
   /hot/ — magazine-quality ranking page
   Layered: hero · featured · list · methodology. Designed to compete with
   the best hot-ranking pages on the web. Dark-mode-first, accessible,
   share-aware. Hover, focus, and motion-reduce all taste-tested below.
   ========================================================================= */

.hot-main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }

/* --- HERO ----------------------------------------------------------------- */

.hot-hero {
  text-align: center;
  padding: 3rem 0 2rem;
  position: relative;
}
.hot-hero::before {
  /* Soft glow halo behind the title */
  content: "";
  position: absolute;
  top: -20%;
  left: 50%;
  width: 60%;
  height: 160%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(236, 72, 153, 0.25), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
.hot-hero--empty::before { display: none; }
.hot-hero-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.hot-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  background: linear-gradient(135deg, #fff, #fbbf24 30%, #ec4899 75%, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hot-flame {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  display: inline-block;
  filter: drop-shadow(0 0 28px rgba(236, 72, 153, 0.55));
  animation: hot-flame-flicker 3s ease-in-out infinite;
}
@keyframes hot-flame-flicker {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .hot-flame { animation: none; }
}
.hot-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  vertical-align: middle;
}
.hot-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: hot-live-pulse 1.6s ease-in-out infinite;
}
@keyframes hot-live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .hot-live-dot { animation: none; }
}
.hot-tagline {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--text-muted);
  margin: 0 0 0.65rem;
  font-weight: 500;
}
.hot-subline {
  max-width: 620px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* --- STATS GRID ----------------------------------------------------------- */

.hot-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  max-width: 920px;
  margin: 2.5rem auto 0;
}
.hot-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.hot-stat:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
}
.hot-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hot-stat-num--accent {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hot-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  margin-top: 0.4rem;
}

/* --- FEATURED #1 CARD ---------------------------------------------------- */

.hot-featured {
  display: grid;
  grid-template-columns: auto 1fr 260px;
  gap: 1.5rem;
  align-items: center;
  max-width: 980px;
  margin: 2.5rem auto;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 18px);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(236, 72, 153, 0.05) 60%, rgba(139, 92, 246, 0.04)),
    var(--bg-card);
  position: relative;
  overflow: hidden;
}
.hot-featured::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, #fbbf24 0%, #ec4899 50%, #8b5cf6 100%);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.hot-featured-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.hot-featured-medal {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.6));
}
.hot-featured-rank {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fbbf24;
}
.hot-featured-body { min-width: 0; }
.hot-featured-query {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: break-word;
}
.hot-featured-slug {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.85rem;
}
.hot-featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.hot-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}
.hot-meta-pill--big {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-size: 0.92rem;
}
.hot-meta-pill--big strong {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  margin-right: 0.15rem;
  font-size: 1.05rem;
}
.hot-meta-pill--muted {
  color: var(--text-muted);
  font-size: 0.72rem;
}
.hot-featured-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  background: var(--primary-gradient);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}
.hot-featured-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}
.hot-featured-chart {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  min-width: 0;
}
.hot-featured-chart-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}
.hot-featured-chart svg { width: 100% !important; height: 56px !important; }

/* --- TREND PILLS (used in featured + rows) -------------------------------- */
.hot-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0;
}
.hot-trend .trend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.trend-rising   { color: #6ee7b7; }
.trend-rising .trend-dot { background: #10b981; box-shadow: 0 0 6px #10b981; }
.trend-steady   { color: #93c5fd; }
.trend-steady .trend-dot { background: #3b82f6; box-shadow: 0 0 6px #3b82f6; }
.trend-cooling  { color: #fca5a5; }
.trend-cooling .trend-dot { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.trend-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: currentColor;
  opacity: 0.85;
}

/* --- LIST SECTION --------------------------------------------------------- */

.hot-list-section { margin: 3rem auto 0; max-width: 1180px; }
.hot-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.hot-list-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0;
}
.hot-filter-input {
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}
.hot-filter-input:focus {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 0;
  border-color: transparent;
}
.hot-filter-input::placeholder { color: var(--text-dim); }
.hot-empty-filter {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 0.6rem;
}

/* --- TABLE (overrides the basic 4-col table earlier in the file) ---------- */

.hot-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.hot-tr {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 130px 90px 80px 80px 70px 36px;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
}
.hot-tr--head {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.hot-tr--body {
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.12s, transform 0.12s;
  position: relative;
}
.hot-tr--body:first-of-type { border-top: none; }
.hot-tr--body:hover {
  background: rgba(139, 92, 246, 0.07);
}
.hot-tr--body:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.55);
  outline-offset: -2px;
}
.hot-tr--body.is-hidden {
  display: none;
}
.hot-tr--head .hot-cell--arrow { width: 36px; }

.hot-cell--rank   { justify-self: center; }
.hot-cell--query  { min-width: 0; }
.hot-cell--trend  { justify-self: start; }
.hot-cell--spark  { justify-self: start; min-width: 80px; }
.hot-cell--count  { justify-self: end; font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.hot-cell--last   { justify-self: end; color: var(--text-muted); font-size: 0.78rem; }
.hot-cell--open   { justify-self: end; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.hot-cell--arrow  { justify-self: center; color: var(--text-muted); font-size: 1rem; transition: color 0.15s, transform 0.15s; }
.hot-tr--body:hover .hot-cell--arrow {
  color: var(--text);
  transform: translateX(2px);
}

.hot-query-main {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hot-query-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sparkline colours by rank */
.hot-spark { display: block; }

.rank-2 .hot-cell--rank .rank-badge { background: rgba(192, 192, 192, 0.12); color: #e5e7eb; border-color: rgba(192, 192, 192, 0.4); }
.rank-3 .hot-cell--rank .rank-badge { background: rgba(205, 127, 50, 0.18); color: #d97706; border-color: rgba(205, 127, 50, 0.45); }
.rank-4 .hot-cell--rank .rank-badge { background: rgba(255, 255, 255, 0.04); color: #fbbf24; border-color: rgba(245, 158, 11, 0.30); }

/* Responsive — collapse less-essential columns on small screens */
@media (max-width: 880px) {
  .hot-tr { grid-template-columns: 44px minmax(0, 1fr) 90px 60px 70px 36px; }
  .hot-cell--last, .hot-cell--open, .hot-cell--spark { display: none; }
  .hot-tr--head .hot-cell--last,
  .hot-tr--head .hot-cell--open,
  .hot-tr--head .hot-cell--spark { display: none; }
  .hot-featured {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hot-featured-mark { flex-direction: row; justify-content: center; }
  .hot-featured-meta { justify-content: center; }
  .hot-featured-cta { justify-content: center; }
  .hot-featured-chart { max-width: 320px; margin: 0 auto; }
}
@media (max-width: 540px) {
  .hot-featured-meta .hot-meta-pill { font-size: 0.7rem; }
}

/* --- METHODOLOGY FOOTER --------------------------------------------------- */

.hot-methodology {
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 18px);
  background: linear-gradient(135deg,
    rgba(6, 182, 212, 0.05),
    rgba(139, 92, 246, 0.04));
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.hot-methodology h2 {
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 0 0 0.65rem;
  color: var(--text);
}
.hot-methodology-lead {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.hot-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.hot-method-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.hot-method-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}
.hot-method-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.hot-method-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.hot-method-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.hot-method-footer a {
  color: var(--primary-from);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted var(--primary-from);
}

/* --- EMPTY STATE ---------------------------------------------------------- */

.hot-empty-state {
  text-align: center;
  padding: 3rem 1rem 4rem;
  max-width: 540px;
  margin: 0 auto;
}
.hot-empty-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.hot-empty-state h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.hot-empty-state p  { color: var(--text-muted); line-height: 1.55; }

/* Clickable link to the offending content for flagged event details */
.log-detail-target-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  max-width: 100%;
  transition: background 0.15s, border-color 0.15s;
}
.log-detail-target-link:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: var(--primary-from);
}
.log-detail-target-arrow {
  font-size: 0.78rem;
  color: var(--primary-from);
}

/* Cell-popup variants — challenge needs a ranking context to work. */
.popup-no-slug.warning {
  font-size: 0.78rem;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}
.challenge-error {
  font-size: 0.82rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  line-height: 1.4;
}

/* ==========================================================================
   /live/ — Live Rankings public dashboard
   Hero · "in flight" grid · "recently completed" timeline · help callout
   ========================================================================== */

.live-main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }

.live-hero { text-align: center; padding: 2.5rem 0 2rem; position: relative; }
.live-hero::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 50%;
  width: 70%;
  height: 130%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(16, 185, 129, 0.20), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
.live-hero-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.live-hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
  background: linear-gradient(135deg, #10b981, #06b6d4 50%, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.live-pulse {
  display: inline-flex;
  gap: 0.18rem;
  align-items: center;
}
.live-pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: live-pulse-anim 1.4s ease-in-out infinite;
}
.live-pulse-dot:nth-child(2) { animation-delay: 0.15s; }
.live-pulse-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes live-pulse-anim {
  0%, 100% { opacity: 0.4; transform: scale(0.7); }
  50%      { opacity: 1; transform: scale(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .live-pulse-dot { animation: none; opacity: 1; transform: scale(1); }
}
.live-tagline {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  margin: 0 0 0.65rem;
  font-weight: 500;
}
.live-subline {
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.55;
}

.live-section {
  margin-top: 2.5rem;
  padding: 0;
}
.live-section-head {
  margin-bottom: 1rem;
}
.live-section-head h2 {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.3rem;
  color: var(--text);
}
.live-section-head p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}
.live-section-count {
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-size: 1.3rem;
  font-weight: 800;
  margin-right: 0.3rem;
}

/* In-flight grid */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.live-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.live-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary-from), var(--primary-to));
}
.live-card--streaming::before { background: linear-gradient(180deg, #06b6d4, #3b82f6); }
.live-card--started::before   { background: linear-gradient(180deg, #10b981, #14b8a6); }
.live-card--error::before     { background: var(--error); }
.live-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.live-card-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}
.live-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}
.live-card--streaming .live-card-status { color: #67e8f9; background: rgba(6, 182, 212, 0.14); }
.live-card--started   .live-card-status { color: #6ee7b7; background: rgba(16, 185, 129, 0.14); }
.live-card--error     .live-card-status { color: #fca5a5; background: rgba(239, 68, 68, 0.14); }
.live-card-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: live-pulse-anim 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .live-card-dot { animation: none; }
}
.live-card-query {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  word-break: break-word;
  line-height: 1.3;
}
.live-card-slug {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  word-break: break-all;
}
.live-card-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  margin: 0.4rem 0 0.5rem;
  word-break: break-word;
}
.live-card-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.live-card-link {
  margin-left: auto;
  color: var(--primary-from);
  text-decoration: none;
  font-weight: 700;
}
.live-card-link:hover { color: var(--primary-to); }

/* Expandable live-card (click any non-link area to toggle) */
.live-card[data-rnkd-card] { cursor: pointer; }
.live-card-toggle {
  margin-left: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.18s, background 0.18s;
  flex-shrink: 0;
}
.live-card.is-expanded .live-card-toggle {
  transform: rotate(180deg);
  background: rgba(255, 255, 255, 0.12);
}
.live-card-expanded {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.55rem;
}
.live-card-detail-full {
  font-size: 0.78rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  word-break: break-word;
  max-height: 12rem;
  overflow: auto;
}
.live-card-urls {
  display: grid;
  gap: 0.35rem;
}
.live-card-url-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.78rem;
}
.live-card-url-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
}
.live-card-url-link {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.78rem;
  color: var(--primary-from);
  text-decoration: none;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  word-break: break-all;
  transition: color 0.15s, border-color 0.15s;
}
.live-card-url-link:hover {
  color: var(--primary-to);
  border-color: rgba(139, 92, 246, 0.45);
}
.live-card.is-expanded .live-card-link { pointer-events: auto; }
.live-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  grid-column: 1 / -1;
}

/* Recently completed list */
.live-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.live-recent-row {
  display: grid;
  grid-template-columns: 1fr 240px 120px 32px;
  gap: 0.85rem;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.12s;
}
.live-recent-row:first-child { border-top: none; }
.live-recent-row:hover { background: rgba(139, 92, 246, 0.06); }
.live-recent-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.live-recent-title:hover { color: var(--primary-from); }
.live-recent-slug {
  color: var(--text-dim);
  font-size: 0.78rem;
  word-break: break-all;
}
.live-recent-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}
.live-recent-arrow { color: var(--text-muted); text-align: right; }
.live-empty-row {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
@media (max-width: 720px) {
  .live-recent-row {
    grid-template-columns: 1fr 24px;
    gap: 0.4rem;
  }
  .live-recent-slug, .live-recent-meta { display: none; }
}

/* Help callout */
.live-help-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid var(--border);
  border-radius: 14px;
  flex-wrap: wrap;
}
.live-help-callout h3 {
  font-size: 1rem;
  margin: 0 0 0.3rem;
  color: var(--text);
}
.live-help-callout p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 640px;
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   /top/<slug> "live ranking" pipeline UI
   Shows while the AI fills a brand-new table. Renders SSE frames as
   rows drop so the user can watch the table build itself.
   ========================================================================== */

.pipeline-card .ai-curated-meta.pipeline-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(6, 182, 212, 0.14);
  color: #67e8f9;
  border-color: rgba(6, 182, 212, 0.4);
}
.pipeline-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pipeline-pulse 1.4s ease-in-out infinite;
}
@keyframes pipeline-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.7); }
  50%      { opacity: 1; transform: scale(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .pipeline-dot { animation: none; }
}
.pipeline-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.pipeline-progress {
  margin-top: 0.85rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}
/* Instant empty-table skeleton (pre-AI shell in the /fill pipeline) */
.pipeline-shell-col { color: var(--text-muted, #a1a1aa); font-style: italic; }
.pipeline-skeleton td { color: var(--text-muted, #a1a1aa); }
.pipeline-sk-rank { text-align: center; opacity: 0.5; font-variant-numeric: tabular-nums; }
.sk-bar {
  display: inline-block;
  width: 78%;
  height: 0.7rem;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.14), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
@keyframes sk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk-bar { animation: none; background: rgba(255,255,255,0.08); }
}

/* Pipeline "thinking" card — shown while AI builds the table */
.pipeline-thinking {
  padding: 1.5rem 0;
}
.pipeline-thinking-text {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 1.2rem;
}
.pipeline-wiki-suggestions {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1rem;
}
.pipeline-suggestions-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted, #a1a1aa);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pipeline-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pipeline-suggestion-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text, #fff);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.pipeline-suggestion-link:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
}
.suggestion-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.suggestion-snippet {
  font-size: 0.78rem;
  color: var(--text-muted, #a1a1aa);
  line-height: 1.3;
}
.pipeline-suggestions-loading,
.pipeline-suggestions-empty {
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  font-style: italic;
}

/* Pipeline debug panel */
.pipeline-debug {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.pipeline-debug-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #ef4444;
  font-weight: 600;
}
.pipeline-debug-content {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
  line-height: 1.5;
}
.pipeline-debug-content ul { margin: 0.3rem 0 0 1.2rem; padding: 0; }
.pipeline-debug-content a { color: #8b5cf6; }
