/* agent-eval demo: the look of the framework's Streamlit dashboard, in plain CSS.
   Chart colours are the dashboard's own (agent_eval/dashboard/charts.py,
   Palette): one blue for data and improvements, red for regressions, grey
   for no call. Never green/red. Small text uses the darker -text variants of
   the red and blue so it clears 4.5:1 on white. */

@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-400.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/source-sans-3-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-600.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-700.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --sidebar: #f0f2f6;
  --text: #31333f;
  --muted: rgba(49, 51, 63, 0.74);
  --border: rgba(49, 51, 63, 0.2);
  --border-soft: rgba(49, 51, 63, 0.1);
  --hover: rgba(49, 51, 63, 0.04);
  --accent: var(--text);   /* selection is neutral: red is reserved for regressions */
  --code-bg: #f0f2f6;
  --head-bg: #f8f9fb;
  --info-bg: rgba(28, 131, 225, 0.1);   --info-text: #004280;
  --success-bg: rgba(33, 195, 84, 0.1); --success-text: #177233;
  --warn-bg: rgba(255, 227, 18, 0.12);  --warn-text: #7a5a04;
  --error-bg: rgba(255, 43, 43, 0.09);  --error-text: #7d353b;
  --json-key: #31333f; --json-str: #0a6b3d; --json-num: #1c6ad1; --json-lit: #9a3a9a;

  /* charts.Palette.for_theme(dark=False) */
  --c-surface: #ffffff;
  --c-ink: #0b0b0b;
  --c-muted: #6b6a65;
  --c-grid: #e1e0d9;
  --c-axis: #c3c2b7;
  --c-series: #2a78d6;
  --c-down: #e34948;
  --c-neutral: #898781;
  --c-down-text: #b92b2a;
  --c-up-text: #1a62b8;

  --sans: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --chart-font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --sidebar: #262730;
    --text: #fafafa;
    --muted: rgba(250, 250, 250, 0.6);
    --border: rgba(250, 250, 250, 0.2);
    --border-soft: rgba(250, 250, 250, 0.1);
    --hover: rgba(250, 250, 250, 0.04);
    --code-bg: #1b1d26;
    --head-bg: #1a1c24;
    --info-bg: rgba(61, 157, 243, 0.2);   --info-text: #c7ebff;
    --success-bg: rgba(61, 213, 109, 0.2); --success-text: #dffde9;
    --warn-bg: rgba(255, 227, 18, 0.2);    --warn-text: #ffffc2;
    --error-bg: rgba(255, 108, 108, 0.2);  --error-text: #ffdede;
    --json-key: #fafafa; --json-str: #7fd6a4; --json-num: #8cbcff; --json-lit: #e3a6e3;

    /* charts.Palette.for_theme(dark=True) */
    --c-surface: #0e1117;
    --c-ink: #ffffff;
    --c-muted: #898781;
    --c-grid: #2c2c2a;
    --c-axis: #383835;
    --c-series: #3987e5;
    --c-down: #e66767;
    --c-neutral: #898781;
    --c-down-text: #e66767;
    --c-up-text: #3987e5;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 0.25rem; overflow-wrap: anywhere; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-series); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--bg); padding: 0.5rem 1rem; border-radius: 0.5rem; }

/* ---------- Frame: sidebar + main ---------- */

.app {
  display: grid; grid-template-columns: 18.5rem minmax(0, 1fr); min-height: 100vh;
  /* The sidebar's colour runs the full height of a long page. */
  background: linear-gradient(to right, var(--sidebar) 18.5rem, var(--bg) 18.5rem);
}

.sidebar {
  background: var(--sidebar);
  padding: 2rem 1.5rem;
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh; overflow-y: auto;
}
.back { display: inline-block; font-size: 0.9rem; font-weight: 600; text-decoration: none; margin-bottom: 1.5rem; }
.back:hover { text-decoration: underline; }
.brand { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0 0 1.5rem; letter-spacing: -0.01em; }

.radio { border: 0; margin: 0 0 1.25rem; padding: 0; }
.radio legend, .field > span { font-size: 0.875rem; margin-bottom: 0.35rem; padding: 0; }
.radio-options { display: flex; flex-direction: column; gap: 0.15rem; }
.radio-option { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 1rem; padding: 0.25rem 0; }
.radio-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-dot {
  width: 1rem; height: 1rem; border-radius: 50%; flex: none;
  border: 1px solid var(--border); background: var(--bg);
  display: grid; place-items: center;
}
.radio-option input:checked + .radio-dot { background: var(--accent); border-color: var(--accent); }
.radio-option input:checked + .radio-dot::after { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--bg); }
.radio-option input:focus-visible + .radio-dot { outline: 2px solid var(--c-series); outline-offset: 2px; }

.field { display: block; margin: 0 0 1.25rem; }
.field > span { display: block; }
select {
  width: 100%; max-width: 100%;
  appearance: none; -webkit-appearance: none;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23898781' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
  padding: 0.45rem 2.25rem 0.45rem 0.75rem;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  cursor: pointer;
}
.sidebar select { background-color: var(--bg); }
select:disabled { cursor: default; opacity: 0.75; }

main { padding: 3rem 4rem 5rem; min-width: 0; max-width: 78rem; }
main:focus { outline: none; }

.caption { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0 1rem; }

/* ---------- Intro and tour ---------- */

.intro { margin-bottom: 1.75rem; }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.25rem; font-weight: 600; }
.intro h1 { font-size: 2.75rem; line-height: 1.15; margin: 0 0 0.5rem; font-weight: 700; letter-spacing: -0.01em; }
.lede { font-size: 1.15rem; max-width: 46rem; margin: 0 0 1.5rem; }

.tour-title { font-size: 0.875rem; color: var(--muted); margin: 0 0 0.5rem; }
.tour-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.5rem; }
.tour-step {
  width: 100%; height: 100%; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.6rem 0.85rem; line-height: 1.3;
  transition: border-color 0.15s, background-color 0.15s;
}
.tour-step:hover { border-color: var(--text); }
/* The current step takes the info colour of the note it opens below. */
.tour-step[aria-current="step"] {
  border-color: var(--c-series);
  background: color-mix(in srgb, var(--c-series) 10%, var(--bg));
  box-shadow: inset 0 3px 0 var(--c-series);
}
.tour-step .num { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.15rem; }
.tour-step[aria-current="step"] .num { color: var(--info-text); }
.tour-step .name { font-weight: 600; }

/* st.info / st.success / st.warning / st.error */
.alert { border-radius: 0.5rem; padding: 0.9rem 1rem; margin: 0 0 1.25rem; font-size: 0.975rem; }
.alert p { margin: 0 0 0.5rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-info { background: var(--info-bg); color: var(--info-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert code { background: transparent; padding: 0; }
.note-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.note-head strong { font-weight: 700; }
.note-next {
  background: transparent; border: 1px solid currentColor; border-radius: 0.5rem;
  padding: 0.2rem 0.75rem; cursor: pointer; font-size: 0.9rem; color: inherit;
}
.note-next:hover { background: var(--hover); }

/* ---------- A view ---------- */

.view h2.view-title { font-size: 2.1rem; line-height: 1.2; margin: 0.5rem 0 1rem; font-weight: 700; overflow-wrap: anywhere; }
.view h3 { font-size: 1.45rem; line-height: 1.3; margin: 2rem 0 0.5rem; font-weight: 600; }
.view h4 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; font-weight: 600; }

.pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.75rem 1rem; margin-bottom: 1rem; }
.pickers .field { margin: 0; min-width: 0; }

/* st.metric */
.metrics { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1rem; margin: 0.5rem 0 1.25rem; }
.metric { min-width: 0; padding: 0.7rem 0.9rem 0.8rem; border: 1px solid var(--border-soft); border-radius: 0.6rem; }
.metric-label { font-size: 0.875rem; margin: 0; }
.metric-value { font-size: 2.1rem; line-height: 1.25; margin: 0.1rem 0 0; overflow-wrap: anywhere; }
.metric-value.small { font-size: 1.45rem; padding-top: 0.35rem; }
.metric-delta { display: inline-block; font-size: 0.9rem; border-radius: 1rem; padding: 0.05rem 0.55rem; margin-top: 0.25rem; }
.metric-delta.down { color: var(--c-down-text); background: color-mix(in srgb, var(--c-down) 12%, transparent); }
.metric-delta.up { color: var(--c-up-text); background: color-mix(in srgb, var(--c-series) 12%, transparent); }
.metric-delta.flat { color: var(--c-muted); background: color-mix(in srgb, var(--c-muted) 14%, transparent); }

/* st.dataframe */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 0.5rem; margin: 0.5rem 0 1rem; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--head-bg); font-weight: 400; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.wrap { min-width: 14rem; overflow-wrap: anywhere; }
td.id { font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; }
td.none { color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--hover); }
tr.selected td { background: color-mix(in srgb, var(--c-series) 9%, transparent); }
.down-text { color: var(--c-down-text); }
.up-text { color: var(--c-up-text); }

/* Charts */
.chart { position: relative; width: 100%; margin: 0.25rem 0 0.5rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--chart-font); }
.chart .pt { cursor: default; }
.chart .pt:focus { outline: none; }
.chart .pt:focus-visible { stroke: var(--c-ink); }
.grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 0.5rem 0 1rem; }
.cell-title { font-family: var(--chart-font); font-size: 12px; margin: 0 0 0.25rem; color: var(--c-ink); overflow-wrap: anywhere; }

.tip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 0.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 0.45rem 0.65rem; font-family: var(--chart-font); font-size: 12px; line-height: 1.45;
  max-width: min(20rem, calc(100vw - 2rem));
}
.tip dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 0 0.75rem; }
.tip dt { color: var(--muted); }
.tip dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* st.code */
pre.code {
  background: var(--code-bg); border-radius: 0.5rem;
  padding: 0.85rem 1rem; margin: 0.5rem 0 1rem;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
  overflow-x: auto; max-width: 100%; white-space: pre;
}
pre.code .bad { color: var(--c-down-text); font-weight: 600; }
.exit { font-size: 0.875rem; color: var(--muted); margin: -0.5rem 0 1rem; }

/* st.expander */
details.expander { border: 1px solid var(--border-soft); border-radius: 0.5rem; margin: 0.75rem 0 1rem; }
details.expander > summary { cursor: pointer; padding: 0.6rem 1rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.expander > summary::-webkit-details-marker { display: none; }
details.expander > summary::after { content: "⌄"; color: var(--muted); transition: transform 0.15s; line-height: 1; }
details.expander[open] > summary::after { transform: rotate(180deg); }
details.expander > .body { padding: 0 1rem 0.75rem; min-width: 0; }

/* st.json */
.json {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
  background: var(--code-bg); border-radius: 0.5rem; padding: 0.75rem 0.9rem;
  max-height: 34rem; overflow: auto; margin: 0.5rem 0 1rem;
  overflow-wrap: anywhere;
}
.json details { margin-left: 0; }
.json details > summary { cursor: pointer; list-style: none; }
.json details > summary::-webkit-details-marker { display: none; }
.json details > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); }
.json details[open] > summary::before { content: "▾"; }
.json .kids { padding-left: 1.1rem; border-left: 1px solid var(--border-soft); margin-left: 0.3rem; }
.json .leaf { padding-left: 1em; }
.json .k { color: var(--json-key); }
.json .s { color: var(--json-str); }
.json .n { color: var(--json-num); }
.json .l { color: var(--json-lit); }
.json .meta { color: var(--muted); }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.two > div { min-width: 0; }

hr.rule { border: 0; border-top: 1px solid var(--border-soft); margin: 3rem 0 2rem; }

/* ---------- Below the views ---------- */

.how { border-top: 1px solid var(--border-soft); margin-top: 3.5rem; padding-top: 2rem; }
.how h2 { font-size: 1.45rem; margin: 0 0 0.75rem; font-weight: 600; }
.ideas { margin: 0; padding-left: 1.4rem; max-width: 50rem; }
.ideas li { margin-bottom: 0.65rem; }
.foot { margin-top: 2.5rem; color: var(--muted); font-size: 0.9rem; }
.foot p { margin: 0 0 0.35rem; }

/* ---------- Narrower screens ---------- */

@media (max-width: 1100px) {
  main { padding: 2.5rem 2rem 4rem; }
}

@media (max-width: 860px) {
  .app { display: block; background: var(--bg); }
  .sidebar {
    position: static; height: auto; overflow: visible;
    padding: 1rem 16px 1.1rem;
    display: grid; grid-template-columns: 1fr; gap: 0;
  }
  .back { margin-bottom: 0.5rem; }
  .brand { font-size: 1.5rem; margin-bottom: 0.75rem; }
  .radio { margin-bottom: 0.75rem; }
  .radio-options { flex-direction: row; flex-wrap: wrap; gap: 0.35rem 1rem; }
  .field { margin-bottom: 0.5rem; }
  .sidebar .caption { margin-bottom: 0; }
  main { padding: 1.75rem 16px 3rem; }
  .intro h1 { font-size: 2.1rem; }
  .lede { font-size: 1.05rem; }
  .view h2.view-title { font-size: 1.6rem; }
  .view h3 { font-size: 1.25rem; margin-top: 1.75rem; }
  .metrics { --cols: 2 !important; }
  .two { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

@media (max-width: 640px) {
  .wide-only { display: none; }
  .tour-steps { grid-template-columns: 1fr 1fr; }
  .metric-value { font-size: 1.7rem; }
  .metric-value.small { font-size: 1.2rem; }
  td.wrap { min-width: 8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
td.nowrap { white-space: nowrap; }

/* ---------- Refinements: type, hidden controls, touch targets, phone header ---------- */

/* Without this, .field's display beats the hidden attribute and the Suite
   picker stays on screen in the Overview view. */
[hidden] { display: none !important; }

h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

.eyebrow::before {
  content: ""; display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%;
  background: var(--c-series); margin-right: 0.6em; vertical-align: 0.08em;
}
.brand { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.intro h1 { letter-spacing: -0.02em; }

.foot-source { display: none; }

@media (pointer: coarse) {
  .radio-option { min-height: 44px; }
  .back { display: inline-flex; align-items: center; min-height: 44px; }
  .note-next { min-height: 44px; padding: 0.4rem 1rem; }
  tr.clickable td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
  details.expander > summary { min-height: 44px; align-items: center; }
  .foot a { display: inline-block; padding: 0.7rem 0; }
}

/* On a phone the first screen should show what the page is, not only its
   controls: one compact row of view pills, then the suite picker. */
@media (max-width: 860px) {
  .sidebar { padding: 0.25rem 16px 0.75rem; }
  .brand, .sidebar .caption { display: none; }
  /* A fieldset won't shrink below its content by default, which would stretch the grid column. */
  .radio { min-width: 0; min-inline-size: 0; }
  .foot-source { display: block; }
  .back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 0.25rem; }
  .radio legend {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .radio-options {
    flex-direction: row; flex-wrap: nowrap; gap: 0.4rem;
    overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none;
  }
  .radio-options::-webkit-scrollbar { display: none; }
  /* The visually hidden input is absolutely positioned; anchoring it to its label keeps it inside the scrolling row. */
  .radio-option { position: relative; flex: none; padding: 0; }
  .radio-dot { display: none; }
  .radio-option > span:last-child {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  }
  .radio-option input:checked ~ span:last-child {
    background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600;
  }
  .radio-option input:focus-visible ~ span:last-child { outline: 2px solid var(--c-series); outline-offset: 2px; }
  /* 16px: anything smaller makes iOS Safari zoom the page when a select is focused. */
  select, .sidebar select { font-size: 16px; min-height: 44px; }
}

@media (forced-colors: active) {
  .radio-option input:checked + .radio-dot { background: Highlight; border-color: Highlight; }
  .radio-option input:checked + .radio-dot::after { background: HighlightText; }
  .tour-step[aria-current="step"] { border-width: 3px; border-color: Highlight; }
}
.site-foot p { max-width: none; }
