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

/* Design tokens live in theme.css (loaded before this file). */

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Sticky Top Wrapper ===== */
.sticky-top {
  position: sticky;
  top: 0;
  /* Above the detail drawer scrim (z-index 1000) so the breadcrumb top-bar
     stays visible and clickable while a packet drawer is open. */
  z-index: 1001;
  background: var(--color-bg);
}

/* ===== Under-Construction Banner ===== */
.under-construction-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--color-warning-dim);
  border-bottom: 1px solid var(--color-warning);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  text-align: center;
}

.under-construction-icon {
  display: none;
}

/* ===== Top Bar ===== */
.top-bar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
}

.header-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  min-width: 0;
}

.breadcrumb-logo { height: 20px; width: auto; display: block; }

.breadcrumb-sep { color: var(--color-text-muted); }

.breadcrumb-current {
  color: var(--color-text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.breadcrumb-current.breadcrumb-link {
  cursor: pointer;
  color: var(--color-accent);
}

.breadcrumb-current.breadcrumb-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb-crumb {
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-trail .breadcrumb-crumb:last-child {
  color: var(--color-text);
  font-weight: 600;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.topbar-search input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

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

.topbar-search input:focus {
  outline: none;
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.topbar-search .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--sticky-header-h, 88px));
}

/* ===== Sidebar (dark navigation spine) ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--sticky-header-h, 88px);
  height: calc(100vh - var(--sticky-header-h, 88px));
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  width: 100%;
  padding: 1.5rem 1.25rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: none;
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-header:hover { background: rgba(255,255,255,0.04); }
.sidebar-header:hover .kit-title { color: var(--color-primary-light); }

.sidebar-header:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: -2px;
}

.kit-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(13, 148, 136, 0.15);
  color: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kit-meta { min-width: 0; }

.kit-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-sidebar-active-text);
  letter-spacing: -0.01em;
  line-height: 1.3;
  transition: color 0.15s;
}

.kit-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--color-sidebar-text-dim);
  margin-top: 0.15rem;
}

/* ===== Mobile nav toggle ===== */
.mobile-nav-toggle {
  display: none;
  width: calc(100% - 2.5rem);
  margin: 0.75rem 1.25rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-sidebar-active-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-active-text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav-toggle svg { transition: transform 0.2s; }
.mobile-nav-toggle.open svg { transform: rotate(180deg); }

/* ===== Section Nav ===== */
.section-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

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

/* --- Partitions: visually distinct sections --- */
.nav-partition {
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: relative;
}

.nav-partition:last-child { border-bottom: none; }

.nav-partition-header {
  padding: 0.25rem 1rem 0.35rem;
  display: flex;
  flex-direction: column;
}

.nav-partition-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-sidebar-active-text);
}

.nav-partition-hint {
  display: block;
  font-size: 0.6rem;
  color: var(--color-sidebar-text-dim);
  margin-top: 0.1rem;
  font-weight: 400;
  font-style: italic;
}

/* Accent indicators per partition type */
#nav-partition-role .nav-partition-label { color: var(--color-sidebar-active-text); }
#nav-partition-learning .nav-partition-label { color: #a5d6a7; }
#nav-partition-packets .nav-partition-label { color: #90caf9; }
#nav-partition-assets .nav-partition-label { color: #ffcc80; }

/* --- Filter sub-groups within partitions --- */
.nav-filter-group {
  margin-top: 0.2rem;
}

.nav-filter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.35rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

.nav-filter-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-sidebar-text);
  letter-spacing: 0.02em;
}

.nav-filter-toggle .nav-group-chevron {
  opacity: 0.4;
}

.nav-filter-toggle[aria-expanded="false"] .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group { padding: 0.5rem 0; }

.nav-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-sidebar-group);
  padding: 0.5rem 1.25rem 0.35rem;
}

.nav-list { list-style: none; }

.nav-item { position: relative; }

.nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.4rem 1rem;
  text-decoration: none;
  color: var(--color-sidebar-text);
  font-size: 0.78rem;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item a:hover {
  background: var(--color-sidebar-hover-bg);
  color: var(--color-sidebar-active-text);
}

.nav-item.active a {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  font-weight: 600;
  border-left-color: var(--color-primary-light);
}

.nav-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  color: var(--color-sidebar-text-dim);
}

.nav-item.active .nav-count {
  background: var(--color-primary);
  color: #fff;
}

.nav-empty {
  padding: 0.55rem 1.25rem;
  font-size: 0.8rem;
  color: var(--color-sidebar-text-dim);
}

/* ===== Role Selector ===== */
.role-selector {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.75rem;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-sidebar-text);
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.role-btn:hover {
  background: var(--color-sidebar-hover-bg);
  color: var(--color-sidebar-active-text);
}

.role-btn.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  font-weight: 600;
  border-color: var(--color-primary-light);
}

.role-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.12);
  color: var(--color-primary-light);
  font-size: 0.55rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.role-btn-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Nav Items: Icons + Badges ===== */
.nav-item-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
  margin-right: -0.2rem;
}

.nav-badge {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
}

.nav-badge-required {
  background: var(--color-primary);
  color: #fff;
}

.nav-badge-soon {
  background: rgba(255,255,255,0.08);
  color: var(--color-sidebar-text-dim);
}

.nav-item-locked {
  opacity: 0.5;
  pointer-events: none;
}

.nav-item-empty { opacity: 0.45; }

/* ===== Collapsible Nav Groups ===== */
.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 1.25rem 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

.nav-group-toggle .nav-group-title {
  padding: 0;
}

.nav-group-chevron {
  transition: transform 0.2s;
  opacity: 0.5;
}

.nav-group-toggle[aria-expanded="false"] .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-list.collapsed {
  display: none;
}

/* Role selector within partition */
.nav-partition .role-selector {
  padding: 0 0.75rem;
}

/* ===== Role Chooser Overlay ===== */
.role-chooser-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
}

.role-chooser {
  max-width: 520px;
  text-align: center;
}

.role-chooser-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.role-chooser-sub {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

.role-chooser-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.role-chooser-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.role-chooser-btn:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.10);
  transform: translateY(-2px);
}

.role-chooser-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.12);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.role-chooser-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  display: block;
}

.role-chooser-desc {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  display: block;
  margin-top: 0.15rem;
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-sidebar-text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-link:hover { color: var(--color-sidebar-active-text); }

.nav-item a:focus-visible,
.sidebar-link:focus-visible,
.mobile-nav-toggle:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: -2px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2.5rem 4rem;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.8rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

.filter-group select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--color-border-hover);
}

.active-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}

.filter-chip button {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}
.filter-chip button:hover { opacity: 1; }

.clear-all-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.18rem 0.4rem;
}

.results-summary {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag-btn {
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 99px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.tag-btn:hover, .tag-btn.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ===== Document Layout ===== */
.doc-intro {
  padding: 1.75rem 0 1rem;
  border-bottom: 1px solid var(--color-border);
}

.doc-intro h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.doc-intro p {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
  max-width: 68ch;
}

/* Role entry points */
.entry-points {
  padding: 1.5rem 0 0.25rem;
}

.entry-points-head {
  margin-bottom: 0.85rem;
}

.entry-points-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.entry-points-sub {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.entry-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.6rem;
}

.entry-point {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
}

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

.entry-point:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.entry-point.active {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.entry-point-icon {
  font-size: 1.15rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.entry-point-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.entry-point-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.entry-point.active .entry-point-label { color: var(--color-accent); }

.entry-point-desc {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

/* Sections */
.doc-section {
  margin-top: 2.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  scroll-margin-top: calc(var(--sticky-header-h, 5rem) + 1.5rem);
}

.doc-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-text);
  padding: 0.85rem 1.5rem;
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
}

.doc-section-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-dim);
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
}

.doc-entries {
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem;
}

/* Entries */
.doc-entry {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

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

.entry-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.entry-title a {
  color: var(--color-text);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.entry-depth { display: inline-flex; gap: 0.25rem; }

.depth-badge {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-info);
  background: var(--color-info-dim);
  padding: 0.06rem 0.4rem;
  border-radius: 99px;
}

.entry-draft {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-warning);
  background: var(--color-warning-dim);
  padding: 0.08rem 0.4rem;
  border-radius: 99px;
}

.entry-tier {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.08rem 0.4rem;
  border-radius: 99px;
}
.entry-tier.tier-internal { color: var(--color-danger); background: var(--color-danger-dim); }
.entry-tier.tier-partner { color: var(--color-purple); background: var(--color-purple-dim); }
.entry-tier.tier-public { color: var(--color-success); background: var(--color-success-dim); }

.entry-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin-bottom: 0.55rem;
  max-width: 72ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.74rem;
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s;
}

.entry-link:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

.entry-link-count {
  font-size: 0.62rem;
  color: var(--color-text-muted);
  background: var(--color-surface-raised);
  padding: 0.02rem 0.3rem;
  border-radius: 99px;
}

.entry-link:hover .entry-link-count { color: var(--color-accent); }

.entry-details {
  border-style: dashed;
  font-weight: 600;
}

/* ===== Shared (drawer) badges ===== */
.packet-type-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-bottom: 0.15rem;
}

.packet-overlays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}

.overlay-badge {
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.overlay-audience {
  background: var(--color-purple-dim);
  color: var(--color-purple);
}

.overlay-level {
  background: var(--color-info-dim);
  color: var(--color-info);
}

/* ===== Detail slide-over drawer ===== */
.drawer-scrim {
  position: fixed;
  /* Start below the sticky top-bar so it stays visible/clickable (the
     breadcrumb closes the drawer); the scrim dims the catalog + sidebar. */
  top: var(--sticky-header-h, 88px);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.drawer-scrim.open {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  /* Absolute within the scrim (a fixed, positioned ancestor) so positioning
     doesn't depend on the scrim's backdrop-filter containing block. */
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 560px;
  max-width: 92vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-scrim.open .drawer-panel { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .drawer-scrim,
  .drawer-panel { transition: none; }
}

.drawer-header {
  flex-shrink: 0;
  padding: 1.15rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.drawer-header h2 { font-size: 1.15rem; font-weight: 700; }

.drawer-close {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.15s;
}

.drawer-close:hover { color: var(--color-text); }

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.15rem 1.25rem;
}

.drawer-section { margin-bottom: 1.15rem; }

.drawer-section h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.3rem;
}

.content-group {
  margin-bottom: 1rem;
}

.content-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0.5rem 0.65rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 0.35rem;
}

.content-group-header:hover {
  border-color: var(--color-border-hover);
}

.content-group-header:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.content-group-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.content-group-count {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
}

.content-group-toggle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform 0.2s;
}

.content-group.expanded .content-group-toggle {
  transform: rotate(90deg);
}

.content-group-items {
  display: none;
  padding: 0 0.25rem;
}

.content-group.expanded .content-group-items {
  display: block;
}

.content-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.6rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  transition: background 0.1s;
}

.content-item:last-child { border-bottom: none; }

.content-item:hover { background: var(--color-surface-hover); }

.content-item a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.content-item a:hover { text-decoration: underline; }

.content-item-meta {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.content-item-desc {
  width: 100%;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  padding-left: 1.6rem;
}

.loading-spinner {
  text-align: center;
  padding: 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.preview-content {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.preview-content h1, .preview-content h2, .preview-content h3 {
  color: var(--color-text);
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.preview-content h1 { font-size: 1.1rem; }
.preview-content h2 { font-size: 0.95rem; }
.preview-content h3 { font-size: 0.85rem; }
.preview-content p { margin-bottom: 0.5rem; }

.preview-content code {
  background: var(--color-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.preview-content pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.preview-content pre code { background: none; padding: 0; }

.preview-content ul, .preview-content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.preview-content th, .preview-content td {
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.preview-content th { background: var(--color-surface); font-weight: 600; }
.preview-content a { color: var(--color-accent); }

.resource-list { list-style: none; }

.resource-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.resource-item:last-child { border-bottom: none; }

.resource-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.78rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
}

.resource-info { flex: 1; }

.resource-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-accent);
  text-decoration: none;
}

.resource-title:hover { text-decoration: underline; }

.resource-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.08rem;
}

.resource-access {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.06rem 0.3rem;
  border-radius: 99px;
}

.resource-access.public { background: var(--color-success-dim); color: var(--color-success); }
.resource-access.protected { background: var(--color-warning-dim); color: var(--color-warning); }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }

.empty-state h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--color-text-secondary);
}

.site-footer {
  margin-top: 3rem;
  background: transparent;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.72rem;
}
.site-footer a { color: var(--color-accent); text-decoration: none; }
.site-footer a:hover { color: var(--color-accent); text-decoration: underline; }

/* Search-match highlight */
mark {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-radius: 3px;
  padding: 0 2px;
}

/* ===== Top-bar right cluster (Foundations link + search) ===== */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.topbar-link:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-dim);
}

.topbar-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== Overview: Section titles ===== */
.overview-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.overview-section-sub {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.overview-learning { margin-bottom: 2rem; }
.overview-recommended { margin-bottom: 2rem; }

/* ===== Overview: Learning Cards ===== */
.learning-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.learning-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.learning-card-active:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.10);
  transform: translateY(-2px);
}

.learning-card-locked {
  opacity: 0.55;
  border-style: dashed;
}

.learning-card-step {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.learning-card-icon {
  display: none;
}

.learning-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.learning-card-desc {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.learning-card-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: auto;
}

.learning-card-locked-label {
  color: var(--color-text-muted);
}

/* ===== Overview: Foundations call-to-action ===== */
.foundations-cta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.25rem 0 0;
  padding: 0.7rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-primary-subtle);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.foundations-cta:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.foundations-cta:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.foundations-cta-icon { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }

.foundations-cta-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.foundations-cta-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text); }
.foundations-cta-sub { font-size: 0.74rem; color: var(--color-text-secondary); }

/* ===== Overview: section tiles ===== */
.section-tiles { padding: 1.75rem 0 0; }

.tiles-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.tiles-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.tiles-note { font-size: 0.78rem; color: var(--color-text-secondary); }

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.7rem;
}

.section-tile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.section-tile:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.section-tile:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.section-tile.is-empty { opacity: 0.55; }

.tile-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 0.55rem;
}

.tile-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.tile-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.tile-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-dim);
  padding: 0.05rem 0.45rem;
  border-radius: 99px;
}

.tile-blurb { font-size: 0.78rem; line-height: 1.4; color: var(--color-text-secondary); }

.tile-arrow {
  font-size: 1rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.section-tile:hover .tile-arrow,
.foundations-cta:hover .tile-arrow {
  color: var(--color-accent);
  transform: translateX(2px);
}

/* ===== Section / search view header ===== */
.view-head {
  padding: 1.5rem 0 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  cursor: pointer;
}

.back-link:hover { text-decoration: underline; }
.back-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.view-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.view-sub {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 68ch;
}

/* ===== Refine bar (persona switcher + depth/domain) ===== */
.refine-bar {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 0 0.25rem;
}

.persona-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.persona-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 99px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.persona-chip:hover { border-color: var(--color-accent); color: var(--color-accent); }

.persona-chip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.persona-chip.active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.refine-selects {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.refine-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.refine-group > span {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.refine-group select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
}

.refine-group select:focus { outline: none; border-color: var(--color-border-hover); }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .main-content { padding: 1.25rem 1.5rem 3rem; }
}

@media (max-width: 900px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    min-width: 100%;
    height: auto;
    overflow: visible;
  }
  .sidebar-header { display: none; }
  .mobile-nav-toggle { display: flex; }
  .section-nav {
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .section-nav.open { display: block; }
  .main-content { padding: 1.25rem 1.25rem 3rem; }
  .topbar-search { max-width: none; }
}

@media (max-width: 600px) {
  .top-bar { height: auto; padding: 0.55rem 1rem; }
  .header-inner { flex-wrap: wrap; }
  .breadcrumb-trail { display: none; }
  .topbar-right { flex-basis: 100%; }
  .topbar-link span { display: none; }
  .topbar-link { padding: 0.4rem 0.55rem; }
  .main-content { padding: 1rem 1rem 2.5rem; }
  .refine-selects { align-items: stretch; }
  .results-summary { margin-left: 0; }
  .view-title { font-size: 1.35rem; }
  .drawer-panel { width: 100%; max-width: 100%; }
}

/* ===== In-app document viewer (doc.html) ===== */

.doc-viewer-shell {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.doc-viewer-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.doc-viewer-back {
  font-size: 0.85rem;
  color: var(--color-accent);
  text-decoration: none;
}
.doc-viewer-back:hover { text-decoration: underline; }
.doc-viewer-tier { margin-left: auto; }
.doc-viewer-error {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-secondary);
}
.doc-viewer-error h1 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.doc-viewer-error a { color: var(--color-accent); }

.markdown-body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.3;
}
.markdown-body h1 { font-size: 1.5rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.25rem; border-bottom: 1px solid var(--color-border-light); padding-bottom: 0.25em; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { margin: 0.75em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin: 0.75em 0; }
.markdown-body li { margin: 0.25em 0; }
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-surface-raised);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}
.markdown-body pre {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
}
.markdown-body pre code {
  background: none;
  padding: 0;
}
.markdown-body blockquote {
  border-left: 3px solid var(--color-primary);
  margin: 1em 0;
  padding: 0.5em 1em;
  color: var(--color-text-secondary);
  background: var(--color-primary-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--color-border);
  padding: 0.5em 0.75em;
  text-align: left;
}
.markdown-body th { background: var(--color-surface-raised); font-weight: 600; }
.markdown-body a { color: var(--color-accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }

/* ===== Access tier badges ===== */

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.access-public  { background: var(--color-success-dim); color: #047857; }
.access-bronze  { background: rgba(180,83,9,0.12);  color: #92400e; }
.access-silver  { background: rgba(107,114,128,0.12); color: #4b5563; }
.access-gold    { background: rgba(217,119,6,0.12);  color: #b45309; }
.access-platinum { background: rgba(99,102,241,0.12); color: #4338ca; }
.access-internal { background: var(--color-danger-dim); color: #b91c1c; }

/* ===== Packet Detail View (full-width) ===== */

.packet-view {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.pv-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.pv-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pv-title-group {
  flex: 1;
  min-width: 0;
}

.pv-type-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.3rem;
}

.pv-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.pv-description {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  max-width: 72ch;
}

.pv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.pv-meta-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pv-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pv-meta-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  white-space: nowrap;
}

.pv-meta-audience {
  background: var(--color-purple-dim);
  color: var(--color-purple);
}

.pv-meta-level {
  background: var(--color-info-dim);
  color: var(--color-info);
}

.pv-meta-domain {
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.pv-meta-sep {
  width: 1px;
  height: 16px;
  background: var(--color-border);
}

/* Table of contents */
.pv-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.pv-toc-label {
  width: 100%;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.pv-toc-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  padding: 0.3em 0.7em;
  border-radius: var(--radius-sm);
  background: var(--color-primary-dim);
  transition: background 0.15s;
}

.pv-toc-link:hover {
  background: rgba(13, 148, 136, 0.15);
}

/* Content sections */
.pv-content-section {
  margin-bottom: 2.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border);
}

.pv-content-section:hover {
  border-left-color: var(--color-accent);
}

.pv-content-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.pv-content-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.pv-content-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-raised);
  padding: 0.15em 0.5em;
  border-radius: 99px;
}

.pv-content-desc {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  max-width: 60ch;
}

/* Item cards grid */
.pv-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.pv-items-grid:has(.pv-item-card:only-child) {
  grid-template-columns: 1fr;
  max-width: 480px;
}

.pv-item-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

.pv-item-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.10);
  transform: translateY(-2px);
}

.pv-item-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  background: var(--color-primary-dim);
  border-radius: var(--radius-sm);
}

.pv-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pv-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1.3;
}

.pv-item-desc {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pv-item-meta {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

.pv-item-arrow {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
  transition: color 0.15s, transform 0.15s;
}

.pv-item-card:hover .pv-item-arrow {
  color: var(--color-accent);
  transform: translateX(2px);
}

/* Resources section */
.pv-resources-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.pv-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.pv-resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.pv-resource-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.pv-resource-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-hover);
}

.pv-resource-icon {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.pv-resource-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pv-resource-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.pv-resource-desc {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.pv-resource-section-tag {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.2em 0.5em;
  border-radius: 4px;
}

.pv-loading {
  text-align: center;
  padding: 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  grid-column: 1 / -1;
}

/* ===== Item Detail View ===== */
.item-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.iv-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.iv-breadcrumb {
  margin: 0.5rem 0 0.75rem;
}

.iv-crumb-group {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.iv-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.iv-icon {
  flex-shrink: 0;
}

.iv-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
  margin: 0;
}

.iv-description {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.iv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.iv-meta-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  background: var(--color-surface-alt, #f1f5f9);
  color: var(--color-text-secondary);
}

.iv-body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2rem;
  align-items: start;
}

.iv-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.iv-action-card {
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.iv-open-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity 0.15s;
}

.iv-open-link:hover { opacity: 0.8; }

.iv-packet-link {
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.iv-packet-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.iv-packet-ref {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.iv-packet-ref:hover { opacity: 0.75; }

.iv-packet-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(13,148,136,0.08);
  flex-shrink: 0;
}

.iv-packet-info {
  display: flex;
  flex-direction: column;
}

.iv-packet-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

.iv-packet-type {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.iv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.iv-sidebar-section {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.iv-sidebar-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.iv-siblings {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.iv-sibling {
  display: block;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.iv-sibling:hover {
  background: rgba(0,0,0,0.03);
  color: var(--color-text);
}

.iv-sibling-active {
  background: var(--color-primary-light);
  color: var(--color-text);
  font-weight: 600;
}

.iv-other-groups {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.iv-group-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.iv-group-link:hover {
  background: rgba(0,0,0,0.03);
}

.iv-group-count {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

/* ===== Tiles Note ===== */
.tiles-note {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.overview-more-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

.overview-results { margin-bottom: 2rem; }

/* Responsive */
@media (max-width: 768px) {
  .packet-view {
    padding: 1rem 0.5rem 2rem;
  }
  .pv-items-grid {
    grid-template-columns: 1fr;
  }
  .pv-resources-grid {
    grid-template-columns: 1fr;
  }
  .pv-title {
    font-size: 1.25rem;
  }
  .iv-body {
    grid-template-columns: 1fr;
  }
}

/* ===== Resource Type Icons (text-based) ===== */
.res-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--color-border);
  color: var(--color-text-secondary);
}

.res-icon-md { background: #e8f5e9; color: #2e7d32; }
.res-icon-repo { background: #e3f2fd; color: #1565c0; }
.res-icon-web { background: #fff3e0; color: #e65100; }
.res-icon-devin { background: rgba(13,148,136,0.12); color: var(--color-primary); }
.res-icon-doc { background: #e8eaf6; color: #283593; }
.res-icon-video { background: #fce4ec; color: #c62828; }
