/* Roofline Walk - a field tool. Designed at 390 px first; desktop is a centred
 * two-column variant (checklist left, live report right). Chrome is monochrome;
 * colour appears only on statuses and severities. */
:root {
  --paper: #ffffff;
  --paper-2: #f4f4f2;
  --ink: #101010;
  --ink-2: #3c3c3c;
  --muted: #5d5d5d;
  --line: #d4d4d0;
  --line-strong: #101010;
  --focus: #1a56db;
  --pass: #17803f;
  --pass-bg: #e3f5e8;
  --fail: #c41e1e;
  --fail-bg: #fde4e2;
  --na: #6b6b6b;
  --na-bg: #ececea;
  --urgent: #a51010;
  --high: #d35400;
  --medium: #b88400;
  --low: #55626d;
  --top-h: 56px;
  --bb-h: 64px;
  --r: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #121212;
  --paper-2: #1c1c1c;
  --ink: #f3f3f1;
  --ink-2: #d2d2cf;
  --muted: #a6a6a2;
  --line: #3a3a38;
  --line-strong: #f3f3f1;
  --focus: #7aa7ff;
  --pass: #4cc47a;
  --pass-bg: #163a23;
  --fail: #ff6b63;
  --fail-bg: #45191a;
  --na: #b0b0ad;
  --na-bg: #2a2a29;
  --urgent: #ff6b63;
  --high: #ff9f4a;
  --medium: #f1c24b;
  --low: #a9b6c1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.45 var(--font);
  padding-bottom: calc(var(--bb-h) + env(safe-area-inset-bottom));
}
body.no-bar { padding-bottom: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px; background: var(--paper); border-bottom: 2px solid var(--line-strong);
}
.brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 4px; cursor: pointer; min-height: 48px; }
.brand .mark { width: 28px; height: 28px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.session { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); text-decoration: none; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip.strong { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }
.chip.icon { width: 40px; justify-content: center; padding: 0; font-size: 18px; }
#back { display: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--line-strong);
  background: var(--paper); font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { border-color: var(--line); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--fail); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* home */
.home { max-width: 760px; margin: 0 auto; padding: 8px 16px 32px; }
.hero h1 { font-size: 30px; line-height: 1.12; letter-spacing: -.02em; margin: 18px 0 10px; }
.lede { color: var(--ink-2); margin: 0; }
.t-pass { color: var(--pass); } .t-fail { color: var(--fail); } .t-na { color: var(--na); }
.tpl-cards { display: grid; gap: 12px; }
.tpl-card {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; width: 100%;
  padding: 16px; border: 2px solid var(--line-strong); border-radius: var(--r); background: var(--paper); cursor: pointer; min-height: 96px;
}
.tpl-card .tc-name { font-weight: 800; font-size: 19px; }
.tpl-card .tc-meta { font-family: var(--mono); font-size: 13px; color: var(--muted); align-self: start; text-align: right; white-space: pre-line; }
.tpl-card .tc-blurb { grid-column: 1 / -1; color: var(--ink-2); font-size: 15px; }
.tpl-card:active { transform: translateY(1px); }
.ex-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-btn { flex: 1 1 160px; min-height: 52px; border-radius: 12px; border: 2px dashed var(--line-strong); background: var(--paper-2); font-weight: 650; cursor: pointer; padding: 8px 12px; }
.walks-head { display: flex; align-items: baseline; justify-content: space-between; }
.walk-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.walk-row { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.walk-open { flex: 1; text-align: left; background: none; border: 0; padding: 10px 12px; cursor: pointer; min-height: 60px; }
.walk-open .wr-title { font-weight: 700; display: block; }
.walk-open .wr-meta { font-size: 13px; color: var(--muted); }
.wr-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--na-bg); margin-top: 6px; }
.wr-bar i { display: block; }

/* walk */
.walk { max-width: 1240px; margin: 0 auto; }
.col-check { padding: 0 12px 24px; }
.walk-title { padding: 6px 4px 10px; }
.walk-title h2 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: -.01em; }
.walk-title .eyebrow { margin: 10px 0 2px; }
.overall { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.obar { flex: 1; height: 10px; background: var(--na-bg); border-radius: 5px; overflow: hidden; }
.obar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s; }

.cover-box { border: 2px solid var(--line-strong); border-radius: var(--r); margin: 6px 0 12px; }
.cover-box summary { min-height: 52px; display: flex; align-items: center; padding: 0 14px; font-weight: 700; cursor: pointer; }
.cover-grid { display: grid; gap: 10px; padding: 0 14px 14px; }
.cover-grid label, .cover-extra label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cover-grid input, .cover-grid select {
  min-height: 48px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--paper);
  font-size: 17px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink);
}
.cover-extra { display: grid; gap: 10px; }

.safety { border-left: 6px solid var(--ink); background: var(--paper-2); padding: 10px 12px; border-radius: 0 12px 12px 0; font-size: 15px; margin-bottom: 12px; }
.safety b { display: block; margin-bottom: 4px; }
.safety ul { margin: 0; padding-left: 18px; }
.before-box { border: 2px dashed var(--line-strong); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 15px; }

.filters { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--line-strong); border-radius: 12px; overflow: hidden; margin: 6px 0 10px; }
.seg { min-height: 48px; border: 0; background: var(--paper); font-weight: 650; cursor: pointer; }
.seg + .seg { border-left: 2px solid var(--line-strong); }
.seg.on { background: var(--ink); color: var(--paper); }

/* sections with sticky headers */
.sec { margin: 0 0 18px; }
.sec-head {
  position: sticky; top: var(--top-h); z-index: 10; background: var(--paper);
  padding: 10px 4px 8px; border-bottom: 2px solid var(--line-strong);
}
.sec-head .sh-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec-head h3 { margin: 0; font-size: 18px; }
.sec-head .sh-code { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-right: 6px; }
.sec-head .sh-count { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.sbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--na-bg); margin-top: 6px; }
.sbar i { display: block; height: 100%; }
.sbar .p, .wr-bar .p { background: var(--pass); }
.sbar .f, .wr-bar .f { background: var(--fail); }
.sbar .n, .wr-bar .n { background: var(--na); }
.sec-intro { font-size: 14px; color: var(--muted); margin: 8px 4px 4px; }

/* item card */
.item { border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; background: var(--paper); }
.item[data-s="pass"] { border-color: var(--pass); box-shadow: inset 6px 0 0 var(--pass); }
.item[data-s="fail"] { border-color: var(--fail); box-shadow: inset 6px 0 0 var(--fail); }
.item[data-s="na"] { border-color: var(--na); box-shadow: inset 6px 0 0 var(--na); }
.item.drag { outline: 3px dashed var(--focus); outline-offset: 2px; }
.it-top { display: flex; gap: 8px; align-items: flex-start; }
.it-id { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; min-width: 34px; }
.it-label { flex: 1; margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.it-info { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); font-weight: 800; cursor: pointer; }
.it-info[aria-expanded="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.guide { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); display: grid; gap: 6px; }
.guide p { margin: 0; }
.guide b { color: var(--ink); }
.prev { margin: 8px 0 0; font-size: 14px; padding: 6px 10px; border-radius: 8px; background: var(--paper-2); }
.tri { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.tri button {
  min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper);
  font-weight: 800; font-size: 16px; cursor: pointer; letter-spacing: .01em;
}
.tri button[data-set="pass"][aria-pressed="true"] { background: var(--pass); border-color: var(--pass); color: #fff; }
.tri button[data-set="fail"][aria-pressed="true"] { background: var(--fail); border-color: var(--fail); color: #fff; }
.tri button[data-set="na"][aria-pressed="true"] { background: var(--na); border-color: var(--na); color: #fff; }
.evidence { margin-top: 10px; display: grid; gap: 8px; }
.note {
  width: 100%; min-height: 48px; resize: vertical; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--paper); font-size: 16px;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 14px; overflow: hidden; border: 1.5px solid var(--line); background: var(--paper-2); padding: 0; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.72); color: #fff; font-size: 15px; line-height: 26px; cursor: pointer; }
.thumb .cloud { position: absolute; left: 4px; bottom: 3px; font-size: 11px; color: #fff; text-shadow: 0 0 3px #000; }
.add-photo {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; min-width: 72px; padding: 0 14px;
  border-radius: 14px; border: 2px dashed var(--line-strong); cursor: pointer; font-weight: 700; font-size: 15px;
}
.add-photo input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-hint { font-size: 13px; color: var(--muted); }
.end-actions { margin: 20px 0 8px; }

/* report column */
.col-report { padding: 8px 16px 32px; border-top: 2px solid var(--line-strong); }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.report-head h2 { margin: 12px 0; font-size: 22px; }
.pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line-strong); font-weight: 800; font-size: 14px; }
.pill.act_now { background: var(--fail); border-color: var(--fail); color: #fff; }
.pill.repair_soon { background: var(--high); border-color: var(--high); color: #fff; }
.pill.monitor { background: var(--medium); border-color: var(--medium); color: #111; }
.pill.sound { background: var(--pass); border-color: var(--pass); color: #fff; }
.cover-view { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; border: 2px solid var(--line-strong); border-radius: var(--r); padding: 12px; font-size: 15px; }
.cover-view div span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.cover-view .wide { grid-column: 1 / -1; }
.sum-bars { margin: 14px 0; display: grid; gap: 8px; }
.sum-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 14px; }
.sum-row .sbar { grid-column: 1 / -1; margin: 0; height: 10px; }
.sum-row span:last-child { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.ai-box { border: 2px solid var(--line-strong); border-radius: var(--r); padding: 12px; margin: 14px 0; }
.ai-box h3 { margin: 0 0 4px; font-size: 18px; }
.run-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.run-row .btn { flex: 1 1 200px; }
.meter { margin: 8px 0 0; color: var(--ink-2); }
.gate { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--paper-2); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.progress { margin-top: 10px; border-top: 1.5px solid var(--line); padding-top: 8px; }
.pg-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; }
.pg-steps { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: 14px; }
.pg-steps li { color: var(--muted); padding-left: 22px; position: relative; }
.pg-steps li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.pg-steps li.done { color: var(--ink); }
.pg-steps li.done::before { background: var(--ink); border-color: var(--ink); }
.pg-steps li.now { color: var(--ink); font-weight: 700; }
.pg-steps li.now::before { border-color: var(--ink); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.35); } }
.partial, .recon { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.partial { background: var(--fail-bg); }
.recon { border: 2px dashed var(--line-strong); }
.recon b, .partial b { display: block; margin-bottom: 4px; }
.recon ul { margin: 0; padding-left: 18px; }
.sev-group h4 { margin: 18px 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .06em; }
.sev-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sev-dot.urgent, .find.urgent { --sev: var(--urgent); }
.sev-dot.high, .find.high { --sev: var(--high); }
.sev-dot.medium, .find.medium { --sev: var(--medium); }
.sev-dot.low, .find.low { --sev: var(--low); }
.sev-dot { background: var(--sev); }
.find { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; border: 1.5px solid var(--line); border-left: 6px solid var(--sev); border-radius: 12px; padding: 10px; margin: 8px 0; }
.find.nophoto { grid-template-columns: minmax(0, 1fr); }
.find .f-ph { display: grid; gap: 6px; align-content: start; }
.find .f-ph .thumb { width: 72px; height: 72px; }
.find .f-ph .more { font-size: 12px; color: var(--muted); text-align: center; }
.find h5 { margin: 0; font-size: 15px; }
.find h5 .fid { font-family: var(--mono); color: var(--muted); font-weight: 500; margin-right: 4px; }
.find p { margin: 4px 0 0; font-size: 14px; }
.find .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 12px; border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.tag.na-tag { border-style: dashed; }
.find .lbl { font-weight: 700; }
.questions ol { padding-left: 20px; margin: 6px 0; }
.questions li { margin: 6px 0; font-size: 15px; }
.questions .to { font-weight: 800; text-transform: capitalize; }
.summary p { margin: 6px 0; }
.exports { margin-top: 18px; }
.exports h3 { margin: 0 0 8px; font-size: 18px; }
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.exports > .btn { margin-top: 8px; }
.empty-note { font-size: 14px; color: var(--muted); padding: 6px 0; }

/* phone bottom bar */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--bb-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper); border-top: 2px solid var(--line-strong);
}
.bottom-bar button { border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 0; font-size: 12px; font-weight: 700; cursor: pointer; min-height: 48px; }
.bottom-bar .bb-ico { font-size: 20px; line-height: 1.1; }
.bottom-bar button.on { background: var(--ink); color: var(--paper); }
.bottom-bar b { color: var(--fail); }
.bottom-bar button.on b { color: inherit; }
.jump-menu { position: fixed; left: 12px; right: 12px; bottom: calc(var(--bb-h) + 8px + env(safe-area-inset-bottom)); z-index: 45; background: var(--paper); border: 2px solid var(--line-strong); border-radius: var(--r); max-height: 60vh; overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.jump-menu ul { list-style: none; margin: 0; padding: 6px; }
.jump-menu button { width: 100%; min-height: 48px; display: flex; justify-content: space-between; align-items: center; border: 0; background: none; padding: 0 10px; font-weight: 650; cursor: pointer; border-radius: 10px; text-align: left; gap: 8px; }
.jump-menu button:hover { background: var(--paper-2); }

/* phone: report is a tab */
@media (max-width: 979px) {
  body.view-report .col-check { display: none; }
  body:not(.view-report) .col-report { display: none; }
  .col-report { border-top: 0; }
}
@media (min-width: 560px) {
  .cover-grid { grid-template-columns: 1fr 1fr; }
  .tpl-cards { grid-template-columns: 1fr; }
  .ex-grid { grid-template-columns: repeat(3, 1fr); }
}
/* desktop: centred two columns, report sticky on the right */
@media (min-width: 980px) {
  body { padding-bottom: 0; }
  .bottom-bar, .jump-menu { display: none !important; }
  #back { display: inline-flex; }
  .walk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 28px; padding: 0 20px; }
  .col-check { padding: 0 0 40px; }
  .col-report { position: sticky; top: calc(var(--top-h) + 12px); align-self: start; max-height: calc(100vh - var(--top-h) - 24px); overflow: auto; border: 2px solid var(--line-strong); border-radius: var(--r); margin-top: 12px; }
  .end-actions { display: none; }
  .tpl-cards { grid-template-columns: repeat(3, 1fr); }
  .ex-grid { grid-template-columns: 1fr 1fr; }
}

.foot { max-width: 760px; margin: 24px auto 0; padding: 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--bb-h) + 12px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 6px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--paper); padding: 12px 14px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: opacity .5s; }
.toast.err { background: var(--fail); color: #fff; }
.toast.warn { background: var(--medium); color: #111; }
.toast a { margin-left: 8px; font-weight: 800; color: inherit; }
.toast.gone { opacity: 0; }
@media (min-width: 980px) { .toasts { left: auto; width: 380px; bottom: 16px; } }

/* print: only the report */
.print-area { display: none; }
@media print {
  body { padding: 0; background: #fff; color: #000; }
  .top, #main, .bottom-bar, .jump-menu, .foot, .toasts { display: none !important; }
  .print-area { display: block !important; }
}
.note-cap { margin: -4px 0 0; font-size: 13px; }
