/* DraftSafe Chimney app — one stylesheet, phone first.
   Brand: black #0E0C0C, burgundy #861A2B (hover #5E1220), cream #FAF8F5 / #F1ECE6,
   green #1F6B3A only for PASS / success. Same palette as draft-safe.com. */
:root {
  --black: #0E0C0C; --red: #861A2B; --red-dark: #5E1220; --pink: #E8A0AA;
  --cream: #FAF8F5; --cream2: #F1ECE6; --line: #E2DBD3; --text: #1D1A1A; --muted: #6B6461;
  --green: #1F6B3A; --amber: #8A5A00; --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--red); }
h1 { font-size: 1.5rem; line-height: 1.2; margin: .3em 0 .6em; }
h2 { font-size: 1.1rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1rem; margin: .2em 0 .5em; display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
p { margin: .5em 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* header */
.bar {
  background: var(--black); border-bottom: 3px solid var(--red);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px; position: sticky; top: 0; z-index: 10;
}
.brand img { display: block; height: 52px; width: auto; }
.bar-right { display: flex; align-items: center; gap: 12px; }
.state-pick select {
  background: #231f1f; color: #fff; border: 1px solid #4a4242; border-radius: 8px;
  padding: 8px 28px 8px 10px; font-size: .9rem; min-height: 40px;
}
.state-fixed { color: var(--pink); font-size: .9rem; font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--red); font: inherit; padding: 6px 2px; cursor: pointer; text-decoration: underline; min-height: 40px; }
.link-btn.light { color: #fff; text-decoration: none; font-size: .9rem; opacity: .85; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 12px 12px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; font-size: .95rem; }
.tabs a.on { color: var(--black); border-bottom-color: var(--red); }

main { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px calc(32px + var(--safe-b)); flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px 16px calc(16px + var(--safe-b)); }
.back { display: inline-block; text-decoration: none; padding: 6px 0; font-weight: 600; }
.hello { font-size: 1.1rem; margin: .2em 0 0; }

/* cards & forms */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; /* 16px stops iPhone zoom */
  padding: 11px 12px; border: 1px solid #CFC6BD; border-radius: 10px; background: #fff; color: var(--text); min-height: 46px;
}
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.radio { display: flex; align-items: center; gap: 10px; font-weight: 400; margin: 0; padding: 8px 0; min-height: 44px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.radio input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--red); }
.two, .three { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) {
  .two { grid-template-columns: 1fr 1fr; }
  .three { grid-template-columns: 2fr 1fr 1fr; }
}
.three { grid-template-columns: 1fr 80px 100px; }
.three .grow { grid-column: 1 / -1; }
@media (min-width: 520px) { .three .grow { grid-column: auto; } .three { grid-template-columns: 2fr 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: 2px solid var(--red); border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  min-height: 48px; width: 100%;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: #fff; color: var(--red); }
.btn.ghost:hover { background: var(--cream2); }
.btn.danger { background: #fff; color: #9b1c1c; border-color: #d9a3a3; }
.btn.small { width: auto; min-height: 40px; padding: 7px 14px; font-size: .9rem; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn.ghost.busy::after, .btn.danger.busy::after { border-color: rgba(134,26,43,.3); border-top-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; min-height: 0; }
.actions { display: flex; gap: 12px; margin: 16px 0; }
.actions .btn { flex: 1; }
.actions.wrap { flex-wrap: wrap; }
.actions.wrap .btn { flex: 1 1 200px; }
.note { background: #FFF6E5; border: 1px solid #F0D9A8; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.linkbox { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.linkbox input { font-size: 14px; background: var(--cream); }
h2.first { margin-top: 0; }
.legal { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .9rem; max-height: 320px; overflow-y: auto; margin: 0 0 12px; }

/* lists, badges, stats */
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-head h1, .row-head h2 { margin: .4em 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li > a { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; color: var(--text); text-decoration: none; }
.list > li > a:active { background: var(--cream2); }
.li-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.list.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list.plain li:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: var(--cream2); color: var(--muted); }
.b-active { background: #E3F1E8; color: var(--green); }
.b-awaiting_approval { background: #FFF0D6; color: var(--amber); }
.b-suspended { background: #FBE4E4; color: #9b1c1c; }
.b-ended { background: #E7E3DF; color: #4A4441; }
.b-invited, .b-profile_pending { background: #ECE8F6; color: #4B3F7A; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.hot { border-color: #F0C878; background: #FFF8EA; }
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.tbl th { background: var(--cream2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tiles { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--text); }
.tile span { color: var(--muted); font-size: .875rem; }
.tile.soon { border-left-color: #CFC6BD; opacity: .75; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 12px; padding-bottom: 4px; }
.chip { border: 1px solid #CFC6BD; background: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .9rem; white-space: nowrap; cursor: pointer; min-height: 40px; }
.chip.on { background: var(--black); color: #fff; border-color: var(--black); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .875rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.check { list-style: none; padding: 0; margin: 0 0 8px; }
.check li { padding: 6px 0; }
.check .yes { color: var(--green); font-weight: 600; }

/* onboarding steps */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 16px; }
.stepper a { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: .78rem; font-weight: 600; text-align: center; }
.stepper i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid #CFC6BD; font-size: .85rem; }
.stepper .done i { background: var(--green); border-color: var(--green); color: #fff; }
.stepper .on a { color: var(--black); }
.stepper .on i { border-color: var(--red); color: var(--red); }
.stepper .on.done i { color: #fff; }

/* toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--safe-b)); max-width: 520px; margin: 0 auto;
  background: var(--black); color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600;
  transform: translateY(150%); transition: transform .25s; z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.show { transform: none; }
.toast.ok { color: #fff; }
.toast.err { background: #8E1B1B; }

@media (min-width: 900px) {
  main { padding-top: 28px; }
  .brand img { height: 60px; }
}

/* ---------- inspection reports (app) ---------- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline input { margin-top: 0; flex: 1; }
.inline .btn { width: auto; }
.alert { display: block; background: #FFF8EA; border: 1px solid #F0C878; color: var(--text); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; text-decoration: none; font-weight: 600; }
.alert.bad { background: #FBE4E4; border-color: #E5A9A9; }
.warn { color: #9b1c1c; }
.ok { color: var(--green); font-weight: 600; }
.r-submitted { background: #FFF0D6; color: var(--amber); }
.r-returned { background: #FBE4E4; color: #9b1c1c; }
.r-approved { background: #E3F1E8; color: var(--green); }
.progress { position: sticky; top: 74px; z-index: 5; height: 6px; background: var(--cream2); border-radius: 99px; margin: 0 0 12px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--red); transition: width .2s; }
.done-card { border-color: #BFDCC8; }
.check-row { align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row input { margin-top: 2px; flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--red); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.seg button { border: 0; background: #fff; color: var(--red); font: inherit; font-weight: 700; min-height: 46px; cursor: pointer; }
.seg button.on { background: var(--red); color: #fff; }
.item { border-left: 4px solid #CFC6BD; }
.item.pass { border-left-color: var(--green); }
.item.fail { border-left-color: var(--red); }
.item.absent { opacity: .7; }
.item .li-top { align-items: flex-start; }
.item .link-btn.small { font-size: .8rem; min-height: 40px; padding: 4px 0; text-align: right; }
.pf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.pf button { min-height: 52px; border-radius: 10px; font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; background: #fff; }
.pf .pass { border: 2px solid var(--green); color: var(--green); }
.pf .fail { border: 2px solid var(--red); color: var(--red); }
.pf .pass.on { background: var(--green); color: #fff; }
.pf .fail.on { background: var(--red); color: #fff; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--cream2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(14,12,12,.75); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.addphoto { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 84px; min-width: 84px; padding: 0 12px; margin: 0;
  border: 2px dashed #CFC6BD; border-radius: 10px; color: var(--red); font-weight: 700; cursor: pointer; }
.addphoto input { position: absolute; inset: 0; opacity: 0; margin: 0; min-height: 0; cursor: pointer; }
.markup { position: fixed; inset: 0; z-index: 100; background: var(--black); color: #fff; display: flex; flex-direction: column; padding: 12px 12px calc(12px + var(--safe-b)); }
.markup p { margin: 4px 0 10px; text-align: center; }
.markup canvas { flex: 1; min-height: 0; width: 100%; object-fit: contain; touch-action: manipulation; }
.markup .actions { margin: 12px 0 0; }
.staff-panel h3 { margin: 0; }

/* ---------- the report itself (app + customer page) ---------- */
body.public main { max-width: 860px; padding-top: 0; }
/* ---------- inspection report (customer + staff): a formal document ---------- */
.rpt { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 12px; color: #1D1A1A; }
.rpt > section, .rpt > dl, .rpt > p { margin-left: 22px; margin-right: 22px; }
.rpt h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .09em; color: var(--red); margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #E8E1D9; }
.rpt h3 { font-size: 1rem; }
.rpt-head, .rpt-head.solo { background: var(--black); border-bottom: 4px solid var(--red); color: #fff; display: flex; gap: 18px; align-items: center; padding: 18px 22px; }
.rpt-head.solo { justify-content: center; border-radius: var(--radius); margin: 12px 0; }
.rpt-head img { height: 64px; width: auto; flex: none; }
.rpt-title h1 { font-size: 1.2rem; margin: 0 0 2px; letter-spacing: .01em; }
.rpt-title p { margin: 0; color: #D9CFC6; font-size: .85rem; }
.rpt-title .rpt-eyebrow { color: var(--pink); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 700; margin-bottom: 4px; }
.rpt-print { text-align: right; margin-top: 12px !important; margin-bottom: 0 !important; }
.rpt-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; margin: 14px 0 4px; }
@media (min-width: 700px) { .rpt-dl { grid-template-columns: repeat(3, 1fr); } }
.rpt-dl > div { padding: 8px 0; border-bottom: 1px solid #F0EAE3; min-width: 0; }
.rpt-dl dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.rpt-dl dd { margin: 2px 0 0; font-weight: 600; font-size: .93rem; overflow-wrap: anywhere; }
.rpt-sum { margin-top: 18px; padding: 16px 18px; background: #FBF9F6; border: 1px solid #E8E1D9; border-left: 5px solid var(--green); border-radius: 4px; }
.rpt-sum.st-repair { border-left-color: var(--amber); }
.rpt-sum.st-hazard { border-left-color: var(--red); }
.rpt-sum h2 { margin-top: 0; border: 0; padding: 0; }
.rpt-status { font-size: 1.25rem; font-weight: 800; margin: 0; color: var(--green); }
.st-repair .rpt-status { color: var(--amber); }
.st-hazard .rpt-status { color: var(--red); }
.rpt-overall { font-weight: 600; margin: .6em 0; }
.rpt-metrics { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid #E8E1D9; border-radius: 4px; background: #fff; margin: 12px 0; }
@media (min-width: 560px) { .rpt-metrics { grid-template-columns: repeat(4, 1fr); } }
.rpt-metrics > div { padding: 10px 12px; border-right: 1px solid #F0EAE3; border-bottom: 1px solid #F0EAE3; }
.rpt-metrics b { display: block; font-size: 1.4rem; line-height: 1.1; }
.rpt-metrics span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rpt-metrics .m-fail b { color: var(--red); }
.rpt-sum h3 { font-size: .9rem; margin: 12px 0 4px; }
.rpt-steps { padding-left: 22px; margin: .3em 0; }
.rpt-steps li { margin-bottom: 3px; }
.tag { display: inline-block; white-space: nowrap; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid currentColor; }
.tag.p-hazard { color: #fff; background: var(--red); border-color: var(--red); }
.tag.p-repair { color: var(--amber); background: #FFF7E8; }
.tag.p-maintenance { color: #44546A; background: #F1F4F8; }
.rpt-plan td:first-child { width: 28px; color: var(--muted); }
.rpt-plan td { vertical-align: top; }
@media (max-width: 559px) {
  .rpt-plan thead { display: none; }
  .rpt-plan, .rpt-plan tbody, .rpt-plan tr, .rpt-plan td { display: block; width: auto; }
  .rpt-plan tr { padding: 10px 12px; border-bottom: 1px solid #E8E1D9; }
  .rpt-plan tr:last-child { border-bottom: 0; }
  .rpt-plan td { border: 0; padding: 2px 0; }
  .rpt-plan td:first-child { display: none; }
  .rpt-plan td:nth-child(2) { font-weight: 700; }
  .rpt-plan td:nth-child(3) br { display: none; }
  .rpt-plan td:nth-child(3) .muted { margin-left: 6px; }
}
.rpt-find { border: 1px solid #E8E1D9; border-left: 4px solid var(--green); border-radius: 4px; padding: 12px 16px; margin: 0 0 14px; }
.rpt-find.fail { border-left-color: var(--amber); }
.rpt-find.fail.p-hazard { border-left-color: var(--red); }
.rpt-find.fail.p-maintenance { border-left-color: #6B7C93; }
.rpt-find h3 { margin: 4px 0 8px; }
.rpt-find-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rpt-ref { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0; }
.rpt-obs { margin: 0; }
.rpt-obs > div { display: grid; grid-template-columns: 1fr; gap: 0 14px; padding: 6px 0; border-top: 1px solid #F3EEE8; }
@media (min-width: 620px) { .rpt-obs > div { grid-template-columns: 150px 1fr; } }
.rpt-obs dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 2px; }
.rpt-obs dd { margin: 0; }
.rpt-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 4px; }
.rpt-photos figure { margin: 0; }
.rpt-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; display: block; background: var(--cream2); border: 1px solid #E8E1D9; }
.rpt-photos figcaption { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.rpt-tbl { margin-bottom: 12px; }
.rpt-tbl th:first-child { color: var(--text); }
.rpt-tbl td:last-child, .rpt-tbl th:last-child { text-align: right; width: 120px; }
.res { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.res::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.res.pass { color: var(--green); }
.res.fail { color: var(--red); }
.res.na { color: var(--muted); }
.rpt-scope p { margin: .5em 0; }
.rpt-note { padding: 4px 0 18px; }
.rpt-feedback { margin-top: 14px; }
.rpt-csia { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; margin-top: 12px !important; }
.rpt-csia img { width: 44px; height: 44px; }
@media print {
  @page { margin: 14mm 12mm; }
  .bar, .tabs, .foot, .back, .staff-panel, .rpt-print, #toast, .rpt-feedback, #estForm, .ai-card { display: none !important; }
  body, main { background: #fff; padding: 0; max-width: none; font-size: 11pt; }
  .rpt { border: 0; }
  .rpt-head, .tag, .res, .rpt-sum, .rpt-find { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rpt-find, .rpt-photos figure, .rpt-tbl, .rpt-plan tr, .rpt-sum { break-inside: avoid; }
  .rpt h2 { break-after: avoid; }
  .rpt-photos { grid-template-columns: repeat(3, 1fr); }
  .rpt-dl { grid-template-columns: repeat(3, 1fr); }
  .rpt-metrics { grid-template-columns: repeat(4, 1fr); }
  .rpt-obs > div { grid-template-columns: 150px 1fr; }
}
.health.ok { color: var(--green); margin: 0 0 12px; }
.search { margin: 4px 0 8px; }
.reopen { margin-top: 10px; }
.reopen summary { cursor: pointer; color: var(--red); font-weight: 600; padding: 8px 0; min-height: 40px; }

/* ---------- growth ---------- */
.num { text-align: right; white-space: nowrap; }
.est-line { display: grid; grid-template-columns: 1fr 70px; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.est-line select[name=item] { grid-column: 1 / -1; }
.est-line select[name=finding] { grid-column: 1 / 2; }
.est-line input, .est-line select { margin-top: 0; }
.est-line .link-btn { font-size: 1.4rem; }
.sigwrap canvas { width: 100%; height: 140px; border: 2px dashed #CFC6BD; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.checkbox-list { background: #FFF8EA; border: 1px solid #F0C878; border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.checkbox-list ul { margin: 4px 0; padding-left: 18px; }
.launch { margin-top: 10px; }
.launch summary { cursor: pointer; font-weight: 600; color: var(--red); min-height: 40px; padding: 8px 0; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rpt-est .tbl tfoot th { text-align: right; }
.rpt-est .tbl tfoot th:first-child { text-align: left; }
.err { color: #9b1c1c; }
.fb-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.stars { display: flex; gap: 4px; }
.stars label { margin: 0; cursor: pointer; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.stars span { font-size: 2rem; color: #CFC6BD; display: inline-block; min-width: 44px; text-align: center; }
.stars label:has(input:checked) span, .stars label:has(~ label input:checked) span { color: #C9962B; }
.stars input:focus-visible + span { outline: 2px solid var(--red); border-radius: 6px; }

/* ---------- AI (suggestions only; brand burgundy, never green/blue "magic") ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.spark { width: 16px; height: 16px; fill: currentColor; flex: none; vertical-align: -2px; }
.ai-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--red); background: #fff; color: var(--red); font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.ai-btn:hover { background: #FBF1F2; }
.ai-btn { white-space: nowrap; flex: none; }
.li-top:has(> .ai-btn) { flex-wrap: wrap; gap: 8px; }
.ai-btn.busy { opacity: .7; }
.ai-btn.busy .spark { animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { transform: scale(1.35) rotate(20deg); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .ai-btn.busy .spark { animation: none; } }
.ai-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-card { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: #FBF4F5; border: 1px solid #EBCFD3; border-left: 4px solid var(--red); }
.ai-card p { margin: .3em 0; }
.ai-card ul { margin: .4em 0; padding-left: 1.2em; }
.ai-card .btn { margin-top: 6px; }
.ai-fine { font-size: 12px; color: var(--muted); margin: .6em 0 0 !important; }
.ai-chip { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; color: #fff; background: var(--muted); }
.ai-chip.pass { background: var(--green); }
.ai-chip.fail { background: var(--red); }
.ai-score { font-size: 1.8rem; font-weight: 800; color: var(--red); line-height: 1; }
.ai-score small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ai-issues li { margin-bottom: 4px; }
.ai-ask { border-left: 4px solid var(--red); }
.ai-ask h3 { display: flex; align-items: center; gap: 8px; color: var(--red); margin-top: 0; }
.ai-ask h3 .spark { width: 20px; height: 20px; }
.ai-qs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.ai-q { border: 1px solid #CFC6BD; background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px; text-align: left; }
.ai-q:hover { border-color: var(--red); color: var(--red); }
.ai-answer { white-space: normal; }
/* voice typing */
textarea[data-mic] { padding-right: 52px; }
label:has(> textarea[data-mic]), .mic-wrap { position: relative; display: block; }
.mic { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--red); display: grid; place-items: center; cursor: pointer; padding: 0; }
.mic svg { width: 20px; height: 20px; fill: currentColor; }
.mic.on { background: var(--red); color: #fff; border-color: var(--red); animation: mic-on 1.2s ease-in-out infinite; }
@keyframes mic-on { 50% { box-shadow: 0 0 0 8px rgba(134, 26, 43, .15); } }
@media print { .ai-btn, .ai-card, .ai-row, .mic, .ai-ask { display: none !important; } }

/* ---------- report form: priority + system description ---------- */
.prio { border: 0; padding: 0; margin: 10px 0 4px; }
.prio legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.prio-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.prio-opt { margin: 0; position: relative; }
.prio-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.prio-opt span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 6px 8px; border: 1px solid #CFC6BD; border-radius: 8px; background: #fff; font-size: .82rem; font-weight: 700; cursor: pointer; line-height: 1.2; }
.prio-opt input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.prio-opt.p-hazard input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.prio-opt.p-repair input:checked + span { background: #FFF7E8; border-color: var(--amber); color: var(--amber); }
.prio-opt.p-maintenance input:checked + span { background: #F1F4F8; border-color: #6B7C93; color: #44546A; }
.sysdesc { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; margin: 12px 0; background: #FDFCFA; }
.sysdesc summary { cursor: pointer; font-weight: 700; padding: 12px 0; min-height: 44px; }

/* ---------- field: my jobs, team board ---------- */
.jobs-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 10px; margin: 12px 0 4px; box-shadow: 0 1px 0 rgba(14, 12, 12, .03); }
.jobs-card .row-head h2 { margin: 12px 0 4px; }
.job-day { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--red); margin: 14px 0 4px; }
.jobs { list-style: none; margin: 0; padding: 0; }
.job { display: grid; grid-template-columns: 74px 1fr; gap: 4px 12px; padding: 12px 0; border-top: 1px solid #F0EAE3; align-items: start; }
.jobs .job:first-child { border-top: 0; }
.job-time b { display: block; font-size: .95rem; white-space: nowrap; }
.job-time span { font-size: .75rem; color: var(--muted); }
.job-main { display: flex; flex-direction: column; min-width: 0; }
.job-main strong { font-size: 1rem; }
.job-type { font-size: .78rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wz, .rs { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: #FBF9F6; }
.rs-none { color: var(--amber); border-color: #F0C878; background: #FFF8EA; }
.rs-draft { color: #44546A; border-color: #C9D3E0; background: #F1F4F8; }
.rs-wait { color: var(--red); border-color: #EBCFD3; background: #FBF4F5; }
.rs-ret { color: #fff; background: var(--red); border-color: var(--red); }
.rs-ok { color: var(--green); border-color: #B9DCC3; background: #F1F9F3; }
.job-act { grid-column: 2; }
.job-act .btn { min-height: 40px; }
@media (min-width: 620px) { .job { grid-template-columns: 70px 1fr auto; } .job-act { grid-column: auto; align-self: center; } }
.board-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--text); background: var(--black); color: #fff; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; border-left: 4px solid var(--red); }
.board-link .muted { color: #D9CFC6; display: block; }
.board-link > span:last-child { font-size: 1.6rem; color: var(--pink); }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 12px; }
.day-nav .btn { min-width: 44px; font-size: 1.2rem; }
.person-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px 6px; margin: 12px 0; }
.person-day h2 { margin: 12px 0 2px; }
.person-day h2 a { color: var(--text); text-decoration: none; }
.skel { height: 64px; border-radius: 10px; margin: 10px 0; background: linear-gradient(90deg, #F2ECE5 25%, #FAF6F1 50%, #F2ECE5 75%); background-size: 200% 100%; animation: skel 1.2s infinite linear; }
@keyframes skel { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ---------- computer: side navigation ---------- */
@media (min-width: 1024px) {
  #app:has(> nav.tabs) { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  #app:has(> nav.tabs) > .bar, #app:has(> nav.tabs) > .offline-bar, #app:has(> nav.tabs) > .foot { grid-column: 1 / -1; }
  #app:has(> nav.tabs) > nav.tabs { grid-column: 1; grid-row: 2; flex-direction: column; gap: 2px; padding: 18px 12px; border-bottom: 0; border-right: 1px solid var(--line); overflow: visible; position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px); background: #fff; }
  #app:has(> nav.tabs) > nav.tabs a { border-bottom: 0; border-left: 3px solid transparent; border-radius: 8px; padding: 10px 14px; }
  #app:has(> nav.tabs) > nav.tabs a:hover { background: var(--cream); color: var(--text); }
  #app:has(> nav.tabs) > nav.tabs a.on { background: #FBF4F5; border-left-color: var(--red); color: var(--black); }
  #app:has(> nav.tabs) > main { grid-column: 2; grid-row: 2; max-width: 1000px; padding: 24px 32px 48px; margin: 0; }
  #app:has(> nav.tabs) .tiles { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- DraftSafe wallpaper: sign-in screens ---------- */
#app.is-wall { background: var(--black); }
.wall { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; overflow: hidden; color: #fff; }
.wall-bg, .hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.wall-art { width: 100%; height: 100%; display: block; }
.wall-inner { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: max(28px, env(safe-area-inset-top)) 18px 24px; display: flex; flex-direction: column; align-items: center; flex: 1; }
.wall-logo { width: 168px; height: auto; margin: 4vh 0 6px; filter: drop-shadow(0 10px 30px rgba(134, 26, 43, .45)); animation: wall-in .7s ease-out both; }
.wall-tag { margin: 0 0 22px; text-transform: uppercase; letter-spacing: .32em; font-size: .72rem; font-weight: 700; color: var(--pink); }
.wall-card { width: 100%; max-width: none; margin: 0; padding: 22px 20px 18px; flex: 0 0 auto; border-radius: 18px;
  background: rgba(250, 248, 245, .97); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08); animation: wall-in .7s .08s ease-out both; }
.wall-card h1 { font-size: 1.35rem; margin: 0 0 14px; }
.wall-card .card { background: none; border: 0; padding: 0; margin: 0; box-shadow: none; }
.wall-card .btn { width: 100%; min-height: 50px; font-size: 1.02rem; }
.wall-card .qr { display: block; margin: 10px auto; border-radius: 10px; }
.wall-note { color: #CFC6BD; text-align: center; font-size: .85rem; margin: 16px 0 0; }
.wall-card .wall-note { color: var(--muted); }
.wall-foot { position: relative; z-index: 1; color: #8F8580; font-size: .75rem; margin: 0 0 max(14px, env(safe-area-inset-bottom)); text-align: center; }
@keyframes wall-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wall-logo, .wall-card { animation: none; } }
@media (min-width: 1024px) { .wall-logo { width: 210px; margin-top: 8vh; } }
/* 6-digit code: one field drawn as six boxes */
.otp-label { font-weight: 600; }
.otp-input { font: 700 1.7rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; letter-spacing: .62em; text-indent: .62em; text-align: left; padding: 12px 0 12px 6px !important; height: 60px;
  background: repeating-linear-gradient(90deg, #fff 0 calc(100% / 6 - 6px), var(--cream) calc(100% / 6 - 6px) calc(100% / 6)) !important; border: 1px solid #CFC6BD; border-radius: 12px; width: 100%; max-width: 320px; display: block; margin: 8px 0 14px; }
.otp-input:focus { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- home: hero + launcher ("home screen") ---------- */
#app.is-home .tabs { display: none; }
@media (min-width: 1024px) { #app.is-home .tabs { display: flex; } }
.hero { position: relative; overflow: hidden; margin: -16px -16px 16px; color: #fff; background: var(--black); border-bottom: 3px solid var(--red); }
.hero-in { position: relative; z-index: 1; padding: 22px 18px 20px; }
.hero-date { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; font-weight: 700; color: var(--pink); }
.hero .hello { font-size: 1.65rem; font-weight: 800; line-height: 1.15; margin: 6px 0 2px; color: #fff; letter-spacing: -.01em; }
.hero-sub { margin: 0; color: #CFC6BD; font-size: .9rem; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 2px; }
.chip-h { display: inline-flex; align-items: center; min-height: 40px; gap: 6px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); color: #fff; text-decoration: none; font-size: .85rem; backdrop-filter: blur(6px); }
.chip-h b { font-size: 1rem; }
.launcher { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; margin-top: 20px; }
.tile.app { background: none; border: 0; padding: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; color: #fff; text-align: center; min-width: 0; }
.app-ic { position: relative; width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); transition: transform .15s ease, background .15s; }
.app-ic svg { width: 27px; height: 27px; color: #fff; }
.tile.app:first-child .app-ic { background: linear-gradient(160deg, #A62238, var(--red)); border-color: rgba(255, 255, 255, .25); }
.tile.app:hover .app-ic, .tile.app:focus-visible .app-ic { transform: translateY(-2px); background: linear-gradient(160deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .08)); }
.tile.app:focus-visible { outline: none; }
.tile.app:focus-visible .app-ic { outline: 2px solid var(--pink); outline-offset: 3px; }
.tile.app .app-label { color: #F2ECE6; font-size: .75rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.app-badge { position: absolute; top: -6px; right: -6px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: #E23B55; color: #fff; font-size: .72rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--black); }
@media (min-width: 560px) { .launcher { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1024px) {
  .hero { margin: 0 0 20px; border-radius: 18px; border-bottom: 0; }
  .hero-in { padding: 30px 30px 28px; }
  .hero .hello { font-size: 2rem; }
  .launcher { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
.attention h2 { margin-top: .6em; }
@media print { .hero { display: none; } }
