:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #7c3aed;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

/* full-width container with side gutters */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}
.container-narrow { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* ===== Topbar ===== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.logo {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; padding: 4px 8px; border-radius: 6px; font-size: 16px;
}
.brand-text { color: var(--text); }

.menu { display: flex; gap: 22px; flex: 1; }
.menu a { color: var(--text); font-weight: 500; }
.menu a:hover { color: var(--primary); text-decoration: none; }
.menu .admin-link { color: var(--accent); }

.account { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--muted); font-size: 13px; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text);
}
.nav-toggle svg { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color:white; text-decoration:none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); text-decoration:none; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; text-decoration: none; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.flash {
  background: #fef3c7; color: #92400e; padding: 10px 0;
  border-bottom: 1px solid #fde68a; font-size: 14px;
}

.main {
  width: 100%;
  margin: 0 auto;
  padding: 32px;
  min-height: calc(100vh - var(--header-h) - 200px);
}
.main-inner { width: 100%; max-width: 100%; margin: 0; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border-radius: 20px; padding: 64px 48px; margin-bottom: 40px;
}
.hero-inner { max-width: 880px; margin: 0 auto; }
.hero h1 { font-size: 42px; line-height: 1.2; margin: 0 0 16px; font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .lead { color: var(--muted); font-size: 17px; margin: 0 0 28px; }
.hero-search { display: flex; gap: 8px; margin-bottom: 28px; }
.hero-search input {
  flex: 1; padding: 14px 18px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 15px; background: white; min-width: 0;
}
.hero-search input:focus { outline: none; border-color: var(--primary); }
.hero-search .btn { padding: 14px 24px; font-size: 15px; }
.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 24px; font-weight: 700; }
.hero-stats span { color: var(--muted); font-size: 13px; }

/* ===== Blocks ===== */
.block { margin-bottom: 48px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.block-head h2 { font-size: 22px; margin: 0; }
.more { font-size: 14px; color: var(--muted); }

/* ===== Category ===== */
.cat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 4px;
  color: var(--text); transition: all 0.15s;
}
.cat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration:none; }
.cat-ko { font-weight: 600; font-size: 15px; }
.cat-en { color: var(--muted); font-size: 12px; }
.cat-desc { color: var(--muted); font-size: 12px; margin-top: 4px; }
.cat-cnt { color: var(--primary); font-size: 12px; font-weight: 600; margin-top: 6px; }

.cat-section { margin-bottom: 32px; }
.cat-section h2 { font-size: 18px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }

.cat-ko-big { font-size: 28px; font-weight: 700; margin-right: 12px; }
.cat-en-big { color: var(--muted); font-weight: 400; font-size: 18px; }

/* ===== Tags ===== */
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.tag:hover { text-decoration:none; border-color: var(--primary); }
.tag-cnt { color: var(--muted); font-size: 11px; font-weight: 600; }
.tag-en { color: var(--muted); font-size: 11px; font-weight: 400; }
.tag-procedure   { background: #eff6ff; color: #1e40af; border-color: #dbeafe; }
.tag-anatomy     { background: #f0fdf4; color: #166534; border-color: #dcfce7; }
.tag-complication{ background: #fef2f2; color: #991b1b; border-color: #fee2e2; }
.tag-material    { background: #fffbeb; color: #92400e; border-color: #fef3c7; }
.tag-drug        { background: #faf5ff; color: #6b21a8; border-color: #f3e8ff; }
.tag-technique   { background: #ecfdf5; color: #065f46; border-color: #d1fae5; }

/* ===== Paper list ===== */
.paper-list { list-style: none; padding: 0; margin: 0; }
.paper-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 12px;
}
.paper-item:hover { border-color: var(--primary); }
.paper-title { font-size: 16px; font-weight: 600; color: var(--text); display: block; margin-bottom: 6px; line-height: 1.5; }
.paper-title:hover { color: var(--primary); text-decoration: none; }
.paper-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.paper-meta .pmid { font-family: ui-monospace, monospace; }
.paper-abstract { color: var(--muted); font-size: 14px; margin: 6px 0 0; line-height: 1.6; }
.paper-authors { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }

/* ===== Search head ===== */
.search-head { margin-bottom: 24px; }
.search-head h1 { font-size: 24px; margin: 0 0 16px; }
.search-bar {
  display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
  background: var(--surface); padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
}
.search-bar input { flex: 1; min-width: 240px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.search-bar select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: white; }
.search-bar input:focus, .search-bar select:focus { outline: none; border-color: var(--primary); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ===== Pager ===== */
.pager { display: flex; gap: 4px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.pager a {
  padding: 7px 13px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px;
}
.pager a:hover { border-color: var(--primary); text-decoration:none; }
.pager a.on { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Paper detail ===== */
.paper-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; max-width: 1100px; margin: 0 auto; }
.paper-detail h1 { font-size: 24px; line-height: 1.4; margin: 0 0 12px; }
.paper-detail h3 { font-size: 16px; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.paper-header-actions { display: flex; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.paper-links { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.abstract { white-space: pre-wrap; line-height: 1.75; color: var(--text); font-size: 14px; }
.paper-tags { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-top: 18px; }
.paper-tags h3 { margin-top: 0; border-bottom: none; padding-bottom: 0; }

.entities { width: 100%; border-collapse: collapse; font-size: 14px; }
.entities th, .entities td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.entities th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: 12px; }
.cui-link { font-family: ui-monospace, monospace; font-size: 12px; color: var(--accent); }
.cui-link:hover { text-decoration: underline; }

.ko-summary h3 { display: flex; justify-content: space-between; align-items: center; }
.summary-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #fef3c7 100%);
  border: 1px solid #fde68a; border-radius: var(--radius);
  padding: 18px 22px; min-height: 60px;
}
.summary-box.empty { background: var(--bg); border-color: var(--border); }
.summary-text { font-family: inherit; white-space: pre-wrap; line-height: 1.85; margin: 0; font-size: 14.5px; color: var(--text); }
.summary-box.loading { color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-procedure   { background: #dbeafe; color: #1e40af; }
.badge-anatomy     { background: #dcfce7; color: #166534; }
.badge-complication{ background: #fee2e2; color: #991b1b; }
.badge-material    { background: #fef3c7; color: #92400e; }
.badge-drug        { background: #f3e8ff; color: #6b21a8; }
.badge-technique   { background: #d1fae5; color: #065f46; }
.badge-pending     { background: #f3f4f6; color: #374151; }
.badge-running     { background: #dbeafe; color: #1e40af; }
.badge-completed   { background: #dcfce7; color: #166534; }
.badge-failed      { background: #fee2e2; color: #991b1b; }

/* ===== Auth ===== */
.auth-card {
  max-width: 420px; margin: 60px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 36px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 24px; font-size: 24px; text-align: center; }
.auth-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.auth-card input, .auth-card select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; margin-top: 4px;
  font-family: inherit;
}
.auth-card input:focus, .auth-card select:focus { outline: none; border-color: var(--primary); }

/* ===== Misc ===== */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.prose { max-width: 800px; line-height: 1.8; margin: 0 auto; }
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 20px; margin-top: 32px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.prose .lead { font-size: 17px; color: var(--muted); }

/* ===== Footer ===== */
.footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0; margin-top: 60px; font-size: 13px; }
.footer p { margin: 4px 0; }
.footer .container { padding: 0 32px; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .container, .footer .container { padding: 0 24px; }
  .main { padding: 24px; }
  .hero { padding: 48px 32px; }
  .hero h1 { font-size: 34px; }
}

@media (max-width: 768px) {
  body { font-size: 14px; }
  .container, .footer .container { padding: 0 16px; }
  .main { padding: 18px 16px 40px; }
  .nav { gap: 12px; height: 56px; }
  :root { --header-h: 56px; }

  .nav-toggle { display: inline-flex; }
  .menu {
    position: fixed; top: 56px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; gap: 0; padding: 8px 0;
    transform: translateY(-110%); transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    z-index: 49;
  }
  .menu.open { transform: translateY(0); }
  .menu a { padding: 12px 20px; border-bottom: 1px solid var(--border); }
  .menu a:last-child { border-bottom: 0; }

  .account { gap: 6px; margin-left: auto; }
  .user-name { display: none; }
  .account .btn { padding: 6px 10px; font-size: 13px; }

  .hero { padding: 36px 22px; border-radius: 14px; }
  .hero h1 { font-size: 26px; }
  .hero .lead { font-size: 15px; }
  .hero-search { flex-direction: column; }
  .hero-search input { padding: 12px 14px; }
  .hero-search .btn { padding: 12px; }
  .hero-stats { gap: 18px; }
  .hero-stats strong { font-size: 20px; }

  .block-head h2 { font-size: 18px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .cat-card { padding: 14px; }

  .paper-detail { padding: 20px 16px; border-radius: 10px; }
  .paper-detail h1 { font-size: 20px; }
  .entities th, .entities td { padding: 8px 6px; font-size: 13px; }

  .auth-card { margin: 24px 12px; padding: 24px 18px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .hero-stats { gap: 14px; }
  .hero-stats strong { font-size: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ───────────────── ripgrep evidence (P1-1, P1-2) ───────────────── */
.engine-badge {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 2px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}
.engine-ripgrep { background:#eff6ff; color:#1d4ed8; border:1px solid #bfdbfe; }
.engine-sql     { background:#f1f5f9; color:#334155; border:1px solid #cbd5e1; }
.muted-tiny     { font-size: 11px; color:#94a3b8; margin-left: 4px; }

.paper-snippet {
  margin: 6px 0 4px;
  padding: 8px 10px;
  background: #fafbfc;
  border-left: 3px solid #3b82f6;
  border-radius: 0 4px 4px 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}
.paper-snippet mark {
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

.evidence-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.badge-evidence {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  border: 1px solid #e2e8f0;
}
.badge-evidence em {
  font-style: normal;
  color: #64748b;
  font-size: 10px;
  margin-left: 2px;
}
.badge-rg       { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.badge-fulltext { background:#f1f5f9; color:#475569; }
.badge-category { background:#f0fdf4; color:#166534; border-color:#bbf7d0; }
.badge-entity   { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.badge-question { background:#fdf2f8; color:#9d174d; border-color:#fbcfe8; }

/* ───────────────── /router fusion view (P2-1) ───────────────── */
.router-head { margin: 24px 0 16px; }
.router-head h1 { font-size: 24px; margin: 0 0 8px; }

.router-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.router-cat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  transition: all .15s;
}
.router-cat.open { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,.12); }
.router-cat .cat-label { font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.router-cat .cat-summary { font-size: 12px; color: var(--text-soft); margin: 0 0 10px; }
.router-cat .q-list { display: flex; flex-wrap: wrap; gap: 6px; }
.router-cat .q-chip {
  display: inline-block; padding: 4px 10px; font-size: 12px;
  border-radius: 999px; background: var(--bg); color: var(--text-soft);
  border: 1px solid var(--border);
}
.router-cat .q-chip:hover { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.router-cat .q-chip.on { background: #1e3a8a; color: #fff; border-color: #1e3a8a; font-weight: 600; }

.router-result { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.router-result h2 { font-size: 20px; margin: 0 0 4px; }
.router-result .hint {
  background: #fef3c7; padding: 8px 12px; border-radius: 4px;
  color: #92400e; font-size: 13px; margin: 8px 0 12px;
}
.engine-fusion { background:#fdf2f8; color:#9d174d; border:1px solid #fbcfe8; }

.score-pill {
  display: inline-block; padding: 1px 7px;
  background: #fef3c7; color: #92400e;
  border-radius: 999px; font-size: 11px; font-weight: 600;
}

/* ───────────────── /category hero (P2-2,3 redesign) ──────────── */
.cat-hero {
  position: relative;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 22px;
  overflow: hidden;
}
.cat-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.cat-hero-anatomy::before     { background: linear-gradient(90deg,#16a34a,#65a30d); }
.cat-hero-procedure::before   { background: linear-gradient(90deg,#2563eb,#7c3aed); }
.cat-hero-complication::before{ background: linear-gradient(90deg,#dc2626,#ea580c); }
.cat-hero-material::before    { background: linear-gradient(90deg,#d97706,#ca8a04); }
.cat-hero-drug::before        { background: linear-gradient(90deg,#7c3aed,#c026d3); }
.cat-hero-technique::before   { background: linear-gradient(90deg,#059669,#0d9488); }
.cat-hero-condition::before   { background: linear-gradient(90deg,#4338ca,#6366f1); }

.cat-hero-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.cat-hero-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(15,23,42,0.06);
  color: #475569;
  flex-shrink: 0;
  margin-top: 4px;
}
.cat-hero-anatomy     .cat-hero-type { background:#dcfce7; color:#166534; border-color:#bbf7d0; }
.cat-hero-procedure   .cat-hero-type { background:#dbeafe; color:#1e40af; border-color:#bfdbfe; }
.cat-hero-complication .cat-hero-type{ background:#fee2e2; color:#991b1b; border-color:#fecaca; }
.cat-hero-material    .cat-hero-type { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.cat-hero-drug        .cat-hero-type { background:#f3e8ff; color:#6b21a8; border-color:#e9d5ff; }
.cat-hero-technique   .cat-hero-type { background:#d1fae5; color:#065f46; border-color:#a7f3d0; }

.cat-hero-titles { flex: 1; min-width: 0; }
.cat-hero-titles h1 { margin: 0 0 4px; font-weight: 800; line-height: 1.15; letter-spacing: -0.4px; display:flex; flex-wrap:wrap; align-items:baseline; gap:10px; }
.cat-hero-ko { font-size: 32px; color: var(--text); }
.cat-hero-en { font-size: 16px; color: var(--muted); font-weight: 500; }
.cat-hero-desc { color: var(--muted); font-size: 14.5px; margin: 4px 0 0; }

.cat-hero-summary {
  text-align: right;
  display: flex; flex-direction: column; align-items: flex-end;
  flex-shrink: 0;
  padding-left: 8px;
}
.cat-hero-summary strong { font-size: 28px; color: var(--text); font-weight: 800; line-height: 1.05; }
.cat-hero-summary span { color: var(--muted); font-size: 12px; }

.cat-hero-search {
  margin-top: 18px;
  display: flex; gap: 8px; flex-wrap: wrap;
  background: rgba(255,255,255,0.85);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.04);
}
.cat-hero-search input {
  flex: 1; min-width: 220px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  background: white;
}
.cat-hero-search input:focus, .cat-hero-search select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.cat-hero-search select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: white;
}
.cat-hero-search .btn { padding: 10px 18px; font-size: 14px; }
.cat-hero-engine { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ───────────────── /category aggregate redesigned ───── */
.cat-aggregate {
  margin-bottom: 22px;
}
.cat-aggregate .agg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.cat-aggregate .stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  position: relative; overflow: hidden;
}
.cat-aggregate .stat::before {
  content:''; position:absolute; left:0; top:0; bottom:0; width:3px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.cat-aggregate .stat strong { font-size: 26px; color: var(--text); font-weight: 800; line-height: 1.1; letter-spacing:-0.4px; }
.cat-aggregate .stat span { font-size: 12px; color: var(--muted); }

.cat-aggregate .agg-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.agg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.agg-card h4 {
  margin: 0 0 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--muted);
}

.agg-journal-list { list-style: none; padding: 0; margin: 0; }
.agg-journal-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.agg-journal-list li:last-child { border-bottom: 0; }
.agg-journal-name {
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.agg-journal-count {
  color: var(--primary); font-weight: 700; font-size: 12px;
  background: var(--primary-soft); padding: 2px 9px; border-radius: 999px;
  flex-shrink: 0;
}

.agg-cooc-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cooc-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  transition: all 0.12s;
}
.cooc-pill:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); text-decoration: none;
}
.cooc-pill em {
  font-style: normal; color: var(--muted); font-size: 11px;
}

/* ───────────────── /category landmarks redesigned ───── */
.landmarks {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.landmarks::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: linear-gradient(90deg, #f59e0b, #f97316);
}
.landmarks-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.landmarks-title {
  margin: 0; font-size: 15px; color: var(--text); font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
}
.landmarks-title svg { color: #f59e0b; }
.landmarks-sub { color: var(--muted); font-size: 12px; }

.landmark-list { list-style: none; padding: 0; margin: 0; counter-reset: lm; }
.landmark-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.landmark-item:last-child { border-bottom: 0; padding-bottom: 0; }
.landmark-rank {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fef3c7; color: #92400e;
  border-radius: 6px;
  font-weight: 700; font-size: 13px;
  font-family: ui-monospace, monospace;
}
.landmark-item:nth-child(1) .landmark-rank { background:#fde68a; color:#78350f; }
.landmark-item:nth-child(2) .landmark-rank { background:#fef3c7; color:#92400e; }
.landmark-item:nth-child(3) .landmark-rank { background:#fef9c3; color:#854d0e; }
.landmark-body { flex: 1; min-width: 0; }
.landmark-title {
  display: block; font-weight: 600; color: var(--text); font-size: 14.5px;
  line-height: 1.4; margin-bottom: 4px;
}
.landmark-title:hover { color: var(--primary); text-decoration: none; }
.landmark-meta {
  display: flex; flex-wrap: wrap; gap: 4px 0;
  font-size: 12px; color: var(--muted);
}
.landmark-meta > span { padding-right: 8px; }
.landmark-meta > span + span::before { content: "·"; color: #cbd5e1; padding-right: 8px; }
.landmark-meta .cite-pill, .landmark-meta .score-pill { padding-right: 0; }
.landmark-meta .cite-pill::before, .landmark-meta .score-pill::before { content: ''; padding: 0; }

.cite-pill {
  display: inline-block; padding: 1px 8px;
  background: #dbeafe; color: #1e40af;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  margin-left: 4px;
}

.section-divider {
  margin: 28px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-divider h2 { font-size: 17px; margin: 0; }

@media (max-width: 768px) {
  .cat-hero { padding: 22px 18px; border-radius: 12px; }
  .cat-hero-ko { font-size: 24px; }
  .cat-hero-en { font-size: 14px; }
  .cat-hero-summary { text-align: left; align-items: flex-start; padding-left: 0; margin-top: 4px; }
  .cat-hero-summary strong { font-size: 22px; }
  .cat-aggregate .agg-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat-aggregate .stat { padding: 12px 14px; }
  .cat-aggregate .stat strong { font-size: 20px; }
  .cat-aggregate .agg-cols { grid-template-columns: 1fr; }
  .landmarks { padding: 14px 16px; }
  .landmark-item { gap: 10px; }
}

/* ───────────────── /paper/:id citation widgets (P4-1) ───────── */
.citations { margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--border); }
.cite-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .cite-grid { grid-template-columns: 1fr; }
}
.cite-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}
.cite-col h4 { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.cite-count {
  display: inline-block; padding: 1px 7px; margin-left: 4px;
  background: #dbeafe; color: #1e40af;
  border-radius: 999px; font-size: 11px; font-weight: 600;
}
.cite-list { list-style: none; padding: 0; margin: 0; }
.cite-list li {
  padding: 6px 0;
  border-bottom: 1px dashed #f0f3f7;
  font-size: 13px;
  line-height: 1.45;
}
.cite-list li:last-child { border-bottom: none; }
.cite-list li a { color: var(--text); font-weight: 500; }
.cite-list li a:hover { color: #1d4ed8; }
.cite-meta { color: var(--text-soft); font-size: 11px; margin-top: 2px; }
.cite-meta span + span::before { content: " · "; color: #cbd5e1; }

.dangling { margin-top: 10px; }
.dangling summary { font-size: 12px; color: var(--text-soft); cursor: pointer; }
.dangling-list { font-size: 12px; padding-left: 20px; }
.dangling-list li { color: var(--text-soft); padding: 2px 0; }

.cooccurring { margin: 20px 0; }
.cooccurring h3 { margin-bottom: 4px; }
.cooccurring .small { margin: 0 0 8px; font-size: 12px; }

/* ───────────────── /graph viewer (P4-3) ───────────────── */
.graph-head { margin: 24px 0 12px; }
.graph-head h1 { margin: 0 0 4px; font-size: 24px; }
.graph-tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--border); }
.graph-tab {
  padding: 8px 14px;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg); color: var(--text-soft);
  margin-bottom: -1px;
}
.graph-tab.on { background: var(--surface); color: #1d4ed8; border-color: var(--border); border-bottom-color: var(--surface); font-weight: 600; }

.graph-controls {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 14px; margin: 12px 0;
}
.graph-controls label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.graph-controls input[type=range] { width: 200px; }

.graph-canvas {
  width: 100%; height: 700px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ============================================================
   /graph — Graphify-style 3-panel knowledge graph viewer
   ============================================================ */
.gx-shell { display: block; }

.gx-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
  color: #f1f5f9;
  border-radius: 18px;
  padding: 28px 32px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.gx-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(800px 240px at 80% 0%, rgba(124,58,237,0.35), transparent 60%),
              radial-gradient(600px 200px at 20% 100%, rgba(37,99,235,0.30), transparent 60%);
  pointer-events: none;
}
.gx-hero-head { position: relative; max-width: 880px; }
.gx-hero-eyebrow {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: #c4b5fd;
}
.gx-hero-title {
  margin: 12px 0 8px;
  font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, #c4b5fd);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.gx-hero-sub { margin: 0; color: #cbd5e1; font-size: 14.5px; line-height: 1.7; }
.gx-hero-sub strong { color: #ffffff; font-weight: 700; }

.gx-hero-stats {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-top: 22px;
}
.gx-hero-stats > div {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column;
  backdrop-filter: blur(10px);
}
.gx-hero-stats strong { font-size: 22px; font-weight: 800; color: #ffffff; line-height: 1.05; }
.gx-hero-stats span { font-size: 11px; color: #cbd5e1; letter-spacing: 0.4px; }

.gx-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.gx-tab {
  padding: 9px 16px;
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--bg); color: var(--muted);
  margin-bottom: -1px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.gx-tab.on, .gx-tab:hover {
  background: var(--surface); color: var(--primary);
  border-bottom-color: var(--surface);
  text-decoration: none;
}
.gx-tab.on { font-weight: 700; }

.gx-tabs-sm { border-bottom: 0; gap: 6px; margin-bottom: 14px; }
.gx-tabs-sm .gx-tab {
  border-radius: 8px;
  border-bottom: 1px solid var(--border);
  margin: 0;
  font-size: 13px;
}
.gx-tabs-sm .gx-tab.on { background: var(--primary); color: white; border-color: var(--primary); }

.gx-grid {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 14px;
  align-items: stretch;
}

.gx-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.gx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.gx-card-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}
.gx-card-head svg { color: var(--primary); }

.gx-control { display: block; margin-bottom: 12px; font-size: 12px; color: var(--text-soft); font-weight: 500; }
.gx-control > span { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.gx-control em { color: var(--primary); font-style: normal; font-weight: 700; font-size: 13px; }
.gx-control input[type=range] { width: 100%; accent-color: var(--primary); }
.gx-control select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: white; }

.gx-checks { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.gx-checks label { font-size: 12px; color: var(--text-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; }

.gx-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; margin-bottom: 6px; font-family: ui-monospace, monospace;
}
.gx-btn-block { width: 100%; margin-top: 6px; padding: 8px; font-size: 13px; }
.gx-muted { color: var(--muted); font-size: 12px; margin: 0 0 8px; line-height: 1.55; }
.gx-muted-tiny { color: #94a3b8; font-size: 11px; }

.gx-path-out {
  margin-top: 10px;
  padding: 10px 12px;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  font-size: 12px;
  color: #5b21b6;
  line-height: 1.7;
}
.gx-path-step {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: white;
  border: 1px solid #e9d5ff;
  color: #6b21a8;
  font-weight: 600;
  font-size: 11.5px;
  margin: 2px;
}
.gx-path-arrow { color: #a855f7; padding: 0 4px; font-weight: 700; }

.gx-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.gx-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.gx-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.gx-canvas-wrap { position: relative; min-width: 0; }
.gx-canvas {
  width: 100%; height: 720px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.gx-loader {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,0.85); color: white;
  padding: 8px 16px; border-radius: 999px;
  font-size: 13px; backdrop-filter: blur(10px);
}

/* Inspector */
.gx-inspector { display: flex; flex-direction: column; gap: 12px; }
.gx-insp-head h3 { margin: 4px 0 2px; font-size: 17px; font-weight: 700; color: var(--text); }
.gx-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.gx-insp-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--bg); border-radius: 8px; padding: 10px;
}
.gx-insp-stats > div { display: flex; flex-direction: column; }
.gx-insp-stats strong { font-size: 18px; color: var(--text); font-weight: 800; }
.gx-insp-stats span { font-size: 11px; color: var(--muted); }
.gx-insp-section h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); }
.gx-neigh-list { list-style: none; padding: 0; margin: 0; }
.gx-neigh-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.gx-neigh-list li:last-child { border-bottom: 0; }
.gx-neigh-list a { font-weight: 600; }
.gx-neigh-list a:hover { text-decoration: underline; }

/* Bottom panels */
.gx-bottom { margin-top: 18px; }
.gx-bottom-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.gx-god-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.gx-god-card {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
  transition: all 0.12s;
}
.gx-god-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.gx-god-rank {
  font-family: ui-monospace, monospace;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.gx-god-name { display: block; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.gx-god-name:hover { text-decoration: underline; }
.gx-god-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.gx-god-meta strong { color: var(--text); font-weight: 700; }

.gx-comm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.gx-comm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
}
.gx-comm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.gx-comm-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.gx-comm-pill {
  display: inline-block;
  padding: 3px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-soft);
  font-family: ui-monospace, monospace;
}
.gx-comm-pill:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.gx-surp-grid { display: flex; flex-direction: column; gap: 4px; }
.gx-surp-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px dashed var(--border);
}
.gx-surp-row:last-child { border-bottom: 0; }
.gx-surp-end {
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
  border-left: 3px solid var(--c, var(--primary));
  padding-left: 10px;
}
.gx-surp-end:hover { text-decoration: none; }
.gx-surp-end strong { font-weight: 600; font-size: 14px; }
.gx-surp-mid {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #a855f7;
  font-size: 11px;
  white-space: nowrap;
}
.gx-surp-mid em { font-style: normal; }

.gx-pipe { color: var(--text-soft); font-size: 13.5px; line-height: 1.85; padding-left: 22px; margin: 0; }
.gx-pipe strong { color: var(--text); font-family: ui-monospace, monospace; background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

@media (max-width: 1100px) {
  .gx-grid { grid-template-columns: 1fr; }
  .gx-side-right, .gx-side-left { order: 1; }
  .gx-canvas-wrap { order: 0; }
  .gx-canvas { height: 540px; }
  .gx-hero-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .gx-hero { padding: 22px 18px; border-radius: 12px; }
  .gx-hero-title { font-size: 24px; }
  .gx-hero-sub { font-size: 13px; }
  .gx-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .gx-canvas { height: 460px; }
  .gx-surp-row { grid-template-columns: 1fr; }
}

/* =====================================================================
 * Split layout — list on the left, paper detail on the right.
 * Activated when search/router views render a `.split-shell`.
 * Right pane is sticky so it stays in view while the list scrolls.
 * ===================================================================== */
.split-shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: start;
}
.split-list { min-width: 0; }
.split-detail {
  position: sticky;
  top: calc(var(--header-h, 64px) + 12px);
  height: calc(100vh - var(--header-h, 64px) - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.paper-pane {
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.paper-pane.loading { opacity: 0.55; pointer-events: none; }
.paper-pane-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 80px 32px; text-align: center; color: var(--muted);
  height: 100%;
}
.paper-pane-empty svg { color: var(--border); }
.paper-pane-empty p { margin: 0; font-size: 14px; line-height: 1.6; }

/* paper-detail rendered inline inside the right pane: drop chrome, fill width */
.split-detail .paper-detail,
.paper-detail-inline {
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 24px 28px;
}

/* selectable list rows */
.paper-list-split .paper-item { cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; }
.paper-list-split .paper-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.paper-list-split .paper-item.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.paper-list-split .paper-item.active .paper-title { color: var(--primary); }

/* Below 1024px: stack. When detail is open, hide the list to give the detail full width. */
@media (max-width: 1024px) {
  .split-shell { grid-template-columns: 1fr; gap: 16px; }
  .split-detail { position: static; height: auto; max-height: none; }
  .paper-pane { max-height: none; }
  .split-shell.detail-open .split-list { display: none; }
}

/* =====================================================================
 * Author views — /authors index + /author/{name} profile.
 * ===================================================================== */
.author-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.author-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.author-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.author-name {
  display: block; font-weight: 600; font-size: 15px; color: var(--text);
  margin-bottom: 6px;
}
.author-name:hover { color: var(--primary); text-decoration: none; }
.author-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.author-count { font-weight: 700; color: var(--primary); }
.author-years { color: var(--muted); }

/* author-hero (profile page) */
.author-hero {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}
.author-hero-head {
  display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start;
  margin-bottom: 18px;
}
.author-hero-title { flex: 1 1 320px; min-width: 0; }
.author-hero-title h1 { margin: 0 0 4px; font-size: 26px; }
.author-hero-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.author-hero-stats .stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; min-width: 96px; text-align: center;
}
.author-hero-stats strong { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.author-hero-stats span { display: block; color: var(--muted); font-size: 12px; }

.author-hero-cols {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.author-card-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.author-card-block h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* year histogram bars */
.year-bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.year-bars li {
  display: grid;
  grid-template-columns: 56px 1fr 32px;
  gap: 8px; align-items: center;
  font-size: 12px;
}
.year-label { color: var(--muted); }
.year-bar { background: var(--bg); border-radius: 999px; overflow: hidden; height: 10px; }
.year-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.year-count { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }

/* clickable author chips inside paper detail */
.paper-authors { line-height: 1.7; }
.author-link {
  color: var(--text); border-bottom: 1px dashed transparent;
  padding: 0 1px; border-radius: 3px;
}
.author-link:hover { color: var(--primary); border-bottom-color: var(--primary); text-decoration: none; }
.first-author-mark { color: var(--primary); font-weight: 600; }

/* =====================================================================
 * Authors index — ranked list view (replaces sparse card grid).
 * ===================================================================== */
.authors-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px 28px;
  margin-bottom: 24px;
}
.authors-hero-text { max-width: 880px; }
.authors-hero h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.authors-hero p { margin: 0 0 18px; color: var(--text-soft); font-size: 14px; line-height: 1.65; }
.authors-hero p strong { color: var(--primary); font-weight: 700; }

.authors-hero-search {
  display: flex; gap: 8px; max-width: 640px; margin: 0 0 8px; flex-wrap: wrap;
}
.authors-hero-search input {
  flex: 1 1 280px; min-width: 0;
  padding: 11px 14px; font-size: 14px;
  border: 2px solid var(--border); border-radius: 10px; background: white;
}
.authors-hero-search input:focus { outline: none; border-color: var(--primary); }
.authors-hero-search .btn { padding: 11px 18px; font-size: 14px; }

/* ranked, multi-column dense list */
.author-rank-list {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.author-row { border-bottom: 1px solid var(--border); }
.author-row:last-child { border-bottom: 0; }

.author-row-link {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text);
  transition: background .12s;
}
.author-row-link:hover {
  background: var(--primary-soft, #eff6ff);
  text-decoration: none;
}
.author-row-link:hover .author-row-name { color: var(--primary); }

.author-rank {
  font-size: 13px; color: var(--muted-2, #9ca3af); font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.author-row-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.author-row-name {
  font-weight: 600; font-size: 15px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .12s;
}
.author-row-meta {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  font-size: 12px; color: var(--muted);
}
.author-row-count {
  display: flex; flex-direction: column; align-items: flex-end;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.author-row-count strong {
  font-size: 17px; font-weight: 700; color: var(--primary);
}
.author-row-count em {
  font-style: normal; font-size: 11px; color: var(--muted);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .authors-hero { padding: 22px 18px 18px; }
  .authors-hero h1 { font-size: 22px; }
  .author-rank-list { grid-template-columns: 1fr; }
  .author-row-link { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 11px 12px; }
}

/* ============================================================
   /graph v2 — toolbar, papers list, edge inspector, clusters
   ============================================================ */

/* Canvas toolbar (above canvas) */
.gx-canvas-toolbar {
  position: absolute; top: 12px; left: 12px; right: 12px;
  z-index: 5;
  display: flex; align-items: center; gap: 6px;
  padding: 6px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.gx-search {
  flex: 1; min-width: 0;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
.gx-search:focus { outline: none; border-color: var(--primary); background: white; }
.gx-toolbar-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.gx-toolbar-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 7px; cursor: pointer; color: var(--text-soft);
  transition: all 0.12s;
}
.gx-toolbar-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--border); }

/* Floating canvas meta (bottom-right) */
.gx-canvas-meta {
  position: absolute; bottom: 12px; right: 12px;
  z-index: 4;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

/* Inspector — papers list (async loaded) */
.gx-papers-list { display: flex; flex-direction: column; gap: 6px; }
.gx-paper-row {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  text-decoration: none;
  transition: all 0.12s;
}
.gx-paper-row:hover { border-color: var(--primary); background: white; text-decoration: none; }
.gx-paper-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.gx-paper-meta {
  display: flex; flex-wrap: wrap; gap: 4px 8px;
  color: var(--muted); font-size: 11px;
  margin-top: 4px;
}
.gx-paper-meta .gx-cite {
  background: #dbeafe; color: #1e40af;
  padding: 0 6px; border-radius: 999px; font-weight: 600;
}

/* Edge inspector */
.gx-edge-ends { display: flex; flex-direction: column; gap: 8px; }
.gx-edge-end {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
}
.gx-edge-end:hover { border-color: var(--primary); text-decoration: none; }
.gx-edge-end strong { color: var(--text); font-size: 14px; }

/* Inspector head: pill row */
.gx-insp-head .gx-pill { margin-right: 4px; margin-bottom: 6px; display: inline-block; }
.gx-pill-clst { font-family: ui-monospace, monospace; font-weight: 700; }

/* Clusters panel (LPA) */
.gx-clst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.gx-clst-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
}
.gx-clst-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.gx-clst-num {
  font-family: ui-monospace, monospace; font-weight: 800; font-size: 11px;
  color: white; padding: 2px 8px; border-radius: 6px;
}
.gx-clst-label {
  flex: 1; font-size: 14.5px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gx-clst-types {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}
.gx-clst-types .gx-pill { font-size: 10.5px; padding: 1px 7px; }

/* Side panel scroll */
.gx-side-left, .gx-side-right { max-height: 100%; overflow-y: auto; }
.gx-side-left::-webkit-scrollbar, .gx-side-right::-webkit-scrollbar { width: 6px; }
.gx-side-left::-webkit-scrollbar-thumb, .gx-side-right::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Hero now 7-cell grid: keep readable on smaller screens */
@media (max-width: 1280px) {
  .gx-hero-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
  .gx-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .gx-canvas-toolbar { flex-wrap: wrap; }
  .gx-search { min-width: 100%; }
}

/* =====================================================================
 * Co-author egonet graph — embedded on /author/{name}.
 * ===================================================================== */
.coauthor-graph-block { margin: 32px 0 24px; }
.coauthor-graph-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.coauthor-graph-toolbar {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cg-control { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.cg-control span { white-space: nowrap; }
.cg-control em {
  font-style: normal; color: var(--primary); font-weight: 700;
  background: var(--primary-soft, #eff6ff); padding: 1px 6px; border-radius: 999px;
  font-size: 11px;
}
.cg-control input[type=range] { width: 140px; }

.cg-stats { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; color: var(--muted); }
.cg-stats strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

.cg-legend { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.cg-legend .cg-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.cg-edge { display: inline-block; width: 18px; height: 2px; vertical-align: middle; margin-right: 4px; }
.cg-edge-ego { background: #c4b5fd; }
.cg-edge-cross { background: #cbd5e1; }

.coauthor-canvas { height: 460px; background: #fbfbfd; }
.cg-loader {
  position: absolute; top: 56px; left: 50%; transform: translate(-50%, 0);
  background: rgba(255,255,255,0.92); padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
.cg-hint {
  margin: 0; padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

@media (max-width: 768px) {
  .coauthor-canvas { height: 340px; }
  .coauthor-graph-toolbar { gap: 10px; }
  .cg-stats { width: 100%; margin-left: 0; }
}

/* author hero — fresh stat + external action buttons */
.author-hero-stats .stat-fresh strong { color: var(--green, #16a34a); }
.author-hero-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* compact ranked co-author text list inside author hero */
.coauthor-mini-list {
  list-style: none; padding: 0; margin: 0;
  counter-reset: coa;
  display: flex; flex-direction: column; gap: 4px;
}
.coauthor-mini-list li {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
}
.coauthor-mini-list li::before {
  counter-increment: coa;
  content: counter(coa);
  color: var(--muted-2, #9ca3af);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  font-variant-numeric: tabular-nums;
}
.coauthor-mini-list a {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.coauthor-mini-list a:hover { color: var(--primary); text-decoration: none; }
.coauthor-mini-list .muted-tiny { color: var(--muted); font-variant-numeric: tabular-nums; }

/* /authors sort tabs */
.authors-sort-tabs {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; flex-wrap: wrap;
  font-size: 13px;
}
.authors-sort-label { color: var(--muted); margin-right: 4px; }
.authors-sort-tab {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, background .12s;
}
.authors-sort-tab:hover { border-color: var(--primary); text-decoration: none; }
.authors-sort-tab.on {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* author profile — recent papers preview cards */
.author-recent-block { margin: 0 0 24px; }
.author-recent-head {
  margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.author-recent-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.author-recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.author-recent-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
}
.recent-card-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.recent-year {
  background: var(--primary-soft, #eff6ff); color: var(--primary);
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.recent-journal { color: var(--muted); }
.recent-card-title {
  font-weight: 600; font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.recent-card-author { font-size: 12px; }

/* category hero — external search action row */
.cat-hero-external {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* paper-meta first-author link */
.meta-author-link { color: var(--text); border-bottom: 1px dashed transparent; }
.meta-author-link:hover { color: var(--primary); border-bottom-color: var(--primary); text-decoration: none; }

/* home — recent active authors strip */
.active-author-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.active-author a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; color: var(--text);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.active-author a:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.aa-name { font-weight: 600; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-meta { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.aa-year { background: var(--primary-soft, #eff6ff); color: var(--primary); padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.aa-count { color: var(--muted); font-size: 12px; }
