/* Recommendations retain their existing links; evidence is a separate reading surface. */
#homeView .home-evidence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  min-width: 0;
}

#homeView .home-evidence-list,
#homeView .home-evidence-card,
#homeView .home-evidence-content > * { min-width: 0; }

#homeView .home-evidence-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--line, #dce2e9);
  border-radius: 10px;
  background: #fff;
  color: var(--muted, #596579);
  font-size: 13px;
  line-height: 1.5;
}
#homeView .home-evidence-summary :is(p, dl) { margin: 0; }
#homeView .home-evidence-summary strong { color: var(--text, #1b2236); }

/* The sibling button never covers the original card link or its focus ring. */
#homeView .home-evidence-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 14px;
}
#homeView .home-evidence-card > .home-simple-decision { flex: 1 1 auto; }
#homeView .home-evidence-card.is-selected {
  outline: 2px solid var(--accent, #234a74);
  outline-offset: 4px;
}
#homeView .home-evidence-trigger,
#homeView .home-evidence-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #c7d2de;
  border-radius: 8px;
  background: #fff;
  color: var(--accent, #234a74);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
#homeView .home-evidence-trigger { align-self: flex-end; max-width: 100%; }
#homeView .home-evidence-trigger > i { font-size: 16px; }
#homeView .home-evidence-trigger:hover,
#homeView .home-evidence-close:hover { background: #edf3f8; border-color: #92a7bf; }
#homeView .home-evidence-trigger[aria-expanded="true"] {
  background: var(--accent-soft, #eaf1f8);
  border-color: var(--accent, #234a74);
}
#homeView :is(.home-evidence-trigger, .home-evidence-close):focus-visible {
  outline: 3px solid #1686b3;
  outline-offset: 3px;
}
#homeView .home-compact-decision-grid > .home-evidence-card {
  gap: 0;
  border-bottom: 1px solid var(--line, #dce2e9);
  border-radius: 0;
}
#homeView .home-compact-decision-grid > .home-evidence-card:last-child { border-bottom: 0; }
#homeView .home-compact-decision-grid > .home-evidence-card > .home-compact-decision { border-bottom: 0; }
#homeView .home-compact-decision-grid > .home-evidence-card > .home-evidence-trigger { margin: 0 18px 16px; }
#homeView .home-compact-decision-grid > .home-evidence-card.is-selected { outline-offset: -2px; }

#homeView .home-evidence-panel {
  position: sticky;
  top: 100px;
  z-index: 21;
  min-width: 0;
  max-height: calc(100vh - var(--home-evidence-top, 100px) - 20px);
  max-height: calc(100dvh - var(--home-evidence-top, 100px) - 20px);
  border: 1px solid #bdcbd9;
  border-radius: 12px;
  background: #fff;
  color: var(--text, #1b2236);
  box-shadow: 0 5px 20px rgb(16 27 45 / 7%);
  overflow: hidden;
}
#homeView .home-evidence-panel:not([hidden]) { display: flex; flex-direction: column; }
#homeView .home-evidence-panel[hidden] { display: none !important; }
#homeView .home-evidence-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line, #dce2e9);
  background: #f5f8fb;
}
#homeView .home-evidence-header > div { min-width: 0; }
#homeView .home-evidence-header p {
  margin: 0 0 5px;
  color: var(--accent, #234a74);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
#homeView .home-evidence-header h2 {
  margin: 0;
  color: var(--text, #1b2236);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
#homeView .home-evidence-header h2:focus-visible { outline: 3px solid #1686b3; outline-offset: 3px; }
#homeView .home-evidence-close { flex: 0 0 auto; min-width: 44px; padding: 10px; }
#homeView .home-evidence-close-label { display: none; }
#homeView .home-evidence-content {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 22px;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
#homeView .home-evidence-content :is(h3, h4) {
  margin: 0 0 10px;
  color: var(--text, #1b2236);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
#homeView .home-evidence-content p { margin: 0; }
#homeView .home-evidence-content p + p { margin-top: 10px; }
#homeView .home-evidence-content a:not(.primary-button):not(.secondary-button):not(.home-evidence-action) {
  color: var(--accent, #234a74);
  text-decoration: underline;
  text-underline-offset: 3px;
}
#homeView .home-evidence-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line, #dce2e9);
  border-radius: 10px;
  background: #f5f8fb;
}
#homeView .home-evidence-context > div { min-width: 0; }
#homeView .home-evidence-context dt { color: var(--muted, #596579); font-size: 12px; }
#homeView .home-evidence-context dd { margin: 4px 0 0; color: var(--text, #1b2236); font-size: 13px; font-weight: 700; }
#homeView .home-evidence-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
#homeView .home-evidence-fact {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line, #dce2e9);
  border-radius: 10px;
  background: #fff;
}
#homeView .home-evidence-fact :is(dt, small, span) { display: block; color: var(--muted, #596579); font-size: 12px; line-height: 1.45; }
#homeView .home-evidence-fact :is(dd, strong) {
  display: block;
  margin: 7px 0 0;
  color: var(--text, #1b2236);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
#homeView .home-evidence-fact small { margin-top: 7px; }
#homeView .home-evidence-fact > p { margin-top: 7px; color: var(--muted, #596579); font-size: 12px; line-height: 1.5; }
#homeView .home-evidence-sources { display: grid; gap: 14px; margin: 0; }
#homeView .home-evidence-source-entry { min-width: 0; }
#homeView .home-evidence-source-entry dt { font-size: 14px; font-weight: 700; }
#homeView .home-evidence-source-entry dd { margin: 5px 0 0; font-size: 14px; line-height: 1.55; }
#homeView .home-evidence-source-entry > p { margin-top: 5px; color: var(--muted, #596579); font-size: 12px; }
#homeView .home-evidence-section { display: grid; align-content: start; gap: 14px; min-width: 0; }
#homeView .home-evidence-content .home-evidence-section > * { margin-block: 0; }
#homeView .home-evidence-content .home-evidence-section > h3:not(:first-child) { margin-top: 6px; }
#homeView .home-evidence-section + .home-evidence-section { padding-top: 20px; border-top: 1px solid var(--line, #dce2e9); }
#homeView .home-evidence-section :is(ul, ol) { display: grid; gap: 9px; margin: 10px 0 0; padding-left: 20px; }
#homeView .home-evidence-notice {
  padding: 13px 15px;
  border: 1px solid #c7d9e9;
  border-left: 3px solid var(--accent, #234a74);
  border-radius: 8px;
  background: #f1f6fb;
  color: #344c66;
  font-size: 13px;
  line-height: 1.55;
}
#homeView .home-evidence-notice:is(.is-warning, .is-stale) { border-color: #e2cc9c; border-left-color: #996114; background: #fbf4e7; color: #725016; }
#homeView .home-evidence-notice.is-error { border-color: #e2b9c0; border-left-color: #b23f4c; background: #fbedef; color: #8f303d; }
#homeView .home-evidence-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
#homeView .home-evidence-actions > :is(a, button) { flex: 1 1 150px; min-width: 0; min-height: 44px; white-space: normal; text-align: center; }
#homeView .home-evidence-table-scroll { min-width: 0; overflow: auto; border: 1px solid var(--line, #dce2e9); border-radius: 8px; overscroll-behavior-x: contain; }
#homeView .home-evidence-table-scroll table { min-width: 480px; width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
#homeView .home-evidence-table-scroll :is(th, td) { padding: 11px 12px; border-bottom: 1px solid #e8edf2; vertical-align: top; text-align: left; }
#homeView .home-evidence-table-scroll th { background: #f3f6f9; color: #4b596d; font-size: 12px; font-weight: 700; }
#homeView .home-evidence-table-scroll .numeric { text-align: right; white-space: nowrap; }
#homeView .home-evidence-table-scroll tbody tr:last-child td { border-bottom: 0; }
#homeView .home-evidence-source { color: var(--muted, #596579); font-size: 12px; line-height: 1.6; }
#homeView .home-evidence-source + .home-evidence-source { margin-top: 12px; }
#homeView .home-evidence-empty { padding: 20px; border: 1px dashed #bdc7d3; border-radius: 10px; background: #f7f9fb; color: var(--muted, #596579); }

/* The in-panel summary is prose; the summary above the list is a context strip. */
#homeView .home-evidence-content .home-evidence-title { margin: 0 0 10px; font-size: 19px; line-height: 1.4; }
#homeView .home-evidence-content .home-evidence-summary {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #39465a;
  font-size: 14px;
  line-height: 1.6;
}
#homeView .home-evidence-detail { min-width: 0; }
#homeView .home-evidence-meta { margin: 8px 0 0; color: var(--muted, #596579); font-size: 12px; line-height: 1.55; }
#homeView .home-evidence-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line, #dce2e9);
  border-radius: 6px;
  background: #f5f8fb;
  color: #344c66;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
#homeView .home-evidence-status:is(.is-warning, .is-stale) { border-color: #e2cc9c; background: #fbf4e7; color: #725016; }
#homeView .home-evidence-actions .home-evidence-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #c7d2de;
  border-radius: 8px;
  background: #fff;
  color: var(--accent, #234a74);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}
#homeView .home-evidence-actions .home-evidence-action:hover { background: #edf3f8; border-color: #92a7bf; }
#homeView .home-evidence-records { display: grid; gap: 10px; min-width: 0; }
#homeView .home-evidence-record {
  min-width: 0;
  border: 1px solid var(--line, #dce2e9);
  border-radius: 10px;
  background: #fff;
}
#homeView .home-evidence-record > summary {
  position: relative;
  display: block;
  min-height: 48px;
  padding: 14px 42px 14px 16px;
  border-radius: 9px;
  background: #f5f8fb;
  color: var(--text, #1b2236);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  list-style: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}
#homeView .home-evidence-record > summary::-webkit-details-marker { display: none; }
#homeView .home-evidence-record > summary::after {
  position: absolute;
  top: 20px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--accent, #234a74);
  content: "";
  transform: rotate(45deg);
}
#homeView .home-evidence-record[open] > summary { border-radius: 9px 9px 0 0; }
#homeView .home-evidence-record[open] > summary::after { top: 24px; transform: rotate(225deg); }
#homeView .home-evidence-record > summary:hover { background: #edf3f8; }
#homeView .home-evidence-record > summary:focus-visible { outline: 3px solid #1686b3; outline-offset: 2px; }
#homeView .home-evidence-record > summary strong { display: block; font-size: 14px; line-height: 1.5; }
#homeView .home-evidence-record > summary small { display: block; margin-top: 3px; color: var(--muted, #596579); font-size: 12px; font-weight: 400; line-height: 1.5; }
#homeView .home-evidence-record > dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 0;
  padding: 16px;
  border-top: 1px solid var(--line, #dce2e9);
}
#homeView .home-evidence-record > dl > div { min-width: 0; }
#homeView .home-evidence-record dt { color: var(--muted, #596579); font-size: 12px; line-height: 1.45; }
#homeView .home-evidence-record dd { margin: 4px 0 0; color: var(--text, #1b2236); font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#homeView .home-evidence-record dd strong { display: block; font-size: 13px; }
#homeView .home-evidence-record dd small { display: block; margin-top: 3px; color: var(--muted, #596579); font-size: 12px; }
#homeView .home-evidence-record dd > * { max-width: 100%; white-space: normal; }
#homeView .home-evidence-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  white-space: nowrap;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

@media (min-width: 1151px) {
  #homeView .home-evidence-layout.is-open { grid-template-columns: minmax(0, 1fr) clamp(400px, 30vw, 460px); }
  #homeView .home-evidence-content { padding-bottom: 100px; }
  #homeView .home-evidence-layout.is-open .home-cockpit-decision-grid { grid-template-columns: minmax(0, 1fr); }
  #homeView .home-evidence-layout.is-open .home-compact-decision {
    grid-template-columns: 32px minmax(0, 1fr) 18px;
    gap: 14px;
    padding: 20px 16px;
  }
  #homeView .home-evidence-layout.is-open .home-compact-decision-rank { width: 32px; height: 32px; }
  #homeView .home-evidence-layout.is-open .home-compact-decision-step {
    grid-column: 2;
    padding: 12px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line, #dce2e9);
  }
  #homeView .home-evidence-layout.is-open .home-compact-decision-owner { grid-column: 2; display: grid; gap: 5px; }
  #homeView .home-evidence-layout.is-open .home-compact-decision-arrow { grid-column: 3; grid-row: 1; }
}

/* JS supplies dialog semantics, inert background and focus management at this breakpoint. */
@media (max-width: 1150px) {
  #homeView .home-evidence-panel {
    position: fixed;
    inset: 0;
    z-index: 120;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #homeView .home-evidence-header {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 16px;
    padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 20px max(20px, env(safe-area-inset-left));
  }
  #homeView .home-evidence-close { align-self: flex-start; padding: 10px 14px; }
  #homeView .home-evidence-close-label { display: inline; }
  #homeView .home-evidence-content {
    padding: 24px max(24px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  }
}

@media (max-width: 480px) {
  #homeView .home-evidence-header h2 { font-size: 20px; }
  #homeView .home-evidence-content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); gap: 20px; }
  #homeView .home-evidence-context { gap: 12px; padding: 14px; }
  #homeView .home-evidence-facts { gap: 10px; }
  #homeView .home-evidence-fact { padding: 12px; }
  #homeView .home-evidence-fact :is(dd, strong) { font-size: 20px; }
}

@media (forced-colors: active) {
  #homeView .home-evidence-card.is-selected { outline-color: Highlight; }
  #homeView .home-evidence-trigger[aria-expanded="true"] { border-color: Highlight; }
}
