.pe-card {
  --pe-border: #ddd;
  --pe-surface: #fff;
  --pe-surface-hover: #f8f8f8;
  --pe-text: #333;
  --pe-muted: #777;
  --pe-rule: #555;
  --pe-pass: #4a7c59;
  --pe-fail: #9a4d4d;
  --pe-open: #9b7b2f;
  background: var(--pe-surface);
  color: var(--pe-text);
  border: 1px solid var(--pe-border);
  border-left: 3px solid var(--pe-border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.pe-card.eligible { border-left-color: var(--pe-pass); }
.pe-card.conditional { border-left-color: #8066a6; }
.pe-card.candidate { border-left-color: var(--pe-open); }
.pe-card.ineligible { border-left-color: var(--pe-fail); }
.pe-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; padding: 0.55rem 0.65rem; cursor: pointer; }
.pe-head:hover { background: var(--pe-surface-hover); }
.pe-head:focus-visible { outline: 2px solid #4a7c59; outline-offset: -2px; }
.pe-flag { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; flex: 0 0 auto; }
.pe-top { color: #d4a017; line-height: 1; }
.pe-name { min-width: 0; flex: 1 1 auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-status { flex: 0 0 auto; border-radius: 999px; padding: 0.12rem 0.42rem; font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.035em; background: #eee; color: var(--pe-muted); }
.pe-status.eligible { background: #e5f1e8; color: #315c3e; }
.pe-status.conditional { background: #eee8f6; color: #684d8c; }
.pe-status.candidate { background: #f7efd9; color: #745c20; }
.pe-status.ineligible { background: #f5e5e5; color: #7c3939; }
.pe-actions { display: inline-flex; align-items: center; gap: 0.3rem; }
.pe-action { appearance: none; border: 1px solid var(--pe-border); border-radius: 4px; background: transparent; color: inherit; cursor: pointer; font: inherit; font-size: 0.6875rem; line-height: 1.2; padding: 0.25rem 0.45rem; text-decoration: none; white-space: nowrap; }
.pe-action:hover { background: var(--pe-surface-hover); }
.pe-caret { color: var(--pe-muted); font-size: 0.625rem; transition: transform 0.15s; }
.pe-card.expanded .pe-caret { transform: rotate(90deg); }
.pe-missing { color: var(--pe-open); font-size: 0.6875rem; padding: 0 0.65rem 0.45rem; }
.pe-missing code { background: color-mix(in srgb, var(--pe-open) 12%, transparent); border-radius: 3px; color: inherit; padding: 0.05rem 0.25rem; }
.pe-body { display: none; border-top: 1px solid var(--pe-border); padding: 0.6rem 0.7rem 0.7rem; }
.pe-card.expanded .pe-body { display: block; }
.pe-reason { background: color-mix(in srgb, var(--pe-open) 10%, transparent); border-radius: 4px; color: var(--pe-rule); font-size: 0.75rem; margin-bottom: 0.6rem; padding: 0.45rem 0.55rem; }
.pe-rule-label { color: var(--pe-muted); font-size: 0.625rem; font-weight: 700; letter-spacing: 0.06em; margin: 0.4rem 0 0.2rem; text-transform: uppercase; }
.pe-rule { color: var(--pe-rule); font: 0.6875rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pe-rule-group > .pe-rule-children { border-left: 1px dashed var(--pe-border); margin-left: 0.35rem; padding-left: 0.55rem; }
.pe-rule-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; min-height: 1.15rem; padding: 0.04rem 0; }
.pe-rule-state { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--pe-open); }
.pe-rule-state.pass { background: var(--pe-pass); }
.pe-rule-state.fail { background: var(--pe-fail); }
.pe-rule-state.open { background: var(--pe-open); }
.pe-rule-op { color: #4777a5; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.pe-rule-attr { color: #4777a5; }
.pe-rule-check { color: var(--pe-rule); }
.pe-rule-actual { color: var(--pe-pass); font-style: italic; margin-left: 0.2rem; }
.pe-rule-actual.empty { color: var(--pe-muted); }
.pe-evidence { background: rgba(201,168,76,0.18); border-radius: 999px; color: #8a6818; font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.03em; padding: 0 0.3rem; text-transform: uppercase; }
.pe-empty { color: var(--pe-muted); font-size: 0.75rem; font-style: italic; }
.pe-source-meta { color: #777; font-size: 0.75rem; line-height: 1.45; margin-bottom: 0.45rem; }

.pathway-evaluation-dark .pe-card {
  --pe-border: rgba(255,255,255,0.13);
  --pe-surface: rgba(255,255,255,0.04);
  --pe-surface-hover: rgba(255,255,255,0.07);
  --pe-text: #e7e7e7;
  --pe-muted: #888;
  --pe-rule: #ccc;
  --pe-pass: #62a776;
  --pe-fail: #a85b5b;
  --pe-open: #c9a84c;
}
.pathway-evaluation-dark .pe-status { background: rgba(255,255,255,0.08); color: #bbb; }
.pathway-evaluation-dark .pe-status.eligible { color: #c5f0cd; }
.pathway-evaluation-dark .pe-status.conditional { color: #d8c9ef; }
.pathway-evaluation-dark .pe-status.candidate { color: #f5e6b8; }
.pathway-evaluation-dark .pe-status.ineligible { color: #f0c5c5; }
.pathway-evaluation-dark .pe-rule-op,
.pathway-evaluation-dark .pe-rule-attr { color: #8bb8f8; }
.pathway-evaluation-dark .pe-evidence { color: #ffe39a; }

@media (max-width: 720px) {
  .pe-status { display: none; }
  .pe-actions { flex-wrap: wrap; justify-content: flex-end; }
}
