/* E2E Tests page: ported from togal-checksum-dashboard (src/dashboard.html). Every rule is scoped
   under .e2e; colors and fonts come from styles.css, plus the status colors the matrix needs. */
.e2e {
  --surface-2: var(--hover);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --pass: #1f9d55;
  --fail: #d6363c;
  --bug: #e07b16;
  --recovered: #c9a400;
  --skip: #a7b1bb;
  --cell-line: color-mix(in srgb, var(--line) 70%, var(--surface));
  --shadow: 0 1px 2px rgba(22, 32, 42, .06), 0 8px 24px rgba(22, 32, 42, .06);
  --display: var(--font-display);
  --body: var(--font-display);
  --mono: var(--font-data);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .e2e { --pass: #3cc274; --fail: #f0585d; --bug: #f39a3d; --recovered: #e3c53a; --skip: #5b6875; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); }
}
:root[data-theme="dark"] .e2e { --pass: #3cc274; --fail: #f0585d; --bug: #f39a3d; --recovered: #e3c53a; --skip: #5b6875; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); }
/* The matrix needs more room than the other pages. */
main.e2e-main { max-width: 1480px; }
/* styles.css styles some of the same class names for other pages (.panel, .row-btn, .toolbar, ...).
   Undo those inside .e2e. :where() keeps this at the lowest specificity, so every .e2e rule below wins. */
.e2e :where(.muted, .num, .banner, .summary, .panel, .count, .dot, .grid, .bar, .row-btn, .sub, .pill, .fail, .pass, .empty, .tabs, .toolbar, .r, .kv, .err, .btn, .note) {
  all: revert;
  box-sizing: border-box;
}
.e2e, .e2e * { box-sizing: border-box; }
.e2e [hidden] { display: none !important; }
.e2e { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 14px; line-height: 1.45; }
.e2e { max-width: 1480px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; }
.e2e h1, .e2e h2, .e2e h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: .01em; }
.e2e h1 { font-size: 26px; }
.e2e h2 { font-size: 17px; }
.e2e h3 { font-size: 15px; }
.e2e .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.e2e .muted { color: var(--muted); }
.e2e .mono { font-family: var(--mono); font-size: 12px; }
.e2e .num { font-variant-numeric: tabular-nums; }
.e2e a { color: var(--accent); text-decoration: none; }
.e2e a:hover { text-decoration: underline; }
.e2e button, .e2e select, .e2e input { font: inherit; color: inherit; }
.e2e :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.e2e .top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.e2e .top .meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
.e2e .seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.e2e .seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.e2e .seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

.e2e .banner { border: 1px solid var(--line); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; }

/* summary */
.e2e .summary { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; }
.e2e .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.e2e .latest { display: grid; gap: 12px; align-content: start; }
.e2e .rate { display: flex; align-items: baseline; gap: 10px; }
.e2e .rate b { font-family: var(--display); font-size: 44px; line-height: 1; font-weight: 600; }
.e2e .days { display: grid; gap: 4px; font-size: 13px; }
.e2e .day { display: grid; grid-template-columns: 52px 52px 1fr; align-items: baseline; gap: 8px; }
.e2e .day .k { color: var(--muted); }
.e2e .delta { font-size: 13px; font-weight: 600; }
.e2e .delta.up { color: var(--pass); } .e2e .delta.down { color: var(--fail); } .e2e .delta.flat { color: var(--muted); }
.e2e .counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.e2e .count { display: grid; gap: 2px; }
.e2e .count .v { font-family: var(--display); font-size: 20px; font-weight: 600; }
.e2e .count .k { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.e2e .dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }
.e2e .trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.e2e .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.e2e .legend span { display: inline-flex; align-items: center; gap: 5px; }
.e2e #trend { width: 100%; height: 170px; display: block; }
.e2e #trend text { fill: var(--muted); font-size: 10px; font-family: var(--body); }
.e2e #trend .grid { stroke: var(--cell-line); stroke-width: 1; }
.e2e #trend .bar { cursor: pointer; }
.e2e #trend .bar:hover rect { opacity: .82; }

/* insights */
.e2e .insights { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.e2e .insights > .panel { grid-column: span 2; }
.e2e .insights > .panel.half { grid-column: span 3; }
@media (max-width: 1100px) { .e2e .insights > .panel, .e2e .insights > .panel.half { grid-column: span 3; } }
@media (max-width: 700px) { .e2e .insights > .panel, .e2e .insights > .panel.half { grid-column: 1 / -1; } }
.e2e .insights > .panel.full { grid-column: 1 / -1; }
.e2e .section-break { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
/* Slowest tests: two columns on wide screens. */
.e2e .slow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; max-height: none; }
@media (max-width: 900px) { .e2e .slow-grid { grid-template-columns: 1fr; } }
.e2e .list.wide .row-btn .t { display: block; }
.e2e .list.wide .row-btn .sub { white-space: normal; }
.e2e .insights .panel { display: grid; gap: 10px; align-content: start; }
.e2e .panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 8px; }
.e2e .list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.e2e .list li { min-width: 0; }
.e2e .row-btn { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.e2e .row-btn:hover, .e2e .row-btn[aria-pressed="true"] { background: var(--surface-2); }
.e2e .row-btn .t { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.e2e .row-btn .t .sub, .e2e .row-btn .t .meter { -webkit-line-clamp: initial; }
.e2e .row-btn .bugn { display: block; font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.e2e .row-btn .sub { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2e .meter { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.e2e .meter { display: flex; }
.e2e .meter i { display: block; height: 100%; background: var(--fail); }
.e2e .pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.e2e .pill.fail { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
.e2e .pill.pass { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }
.e2e .pill.bug { background: color-mix(in srgb, var(--bug) 18%, transparent); color: var(--bug); }
.e2e .empty { color: var(--muted); font-size: 13px; padding: 6px 8px; }
.e2e .tabs { display: flex; gap: 4px; }
.e2e .tabs button { border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--muted); }
.e2e .tabs button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* matrix */
.e2e .matrix-panel { padding: 0; overflow: hidden; }
.e2e .toolbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.e2e .toolbar h2 { margin-right: auto; }
.e2e .toolbar input[type="search"], .e2e .toolbar select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.e2e .toolbar input[type="search"] { width: 220px; max-width: 100%; }
.e2e .check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.e2e .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: 600; }
.e2e .chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.e2e .scroller { overflow: auto; max-height: 78vh; }
.e2e table.mx { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.e2e .mx th, .e2e .mx td { padding: 0; }
.e2e .mx thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 500; }
.e2e .mx .name { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); min-width: var(--nw, 340px); max-width: var(--nw, 340px); }
.e2e .mx .name { text-align: left; }
.e2e .mx thead .name { z-index: 4; text-align: left; padding: 8px 12px; vertical-align: bottom; }
.e2e .mx .rh { width: var(--cw, 30px); min-width: var(--cw, 30px); text-align: center; vertical-align: bottom; padding: 6px 0; cursor: pointer; }
.e2e .mx .rh .d { font-family: var(--display); font-weight: 600; font-size: 12px; display: block; writing-mode: vertical-rl; transform: rotate(180deg); margin: 0 auto 4px; white-space: nowrap; }
.e2e .mx .rh .r { display: block; width: 18px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.e2e .mx .rh .r i { display: block; height: 100%; background: var(--pass); }
.e2e .mx .rh a { color: var(--fg); display: block; text-decoration: none; }
.e2e .mx .rh a:hover .d { color: var(--accent); }
.e2e .mx tbody tr.t:hover .name, .e2e .mx tbody tr.t:hover td { background: var(--surface-2); }
.e2e .mx tbody tr.t .name { padding: 4px 12px; cursor: pointer; }
.e2e .mx .ttl { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2e .mx .tid { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.e2e .mx .tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.e2e .mx .tags .pill { font-size: 10px; padding: 0 5px; }
.e2e .mx td.c { text-align: center; border-bottom: 1px solid var(--cell-line); height: 34px; }
.e2e .mx .rh.ds, .e2e .mx td.c.ds { border-left: 1px solid var(--line, var(--cell-line)); }
.e2e .cell { display: inline-block; position: relative; width: 18px; height: 18px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; vertical-align: middle; }
/* Passed only on Playwright's in-run retry: green cell with an amber corner. */

.e2e .cell.P { background: var(--pass); }
.e2e .cell.F { background: var(--fail); }
.e2e .cell.B { background: var(--bug); }
.e2e .cell.R { background: var(--recovered); }
.e2e .cell.S { background: repeating-linear-gradient(135deg, var(--skip) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--skip); }
.e2e .cell.N { background: transparent; box-shadow: inset 0 0 0 1px var(--cell-line); cursor: default; }
.e2e .cell.P.rt { background: linear-gradient(225deg, var(--recovered) 0 40%, var(--pass) 40%); }
.e2e .cell.sel { outline: 2px solid var(--fg); outline-offset: 1px; }
.e2e .mx tr.g th { position: sticky; left: 0; z-index: 2; text-align: left; background: var(--surface-2); padding: 7px 12px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); cursor: pointer; font-weight: 600; }
.e2e .mx tr.g td { background: var(--surface-2); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.e2e .mx tr.g .gtxt { display: flex; align-items: center; gap: 8px; }
.e2e .mx tr.g .caret { display: inline-block; width: 10px; transition: transform .15s; }
.e2e .mx tr.g[aria-expanded="false"] .caret { transform: rotate(-90deg); }
.e2e .mx tfoot th, .e2e .mx tfoot td { position: sticky; bottom: 0; z-index: 3; background: var(--surface); border-top: 2px solid var(--line); }
.e2e .mx tfoot .name { z-index: 4; padding: 8px 12px; }
.e2e .mx tfoot .name b { display: block; font-size: 13px; }
.e2e .mx tfoot .name span { font-size: 11px; color: var(--muted); font-weight: 400; }
.e2e .mx td.tot-c { text-align: center; font-family: var(--display); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.e2e .mx td.tot-c.has { color: var(--fail); }
.e2e .mx td.tot-c.rt { color: var(--recovered); }
/* Incident runs: hatched column, dimmed cells. */
.e2e .mx th.rh.inc { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--fail) 14%, var(--surface)) 0 4px, var(--surface) 4px 8px); }
.e2e .mx th.rh.inc .d { color: var(--fail); }
.e2e .mx td.c.inc { background: color-mix(in srgb, var(--fail) 5%, transparent); }
.e2e .mx td.c.inc .cell { opacity: .45; }
.e2e .pill.inc { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
.e2e .mx tfoot tr.tot-rt th, .e2e .mx tfoot tr.tot-rt td { bottom: 0; border-top: 1px solid var(--cell-line); }
.e2e .mx tfoot th, .e2e .mx tfoot td { height: 46px; box-sizing: border-box; }
.e2e .mx tfoot .name { padding-block: 4px; }
.e2e .mx tfoot tr:first-child th, .e2e .mx tfoot tr:first-child td { bottom: 46px; }
.e2e .foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }

/* tooltip */
.e2e #tip { position: fixed; z-index: 30; pointer-events: none; max-width: 360px; background: var(--fg); color: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); }
.e2e #tip .e { font-family: var(--mono); font-size: 11px; opacity: .85; margin-top: 4px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* drawer */
.e2e #scrim { position: fixed; inset: 0; background: rgba(10, 16, 22, .35); z-index: 40; }
.e2e #drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 41; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); }
.e2e #drawer header { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.e2e #drawer .x { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); border: 0; background: var(--surface-2); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.e2e #drawer .body { overflow: auto; padding: 16px 20px 24px; display: grid; gap: 18px; align-content: start; }
.e2e .kv { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.e2e .strip { display: flex; flex-wrap: wrap; gap: 3px; }
.e2e .strip .cell { width: 14px; height: 14px; border-radius: 3px; }
.e2e .hist { display: grid; gap: 8px; }
.e2e .hist .h { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.e2e .hist .h.cur { border-color: var(--accent); }
.e2e .hist .hh { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.e2e .err { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; margin: 0; }
.e2e .btn { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer; justify-self: start; }
.e2e .btn:hover { background: var(--accent); color: var(--surface); }
.e2e .folder-health { max-height: 520px; overflow: auto; }
.e2e #durChart { width: 100%; height: 190px; display: block; }
.e2e #durChart text { fill: var(--muted); font-size: 10px; font-family: var(--body); }
.e2e #durChart .grid { stroke: var(--cell-line); stroke-width: 1; }
.e2e .hstrip { display: flex; gap: 2px; margin-top: 5px; }
.e2e .hstrip i { width: 9px; height: 12px; border-radius: 2px; background: var(--surface-2); }
.e2e .hstrip i.g { background: var(--pass); }
.e2e .hstrip i.y { background: color-mix(in srgb, var(--pass) 45%, var(--recovered)); }
.e2e .hstrip i.o { background: var(--bug); }
.e2e .hstrip i.r { background: var(--fail); }
.e2e .hstrip i.x { background: repeating-linear-gradient(135deg, var(--skip) 0 2px, transparent 2px 4px); }
.e2e .cause-tests { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.e2e .note { border-left: 3px solid var(--bug); padding: 6px 10px; background: color-mix(in srgb, var(--bug) 8%, transparent); border-radius: 0 8px 8px 0; font-size: 13px; }

@media (max-width: 860px) {
  .e2e .summary { grid-template-columns: 1fr; }
  .e2e .mx .name { min-width: 210px; max-width: 210px; }
  .e2e .counts { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .e2e, .e2e * { transition: none !important; } }

/* Inside api-health's layout: no page padding of its own; run-type switch and data info on one line. */
.e2e { padding: 0; max-width: none; }
.e2e .e2e-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.e2e .e2e-bar .meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
