/*
 * A calm surface with one voice: greys that lean a little towards the AchieveDXP teal, hairline
 * borders, and depth from small shadows. The structure follows the Coss UI recipe (one base
 * radius, quiet panels), not its components.
 *
 * Colour means something. Teal is the brand: the filled button, what is chosen, links and
 * focus. Green, red and amber are pass, fail and hold. A tag has its own hue, taken from its
 * name and kept away from the status colours, so the same tag looks the same everywhere.
 */
:root {
  --bg: #f6f9f8;
  --panel: #ffffff;
  --ink: #0f1a19;
  --muted: #5d6a68;
  --line: #e1e8e6;
  --pass: #047857;
  --pass-bg: #ecfdf5;
  --pass-fill: #10b981;
  --fail-fill: #ef4444;
  --skip-fill: #f59e0b;
  --fail: #b91c1c;
  --fail-bg: #fef2f2;
  --skip: #b45309;
  --skip-bg: #fffbeb;
  --vendor: #6d28d9;
  --vendor-bg: #f5f3ff;
  --accent: #0f766e;
  --on-accent: #ffffff;
  --primary: #0f766e;
  --on-primary: #ffffff;
  --rail: #ecf1f0;
  --rail-ink: #5d6a68;
  --tag-bg-l: 0.955; --tag-line-l: 0.87; --tag-ink-l: 0.42;
  --radius: 10px;
  --shadow-xs: 0 1px 2px rgba(8, 30, 28, 0.06);
  --shadow-sm: 0 1px 2px rgba(8, 30, 28, 0.05), 0 2px 6px rgba(8, 30, 28, 0.05);
  color-scheme: light;
}

/* Dark values, applied when the system asks for dark and no theme was chosen, or when dark
   was chosen outright. The two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1413; --panel: #141b1a; --ink: #f0f5f4; --muted: #93a19e; --line: #25302e;
    --pass: #34d399; --pass-bg: #0f2a20; --fail: #f87171; --fail-bg: #2e1616;
    --pass-fill: #34d399; --fail-fill: #f87171; --skip-fill: #fbbf24;
    --skip: #fbbf24; --skip-bg: #2b2210; --vendor: #a78bfa; --vendor-bg: #221a38;
    --accent: #2dd4bf; --on-accent: #04201d; --primary: #2dd4bf; --on-primary: #04201d;
    --rail: #080c0b; --rail-ink: #93a19e;
    --tag-bg-l: 0.27; --tag-line-l: 0.37; --tag-ink-l: 0.85;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0e1413; --panel: #141b1a; --ink: #f0f5f4; --muted: #93a19e; --line: #25302e;
    --pass: #34d399; --pass-bg: #0f2a20; --fail: #f87171; --fail-bg: #2e1616;
    --pass-fill: #34d399; --fail-fill: #f87171; --skip-fill: #fbbf24;
    --skip: #fbbf24; --skip-bg: #2b2210; --vendor: #a78bfa; --vendor-bg: #221a38;
    --accent: #2dd4bf; --on-accent: #04201d; --primary: #2dd4bf; --on-primary: #04201d;
    --rail: #080c0b; --rail-ink: #93a19e;
    --tag-bg-l: 0.27; --tag-line-l: 0.37; --tag-ink-l: 0.85;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

/* The faces: Geist for reading and Geist Mono for names, references and code. Both are kept
   beside this file (fonts/, with their licences), so nothing is fetched from anywhere. */
@font-face { font-family: "Geist"; src: url("fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
/* Controls do not take the page's face unless told to. */
button, input, select, textarea { font-family: inherit; }

/* The list a select opens is drawn by the browser from the select's own background. A select
   with a see-through background opens a white list, whatever the theme, so the choices carry
   their own colours. */
select option, select optgroup { background-color: var(--panel); color: var(--ink); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.masthead {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 24px clamp(16px, 2vw, 40px); background: var(--panel); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.masthead h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.runpicker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.runpicker select {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 13px; max-width: 340px;
}

/* The whole window: tables and panels take the room, and the gutter grows a little with it. */
main { padding: 24px clamp(16px, 2vw, 40px) 64px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.tile .n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile.pass .n { color: var(--pass); }
.tile.fail .n { color: var(--fail); }
.tile.skip .n { color: var(--skip); }

.filters { display: flex; gap: 12px; align-items: center; margin: 24px 0 12px; flex-wrap: wrap; }
#search {
  flex: 1 1 280px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 14px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.group { margin-top: 22px; }
.group h2 {
  font-size: 13px; font-weight: 650; color: var(--ink);
  margin: 0 0 8px;
}

.test {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; overflow: hidden;
}
.test summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer;
  list-style: none;
}
.test summary::-webkit-details-marker { display: none; }
.test .title { flex: 1; min-width: 0; }
.test .title b { font-weight: 550; }
.test .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dur { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.badge {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.passed { color: var(--pass); background: var(--pass-bg); }
.badge.failed, .badge.timedOut { color: var(--fail); background: var(--fail-bg); }
.badge.skipped { color: var(--skip); background: var(--skip-bg); }
.badge.kind { color: var(--vendor); background: var(--vendor-bg); }

.detail { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.detail h3 {
  font-size: 12px; color: var(--muted);
  margin: 14px 0 6px;
}
pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  overflow-x: auto; font-size: 12.5px; margin: 0; white-space: pre-wrap; word-break: break-word;
}
.attach { display: flex; gap: 8px; flex-wrap: wrap; }
.attach a {
  font-size: 12.5px; color: var(--accent); text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px;
}
.attach a:hover { text-decoration: underline; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
code { font-family: var(--font-mono); font-size: 0.92em; }

.badge.note { color: var(--accent); background: var(--vendor-bg); }
.notes { margin: 0; padding-left: 18px; font-size: 13px; }
.notes li { margin-bottom: 4px; }
.notes b { font-weight: 600; }

/* Neutral key:value chips — client, app. Grey in both themes so they never read as status. */
.tagchip {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 11.5px; line-height: 1.5;
  white-space: nowrap; margin-right: 6px;
}
.tagchip .k { font-size: 10px; opacity: 0.75; }
.sub .meta-text { color: var(--muted); }
#subtitle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 0; }

/* Shown only when the page is served by the Test Manager. */
.masthead .back { margin-left: 14px; font-size: 13px; font-weight: 400; color: var(--accent); text-decoration: none; }
.masthead .back:hover { text-decoration: underline; }

/* ---- Surface -----------------------------------------------------------------------------
   The finish shared by the run report and the Test Manager: panels sit a hair above the
   page, everything shares one radius, and headings are set a little tighter. */
h1, h2, h3, h4, h5 { letter-spacing: -0.02em; font-weight: 600; }
.masthead h1 { font-weight: 600; letter-spacing: -0.025em; }
.tile .n { font-weight: 600; letter-spacing: -0.035em; }
code, pre { font-family: var(--font-mono); }
pre { font-size: 12px; line-height: 1.6; }
.tile, .masthead + main .group > *, #search, .runpicker select { border-radius: var(--radius); }
.tile { box-shadow: var(--shadow-xs); }
.tile .n { font-variant-numeric: tabular-nums; }
.chip { transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
.chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* The run report's tiles say which is which with a band of the status colour. */
.tile { position: relative; overflow: hidden; }
.tile.pass, .tile.fail, .tile.skip { padding-top: 16px; }
.tile.pass::before, .tile.fail::before, .tile.skip::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.tile.pass::before { background: var(--pass-fill); }
.tile.fail::before { background: var(--fail-fill); }
.tile.skip::before { background: var(--skip-fill); }
