/* /quick/r/<id> — the stored browser quick-test run, styled as a LOOK-ALIKE of the per-capture report page
 * (#1274 S3 T4; owner decision 2026-10-24: "look-alike page now, real /c/ page later").
 *
 * Every rule below is COPIED from workers/results-page/src/results-template.html (the per-capture page) unless it says
 * otherwise; each block names its source section, so the S4 graduation to real /c/ captures can delete this file whole.
 * Don't extract shared files from the template: it is a bundled Worker surface. Rules are scoped under .qr (this
 * page's <main>) where the template's class names are generic. Tokens (--gray-*, --brand-*) come from
 * /shared/styles.css, as on the template. There is no dark theme: the per-capture page has none either.
 *
 * Tier TEXT colours are GENERATED (the region below; scripts/gen_quality_mirrors.py from quality_spec.json), the same
 * region the template carries. Thresholds are never here: view.js grades with the generated activities.js.
 */
:root {
  /* --- BEGIN GENERATED: quality_spec:text-colors (scripts/gen_quality_mirrors.py) --- */
          /* Do not edit by hand: edit src/wifi_monitor/quality_spec.json, then run scripts/gen_quality_mirrors.py. */
          --q-superior-text:#1e6091;--q-excellent-text:#1e6091;--q-good-text:#166534;--q-fair-text:#92400e;--q-impaired-text:#991b1b;--q-broken-text:#111827;
  /* --- END GENERATED: quality_spec:text-colors --- */
}

/* ── Page width: the template's .page (styles.css) minus its TOC sidebar column (232px + 32px gap). Ours. ── */
.qr.page { max-width: 1180px; }

/* ── Header (template "Header": .header, .header-left, .btn) ── */
.qr .header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.qr .header-left { min-width: 0; }
.qr .header-left h1 { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.qr .header-left .subtitle { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; margin-top: 4px; }
/* Ours (card K): the network identity line, in /quick/'s .net-line type (the apps' activity line), not a chip. */
.qr .net-line { margin-top: 4px; color: var(--gray-500); font: 500 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere; }
.qr .net-line:empty { display: none; }
.qr .btn { font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--gray-200); background: white;
    color: var(--gray-700); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.qr .btn:hover { background: var(--gray-100); border-color: var(--gray-300); }
.qr .btn[hidden] { display: none; }
/* Ours (card K): the ONE action row, between the identity line and the card: Copy shareable link (primary), Run it again,
 * a quiet Delete (red text, like /quick/'s "Your runs" delete), the raw JSON as a quiet link at the end. */
.qr .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.qr .act-del, .qr .act-link { font: inherit; font-size: 12px; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px; }
.qr .act-del { color: var(--q-impaired-text); }
.qr .act-del:disabled { color: var(--gray-400); cursor: default; }
.qr .act-link { color: var(--gray-500); font-weight: 500; margin-left: auto; }
.qr .act-del[hidden], .qr .act-link[hidden] { display: none; }
.qr .del-err { margin: -6px 0 14px; font-size: 13px; color: var(--q-impaired-text); }
.qr .del-err:empty { display: none; }
/* Ours: the one call to action gets the site's filled button colours (styles.css --brand-blue-strong, AA with white). */
.qr .btn.btn-primary { background: var(--brand-blue-strong); border-color: var(--brand-blue-strong); color: #fff; }
.qr .btn.btn-primary:hover { background: var(--brand-blue-strong-hover); border-color: var(--brand-blue-strong-hover); }

/* ── Loading / error (template "Loading / Error": .loading-container, .loading-spinner, .error-container) ── */
.qr .view-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 80px 20px;
    color: var(--gray-500); font-size: 14px; text-align: center; }
.qr .view-msg:empty { display: none; }
.qr .view-msg.loading::before { content: ""; width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: #009de0;
    border-radius: 50%; animation: qr-spin 0.8s linear infinite; }
@keyframes qr-spin { to { transform: rotate(360deg); } }

/* ── Cards (template "Redesigned summary sections": .card; "Summary Panels": .summary-panel-title) ── */
.qr .card { background: #fff; border: 1px solid var(--gray-200); border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 22px 24px; margin-bottom: 12px; }
.qr .summary-panel-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-400); margin-bottom: 14px; }

/* ── Hero (template "hero": .findings): the shared Lightning card (/shared/lightning-card.css, static mode; quick-polish
 * card F: it replaced the hero's emoji chips and the finished metro strip; card I dropped its "Overview" title) and the
 * findings. ── */
.qr .lc-box { margin-top: 2px; }
/* Ours: the "good for" answers as one line when the card script didn't load (view.js heroCard). */
.qr .lc-fallback { margin-top: 10px; font-size: .86rem; line-height: 1.5; color: var(--gray-700); }
.qr .findings { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 7px; max-width: 64ch; }
.qr .findings li { position: relative; padding-left: 18px; font-size: .86rem; line-height: 1.4; color: var(--gray-600); }
.qr .findings li::before { content: ''; position: absolute; left: 3px; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--gray-400); }

/* ── Stat tiles (template "fused cards + glyph": .fcard .k/.top/.n/.tier/.fdepth). Ours (quick-polish card I): two rows
 * (speed + jitter, then latency), each as many equal columns as it has tiles (.qs-n1..3), so a row of two has no hole.
 * Card K: compact (no sparklines, no helper lines; tighter padding and gaps), so the 2 × 3 grid reads at a glance. ── */
.qr .qs-row { display: grid; gap: 8px; }
.qr .qs-row.qs-n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qr .qs-row.qs-n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qr .qs-row.qs-n1 { grid-template-columns: minmax(0, 1fr); }
.qr .qs-row + .qs-row { margin-top: 8px; }
.qr .fcard { border: 1px solid var(--gray-200); border-radius: 10px; padding: 8px 12px 9px; }
.qr .fcard .k { font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-400); }
.qr .fcard .top { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 8px; margin-top: 1px; flex-wrap: wrap; }
.qr .fcard .n { font-size: 1.3rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.qr .fcard .n small { font-size: .7rem; color: var(--gray-400); font-weight: 600; }
.qr .fcard .tier { font-size: .6875rem; font-weight: 700; text-transform: uppercase; }
.qr .fcard .fdepth { font-size: .6rem; font-weight: 500; color: var(--gray-400); font-variant-numeric: tabular-nums; margin-top: 2px; }
/* Tier word colours: the template's `color: var(--q-<tier>-text)` (renderCards), as classes (view.js sets no inline style). */
.qr .tier-superior { color: var(--q-superior-text); }
.qr .tier-excellent { color: var(--q-excellent-text); }
.qr .tier-good { color: var(--q-good-text); }
.qr .tier-fair { color: var(--q-fair-text); }
.qr .tier-impaired { color: var(--q-impaired-text); }
.qr .tier-broken { color: var(--q-broken-text); }
/* Ours: the loaded-latency tiles carry their rise over idle in the tier slot; /quick/'s own rule (+100 ms or more
 * reads as bufferbloat) in the impaired text shade. */
.qr .fcard .tier.delta { color: var(--gray-500); text-transform: none; font-variant-numeric: tabular-nums; }
.qr .fcard .tier.delta.bad { color: var(--q-impaired-text); }

/* ── Video (template "video": .sechead, .vchip, .empty; the #section-hosted-video KPI tiles .kgrid/.ktile) ── */
.qr .sechead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qr .sechead .h { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-400); }
.qr .vchip { font-size: .7rem; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--gray-100); color: var(--gray-600); white-space: nowrap; }
/* The template hand-types these text shades; here they ride the generated vars above (same values today). */
.qr .vchip.bad { background: #fee2e2; color: var(--q-impaired-text); }
.qr .vchip.ok { background: #dcfce7; color: var(--q-good-text); }
.qr .vchip.warn { background: #fef3c7; color: var(--q-fair-text); }
.qr .empty { font-size: .8rem; color: var(--gray-400); font-style: italic; margin-top: 12px; }
.qr .kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.qr .ktile { border: 1px solid var(--gray-200); border-radius: 12px; padding: 12px 12px; min-height: 84px; }
.qr .ktile .k { font-size: .6rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--gray-400); display: flex; align-items: center; }
.qr .ktile .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; line-height: 1.05; color: var(--gray-900); }
.qr .ktile .v small { font-size: .7rem; font-weight: 600; color: var(--gray-400); }
.qr .ktile .sub { font-size: .6875rem; font-weight: 600; margin-top: 3px; color: var(--gray-500); }
.qr .cap { font-size: .66rem; color: var(--gray-400); margin-top: 12px; }

/* ── Details table (template "Protocol Stats Table": .proto-table; .proto-wrap from its phone rules) ── */
.qr .proto-wrap { overflow-x: auto; }
.qr .proto-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.qr .proto-table th { text-align: left; font-weight: 600; color: var(--gray-500); text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em;
    padding: 6px 12px; border-bottom: 1px solid var(--gray-200); width: 34%; vertical-align: top; }
.qr .proto-table td { padding: 6px 12px; border-bottom: 1px solid var(--gray-200); color: var(--gray-700); font-variant-numeric: tabular-nums; }
.qr .proto-table tr:last-child th, .qr .proto-table tr:last-child td { border-bottom: none; }

/* ── What a browser can't measure (ours: the /quick/ list, set in a template .card) ── */
.qr .cant ul { padding-left: 20px; color: var(--gray-700); font-size: 0.88rem; line-height: 1.6; }
.qr .cant p { margin-top: 12px; color: var(--gray-800); font-size: 0.9rem; }
.qr .cant a { color: var(--brand-blue-strong); font-weight: 600; }

/* ── Responsive (template "Responsive" + the phone rules and the fused-card grid steps) ── */
@media (max-width: 768px) {
    .qr.page { padding: 12px 16px 32px; }
    .qr .header { flex-direction: column; }
    .qr .header-left h1 { font-size: 1.25rem; }
}
@media (max-width: 520px) {
    .qr .card { padding: 16px; }
    /* Ours (card K): the compact tiles keep their 2 × 3 grid on a phone too, in smaller type (a label may wrap). */
    .qr .qs-row { gap: 6px; }
    .qr .qs-row + .qs-row { margin-top: 6px; }
    .qr .fcard { padding: 7px 8px 8px; }
    .qr .fcard .k { font-size: .56rem; letter-spacing: .03em; }
    .qr .fcard .n { font-size: 1.05rem; }
    .qr .fcard .n small { font-size: .62rem; }
    .qr .fcard .tier { font-size: .6rem; }
    /* Ours: the video tiles follow the stat tiles' rule (two columns, an odd last tile spans, no orphan). */
    .qr .kgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qr .kgrid > .ktile:last-child:nth-child(odd) { grid-column: 1 / -1; }
    /* Ours: on a phone each details label sits above its value instead of wrapping in a narrow column. */
    .qr .proto-table th, .qr .proto-table td { display: block; width: auto; }
    .qr .proto-table th { border-bottom: 0; padding: 8px 0 0; }
    .qr .proto-table td { padding: 2px 0 8px; }
}

/* Ours (quick-polish card H): the chart panels (panels.js). The width follows the card (Plotly's responsive); Download and upload sit side by side, stacked on a narrow screen. */
.qr .qp .summary-panel-title { margin-bottom: 10px; } /* a chart panel's title sits on its caption */
.qr .qp-cap { font-size: .8rem; line-height: 1.45; color: var(--gray-500); margin: -6px 0 12px; max-width: 72ch; }
.qr .qp-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.qr .qp-half { min-width: 0; }
.qr .qp-sub { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-500); }
.qr .qp-chart { min-width: 0; } /* its height: the figure's, set by panels.js before Plotly arrives (no jump) */
@media (max-width: 720px) {
    .qr .qp-pair { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* Ours (quick-polish card J): the Video pane's chart (video-chart.js), under its tiles; a Plotly chart since card K,
 * in the panels' look (its .qp-chart holds the figure's height while Plotly loads). */
.qr .vc { margin-top: 16px; }
.qr .vc .qp-sub { margin-bottom: 2px; }
.qr .vc .qp-cap { margin: 6px 0 0; }
