:root {
  --bg: #eef4fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-soft: #f5f9ff;
  --line: #d7e3f1;
  --line-strong: #bfd3ee;
  --text: #142033;
  --muted: #61748b;
  --accent: #1859c7;
  --accent-soft: #e8f1ff;
  --accent-warm: #d94763;
  --shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(24, 89, 199, 0.14), transparent 20rem),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 54%, #e8eff8 100%);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(215, 227, 241, 0.9);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
  text-decoration: none;
}

.brand img {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: contain;
}

.brand span {
  display: grid;
  gap: 0.06rem;
}

.brand strong {
  font-size: 1rem;
}

.brand small,
.summary-card span,
.summary-card small,
.filter-panel span,
.quick-filter-group > span,
.quick-filter-head span,
.library-insight-head span,
.resource-meta,
.resource-source,
.result-head span,
.empty-state,
.latest-resource-card p,
.library-kicker,
.library-lead {
  color: var(--muted);
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.48rem;
}

.topnav a,
.result-head button,
.filter-panel button,
.ghost-button,
.quick-filter-chip,
.spotlight-chip,
.active-filter-pill button,
.file-link,
.resource-open-button,
.resource-ai-button,
.latest-resource-actions a,
.latest-resource-actions button,
.library-action-secondary,
.library-action-primary {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  text-decoration: none;
  font-weight: 820;
  line-height: 1;
}

button.file-link,
button.resource-open-button,
.latest-resource-actions button[data-source-file-id] {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.topnav a {
  padding: 0.62rem 0.82rem;
}

.layout {
  width: min(1220px, calc(100% - 2rem));
  margin: 1.1rem auto 3rem;
}

.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 28rem);
  gap: 1rem;
  align-items: start;
}

.library-hero-copy,
.filter-panel,
.quick-filter-panel,
.library-latest-panel,
.result-head,
.active-filters,
.resource-card,
.empty-state,
.summary-card,
.library-insight-card {
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.library-hero-copy {
  display: grid;
  gap: 1rem;
  padding: 1.35rem;
}

.library-kicker {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.library-hero-copy h1 {
  margin: 0;
  max-width: 11ch;
  color: #0c1828;
  font-size: clamp(2.7rem, 5vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.library-lead {
  max-width: 38rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.75;
}

.library-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
}

.library-action-primary,
.library-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.05rem;
  padding: 0 1.1rem;
}

.library-action-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, #2274d6 56%, var(--accent-warm) 100%);
  color: #fff;
  box-shadow: 0 18px 34px rgba(24, 89, 199, 0.2);
}

.library-workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.72rem;
}

.library-workflow[hidden] {
  display: none !important;
}

.library-workflow article,
.summary-card,
.latest-resource-card {
  border: 1px solid rgba(191, 211, 238, 0.92);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.88);
}

.library-workflow article {
  display: grid;
  gap: 0.32rem;
  min-height: 7rem;
  padding: 0.9rem;
}

.library-workflow span,
.library-insight-head strong,
.summary-card span {
  font-size: 0.78rem;
  font-weight: 900;
}

.library-workflow strong {
  font-size: 0.95rem;
  line-height: 1.45;
}

.library-hero-panel {
  display: grid;
  gap: 0.9rem;
}

.summary-grid {
  display: grid;
  gap: 0.72rem;
}

.summary-card {
  display: grid;
  gap: 0.32rem;
  min-height: 6rem;
  padding: 1rem;
}

.summary-card strong {
  font-size: clamp(1.4rem, 3vw, 1.95rem);
  line-height: 1.1;
}

.library-insight-card {
  display: grid;
  gap: 0.78rem;
  padding: 1rem;
}

.library-insight-head {
  display: grid;
  gap: 0.18rem;
}

.course-spotlight,
.quick-filter-list,
.active-filter-list,
.file-list,
.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}

.spotlight-chip,
.quick-filter-chip,
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2.3rem;
  padding: 0 0.78rem;
}

.spotlight-chip,
.quick-filter-chip {
  color: var(--text);
  cursor: pointer;
}

.spotlight-chip small,
.quick-filter-chip small {
  color: var(--muted);
  font-weight: 760;
}

.spotlight-chip:hover,
.quick-filter-chip:hover,
.ghost-button:hover,
.result-head button:hover,
.resource-open-button:hover,
.file-link:hover,
.active-filter-pill button:hover,
.latest-resource-actions a:hover,
.latest-resource-actions button:hover {
  border-color: var(--line-strong);
}

.filter-panel,
.quick-filter-panel,
.library-latest-panel {
  margin-top: 0.92rem;
  padding: 1rem;
}

.filter-panel form {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 170px 140px 150px 130px auto;
  gap: 0.7rem;
  align-items: end;
}

.filter-panel label {
  display: grid;
  gap: 0.34rem;
  min-width: 0;
}

.filter-panel span,
.quick-filter-group > span {
  font-size: 0.78rem;
  font-weight: 900;
}

.filter-panel input,
.filter-panel select {
  width: 100%;
  min-width: 0;
  height: 2.78rem;
  border: 1px solid var(--line);
  border-radius: 0.82rem;
  padding: 0 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  outline: none;
  font: inherit;
}

.filter-panel input:focus,
.filter-panel select:focus {
  border-color: #94bfff;
  box-shadow: 0 0 0 3px rgba(24, 89, 199, 0.12);
}

.filter-panel button,
.result-head button,
.ghost-button {
  min-height: 2.78rem;
  padding: 0 1rem;
  cursor: pointer;
}

.filter-panel button,
.result-head button,
.latest-resource-actions button,
.resource-ai-button {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.quick-filter-panel {
  background:
    linear-gradient(180deg, rgba(232, 241, 255, 0.84), rgba(255, 255, 255, 0.35)),
    var(--surface);
}

.quick-filter-head,
.result-head,
.resource-top,
.resource-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.quick-filter-head strong,
.result-head strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
}

.quick-filter-head span,
.result-head span {
  display: block;
  max-width: 46rem;
  line-height: 1.55;
}

.quick-filter-groups {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.95rem;
}

.quick-filter-group {
  display: grid;
  gap: 0.48rem;
}

.quick-filter-chip.active {
  border-color: rgba(24, 89, 199, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.quick-filter-chip.active small {
  color: inherit;
}

.library-latest-panel {
  display: grid;
  gap: 0.95rem;
}

.latest-resource-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.72rem;
}

.latest-resource-card {
  display: grid;
  gap: 0.72rem;
  min-width: 0;
  padding: 0.95rem;
}

.latest-resource-meta,
.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.latest-resource-meta span,
.resource-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.24rem 0.54rem;
  background: var(--surface-soft);
  color: #39526d;
  font-size: 0.76rem;
  font-weight: 800;
}

.latest-resource-card strong,
.resource-card h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.48;
}

.latest-resource-card p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.62;
}

.latest-resource-actions,
.resource-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.latest-resource-actions a,
.latest-resource-actions button,
.resource-open-button,
.resource-ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.32rem;
  padding: 0 0.86rem;
  cursor: pointer;
}

.latest-resource-actions a,
.resource-open-button {
  color: var(--accent);
}

.result-head {
  margin-top: 0.92rem;
  padding: 0.88rem 0.95rem;
}

.result-head div {
  display: grid;
  gap: 0.18rem;
}

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

.active-filters {
  display: grid;
  gap: 0.68rem;
  margin-top: 0.82rem;
  padding: 0.82rem 0.95rem;
  background: rgba(245, 249, 255, 0.86);
}

.active-filters strong {
  font-size: 0.86rem;
}

.active-filter-pill {
  border: 1px solid rgba(24, 89, 199, 0.18);
  background: #fff;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 760;
}

.active-filter-pill button {
  min-width: 1.68rem;
  min-height: 1.68rem;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.resource-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.92rem;
}

.resource-card {
  display: grid;
  gap: 0.78rem;
  padding: 1rem;
}

.resource-type {
  color: var(--accent);
}

.resource-type.book {
  color: #0f766e;
}

.resource-type.doc {
  color: #b45309;
}

.resource-source {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.58;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.32rem;
  padding: 0 0.74rem;
  color: var(--text);
}

.file-link strong {
  color: var(--accent);
}

.resource-action-buttons {
  justify-content: flex-end;
}

.resource-ai-button {
  box-shadow: 0 12px 28px rgba(24, 89, 199, 0.18);
}

.empty-state {
  padding: 1.4rem;
  text-align: center;
}

.empty-state.inline {
  display: inline-flex;
  width: auto;
  padding: 0.45rem 0.72rem;
}

@media (max-width: 1080px) {
  .library-hero,
  .latest-resource-list,
  .filter-panel form {
    grid-template-columns: 1fr;
  }

  .filter-panel button {
    grid-column: auto;
  }
}

@media (max-width: 860px) {
  .library-workflow {
    grid-template-columns: 1fr;
  }

  .filter-panel form {
    grid-template-columns: 1fr 1fr;
  }

  .filter-panel label:first-child,
  .filter-panel button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar,
  .quick-filter-head,
  .resource-top,
  .resource-actions,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav {
    justify-content: stretch;
  }

  .topnav a,
  .library-hero-actions a {
    flex: 1;
    text-align: center;
  }

  .layout {
    width: min(100%, calc(100% - 1rem));
    margin-top: 0.7rem;
  }

  .library-hero-copy,
  .filter-panel,
  .quick-filter-panel,
  .library-latest-panel,
  .result-head,
  .active-filters,
  .resource-card {
    padding: 0.92rem;
    border-radius: 1.05rem;
  }

  .library-hero-copy h1 {
    max-width: none;
    font-size: clamp(2.2rem, 12vw, 3.15rem);
  }

  .summary-grid,
  .filter-panel form {
    grid-template-columns: 1fr;
  }

  .filter-panel label:first-child,
  .filter-panel button {
    grid-column: auto;
  }

  .quick-filter-chip,
  .spotlight-chip,
  .active-filter-pill,
  .file-link,
  .resource-open-button,
  .resource-ai-button,
  .latest-resource-actions a,
  .latest-resource-actions button {
    width: 100%;
    justify-content: space-between;
  }

  .result-actions,
  .resource-action-buttons,
  .latest-resource-actions {
    width: 100%;
  }
}

/* Student utility pass: search first, minimal copy, no onboarding prose. */
.layout {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: min(1320px, calc(100% - 2rem));
}

.filter-panel {
  order: 1;
  position: sticky;
  top: 4.25rem;
  z-index: 24;
  margin-top: 0;
  padding: 0.78rem;
  border-radius: 1rem;
}

.library-hero {
  order: 2;
  grid-template-columns: minmax(0, 1fr) minmax(24rem, 31rem);
  gap: 0.75rem;
}

.quick-filter-panel {
  order: 3;
  margin-top: 0;
  padding: 0.78rem;
  border-radius: 1rem;
}

.library-latest-panel {
  display: none;
}

.result-head {
  order: 4;
  margin-top: 0;
}

.active-filters {
  order: 5;
  margin-top: 0;
}

.resource-list {
  order: 6;
  margin-top: 0;
}

.library-hero-copy {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 1rem;
  padding: 1rem;
  border-radius: 1rem;
}

.library-kicker {
  display: none;
}

.library-hero-copy h1 {
  max-width: none;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.library-lead {
  max-width: none;
  font-size: 0.9rem;
  line-height: 1.35;
}

.library-hero-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-content: flex-end;
  gap: 0.45rem;
}

.library-action-primary,
.library-action-secondary {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border-radius: 0.72rem;
}

.library-action-secondary[href="./index.html"] {
  display: none;
}

.library-hero-panel {
  gap: 0.75rem;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-card {
  min-height: 4.35rem;
  gap: 0.12rem;
  padding: 0.72rem;
  border-radius: 1rem;
  box-shadow: none;
}

.summary-card strong {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.summary-card small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-insight-card {
  gap: 0.5rem;
  padding: 0.72rem;
  border-radius: 1rem;
  box-shadow: none;
}

.library-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.library-insight-head span {
  display: none;
}

.course-spotlight,
.quick-filter-list {
  gap: 0.38rem;
}

.filter-panel form {
  grid-template-columns: minmax(18rem, 1.8fr) minmax(8.8rem, 0.75fr) minmax(7rem, 0.58fr) minmax(8.4rem, 0.62fr) minmax(8.4rem, 0.62fr) 4.8rem;
  gap: 0.55rem;
}

.filter-panel label {
  gap: 0.22rem;
}

.filter-panel span,
.quick-filter-group > span {
  font-size: 0.72rem;
}

.filter-panel input,
.filter-panel select,
.filter-panel button,
.result-head button,
.ghost-button {
  height: 2.45rem;
  min-height: 2.45rem;
  border-radius: 0.68rem;
}

.quick-filter-head span,
.result-head span {
  max-width: none;
  line-height: 1.35;
}

.quick-filter-head span {
  display: none;
}

.quick-filter-head strong,
.result-head strong {
  margin-bottom: 0;
}

.quick-filter-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.72rem;
  margin-top: 0.68rem;
}

.quick-filter-chip,
.spotlight-chip,
.active-filter-pill,
.file-link {
  min-height: 2.05rem;
  padding: 0 0.62rem;
  border-radius: 0.66rem;
}

.resource-card {
  gap: 0.55rem;
  padding: 0.82rem 0.9rem;
  border-radius: 1rem;
  box-shadow: none;
}

.resource-card h2 {
  font-size: 0.98rem;
  line-height: 1.42;
}

.resource-meta {
  gap: 0.3rem;
}

.resource-meta span,
.latest-resource-meta span {
  padding: 0.18rem 0.45rem;
  font-size: 0.7rem;
}

.resource-source {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-actions {
  align-items: center;
}

.resource-open-button,
.resource-ai-button {
  min-height: 2.18rem;
  padding: 0 0.72rem;
  border-radius: 0.68rem;
}

.empty-state {
  padding: 1rem;
}

@media (max-width: 1080px) {
  .library-hero,
  .filter-panel form,
  .quick-filter-groups,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    position: static;
  }

  .library-hero-copy {
    grid-template-columns: 1fr;
  }

  .library-hero-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .layout {
    width: min(100%, calc(100% - 0.8rem));
  }

  .topbar {
    padding: 0.72rem;
  }

  .filter-panel,
  .quick-filter-panel,
  .library-hero-copy,
  .library-insight-card,
  .result-head,
  .active-filters,
  .resource-card {
    padding: 0.72rem;
    border-radius: 0.9rem;
  }

  .library-hero-copy h1 {
    font-size: 1.6rem;
  }

  .topnav a,
  .library-hero-actions a,
  .quick-filter-chip,
  .spotlight-chip,
  .active-filter-pill,
  .file-link,
  .resource-open-button,
  .resource-ai-button {
    width: auto;
  }
}

/* Compact library overview: this is a status module, not a landing hero. */
.library-hero {
  order: 1;
  display: grid !important;
  grid-template-columns: minmax(12rem, 0.62fr) minmax(0, 1.55fr) !important;
  align-items: stretch !important;
  gap: 0.55rem !important;
  margin-top: 0;
}

.filter-panel {
  order: 2;
}

.quick-filter-panel {
  order: 3;
}

.result-head {
  order: 4;
}

.active-filters {
  order: 5;
}

.resource-list {
  order: 6;
}

.library-hero-copy,
.library-hero-panel,
.summary-grid,
.library-insight-card {
  min-height: 0 !important;
}

.library-hero-copy {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.7rem !important;
  padding: 0.72rem 0.82rem !important;
  border-radius: 0.95rem !important;
}

.library-hero-copy h1 {
  font-size: 1.12rem !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

.library-lead {
  display: none !important;
}

.library-hero-actions {
  display: flex !important;
  grid-column: auto !important;
  grid-row: auto !important;
  flex: 0 0 auto;
  gap: 0.42rem !important;
  justify-content: flex-end !important;
}

.library-action-secondary {
  display: none !important;
}

.library-action-primary {
  min-height: 2rem !important;
  padding: 0 0.78rem !important;
  border-radius: 999px !important;
  font-size: 0.84rem !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18) !important;
}

.library-hero-panel {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.62fr) !important;
  gap: 0.55rem !important;
}

.summary-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.55rem !important;
}

.summary-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-areas:
    "label value"
    "meta value";
  align-items: center !important;
  min-height: 3.35rem !important;
  padding: 0.5rem 0.65rem !important;
  border-radius: 0.9rem !important;
  box-shadow: none !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.summary-card span {
  grid-area: label;
  min-width: 0;
  font-size: 0.68rem !important;
}

.summary-card strong {
  grid-area: value;
  justify-self: end;
  font-size: 1.22rem !important;
  line-height: 1 !important;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card small {
  grid-area: meta;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.66rem !important;
}

.library-insight-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 0.55rem !important;
  padding: 0.5rem 0.62rem !important;
  border-radius: 0.9rem !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.library-insight-head {
  display: block !important;
}

.library-insight-head strong {
  display: block;
  font-size: 0.74rem;
  line-height: 1.1;
  white-space: nowrap;
}

.course-spotlight {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem !important;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 0.08rem 0.04rem 0.16rem;
  scrollbar-width: none;
}

.course-spotlight::-webkit-scrollbar {
  display: none;
}

.spotlight-chip {
  flex: 0 0 auto;
  min-height: 1.86rem !important;
  padding: 0 0.56rem !important;
  border-radius: 999px !important;
  white-space: nowrap;
}

.filter-panel {
  margin-top: 0;
}

.resource-source,
.resource-source a {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .library-hero {
    grid-template-columns: 1fr !important;
  }

  .library-hero-panel {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 720px) {
  .library-hero-copy {
    flex-wrap: wrap;
  }

  .library-hero-copy h1 {
    white-space: normal;
  }

  .library-hero-actions {
    width: 100%;
    justify-content: flex-start !important;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .summary-card {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "label"
      "value";
    gap: 0.16rem;
    padding: 0.42rem 0.48rem !important;
  }

  .summary-card strong {
    justify-self: start;
    font-size: 0.95rem !important;
  }

  .summary-card small {
    display: none;
  }

  .library-insight-card {
    grid-template-columns: 1fr !important;
  }

  .spotlight-chip {
    min-height: 1.74rem !important;
    padding: 0 0.48rem !important;
    font-size: 0.72rem;
  }
}

/* Resource results: compact scan rows. */
.resource-list {
  gap: 0.72rem !important;
}

.active-filters[hidden] {
  display: none !important;
}

.resource-card {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 0.42rem 1.05rem !important;
  align-items: center !important;
  min-height: 6.2rem !important;
  padding: 0.72rem 1rem 0.76rem 1.28rem !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07) !important;
}

.resource-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.32rem;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
}

.resource-card.accent-2::before {
  background: linear-gradient(180deg, #34d399, #14b8a6);
}

.resource-card.accent-3::before {
  background: linear-gradient(180deg, #8b5cf6, #6366f1);
}

.resource-card.accent-4::before {
  background: linear-gradient(180deg, #fb7185, #ec4899);
}

.resource-card.accent-5::before {
  background: linear-gradient(180deg, #fb923c, #f97316);
}

.resource-top {
  grid-column: 1;
  min-width: 0;
  display: grid !important;
  gap: 0.26rem !important;
}

.resource-top > div {
  min-width: 0;
}

.resource-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.3rem !important;
  min-width: 0;
}

.resource-meta span {
  display: inline-flex;
  align-items: center;
  max-width: 12rem;
  min-height: 1.46rem;
  padding: 0 0.48rem;
  border: 1px solid rgba(191, 211, 238, 0.86);
  border-radius: 999px;
  background: rgba(241, 247, 255, 0.88);
  color: #37516e;
  font-size: 0.68rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-card h2 {
  margin: 0 !important;
  max-width: 72ch;
  color: #0f1b2d !important;
  font-size: 1rem !important;
  line-height: 1.34 !important;
  letter-spacing: 0 !important;
}

.resource-type {
  position: absolute;
  top: 0.72rem;
  right: 1rem;
  color: #1d5fd1 !important;
  font-size: 0.86rem;
  font-weight: 900;
}

.resource-source {
  grid-column: 1;
  margin: 0 !important;
  max-width: 100%;
  min-width: 0;
  color: #5d718c !important;
  font-size: 0.78rem !important;
  line-height: 1.42 !important;
}

.resource-source a {
  display: inline-block !important;
  max-width: min(48rem, calc(100% - 2.5rem));
  vertical-align: bottom;
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18rem;
}

.resource-actions {
  display: contents !important;
}

.file-list {
  grid-column: 1;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.42rem !important;
  min-width: 0;
  margin-top: 0.06rem;
}

.file-link {
  min-height: 1.72rem !important;
  padding: 0 0.62rem !important;
  gap: 0.4rem !important;
  border-color: rgba(191, 211, 238, 0.9) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #132033 !important;
  box-shadow: none !important;
}

.file-link strong {
  color: #ef334d !important;
  font-size: 0.9rem;
}

.file-link.variant-html strong {
  color: #1d63d9 !important;
}

.file-link.variant-mdx strong,
.file-link.variant-md strong {
  color: #8b5cf6 !important;
}

.resource-action-buttons {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 0.58rem !important;
  min-width: 17rem;
}

.resource-open-button,
.resource-ai-button {
  min-height: 2.35rem !important;
  border-radius: 0.72rem !important;
  padding: 0 0.92rem !important;
  white-space: nowrap;
}

.resource-open-button {
  min-width: 4.8rem;
  border-color: rgba(139, 92, 246, 0.5) !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #6d35d6 !important;
}

.resource-ai-button {
  min-width: 9rem;
  border: 0 !important;
  background: linear-gradient(135deg, #1d72f3, #a855f7) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.24) !important;
}

@media (max-width: 900px) {
  .resource-card {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    padding: 0.78rem 0.86rem 0.9rem 1.08rem !important;
  }

  .resource-type {
    position: static;
    justify-self: start;
    grid-column: 1;
    margin-top: 0.08rem;
  }

  .resource-action-buttons {
    grid-column: 1;
    grid-row: auto;
    justify-content: stretch;
    min-width: 0;
    width: 100%;
  }

  .resource-open-button,
  .resource-ai-button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 0.55rem !important;
  }

  .resource-source a {
    max-width: 100%;
  }
}

/* Direction pass: the library is a scan-first tool surface. */
.layout {
  width: min(1280px, calc(100% - 2rem)) !important;
  gap: 0.68rem !important;
}

.library-hero {
  grid-template-columns: minmax(13rem, 0.5fr) minmax(0, 1.75fr) !important;
  gap: 0.5rem !important;
}

.library-hero-copy,
.summary-card,
.library-insight-card,
.filter-panel,
.quick-filter-panel,
.result-head,
.active-filters,
.resource-card {
  border-color: rgba(188, 211, 238, 0.82) !important;
  background: rgba(255, 255, 255, 0.86) !important;
  box-shadow: 0 10px 28px rgba(38, 67, 103, 0.055) !important;
}

.library-hero-copy {
  padding: 0.58rem 0.7rem !important;
}

.library-hero-copy h1 {
  font-size: 1rem !important;
  font-weight: 900 !important;
}

.library-action-primary {
  min-height: 1.9rem !important;
  padding-inline: 0.72rem !important;
  font-size: 0.78rem !important;
}

.summary-grid {
  gap: 0.45rem !important;
}

.summary-card {
  min-height: 3rem !important;
  padding: 0.42rem 0.58rem !important;
}

.summary-card span,
.summary-card small {
  font-size: 0.62rem !important;
}

.summary-card strong {
  font-size: 1.08rem !important;
}

.library-insight-card {
  padding: 0.42rem 0.55rem !important;
}

.filter-panel {
  padding: 0.68rem !important;
  top: 4rem !important;
}

.filter-panel form {
  grid-template-columns: minmax(20rem, 2fr) minmax(9.5rem, 0.78fr) minmax(7rem, 0.58fr) minmax(8.4rem, 0.58fr) minmax(8.4rem, 0.58fr) 4.6rem !important;
  gap: 0.5rem !important;
}

.filter-panel span {
  font-size: 0.66rem !important;
}

.filter-panel input,
.filter-panel select,
.filter-panel button {
  height: 2.32rem !important;
  min-height: 2.32rem !important;
}

.quick-filter-panel {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 0.6rem !important;
  padding: 0.58rem 0.68rem !important;
}

.quick-filter-head {
  display: contents !important;
}

.quick-filter-head > div {
  display: contents !important;
}

.quick-filter-head strong {
  white-space: nowrap;
  font-size: 0.92rem !important;
}

.quick-filter-head .ghost-button {
  grid-column: 3;
  grid-row: 1;
  min-height: 2.1rem !important;
  height: 2.1rem !important;
  padding: 0 0.72rem !important;
  font-size: 0.76rem !important;
}

.quick-filter-groups {
  grid-column: 2;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-width: 0;
  margin-top: 0 !important;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-filter-groups::-webkit-scrollbar {
  display: none;
}

.quick-filter-group {
  display: contents !important;
}

.quick-filter-group > span {
  display: none !important;
}

.quick-filter-list {
  flex-wrap: nowrap !important;
  gap: 0.34rem !important;
}

.quick-filter-chip,
.spotlight-chip {
  flex: 0 0 auto;
  min-height: 1.84rem !important;
  padding: 0 0.54rem !important;
  border-radius: 999px !important;
  font-size: 0.74rem !important;
  white-space: nowrap;
}

.result-head {
  min-height: 3.2rem;
  padding: 0.58rem 0.72rem !important;
}

.result-head strong {
  font-size: 1rem !important;
}

.result-head span {
  font-size: 0.78rem !important;
}

.result-head button {
  height: 2.1rem !important;
  min-height: 2.1rem !important;
  padding: 0 0.78rem !important;
}

.active-filters {
  display: flex !important;
  align-items: center !important;
  gap: 0.62rem !important;
  min-height: 3.05rem;
  padding: 0.52rem 0.7rem !important;
  border-color: rgba(198, 157, 255, 0.62) !important;
  background: linear-gradient(90deg, rgba(250, 247, 255, 0.92), rgba(248, 251, 255, 0.92)) !important;
}

.active-filters strong {
  flex: 0 0 auto;
  margin: 0 !important;
  font-size: 0.98rem !important;
}

.active-filter-list {
  flex-wrap: nowrap !important;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.active-filter-list::-webkit-scrollbar {
  display: none;
}

.active-filter-pill {
  flex: 0 0 auto;
  min-height: 1.78rem !important;
  padding: 0 0.38rem 0 0.58rem !important;
  background: rgba(255, 255, 255, 0.74) !important;
}

.active-filter-pill button {
  width: 1.28rem;
  height: 1.28rem;
  min-height: 1.28rem;
}

.resource-list {
  gap: 0.58rem !important;
}

.resource-card {
  grid-template-columns: minmax(0, 1fr) minmax(13.5rem, 15.8rem) !important;
  min-height: 5.6rem !important;
  padding: 0.64rem 0.78rem 0.66rem 1.18rem !important;
  border-radius: 0.86rem !important;
}

.resource-card::before {
  width: 0.28rem !important;
}

.resource-meta {
  gap: 0.26rem !important;
}

.resource-meta span {
  min-height: 1.32rem !important;
  max-width: 10.5rem;
  padding: 0 0.42rem !important;
  font-size: 0.64rem !important;
}

.resource-card h2 {
  font-size: 0.96rem !important;
  line-height: 1.28 !important;
}

.resource-type {
  top: 0.58rem !important;
  right: 0.78rem !important;
  font-size: 0.78rem !important;
}

.resource-source {
  font-size: 0.74rem !important;
}

.file-link {
  min-height: 1.58rem !important;
  padding: 0 0.55rem !important;
  border-radius: 999px !important;
}

.file-link strong {
  font-size: 0.84rem !important;
}

.resource-action-buttons {
  min-width: 0 !important;
  width: 100%;
  gap: 0.48rem !important;
}

.resource-open-button,
.resource-ai-button {
  min-height: 2.18rem !important;
  border-radius: 0.68rem !important;
  font-size: 0.86rem !important;
}

.resource-open-button {
  min-width: 4.5rem !important;
}

.resource-ai-button {
  min-width: 8.2rem !important;
  box-shadow: 0 10px 22px rgba(124, 58, 237, 0.2) !important;
}

@media (max-width: 1180px) {
  .filter-panel form {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, 0.55fr) minmax(8rem, 0.55fr) !important;
  }

  .filter-panel label:first-child,
  .filter-panel button {
    grid-column: auto !important;
  }

  .library-hero,
  .library-hero-panel {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  .layout {
    width: min(100%, calc(100% - 0.8rem)) !important;
  }

  .filter-panel {
    position: static !important;
  }

  .filter-panel form,
  .summary-grid {
    grid-template-columns: 1fr !important;
  }

  .library-hero {
    gap: 0.42rem !important;
  }

  .library-hero-copy {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding: 0.62rem !important;
  }

  .library-hero-actions {
    width: auto !important;
    justify-content: flex-end !important;
  }

  .library-action-primary {
    width: auto !important;
    min-width: 5.8rem;
    min-height: 1.92rem !important;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.36rem !important;
  }

  .summary-card {
    min-height: 3.1rem !important;
    padding: 0.42rem !important;
  }

  .summary-card span {
    font-size: 0.62rem !important;
  }

  .summary-card strong {
    font-size: 1rem !important;
  }

  .summary-card small {
    display: none !important;
  }

  .quick-filter-panel {
    grid-template-columns: 1fr !important;
  }

  .quick-filter-head .ghost-button,
  .quick-filter-groups {
    grid-column: 1;
  }

  .quick-filter-groups,
  .active-filter-list {
    width: 100%;
  }

  .active-filters {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .resource-card {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
  }

  .resource-action-buttons {
    justify-content: stretch !important;
  }

  .resource-open-button,
  .resource-ai-button {
    flex: 1 1 0;
  }
}

.filter-panel input,
.filter-panel select {
  border-radius: 999px !important;
  border-color: rgba(186, 207, 236, 0.9) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.94)) !important;
  color: #10233f !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 6px 14px rgba(35, 91, 160, 0.05) !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease !important;
}

.filter-panel input::placeholder {
  color: rgba(101, 118, 143, 0.74) !important;
}

.filter-panel select {
  appearance: none !important;
  cursor: pointer !important;
  padding-right: 2.15rem !important;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7d99 50%),
    linear-gradient(135deg, #6b7d99 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.94)) !important;
  background-position:
    calc(100% - 1.08rem) 50%,
    calc(100% - 0.82rem) 50%,
    0 0 !important;
  background-size:
    0.28rem 0.28rem,
    0.28rem 0.28rem,
    100% 100% !important;
  background-repeat: no-repeat !important;
}

.filter-panel label[for="source-stage"] {
  min-width: 7rem !important;
}

.filter-panel #source-stage {
  color: #1859c7 !important;
  font-weight: 900 !important;
}

.filter-panel input:hover,
.filter-panel select:hover {
  border-color: rgba(88, 143, 224, 0.78) !important;
}

.filter-panel input:focus,
.filter-panel select:focus {
  border-color: rgba(47, 113, 230, 0.78) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px rgba(47, 113, 230, 0.13),
    0 10px 22px rgba(35, 91, 160, 0.08) !important;
}

.filter-panel form {
  grid-template-columns: minmax(10rem, 1fr) minmax(8rem, .82fr) minmax(9rem, .86fr) minmax(7rem, .68fr) 5rem !important;
  gap: 0.62rem !important;
}

@media (max-width: 760px) {
  .filter-panel form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .filter-panel button {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 520px) {
  .filter-panel form {
    grid-template-columns: 1fr !important;
  }
}

/* Top navigation module colors: match the question bank header while keeping
   the source-library page light and utilitarian. */
.topnav a[href="./question_bank.html"],
.topnav a[href="./source_library.html"] {
  border-color: rgba(37, 99, 235, 0.22) !important;
  background: linear-gradient(180deg, #eff6ff, #dbeafe) !important;
  color: #1d4ed8 !important;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12) !important;
}

.topnav a[href="./index.html"] {
  border-color: rgba(245, 158, 11, 0.28) !important;
  background: linear-gradient(180deg, #fffbeb, #fef3c7) !important;
  color: #92400e !important;
  box-shadow: 0 10px 22px rgba(180, 83, 9, 0.12) !important;
}

.topnav a[href^="https://byrdocs.org"] {
  border-color: rgba(20, 184, 166, 0.28) !important;
  background: linear-gradient(180deg, #ecfdf5, #ccfbf1) !important;
  color: #0f766e !important;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.12) !important;
}

.topnav a[href="./question_bank.html"]:hover,
.topnav a[href="./source_library.html"]:hover,
.topnav a[href="./question_bank.html"]:focus-visible,
.topnav a[href="./source_library.html"]:focus-visible {
  border-color: rgba(37, 99, 235, 0.42) !important;
  background: #2563eb !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.topnav a[href="./index.html"]:hover,
.topnav a[href="./index.html"]:focus-visible {
  border-color: rgba(217, 119, 6, 0.44) !important;
  background: #d97706 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.topnav a[href^="https://byrdocs.org"]:hover,
.topnav a[href^="https://byrdocs.org"]:focus-visible {
  border-color: rgba(13, 148, 136, 0.44) !important;
  background: #0d9488 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
