:root {
  --patch-judge-bg: #07111f;
  --patch-judge-card: rgba(15, 23, 42, 0.96);
  --patch-judge-soft: rgba(2, 6, 23, 0.74);
  --patch-judge-border: rgba(125, 211, 252, 0.22);
  --patch-judge-text: #e5edf7;
  --patch-judge-muted: #9fb2c8;
  --patch-judge-accent: #38bdf8;
  --patch-judge-good: #22c55e;
  --patch-judge-warn: #f59e0b;
  --patch-judge-bad: #ef4444;
}
html.fb-light-preload, html[data-theme="light"], body.light, body.light-theme {
  --patch-judge-bg: #f4f7fb;
  --patch-judge-card: rgba(255,255,255,.96);
  --patch-judge-soft: rgba(255,255,255,.9);
  --patch-judge-border: rgba(37,99,235,.18);
  --patch-judge-text: #0f172a;
  --patch-judge-muted: #475569;
  --patch-judge-accent: #2563eb;
}
body.patch-judge-page { margin:0; min-height:100vh; background:radial-gradient(circle at top left, rgba(56,189,248,.18), transparent 32%), var(--patch-judge-bg); color:var(--patch-judge-text); font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.patch-judge-shell { width:min(1180px,calc(100% - 28px)); margin:0 auto; padding:24px 0 48px; }
.patch-judge-hero,.patch-judge-panel,.patch-judge-denied { border:1px solid var(--patch-judge-border); border-radius:24px; background:var(--patch-judge-card); box-shadow:0 20px 60px rgba(2,6,23,.22); }
.patch-judge-hero { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; padding:22px; margin-bottom:18px; }
.patch-judge-back { color:var(--patch-judge-accent); font-weight:950; text-decoration:none; display:inline-flex; margin-bottom:12px; }
.patch-judge-kicker { margin:0 0 8px; color:var(--patch-judge-accent); font-weight:950; text-transform:uppercase; letter-spacing:.08em; font-size:.78rem; }
.patch-judge-hero h1,.patch-judge-panel h2 { margin:0 0 8px; }
.patch-judge-hero p,.patch-judge-panel p { margin:0; color:var(--patch-judge-muted); line-height:1.55; }
.patch-judge-score { min-width:210px; border:1px solid rgba(34,197,94,.35); border-radius:20px; padding:14px; background:rgba(34,197,94,.12); font-weight:950; text-align:center; }
.patch-judge-score strong { display:block; font-size:2rem; color:var(--patch-judge-good); }
.patch-judge-actions { display:flex; flex-wrap:wrap; gap:10px; margin:16px 0 0; }
.patch-judge-btn { border:1px solid rgba(56,189,248,.35); border-radius:999px; padding:10px 14px; background:linear-gradient(135deg,#38bdf8,#2563eb); color:white; font-weight:950; cursor:pointer; text-decoration:none; }
.patch-judge-btn.secondary { background:rgba(15,23,42,.35); color:var(--patch-judge-text); }
.patch-judge-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.patch-judge-panel { padding:18px; margin-bottom:16px; }
.patch-judge-list { display:grid; gap:10px; margin-top:14px; }
.patch-judge-item { border:1px solid var(--patch-judge-border); border-radius:16px; padding:12px; background:var(--patch-judge-soft); }
.patch-judge-item strong { display:block; margin-bottom:4px; }
.patch-judge-item small { color:var(--patch-judge-muted); line-height:1.4; display:block; }
.patch-judge-pill { display:inline-flex; align-items:center; border-radius:999px; padding:4px 9px; font-size:.72rem; font-weight:950; margin-bottom:8px; text-transform:uppercase; letter-spacing:.05em; }
.patch-judge-pass { color:#dcfce7; background:rgba(22,163,74,.24); }
.patch-judge-warn { color:#fef3c7; background:rgba(245,158,11,.24); }
.patch-judge-fail { color:#fee2e2; background:rgba(239,68,68,.24); }
.patch-judge-info { color:#dbeafe; background:rgba(37,99,235,.24); }
.patch-judge-output { white-space:pre-wrap; overflow:auto; max-height:300px; border-radius:16px; padding:12px; background:rgba(2,6,23,.72); color:#dbeafe; font-size:.86rem; }
.patch-judge-denied { width:min(720px,calc(100% - 28px)); margin:40px auto; padding:24px; text-align:center; }
@media (max-width: 900px){ .patch-judge-hero{flex-direction:column;} .patch-judge-grid{grid-template-columns:1fr;} .patch-judge-score{width:100%; min-width:0;} }


/* Patch 1.6.8.3.155 - Patch Judge work list */
.patch-judge-work-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:14px 0;}
.patch-judge-work-form input,.patch-judge-work-form select,.patch-judge-work-form textarea{width:100%;border:1px solid rgba(148,163,184,.28);background:rgba(15,23,42,.78);color:#e5f3ff;border-radius:14px;padding:11px 12px;font:inherit;outline:none;}
.patch-judge-work-form textarea{grid-column:1/-1;min-height:86px;resize:vertical;}
.patch-judge-work-form button{grid-column:1/-1;}
.compact-actions{margin:8px 0 14px;gap:10px;display:flex;flex-wrap:wrap;}
.patch-judge-todo-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;}
.patch-judge-todo-actions button{border:1px solid rgba(125,211,252,.28);background:rgba(14,165,233,.12);color:#dbeafe;border-radius:999px;padding:7px 10px;cursor:pointer;font-weight:700;}
.patch-judge-todo-actions button:hover{background:rgba(14,165,233,.22);}
@media(max-width:760px){.patch-judge-work-form{grid-template-columns:1fr;}.compact-actions{flex-direction:column}.compact-actions .patch-judge-btn{width:100%;}}

/* Patch 1.6.8.3.157 - prioritized work-list mirrors + copy JSON button */
.patch-judge-risk-worklist{margin-top:16px;border-top:1px solid var(--patch-judge-border);padding-top:14px;}
.patch-judge-risk-worklist::before{content:"Critical / High Work Items";display:block;color:var(--patch-judge-accent);font-weight:950;text-transform:uppercase;letter-spacing:.08em;font-size:.76rem;margin-bottom:4px;}
#patchJudgeBacklogItems .patch-judge-item{opacity:.96;}
.patch-judge-output + .patch-judge-btn,.compact-actions #patchJudgeCopyRawBtn{min-width:160px;}


/* Patch 1.6.8.3.158 - Patch Judge scroll containment quick fix */
.patch-judge-panel {
  min-height: 0;
}

.patch-judge-panel .patch-judge-list,
#patchJudgeResults,
#patchJudgeSecurityResults,
#patchJudgeCriticalWorkItems,
#patchJudgeTodoList,
#patchJudgeBacklogItems {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.55) rgba(15, 23, 42, 0.35);
}

#patchJudgeCriticalWorkItems {
  max-height: 260px;
}

#patchJudgeTodoList,
#patchJudgeBacklogItems {
  max-height: 420px;
}

.patch-judge-output {
  max-height: 360px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.55) rgba(15, 23, 42, 0.35);
}

.patch-judge-panel .patch-judge-list::-webkit-scrollbar,
.patch-judge-output::-webkit-scrollbar {
  width: 10px;
}

.patch-judge-panel .patch-judge-list::-webkit-scrollbar-track,
.patch-judge-output::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 999px;
}

.patch-judge-panel .patch-judge-list::-webkit-scrollbar-thumb,
.patch-judge-output::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.55);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.25);
}

.patch-judge-panel .patch-judge-list::-webkit-scrollbar-thumb:hover,
.patch-judge-output::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.78);
}

.patch-judge-scroll-note {
  color: var(--patch-judge-muted);
  font-size: 0.78rem;
  margin: 8px 0 0;
}

@media (max-width: 760px) {
  .patch-judge-panel .patch-judge-list,
  #patchJudgeResults,
  #patchJudgeSecurityResults,
  #patchJudgeCriticalWorkItems,
  #patchJudgeTodoList,
  #patchJudgeBacklogItems {
    max-height: 300px;
  }

  #patchJudgeTodoList,
  #patchJudgeBacklogItems,
  .patch-judge-output {
    max-height: 340px;
  }
}
