/* ScaffInspect app styles. Hi-vis brand to match scaffinspect.com; large touch targets for site use. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("inter-latin.woff2") format("woff2");
}
:root {
  --bg: #f2f3f5; --card: #fff; --ink: #14181f; --ink-2: #374151; --muted: #6b7280; --line: #e3e6ea; --line-2: #d3d8de;
  --hivis: #f5b700; --hivis-ink: #14181f; --hivis-soft: #fff6d6; --dark: #14181f;
  --link: #8a5a00;
  --good: #1a7a3c; --good-bg: #e4f5ea; --warn: #8a5a00; --warn-bg: #fff4d1; --bad: #b3261e; --bad-bg: #fde8e6;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 24, 31, .05), 0 6px 20px rgba(20, 24, 31, .05);
  --focus: 0 0 0 3px rgba(245, 183, 0, .45);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #181d24; --ink: #eef1f5; --ink-2: #c9cfd7; --muted: #9aa5b4; --line: #262d37; --line-2: #313a46;
    --hivis-soft: #3a2f0a; --link: #f5c542;
    --good: #6fd08c; --good-bg: #16301f; --warn: #f5c542; --warn-bg: #352a0c; --bad: #ff8a80; --bad-bg: #3a1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 2px; }
main { max-width: 880px; margin: 0 auto; padding: 20px 16px 32px; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.02em; margin: .3em 0 .5em; font-weight: 800; }
h2 { font-size: 1.1rem; letter-spacing: -0.01em; margin: 1.6em 0 .6em; font-weight: 700; }
h3 { font-size: 1rem; margin: 1em 0 .4em; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mt { margin-top: 12px; }

/* Header */
.top { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.hazard { height: 5px; background: repeating-linear-gradient(135deg, var(--hivis) 0 14px, var(--dark) 14px 28px); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; margin-right: auto; }
.brand b { color: var(--hivis); font-weight: 800; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topnav { display: flex; gap: 4px; }
.topnav a { display: flex; align-items: center; gap: 7px; color: #c9cfd7; text-decoration: none; font-weight: 600; font-size: .93rem; padding: 8px 12px; border-radius: 10px; }
.topnav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topnav a.active { background: rgba(245, 183, 0, .16); color: var(--hivis); }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; color: var(--muted); }
.logout button.link { display: flex; align-items: center; gap: 6px; color: #9aa5b4; padding: 8px 10px; border-radius: 10px; font-size: .9rem; font-weight: 500; }
.logout button.link:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* Bottom tab bar on phones */
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav { display: none; }
  .logout span { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--dark); border-top: 3px solid var(--hivis); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #9aa5b4; text-decoration: none; font-size: .72rem; font-weight: 600; padding: 6px 2px; border-radius: 10px; min-height: 48px; justify-content: center; }
  .tabbar a.active { color: var(--hivis); background: rgba(245, 183, 0, .12); }
  .tabbar .ico { width: 22px; height: 22px; }
  body.has-tabbar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.4rem; }
}

/* Cards, lists, facts */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin: 28px auto; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line); min-height: 60px; }
.row:first-child { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.row a { color: var(--ink); text-decoration: none; }
.row a:hover { text-decoration: underline; }
.row a.btn { color: var(--hivis-ink); text-decoration: none; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin: 0 0 16px; }
.facts dt { color: var(--muted); font-size: .92rem; } .facts dd { margin: 0; font-weight: 500; }
details.card > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); font-weight: 500; }
details.card[open] > summary::after { content: "–"; }
details.card[open] > summary { margin-bottom: 8px; }

/* Forms */
label { display: block; margin: 12px 0; font-weight: 600; font-size: .95rem; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 48px; font: inherit; font-weight: 400; color: var(--ink); background: var(--card); border: 1.5px solid var(--line-2); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--hivis); box-shadow: var(--focus); }
input[type="file"] { padding: 10px; background: var(--bg); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; background: var(--hivis); color: var(--hivis-ink); border: 0; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: 0 1px 0 rgba(0, 0, 0, .12); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .topnav a:focus-visible, .tabbar a:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .9rem; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; margin: 10px 0 28px; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--ink-2); filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }

/* Messages */
.flash, .banner { padding: 12px 16px; border-radius: 12px; margin: 0 0 14px; font-weight: 500; border: 1px solid transparent; }
.flash { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.flash.bad, .banner.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner a { color: inherit; font-weight: 700; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-right: 8px; white-space: nowrap; vertical-align: middle; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-bg); color: var(--good); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }

/* Dashboard counters */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font-size: .88rem; color: var(--muted); box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; color: var(--ink); letter-spacing: -0.02em; }
.stat.bad { border-left-color: var(--bad); } .stat.bad b { color: var(--bad); }
.stat.warn { border-left-color: var(--hivis); } .stat.warn b { color: var(--warn); }
.stat.good { border-left-color: var(--good); } .stat.good b { color: var(--good); }

/* Inspection checklist */
fieldset.check { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0; }
fieldset.check:first-of-type { border-top: 0; }
fieldset.check legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg label { position: relative; margin: 0; min-height: 50px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line-2); border-radius: 10px; cursor: pointer; font-weight: 700; background: var(--card); user-select: none; transition: background .12s, border-color .12s; }
.seg label:hover { border-color: var(--ink-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { box-shadow: var(--focus); }
.seg label:has(input:checked) { background: var(--good); color: #fff; border-color: var(--good); }
.seg label.d:has(input:checked) { background: var(--bad); color: #fff; border-color: var(--bad); }
.seg label:last-child:has(input:checked) { background: var(--muted); color: #fff; border-color: var(--muted); }
.note { margin-top: 8px; font-size: .92rem; min-height: 44px; padding: 9px 12px; }
.sigpad { display: block; width: 100%; height: 170px; background: #fff; border: 2px dashed var(--line-2); border-radius: 12px; touch-action: none; margin: 6px 0 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* Share link */
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow input { margin: 0; font-size: .9rem; min-width: 0; }
.copyrow .btn { flex: none; }
.sharebadge { font-size: .8rem; font-weight: 700; color: var(--hivis); border: 1px solid rgba(245, 183, 0, .45); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plan h2 { margin: 4px 0 0; } .plan form { margin-top: auto; } .plan .btn { width: 100%; }
.plan.featured { border: 2px solid var(--hivis); }
.price { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; margin: 0; } .price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; } }

/* Printable documents (always light) */
.doc { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.doc a { color: #111; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px solid #111; padding-bottom: 10px; margin-bottom: 14px; }
.doc-head .right { text-align: right; }
.doc .muted { color: #555; }
.outcome { font-weight: 800; font-size: 1.1rem; padding: 10px 14px; border-radius: 10px; }
.outcome.good { background: #e4f5ea; color: #1a7a3c; } .outcome.warn { background: #fff4d1; color: #7a4d00; } .outcome.bad { background: #fde8e6; color: #b3261e; }
.doc-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc-table th, .doc-table td { border: 1px solid #ccc; padding: 8px 10px; vertical-align: top; text-align: left; }
.doc-table th { width: 34%; background: #f3f4f6; font-weight: 600; }
.checklist td.st { width: 80px; font-weight: 700; } .checklist td.st.bad { color: #b3261e; }
.sig { max-width: 240px; max-height: 90px; margin-top: 6px; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.doc-photos img { border-color: #ccc; }
.doc-foot { margin-top: 16px; border-top: 1px solid #ccc; padding-top: 8px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 12px 16px 32px; }
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .stat { padding: 10px; font-size: .78rem; } .stat b { font-size: 1.5rem; }
  .row { flex-wrap: wrap; }
  .doc { padding: 16px; } .doc-head { flex-direction: column; } .doc-head .right { text-align: left; } .sigs { grid-template-columns: 1fr; } .doc-table th { width: 40%; }
}

/* Public tag page */
.tagpage main { max-width: 560px; }
.tagstatus { border-radius: 16px; padding: 20px 22px; margin: 8px 0 18px; font-size: 1.05rem; box-shadow: var(--shadow); }
.tagstatus-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.tagstatus.good { background: #1a7a3c; color: #fff; } .tagstatus.warn { background: #f5b700; color: #14181f; }
.tagstatus.bad { background: #b3261e; color: #fff; } .tagstatus.muted { background: #5f6b78; color: #fff; }

/* Printable QR tag (about A6) */
.qrtag { width: 105mm; max-width: 100%; margin: 12px auto; background: #fff; color: #111; border: 2px solid #111; border-radius: 10px; overflow: hidden; }
.qrtag-stripe { height: 10px; background: repeating-linear-gradient(135deg, #f5b700 0 12px, #14181f 12px 24px); }
.qrtag-body { padding: 12px 14px; text-align: center; }
.qrtag-head { font-weight: 800; letter-spacing: 0.2em; font-size: 0.8rem; }
.qrtag-ref { font-size: 2.2rem; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.qrtag-site { font-size: 0.95rem; margin-bottom: 8px; }
.qrcode { width: 62mm; max-width: 80%; margin: 0 auto; } .qrcode svg { width: 100%; height: auto; display: block; }
.qrtag-scan { font-weight: 700; margin: 6px 0 8px; }
.qrtag-meta { font-size: 0.82rem; text-align: left; border-top: 1px solid #ccc; padding-top: 6px; }
.qrtag-warn { font-size: 0.72rem; margin-top: 8px; font-weight: 600; }

@media print {
  .qrtag { margin: 0; page-break-inside: avoid; }
  .top, .tabbar, .foot, .noprint, .flash, .banner { display: none !important; }
  body, body.has-tabbar { background: #fff; padding: 0; } main { max-width: none; padding: 0; }
  .doc { border: 0; padding: 0; box-shadow: none; }
  .doc-photos { grid-template-columns: repeat(4, 1fr); }
  tr, img { break-inside: avoid; }
}
