Add Case Advocate tab — partisan brief grounded in Norwegian law

New /advocate.php tab: user selects who they represent (biological
father, mother, foster carer, CWS, etc.) and the agent takes their
side entirely. Adversarial sub-questions target supporting Lovdata
statutes + ECHR precedents; synthesis returns client_strengths[] and
opposing_weaknesses[] alongside the advocate brief.

- DeepResearchAgent: add advocateRole param to run(), interpretSeed(),
  expandQueries(), synthesise(). Neutral path unchanged (empty string).
- api/deep-research.php: extract + validate advocate_role from payload;
  telemetry logs tool='advocate' vs 'deep_research'.
- advocate.php: new page with role dropdown (presets + custom), same
  corpus slices/engine/controls/upload zone as deep research.
- assets/js/advocate.js: page-scoped JS; renders advocate banner,
  client strengths card (teal), advocate brief, opposing weaknesses
  card (amber), sub-Q cards, sources, uncertainty, next step.
- assets/css/tools.css: append .adv-* rules (~120 lines).
- includes/layout.php: add Advocate nav tab between Deep research and
  Summarize.
- index.php: add Advocate cap-card tile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 12:26:05 +02:00
parent 85a6bc8134
commit 640778454f
7 changed files with 1154 additions and 26 deletions
+161
View File
@@ -3052,3 +3052,164 @@ a.dr-source-title-link:hover {
.source-expand-grid { grid-template-columns: 1fr; }
.corpus-search-controls { flex-direction: column; align-items: flex-start; }
}
/* =====================================================================
Advocate tool (.adv-*)
===================================================================== */
/* Role selector row */
.adv-role-row {
display: flex;
flex-direction: column;
gap: 8px;
padding: 18px 20px;
background: var(--soft-teal);
border-radius: 8px;
border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent);
margin-bottom: 18px;
}
.adv-role-row .control-label {
font-size: 0.82rem;
font-weight: 600;
color: var(--teal-dark, var(--teal));
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 0;
}
.adv-role-select {
appearance: none;
background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 14px center;
border: 1px solid var(--line);
border-radius: 6px;
padding: 10px 38px 10px 14px;
font-size: 0.95rem;
color: var(--ink);
cursor: pointer;
width: 100%;
max-width: 480px;
}
.adv-role-select:focus { outline: 2px solid var(--teal); outline-offset: 2px; }
.adv-role-custom {
border: 1px solid var(--line);
border-radius: 6px;
padding: 9px 14px;
font-size: 0.93rem;
color: var(--ink);
width: 100%;
max-width: 480px;
background: var(--panel);
}
.adv-role-custom:focus { outline: 2px solid var(--teal); outline-offset: 2px; }
/* Advocate result banner */
.adv-banner {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 14px;
padding: 14px 20px;
background: var(--soft-teal);
border-radius: 8px;
border-left: 4px solid var(--teal);
margin-bottom: 16px;
}
.adv-banner__label {
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--teal-dark, var(--teal));
flex-shrink: 0;
}
.adv-banner__role {
font-size: 1.05rem;
color: var(--ink);
}
.adv-banner__note {
font-size: 0.8rem;
color: var(--muted);
flex-basis: 100%;
}
/* Client strengths card */
.adv-strengths {
background: var(--soft-teal);
border-radius: 8px;
border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent);
padding: 16px 20px;
margin-bottom: 14px;
}
.adv-strengths__head {
font-size: 0.9rem;
font-weight: 700;
color: var(--teal-dark, var(--teal));
margin: 0 0 10px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.adv-strengths__list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 7px;
}
.adv-strengths__item {
padding-left: 24px;
position: relative;
font-size: 0.88rem;
color: var(--ink);
line-height: 1.5;
}
.adv-strengths__item::before {
content: '✓';
position: absolute;
left: 0;
color: var(--teal);
font-weight: 700;
}
/* Opposing weaknesses card */
.adv-weaknesses {
background: color-mix(in srgb, var(--amber, #c87f00) 10%, transparent);
border-radius: 8px;
border: 1px solid color-mix(in srgb, var(--amber, #c87f00) 25%, transparent);
padding: 16px 20px;
margin-bottom: 14px;
}
.adv-weaknesses__head {
font-size: 0.9rem;
font-weight: 700;
color: var(--amber-dark, #8a5700);
margin: 0 0 10px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.adv-weaknesses__list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 7px;
}
.adv-weaknesses__item {
padding-left: 24px;
position: relative;
font-size: 0.88rem;
color: var(--ink);
line-height: 1.5;
}
.adv-weaknesses__item::before {
content: '⚠';
position: absolute;
left: 0;
font-size: 0.85em;
color: var(--amber, #c87f00);
}
@media (max-width: 760px) {
.adv-role-select, .adv-role-custom { max-width: 100%; }
.adv-banner { flex-direction: column; align-items: flex-start; }
}