:root {
  --bg: #ffffff; --fg: #14202b; --muted: #4a5a68; --line: #c5cfd8; --card: #f4f7fa;
  --brand: #0b3d5c; --on-brand: #ffffff; --focus: #b35c00; --link: #0b4f7a;
  --pass: #0d5c2e; --pass-bg: #e3f4ea; --fail: #8f1d1d; --fail-bg: #fbe8e8; --pend: #4a5a68; --pend-bg: #eceff2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820; --fg: #e8eef3; --muted: #aab8c4; --line: #33424f; --card: #172330;
    --brand: #1d6a99; --on-brand: #ffffff; --focus: #ffb454; --link: #8fd0ff;
    --pass: #7fe0a4; --pass-bg: #12301f; --fail: #ffaaaa; --fail-bg: #3a1818; --pend: #b9c6d1; --pend-bg: #233140;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 46rem; margin: 0 auto; padding: 1rem; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.35rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: .75rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.bar { background: var(--brand); color: var(--on-brand); padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.bar h1 { margin: 0; font-size: 1.2rem; }
.net { margin: 0; font-size: .9rem; }
.foot { max-width: 46rem; margin: 2rem auto 1rem; padding: 0 1rem; color: var(--muted); font-size: .9rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn { min-height: 44px; min-width: 44px; padding: .5rem 1rem; border: 2px solid var(--brand); border-radius: .5rem; background: var(--brand); color: var(--on-brand); cursor: pointer; }
button.secondary, .btn.secondary { background: transparent; color: var(--fg); border-color: var(--line); }
button.danger { background: transparent; color: var(--fail); border-color: var(--fail); }
button[disabled] { opacity: .55; cursor: not-allowed; }
input[type="text"], input[type="number"], input[type="date"], select, textarea { width: 100%; min-height: 44px; padding: .5rem .75rem; border: 2px solid var(--line); border-radius: .5rem; background: var(--bg); }
label { display: block; font-weight: 600; margin: .5rem 0 .25rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 10rem; }
.row > button { flex: 0 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; margin: 0 0 1rem; }
fieldset.card { min-width: 0; }
legend { padding: 0 .25rem; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; padding: 0; list-style: none; }
.steps button { background: transparent; color: var(--fg); border-color: var(--line); }
.steps button[aria-current="step"], .steps a[aria-current="page"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.muted { color: var(--muted); font-size: .95rem; }
.basis { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; border: 1px solid var(--line); font-size: .85rem; }
.basis.ref { border-style: dashed; }
.result { margin: .5rem 0 0; padding: .5rem .75rem; border-radius: .5rem; font-weight: 600; }
.result.pass { color: var(--pass); background: var(--pass-bg); }
.result.fail { color: var(--fail); background: var(--fail-bg); }
.result.pending { color: var(--pend); background: var(--pend-bg); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.thumb { position: relative; }
.thumb img { width: 88px; height: 88px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--line); display: block; }
.thumb button { position: absolute; top: -8px; right: -8px; border-radius: 50%; padding: 0; width: 44px; height: 44px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
caption { text-align: left; font-weight: 600; padding-bottom: .5rem; }
.letterhead { border-bottom: 2px solid var(--line); margin-bottom: .5rem; }
.letterhead p { margin: 0 0 .25rem; }
.letterhead .org { font-size: 1.4rem; font-weight: 700; }
.sig { margin-top: 2rem; }
.radios { border: 0; padding: 0; margin: .75rem 0; min-width: 0; }
.radios legend { font-weight: 600; padding: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.radio-row.stack { flex-direction: column; }
.radio { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; }
.radio input { width: 1.4rem; height: 1.4rem; margin: 0; }
.radio label { margin: 0; font-weight: 400; }
.warn { margin: .5rem 0 0; padding: .5rem .75rem; border-radius: .5rem; background: var(--fail-bg); color: var(--fail); }
.good { margin: .5rem 0 0; padding: .5rem .75rem; border-radius: .5rem; background: var(--pass-bg); color: var(--pass); }
.stmt { white-space: pre-wrap; background: var(--bg); border: 1px dashed var(--line); border-radius: .5rem; padding: .75rem; }
dl.fields { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .25rem .75rem; margin: .5rem 0; }
dl.fields dt { font-weight: 600; }
dl.fields dd { margin: 0; }
.idcell { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print {
  dl.fields { grid-template-columns: 11rem 1fr; }
  .stmt { border-color: #000; }
  .warn, .good { background: none; color: #000; border: 1px solid #000; }
  .bar, .foot, .noprint, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; border-color: #999; }
  .letterhead { border-bottom-color: #000; }
  .letterhead .muted { color: #000; }
  @page { margin: 0.75in; }
  .result.pass, .result.fail, .result.pending { background: none; color: #000; border: 1px solid #000; }
}

/* photo markup */
.thumb .markup { position: static; width: auto; min-height: 44px; border-radius: .5rem; margin-top: .25rem; padding: 0 .5rem; font-size: .85rem; }
.thumb .badge { position: absolute; left: 4px; top: 4px; background: #000; color: #fff; border: 1px solid #fff; border-radius: .25rem; padding: 0 .35rem; font-size: .75rem; font-weight: 700; }
dialog.annot { width: min(96vw, 960px); max-height: 96vh; overflow: auto; padding: 1rem; background: var(--bg); color: var(--fg); border: 2px solid var(--line); border-radius: .75rem; }
dialog.annot::backdrop { background: rgba(0,0,0,.7); }
.annot-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.annot-tools [role=group] { display: flex; gap: .35rem; flex-wrap: wrap; }
.annot-tools button[aria-pressed=true] { outline: 3px solid var(--fg); outline-offset: 1px; }
.annot-stage { background: #000; border-radius: .5rem; overflow: hidden; }
.annot-canvas { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; margin: 0 auto; touch-action: none; cursor: crosshair; }
.swatch { min-width: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.swatch-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #000; box-shadow: 0 0 0 1px #fff; display: inline-block; }
.swatch-dot[data-c=red] { background: #ff3b30; } .swatch-dot[data-c=yellow] { background: #ffd60a; }
.swatch-dot[data-c=white] { background: #fff; } .swatch-dot[data-c=blue] { background: #0a84ff; }
.photolog { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.photo { margin: 0; break-inside: avoid; }
.photo img { width: 100%; height: auto; max-height: 360px; object-fit: contain; background: #000; border-radius: .5rem; display: block; }
.photo figcaption { font-size: .9rem; color: var(--muted); }
@media print { .photolog { grid-template-columns: repeat(2, 1fr); } }

/* history and quick capture */
.timeline { padding-left: 1.25rem; margin: .5rem 0; }
.timeline li { margin-bottom: .35rem; }
.geo { font-variant-numeric: tabular-nums; }

/* rules review sheet */
td.blank { min-width: 7rem; height: 3rem; border: 1px solid var(--line); }
@media print { td.blank { border-color: #000; } a { color: #000; } }

/* approachable polish */
.card { box-shadow: 0 1px 2px rgba(11, 61, 92, .08); }
@media (prefers-color-scheme: dark) { .card { box-shadow: none; } }
.card h3 { margin-bottom: .5rem; }
.card > h3:not(:first-child) { margin-top: 1.25rem; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
details.card > summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; min-height: 44px; display: flex; align-items: center; }
details.card[open] > summary { margin-bottom: .5rem; }
.welcome h2 { margin-top: 0; }
.welcome details { margin-top: .75rem; }
.welcome summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.welcome ol { padding-left: 1.25rem; margin: .5rem 0; }
.welcome li { margin-bottom: .35rem; }
input[type="file"] { width: 100%; padding: .25rem 0; }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: .75rem; padding: .5rem 1rem; border: 2px solid var(--line); border-radius: .5rem; background: transparent; color: var(--fg); font: inherit; cursor: pointer; }
ul.plain.stackrows li { flex-direction: column; align-items: flex-start; gap: .1rem; }
h2, h3 { text-wrap: balance; }
details.card > summary, .welcome summary { justify-content: space-between; gap: .75rem; list-style: none; }
details.card > summary::-webkit-details-marker, .welcome summary::-webkit-details-marker { display: none; }
details.card > summary::after, .welcome summary::after { content: ""; flex: 0 0 auto; width: .6rem; height: .6rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 .25rem .25rem 0; }
details[open] > summary::after { transform: rotate(-135deg); margin: .25rem .25rem 0 0; }
@media print { details.card > summary::after, .welcome summary::after { display: none; } }

.bar .logo { display: block; height: 1.9rem; width: auto; }
.nw { white-space: nowrap; }

/* landing */
body.landing .bar { display: none; }
.hero { background: #0b3d5c; color: #fff; border-radius: .75rem; padding: 2rem 1.25rem 2.25rem; text-align: center; margin: 1rem 0; }
.hero-mark { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.25rem 2rem; }
.hero-eye { width: min(240px, 60vw); height: auto; }
.hero-text { text-align: left; }
.hero h1 { margin: 0; line-height: 0; }
.hero-word { width: min(380px, 80vw); height: auto; }
.hero-tag { font-size: clamp(1.1rem, 4vw, 1.5rem); margin: .5rem 0 0; font-weight: 600; letter-spacing: .01em; }
.hero-sub { max-width: 34rem; margin: 1.5rem auto 1rem; font-size: 1.05rem; }
.hero .btn.hero-go { display: inline-block; background: #ffc20e; color: #0b3d5c; border-color: #ffc20e; font-weight: 800; font-size: 1.25rem; padding: .75rem 3rem; text-decoration: none; }
.hero .btn.hero-go:hover { background: #ffd24d; }
.hero a:focus-visible { outline-color: #fff; }
.hero-note { font-size: .9rem; opacity: .9; margin: 1rem 0 0; }
@media (max-width: 560px) { .hero-text { text-align: center; } }
.tablewrap { overflow-x: auto; margin: 1rem 0; }
tfoot th, tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
tbody th[scope="row"] { font-weight: 600; }
main:focus-visible { outline: none; }

/* Report options, cover letter, logo */
[hidden] { display: none !important; }
.report-logo { display: block; max-width: 100%; max-height: 80px; width: auto; height: auto; margin: 0 0 .5rem; }
.letter { break-after: page; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.letter .report-logo { max-height: 100px; margin-bottom: 1.25rem; }
.pre { white-space: pre-line; }
label.check { display: flex; gap: .5rem; align-items: center; min-height: 44px; font-weight: 400; }
label.check input { width: auto; flex: none; }
@media print { .letter { border-bottom: 0; } }

/* Site plot (SVG classes so light, dark and print follow the theme) */
.plot { display: block; width: 100%; max-width: 640px; height: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.plot-track { fill: none; stroke: var(--link); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.plot-start { fill: var(--pass); stroke: var(--fg); stroke-width: 1.5; }
.plot-end { fill: var(--fail); stroke: var(--fg); stroke-width: 1.5; }
.plot-pt { fill: var(--fail); stroke: var(--fg); stroke-width: 1.5; }
.plot-site { fill: var(--brand); stroke: var(--fg); stroke-width: 1.5; }
.plot-label { fill: var(--fg); font: 600 14px system-ui, sans-serif; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.plot-ui line, .plot-ui path { stroke: var(--fg); stroke-width: 2; fill: none; }
@media print { .plot { max-width: 100%; } .plot-track { stroke: #000; } }

/* photo full-size viewer */
.thumb .thumb-open { position: static; width: auto; height: auto; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: .5rem; background: none; display: block; cursor: zoom-in; }
.thumb .thumb-open:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.viewer-img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; object-fit: contain; }
a.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: .5rem; border: 1px solid var(--line); text-decoration: none; background: var(--card, var(--bg)); color: var(--fg); font-weight: 600; }
