:root {
  color-scheme: light;
  --ink: #20273a;
  --muted: #667085;
  --line: #dfe4ee;
  --surface: #ffffff;
  --canvas: #f3f6fb;
  --success: #1e9b68;
  --success-soft: #dcf6e9;
  --failure: #cf4b5b;
  --failure-soft: #ffe4e7;
  --unknown: #a4acba;
  --accent: #5469e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-end;
  padding: 3.5rem max(1.5rem, calc((100% - 1160px) / 2));
  color: #fff;
  background: radial-gradient(circle at 80% 0%, #687bf2 0, transparent 31%), #252b4c;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.04em; }
h2 { font-size: 1.2rem; letter-spacing: -0.02em; }
.subtitle { margin-top: .35rem; color: #cbd3ff; }
.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .11em; }
.page-header .eyebrow { color: #aeb9ff; }

.report-status {
  flex: 0 0 auto;
  padding: .4rem .7rem;
  border: 1px solid #6571bf;
  border-radius: 999px;
  color: #e1e5ff;
  font-size: .85rem;
}

main { width: min(1160px, calc(100% - 3rem)); margin: 2rem auto 4rem; }
.panel, .overview > * { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 18px rgb(31 39 68 / 4%); }

.loader { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; padding: 1.25rem 1.4rem; }
.loader p { color: var(--muted); }
.load-controls, .filters { display: flex; gap: .65rem; align-items: end; flex-wrap: wrap; }
.file-button, #load-url { padding: .58rem .8rem; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.file-button input { display: none; }
.url-field { display: grid; gap: .2rem; color: var(--muted); font-size: .73rem; font-weight: 700; }
.url-field input, .filters input, .filters select { min-height: 2.35rem; padding: .42rem .55rem; border: 1px solid #cbd3e0; border-radius: 8px; background: #fff; color: var(--ink); }
.url-field input { width: min(310px, 45vw); }
.hint { width: 100%; font-size: .8rem; }
code { padding: .08rem .28rem; border-radius: 4px; background: #eef1f8; color: #40506e; }

.error-message { margin: 1rem 0; padding: .85rem 1rem; border: 1px solid #f5abb5; border-radius: 9px; color: #9e2231; background: var(--failure-soft); }
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .85rem; margin: 1.4rem 0; }
.overview > * { padding: 1rem; }
.overview .label { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.overview .value { margin-top: .2rem; font-size: 1.45rem; font-weight: 800; letter-spacing: -.04em; }
.overview .meta-value { font-size: 1rem; letter-spacing: 0; overflow-wrap: anywhere; }
.overview .success-value { color: var(--success); }
.overview .failure-value { color: var(--failure); }
.overview .neutral-value { color: #747d8d; }

.cases { padding: 1.25rem; }
.cases-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
#case-count { color: var(--muted); font-size: .88rem; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(31px, 1fr)); gap: 4px; }
.case {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.case:hover, .case:focus-visible { z-index: 1; outline: none; transform: scale(1.18); box-shadow: 0 0 0 2px var(--ink); }
.case.success { background: var(--success); }
.case.failed { background: var(--failure); }
.case.not-evaluated { background: #a4acba; }
.case.unknown { background: var(--unknown); }
.case[hidden] { display: none; }

dialog { width: min(680px, calc(100% - 2rem)); max-height: min(760px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 70px rgb(18 24 47 / 35%); }
dialog::backdrop { background: rgb(16 22 44 / 54%); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; padding: 1.4rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.close-button { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: #edf0f6; color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
#case-details { padding: 1.2rem 1.5rem 1.5rem; overflow: auto; }
.status { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.status.success { color: #08744a; background: var(--success-soft); }
.status.failed { color: #ad2736; background: var(--failure-soft); }
.status.not-evaluated { color: #515969; background: #e5e8ee; }
.detail-list { display: grid; grid-template-columns: 10rem 1fr; gap: .65rem 1rem; margin: 1.2rem 0; }
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
a { color: #3d50c8; }
details { margin-top: 1rem; }
pre { max-height: 260px; overflow: auto; padding: .85rem; border-radius: 8px; background: #252b3a; color: #e8edf9; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .page-header, .loader, .cases-header { align-items: stretch; flex-direction: column; }
  .overview { grid-template-columns: repeat(2, 1fr); }
  .url-field input { width: 100%; }
  .detail-list { grid-template-columns: 1fr; gap: .12rem; }
}
