/* Escape Field App — built for a phone, in a truck, in sunlight, with gloves on.
   Brand: near-black #171205, gold #B8860B/#E4BA55, cream #FBF3DD. */

:root {
  --ink: #171205;
  --ink-2: #241d0c;
  --ink-3: #322912;
  --gold: #B8860B;
  --gold-lt: #E4BA55;
  --gold-dk: #8F6A08;
  --cream: #FBF3DD;
  --cream-dim: #C9C0A8;
  --muted: #9C9484;
  --ok: #4ea36a;
  --warn: #d98324;
  --bad: #c0453c;
  --gold-fill: #E4BA55;     /* gold used as a fill behind dark text: same in both themes */
  --gold-bg: #3a3218;
  --ok-bg: #1f3b26; --ok-text: #8fd4a0;
  --bad-bg: #3d1f1f; --bad-text: #f0a3a3; --bad-line: #6b2a2a;
  --shadow: rgba(0,0,0,.6);
  color-scheme: dark;
  --tap: 56px;              /* nothing interactive is smaller than this */
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--cream);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

body { padding-bottom: env(safe-area-inset-bottom); }

.app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ header */
header {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-3);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 12px; position: sticky;
}
/* ESCAPE sits dead centre; Back on the left, Refresh on the right. */
header .brand { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; }
.hdr-back { background: none; border: 0; padding: 6px 4px; min-height: 40px; color: var(--gold-lt);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.hdr-back[hidden] { display: none; }
/* Each screen's own Back is pressed from the top bar instead. */
#main button.back { display: none !important; }
/* The job's one status button, right of the customer's name. */
.status-btn { flex: none; min-height: 44px; min-width: 104px; padding: 0 16px; border-radius: 12px;
  background: var(--gold); color: #1a1305; border: 1px solid var(--gold); font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
.status-btn.done { background: transparent; color: var(--ok); border-color: var(--ok); }
.status-btn:disabled { opacity: .6; }
.status-btn { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.btn-ghost.danger { color: var(--bad-text); border-color: var(--bad-line); }
.brand { font-weight: 700; letter-spacing: .14em; font-size: 15px; color: var(--gold-lt); text-transform: uppercase; }
.spacer { flex: 1; }

.sync {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  background: var(--ink-2); color: var(--cream-dim); border: 1px solid var(--ink-3);
  white-space: nowrap;
}
.bell { position: relative; margin-left: 8px; width: 42px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-2); color: var(--cream-dim); border: 1px solid var(--ink-3); border-radius: 999px; cursor: pointer; padding: 0; flex: none; }
.bell-dot { display: none; position: absolute; top: 1px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #e0242a; border: 2px solid var(--ink); }
.bell.has .bell-dot { display: block; }
.bell.has { color: var(--gold-lt); }
.bellbox { text-align: left; max-height: 80vh; display: flex; flex-direction: column; }
.bellbox h2 { text-align: center; }
.bell-list { overflow-y: auto; margin: 0 -6px 14px; }
.bell-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--ink-3); color: var(--cream); font: inherit; padding: 10px 6px; cursor: pointer; }
.bell-item.new { border-left: 3px solid #e0242a; padding-left: 9px; }
.bell-t { display: block; font-weight: 700; font-size: 15px; }
.bell-b { display: block; font-size: 14px; color: var(--cream-dim); margin-top: 2px; }
.bell-w { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sync.pending { color: #1d1607; background: var(--gold-fill); border-color: var(--gold-fill); font-weight: 700; }
.sync.offline { color: #fff; background: var(--bad); border-color: var(--bad); font-weight: 700; }

/* -------------------------------------------------------------------- main */
/* Clears the fixed tab bar (one row, ~60px) plus the phone's home-indicator area. */
main { flex: 1; padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
h1 { font-size: 21px; margin: 4px 0 2px; }

/* Greeting row: name on the left, the time clock on the right. */
.hello-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello-row h1 { min-width: 0; }
.clock-btn {
  min-height: 40px; padding: 0 18px; border-radius: 999px; white-space: nowrap; flex: none;
  background: var(--gold); color: #1a1305; font-size: 15px;
}
.clock-btn:active { background: var(--gold-dk); }
.clock-btn:disabled { opacity: .6; }
.modal-btns { display: grid; gap: 10px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* ------------------------------------------------------------------- cards */
.job {
  display: block; width: 100%; text-align: left;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  color: inherit; font: inherit; cursor: pointer;
}
.job:active { background: var(--ink-3); }
.job-top { display: flex; align-items: flex-start; gap: 10px; }
.job-name { font-weight: 700; font-size: 17px; flex: 1; }
.job-meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.job-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 6px; }
.job-foot .job-meta { margin-top: 0; }
.status-pill {
  margin-left: auto; white-space: nowrap; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px;
  background: var(--gold-fill); color: #241a06;
}
.fu-amt { color: var(--gold-lt); font-weight: 700; white-space: nowrap; }

.chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--ink-3); color: var(--cream-dim);
}
.chip.on_my_way { background: var(--warn); color: #241a06; }
.chip.onsite, .chip.in_progress { background: var(--gold-fill); color: #241a06; }
.chip.complete { background: var(--ok); color: #06210f; }
.chip.cancelled { background: var(--bad); color: #fff; }
.chip.needs_return_visit { background: var(--gold-dk); color: #fff; }

/* ----------------------------------------------------------------- buttons */
button, .btn {
  min-height: var(--tap); border-radius: var(--radius); border: 0;
  font: inherit; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--gold); color: #1a1305; width: 100%; }
.btn-primary:active { background: var(--gold-dk); }
.btn-primary:disabled { background: var(--ink-3); color: var(--muted); }
.btn-ghost {
  background: transparent; color: var(--cream);
  border: 1px solid var(--ink-3); width: 100%;
}
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }

.actions { display: grid; gap: 10px; margin: 18px 0; }
.action { background: var(--ink-2); color: var(--cream); border: 1px solid var(--gold-dk); width: 100%; }
.action.next { background: var(--gold); color: #1a1305; border-color: var(--gold); font-size: 18px; min-height: 64px; }
.action:disabled { opacity: .4; }
.action { flex-direction: column; gap: 0; padding-top: 8px; padding-bottom: 8px; }
.action small { display: block; font-size: 12px; font-weight: 400; opacity: .75; margin-top: 2px; }
.note-scroll { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ink-3); border-radius: 10px; }
.note-item { display: block; width: 100%; min-height: 0; text-align: left; background: none; color: inherit;
  font-weight: 400; border-radius: 0; padding: 10px 12px; border-bottom: 1px solid var(--ink-3); }
.note-item:last-child { border-bottom: 0; }
.note-item:active { background: var(--ink-3); }
.note-item .by { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.note-item .tx { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid button { padding: 0; border: 0; background: none; min-height: 0; position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.photo-grid .file { aspect-ratio: 1; border-radius: 8px; background: var(--ink-3); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.photo-grid .src { font-size: 10px; color: var(--muted); text-align: left; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ inputs */
input, textarea {
  width: 100%; min-height: var(--tap); padding: 14px;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius);
  color: var(--cream); font: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }

/* ------------------------------------------------------------------ detail */
.panel {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-lt); margin: 0 0 10px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--ink-3); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); font-size: 14px; }
.kv span:last-child { text-align: right; }

.back {
  background: none; color: var(--gold-lt); padding: 0; min-height: 40px;
  justify-content: flex-start; font-size: 15px;
}

/* ---------------------------------------------------------------- tab bar */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  /* One row, however many tabs are visible: hidden tabs take no column. */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--ink-2); border-top: 1px solid var(--ink-3);
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 640px; margin: 0 auto;
}
nav.tabs button {
  background: none; color: var(--muted); min-height: 58px; padding: 4px 2px;
  flex-direction: column; gap: 2px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
nav.tabs button.on { color: var(--gold-lt); }
nav.tabs .ico { font-size: 19px; line-height: 1; position: relative; }
.nav-badge {
  position: absolute; top: -7px; left: 13px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--gold-fill); color: #241a06; font-size: 11px; font-weight: 800;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--ink-2);
}
.nav-badge.hide { display: none; }
.fu-card { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); margin-bottom: 10px; }
.fu-card > .job { border: 0; margin: 0; background: none; }
.fu-more { padding: 0 14px 14px; }
.fu-note { font-size: 14px; border-left: 3px solid var(--gold-dk); padding: 4px 0 4px 10px; margin: 8px 0; }
.fu-note .by { color: var(--muted); font-size: 12px; }
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--ink-2); border: 1px solid var(--gold-dk); border-radius: var(--radius); padding: 22px; max-width: 420px; width: 100%; text-align: center; }
.modal h2 { color: var(--gold-lt); margin: 0 0 10px; }
.modal p { font-size: 17px; line-height: 1.45; margin: 0 0 18px; }
.fp-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.fp-file { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--gold-dk); background: var(--ink-3); color: var(--gold-lt); font-size: 14px; font-weight: 700;
  text-decoration: none; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.fp-file:active { background: var(--gold-dk); color: var(--cream); }
.install-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.install-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

/* ------------------------------------------------------------- pricebook */
.crumb { color: var(--gold-lt); font-size: 14px; margin-bottom: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); padding: 14px; margin-bottom: 8px;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row:active { background: var(--ink-3); }
.row .grow { flex: 1; min-width: 0; }
.row .nm { font-weight: 600; }
.row .px { font-weight: 700; color: var(--gold-lt); white-space: nowrap; }
.row .sub2 { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row.folder .fic { color: var(--gold-lt); font-size: 18px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat.tap { font: inherit; color: inherit; border: 0; cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; padding: 12px; }
.stat.tap .l { margin-top: 0; font-size: 13px; }
.stat.tap .n { text-align: right; flex: none; }
.stat.tap .l b { color: var(--cream); font-weight: 700; }
.head-tools { display: flex; gap: 8px; align-items: center; }
.rep-row { width: 100%; text-align: left; }
.review-btn { margin: 0 0 12px; }
.review-text { background: var(--ink-3); border-radius: 10px; padding: 10px 12px; margin: 6px 0 4px; line-height: 1.4; word-break: break-word; }
.btn-ghost.mini-btn { width: auto; padding: 6px 12px; font-size: 14px; margin: 0; }
.slot-day { font-weight: 700; color: var(--cream); margin: 12px 0 6px; font-size: 14px; }
.slot-day:first-of-type { margin-top: 4px; }
.slot-row { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { background: var(--ink-3); color: var(--cream); border: 1px solid var(--ink-3); border-radius: 999px;
        padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.slot.on { background: var(--gold); color: #1a1305; border-color: var(--gold); font-weight: 700; }
.due-late { color: var(--bad); font-weight: 700; }
.signout { margin: 18px 0 8px; width: 100%; }
.folder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.folder-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 64px;
  background: var(--ink-3); border: 1px solid var(--ink-3); border-radius: var(--radius);
  padding: 10px 12px; color: var(--cream); font: inherit; text-align: left; cursor: pointer;
}
.folder-tile:active { border-color: var(--gold-dk); }
.folder-tile .nm { font-weight: 600; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.folder-tile .n { color: var(--gold-lt); font-size: 12px; font-weight: 700; }

/* -------------------------------------------------------------- utilities */
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.stale { background: var(--warn); color: #241a06; font-weight: 700;
         padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 14px; }
.err { background: var(--bad); color: #fff; padding: 12px 14px; border-radius: var(--radius); margin: 10px 0; }
.center { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.hide { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  .job, .row { transition: background .12s ease; }
}

/* Offers — the tech raises a flag, the shop's automation sends the link. */
.offers { display: grid; gap: 8px; }
.offers button { min-height: 52px; }
.row .px.bad { color: var(--bad); font-size: 13px; }


/* Quantity stepper in the estimate/invoice builder. Big targets — this gets
   used with gloves on, standing up, one-handed. */
.row.builder { align-items: center; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 46px; min-height: 46px; border-radius: 10px;
  background: var(--ink-3); color: var(--gold-lt); font-size: 22px; font-weight: 700;
}
.stepper button:disabled { opacity: .3; }
.stepper .qty {
  min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------- job screen tab bar */
/* Wraps rather than scrolls: a hidden scrollbar cut the last tab (Report) in
   half with no sign there was more. Every tab stays visible on any width. */
.jobtabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px;
}
/* Pinned: Back and the name on one line, then the visit card. Everything
   else (address, phone, Call/Text/Navigate, tabs) scrolls with the page. */
.customer-head .head-top { display: flex; align-items: center; gap: 10px; }
.customer-head .head-top .back { flex: none; min-height: 36px; }
.customer-head .head-top h1 { margin: 0; font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-head .visit-box { margin: 6px 0 0; padding: 7px 10px; }
.customer-head .visit-cover { font-size: 15px; }
.customer-head .visit-notes { max-height: 3.2em; overflow: hidden; font-size: 13px; cursor: pointer; }
.customer-head .visit-notes.open { max-height: 40vh; overflow-y: auto; }
.customer-more { padding-top: 8px; }
/* Call, Text, Navigate, Photo under the visit card. */
.round-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 14px; }
.rbtn { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: 0; padding: 0;
  color: var(--cream-dim); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.rbtn i { font-style: normal; width: 56px; height: 56px; border-radius: 50%; background: var(--ink-3);
  display: grid; place-items: center; font-size: 22px; }
.rbtn:active i { background: var(--gold-dk); }
.rbtn:disabled { opacity: .4; }
.job-tiles + .review-btn { margin-bottom: 12px; }
/* The job's first screen ends in tiles; each opens that part on its own screen. */
.job-tiles { margin: 4px 0 16px; }
.job-tiles .folder-tile { min-height: 72px; }
.job-tiles .folder-tile .nm { font-size: 16px; }
.job-tiles .folder-tile { align-items: flex-start; text-align: left; position: relative; padding-right: 30px; }
/* A small gold arrow, right side, centred top to bottom. */
.job-tiles .go { position: absolute; right: 12px; top: 50%; width: 9px; height: 15px; transform: translateY(-50%);
  fill: none; stroke: var(--gold-lt); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.job-tiles .folder-tile .n:empty { display: none; }
.job-tiles .folder-tile { justify-content: center; }
.job-tiles .folder-tile .ti { display: inline-block; width: 1.4em; }
/* Review link: gold outline and gold words, like the mock-up. */
.review-btn { color: var(--gold-lt); border-color: var(--gold-dk); }
.status-box .actions { margin: 6px 0 12px; }
.status-box .review-btn { margin: 0; }
a.phone-link { color: var(--cream); font-weight: 600; text-decoration: none; }
.job-desc .jd { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.4; }
.job-desc .jd.none { color: var(--muted); font-style: italic; }
.jobtabs button {
  min-height: 44px; padding: 0 16px; border-radius: 999px; white-space: nowrap;
  background: var(--ink-2); color: var(--cream-dim);
  border: 1px solid var(--ink-3); font-size: 14px; font-weight: 600;
}
.jobtabs button.on { background: var(--gold); color: #1a1305; border-color: var(--gold); }

/* Customer stays pinned while the tabs change underneath it. */
.customer-head {
  /* Pinned just under the app's own top bar, never behind it. */
  position: sticky; top: var(--hdr-h, 0px); z-index: 10;
  background: var(--ink); padding-top: 6px; padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-3); margin-bottom: 4px;
}

/* Conversations */
.msg { max-width: 82%; padding: 10px 13px; border-radius: 16px; margin-bottom: 8px; font-size: 15px;
       overflow-wrap: anywhere; }
.msg .tx, .msg .clamp { white-space: pre-line; }
.msg.in  { background: var(--ink-2); border: 1px solid var(--ink-3); border-bottom-left-radius: 5px; }
.msg.out { background: var(--gold-dk); color: #fff; margin-left: auto; border-bottom-right-radius: 5px; }
.msg.call { background: transparent; border: 1px dashed var(--ink-3); color: var(--muted);
            font-size: 13px; text-align: center; max-width: 100%; }
.msg .when { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
/* Pinned just above the tab bar, like a chat app: the newest message sits right above it. */
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px;
            position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 5;
            background: var(--ink); padding: 8px 0; }
.composer textarea { flex: 1; min-height: 52px; }
.composer button { width: 84px; }

/* Membership */
.badge {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; margin-right: 8px;
}
.badge.on  { background: var(--ok); color: #06210f; }
.badge.off { background: var(--ink-3); color: var(--muted); }
select {
  width: 100%; min-height: var(--tap); padding: 14px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); color: var(--cream); font: inherit;
}
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.check input[type=checkbox] { width: 26px; height: 26px; min-height: 26px; accent-color: var(--gold); }

/* Equipment cards */
.unit { background: var(--ink-2); border: 1px solid var(--ink-3);
        border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.unit .t { font-weight: 700; margin-bottom: 6px; }

/* ------------------------------------------------- plan report (Report tab) */
.tri { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.tri-b { flex: 1 1 0; min-height: var(--tap); border-radius: 12px; border: 1.5px solid var(--ink-3);
  background: var(--ink-2); color: var(--cream); font-weight: 700; font-size: 15px; padding: 6px 8px; }
.tri-b.on { background: var(--gold); border-color: var(--gold); color: #1a1305; }
.tri-b.ok.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tri-b.problem.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.pitem-t { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.pchip { min-height: 44px; padding: 6px 12px; border-radius: 22px; border: 1.5px solid var(--ink-3);
  background: transparent; color: var(--cream); font-size: 14px; }
.pchip.on { background: var(--gold-fill); border-color: var(--gold-fill); color: #241a06; font-weight: 700; }
.pslot { margin-bottom: 10px; }
.pthumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pthumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.plan-flag { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--gold-lt); }
.pdone { font-size: 13px; color: var(--muted); align-self: center; }
.err:empty { display: none; }

/* Long texts fold to a few lines; emails show as a subject line. Tap to read. */
.msg .clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.msg .more { display: block; margin-top: 4px; font-size: 13px; font-weight: 700; text-decoration: underline; opacity: .9; }
.msg.tap { cursor: pointer; }
.msg .subj { font-weight: 700; }
.msg .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; display: block; margin-bottom: 2px; }
.msg .prev { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; font-size: 14px; }
.older { display: block; margin: 0 auto 12px; min-height: 40px; padding: 0 16px; background: var(--ink-2);
         color: var(--cream-dim); border: 1px solid var(--ink-3); border-radius: 999px; font-size: 13px; }

/* Full-screen sheet for anything that would otherwise leave the app: a page,
   an email. Always has a way back. */
.viewer { position: fixed; inset: 0; z-index: 60; background: var(--ink); display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ink-3);
              padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; }
.viewer-bar .t { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar button { min-height: 44px; padding: 0 14px; background: var(--ink-2); color: var(--gold-lt);
                     border: 1px solid var(--ink-3); border-radius: 999px; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.viewer .read { flex: 1; overflow: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
                white-space: pre-line; overflow-wrap: anywhere; }

/* One photo at a time: fitted, swipeable, zoomable. */
.swiper { flex: 1; position: relative; overflow: hidden; background: #000; touch-action: none;
          display: flex; align-items: center; justify-content: center; user-select: none; -webkit-user-select: none; }
.swiper img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; will-change: transform; }
.sw-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; min-height: 0; padding: 0;
          border: 0; border-radius: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: 34px; line-height: 1; }
.sw-nav.prev { left: 6px; } .sw-nav.next { right: 6px; }

/* Schedule: month on top, the selected day's visits underneath. */
.cal { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); padding: 10px; margin-bottom: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head .m { font-weight: 700; }
.cal-head button { min-height: 40px; width: 44px; background: var(--ink-3); color: var(--gold-lt); border-radius: 10px; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 11px; color: var(--muted); padding: 4px 0; font-weight: 700; }
.cal-grid button { min-height: 42px; border-radius: 10px; background: none; color: var(--cream);
                   flex-direction: column; gap: 1px; font-weight: 600; font-size: 15px; padding: 0; }
.cal-grid button.out { color: var(--ink-3); }
.cal-grid button.today { color: var(--gold-lt); }
.cal-grid button.sel { background: var(--gold); color: #1a1305; }
.cal-grid .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold-fill); }
.cal-grid button.sel .dot { background: var(--ink); }
.cal-grid .nodot { width: 5px; height: 5px; }
.day-head { color: var(--gold-lt); font-weight: 700; font-size: 14px; margin: 4px 0 8px; display: flex; justify-content: space-between; }

/* Equipment */
.ethumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ethumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.unit .btn-row { margin: 10px 0 0; }
.unit .btn-row button { min-height: 46px; }

/* A customer thread: the messages scroll in their own box (sized by fitChat),
   so the top of the screen never scrolls away. */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-top: 4px; }
.chat .composer { position: static; padding-bottom: 0; background: transparent; }
.thread-head { display: flex; align-items: center; gap: 10px; }
.thread-head h1 { flex: 1; font-size: 18px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-row.three { grid-template-columns: 1fr 1fr 1fr; }
.btn-ghost.bad-btn { color: var(--bad); border-color: var(--bad); }

.unread { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-fill); margin-right: 7px; vertical-align: middle; }

/* ------------------------------------------------------------------ home */
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.box-head h2 { margin: 0; }
.linkish { min-height: 36px; background: none; color: var(--gold-lt); font-size: 14px; padding: 0; }
.seg { display: inline-flex; background: var(--ink-3); border-radius: 999px; padding: 2px; }
.seg button { min-height: 32px; padding: 0 12px; border-radius: 999px; background: none; color: var(--cream-dim); font-size: 13px; }
.seg button.on { background: var(--gold); color: #1a1305; }
select.mini { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; }
.taskseg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.taskseg button { min-height: 44px; border-radius: 12px; background: var(--ink-3); color: var(--cream-dim);
                  font-size: 13px; flex-direction: column; gap: 0; line-height: 1.2; }
.taskseg button b { font-size: 17px; }
.taskseg button.on { background: var(--gold); color: #1a1305; }
.taskseg button.late:not(.on) b { color: var(--bad); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--ink-3); }
.task .grow { flex: 1; min-width: 0; cursor: pointer; }
.task .nm { font-weight: 600; }
.tick { flex: none; width: 28px; min-height: 28px; height: 28px; margin-top: 2px; border-radius: 50%;
        border: 2px solid var(--gold-lt); background: transparent; padding: 0; }
.tick.on { background: var(--gold); border-color: var(--gold); }   /* the shop's own colour */
.task.done .nm { text-decoration: line-through; opacity: .6; }
.task.done .sub2 { opacity: .6; }
.tick.on::after { content: '\2713\FE0E'; color: #1a1305; font-size: 17px; font-weight: 900; }
.tnotes { margin-top: 6px; font-size: 14px; color: var(--cream-dim); white-space: pre-line; overflow-wrap: anywhere; }
.late-t { color: var(--bad); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--ink-3); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--gold-lt); line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--cream-dim); margin-top: 3px; line-height: 1.3; }
.panel .job:last-child { margin-bottom: 0; }

.doc-row { padding: 4px 0 10px; border-bottom: 1px solid var(--ink-3); }
.doc-row:last-child { border-bottom: 0; }
.doc-row .kv { border-bottom: 0; }
.doc-row .btn-ghost { width: 100%; min-height: 44px; }
.doc-status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ink-3); color: var(--cream-dim); }
.doc-status.paid, .doc-status.accepted, .doc-status.invoiced { background: var(--ok-bg); color: var(--ok-text); }
.doc-status.declined, .doc-status.overdue, .doc-status.void, .doc-status.expired { background: var(--bad-bg); color: var(--bad-text); }
.doc-status.sent, .doc-status.viewed, .doc-status.partially_paid { background: var(--gold-bg); color: var(--gold-lt); }
.doc-row .btn-row { gap: 8px; }
#payform label { display: block; margin-top: 10px; }
.eq-ph { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--ink-3); }
.eq-ph img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.eq-ph-acts { display: grid; gap: 6px; flex: 1; }
.eq-ph-acts select, .eq-ph-acts button { min-height: 40px; margin: 0; }
.btn-danger { width: 100%; background: none; color: var(--bad-text); border: 1px solid var(--bad-line); }

/* The visit a job was opened from: what the tech is there to do. */
.visit-box { border: 1px solid var(--gold-dk); border-left: 4px solid var(--gold-lt); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.visit-kind { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.visit-cover { font-size: 17px; font-weight: 700; color: var(--gold-lt); margin-top: 2px; }
.visit-notes { font-size: 14px; margin-top: 6px; white-space: pre-wrap; }

.report-required { text-align: center; font-weight: 800; font-size: 20px; letter-spacing: .04em; color: var(--gold-lt);
  border: 2px solid var(--gold-lt); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; text-transform: uppercase; }

.head-line { color: var(--cream); font-size: 15px; margin-top: 2px; }
.head-line a { color: var(--gold-lt); text-decoration: none; font-weight: 600; }
.jobtabs button { position: relative; }
.red-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #e5484d; margin-left: 5px; vertical-align: top; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--ink-3); color: var(--cream); }
.maint-note { border: 2px solid #e5484d; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.maint-note.done { border-color: var(--ok); }
.maint-head { font-weight: 800; color: var(--bad-text); margin-bottom: 4px; }
.maint-q { font-weight: 700; margin-top: 10px; }
.maint-yn { display: flex; gap: 24px; margin: 8px 0 4px; }
.maint-yn label { display: flex; align-items: center; gap: 8px; font-size: 17px; min-height: 44px; }
.maint-yn input { width: 24px; height: 24px; }
.maint-warn { color: var(--bad-text); font-weight: 700; margin-top: 10px; }

/* ------------------------------------------------------------------ hours */
.hours-mini { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; }
.hours-mini b, .hours-total { color: var(--gold-lt); white-space: nowrap; }
.hours-week { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; margin: 0 0 14px; }
.hours-week #wlabel { text-align: center; font-weight: 700; }
.hours-emp { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 8px; }
.hours-day { display: flex; justify-content: space-between; margin: 12px 0 4px; font-weight: 700; border-top: 1px solid var(--ink-3); padding-top: 10px; }
.hours-punch { display: flex; align-items: center; gap: 10px; padding: 2px 0 2px 10px; font-size: 15px; }
.hours-punch .grow { flex: 1; min-width: 0; }
.hours-punch.open { border-left: 3px solid var(--bad); }
.hours-flags { margin: 8px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.4; }
.hours-form { text-align: left; }
.hours-form h2 { text-align: center; }
.my-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.my-total b { font-size: 28px; color: var(--gold-lt); }
.my-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; text-align: center; }
.my-days > div { background: var(--ink-3); border-radius: 10px; padding: 6px 0; font-size: 12px; color: var(--cream-dim); }
.my-days > div b { display: block; font-size: 15px; color: var(--cream); margin-top: 2px; }
.my-days > div.on { outline: 2px solid var(--gold); }
.pf-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* iPhone draws date/time boxes at their own width and blank when empty:
   make them fill (and never pass) their column like every other input. */
input[type="date"], input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; min-width: 0; max-width: 100%; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
.hours-form .row { text-align: left; }
.in-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3fb950; margin-left: 4px; vertical-align: middle; }
/* Refresh: the header button and the pull-down bar. */
.sync { cursor: pointer; }
.pull-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  background: var(--ink-2); color: var(--gold-lt); font-size: 13px; font-weight: 700;
  padding-top: env(safe-area-inset-top);
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 80;
  background: var(--ink-3); color: var(--cream); border: 1px solid var(--gold-dk);
  border-radius: var(--radius); padding: 12px 14px; font-size: 15px; text-align: center;
}
#main { transition: opacity .15s; }
#main.refreshing { opacity: .25; pointer-events: none; }

/* Checklist (sample, 11/8) */
.chk-box.locked { opacity: .7; }
.chk-prog { height: 8px; background: var(--ink-3); border-radius: 4px; overflow: hidden; margin: 8px 0 10px; }
.chk-prog i { display: block; height: 100%; background: var(--gold); }
.chk-peek { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--ink-3); font-size: 15px; }
.chk-peek .bx, .chk-row .bx { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--gold-dk); flex: none;
  display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #1a1305; }
.chk-peek .kd { margin-left: auto; color: var(--muted); font-size: 12px; }
.chk-box .btn-primary { margin-top: 10px; }
.chk-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 0;
  border: 0; border-top: 1px solid var(--ink-3); background: none; color: var(--cream); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.chk-row .lb { flex: 1; min-width: 0; }
.chk-row.ok .bx { background: var(--gold); border-color: var(--gold); }
.chk-row.ok .lb { color: var(--cream-dim); }
.chk-row .req { color: var(--gold-lt); }
.chk-row .rd { display: flex; align-items: center; gap: 4px; flex: none; }
.chk-row .rd input { width: 76px; min-height: 44px; text-align: center; font-size: 16px; }
.chk-row .rd small { color: var(--muted); width: 18px; }

/* ---- maintenance checklist (11/8) ---- */
.ck-sys.skip { opacity: .7; }
.ck-skip { font-size: 14px; color: var(--cream-dim); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ck-kind { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--cream-dim); margin: 4px 0 8px; }
.ck-kind select { min-height: 44px; font-size: 16px; }
.ck-sec { border-top: 1px solid var(--ink-3); }
.ck-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; background: none; color: var(--cream);
  font-size: 16px; font-weight: 700; text-align: left; padding: 6px 0; }
.ck-head .grow { flex: 1; }
.ck-n { color: var(--muted); font-size: 13px; font-weight: 600; }
.ck-arr { color: var(--gold-lt); width: 14px; }
.ck-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold-dk); flex: none; }
.ck-dot.done { background: var(--ok); border-color: var(--ok); }
.ck-dot.watch { background: var(--warn); border-color: var(--warn); }
.ck-dot.attention { background: var(--bad); border-color: var(--bad); }
.ck-body { padding-bottom: 8px; }
.ck-allgood { margin: 0 0 6px !important; }
.ck-item { padding: 10px 0; border-top: 1px dashed var(--ink-3); }
.ck-item.fixed { box-shadow: inset 3px 0 0 var(--ok); padding-left: 8px; }
.ck-item.watch { box-shadow: inset 3px 0 0 var(--warn); padding-left: 8px; }
.ck-item.attention { box-shadow: inset 3px 0 0 var(--bad); padding-left: 8px; }
.ck-q { font-size: 15px; margin-bottom: 6px; font-weight: 700; }
.ck-cov { font-size: 12.5px; color: var(--muted); margin: -2px 0 8px; line-height: 1.35; }
.ck-q2 { font-size: 13.5px; color: var(--cream-dim); margin: 10px 0 6px; }
.ck-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ck-btns:has(> :nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
.ck-btns:not(:has(> :nth-child(3))) { grid-template-columns: repeat(2, 1fr); }   /* install: All Good · N/A */
.ck-swap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 6px; }
.ck-swap .eq-ph { display: flex; flex-direction: column; gap: 6px; }
.ck-swap img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; }
.ck-btns button { min-height: 48px; border-radius: 10px; background: var(--ink-3); color: var(--cream-dim); font-size: 13.5px; font-weight: 700; padding: 4px 6px; }
.ck-btns button.on.good, .ck-btns button.on.fixed { background: var(--ok); color: #0d1a10; }
.ck-btns button.on.watch { background: var(--warn); color: #241a06; }
.ck-btns button.on.attention { background: var(--bad); color: #fff; }
.ck-btns button.on.na { background: var(--muted); color: var(--ink); }
.ck-note, .ck-other { width: 100%; margin-top: 8px; font-size: 16px; }
.ck-ph { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.ck-ph img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.ck-more { background: none; color: var(--gold-lt); font-size: 13px; padding: 6px 0; min-height: 36px; }
.ck-rds { margin-top: 6px; }
.ck-rd { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--cream-dim); margin-top: 6px; }
.ck-rd input { width: 110px; min-height: 40px; font-size: 16px; text-align: center; }
.ck-rd small { color: var(--muted); }
.ck-rdsel select { min-height: 44px; font-size: 16px; flex: 1; min-width: 0; }
.ck-life { border-top: 1px solid var(--ink-3); padding-top: 10px; margin-top: 8px; }
.ck-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ck-chips button { min-height: 40px; border-radius: 999px; background: var(--ink-3); color: var(--cream-dim); padding: 4px 12px; font-size: 13.5px; }
.ck-chips button.on { background: var(--gold); color: #1a1305; }
.ob-row { border-top: 1px solid var(--ink-3); padding: 10px 0; }
.ob-row .btn-row { margin-top: 8px; }

.ck-sysname { overflow-wrap: anywhere; }
.ck-skipbtn { display: inline-block; width: auto; min-height: 40px; padding: 4px 14px; border-radius: 999px; background: var(--ink-3);
  color: var(--cream-dim); font-size: 14px; font-weight: 600; margin: 2px 0 8px; max-width: 100%; }
.ck-skipbtn.on { background: var(--gold); color: #1a1305; }
.ck-q .sub2 { display: block; font-weight: 400; }
.ck-btns.four { grid-template-columns: repeat(2, 1fr); }
.eq-del { color: var(--bad-text); border-color: var(--bad-line); }
.ck-btns button:disabled { opacity: .4; }
.ck-ph img { cursor: pointer; }
/* Client page: four buttons, 2 x 2, even and centred (11/9). */
.jobtabs.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jobtabs.two button { width: 100%; margin: 0; text-align: center; justify-content: center; }

/* Two checklists on one job: jump between them (11/9). */
.ck-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

/* A choice with a line under it (install removal picker): stacked, left, never side by side. */
.btn-ghost.ck-big { display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 2px; text-align: left; padding: 10px 14px; }
.ck-big .ck-big-h { font-weight: 700; }
.ck-big .sub2 { font-weight: 400; }
/* Install (11/11): delete old equipment rows, labeled install photo lines. */
.ck-oldeq { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid rgba(127,127,127,.2); }
.ck-shot { margin-top: 8px; }
.ck-shot .ck-ph { margin-top: 4px; }

/* Commissions (11/11) */
.comm-line { border-top: 1px solid var(--gold-dk); padding: 8px 0; }
.comm-line.off { opacity: .5; }
.comm-who { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.comm-pay { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--cream); cursor: pointer; }
.comm-pay input { width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--gold); }
.comm-line select { width: auto; min-width: 0; max-width: 62%; min-height: 40px; padding: 6px 10px; font-size: 15px; border-radius: 10px; }
.comm-ask { margin-top: 8px; border: 1.5px solid var(--gold); border-radius: 12px; padding: 10px 12px; background: var(--gold-bg); }
.comm-ask .q { font-weight: 800; color: var(--cream); margin-bottom: 2px; }
.comm-ask .btn-row { margin: 8px 0 0; }
.comm-ans { margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--cream-dim); display: flex; align-items: center; gap: 10px; }
.comm-amt { width: 110px; text-align: right; }
.comm-add { display: grid; gap: 6px; margin-top: 8px; }

/* ------------------------------------------------ Menu (top-left drawer) */
.hdr-menu .burger { font-size: 18px; margin-right: 2px; }
.hdr-menu[hidden] { display: none; }
.drawer { position: fixed; inset: 0; z-index: 65; }
.drawer[hidden] { display: none; }
.drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,.6); opacity: 0; transition: opacity .2s; }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(84vw, 320px); overflow-y: auto;
  background: var(--ink); border-right: 1px solid var(--ink-3);
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px);
  transform: translateX(-100%); transition: transform .2s ease-out; }
.drawer.open .drawer-back { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin-bottom: 4px; }
.drawer-who { margin-bottom: 12px; }
.drawer-panel .row { width: 100%; text-align: left; margin-bottom: 8px; }
.drawer-panel .fic { display: flex; align-items: center; justify-content: center; width: 26px; color: var(--gold-lt); }
.mic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.drawer-sec { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--cream-dim); margin: 14px 0 8px; }
.drawer-ver { text-align: center; }
/* Settings is simply the last item; it scrolls with the rest of the menu. */
.drawer-foot { margin-top: 14px; }

/* Report a problem: screenshot thumbnails */
.shot-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.shot { position: relative; width: 72px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--ink-3); background: var(--ink-2); padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-x { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; min-height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.7); color: #fff; font-size: 13px; padding: 0; cursor: pointer; }
a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ------------------------------------------------------------ light theme */
/* Menu › Settings › Appearance. <html data-theme="light"> is set in index.html
   before the page paints. Every color above is a token, so light mode is only
   this block: cream paper, white cards, dark gold for text accents. */
html[data-theme="light"] {
  --ink: #F7F2E4;          /* page */
  --ink-2: #FFFFFF;        /* cards, inputs */
  --ink-3: #E3D9BF;        /* lines, quiet buttons */
  --gold: #C9971C;
  --gold-lt: #855F05;      /* gold as text on paper */
  --gold-dk: #A97C0C;
  --gold-fill: #EBC660;
  --gold-bg: #F5E7BF;
  --cream: #1D1707;        /* main text */
  --cream-dim: #4F4634;
  --muted: #6B624E;
  --ok: #2F8A4E;
  --warn: #C26F12;
  --bad: #B83A30;
  --ok-bg: #DDF0E2; --ok-text: #1E6B39;
  --bad-bg: #F8DEDB; --bad-text: #A22D24; --bad-line: #E3A9A3;
  --shadow: rgba(40,30,5,.35);
  color-scheme: light;
}
html[data-theme="light"] .modal-back { background: rgba(40,30,5,.45); }
html[data-theme="light"] .drawer-back { background: var(--shadow); }

/* Settings › Appearance: three big choices */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-pick button { min-height: var(--tap); border-radius: 12px; border: 1.5px solid var(--ink-3);
  background: var(--ink-2); color: var(--cream); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.theme-pick button.on { background: var(--gold); border-color: var(--gold); color: #1a1305; }
html[data-theme="light"] .ck-btns button.on.na { color: #fff; }
html[data-theme="light"] .ck-btns button.on.good, html[data-theme="light"] .ck-btns button.on.fixed { background: #23703D; color: #fff; }  /* dark text on --ok was 4.15:1 */
html[data-theme="light"] .folder-tile .n { color: #6E4E03; }  /* --gold-lt on a tile was 4.11:1 */
html[data-theme="light"] .cal-grid button.out { color: #B9AD8E; }
html[data-theme="light"] .msg.out { background: #8A6508; }
html[data-theme="light"] .badge.on, html[data-theme="light"] .chip.complete { background: var(--ok-bg); color: var(--ok-text); }

/* ------------------------------------------------- plan benefits (page + Membership tab) */
.pb-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pb-plan { position: relative; border: 1.5px solid var(--ink-3); border-radius: 12px; padding: 12px 10px 10px; text-align: center; background: var(--ink-2); }
.pb-plan.premium { border-color: var(--gold); background: var(--gold-bg); }
.pb-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--gold-fill); color: #241a06; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.pb-nm { font-weight: 800; color: var(--cream); }
.pb-price { font-size: 28px; font-weight: 800; color: var(--gold-lt); line-height: 1.15; }
.pb-price span { font-size: 14px; font-weight: 600; color: var(--cream-dim); }
.pb-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.pb-table td { padding: 8px 4px; border-top: 1px solid var(--ink-3); vertical-align: top; color: var(--cream); }
.pb-table td:nth-child(2), .pb-table td:nth-child(3) { width: 25%; text-align: center; font-weight: 700; }
.pb-table td.prem { color: var(--gold-lt); }
.pb-table .pb-g th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-dim); padding: 14px 4px 4px; }
.pb-yes { color: var(--ok); font-size: 18px; }
.pb-no { color: var(--muted); }
.pb-list { margin-top: 12px; display: grid; gap: 4px; font-size: 15px; color: var(--cream); }
.pb-lh { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-dim); font-weight: 700; margin-bottom: 2px; }
.pb-terms { margin-top: 12px; font-size: 12px; line-height: 1.4; }
.pb-table .pb-h td { position: sticky; top: calc(env(safe-area-inset-top) + 64px); background: var(--ink-2); border-top: 0;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--cream-dim); z-index: 1; }
.pb-table .pb-h td.prem { color: var(--gold-lt); }
.visit-cover .mem-yes { color: var(--ok); font-weight: 900; }
.visit-cover.not-member { color: var(--bad-text); letter-spacing: .04em; }
.pb-toggle { width: 100%; margin: 0 0 12px; }

/* ------------------------------------------- + button (office: add / book) */
/* Bottom right above the tab bar, like LeadConnector's. Lives inside #main,
   so it goes away with the screen it belongs to. */
.fab {
  position: fixed; z-index: 30; width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 50%;
  right: max(16px, calc((100vw - 640px) / 2 + 16px));
  bottom: calc(74px + env(safe-area-inset-bottom));
  background: var(--gold-fill); color: #241a06; font-size: 32px; font-weight: 400; line-height: 1;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.fab svg { width: 26px; height: 26px; }
.fab-space { height: 72px; }
.find-bar { display: flex; gap: 8px; align-items: center; }
.find-bar input { flex: 1; }
.find-bar .btn-ghost { white-space: nowrap; width: auto; padding: 0 14px; }

/* ------------------------------------------------- company colours (multi-shop) */
/* <html data-brand="invincible"> swaps the gold-on-black palette for
   Invincible's navy / blue / red (read off invinciblehvac.com 11/13). Only the
   brand tokens move: ok / warn / bad stay Escape's, so Invincible's red never
   reads as a warning. Set before paint by applyTheme() in index.html. */
html[data-brand="invincible"] {
  --ink: #020e2c;
  --ink-2: #0c1d47;
  --ink-3: #1d3670;
  --gold: #4fa3ef;
  --gold-lt: #7dbcf3;
  --gold-dk: #2f86d6;
  --gold-fill: #7dbcf3;
  --gold-bg: #10275a;
  --cream: #f1f5fb;
  --cream-dim: #c8d1de;
  --muted: #a9b5c6;
  --brand-stripe: #e63a35;
}
html[data-brand="invincible"][data-theme="light"] {
  --ink: #eef3fa;
  --ink-2: #FFFFFF;
  --ink-3: #c8d1de;
  --gold: #2f86d6;
  --gold-lt: #0c4f94;
  --gold-dk: #1f6fbd;
  --gold-fill: #7dbcf3;
  --gold-bg: #dbeafb;
  --cream: #020e2c;
  --cream-dim: #33405e;
  --muted: #56627a;
  --shadow: rgba(2,14,44,.35);
}
html[data-brand="invincible"] header#hdr { box-shadow: inset 0 -3px 0 var(--brand-stripe); }
html[data-brand="invincible"][data-theme="light"] .msg.out { background: #1f5fa8; }
html[data-brand="invincible"][data-theme="light"] .cal-grid button.out { color: #9aa7bd; }
html[data-brand="invincible"][data-theme="light"] .modal-back { background: rgba(2,14,44,.45); }

/* Which company a visit is for, on a schedule that mixes both. Fixed colours:
   the badge reads the same whatever palette the app is wearing. */
.shop-badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; white-space: nowrap; }
.shop-badge.elevate { background: #E4BA55; color: #241a06; }
.shop-badge.invincible { background: #020e2c; color: #fff; box-shadow: inset 4px 0 0 #e63a35; padding-left: 10px; border: 1px solid #4fa3ef; }
.job.shop-elevate { box-shadow: inset 4px 0 0 #E4BA55; }
.job.shop-invincible { box-shadow: inset 4px 0 0 #e63a35; }

/* Office: which company's full schedule (Anthony, Vince). */
.shop-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0 0 12px; }
.shop-switch button { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--ink-3); background: var(--ink-2);
  color: var(--cream); font-size: 15px; }
.shop-switch button.on.elevate { background: #E4BA55; border-color: #E4BA55; color: #241a06; }
.shop-switch button.on.invincible { background: #020e2c; border-color: #4fa3ef; color: #fff; box-shadow: inset 0 -4px 0 #e63a35; }

/* Two big choices side by side: Monthly / Annual, Standard / Premium generator (11/14). */
.pick2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 12px; }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 60px;
  padding: 10px 12px; border-radius: 12px; background: var(--ink-3); border: 2px solid transparent; color: var(--cream); }
.pick b { font-size: 15px; }
.pick span { font-size: 12px; color: var(--cream-dim); }
.pick.on { border-color: var(--gold); background: var(--ink-2); }
.pb-gen { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ink-3); }

/* Task due cards on the Schedule + the Office placeholder page */
.job.task-card { border-left: 4px solid var(--warn); }
.shop-badge.task { background: var(--warn); color: #241a06; }
.placeholder-page { text-align: center; padding: 36px 8px 24px; }
.placeholder-page h1 { font-size: 26px; margin: 8px 0 6px; }
.ph-tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-lt); border: 1px solid var(--gold-lt); border-radius: 999px; padding: 3px 12px; }
.ph-desc { margin: 22px auto 0; max-width: 520px; font-size: 18px; line-height: 1.5; white-space: pre-wrap; text-align: left;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); padding: 16px; }
.ph-help { margin: 22px auto 0; max-width: 520px; color: var(--muted); font-size: 15px; }
.ph-loc { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px auto 0; max-width: 520px;
  text-align: left; font-size: 17px; color: var(--cream); text-decoration: none;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); padding: 14px 16px; }
.ph-loc span { color: var(--gold-lt); font-weight: 700; white-space: nowrap; font-size: 15px; }
.customer-head .head-top .head-time { flex: none; font-weight: 800; font-size: 17px; color: var(--gold-lt); white-space: nowrap; }

/* Builder: price each per line + discount (11/17) */
.line-edit { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name del" "desc desc" "price total"; gap: 6px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--ink-3); }
.line-edit .le-name { grid-area: name; color: var(--cream); font-weight: 600; }
.line-edit .le-price { grid-area: price; display: flex; align-items: center; gap: 4px; color: var(--muted, #a99f86); font-weight: 600; margin: 0; }
.line-edit .le-del { grid-area: del; justify-self: end; width: 36px; height: 36px; padding: 0; border: 1px solid #7a2a2a; border-radius: 8px; background: transparent; color: #e5534b; font-size: 17px; line-height: 1; cursor: pointer; }
.line-edit .le-del:active { background: #3a1414; }
.line-edit .le-desc { grid-area: desc; width: 100%; box-sizing: border-box; font-size: 15px; line-height: 1.35; padding: 8px 10px; resize: vertical; }
.doc-desc { color: var(--muted, #a99f86); font-size: 14px; white-space: pre-wrap; margin: -2px 0 8px; }
.line-edit .le-total { grid-area: total; text-align: right; font-weight: 700; white-space: nowrap; }
.price-in { width: 110px; min-height: 40px; padding: 6px 10px; font-size: 16px; text-align: right; }
.price-in.changed { border-color: var(--gold); }
.disc-row { display: flex; align-items: center; gap: 10px; padding: 12px 0 6px; }
.disc-row .disc-lbl { flex: 1; font-weight: 600; }
.member-note { margin-top: 14px; font-weight: 800; color: var(--cream); line-height: 1.4; }
.member-note div + div { font-weight: 600; color: var(--gold-lt); }
.member-line span { color: var(--gold-lt); font-weight: 700; }

/* Proposals (11/23): Good / Better / Best / Add-ons tabs in the builder. */
.prop-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 12px; width: 100%; box-sizing: border-box; }
.prop-tabs button { border-radius: 10px; min-height: 46px; line-height: 1.15; padding: 4px 2px; }
.prop-tabs button small { display: block; font-size: 11px; opacity: .85; }
