/* Agent Evaluation flagship page.
 *
 * Implements the approved redesign: a navy hero, the shared prominent tab bar
 * (ml3t-tabs.css), and three panels - What we found, The paper (inline), and the
 * benchmark catalogue table. All colours come from ml3t-theme.css tokens; the
 * few derived values below are local conveniences.
 */
.ae {
  --ae-surface: #fff;
  --ae-surface-2: #f4f4f2;
  --ae-line: var(--ml3t-silver-muted, #e8e8e6);
  --ae-line-strong: #dcdcd9;
  --ae-ink: var(--ml3t-text-dark, #1e293b);
  --ae-muted: var(--ml3t-text-light, #64748b);
  /* The brand copper (#C87533) only reaches ~3.3:1 on these light grounds, so
     it fails WCAG AA for the small labels, finding kickers and source links.
     This darker copper clears 4.5:1 on both the white cards and the off-white
     page; the brand token stays untouched for larger/decorative use. */
  --ae-copper-text: #9A531C;
  /* Slate-500 muted is only 4.32:1 behind the sticky header fill; this slate
     clears 4.5:1 for the uppercase column labels. */
  --ae-th-ink: #556070;
  --ae-amber-tint: rgba(212, 168, 75, 0.12);
  --ae-bar-track: #ececeb;
  background: var(--ml3t-off-white, #FAFAF9);
  color: var(--ml3t-text, #334155);
  font-family: var(--ml3t-font-sans);
  line-height: 1.6;
}
.ae-wrap { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
@media (max-width: 600px) { .ae-wrap { width: calc(100% - 32px); } }
/* The embedded paper keeps its own heading rhythm (paper-preview.css). */
.ae :is(h1, h2, h3, h4):not(.paper-body *) {
  font-family: var(--ml3t-font-serif);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
  color: var(--ae-ink);
}

/* hero */
.ae-hero {
  background: linear-gradient(135deg, var(--ml3t-navy, #0a1628) 0%, var(--ml3t-slate, #1a2d4a) 100%);
  color: var(--ml3t-warm-white, #F8F8F6);
  position: relative;
  overflow: hidden;
}
.ae-hero::after {
  content: "";
  position: absolute;
  right: -140px;
  top: -140px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(212, 168, 75, 0.14), transparent 62%);
  pointer-events: none;
}
.ae-hero .ae-wrap { padding: calc(72px + 50px) 24px 34px; position: relative; z-index: 1; }
@media (max-width: 600px) { .ae-hero .ae-wrap { padding: calc(60px + 34px) 16px 30px; } }
.ae-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ml3t-amber, #D4A84B);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ae-eyebrow .ae-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ml3t-silver, #C0C0C0); opacity: 0.6; }
/* Out-ranks the shared heading rule above, which otherwise paints the hero
   title in dark ink on the navy ground and zeroes its margin. */
.ae .ae-hero h1:not(.paper-body *) { font-size: clamp(2.1rem, 4.6vw, 3.3rem); margin: 16px 0 0; letter-spacing: -0.01em; color: var(--ml3t-warm-white, #F8F8F6); }
.ae-standfirst { font-size: clamp(1.05rem, 1.8vw, 1.26rem); line-height: 1.55; color: var(--ml3t-silver, #C0C0C0); max-width: 720px; margin: 16px 0 0; font-weight: 400; }

/* panels */
.ae-panel { padding: 44px 0 76px; }
.ae-sectlabel { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ae-copper-text); margin: 0 0 14px; }
.ae-lead { font-size: 1.14rem; line-height: 1.55; color: var(--ae-ink); max-width: 720px; margin: 0 0 8px; font-weight: 500; }
.ae-sub { color: var(--ae-muted); max-width: 720px; margin: 0; }

/* findings */
.ae-findings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ae-line); border: 1px solid var(--ae-line); border-radius: 14px; overflow: hidden; margin-top: 26px; }
@media (max-width: 620px) { .ae-findings { grid-template-columns: 1fr; } }
.ae-finding { background: var(--ae-surface); padding: 26px; }
.ae-finding .ae-fk { font-family: var(--ml3t-font-mono); font-size: 12px; color: var(--ae-copper-text); margin: 0 0 10px; }
.ae-finding h2 { font-size: 1.25rem; margin: 0 0 8px; }
.ae-finding p { margin: 0; color: var(--ae-muted); font-size: 15.5px; line-height: 1.58; }

/* viz */
.ae-vizcard { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: 14px; padding: 28px; margin-top: 26px; box-shadow: var(--ml3t-shadow); }
.ae-vizcard h2 { font-size: 1.2rem; margin: 0 0 4px; }
.ae-vizcard .ae-vnote { color: var(--ae-muted); font-size: 14px; margin: 0 0 22px; max-width: 760px; }
.ae-viz-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; }
@media (max-width: 720px) { .ae-viz-cols { grid-template-columns: 1fr; gap: 30px; } }
.ae-vtitle { font-weight: 600; font-size: 14px; margin: 0 0 16px; color: var(--ae-ink); }
.ae-bar { display: grid; grid-template-columns: 148px 1fr 42px; align-items: center; gap: 12px; margin: 0 0 11px; font-size: 13.5px; }
.ae-bar .ae-blabel { color: var(--ae-muted); text-align: right; line-height: 1.22; }
.ae-bar .ae-btrack { background: var(--ae-bar-track); border-radius: 5px; height: 19px; overflow: hidden; }
.ae-bar .ae-bfill { display: block; height: 100%; min-width: 2px; border-radius: 5px; background: var(--ml3t-slate, #1a2d4a); }
.ae-bar.ae-accent .ae-bfill { background: var(--ml3t-amber, #D4A84B); }
.ae-bar .ae-bval { font-family: var(--ml3t-font-mono); font-size: 12.5px; color: var(--ae-ink); text-align: right; }
.ae-illus { font-size: 12.5px; color: var(--ae-muted); margin: 18px 0 0; }

/* The paper: rendered through the shared paper-preview reading layout
   (apps/forecasts/static/forecasts/paper-preview.css), embedded inside the tab
   panel. Only the small adjustments that let that self-contained layout sit
   inside the evaluation page live here. */
.ae-paper-panel { padding: 0 0 20px; }
.paper-page--embedded { background: transparent; }
.paper-page--embedded .paper-header { border-radius: 14px; border: 1px solid var(--ae-line); margin-top: 34px; }
.paper-page--embedded .paper-header-inner { padding: 30px 34px 34px; }
.paper-page--embedded .paper-header .paper-back { display: none; }
.paper-page--embedded .paper-layout { padding: 36px 0 20px; }
/* Below the navbar and the sticky tab bar, not under them. */
.paper-page--embedded .paper-sidebar { top: calc(var(--al-sticky-offset) + 18px); max-height: calc(100vh - var(--al-sticky-offset) - 36px); }
.paper-page--embedded .paper-body :is(h2, h3, h4) { scroll-margin-top: calc(var(--al-sticky-offset) + 16px); }
.paper-embed-title {
  max-width: 1000px;
  margin: 18px 0 16px;
  color: var(--paper-navy, #132b40);
  font-family: var(--ml3t-font-serif);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
@media (max-width: 1000px) {
  .paper-page--embedded .paper-layout { padding-top: 28px; }
}

/* catalogue */
.ae-scope-intro { color: var(--ae-muted); font-size: 15px; max-width: 820px; margin: 0 0 8px; line-height: 1.58; }
.ae-scope-intro b { color: var(--ae-ink); font-weight: 600; }
.ae-scope-src { margin: 0 0 22px; font-size: 13.5px; }
.ae-scope-src a { color: var(--ae-copper-text); font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; }
.ae-scope-src a:hover { border-bottom-color: currentColor; }
.ae-catbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 4px 0 20px; }
.ae-catbar input, .ae-catbar select { font-family: var(--ml3t-font-sans); font-size: 14.5px; background: var(--ae-surface); color: var(--ae-ink); border: 1px solid var(--ae-line-strong); border-radius: 9px; padding: 10px 13px; height: 42px; }
.ae-catbar input { flex: 1; min-width: 220px; }
.ae-catbar .ae-hint { color: var(--ae-muted); font-size: 13.5px; margin-left: auto; font-variant-numeric: tabular-nums; }
.ae-tablewrap { overflow-x: auto; border: 1px solid var(--ae-line); border-radius: 14px; background: var(--ae-surface); box-shadow: var(--ml3t-shadow); }
table.ae-cat { border-collapse: collapse; width: 100%; min-width: 1024px; font-size: 13.5px; table-layout: fixed; }
/* Fixed column widths so all six columns fit the content width at desktop and
   only scroll horizontally on a narrow viewport. */
table.ae-cat th:nth-child(1), table.ae-cat td:nth-child(1) { width: 15%; }
table.ae-cat th:nth-child(2), table.ae-cat td:nth-child(2) { width: 19.5%; }
table.ae-cat th:nth-child(3), table.ae-cat td:nth-child(3) { width: 14%; }
table.ae-cat th:nth-child(4), table.ae-cat td:nth-child(4) { width: 20%; }
table.ae-cat th:nth-child(5), table.ae-cat td:nth-child(5) { width: 11%; }
table.ae-cat th:nth-child(6), table.ae-cat td:nth-child(6) { width: 20.5%; }
table.ae-cat thead th { position: sticky; top: 0; background: var(--ae-surface-2); text-align: left; font-family: var(--ml3t-font-sans); font-weight: 600; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ae-th-ink); padding: 13px 14px; border-bottom: 1px solid var(--ae-line-strong); }
table.ae-cat tbody td { padding: 14px; border-top: 1px solid var(--ae-line); vertical-align: top; line-height: 1.46; overflow-wrap: break-word; }
table.ae-cat tbody tr:hover { background: var(--ae-amber-tint); }
/* slate-500 drops to about 4.36:1 on the amber hover tint; use the header slate. */
table.ae-cat tbody tr:hover :is(.ae-r-type:not(.alt), .ae-r-host, .ae-r-area, .ae-r-note, .ae-r-sub, .ae-r-score, .ae-r-lim) { color: var(--ae-th-ink); }
.ae-cat .ae-r-name { font-weight: 700; color: var(--ae-ink); font-size: 14px; }
.ae-cat .ae-r-name a { color: inherit; text-decoration: none; }
.ae-cat .ae-r-name a:hover { color: var(--ae-copper-text); text-decoration: underline; }
.ae-cat .ae-r-type { display: block; font-weight: 500; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ae-muted); margin-top: 3px; }
.ae-cat .ae-r-type.alt { color: var(--ae-copper-text); }
.ae-cat .ae-r-src { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; }
.ae-cat .ae-r-src a { font-weight: 500; font-size: 11.5px; color: var(--ae-copper-text); text-decoration: none; border-bottom: 1px solid transparent; }
.ae-cat .ae-r-src a:hover { border-bottom-color: currentColor; }
/* The source host is a label: the row name already links to the same source. */
.ae-cat .ae-r-host { font-weight: 500; font-size: 11.5px; color: var(--ae-muted); }
.ae-cat td.ae-r-task { min-width: 210px; color: var(--ae-ink); }
.ae-cat .ae-r-area { font-size: 12px; color: var(--ae-muted); margin-top: 4px; display: block; }
.ae-cat .ae-r-note { display: block; font-weight: 400; font-size: 11.5px; line-height: 1.45; color: var(--ae-muted); margin-top: 6px; }
.ae-cat .ae-r-note a { color: var(--ae-copper-text); font-weight: 500; text-decoration: none; border-bottom: 1px solid transparent; }
.ae-cat .ae-r-note a:hover { border-bottom-color: currentColor; }
.ae-cat td.ae-r-sub, .ae-cat td.ae-r-score, .ae-cat td.ae-r-lim { color: var(--ae-muted); min-width: 160px; }
.ae-pips { display: inline-flex; gap: 4px; }
.ae-pip { width: 9px; height: 9px; border-radius: 50%; background: var(--ae-bar-track); border: 1px solid var(--ae-line-strong); }
.ae-pip.on { background: var(--ml3t-slate, #1a2d4a); border-color: var(--ml3t-slate, #1a2d4a); }
.ae-pips-wrap small { display: block; color: var(--ae-muted); font-size: 11px; margin-top: 5px; white-space: nowrap; }
.ae-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--ae-muted); font-size: 12.5px; margin: 14px 2px 0; }
.ae-legend .ae-pip { display: inline-block; vertical-align: -1px; margin-right: 5px; }
.ae-emptyrow td { text-align: center; color: var(--ae-muted); font-size: 14px; padding: 28px; }

:where(.ae) :focus-visible { outline: 2px solid var(--ml3t-slate, #1a2d4a); outline-offset: 2px; border-radius: 4px; }

/* Per-evaluation page (/agent-lab/evaluation/<slug>/). Sections are plain
   reading blocks; each sample task is a card with its provenance underneath. */
.ev-back { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.ev-back:hover { color: var(--ml3t-amber, #D4A84B); }
.ev-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 0; font-size: 0.92rem; }
.ev-links a { color: var(--ml3t-amber, #D4A84B); }
.ev-links span { opacity: 0.8; }
.ev-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 40px 24px 64px; }
@media (max-width: 600px) { .ev-body { padding: 32px 16px 48px; } }
.ev-body > * { max-width: 860px; }
.ev-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.ev-section h2 { font-size: 1.55rem; }
.ae .ev-section h3:not(.paper-body *) { font-size: 1.15rem; margin-top: 6px; }
.ev-section p { margin: 0; max-width: 72ch; }
.ev-facts { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.ev-facts dt { font-weight: 600; color: var(--ae-ink); }
.ev-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .ev-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ev-facts dd { margin-bottom: 10px; }
}
.ev-environment, .ev-note, .ev-checked { color: var(--ae-muted); }
.ev-checked { font-size: 0.85rem; overflow-wrap: anywhere; }
.ev-absent { background: var(--ae-surface-2); border: 1px solid var(--ae-line); border-radius: 8px; padding: 14px 16px; }
.ev-task { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: 10px; padding: 22px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
@media (max-width: 600px) { .ev-task { padding: 18px 16px; } }
.ev-task-head { display: grid; gap: 6px; justify-items: start; }
.ae .ev-task h4:not(.paper-body *) { font-family: var(--ml3t-font-sans); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ae-th-ink); }
.ev-kicker { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ae-copper-text); }
.ev-badge { font-size: 0.75rem; padding: 2px 10px; border-radius: 999px; background: var(--ae-amber-tint); color: var(--ae-ink); }
.ev-badge.alt { background: var(--ae-surface-2); border: 1px dashed var(--ae-line-strong); }
.ev-prompt { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.86rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; background: var(--ae-surface-2); border-left: 3px solid var(--ae-line-strong); border-radius: 4px; padding: 12px 14px; }
.ev-prompt.verbatim { border-left-color: var(--ml3t-amber, #D4A84B); }
.ev-prompt:focus-visible { outline: 2px solid var(--ae-copper-text); outline-offset: 2px; }
.ev-provenance { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--ae-line); font-size: 0.85rem; color: var(--ae-muted); }
.ev-provenance div { min-width: 0; flex: 1 1 14rem; }
.ev-provenance dt { font-weight: 600; color: var(--ae-th-ink); }
.ev-provenance dd { margin: 0; overflow-wrap: anywhere; }
.ev-provenance a, .ev-checked a, .ev-artifact a { color: var(--ae-copper-text); }
.ev-artifact { display: block; overflow-wrap: anywhere; }
