/* =============================================================================
   Homefront Construction — field app styling
   Brand: dark navy + white with gold accents. Mobile-first, large touch targets,
   iOS safe-area aware, full-screen standalone.
   ============================================================================= */

:root {
  --navy: #0d1b2a;
  --navy-2: #16273c;
  --navy-3: #1f3650;
  --gold: #c7a14f;
  --gold-soft: #e0c178;
  --white: #ffffff;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #18222e;
  --muted: #667488;
  --line: #e3e8ef;
  --danger: #c0392b;
  --success: #1e8e5a;

  --nav-h: 64px;
  --header-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; } /* 16px stops iOS zoom */

/* ---- header ---------------------------------------------------------------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 16px; padding-right: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; display: inline-flex; color: var(--white); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { color: var(--white); font-weight: 800; letter-spacing: .12em; font-size: 14px; }
.brand-sub { color: var(--gold); font-weight: 600; letter-spacing: .22em; font-size: 9px; margin-top: 2px; }
.auth-chip {
  max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--gold-soft); font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.06); padding: 5px 10px; border-radius: 20px;
}

/* ---- sync banner ----------------------------------------------------------- */
.sync-banner {
  position: fixed; left: 0; right: 0; z-index: 25;
  top: calc(var(--header-h) + var(--safe-top));
  font-size: 12.5px; font-weight: 600; text-align: center; padding: 7px 14px; color: #fff;
}
.sync-banner.offline { background: #6b7280; }
.sync-banner.syncing { background: var(--gold); color: var(--navy); }
.sync-banner.attention { background: #b91c1c; color: #fff; text-decoration: underline; }
.small.err { color: #b91c1c; }

/* ---- main content ---------------------------------------------------------- */
.app-content {
  position: absolute; left: 0; right: 0;
  top: calc(var(--header-h) + var(--safe-top));
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.view { padding: 16px 16px 28px; max-width: 720px; margin: 0 auto; }
.view-title { font-size: 22px; font-weight: 800; color: var(--navy); margin: 4px 0 14px; }
.view-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.view-header .view-title { margin: 4px 0; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 24px 16px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error { color: var(--danger); font-weight: 600; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.stack > * + * { margin-top: 12px; }

/* ---- cards ----------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card h2 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-weight: 600; font-size: 13px; text-align: right; }

/* ---- personal client notes (CRM journal) ----------------------------------- */
.pnote { background: #fffdf5; border: 1px solid #ece3c6; border-left: 3px solid var(--gold, #c7a14f);
  border-radius: 10px; padding: 9px 11px; margin-top: 8px; }
.pnote-text { margin: 0 0 4px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.pnote-foot { align-items: center; }

/* ---- forms ----------------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--navy); margin-bottom: 6px; letter-spacing: .02em; }
.input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--text); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--gold); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.path-preview { color: var(--muted); word-break: break-all; }
.money-input { position: relative; }
.money-sign { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.money-input .input { padding-left: 28px; }

/* ---- buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 15px;
  transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-2); }
.btn-ghost { background: #eef1f6; color: var(--navy); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 16px; font-size: 16px; margin-top: 8px; }
.icon-btn { background: transparent; border: none; color: var(--navy); font-size: 15px; font-weight: 700; padding: 8px; }
.icon-btn.light { color: #fff; }
.chip { padding: 6px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 700; background: #eef1f6; }
.chip.ok { background: rgba(30,142,90,.12); color: var(--success); }

/* segmented control */
.segmented { display: flex; background: #e9edf3; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg-btn { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* ---- list rows ------------------------------------------------------------- */
.list { margin-top: 4px; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px;
}
.list-row:active { background: #f7f9fc; }
.list-icon { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
.list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-chevron { color: #c2cad6; font-size: 22px; font-weight: 400; }
.file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }

/* search */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap .search { padding-left: 42px; }
.search-glyph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-glyph svg { width: 20px; height: 20px; }
.crumb { color: var(--muted); margin: -2px 0 12px; word-break: break-all; }

/* glyphs */
.glyph svg { width: 24px; height: 24px; }
.glyph.folder { color: var(--gold); }
.file-glyph { position: relative; }
.file-glyph svg { color: #9aa7b8; }
.file-glyph.f-pdf svg { color: #d23f31; }
.file-glyph.f-doc svg { color: #2b579a; }
.file-glyph.f-xls svg { color: #217346; }
.file-glyph.f-img svg { color: #7d57c1; }
.ext-tag {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  font-size: 7px; font-weight: 800; color: #fff; background: rgba(0,0,0,.45);
  padding: 1px 3px; border-radius: 3px; text-transform: uppercase; letter-spacing: .03em;
}

/* ---- quick actions (job detail) ------------------------------------------- */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--navy); color: #fff; border: none; border-radius: 12px; padding: 14px 6px;
  font-weight: 700; font-size: 12.5px;
}
.quick-btn:active { background: var(--navy-2); }
.quick-btn .glyph svg { width: 22px; height: 22px; color: var(--gold-soft); }

/* ---- summary --------------------------------------------------------------- */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #f7f9fc; border-radius: 11px; padding: 12px 10px; text-align: center; }
.stat-strong { background: var(--navy); }
.stat-strong .stat-label, .stat-strong .stat-sub { color: rgba(255,255,255,.7); }
.stat-strong .stat-value { color: var(--gold-soft); }
.summary-grid.two { grid-template-columns: repeat(2, 1fr); }
.stat-tap { cursor: pointer; }
.stat-tap:active { filter: brightness(.94); }
.entry-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
.entry-amt { width: 110px; flex: none; }
.job-picker { position: relative; }
.job-suggest { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #d8dee6;
  border-radius: 10px; box-shadow: 0 8px 20px rgba(16,24,40,.14); z-index: 30; max-height: 264px; overflow: auto; }
.job-suggest-item { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0;
  background: none; font: inherit; border-bottom: 1px solid #f1f4f8; cursor: pointer; }
.job-suggest-item:last-child { border-bottom: 0; }
.job-suggest-item:active { background: #f5f8fc; }

/* ---- bid builder ----------------------------------------------------------- */
.bid-rows { display: flex; flex-direction: column; gap: 10px; }
.bid-card { border: 1px solid #e4e9f0; border-radius: 11px; padding: 10px; background: #fafbfd; }
.bid-line { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.bid-line.two { margin-top: 0; }
.bid-line.two > .input { flex: 1; }
.bid-field { flex: 1; margin: 0; }
.bid-rowtot { display: flex; flex-direction: column; align-items: flex-end; min-width: 76px; }
.bid-total { font-weight: 800; color: var(--navy); font-size: 14px; }
.bid-rowtot .field-label { text-align: right; }
.bid-line .icon-btn { align-self: center; margin-bottom: 2px; }
.bid-price { display: flex; align-items: center; justify-content: space-between; padding: 14px; }
.bid-price .stat-label { margin: 0; }
.bid-price .stat-value { font-size: 22px; }
.stat-pos { background: #ecfdf3; }
.stat-pos .stat-value { color: #15803d; }
.stat-neg { background: #fef2f2; }
.stat-neg .stat-value { color: #b91c1c; }
.stat-label { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { display: block; font-size: 18px; font-weight: 800; color: var(--navy); margin: 4px 0 2px; }
.stat-sub { display: block; font-size: 10.5px; color: var(--muted); }

/* ---- photos ---------------------------------------------------------------- */
.photo-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.thumb-x {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 2px solid #fff; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ---- receipt scan ---------------------------------------------------------- */
.receipt-stage { margin-bottom: 16px; }
.scan-target {
  width: 100%; aspect-ratio: 3 / 4; max-height: 56vh;
  background: var(--navy); color: var(--gold-soft);
  border: 2px dashed rgba(199,161,79,.5); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.scan-text { color: #fff; font-weight: 700; font-size: 15px; }
.receipt-preview { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: #000; }

/* ---- loading / toast / modal ---------------------------------------------- */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 20px 4px; justify-content: center; }
.spin { width: 22px; height: 22px; border: 3px solid #d8dee8; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); z-index: 60;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; max-width: 90%; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

.modal-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(13,27,42,.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: #fff; border-radius: 16px; padding: 20px; max-width: 360px; width: 100%; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---- file preview overlay -------------------------------------------------- */
.preview-overlay { position: fixed; inset: 0; z-index: 80; background: #0b1622; display: flex; flex-direction: column; }
.preview-bar {
  display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-top) + 10px) 12px 10px;
  background: var(--navy); color: #fff;
}
.preview-name { flex: 1; min-width: 0; text-align: center; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; }
.preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-text {
  width: 100%; height: 100%; margin: 0; padding: 18px; color: #e8edf4; background: #0b1622;
  white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.55; overflow: auto;
}

/* ---- outbox ---------------------------------------------------------------- */
.outbox-list { display: flex; flex-direction: column; gap: 8px; }
.outbox-item { display: flex; align-items: center; gap: 10px; background: #f7f9fc; border-radius: 10px; padding: 10px 12px; }
.outbox-label { font-weight: 600; font-size: 13.5px; }

/* ---- photo count badge (job list) ----------------------------------------- */
.count-badge {
  flex: 0 0 auto; background: #eef1f6; color: var(--navy); font-size: 11.5px; font-weight: 700;
  padding: 4px 9px; border-radius: 20px; margin-right: 4px;
}

/* ---- quick actions 4-up --------------------------------------------------- */
.quick-actions.four { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-actions.four .quick-btn { padding: 12px 4px; font-size: 11.5px; }

/* ---- photo gallery -------------------------------------------------------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; -webkit-overflow-scrolling: touch; }
.fchip {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 20px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.fchip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-cell {
  position: relative; aspect-ratio: 1; border: none; padding: 0; border-radius: 10px; overflow: hidden;
  background: #e9edf3;
}
.photo-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb.ph-blank { background: repeating-linear-gradient(45deg, #e4e9f0, #e4e9f0 8px, #dde3ec 8px, #dde3ec 16px); }
.cell-cat {
  position: absolute; left: 5px; bottom: 5px; font-size: 9.5px; font-weight: 800; color: #fff;
  background: rgba(13,27,42,.72); padding: 2px 6px; border-radius: 5px; letter-spacing: .02em;
}
.cell-flag {
  position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff;
}
.cell-flag.issue { background: var(--danger); }
.cell-flag.up { background: var(--gold); color: var(--navy); }
.photo-cell.pending .photo-thumb { opacity: .72; }
.empty { grid-column: 1 / -1; }

/* floating action button */
.fab {
  position: fixed; right: 18px; z-index: 35;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: var(--gold); color: var(--navy);
  box-shadow: 0 8px 22px rgba(199,161,79,.5); display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.95); }

/* camera modal */
.cam-overlay { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; }
.cam-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 10px) 14px 10px; color: #fff; }
.cam-title { font-size: 13px; opacity: .85; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-mini { width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 18px; }
.cam-stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cam-video { width: 100%; height: 100%; object-fit: cover; }
.cam-tray { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; min-height: 0; }
.cam-thumb { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; border: 2px solid rgba(255,255,255,.5); }
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cam-count { display: none; }
.cam-controls { display: flex; align-items: center; gap: 14px; padding: 12px 16px calc(var(--safe-bottom) + 18px); }
.cam-cat { flex: 1; padding: 12px; border-radius: 10px; border: none; background: rgba(255,255,255,.14); color: #fff; font-weight: 700; }
.cam-cat option { color: #000; }
.cam-shutter { width: 68px; height: 68px; border-radius: 50%; background: #fff; border: 5px solid rgba(255,255,255,.45); flex: 0 0 auto; }
.cam-shutter:active { transform: scale(.94); }
.cam-save { flex: 1; }

/* full-screen viewer */
.viewer-overlay { position: fixed; inset: 0; z-index: 88; background: #07101a; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-top) + 10px) 12px 10px; background: var(--navy); color: #fff; }
.viewer-meta { text-align: center; font-size: 13px; }
.viewer-stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; }
.viewer-img.zoom { transform: scale(2.2); cursor: zoom-out; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px;
  background: rgba(0,0,0,.32); color: #fff; border: none; font-size: 30px; border-radius: 8px;
}
.viewer-nav.left { left: 8px; } .viewer-nav.right { right: 8px; }
.viewer-caption { display: flex; align-items: center; justify-content: center; gap: 14px; color: #cdd6e2; font-size: 12.5px; padding: 10px 12px calc(var(--safe-bottom) + 14px); }
.viewer-caption a { color: var(--gold-soft); text-decoration: none; }
.vc-pending { color: var(--gold-soft); }

.cell-flag.client { background: var(--gold); color: var(--navy); }
.jobs-links { margin-bottom: 14px; }
.jobs-links .btn { font-size: 13px; padding: 11px 4px; }
.fin-body { margin-top: 4px; }
.fin-chart { position: relative; width: 100%; }
.fin-chart canvas { position: absolute; inset: 0; }
.w9-file { padding: 8px 0; word-break: break-all; }
.fchip.active.issue { background: var(--danger); border-color: var(--danger); color: #fff; }
.fchip.active.client { background: var(--gold); border-color: var(--gold); color: var(--navy); }

/* ---- viewer edit sheet ---------------------------------------------------- */
.viewer-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  background: #fff; border-radius: 18px 18px 0 0; padding: 8px 16px calc(var(--safe-bottom) + 18px);
  transform: translateY(100%); transition: transform .25s ease; max-height: 78%; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.35);
}
.viewer-sheet.open { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #d4dae3; margin: 6px auto 14px; }
.tag-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; background: #eef1f6; color: var(--navy);
  border-radius: 16px; padding: 4px 6px 4px 11px; font-size: 12.5px; font-weight: 600; }
.tag-x { border: none; background: #d6deea; color: var(--navy); width: 17px; height: 17px; border-radius: 50%; font-size: 10px; line-height: 1; }
.toggle-pill { flex: 1; border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 11px; padding: 11px; font-weight: 700; font-size: 13px; }
.toggle-pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- annotation editor ---------------------------------------------------- */
.annot-overlay { position: fixed; inset: 0; z-index: 95; background: #07101a; display: flex; flex-direction: column; }
.annot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--safe-top) + 10px) 12px 10px; background: var(--navy); color: #fff; }
.annot-title { font-size: 14px; font-weight: 700; }
.annot-save { padding: 9px 16px; }
.annot-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.annot-canvas { max-width: 100%; max-height: 100%; touch-action: none; background: #000; border-radius: 6px; }
.annot-bottom { background: var(--navy-2); padding: 10px 12px calc(var(--safe-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; }
.annot-tools, .annot-actions { display: flex; gap: 8px; }
.annot-tool { flex: 1; border: none; border-radius: 9px; background: rgba(255,255,255,.12); color: #fff; padding: 11px 6px; font-weight: 700; font-size: 13px; }
.annot-tool.active { background: var(--gold); color: var(--navy); }
.annot-swatches { display: flex; gap: 10px; justify-content: center; padding: 4px 0; }
.annot-swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); }
.annot-swatch.active { border-color: #fff; transform: scale(1.12); }

/* ---- photo toolbar / selection (Phase C) ---------------------------------- */
.photo-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.tool-pill { flex: 1; border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 11px; padding: 10px 6px; font-weight: 700; font-size: 12.5px; }
.tool-pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.photo-cell.selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.photo-cell.selected::after { content: "✓"; position: absolute; top: 5px; left: 5px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: var(--navy);
  font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.opt-row input { width: 20px; height: 20px; }

/* ---- share sheet ---------------------------------------------------------- */
.share-sheet { max-width: 380px; }
.share-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.share-action { justify-content: flex-start; }

/* ---- compare (before/after) ----------------------------------------------- */
.cmp-overlay { position: fixed; inset: 0; z-index: 92; background: #07101a; display: flex; flex-direction: column; }
.cmp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--safe-top) + 10px) 12px 10px; background: var(--navy); color: #fff; }
.cmp-title { font-size: 14px; font-weight: 700; }
.cmp-save { padding: 9px 16px; }
.cmp-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 10px; }
.cmp-frame { position: relative; max-width: 100%; max-height: 100%; overflow: hidden; border-radius: 8px; background: #000; user-select: none; }
.cmp-img { display: block; max-width: 100%; max-height: 76vh; object-fit: contain; pointer-events: none; }
.cmp-before { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; }
.cmp-before .cmp-img { max-height: 76vh; height: 100%; object-fit: cover; }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-1px); }
.cmp-knob { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px;
  border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.4); cursor: ew-resize; }
.cmp-label { position: absolute; bottom: 8px; font-size: 10.5px; font-weight: 800; color: #fff;
  background: rgba(13,27,42,.7); padding: 3px 8px; border-radius: 5px; letter-spacing: .04em; }
.cmp-label.left { left: 8px; } .cmp-label.right { right: 8px; }
.cmp-hint { text-align: center; color: #9fb0c2; font-size: 12px; padding: 6px 0 calc(var(--safe-bottom) + 12px); }

/* ---- documents (Phase E) -------------------------------------------------- */
.quick-actions.five { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.quick-actions.five .quick-btn { padding: 11px 2px; font-size: 10.5px; }
.quick-actions.five .quick-btn .glyph svg { width: 20px; height: 20px; }

.items-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.item-row { display: flex; gap: 8px; align-items: center; }
.item-desc { flex: 1; }
.item-nums { display: flex; gap: 6px; }
.item-qty { width: 56px; text-align: center; }
.item-unit { width: 80px; }
.item-rm { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: none;
  background: #f0e2e0; color: var(--danger); font-size: 12px; }
.totals-box { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.total-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--text); }
.total-line.strong { font-weight: 800; color: var(--navy); font-size: 15.5px; }

.sig-line-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sig-thumb { height: 34px; max-width: 110px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.sig-status.ok { color: var(--success); font-weight: 700; }

/* signature pad modal */
.sig-overlay { position: fixed; inset: 0; z-index: 96; background: #07101a; display: flex; flex-direction: column; }
.sig-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--safe-top) + 10px) 12px 10px; background: var(--navy); color: #fff; }
.sig-title { font-size: 14px; font-weight: 700; }
.sig-pad { position: relative; flex: 1; margin: 16px; background: #fff; border-radius: 12px; overflow: hidden; }
.sig-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.sig-line { position: absolute; left: 24px; right: 24px; bottom: 34%; border-bottom: 2px solid #cfd6e0; }
.sig-x { position: absolute; left: 24px; bottom: calc(34% + 2px); color: #cfd6e0; font-size: 18px; }
.sig-tools { display: flex; justify-content: center; padding: 0 16px calc(var(--safe-bottom) + 16px); }

/* ---- bottom nav ------------------------------------------------------------ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--navy); display: flex; border-top: 1px solid rgba(255,255,255,.06);
}
.nav-btn {
  flex: 1; background: transparent; border: none; color: rgba(255,255,255,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; padding: 6px 2px;
}
.nav-btn svg { width: 23px; height: 23px; fill: currentColor; }
.nav-btn.active { color: var(--gold); }
.nav-btn:active { color: var(--gold-soft); }
