/* ═══════════════════════════════════════════════════════════════════
   Components: Knowledge / Case / Source Cards
   ═══════════════════════════════════════════════════════════════════ */

.knowledge-grid,
.case-grid,
.source-grid {
  gap: 20px;
}

.knowledge-card,
.case-card,
.source-card {
  padding: 24px;
}

.knowledge-meta { margin-bottom: 14px; }
.fy-search-guidance { margin: -4px 0 14px; color: var(--color-ink-soft); font-size: .92rem; }
.fy-search-panel { align-items: end; }
.fy-kb-details { margin-top: 28px; border-top: 1px solid var(--border-default); color: var(--color-ink-soft); }
.fy-kb-details > summary { padding: 16px 0; color: var(--color-ink); font-weight: var(--weight-bold); cursor: pointer; }
.fy-kb-details .fy-kb-overview { margin: 0 0 12px; }
.source-card { display: flex; flex-direction: column; min-height: 238px; }
.source-card .button { margin-top: auto; align-self: flex-start; }
.source-load-more { display: flex; width: min(100%, 240px); margin: 24px auto 0; }

/* Official corpus: a legal archive, not another generic card wall. */
.fy-corpus { --corpus-ink: #071b2e; --corpus-line: #bcd2e4; overflow: hidden; border: 1px solid var(--corpus-line); border-radius: 18px; background: #f5f9fc; box-shadow: 0 20px 48px rgba(7, 34, 58, .09); }
.fy-corpus-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 27px; background: linear-gradient(rgba(89, 197, 219, .075) 1px, transparent 1px), linear-gradient(90deg, rgba(89, 197, 219, .075) 1px, transparent 1px), linear-gradient(120deg, #061a2c, #0c3c5d); background-size: 26px 26px, 26px 26px, auto; color: #fff; }
.fy-corpus-kicker { color: #62dbe4; font-family: var(--font-mono); font-size: var(--fs-caption); letter-spacing: .11em; }
.fy-corpus-head h2 { margin: 5px 0 3px; color: #fff; font-size: var(--fs-h1); line-height: var(--lh-h1); }
.fy-corpus-head p { margin: 0; color: #bfd2e1; font-size: var(--fs-body-s); line-height: var(--lh-body-s); }
.fy-corpus-live { display: grid; grid-template-columns: 10px auto; gap: 1px 9px; min-width: 170px; padding: 11px 13px; border: 1px solid rgba(111, 211, 224, .25); border-radius: 10px; background: rgba(3, 22, 38, .58); }
.fy-corpus-live i { grid-row: 1 / 3; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: #43d7aa; box-shadow: 0 0 12px rgba(67, 215, 170, .65); }
.fy-corpus-live strong { color: #fff; font-size: var(--fs-body-s); }
.fy-corpus-live span { color: #93adc1; font-family: var(--font-mono); font-size: var(--fs-caption); }
.fy-corpus-search { display: grid; grid-template-columns: minmax(210px, .75fr) minmax(280px, 1.4fr) auto; gap: 12px; align-items: end; margin: 20px; padding: 16px; border: 1px solid #c9d9e7; border-radius: 12px; background: #fff; }
.fy-corpus-search label { display: grid; gap: 6px; color: #50677b; font-size: var(--fs-label); font-weight: 650; }
.fy-corpus-search :is(input, select) { width: 100%; min-height: 48px; }
.fy-corpus-search .button { min-height: 48px; }
.fy-corpus-status { min-height: 1.5em; margin: -7px 22px 13px; color: #3b607b; font-family: var(--font-mono); font-size: var(--fs-label); }
.fy-corpus-presets { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: -7px 22px 13px; color: #65798a; font-size: var(--fs-label); }
.fy-corpus-presets button { min-height: 32px; padding: 4px 10px; border: 1px solid #c9d8e4; border-radius: 999px; background: #fff; color: #315b77; cursor: pointer; }
.fy-corpus-presets button:hover { border-color: #5c8eac; background: #f2f7fa; }
.fy-corpus > section { padding: 5px 20px 20px; }
.fy-corpus-section-head { display: flex; align-items: center; gap: 10px; margin: 5px 0 12px; }
.fy-corpus-section-head > span { color: #2389a4; font-family: var(--font-mono); font-size: var(--fs-label); }
.fy-corpus-section-head h3 { margin: 0; color: #0d2941; font-size: var(--fs-h3); }
.fy-corpus-section-head p { margin: 1px 0 0; color: #718497; font-size: var(--fs-caption); }
.fy-connector-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.fy-connector-card { position: relative; display: grid; gap: 8px; min-width: 0; padding: 16px; border: 1px solid #c8d9e6; border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.fy-connector-card:hover, .fy-connector-card:focus-visible { transform: translateY(-2px); border-color: #338cb9; box-shadow: 0 10px 24px rgba(8, 57, 89, .1); }
.fy-connector-card.is-disabled { opacity: .58; cursor: not-allowed; }
.fy-connector-card.is-disabled:hover { transform: none; border-color: #c8d9e6; box-shadow: none; }
.fy-connector-card-top { display: flex; align-items: center; justify-content: space-between; color: #44657c; font-size: var(--fs-label); }
.fy-connector-card-top i { width: 8px; height: 8px; border-radius: 50%; background: #ef805f; }
.fy-connector-card-top i.is-blue { background: #43caa4; box-shadow: 0 0 9px rgba(67, 202, 164, .4); }
.fy-connector-card h4 { margin: 0; color: #0c2941; font-size: var(--fs-body); line-height: var(--lh-body); }
.fy-connector-card code { overflow: hidden; color: #658096; font-size: var(--fs-caption); text-overflow: ellipsis; white-space: nowrap; }
.fy-connector-volume { display: flex; align-items: baseline; gap: 7px; padding-top: 6px; border-top: 1px solid #e2ebf2; }
.fy-connector-volume strong { color: #1165a0; font-family: var(--font-mono); font-size: 1.5rem; }
.fy-connector-volume span, .fy-connector-action { color: #687f92; font-size: var(--fs-caption); }
.fy-connector-action { display: flex; justify-content: space-between; color: #176f9e; }
.fy-corpus-loading { grid-column: 1 / -1; margin: 0; padding: 18px; color: #61788c; }
.fy-corpus-empty { padding: 28px; text-align: center; }
.fy-corpus-empty strong { color: #19384e; font-size: var(--fs-h3); }
.fy-corpus-empty p { margin: 7px 0 14px; color: #64798a; }
.fy-corpus-list { display: grid; border: 1px solid #cbdbe7; border-radius: 12px; background: #fff; }
.fy-corpus-row { display: grid; grid-template-columns: minmax(120px, .32fr) minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 18px; border-bottom: 1px solid #e0e9f0; }
.fy-corpus-row:last-child { border-bottom: 0; }
.fy-corpus-row-code { display: grid; gap: 5px; }
.fy-corpus-row-code span { color: #167c96; font-size: var(--fs-label); font-weight: 700; }
.fy-corpus-row-code code { color: #6a7f90; font-size: var(--fs-caption); overflow-wrap: anywhere; }
.fy-corpus-row-main { min-width: 0; }
.fy-corpus-row-main h3 { margin: 0 0 4px; color: #0b263d; font-size: var(--fs-body); line-height: 1.45; }
.fy-corpus-row-main p { margin: 0 0 5px; color: #4e6578; font-size: var(--fs-body-s); line-height: var(--lh-body-s); }
.fy-corpus-row-main > span { color: #718495; font-size: var(--fs-caption); }

@media (max-width: 820px) { .fy-corpus-search { grid-template-columns: 1fr; }.fy-connector-grid { grid-template-columns: 1fr; }.fy-corpus-row { grid-template-columns: 1fr; gap: 10px; }.fy-corpus-row .button { justify-self: start; } }
@media (max-width: 640px) { .fy-corpus { border-radius: 14px; }.fy-corpus-head { display: grid; padding: 20px; }.fy-corpus-live { min-width: 0; }.fy-corpus-search { margin: 14px; }.fy-corpus > section { padding: 4px 14px 16px; } }

/* ── Knowledge index console ── */
.fy-kb-overview { --kb-blue: #2869a1; --kb-cyan: #2695a8; position: relative; margin: 28px 0 18px; overflow: hidden; border: 1px solid #ccd8e1; border-radius: 14px; background: #f7f9fb; box-shadow: 0 8px 24px rgba(19, 43, 60, .06); }
.fy-kb-overview > * { position: relative; z-index: 1; }
.fy-kb-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; color: #173247; border-bottom: 1px solid #d7e0e7; background: #fff; }
.fy-kb-overview-head > div { min-width: 0; }
.fy-kb-eyebrow { display: block; margin-bottom: 5px; color: #547083; font-size: var(--fs-label); font-weight: var(--weight-semibold); }
.fy-kb-overview-head h2 { margin: 0; color: #142e42; font-size: clamp(20px, var(--fs-h2), 25px); line-height: 1.3; }
.fy-kb-overview-head p { margin: 6px 0 0; color: #667b8c; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.6; }
.fy-kb-capabilities { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.fy-kb-capabilities span { padding: 4px 8px; border: 1px solid rgba(92, 205, 224, .28); border-radius: 4px; background: rgba(6, 28, 48, .48); color: #9de7ef; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .07em; }
.fy-kb-build-status { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-width: 210px; padding-left: 18px; border-left: 1px solid #d4dde4; }
.fy-kb-build-status > i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #319c76; }
.fy-kb-build-status > span { display: grid; gap: 1px; color: #6a7f8e; font-size: clamp(14px, var(--fs-caption), 17px); line-height: 1.4; }
.fy-kb-build-status strong { color: #213b4e; }
.fy-kb-stats { display: grid; grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr)); gap: 0; margin: 20px 22px; padding: 0; overflow: hidden; border: 1px solid #c8d9e6; border-radius: 13px; background: #fff; list-style: none; }
.fy-kb-stat { display: grid; align-content: center; gap: 5px; min-width: 0; min-height: 118px; padding: 17px 19px; border: 0; border-right: 1px solid #dbe5ed; border-radius: 0; background: #fff; box-shadow: none; }
.fy-kb-stat:last-child { border-right: 0; }
.fy-kb-stat.is-primary { background: linear-gradient(135deg, #e8f2ff, #f7fbff); box-shadow: inset 4px 0 var(--kb-blue); }
.fy-kb-stat-label { color: #53677f; font-size: clamp(14px, var(--fs-body-s), 19px); font-weight: var(--weight-semibold); line-height: 1.45; }
.fy-kb-stat > strong { color: #0c2542; font-family: var(--font-mono); font-size: clamp(25px, 2vw, 34px); font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -.035em; }
.fy-kb-stat.is-primary > strong { color: #174fbc; font-size: clamp(30px, 2.4vw, 40px); }
.fy-kb-stat > strong em { color: #6a7e96; font-family: var(--font-body); font-size: .65em; font-style: normal; }
.fy-kb-stat-note { display: flex; align-items: flex-start; gap: 7px; color: #667b93; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.5; overflow-wrap: anywhere; }
.fy-kb-stat-note > i { flex: 0 0 auto; width: 7px; height: 7px; margin-top: .5em; border-radius: 50%; background: #f0a43b; }
.fy-kb-provenance { display: grid; grid-template-columns: max-content 22px max-content 22px max-content 22px max-content; align-items: center; justify-content: center; gap: 10px; margin: 0 22px 20px; padding: 14px 16px; border: 1px solid rgba(69, 163, 207, .36); border-radius: 12px; background: linear-gradient(90deg, #08223c, #0b3150); color: #d6e7f8; font-size: clamp(14px, var(--fs-body-s), 18px); line-height: 1.45; }
.fy-kb-provenance > span:not(.fy-kb-provenance-arrow) { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fy-kb-provenance > span > i { width: 7px; height: 7px; border-radius: 2px; background: var(--kb-cyan); box-shadow: 0 0 10px rgba(35, 184, 199, .45); }
.fy-kb-provenance em { color: #62cfdd; font-family: var(--font-mono); font-size: .72em; font-style: normal; }
.fy-kb-provenance-arrow { color: #70d7e3; font-family: var(--font-mono); font-size: 18px; text-align: center; }
.fy-kb-charts { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr); gap: 16px; align-items: stretch; padding: 0 22px 22px; }
.fy-kb-chart { min-width: 0; padding: 20px; border: 1px solid #d8e2ef; border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(16, 44, 78, .045); }
.fy-kb-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.fy-kb-chart-head > div { min-width: 0; }
.fy-kb-chart-head h3 { margin: 0; color: #102a49; font-size: clamp(16px, var(--fs-h3), 22px); line-height: 1.4; }
.fy-kb-chart-head p { margin: 5px 0 0; color: #667b93; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.55; }
.fy-kb-chart-head > span { flex: 0 0 auto; padding: 5px 9px; border: 1px solid #c7d8ef; border-radius: 999px; background: #f0f6ff; color: #285db5; font-family: var(--font-mono); font-size: clamp(14px, var(--fs-caption), 17px); font-variant-numeric: tabular-nums; }
.fy-kb-progress-list, .fy-kb-risk-list { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.fy-kb-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: #314862; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.45; }
.fy-kb-progress-head strong { color: #102a49; font-family: var(--font-mono); font-size: clamp(14px, var(--fs-body-s), 19px); font-variant-numeric: tabular-nums; }
.fy-kb-progress-track { height: 9px; overflow: hidden; border-radius: 2px; background: #e4e9ed; }
.fy-kb-progress-track > i { display: block; height: 100%; border-radius: 2px; background: #3b83ad; }
.fy-kb-risk-figure { display: grid; grid-template-columns: 142px minmax(0, 1fr); gap: 22px; align-items: center; margin-top: 20px; }
.fy-kb-risk-donut { display: grid; width: 140px; aspect-ratio: 1; place-items: center; border-radius: 50%; background: radial-gradient(circle at center, #fff 0 52%, transparent 53%), conic-gradient(var(--risk-conic)); }
.fy-kb-risk-donut span { display: grid; text-align: center; color: #687b8a; font-size: var(--fs-caption); }
.fy-kb-risk-donut strong { color: #19384e; font-family: var(--font-mono); font-size: 1.05rem; }
.fy-kb-risk-rail { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 18px; margin-top: 22px; }
.fy-kb-risk-cell { min-width: 0; border-radius: 2px; }
.fy-kb-risk-cell--low { background: #2d9f8f; }
.fy-kb-risk-cell--medium { background: #e6a23c; }
.fy-kb-risk-cell--high { background: #e4694f; }
.fy-kb-risk-cell--critical { background: #b93d52; }
.fy-kb-risk-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 58px; align-items: center; gap: 9px; min-width: 0; color: #40566f; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.45; }
.fy-kb-risk-dot { width: 10px; height: 10px; border-radius: 3px; }
.fy-kb-risk-list strong, .fy-kb-risk-list em { font-family: var(--font-mono); font-size: clamp(14px, var(--fs-body-s), 19px); font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fy-kb-risk-list strong { color: #102a49; }
.fy-kb-risk-list em { color: #667b93; text-align: right; }
.fy-kb-meta { margin: 0 22px 22px; padding: 12px 14px; border-left: 3px solid var(--kb-blue); border-radius: 0 10px 10px 0; background: #eaf3ff; color: #536a84; font-size: clamp(14px, var(--fs-body-s), 19px); line-height: 1.6; }
.fy-kb-meta strong { color: #173b68; }
.knowledge-grid:empty, .pagination-bar:empty { display: none; }

@media (max-width: 980px) {
  .fy-kb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fy-kb-stat.is-primary { grid-column: 1 / -1; }
  .fy-kb-stat { border-right: 0; border-bottom: 1px solid #dbe5ed; }
  .fy-kb-stat:last-child { border-bottom: 0; }
  .fy-kb-charts { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .fy-kb-overview { margin-top: 22px; border-radius: 14px; }
  .fy-kb-overview-head { display: grid; gap: 16px; padding: 20px; }
  .fy-kb-build-status { width: 100%; min-width: 0; }
  .fy-kb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 14px; padding: 0; }
  .fy-kb-stat { min-height: 118px; padding: 15px; }
  .fy-kb-stat.is-primary { grid-column: 1 / -1; min-height: 108px; }
  .fy-kb-provenance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 14px 14px; padding: 12px 10px; }
  .fy-kb-provenance-arrow { display: none; }
  .fy-kb-provenance > span:not(.fy-kb-provenance-arrow) { justify-content: center; text-align: center; }
  .fy-kb-provenance > span > i { display: none; }
  .fy-kb-charts { gap: 12px; padding: 0 14px 14px; }
  .fy-kb-chart { padding: 16px; }
  .fy-kb-chart-head { gap: 10px; }
  .fy-kb-progress-track { gap: 2px; }
  .fy-kb-risk-rail { gap: 2px; }
  .fy-kb-meta { margin: 0 14px 14px; }
  .fy-kb-risk-list li { grid-template-columns: 12px minmax(0, 1fr) auto 54px; gap: 7px; }
  .fy-kb-risk-figure { grid-template-columns: 1fr; justify-items: center; }
  .fy-kb-risk-list { width: 100%; }
}

@media (max-width: 390px) {
  .fy-kb-stats { grid-template-columns: 1fr; }
  .fy-kb-stat.is-primary { grid-column: auto; }
  .fy-kb-stat { min-height: 0; }
  .fy-kb-chart-head { display: grid; }
  .fy-kb-chart-head > span { justify-self: start; }
}

.knowledge-card h3,
.case-card h3,
.source-card :is(h2, h3) {
  margin-bottom: 8px;
}

.knowledge-card p,
.case-card p,
.source-card p {
  color: var(--color-ink-soft);
}

.source-card .tag { margin-bottom: 14px; }
.source-card :is(h2, h3) { font-size: 1.05rem; line-height: 1.45; overflow-wrap: anywhere; }
.source-card .meta { color: var(--color-ink); font-weight: var(--weight-bold); }
.source-card p:last-of-type { margin-bottom: 18px; font-size: .87rem; }

/* Reference Card */
.reference-card {
  padding: 16px 0;
  border-top: 1px dashed rgba(25, 38, 43, 0.24);
}

.reference-card:first-of-type { border-top: 0; padding-top: 0; }

/* Source & Back Links */
.source-line,
.source-link,
.back-link {
  color: var(--primary-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fy-case-detail-title {
  margin: 12px 0 8px;
  color: var(--text-primary);
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  font-weight: var(--fw-h1);
  letter-spacing: -0.015em;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
}

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Toolbar */
.toolbar { margin-bottom: 16px; }
.source-purpose { color: var(--text-secondary); line-height: 1.55; }
.source-filter-status { margin: -4px 0 14px; color: var(--text-secondary); font-size: var(--fs-body-s); }
.fy-variant-note { margin: 10px 0; padding: 8px 10px; border-left: 3px solid var(--primary-500); background: var(--primary-050); color: var(--text-secondary); font-size: var(--fs-body-s); line-height: 1.5; }
.fy-search-panel.toolbar-grid { grid-template-columns: minmax(260px, 1.6fr) repeat(auto-fit, minmax(160px, 0.75fr)); }
@media (max-width: 940px) { .fy-search-panel.toolbar-grid { grid-template-columns: 1fr; } }

/* Case library is an investigation aid, not a wall of generic cards. Keep its
   filters at the top and make the empty state a clear next action. */
.fy-cases-page .fy-case-filters { margin-bottom: 12px; }
.fy-cases-page .case-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: stretch; }
.fy-cases-page .case-card { display: flex; flex-direction: column; min-height: 100%; }
.fy-cases-page .case-card .button { margin-top: auto; align-self: flex-start; }
.fy-case-empty { grid-column: 1 / -1; display: grid; justify-items: start; gap: 8px; padding: 28px; border: 1px dashed var(--border-default); border-radius: var(--radius-l); background: var(--surface-muted); color: var(--text-secondary); }
.fy-case-empty strong { color: var(--text-primary); font-size: var(--fs-h3); }
.fy-case-empty p { margin: 0; }
