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

:root {
  --bg: #f4f8fa;
  --surface: #ffffff;
  --sidebar-bg: #024F85;
  --sidebar-text: #c8dce8;
  --sidebar-text-hover: #ffffff;
  --sidebar-active: rgba(61, 201, 218, 0.15);
  --sidebar-active-text: #3DC9DA;
  --sidebar-active-border: #3DC9DA;
  --primary: #024F85;
  --primary-light: #e6f5f7;
  --accent: #3DC9DA;
  --text: #024F85;
  --text-secondary: #4a6a7a;
  --text-muted: #7a96a8;
  --border: #d4e2ea;
  --border-light: #ebf1f5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --sidebar-width: 300px;
  --header-height: 56px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(111deg, rgb(1, 46, 77) 31.75%, rgb(2, 79, 133) 65.88%, rgb(5, 128, 184) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide sidebar on welcome/home page */
#app.no-sidebar .sidebar {
  transform: translateX(-100%);
}

#app.no-sidebar .main {
  margin-left: 0;
  transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#app:not(.no-sidebar) .main {
  transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.sidebar-logo {
  height: 32px;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  margin-top: 6px;
  opacity: 0.7;
}

/* Search */
.search-container {
  position: relative;
  padding: 12px 16px;
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sidebar-text);
  opacity: 0.5;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 42px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.search-input::placeholder { color: rgba(255,255,255,0.35); }
.search-input:focus {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,201,218,0.2);
}

.search-kbd {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-family: inherit;
  pointer-events: none;
}

/* Nav */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Faceted filter groups */
.nav-filter-group {
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-filter-group-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}

.nav-filter-group-btn:hover { color: var(--sidebar-text-hover); }

.nav-filter-group-btn .chevron {
  transition: transform var(--transition);
  flex-shrink: 0;
  opacity: 0.5;
}

.nav-filter-group-btn.expanded .chevron { transform: rotate(90deg); }

.nav-filter-options {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  padding: 0 4px;
}

.nav-filter-options.open { max-height: 500px; }

.nav-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--sidebar-text);
  font-size: 0.84rem;
}

.nav-filter-option:hover {
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text-hover);
}

.nav-filter-check {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.nav-filter-check svg {
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #fff;
}

.nav-filter-option.active .nav-filter-check {
  background: var(--accent);
  border-color: var(--accent);
}

.nav-filter-option.active .nav-filter-check svg {
  opacity: 1;
}

.nav-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-filter-count {
  font-size: 0.68rem;
  background: rgba(255,255,255,0.1);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
}

.nav-article-link {
  display: block;
  padding: 7px 10px;
  margin: 1px 0;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-article-link:hover {
  color: var(--sidebar-text-hover);
  background: rgba(255,255,255,0.04);
}

.nav-article-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active);
  border-left-color: var(--sidebar-active-border);
  font-weight: 500;
  padding-top: 9px;
  padding-bottom: 9px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 8px;
  align-items: center;
}

.version-badge, .platform-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.version-badge {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.5);
}

.platform-badge {
  background: rgba(61,201,218,0.2);
  color: var(--sidebar-active-text);
}

/* === Main === */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* === Welcome === */
.welcome {
  max-width: 100%;
  margin: 0;
  padding: 0;
  text-align: center;
}

/* Hero Search */
.hero-search {
  position: relative;
  padding: 64px 40px 56px;
  background: linear-gradient(135deg, #012E4D 0%, #024F85 50%, #0580B8 100%);
  overflow: visible;
  transition: padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-search.searching {
  padding-bottom: 40px;
  min-height: 100vh;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(61,201,218,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(61,201,218,0.1) 0%, transparent 50%);
  pointer-events: none;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-search.searching .hero-content {
  max-width: 780px;
}

.hero-logo {
  height: 64px;
  margin-bottom: 20px;
}

.hero-search h1 {
  font-size: 2.1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
}

.hero-search p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 28px;
}

.hero-search-bar {
  position: relative;
  max-width: 540px;
  margin: 0 auto;
  z-index: 10;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-search.searching .hero-search-bar {
  max-width: 680px;
}

.hero-search-icon {
  position: absolute;
  right: 20px;
  top: 27px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.hero-search.searching .hero-search-icon {
  display: none;
}

.hero-clear-btn {
  position: absolute;
  right: 14px;
  top: 27px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 3;
}

.hero-clear-btn:hover {
  background: var(--border);
  color: var(--text);
}

.hero-search.searching .hero-clear-btn {
  display: flex;
}

.hero-filter-btn {
  position: absolute;
  right: 48px;
  top: 10px;
  bottom: 10px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(0,0,0,0.1);
  border-radius: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.hero-filter-btn:hover {
  background: transparent;
  color: var(--primary);
}

.hero-filter-btn.active {
  background: transparent;
  color: var(--primary);
}

.hero-search-input {
  width: 100%;
  padding: 16px 96px 16px 22px;
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  transition: var(--transition);
}

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

.hero-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 0 0 3px rgba(61,201,218,0.25);
}

/* Filter dropdown */
.hero-filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  z-index: 10;
  overflow: hidden;
  animation: dropIn 0.2s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-filter-dropdown-inner {
  padding: 16px 18px;
}

.hero-filter-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.hero-filter-group-label:not(:first-child) {
  margin-top: 12px;
}

.hero-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}

.hero-filter:hover {
  border-color: var(--accent);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.hero-filter.pillar {
  padding: 8px 16px;
  font-size: 0.88rem;
}

.hero-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hero-filter-count {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
}

/* Browse section with tabs */
.browse-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 40px 60px;
}

.browse-tabs {
  display: inline-flex;
  margin: 0 auto 28px;
  background: var(--border-light);
  border-radius: 50px;
  padding: 4px;
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.browse-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 24px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  border-radius: 50px;
  white-space: nowrap;
}

.browse-tab:hover {
  color: var(--text);
}

.browse-tab.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 79, 133, 0.3);
}

.browse-tab.active svg {
  color: #fff;
}

.browse-panel {
  display: none;
}

.browse-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.topic-pills {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pillar-section,
.concern-section {
  text-align: left;
}

.pillar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.pillar-pills,
.concern-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topic-pill.pillar {
  padding: 10px 22px;
  font-size: 0.92rem;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  user-select: none;
}

.topic-pill:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.topic-pill.active {
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.topic-pill .topic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topic-pill .topic-count {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
}

.topic-pill.active .topic-count {
  background: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.9);
}

/* Topic cards grid */
.topic-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
  text-align: left;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topic-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topic-card-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border-light);
}

.topic-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 10px;
  color: var(--primary);
  margin-bottom: 12px;
}

.topic-card-icon svg {
  width: 22px;
  height: 22px;
}

.topic-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.topic-card-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.topic-card-links {
  padding: 10px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topic-card-link {
  display: block;
  padding: 7px 0;
  font-size: 0.84rem;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-card-link:last-child { border-bottom: none; }

.topic-card-link:hover {
  color: var(--accent);
}

.topic-card-footer {
  padding: 12px 20px 16px;
}

.topic-card-viewall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2fb3c3;
  cursor: pointer;
  transition: var(--transition);
}

.topic-card-viewall:hover {
  gap: 8px;
}

.topic-card-viewall svg {
  transition: var(--transition);
}

/* Topic results */
.topic-results {
  margin-top: 24px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border-light);
}

.topic-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.topic-results-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topic-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.topic-clear-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.topic-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.topic-result-item {
  display: block;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: var(--transition);
}

.topic-result-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.topic-result-phase {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.topic-result-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

/* Chapter section (kept for standalone use / mobile) */
.chapter-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  text-align: left;
}

.chapter-section-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: left;
}

/* Chapter cards */
.chapter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
  text-align: left;
}

.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chapter-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.chapter-card-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border-light);
}

.chapter-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 10px;
  color: var(--primary);
  margin-bottom: 12px;
}

.chapter-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.chapter-card-name:hover {
  color: var(--accent);
}

.chapter-card-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chapter-card-links {
  padding: 10px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chapter-card-link {
  display: block;
  padding: 7px 0;
  font-size: 0.84rem;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-card-link:last-child { border-bottom: none; }

.chapter-card-link:hover {
  color: var(--accent);
}

.chapter-card-footer {
  padding: 12px 20px 16px;
}

.chapter-card-viewall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2fb3c3;
  cursor: pointer;
  transition: var(--transition);
}

.chapter-card-viewall:hover {
  gap: 8px;
}

.chapter-card-viewall svg {
  transition: var(--transition);
}

/* === Article View === */
.article-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  animation: fadeIn 0.25s ease;
}

.article-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.article-content {
  flex: 1;
  min-width: 0;
}

/* Article sidebar (details + topics) */
.article-sidebar {
  width: 350px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Details panel */
.article-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.details-header {
  padding: 14px 18px;
  background: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-header svg {
  color: rgba(255,255,255,0.7);
}

.details-header-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.03em;
}

.details-body {
  padding: 0;
}

.details-row {
  display: flex;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-light);
  gap: 8px;
}

.details-row:last-child {
  border-bottom: none;
}

.details-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  width: 80px;
  flex-shrink: 0;
  padding-top: 1px;
}

.details-value {
  font-size: 0.84rem;
  color: var(--text);
  font-weight: 500;
  flex: 1;
}

.details-value.accent {
  color: var(--accent);
}

.details-value a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

.details-value a:hover {
  text-decoration: underline;
}

.details-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.details-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
}

.details-row-tags {
  align-items: flex-start;
}

.details-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.details-permalink {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.permalink-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

.permalink-link:hover {
  text-decoration: underline;
}

/* Article topics box */
.article-topics {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.article-topics-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.article-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.article-topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.article-topic-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.article-topic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* === Similar Articles === */
.article-similar {
  margin-top: 12px;
}

.similar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.similar-header svg {
  color: var(--text);
  flex-shrink: 0;
}

.similar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 24px;
}

.similar-item {
  display: block;
  padding: 8px 0;
  text-decoration: none;
  transition: color 0.15s ease;
}

.similar-item:hover {
  background: var(--bg);
}

.similar-item-meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.similar-item-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--primary);
  line-height: 1.35;
}

.similar-item:hover .similar-item-name {
  color: var(--accent);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

/* === Breadcrumbs === */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  min-width: 0;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
}

.crumb:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.crumb-sep {
  color: var(--text-muted);
  opacity: 0.6;
  user-select: none;
}

.crumb.current {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.article-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.article-chapter-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--accent);
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-version {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--border-light);
  border-radius: 10px;
}

.article-title {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 32px;
  color: var(--text);
}

/* Table of Contents */
.toc-wrapper {
  margin-bottom: 28px;
  position: relative;
  z-index: 20;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.toc-header svg {
  flex-shrink: 0;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.87rem;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.toc-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.toc-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.toc-link.active {
  color: var(--primary);
  font-weight: 500;
}

.toc-link.active .toc-marker {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 201, 218, 0.2);
}

.toc-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsed sticky TOC */
.toc-wrapper.stuck .toc {
  position: fixed;
  top: 16px;
  left: var(--toc-left, 340px);
  width: var(--toc-width, 728px);
  z-index: 100;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  cursor: pointer;
  background: #ffffff;
}

.toc-wrapper.stuck .toc-header {
  margin-bottom: 0;
}

.toc-wrapper.stuck .toc-nav {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.3s ease;
  margin-top: 0;
}

/* Expand on hover */
.toc-wrapper.stuck .toc:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.toc-wrapper.stuck .toc:hover .toc-header {
  margin-bottom: 12px;
}

.toc-wrapper.stuck .toc:hover .toc-nav {
  max-height: 500px;
  opacity: 1;
  margin-top: 0;
}

/* Placeholder keeps layout space when TOC goes fixed */
.toc-wrapper.stuck {
  height: var(--toc-height, 172px);
}

/* Mobile collapsed */
@media (max-width: 900px) {
  .toc-wrapper.stuck .toc {
    left: 16px;
    width: calc(100% - 32px);
  }
}

/* Article body typography */
.article-body {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.article-body p {
  margin-bottom: 16px;
}

.article-body ul, .article-body ol {
  margin: 12px 0 16px 20px;
}

.article-body li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.article-body li ul {
  margin-top: 8px;
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.88rem;
}

.article-body th, .article-body td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border);
}

.article-body th {
  background: var(--primary-light);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}

.article-body td {
  background: var(--surface);
}

/* References section */
.article-references {
  margin-top: 40px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.references-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.references-title svg {
  color: var(--text);
}

.references-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.references-list li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.references-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ref-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
}

.ref-text {
  flex: 1;
}

.ref-text a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

.ref-text a:visited {
  color: var(--primary);
}

.ref-text a:hover {
  text-decoration: underline;
}

/* Prev / Next footer */
.article-nav-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.article-nav-btn {
  flex: 1;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: inherit;
}

.article-nav-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.article-nav-btn.next { text-align: right; }

.article-nav-btn .nav-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.article-nav-btn .nav-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

/* === Search Results === */
.search-results {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 40px 80px;
  animation: fadeIn 0.2s ease;
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.search-results-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.clear-search-btn {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.clear-search-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.search-result-item {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.search-result-item .result-id {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.search-result-item .result-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.search-result-item .result-snippet {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-item .result-snippet mark {
  background: rgba(61,201,218,0.2);
  color: var(--accent);
  padding: 1px 2px;
  border-radius: 2px;
}

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

.no-results svg { margin-bottom: 16px; opacity: 0.4; }
.no-results p { font-size: 0.95rem; }

/* === Topic Results Page === */
.topic-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 40px 80px;
  animation: fadeIn 0.2s ease;
}

.topic-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topic-page-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
}

.topic-page-title strong {
  color: #079AAD;
}

.topic-page-clear {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.topic-page-clear:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.topic-page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topic-page-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topic-page-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-page-sort label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topic-page-sort select {
  padding: 6px 28px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a96a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--transition);
}

.topic-page-sort select:hover {
  border-color: var(--accent);
}

.topic-page-item {
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.topic-page-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.topic-page-item-id {
  font-size: 0.7rem;
  font-weight: 600;
  color: #008292;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.topic-page-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.topic-page-item-snippet {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pagination */
.topic-page-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.pag-btn:hover:not(.disabled):not(.active) {
  border-color: var(--accent);
  color: var(--text);
}

.pag-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.pag-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* === Inline hero search results === */
.hero-inline-results {
  max-width: 540px;
  margin: 0 auto;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-search.searching .hero-inline-results {
  max-width: 680px;
  max-height: none;
  overflow: visible;
  opacity: 1;
  padding: 20px 0 12px;
}

.hero-inline-results-list {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 10px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.hero-inline-results-list::-webkit-scrollbar {
  width: 4px;
}
.hero-inline-results-list::-webkit-scrollbar-track {
  background: transparent;
}
.hero-inline-results-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
}
.hero-inline-results-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.hero-inline-results .inline-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 2px;
}

.hero-inline-results .inline-results-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

.hero-inline-results .inline-results-count {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
}

.hero-inline-result {
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.hero-inline-result:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.hero-inline-result .result-category {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.hero-inline-result .result-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.hero-inline-result .result-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-inline-result .result-snippet mark {
  background: rgba(61,201,218,0.2);
  color: var(--accent);
  padding: 1px 3px;
  border-radius: 2px;
}

.hero-inline-show-more {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hero-inline-show-more:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.35);
  color: #ffffff;
}

.hero-inline-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.hero-inline-no-results svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

.hero-inline-no-results p {
  font-size: 0.9rem;
}

/* Hide browse section when searching */
.hero-search.searching ~ .browse-section {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0 40px;
  transition: opacity 0.3s ease, max-height 0.4s ease, padding 0.4s ease;
}

.browse-section {
  transition: opacity 0.3s ease, max-height 0.5s ease, padding 0.4s ease;
  max-height: 2000px;
}

/* === Mobile === */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 12px;
  z-index: 90;
}

.mobile-title {
  font-size: 1rem;
  font-weight: 600;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}

.menu-toggle:hover { background: var(--border-light); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  #app.no-sidebar .mobile-header { display: none; }
  #app.no-sidebar .main { padding-top: 0; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open { transform: translateX(0); }

  .main {
    margin-left: 0;
    padding-top: var(--header-height);
  }

  .hero-search {
    padding: 40px 20px 36px;
  }

  .hero-search h1 { font-size: 1.5rem; }

  .chapter-cards {
    grid-template-columns: 1fr;
    padding: 24px 20px 40px;
  }

  .article-view, .search-results {
    padding: 24px 20px 60px;
  }

  .article-layout {
    flex-direction: column-reverse;
  }

  .article-sidebar {
    width: 100%;
    position: static;
  }

  .article-title { font-size: 1.3rem; }

  .article-nav-footer { flex-direction: column; }
}

/* === Scrollbar for main === */
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Print */
@media print {
  .sidebar, .mobile-header, .breadcrumbs, .article-pager, .article-nav-footer { display: none !important; }
  .main { margin-left: 0 !important; }
}

/* === Article tools (details panel) === */
.article-tool-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #d5dbe3);
  background: rgba(41, 128, 185, 0.06);
  color: #2980B9;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.article-tool-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* === Crosswalk (details panel) === */
.crosswalk-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.crosswalk-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.crosswalk-framework {
  font-size: 0.7rem;
  font-weight: 700;
}

.crosswalk-ref {
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.75;
}

/* === Clickable references === */
.ref-text a.ref-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: color 0.15s ease;
}

.ref-text a.ref-link:hover {
  color: #2980B9;
  border-bottom-style: solid;
}

.ref-arrow {
  font-size: 0.85em;
  opacity: 0.6;
}

.article-body a {
  color: #2980B9;
  text-decoration: none;
  border-bottom: 1px solid rgba(41, 128, 185, 0.3);
  word-break: break-all;
}

.article-body a:hover {
  border-bottom-color: currentColor;
}

/* === Internal article links === */
.article-body a.kb-link {
  color: #0a6ba8;
  font-weight: 500;
  word-break: normal;
  border-bottom: 1px dashed rgba(10, 107, 168, 0.45);
}

.article-body a.kb-link:hover {
  color: var(--accent);
  border-bottom-style: solid;
}

/* === Article prev/next pager === */
.article-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.pager-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: var(--transition);
}

.pager-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.pager-card.next {
  align-items: flex-end;
  text-align: right;
}

.pager-card.empty {
  background: transparent;
  border: none;
  pointer-events: none;
}

.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: var(--transition);
}

.pager-card:hover .pager-label {
  color: var(--accent);
}

.pager-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
}

.pager-phase {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .article-pager { grid-template-columns: 1fr; }
  .pager-card.next { align-items: flex-start; text-align: left; }
  .pager-card.empty { display: none; }
}

/* === Listing page header (phase / topic / filtered) === */
.topic-page-header {
  align-items: flex-start;
  gap: 16px;
}

.topic-page-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.topic-page-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.topic-page-eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #008292;
  margin-bottom: 2px;
}

.topic-page-heading-text .topic-page-title {
  font-size: 1.3rem;
  line-height: 1.3;
}

.topic-page-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 58ch;
}

.topic-page-clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Listing items are now real links */
.topic-page-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* === Topic mini-tags on result/listing items === */
.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border-light);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.mini-tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
