/* Field app for chimney & dryer vent work: high contrast for daylight, big touch targets,
   charcoal + brick palette. Light and dark follow the phone's setting. */
:root {
  --bg: #eef0f2; --surface: #ffffff; --sunk: #f4f6f7; --ink: #182028; --muted: #5a6670; --line: #d6dce0;
  --accent: #a33b22; --accent-ink: #ffffff; --accent-soft: #f7e7e2; --char: #1b232b;
  --ok: #23774a; --ok-soft: #e1f2e8; --warn: #95600c; --warn-soft: #fbefd9; --bad: #b42318; --bad-soft: #fde7e4;
  --info: #285e9c; --info-soft: #e3edf9;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418; --surface: #182027; --sunk: #131a20; --ink: #e6ebee; --muted: #93a1ab; --line: #29343c;
    --accent: #e27a57; --accent-ink: #1b0d07; --accent-soft: #3a2219; --char: #0b0f12;
    --ok: #5cc68b; --ok-soft: #15301f; --warn: #e5ae55; --warn-soft: #33270f; --bad: #f37a6d; --bad-soft: #3b1714;
    --info: #80b2ee; --info-soft: #172a40;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--char); color: #fff; padding: calc(var(--top) + 8px) var(--gr) 8px var(--gl); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: .03em; }
.logo-mark { width: 56px; height: 56px; border-radius: 13px; background: url("../icons/icon-192.png") center / cover no-repeat; flex: none; }
.logo-mark.sm { width: 28px; height: 28px; border-radius: 7px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; text-decoration: none;
  background: rgba(255,255,255,.1); color: #fff; white-space: nowrap; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: #5cc68b; }
.pill.busy i { background: #e5ae55; animation: pulse 1s infinite alternate; }
.pill.off i { background: #93a1ab; }
.pill.bad i { background: #f37a6d; }
@keyframes pulse { to { opacity: .35; } }
.main { padding: 12px var(--gr) calc(88px + var(--bot)) var(--gl); }
.wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px var(--gr) calc(4px + var(--bot)) var(--gl); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
body:not([data-mode="app"]) .topbar, body:not([data-mode="app"]) .tabs { display: none; }
body:not([data-mode="app"]) .main { padding-top: calc(var(--top) + 12px); }

/* ---------- type ---------- */
h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.05; margin: 2px 0 0; text-wrap: balance; letter-spacing: .005em; }
h2 { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0; }
h2 .muted { letter-spacing: 0; }
.h { font-family: var(--display); font-size: 24px; margin: 0; }
.pagehead { display: flex; flex-direction: column; gap: 2px; }
.pagehead .sub { color: var(--muted); font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 600; text-decoration: none; font-size: 14px; margin-left: -4px; }
.back svg { width: 18px; height: 18px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 700; } .center { text-align: center; } .pad { padding: 16px; }
.lead { margin: 0; font-size: 15.5px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .05em; }
.tbad { color: var(--bad); font-weight: 600; }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sechead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; border-top: 1px solid var(--line); background: none; width: 100%;
  text-align: left; color: inherit; text-decoration: none; min-height: 56px; cursor: pointer; }
.row:first-child { border-top: 0; }
a.row:active, button.row:active { background: var(--sunk); }
@media (hover: hover) { a.row:hover, button.row:hover { background: var(--sunk); } }
div.row { cursor: default; }
.grow { flex: 1; min-width: 0; }
.t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2 { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wraptext { white-space: normal; overflow: visible; }
.rowend { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty.small { padding: 16px; font-size: 14px; }
.banner { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 14px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.okb { background: var(--ok-soft); color: var(--ok); }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn.light { color: #fff; }
.btn.sm { min-height: 36px; padding: 5px 11px; font-size: 13.5px; }
.btn.big { min-height: 52px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .55; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns.spread { justify-content: space-between; align-items: center; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px 0; cursor: pointer; text-align: left; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--muted); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.light { color: #fff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.input { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 16px; }
textarea.input { resize: vertical; line-height: 1.4; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input.color { padding: 4px; height: 46px; }
.input:disabled { background: var(--sunk); color: var(--muted); }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 10px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.checkline { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.checkline input { width: 22px; height: 22px; accent-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--sunk); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 8px 14px; min-height: 38px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.small button { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.seg.dark { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.seg.dark button { color: #c9d1d6; }
.seg.dark button[aria-pressed="true"] { background: #fff; color: #111; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 220px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.fab { position: fixed; right: calc(var(--gr) + 2px); bottom: calc(78px + var(--bot)); z-index: 25; display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 20px 0 16px; border-radius: 28px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
.fab svg { width: 24px; height: 24px; }

/* ---------- project ---------- */
.actionbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 70px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; }
.act svg { width: 26px; height: 26px; }
.act.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.phaseline { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.thumb { position: relative; display: block; padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--sunk); cursor: pointer; width: 100%; max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .2s; }
.thumb img.loaded { opacity: 1; }
.thumb.ghost { border: 1px dashed var(--line); background: none; cursor: default; }
.badge { position: absolute; left: 5px; top: 5px; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,.6); color: #fff; }
.badge.after { background: var(--ok); color: #fff; }
.badge.mk, .badge.up { left: auto; right: 5px; padding: 3px; display: inline-flex; }
.badge.up { top: auto; bottom: 5px; }
.badge svg { width: 13px; height: 13px; }
.cmp { display: flex; flex-direction: column; gap: 6px; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cmp-row.head span { font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.gpsline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); min-height: 24px; }
.gpsline svg { width: 16px; height: 16px; color: var(--ok); }
.matchbox { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: var(--info-soft); }
.matchrow { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.matchrow span { font-size: 13px; color: var(--muted); }
.matchrow.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tl { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.tl:first-of-type { border-top: 0; }
.tl-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tl-head a { color: var(--ink); text-decoration: none; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; margin: 0; padding: 14px; }
.kv dt { color: var(--muted); font-size: 13.5px; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- inspection ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--ok); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.levelbtn { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 11px 13px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.levelbtn b { font-family: var(--display); font-size: 19px; }
.levelbtn span { font-size: 12.5px; color: var(--muted); }
.levelbtn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.checksec { display: flex; flex-direction: column; gap: 6px; }
.checktitle { font-weight: 700; font-size: 14px; }
.citem { border-top: 1px solid var(--line); }
.citem:first-child { border-top: 0; }
.citem.attn { background: var(--bad-soft); }
.cmain { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 4px; flex-wrap: wrap; }
.clabel { flex: 1 1 180px; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; background: none; border: 0; padding: 8px; font-weight: 600; cursor: pointer; min-height: 44px; }
.pc { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; background: var(--sunk); border-radius: 6px; padding: 1px 6px; }
.pc svg { width: 13px; height: 13px; }
.stbtns { display: flex; gap: 4px; flex-wrap: wrap; }
.st { min-height: 40px; min-width: 52px; padding: 4px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.st[aria-pressed="true"] { color: #fff; background: var(--muted); border-color: var(--muted); }
.st.ok[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.st.bad[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); }
.st.warn[aria-pressed="true"] { background: var(--warn); border-color: var(--warn); }
@media (prefers-color-scheme: dark) { .st[aria-pressed="true"] { color: #10161a; } }
.cdetail { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.strip .thumb { width: 84px; flex: none; }
.addph { flex: none; width: 84px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1.5px dashed var(--muted); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.addph svg { width: 24px; height: 24px; }
.finding { align-items: flex-start; }
.finding .grow { display: flex; flex-direction: column; gap: 4px; }
.sigrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sigimg { max-height: 60px; max-width: 220px; background: #fff; border-radius: 6px; }
.sigpad { width: 100%; aspect-ratio: 3; background: #fff; border: 1.5px dashed var(--muted); border-radius: 10px; touch-action: none; }
.reportbar { display: flex; flex-direction: column; gap: 8px; }
.liblist { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.libitem { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.libitem b { font-weight: 600; } .libitem span:last-child { font-size: 13px; color: var(--muted); }

/* ---------- settings ---------- */
.logorow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logoimg { max-height: 64px; max-width: 180px; background: #fff; border-radius: 8px; padding: 4px; }
.logoph { width: 120px; height: 64px; border: 1.5px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.codebox { font-size: 30px; font-weight: 700; letter-spacing: .18em; color: var(--accent); }

/* ---------- sign in ---------- */
.auth { max-width: 440px; width: 100%; margin: 4vh auto 0; display: flex; flex-direction: column; gap: 18px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.brandname { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: .02em; }

/* ---------- sheets & toasts ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(8,12,15,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 620px; max-height: calc(100% - var(--top) - 24px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; }
.sheet.wide { max-width: 760px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px var(--gl); }
.sheet-head h3 { margin: 0; font-family: var(--display); font-size: 24px; }
.sheet-body { overflow: auto; padding: 6px var(--gr) 16px var(--gl); display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px var(--gr) calc(12px + var(--bot)) var(--gl); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; max-width: 220px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 18px; } .sheet-foot { padding-bottom: 14px; } }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .2s ease-out; } @keyframes up { from { transform: translateY(30px); opacity: .5; } } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--bot)); z-index: 90; max-width: min(92vw, 520px);
  background: var(--char); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; font-size: 14.5px; box-shadow: 0 6px 20px rgba(0,0,0,.3); text-align: center; }

/* ---------- photo viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 70; background: #050708; color: #fff; display: flex; flex-direction: column; }
.v-top { display: flex; align-items: center; gap: 8px; padding: calc(var(--top) + 6px) var(--gr) 6px var(--gl); }
.v-count { font-weight: 600; color: #c9d1d6; }
.chipbtn { border: 1px solid rgba(255,255,255,.3); background: none; color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.v-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.v-nav svg { width: 24px; height: 24px; } .v-nav.l { left: 10px; } .v-nav.r { right: 10px; }
.v-stamp { position: absolute; left: 10px; right: 10px; bottom: 8px; font-size: 12px; color: #e7ecef; text-shadow: 0 1px 3px #000; }
.v-panel { background: #12181d; padding: 12px var(--gr) calc(12px + var(--bot)) var(--gl); display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; }
.v-panel .input { background: #1c242b; border-color: #2b363e; color: #fff; }
.v-panel .seg { background: #1c242b; border-color: #2b363e; }
.v-panel .seg button { color: #aab6be; }
.v-panel .seg button[aria-pressed="true"] { background: #fff; color: #111; }
.v-panel .btn { background: #1c242b; border-color: #2b363e; color: #fff; }
.v-panel .btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.v-panel .btn.danger { color: #f37a6d; }
.v-item { font-weight: 700; color: #ffd8c9; }
.tagrow { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tag { flex: none; border: 1px solid #2b363e; background: #1c242b; color: #c9d1d6; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.tag.on { background: #fff; color: #111; border-color: #fff; }

/* ---------- markup ---------- */
.markup { position: fixed; inset: 0; z-index: 80; background: #050708; color: #fff; display: flex; flex-direction: column; }
.m-top { display: flex; align-items: center; gap: 4px; padding: calc(var(--top) + 6px) var(--gr) 6px var(--gl); }
.m-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; }
.m-stage canvas { max-width: 100%; max-height: 100%; touch-action: none; }
.m-text { position: absolute; width: 220px; min-height: 42px; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--accent); background: #fff; color: #111; font-size: 16px; }
.m-tools { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 10px var(--gr) calc(12px + var(--bot)) var(--gl); background: #12181d; }
.swatches { display: flex; gap: 10px; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.sw[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #050708 inset; }
.m-stampt { display: flex; gap: 8px; align-items: center; font-size: 14px; color: #c9d1d6; }
.m-stampt input { width: 20px; height: 20px; accent-color: var(--accent); }

@media (max-width: 460px) {
  h1 { font-size: 27px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; } .grid3 .f:first-child { grid-column: 1 / -1; }
  .act span { font-size: 12px; }
  .kv { grid-template-columns: 76px 1fr; }
}

/* ---------- photo-section inspection ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chiptog { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left; }
.chiptog[aria-pressed="true"], .chiptog.picked { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.coverrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.covimg { width: 120px; }
.psec { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.psec-head { display: flex; align-items: center; gap: 6px; }
.titlein { font-family: var(--display); font-weight: 700; font-size: 20px; text-transform: uppercase; letter-spacing: .03em; border-color: transparent; background: var(--sunk); }
.psec-tools { display: flex; flex: none; }
.psec-tools .iconbtn { width: 38px; height: 38px; font-size: 13px; }
.addph.sq { width: 100%; height: auto; aspect-ratio: 1; }
.qrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.qrow span { flex: 1 1 200px; }
.card .seg button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }
.yn button[data-yn="deficiencies"][data-v="yes"][aria-pressed="true"], .yn button[data-yn="meets_standards"][data-v="no"][aria-pressed="true"] { background: var(--bad); color: #fff; }
.yn button[data-yn="deficiencies"][data-v="no"][aria-pressed="true"], .yn button[data-yn="meets_standards"][data-v="yes"][aria-pressed="true"] { background: var(--ok); color: #fff; }
h2.mt { margin-top: 10px; }
.prop { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.prop-head { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prop-head + .tl { border-top: 0; }
.kindrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.req { color: var(--bad); font-weight: 800; }
.f.miss > label { color: var(--bad); }
.f.miss .input, .f.miss .chips { outline: 2.5px solid var(--bad); outline-offset: 2px; border-radius: 10px; }
.f.miss .chips { padding: 4px; }
.misslist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--bad); }
.tok { color: var(--ok); font-weight: 600; }
.catchips { margin-bottom: 4px; }
.catchips .chiptog { padding: 7px 11px; font-size: 13px; }

/* Choosing photos to share */
.pickbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pickgrid .thumb { outline: 0 solid transparent; transition: outline-width .1s; }
.pickgrid .thumb img { opacity: .55; }
.pickgrid .thumb img.loaded { opacity: .55; }
.pickgrid .thumb.picked img { opacity: 1; }
.pickgrid .thumb.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
.pickgrid .thumb::after { content: ""; position: absolute; bottom: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35); box-sizing: border-box; }
.pickgrid .thumb.picked::after { content: "✓"; background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); font: 700 14px/18px system-ui, sans-serif; text-align: center; }

/* "Already in the system" warning on New project */
.dupwarn { border: 1.5px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dupwarn > b { color: var(--warn); }
.duprow { display: flex; gap: 10px; align-items: center; background: var(--surface); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; }
.duprow .grow { flex: 1; min-width: 150px; }
.dupwhy { font-size: 12px; font-weight: 700; color: var(--warn); margin-top: 2px; }

/* Full-screen photo viewer: tap the photo to hide/show the buttons */
.v-stage img { cursor: zoom-in; }
.v-hint { display: none; position: absolute; top: calc(var(--top) + 10px); left: 50%; transform: translateX(-50%); font-size: 12px; color: #c9d1d6; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 999px; pointer-events: none; animation: hintfade 3s forwards; }
.viewer.full .v-top, .viewer.full .v-panel, .viewer.full .v-nav { display: none; }
.viewer.full .v-hint { display: block; }
.viewer.full .v-stage img { cursor: zoom-out; }
@keyframes hintfade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* Markup editor: photo uses the whole screen, buttons float over it */
.markup .m-stage { position: absolute; inset: 0; padding: 0; }
.markup .m-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,0)); padding-bottom: 18px; }
.markup .m-tools { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; background: rgba(18,24,29,.85); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dlbar { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; margin: 6px 0 10px; }
.dlbar > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.repicon { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; margin-right: 10px; }
.repicon svg { width: 18px; height: 18px; }
.covwarn { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600; }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.dayhead:first-child { margin-top: 4px; }
.dayhead .muted { font-weight: 600; font-size: 13px; }
/* Project picture (first photo of the job) */
.projpic { width: 58px; height: 58px; border-radius: 10px; overflow: hidden; flex: none; background: var(--sunk); margin-right: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.projpic img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.projpic img.loaded { opacity: 1; }
.projpic.none svg { width: 22px; height: 22px; opacity: .5; }
.projhero { display: block; width: 100%; height: 190px; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--sunk); margin: 6px 0 12px; cursor: pointer; }
.projhero img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.projhero img.loaded { opacity: 1; }
.projherowrap { position: relative; }
.projchange { position: absolute; right: 10px; bottom: 22px; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.5); }
.libbtns { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.lp_top { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.lp_top .input { flex: 1; }
/* Photo zoom */
.v-stage { touch-action: none; overflow: hidden; }
.v-stage img { transition: transform .08s linear; will-change: transform; }
.v-stage.zoomed .v-nav, .v-stage.zoomed .v-stamp { display: none; }
/* Company logo in the top bar */
.cobrand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tblogo { height: 34px; max-width: 120px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px 4px; opacity: 0; transition: opacity .2s; }
.tblogo.loaded { opacity: 1; }
.cobrand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Order numbers (screen only, never in the PDF) */
.picknum { position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--accent); color: #fff; font: 800 14px/26px system-ui, sans-serif; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.4); z-index: 2; }
.numbered .thumb[data-n]::after { content: attr(data-n); position: absolute; left: 5px; bottom: 5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: rgba(0,0,0,.65); color: #fff; font: 700 12px/22px system-ui, sans-serif; text-align: center; }
/* One box per comment */
.cmts { display: flex; flex-direction: column; gap: 8px; }
.cmt { display: flex; gap: 6px; align-items: flex-start; }
.cmt textarea { flex: 1; resize: none; overflow: hidden; min-height: 48px; line-height: 1.4; }
.cmt-tools { display: flex; flex-direction: column; gap: 4px; }
.cmt-tools .iconbtn { width: 34px; height: 34px; color: var(--muted); }
.cmt-tools [data-cstar] { color: var(--accent); font-size: 17px; }
/* Recently deleted */
.trashph { display: flex; flex-direction: column; gap: 4px; }
.trashph .thumb { cursor: default; opacity: .75; }
.trashph .btn { width: 100%; }
.nocust { color: var(--warn); font-weight: 600; }

/* Date fields: iPhone/iPad Safari centers them and lets them grow wider than other fields */
input.input[type="date"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 100%; min-width: 0; text-align: left; min-height: 46px; height: 46px; box-sizing: border-box; line-height: normal; }
input.input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input.input[type="date"]::-webkit-datetime-edit { padding: 0; }

/* ---------- Office: schedule, visits, due for service ---------- */
.row-between { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 12px; }
.cnt { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 18px; }
.weekbar { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; }
.weekdays { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; min-width: 0; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: none; border-radius: 10px; padding: 6px 0 4px; cursor: pointer; color: var(--ink); min-width: 0; }
.wday .wd { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.wday .wn { font-size: 18px; font-weight: 700; line-height: 1.2; }
.wday .wdots { height: 10px; font-size: 14px; line-height: 8px; color: var(--accent); letter-spacing: 1px; }
.wday.today .wn { color: var(--accent); }
.wday.sel { background: var(--accent); }
.wday.sel .wd, .wday.sel .wn, .wday.sel .wdots { color: var(--accent-ink); }
.dayhead2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dayhead2 b { font-size: 17px; }
.monthjump { position: relative; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.monthjump input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; -webkit-appearance: none; appearance: none; }
.techchips { margin-top: -4px; }
.visit { align-items: flex-start; text-align: left; cursor: pointer; }
.vtime { display: flex; flex-direction: column; min-width: 74px; font-size: 14px; }
.vtime span { color: var(--muted); font-size: 12.5px; }
.vstat { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.st-confirmed .vstat { background: var(--accent-soft); color: var(--accent); }
.st-completed .vstat { background: var(--ok-soft); color: var(--ok); }
.st-canceled, .st-no_show { opacity: .6; }
.st-canceled .t1 { text-decoration: line-through; }
.st-no_show .vstat { background: var(--bad-soft); color: var(--bad); }
.rep { color: var(--accent); font-weight: 700; }
.due { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.due + .due { margin-top: 8px; }
.list .due { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.list .due:first-child { border-top: 0; }
.duemain { border: 0; background: none; text-align: left; padding: 0; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.duewhen { color: var(--ink); }
.due.late .duewhen, b.late { color: var(--bad); }
.duebtns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.duebtns .btn { text-decoration: none; min-height: 38px; padding: 6px 14px; }
.statusbar { display: flex; gap: 6px; flex-wrap: wrap; }
.svclist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.svcrow { display: flex; align-items: center; gap: 8px; }
.pricein { display: inline-flex; align-items: center; gap: 4px; }
.pricein .input { width: 96px; }
.svctotal { font-weight: 700; text-align: right; margin-top: 4px; }
.svctotal:empty { display: none; }
.vacts { margin-top: 6px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.remprev { padding: 10px 12px; border-radius: 10px; background: var(--sunk); font-size: 14px; line-height: 1.4; }
.svedit { display: grid; grid-template-columns: 1fr auto auto 44px; gap: 8px; align-items: center; }
@media (max-width: 560px) { .svedit { grid-template-columns: 1fr auto 44px; } .svedit select { grid-column: 1 / 3; grid-row: 2; } }
input.input[type="time"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; text-align: left; min-height: 46px; height: 46px; line-height: normal; }
input.input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }

/* ---------- Billing: estimates and invoices ---------- */
.moneycards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mc { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.mcv { font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcs { font-size: 12.5px; color: var(--muted); }
.mc.late .mcv { color: var(--bad); }
@media (max-width: 420px) { .mcv { font-size: 16px; } .mc { padding: 9px 10px; } }
.doc { text-decoration: none; color: inherit; }
.docamt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }
.dst { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.dst.st-sent, .dst.st-partly-paid { background: var(--accent-soft); color: var(--accent); }
.dst.st-paid, .dst.st-accepted { background: var(--ok-soft); color: var(--ok); }
.dst.st-overdue, .dst.st-declined { background: var(--bad-soft); color: var(--bad); }
.dst.st-void { text-decoration: line-through; }
.pagehead .sub .dst { margin-right: 6px; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.itop { display: flex; gap: 6px; align-items: center; }
.itop .input { font-weight: 600; }
.input.small { min-height: 38px; font-size: 14px; padding: 7px 10px; }
.inums { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inums label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.inums label > .input { width: 68px; }
.inums .pricein .input { width: 100px; }
.iamt { margin-left: auto; font-size: 15px; }
.totals { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.totals > div { display: flex; justify-content: space-between; font-size: 15px; }
.totals > div span { color: var(--muted); }
.totals .grand { font-size: 17px; padding-top: 6px; border-top: 1px solid var(--line); }
.totals .grand span { color: var(--ink); font-weight: 700; }
.btn.wide-left { width: 100%; justify-content: flex-start; text-align: left; }
.pclist { margin-top: 8px; max-height: 50vh; overflow: auto; }
.t1.bad { color: var(--bad); }
h2 .late { color: var(--bad); text-transform: none; letter-spacing: 0; }
.tab span { white-space: nowrap; }
@media (max-width: 380px) { .tab { font-size: 10.5px; } }

/* ---------- Schedule: month view ---------- */
.calview { align-self: flex-start; }
.monthcal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.mhead { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px; }
.mhead b { font-size: 16px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.mdow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.mday { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 64px; padding: 4px 3px; border: 1px solid transparent; border-radius: 8px; background: var(--sunk); color: var(--ink); cursor: pointer; text-align: left; min-width: 0; overflow: hidden; }
.mday.other { opacity: .45; }
.mday .mn { font-size: 13px; font-weight: 700; padding-left: 2px; }
.mday.today .mn { color: var(--accent); }
.mday.sel { border-color: var(--accent); background: var(--accent-soft); }
.mvis { display: block; font-size: 11px; line-height: 1.25; padding: 1px 4px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvis.st-completed { background: var(--ok); color: #fff; }
.mvis.st-no_show { background: var(--bad); color: #fff; }
.mmore { font-size: 10.5px; color: var(--muted); padding-left: 2px; }
.mdots { display: none; color: var(--accent); font-size: 14px; line-height: 8px; letter-spacing: 1px; padding-left: 2px; }
/* phones: dots instead of names */
@media (max-width: 560px) { .mday { min-height: 48px; align-items: center; } .mvis, .mmore { display: none; } .mdots { display: block; } .mday .mn { padding-left: 0; } }
