/* Field app for chimney & dryer vent work: high contrast for daylight, big touch targets,
   charcoal + brick palette. Always light, with a white background (doesn't follow the phone's dark mode). */
:root {
  --bg: #ffffff; --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;
}
* { 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.warn { background: var(--warn-soft); color: var(--warn); }
.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(6, 1fr); gap: 6px; }
.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); }
.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-body > * { flex-shrink: 0; }   /* a tall form scrolls instead of squeezing lines on top of each other */
.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; }

@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-panel, .viewer.full #vToggle, .viewer.full #vFull { display: none; }
.viewer.full .v-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0)); }
.viewer.full .v-hint { top: auto; bottom: calc(var(--bot) + 14px); }
.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 { 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, .dst.st-balance-due, .dst.st-partly-paid { 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; }
.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; } }

/* ---------- Import customers ---------- */
.filepick { cursor: pointer; }
.mapgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mapgrid .f span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
@media (max-width: 560px) { .mapgrid { grid-template-columns: 1fr; } }
.impcounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.checkrow { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.checkrow input { width: 20px; height: 20px; }

.vtexts .btn { text-decoration: none; }

.okline { color: var(--ok); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.okline svg { width: 18px; height: 18px; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }

/* ---------- Route button, reports ---------- */
.routebtn { margin-left: auto; text-decoration: none; }
.routebtn svg { width: 16px; height: 16px; }
.repgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .repgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 170px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bar i { display: block; width: 70%; min-height: 2px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.bar .bv { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bar .bl { font-size: 12px; color: var(--muted); }
b.late { color: var(--bad); }

/* ---------- Online booking settings / requests ---------- */
.svedit { grid-template-areas: none; }
.svedit .svdesc { grid-column: 1 / -1; }
.svedit .svbook { grid-column: 1 / -1; font-size: 13.5px; color: var(--muted); }
.svedit + .svedit { border-top: 1px solid var(--line); padding-top: 10px; }
.linkbox { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); font-size: 13.5px; }
.linkbox .btn { text-decoration: none; }
.pilltag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--sunk); color: var(--muted); vertical-align: middle; }
.pilltag.new { background: var(--accent-soft); color: var(--accent); }

/* ---------- Estimate options / online approval ---------- */
.optbox { padding: 10px 12px; border-radius: 10px; background: var(--sunk); }
.optbox .itop { margin-top: 6px; }
.optsel { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.optsel select { width: auto; flex: 1; }
.totals .grand.chosen span::after { content: " ✓ chosen"; color: var(--ok); font-size: 13px; }
.approved { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); display: flex; flex-direction: column; gap: 4px; }
.approved b { display: inline-flex; gap: 6px; align-items: center; }
.approved svg { width: 18px; height: 18px; }
.sigimg { max-width: 260px; width: 100%; background: #fff; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; }

.pilltag.shared { background: var(--sunk); color: var(--muted); border: 1px solid var(--line); text-transform: none; font-weight: 600; }
/* ---------- Camera that stays open ---------- */
body.camopen { overflow: hidden; }
.camx { position: fixed; inset: 0; z-index: 9999; background: #000; color: #fff; display: flex; flex-direction: column; --tilt: 0deg; }
.camview { flex: 1; min-height: 0; min-width: 0; position: relative; overflow: hidden; background: #000; touch-action: none; }
.camx video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; transform: scale(var(--zoom, 1)); transition: transform .12s; }
.camx video.mirror { transform: scaleX(-1); }
.camzoom { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; padding: 4px; border-radius: 22px; background: rgba(0,0,0,.4); }
.camzoom:empty { display: none; }
.camz { min-width: 38px; height: 38px; padding: 0 6px; border-radius: 19px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 13px; font-weight: 700; }
.camz.on { background: rgba(0,0,0,.6); color: #f5c518; font-size: 14px; }

.camtop { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.camtitle { font-weight: 700; font-size: 15px; text-shadow: 0 1px 3px #000; }
.camtbtns { display: flex; gap: 10px; }
.camb { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; transform: rotate(var(--tilt)); transition: transform .25s; }
.camb svg { width: 22px; height: 22px; }
.camb.on { background: #f5c518; color: #000; }
.camb.camlight { width: auto; border-radius: 22px; padding: 0 14px 0 10px; display: inline-flex; gap: 6px; font-weight: 700; font-size: 14px; }
.cambar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 22px calc(env(safe-area-inset-bottom) + 18px); background: #000; }
.camthumb { justify-self: start; position: relative; width: 58px; height: 58px; border-radius: 10px; border: 2px solid rgba(255,255,255,.7); background: #222 center / cover no-repeat; color: #fff; font-size: 11px; line-height: 1.15; font-weight: 600; transform: rotate(var(--tilt)); transition: transform .25s; }
.camthumb.has .camnat { display: none; }
.camcount { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #c0392b; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.camshut { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; }
.camshut span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .08s; }
.camshut:active span { transform: scale(.88); }
.camdone { justify-self: end; border: 0; border-radius: 22px; background: #fff; color: #000; font-weight: 700; font-size: 16px; padding: 11px 20px; transform: rotate(var(--tilt)); transition: transform .25s; }
.camflash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camflash.go { animation: camflash .25s ease-out; }
@keyframes camflash { from { opacity: .7; } to { opacity: 0; } }
.cammsg { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); padding: 12px 18px; border-radius: 12px; font-weight: 600; }
/* Phone held sideways: picture fills the screen, buttons in a column on the right (like the iPhone camera) */
@media (orientation: landscape) and (max-height: 600px) {
  .camx { flex-direction: row; }
  .camtop { right: calc(124px + env(safe-area-inset-right)); padding-left: calc(env(safe-area-inset-left) + 14px); }
  .cambar { grid-template-columns: none; grid-template-rows: 1fr auto 1fr; justify-items: center; padding: 14px calc(env(safe-area-inset-right) + 18px) 14px 18px; }
  .camdone { grid-row: 1; justify-self: center; align-self: start; }
  .camshut { grid-row: 2; }
  .camthumb { grid-row: 3; justify-self: center; align-self: end; }
}
/* ---------- Open in another tab ---------- */
.elsewhere { position: fixed; inset: 0; z-index: 10000; background: rgba(15, 20, 25, .72); display: grid; place-items: center; padding: 16px; }
.elsewhere .card { max-width: 420px; width: 100%; text-align: center; padding: 24px 20px; }
.elsewhere h2 { margin: 0 0 8px; font-size: 20px; }
.elsewhere .btn { width: 100%; margin-top: 16px; }
.morebtn { display: block; width: calc(100% - 32px); margin: 12px auto 96px; }
.dupwarn { background: #fff4e5; border: 1px solid #f0b46b; color: #7a4a00; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.dupwarn .btns { margin-top: 8px; }

/* ---------- Prospects ---------- */
.tabs { grid-template-columns: repeat(6, 1fr); }
.tab { position: relative; font-size: 10.5px; padding: 6px 2px; }
.tabcnt { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #c0392b; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.seg.scroll { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll .segbtn { flex: none; }
.card.prospect .duemain { text-align: left; background: none; border: 0; padding: 0; width: 100%; color: inherit; font: inherit; cursor: pointer; }
.input.ro { background: var(--sunk); color: var(--muted); }
a.covwarn { display: block; color: inherit; text-decoration: none; }
@media (min-width: 900px) { .tab { font-size: 12px; } }

/* ---------- Arrival windows ---------- */
.awrow { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; }
.awrow span { color: var(--muted); font-size: 14px; }
.wintimes { margin-top: 8px; }
.vtime b { white-space: nowrap; }
.svcline { font-weight: 600; color: var(--ink, inherit); }
.mvis small { display: none; }
@media (min-width: 700px) { .mvis small { display: block; opacity: .8; font-size: 10px; } }
.techline { display: flex; align-items: center; gap: 5px; }
.techline svg { width: 14px; height: 14px; flex: none; opacity: .7; }

/* Description editor with a formatting toolbar */
.rich { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.rtbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; background: var(--warn-soft); border-bottom: 1px solid var(--line); }
.rtb { min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: 600 15px/1 var(--body); cursor: pointer; }
.rtb:hover, .rtb:focus-visible { background: rgba(0,0,0,.08); }
.rtb.on { background: rgba(0,0,0,.14); }
.rtA { border-bottom: 3px solid #c62828; padding: 0 2px; }
.rtM { background: #fff59d; color: #182028; padding: 0 3px; border-radius: 2px; }
.rtsel { height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: 14px var(--body); padding: 0 4px; max-width: 120px; }
.rtpop { padding: 6px; border-bottom: 1px solid var(--line); background: var(--sunk); }
.rtsw { display: flex; flex-wrap: wrap; gap: 6px; }
.rtsw button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid rgba(0,0,0,.25); cursor: pointer; }
.rtsw button.none { background: #fff; color: #b42318; font-weight: 700; }
.rtlink { display: flex; gap: 6px; flex-wrap: wrap; }
.rtlink input { flex: 1 1 180px; }
.rtbox.input { border: 0; border-radius: 0; min-height: 110px; max-height: 60vh; overflow: auto; resize: vertical; background: #fff; color: #182028; padding: 10px 12px; line-height: 1.45; white-space: normal; text-align: left; }
.rich.small .rtbox.input { min-height: 70px; font-size: 14px; }
.rtbox:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.rtbox.empty::before { float: left; height: 0; content: attr(data-ph); color: #8a949c; pointer-events: none; }
.rtbox ol, .rtbox ul { margin: 4px 0; padding-left: 26px; }
.rtbox p { margin: 0 0 4px; }
.rtbox a { color: #1565c0; }
.svedit .svdesc { min-width: 0; }
.fabspace { height: 64px; }

/* ===== Show customer: the invoice / estimate full screen ===== */
#present { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #f2f3f5; color: #111; --pv: #1f6fe0; }
body.presenting { overflow: hidden; }
.pv-bar { background: var(--pv); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--top) + 12px) var(--gr) 12px var(--gl); font: 600 22px/1.2 var(--body); }
.pv-num { font-size: 17px; opacity: .9; }
.pv-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px 0; }
.pv-fit { margin: 0 auto; position: relative; }
.pv-paper { width: 780px; transform-origin: 0 0; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); padding: 46px 44px 40px; margin: 0;
  font: 15px/1.38 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif; color: #111; min-height: 1000px; }
.pv-top { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.5px solid #555; padding-bottom: 10px; }
.pv-title { font-size: 50px; line-height: 1; }
.pv-meta { font-size: 14px; text-align: left; padding-bottom: 6px; }
.pv-head { position: relative; display: flex; justify-content: space-between; gap: 20px; margin: 22px 0 24px; min-height: 170px; }
.pv-left { font-size: 14.5px; line-height: 1.38; max-width: 52%; }
.pv-coname { color: var(--pv); font-weight: 700; font-size: 20px; margin-bottom: 2px; }
.pv-bill { margin-top: 18px; }
.pv-link { color: #1a4fd6; text-decoration: underline; }
.pv-logo { flex: 0 0 auto; max-width: 270px; display: flex; align-items: flex-start; }
.pv-logo img { max-width: 270px; max-height: 240px; object-fit: contain; }
.pv-stamp { position: absolute; left: 41%; top: 44px; transform: rotate(-14deg); border: 5px solid #2457d6; color: #2457d6; padding: 2px 18px;
  font: 700 44px/1.1 Georgia, serif; letter-spacing: 3px; border-radius: 6px; opacity: .85; pointer-events: none;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #2457d6; }
.pv-stamp.ok { border-color: #23774a; color: #23774a; font-size: 30px; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #23774a; }
.pv-items { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pv-items th { background: var(--pv); color: #fff; text-align: left; font-weight: 700; padding: 4px 6px; border: 1px solid #fff; }
.pv-items td { border: 1.5px solid #d9dbe0; padding: 4px 6px; vertical-align: top; }
.pv-items .n { text-align: right; white-space: nowrap; }
.pv-items .c-date { white-space: nowrap; width: 118px; }
.pv-desc { font-size: 13px; color: #333; white-space: pre-wrap; margin-top: 2px; }
.pv-tot { margin: 26px 50px 0 auto; border-collapse: collapse; min-width: 310px; font-size: 15px; }
.pv-tot th { text-align: right; padding: 3px 10px; border: 1.5px solid #d9dbe0; font-weight: 400; }
.pv-tot td { text-align: right; padding: 3px 10px; border: 1.5px solid #d9dbe0; min-width: 120px; }
.pv-tot tr.big th, .pv-tot tr.big td { font-weight: 700; }
.pv-pays { text-align: right; margin: 6px 50px 0 0; font-size: 12.5px; color: #555; }
.pv-notes { margin-top: 26px; font-size: 14px; white-space: pre-wrap; }
.pv-sign { margin-top: 40px; max-width: 520px; }
.pv-sign img { display: block; max-width: 280px; max-height: 90px; }
.pv-signspace { height: 60px; }
.pv-signline { display: flex; justify-content: space-between; border-top: 1.5px solid #111; padding-top: 4px; font-size: 13px; color: #444; }
.pv-agree { font-size: 12px; color: #555; margin-top: 4px; }
.pv-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--pv); padding: 6px var(--gr) calc(6px + var(--bot)) var(--gl); }
.pv-nav button { background: none; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font: 500 15px var(--body); cursor: pointer; min-height: 60px; }
.pv-nav svg { width: 30px; height: 30px; }
.pv-nav button:active { opacity: .7; }
.pv-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .pv-scrim { align-items: center; } }
.pv-pad { background: #fff; color: #111; width: 100%; max-width: 640px; border-radius: 16px 16px 0 0; padding: 18px var(--gr) calc(18px + var(--bot)) var(--gl); max-height: 100%; overflow: auto; }
@media (min-width: 640px) { .pv-pad { border-radius: 16px; padding: 22px; } }
.pv-pad h3 { margin: 0 0 6px; font-size: 22px; }
.pv-total { margin: 4px 0 10px; color: #333; }
.pv-canvas { width: 100%; height: 200px; display: block; border: 2px dashed #9aa3ab; border-radius: 12px; background: #fff; touch-action: none; }
.pv-padrow { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.pv-hint { font-size: 13px; color: #666; }
.pv-lbl { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pv-pad .input { background: #fff; color: #111; }
.pv-err { color: #b42318; min-height: 20px; font-size: 14px; margin-top: 6px; }
.pv-warn { background: #fbefd9; color: #7a4c06; border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-bottom: 8px; }
.pv-opts { display: grid; gap: 6px; margin: 6px 0; }
.pv-opts label { display: flex; gap: 8px; align-items: center; border: 1px solid #d6dce0; border-radius: 10px; padding: 10px; }
.pv-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.pv-btns .btn { min-width: 120px; }
@media print {
  @page { size: letter; margin: 0.4in; }
  body.presenting > *:not(#present) { display: none !important; }
  body.presenting { overflow: visible; background: #fff; }
  #present { position: static; display: block; background: #fff; }
  #present .pv-bar, #present .pv-nav, #pvModal { display: none !important; }
  #present .pv-scroll { overflow: visible; padding: 0; }
  #present .pv-fit { width: auto !important; height: auto !important; }
  #present .pv-paper { transform: none !important; box-shadow: none; padding: 0; width: 100%; min-height: 0; }
  .pv-items th, .pv-stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Google address suggestions */
.addrsug { margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.addrsug button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); padding: 10px 12px; font: inherit; cursor: pointer; border-bottom: 1px solid var(--line); }
.addrsug button b { display: block; font-weight: 600; }
.addrsug button span { font-size: 13px; color: var(--muted); }
.addrsug button:hover, .addrsug button.on { background: var(--sunk); }
.addrpow { font-size: 11px; color: var(--muted); text-align: right; padding: 4px 10px; }
.keyrow { display: flex; gap: 8px; } .keyrow .input { flex: 1; min-width: 0; }

/* Several phones / emails with labels */
.ctlist { display: grid; gap: 6px; }
.ctrow { display: grid; grid-template-columns: 104px 1fr 44px; gap: 6px; align-items: center; }
.ctrow .ctlabel { padding-right: 4px; }
.ctmain { font-size: 12px; color: var(--muted); text-align: center; }
.ctadd { margin-top: 4px; }
.ctshow { display: grid; gap: 4px; }
.ctlab { display: inline-block; min-width: 54px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-right: 6px; }
.ctsms { font-size: 13px; margin-left: 6px; }
.ctrow .ctopt { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: -2px 0 6px 2px; }
.ctrow .ctopt select { width: auto; flex: 0 1 auto; min-height: 36px; }
.ctno { font-size: 12px; color: var(--muted); margin-left: 6px; }
.ctgets { font-size: 12px; color: var(--info); margin-left: 6px; }

/* Customer page tabs */
.ctabs { display: flex; width: 100%; margin: 14px 0 10px; }
.ctabs button { flex: 1; }
.ctabbody > .btns { margin-bottom: 8px; }
.subhead { font-size: 15px; margin: 16px 0 8px; color: var(--ink); }
.histinv { margin: -4px 0 8px 12px; font-size: 13px; }
.histinv .dst { text-decoration: none; }

/* each service on a job has its own description */
.svcrow { flex-wrap: wrap; }
.svcrow .svcdesc { flex: 1 1 100%; margin: 4px 0 6px; }
.custlink { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* six photo/job buttons: two rows of three on phones */
.actionbar > * { min-width: 0; }
@media (max-width: 520px) { .actionbar { grid-template-columns: repeat(3, 1fr); } .actionbar .act { min-height: 62px; } }
.pv-right { display: flex; align-items: center; gap: 12px; }
.pv-edit { border: 1.5px solid rgba(255,255,255,.85); background: transparent; color: #fff; border-radius: 18px; padding: 6px 16px; font: 600 16px var(--body); cursor: pointer; }
.histinv { margin: -2px 0 10px 12px; }
.histbtn { text-decoration: none; }

/* Pay invoice */
.paypad { max-width: 720px; }
.payh { background: #4caf50; color: #fff; margin: -18px calc(-1 * var(--gr)) 12px calc(-1 * var(--gl)); padding: 14px var(--gr) 14px var(--gl); border-radius: 16px 16px 0 0; font-size: 20px; }
@media (min-width: 640px) { .payh { margin: -22px -22px 14px; padding: 14px 22px; } }
.payform { display: grid; gap: 10px; color: var(--ink); }
.paypad .payform { color: #111; }
.pyhead { display: grid; gap: 4px; font-size: 15px; padding-bottom: 8px; border-bottom: 1px solid #d6dce0; }
.pyhead span { color: #555; }
.pyhist { margin-left: 12px; font-size: 14px; }
.pyrow { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; }
@media (max-width: 480px) { .pyrow { grid-template-columns: 1fr; gap: 4px; } }
.pylbl { font-weight: 600; padding-top: 8px; }
.pyopts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pyopts > label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.pyopts input[type="radio"], .pyopts input[type="checkbox"] { width: 22px; height: 22px; accent-color: #2e7d32; }
.pyamt { display: inline-flex; align-items: center; gap: 4px; } .pyamt .input { width: 130px; }
.pyforms { flex-direction: column; align-items: flex-start; gap: 2px; }
.pycheck { width: 120px; } #py_other { width: auto; min-width: 160px; }
.pysq small { color: #2e7d32; font-weight: 600; }
.pydone { background: #e1f2e8; color: #23774a; border-radius: 10px; padding: 12px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.pyerr { color: #b42318; min-height: 20px; font-weight: 600; }
.pybtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pybtns .btn.ok { background: #4caf50; color: #fff; border: 0; }

/* Estimate appointments on the calendar and customer page */
.visit.k-est { border-left: 4px solid var(--info); }
.visit.k-est .vtime span { color: var(--info); font-weight: 700; }
.mvis.k-est { background: var(--info) !important; color: #fff !important; }
.row.k-est { border-left: 4px solid var(--info); }
.esttag { display: inline-block; background: var(--info-soft); color: var(--info); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; text-transform: uppercase; letter-spacing: .03em; vertical-align: 1px; }
.estbanner { margin-bottom: 4px; }
.hbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
/* item description on estimates and invoices */
.idesc { margin: 2px 0 4px; }
.idesc-ro { font-size: 14px; color: var(--muted); }
.idesc-ro ol, .idesc-ro ul, .pv-desc ol, .pv-desc ul, .idesc-pub ol, .idesc-pub ul { margin: 2px 0; padding-left: 22px; }
.pv-desc { white-space: normal; }
/* estimates on the calendar (the day they were created), the Save bar, unsaved estimates */
.row.estdoc { border-left: 4px dashed var(--info); text-decoration: none; color: inherit; }
.row.estdoc .vtime span:last-child { color: var(--muted); font-size: 12px; }
.mvis.k-estdoc { background: transparent; color: var(--info); border: 1px dashed var(--info); }
.savebar { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: 10px; margin: 18px 0 8px; }
.savebar .btn { width: auto; flex: 0 0 auto; }
.savebar .btn.big { flex: 0 1 320px; }
.savebar .btn.big { min-height: 52px; padding: 0 28px; font-size: 17px; }
.unsavedbox { border-left: 4px solid var(--info); }
.dst.st-unsaved { background: var(--info); color: #fff; }
.additem select { font-weight: 600; }
/* ---------- markup editor: photo fills the screen, tools down the right side ---------- */
.markup .m-stage { position: absolute; inset: 0; padding: calc(var(--top) + 60px) 0 calc(var(--bot) + 12px) 0; display: flex; align-items: center; justify-content: center; }
.markup .m-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: calc(var(--top) + 6px) calc(var(--gr) + 6px) 6px calc(var(--gl) + 6px); background: rgba(0,0,0,.55); }
.m-ic { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 48px; min-height: 48px; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
.m-ic.lab span { font-size: 13px; font-weight: 600; }
.m-ic[aria-pressed="true"] { background: rgba(255,255,255,.22); }
.m-side { position: absolute; right: calc(var(--gr) + 6px); top: calc(var(--top) + 66px); z-index: 3; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.m-group { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; background: rgba(18,24,29,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.m-colorwrap { position: relative; }
.m-color { width: 56px; height: 56px; border-radius: 14px; border: 0; background: rgba(18,24,29,.82); display: grid; place-items: center; cursor: pointer; }
.m-color i { width: 30px; height: 30px; border-radius: 8px; display: block; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.m-swatches { position: absolute; right: 64px; top: 4px; display: flex; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(18,24,29,.92); }
.m-swatches[hidden] { display: none; }
.m-pop { position: absolute; z-index: 4; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(40,44,48,.92); box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.m-pop[hidden] { display: none; }
.m-pop button { width: 48px; height: 44px; border: 0; background: transparent; color: #fff; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.m-pop button:active { background: rgba(255,255,255,.18); }
.markup .m-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: center; padding: 8px var(--gr) calc(8px + var(--bot)) var(--gl); background: rgba(0,0,0,.45); }
.m-cropbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 10px calc(var(--gr) + 10px) calc(10px + var(--bot)) calc(var(--gl) + 10px); background: rgba(18,24,29,.95); }
.m-cropbar[hidden] { display: none; }
.markup.cropping .m-side, .markup.cropping .m-bottom, .markup.cropping #mUndo, .markup.cropping #mClear { visibility: hidden; }
.markup .m-text { z-index: 6; width: 280px; }
/* paid invoice: Mark unpaid / Refund */
.paidbtns { display: grid; gap: 10px; margin: 14px 0; }
.paidbtns .btn.big { flex-direction: column; align-items: flex-start; text-align: left; height: auto; padding: 12px 16px; }
.paidbtns .btn.big span { font-size: 13px; font-weight: 400; color: var(--muted); }
.paypad .f label { color: #111; }
.pv-stamp.ref { border-color: #8a5a00; color: #8a5a00; font-size: 30px; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #8a5a00; }
/* calendar: paid jobs green, jobs with a balance due red */
.row.visit.pay-paid { border-left: 4px solid var(--ok); background: var(--ok-soft); }
.row.visit.pay-due { border-left: 4px solid var(--bad); background: var(--bad-soft); }
.paytag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 9px; margin-left: 6px; align-self: flex-start; white-space: nowrap; }
.paytag.paid { background: var(--ok); color: #fff; }
.paytag.due { background: var(--bad); color: #fff; }
.mvis.pay-paid { background: var(--ok) !important; color: #fff !important; }
.mvis.pay-due { background: var(--bad) !important; color: #fff !important; }
.mvis small.mjob { white-space: normal; }
/* job summary */
.vvhead { display: flex; gap: 12px; align-items: flex-start; }
.vvname { font-size: 20px; font-weight: 700; }
.vvwhen { color: var(--muted); margin-top: 2px; }
.vvlist { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 14px 0; }
.vvlist dt { color: var(--muted); font-size: 14px; }
.vvlist dd { margin: 0; }
.vvsvc + .vvsvc { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.vvdesc { color: var(--muted); font-size: 14px; margin-top: 4px; }
.vvtotal { margin-top: 8px; font-weight: 700; text-align: right; }
.vvpay { margin: 10px 0; padding: 8px 12px; border-radius: 10px; font-weight: 700; background: var(--sunk); }
.vvpay.paid { background: var(--ok); color: #fff; }
.vvpay.due { background: var(--bad); color: #fff; }
@media (max-width: 520px) { .vvlist { grid-template-columns: 1fr; gap: 2px; } .vvlist dd { margin-bottom: 10px; } }
/* paper view: Discount / Convert to a job */
.pv-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.pv-discrow { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 22px; font-weight: 700; color: #111; }
.pv-discrow .input { font-size: 22px; max-width: 200px; }
@media (max-width: 560px) { .pv-edit { padding: 5px 11px; font-size: 14px; } }
.vvsvc .row-between { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
/* a question or box opened from the photo screen shows on top of it (Delete photo?, Save photo) */
body:has(.viewer) .scrim { z-index: 75; }
/* month calendar: a job with no invoice yet is white; green = paid, red = balance due (only the invoice sets the color) */
.mvis { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.mvis.st-no_show { text-decoration: line-through; color: var(--muted); }
.mvis.pay-paid, .mvis.pay-due, .mvis.k-est { border-color: transparent; }
/* customer page: what they owe */
.balchip { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 14px; border-radius: 999px; font: 700 15px var(--body); border: 0; }
.balchip span { font-weight: 500; opacity: .9; }
.balchip.due { background: var(--bad); color: #fff; cursor: pointer; }
.balchip.ok { background: var(--ok-soft); color: var(--ok); }
.baltotal { font: 700 30px var(--body); color: var(--bad); margin: 0 0 12px; }
.pagehead .balchip { align-self: flex-start; width: auto; max-width: 100%; white-space: nowrap; display: inline-flex; }
/* a job's status tags: beside the details on wide screens, under the time on phones (so the details keep their width) */
.vtags { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }
.vtags .paytag { margin-left: 0; }
@media (max-width: 600px) {
  .row.visit { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "time main" "tags main"; column-gap: 12px; row-gap: 6px; align-items: start; }
  .row.visit .vtime { grid-area: time; }
  .row.visit .grow { grid-area: main; min-width: 0; }
  .row.visit .vtags { grid-area: tags; flex-direction: column; gap: 4px; }
}
/* several job types on one appointment: one under the other */
.svcline .svcone { display: block; }
.mvis small.mjob + small.mjob { margin-top: 1px; }
/* the tech, under the arrival window */
.vtime .vtech { margin-top: 4px; font-size: 12px; color: var(--muted); max-width: 150px; }
.vtime .vtech b { color: var(--ink); font-weight: 600; }
.vtime .vtech b { display: block; }
@media (max-width: 600px) { .row.visit .vtime { max-width: 104px; } }
/* month box: time, then the customer's last name, then the job types (one per line) */
.mvis .mtime, .mvis .mname { display: block; overflow: hidden; text-overflow: ellipsis; }
.mvis .mname { font-weight: 700; }
.mvis .mname { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
/* everything in a job's left column is centered: time, arrival window, tech, tags */
.row.visit .vtime, .row.estdoc .vtime { align-items: center; text-align: center; }
.vtime .vtech { max-width: none; }
@media (max-width: 600px) { .row.visit .vtags { align-items: center; justify-self: center; } }
/* tech's name above "Tech assigned"; the address in bold */
.vtime .vtech b { display: block; font-size: 13px; }
.row.visit .vaddr { font-weight: 700; color: var(--ink); }
/* estimate cards in the calendar: same layout as job cards */
.row.estdoc { align-items: flex-start; }
.row.estdoc .vtime .eamt { margin-top: 6px; font-size: 15px; color: var(--ink); }
.row.estdoc .vaddr { font-weight: 700; color: var(--ink); }
.row.estdoc .vtime .esttag + span { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .row.estdoc { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "time main" "tags main"; column-gap: 12px; row-gap: 6px; align-items: start; }
  .row.estdoc .vtime { grid-area: time; max-width: 104px; }
  .row.estdoc .grow { grid-area: main; min-width: 0; }
  .row.estdoc .vtags { grid-area: tags; flex-direction: column; gap: 4px; align-items: center; justify-self: center; }
}
/* "JOB" label on job cards (like ESTIMATE on estimate cards) */
.jobtag { display: inline-block; background: #e6ebef; color: #33414b; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
/* balance due: a bright, lighter red (not the dark brownish red) */
:root { --due: #ef4444; --due-soft: #feecec; }
.mvis.pay-due { background: var(--due) !important; color: #fff !important; }
.row.visit.pay-due { border-left-color: var(--due); background: var(--due-soft); }
.paytag.due, .vvpay.due, .balchip.due { background: var(--due); color: #fff; }
.baltotal { color: var(--due); }
/* job cards match their month box: solid color with white text */
.row.visit.pay-due { background: var(--due); border-left-color: #b91c1c; }
.row.visit.pay-paid { background: var(--ok); border-left-color: #14532d; }
.row.visit.pay-due, .row.visit.pay-paid,
.row.visit.pay-due .t1, .row.visit.pay-paid .t1, .row.visit.pay-due .t2, .row.visit.pay-paid .t2,
.row.visit.pay-due .vtime, .row.visit.pay-paid .vtime, .row.visit.pay-due .vtime *, .row.visit.pay-paid .vtime *,
.row.visit.pay-due .vaddr, .row.visit.pay-paid .vaddr, .row.visit.pay-due .muted, .row.visit.pay-paid .muted { color: #fff !important; }
.row.visit.pay-due .rep, .row.visit.pay-paid .rep { color: #fff; }
.row.visit.pay-due .jobtag, .row.visit.pay-due .vstat, .row.visit.pay-due .paytag { background: #fff !important; color: var(--due) !important; }
.row.visit.pay-paid .jobtag, .row.visit.pay-paid .vstat, .row.visit.pay-paid .paytag { background: #fff !important; color: var(--ok) !important; }
.row.estdoc .vtime .vtech { color: var(--muted); }
.row.estdoc .vtime .vtech b { color: var(--ink); }
/* soft pastel colors (like the old calendar), filling the whole box; dark text */
:root { --paid-soft: #cde8b5; --due-pastel: #f4c6c6; }
.mday .mvis { margin: 0 -3px; border-radius: 0; }
.mvis.pay-paid { background: var(--paid-soft) !important; color: var(--ink) !important; }
.mvis.pay-due { background: var(--due-pastel) !important; color: var(--ink) !important; }
.row.visit.pay-paid { background: var(--paid-soft); border-left-color: #6fae4a; }
.row.visit.pay-due { background: var(--due-pastel); border-left-color: #e07b7b; }
.row.visit.pay-due, .row.visit.pay-paid,
.row.visit.pay-due .t1, .row.visit.pay-paid .t1, .row.visit.pay-due .t2, .row.visit.pay-paid .t2,
.row.visit.pay-due .vtime, .row.visit.pay-paid .vtime, .row.visit.pay-due .vtime *, .row.visit.pay-paid .vtime *,
.row.visit.pay-due .vaddr, .row.visit.pay-paid .vaddr, .row.visit.pay-due .rep, .row.visit.pay-paid .rep { color: var(--ink) !important; }
.row.visit.pay-due .muted, .row.visit.pay-paid .muted, .row.visit.pay-due .vtime span, .row.visit.pay-paid .vtime span { color: #3d4a54 !important; }
.row.visit.pay-due .jobtag, .row.visit.pay-paid .jobtag { background: rgba(255,255,255,.7) !important; color: #33414b !important; }
.row.visit.pay-due .vstat, .row.visit.pay-paid .vstat { background: rgba(255,255,255,.7) !important; color: #3d4a54 !important; }
.row.visit.pay-due .paytag { background: #c62828 !important; color: #fff !important; }
.row.visit.pay-paid .paytag { background: #2e7d32 !important; color: #fff !important; }
/* daily and weekly totals (jobs only) */
.weektot, .mweektot { font-size: 14px; color: var(--muted); }
.weektot { margin: 8px 0 6px; }
.weektot b, .mweektot b { color: var(--ink); }
.mweektot { grid-column: 1 / -1; text-align: right; padding: 2px 6px 6px; font-size: 13px; }
.daytot { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 8px; }
.mday .mn { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.mday .mtot { font-size: 11px; font-weight: 700; color: var(--ok); }
@media (max-width: 560px) { .mday .mtot { display: none; } .mweektot { font-size: 12px; } }

/* month view: estimate boxes match job boxes (tag, time, last name, street, items) */
.mvis .mesttag { display: block; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--info); }
.mvis small.maddr { white-space: normal; overflow-wrap: anywhere; }
/* Residential / Commercial */
.chip.ctype { background: var(--sunk); color: var(--muted); }
.chip.ctype.com { background: var(--info-soft); color: var(--info); }
.pagehead .ctyperow { margin-top: 6px; }
#ce_type { max-width: 320px; }
/* Property type: pick list with a "+" to add your own */
.ptyperow { display: flex; gap: 8px; }
.ptyperow select { flex: 1; }
.ptyperow .btn { min-width: 46px; font-size: 20px; font-weight: 700; padding: 0 12px; }
.ptypenew { display: flex; gap: 8px; margin-top: 8px; }
.ptypenew[hidden] { display: none; }
.ptypenew input { flex: 1; }
.chip.ctype.pt { background: var(--accent-soft); color: var(--accent); }
