:root {
  --teal: #00829B;
  --teal-2: #00ABC8;
  --teal-dark: #0A7E9C;
  --teal-soft: #E6F6F9;
  --ink: #3A464D;
  --ink-2: #4A5760;
  --muted: #6F7D86;
  --line: #DCE1E4;
  --bg: #F3F5F6;
  --card: #ffffff;
  --danger: #B94A48;
  --danger-bg: #F8EBEB;
  --warn: #C47B17;
  --warn-bg: #FBF1DE;
  --ok: #1B7F4A;
  --ok-bg: #E6F4EC;
  --radius: 14px;
  --tap: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 56px;
  --footer-h: 76px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 2px rgba(26, 34, 38, 0.05), 0 8px 24px rgba(26, 34, 38, 0.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; overflow: hidden; overscroll-behavior: none; }
body { padding: 0; overflow: hidden; position: fixed; inset: 0; width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: 16px; }
button { cursor: pointer; touch-action: manipulation; }
img { max-width: 100%; }
#app { height: 100%; height: 100dvh; max-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; min-height: 0; }

.hdr {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--header-h) + var(--safe-t));
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.hdr h1 { font-size: 17px; font-weight: 650; margin: 0; flex: 1; min-width: 0; letter-spacing: -0.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.hdr .header-role { font-weight: 600; color: var(--teal-dark); }
.icon-btn {
  flex: 0 0 var(--tap); width: var(--tap); height: var(--tap);
  border: 0; background: transparent; color: var(--teal-dark);
  border-radius: 12px; display: grid; place-items: center;
  font-size: 20px;
}
.icon-btn:active { background: var(--teal-soft); }
.hdr-actions { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }
.hdr-version {
  font-size: 11px; color: var(--muted); font-weight: 500;
  white-space: nowrap; padding: 0 4px; line-height: 1; flex: 0 0 auto;
}
.icon-refresh { display: block; }
.icon-btn.spinning .icon-refresh { animation: spin .8s linear infinite; }
.hdr .hdr-back, .sheet .hdr-back, .overlay-screen .hdr-back, .markup-bar .hdr-back, .pipe-sheet .hdr-back, .kpi-editor .hdr-back {
  flex: 0 0 auto; width: auto; min-width: var(--tap); padding: 0 10px 0 6px; gap: 4px;
  display: inline-flex; align-items: center; font-size: 15px; font-weight: 650;
  border-radius: 22px; background: var(--teal-soft);
}
.hdr .hdr-back .hb-arrow, .sheet .hdr-back .hb-arrow, .overlay-screen .hdr-back .hb-arrow,
.markup-bar .hdr-back .hb-arrow, .pipe-sheet .hdr-back .hb-arrow, .kpi-editor .hdr-back .hb-arrow { font-size: 18px; line-height: 1; }
@media (max-width: 359px) {
  .hdr .hdr-back .hb-txt, .sheet .hdr-back .hb-txt, .overlay-screen .hdr-back .hb-txt { display: none; }
}
.sheet-back-row, .pipe-sheet-back-row { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.overlay-screen {
  position: fixed; inset: 0; z-index: 80; background: #0e1a1c;
  display: flex; flex-direction: column;
}
.overlay-screen .hdr { background: #0e1a1c; border-bottom-color: rgba(255,255,255,.12); }
.overlay-screen .hdr h1 { color: #fff; }
.overlay-screen .hdr-back { background: rgba(255,255,255,.14); color: #fff; }

.hdr .hdr-dash, .sheet .hdr-dash, .overlay-screen .hdr-dash, .markup-bar .hdr-dash, .pipe-sheet .hdr-dash, .kpi-editor .hdr-dash, .sheet-back-row .hdr-dash, .pipe-sheet-back-row .hdr-dash {
  flex: 0 0 auto; width: auto; min-width: 48px; height: 44px; padding: 2px 6px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; border-radius: 12px; color: var(--teal-dark); background: transparent;
}
.hdr .hdr-dash .hd-txt, .sheet .hdr-dash .hd-txt, .overlay-screen .hdr-dash .hd-txt, .markup-bar .hdr-dash .hd-txt,
.sheet-back-row .hdr-dash .hd-txt, .pipe-sheet-back-row .hdr-dash .hd-txt { font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: .01em; }
.hdr .hdr-back + .hdr-dash, .sheet-back-row .hdr-back + .hdr-dash, .pipe-sheet-back-row .hdr-back + .hdr-dash,
.overlay-screen .hdr-back + .hdr-dash, .markup-bar .hdr-back + .hdr-dash { margin-left: -4px; }
.overlay-screen .hdr-dash { color: #fff; }

.overlay-frame, .overlay-zoom {
  flex: 1; width: 100%; border: 0; background: #111; min-height: 0;
}
.overlay-zoom { display: flex; align-items: center; justify-content: center; overflow: auto; padding: 12px; }
.overlay-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}
.btn[aria-busy="true"] { opacity: 0.9; }

.brand-mark { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; }

.scroll {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 14px 14px calc(var(--footer-h) + var(--safe-b) + 16px);
}
.scroll.no-footer { padding-bottom: calc(24px + var(--safe-b)); }

.ftr {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.ftr .btn { flex: 1; min-width: 0; font-size: 14px; padding-left: 10px; padding-right: 10px; }
.ftr .btn.secondary { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 0; border-radius: 12px;
  background: var(--teal); color: #fff; font-weight: 650; letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; transform: none; }
.btn.secondary { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--teal-dark); box-shadow: none; }
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin: 0 0 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(213,218,221,.7);
}
.card h2 { margin: 0 0 8px; font-size: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.card.tap { cursor: pointer; display: flex; align-items: flex-start; gap: 12px; }
.card.tap:active { background: var(--teal-soft); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.center { text-align: center; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

label.fld { display: block; margin: 0 0 12px; }
label.fld > span, .fld-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin: 0 0 6px; letter-spacing: .01em;
}
.req::after { content: ' *'; color: var(--danger); }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=time], input[type=password], input[type=search],
input[type=url], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
textarea { min-height: 96px; line-height: 1.45; resize: vertical; padding-top: 12px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,130,155,.18);
}
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%236F7D86' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.error-text { color: var(--danger); font-size: 13px; margin: 10px 0 0; min-height: 1em; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.seg button {
  flex: 1 1 0; min-height: var(--tap); min-width: 64px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 8px;
}
.seg button.on { background: var(--teal); color: #fff; border-color: var(--teal); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
  background: var(--bg); color: var(--ink-2);
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.teal { background: var(--teal-soft); color: var(--teal-dark); }
.chip.muted { background: var(--bg); color: var(--muted); }

.banner {
  border-radius: 12px; padding: 12px 14px; margin: 0 0 12px;
  background: var(--warn-bg); color: #7A4E0E; font-size: 14px;
  border-left: 4px solid var(--warn);
}
.banner.bad { background: var(--danger-bg); color: #7A2E2C; border-left-color: var(--danger); }
.banner.ok { background: var(--ok-bg); color: #145C36; border-left-color: var(--ok); }
.banner.teal { background: var(--teal-soft); color: var(--teal-dark); border-left-color: var(--teal); }
.banner strong { display: block; margin-bottom: 2px; }

.login-wrap { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 32px 16px calc(32px + var(--safe-b)); overflow-y: auto; }
.login-logo { display: block; width: 220px; max-width: 70%; margin: 0 auto 18px; }
.login-wrap h1 { text-align: center; font-size: 22px; margin: 0 0 6px; }
.login-wrap .tag { text-align: center; color: var(--muted); margin: 0 0 24px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 8px 0 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 8px; border: 2px solid var(--teal); background: transparent; }
.pin-dots i.on { background: var(--teal); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 400px; margin: 0 auto; }
.keypad button {
  height: 68px; min-height: 64px; width: 100%; border: 0; border-radius: 16px; background: #fff;
  font-size: 24px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow);
}
.keypad button:active { background: var(--teal-soft); }
.keypad button.ghost { background: transparent; box-shadow: none; font-size: 15px; color: var(--teal-dark); }

.logo-home { width: 140px; display: block; margin: 0 0 12px; }

.filters {
  display: flex; gap: 6px; overflow-x: auto; padding: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}
.filters button {
  flex: 0 0 auto; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-weight: 650; font-size: 12px; text-transform: capitalize;
}
.filters button.on { background: var(--teal); color: #fff; border-color: var(--teal); }

.search-box { position: relative; margin-bottom: 12px; }
.search-box input { padding-left: 40px; }
.search-box .mag { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.quote-meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.quote-total { font-weight: 700; color: var(--teal-dark); white-space: nowrap; }
.quote-card { align-items: flex-start; }
.quote-card .meta { flex: 1; min-width: 0; }

.line-item { position: relative; padding-right: 8px; }
.line-item .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.line-item .grid-3 { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 8px; }
.line-item .amounts { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.placeholder-flag { color: var(--warn); font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }

.totals { background: var(--teal-soft); border-radius: 12px; padding: 12px 14px; }
.totals .row { justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals .row.grand { font-size: 18px; font-weight: 700; color: var(--teal-dark); border-top: 1px solid rgba(0,130,155,.2); margin-top: 6px; padding-top: 8px; }

.catalog-list { max-height: 50vh; overflow: auto; }
.catalog-row { text-align: left; width: 100%; border: 0; background: transparent; padding: 12px 0; border-bottom: 1px solid var(--line); display: block; }
.catalog-row:active { background: var(--teal-soft); }
.catalog-row strong { display: block; font-size: 14px; }
.catalog-row span { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 10px; -webkit-overflow-scrolling: touch; }
.tabs button {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 0; background: #fff; color: var(--ink-2); font-weight: 600; font-size: 13px;
}
.tabs button.on { background: var(--teal); color: #fff; }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(26,34,38,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-dismiss {
  position: absolute; inset: 0; border: 0; background: transparent; padding: 0;
}
.sheet {
  position: relative; z-index: 1;
  background: #fff; border-radius: 18px 18px 0 0; width: 100%;
  max-height: 88vh; overflow: auto;
  padding: 16px 16px calc(20px + var(--safe-b));
  box-shadow: 0 -8px 32px rgba(26,34,38,.15);
}
.sheet h2 { margin: 0 0 12px; font-size: 18px; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--footer-h) + var(--safe-b) + 12px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 16px; opacity: 0; pointer-events: none;
  transition: .25s ease; z-index: 50; white-space: normal; text-align: center;
  line-height: 1.35; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.offline-pill {
  position: fixed; top: calc(var(--safe-t) + 8px); right: 10px; z-index: 40;
  background: var(--warn); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; display: none;
}
.offline-pill.show { display: block; }

.preview-frame {
  width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #525659;
}

.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.chev { font-weight: 300; color: var(--muted); margin-left: auto; font-size: 20px; }

.user-row { align-items: flex-start; }
.price-row input[type=number] { min-height: 44px; }
.sync-dot { width: 8px; height: 8px; border-radius: 8px; background: var(--ok); display: inline-block; }
.sync-dot.pending { background: var(--warn); }
.terms-box { font-size: 12px; color: var(--ink-2); white-space: pre-wrap; max-height: 200px; overflow: auto; background: var(--bg); border-radius: 10px; padding: 10px 12px; }

/* Proposal pages — thumbs are 2× the original 72×102 CSS size (144×204),
   with 2× source images so they stay sharp on retina phones. */
.page-list { margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.page-card { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
.page-card .meta { flex: 1; min-width: 0; }
.page-card h3 { margin: 0 0 2px; font-size: 14px; }
.page-desc {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.page-thumb-wrap {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 72 / 102;
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f3;
  border: 1px solid var(--line);
  position: relative;
  box-shadow: 0 1px 3px rgba(26, 34, 38, .08);
}
.page-thumb-wrap.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e8ecee 0%, #f6f7f8 50%, #e8ecee 100%);
  background-size: 200% 100%;
  animation: thumb-shimmer 1.2s ease infinite;
}
@keyframes thumb-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.page-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  opacity: 0;
  transition: opacity .2s ease;
  background: #f4f5f6;
}
.page-thumb.ready { opacity: 1; }
.page-thumb-wrap.has-thumb.is-loading::after { display: none; }
.page-thumb-caption {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 52%;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  pointer-events: none;
  overflow: hidden;
  max-height: 2.4em;
}
.page-thumb-wrap.is-live .page-thumb-caption { display: none; }
.page-thumb-wrap.is-refreshing::before {
  content: '';
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: var(--teal);
  background: rgba(26,34,38,.25);
  animation: thumb-spin .7s linear infinite;
  z-index: 2;
}
@keyframes thumb-spin { to { transform: rotate(360deg); } }
.page-num {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.28);
  pointer-events: none;
}
.page-card.is-sortable { cursor: grab; touch-action: pan-y; }
.page-card.is-sortable .page-thumb { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.page-card.is-drop-slot {
  background: var(--teal-soft);
  border: 2px dashed var(--teal);
  box-shadow: none;
}
.page-card.is-drop-slot > * { visibility: hidden; }
.page-card-ghost {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  transform: scale(1.04) rotate(1.5deg);
  box-shadow: 0 10px 24px rgba(26, 34, 38, .22);
  opacity: .96;
  cursor: grabbing;
}
body.is-page-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
body.is-page-dragging .scroll { overflow-y: auto; }
.page-moves { display: flex; flex-direction: row; gap: 4px; }
.page-moves button { min-height: 36px; min-width: 36px; flex: 1; border: 0; background: var(--bg); border-radius: 8px; color: var(--teal-dark); font-weight: 700; }
@media (min-width: 720px) {
  .page-list { grid-template-columns: 1fr; }
  .page-card { flex-direction: row; align-items: flex-start; gap: 12px; padding: 14px; }
  .page-card h3 { font-size: 15px; }
  .page-moves { flex-direction: column; }
  .page-moves button { flex: 0 0 auto; }
  .page-thumb-wrap { flex: 0 0 144px; width: 144px; height: 204px; aspect-ratio: auto; }
  .page-thumb { width: 144px; height: 204px; }
}
.page-edit { margin-top: 8px; }
.page-card .row.mt { flex-wrap: wrap; gap: 6px; }
.page-card .row.mt .btn { flex: 1 1 auto; min-width: 0; }

.ai-row { display: flex; gap: 8px; margin: 6px 0 12px; }
.ai-row .btn { flex: 1; min-height: 40px; font-size: 13px; }

/* Photos */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.photo { position: relative; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .del, .photo .mk {
  position: absolute; top: 6px; border: 0; border-radius: 16px;
  width: 32px; height: 32px; background: rgba(0,0,0,.55); color: #fff; font-size: 13px;
}
.photo .del { right: 6px; }
.photo .mk { left: 6px; font-size: 11px; width: auto; padding: 0 8px; }
.photo-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-photo {
  border-radius: 12px; border: 1.5px dashed var(--teal);
  background: var(--teal-soft); color: var(--teal-dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-weight: 650; font-size: 13px; min-height: 72px;
  padding: 10px 8px; text-align: center; cursor: pointer;
}
.add-photo input { display: none; }
.cap-input { width: 100%; min-height: 40px; margin-top: 4px; font-size: 13px; }
.photo-upload-status {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(26, 34, 38, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  z-index: 2;
}
.photo-upload-status.is-error { background: rgba(140, 30, 30, .86); flex-wrap: wrap; }
.photo-upload-status .btn { min-height: 28px; padding: 0 8px; font-size: 11px; }
.photo-progress {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: thumb-spin .7s linear infinite;
  flex: 0 0 auto;
}

/* Markup */
.markup-overlay {
  position: fixed; inset: 0; z-index: 80; background: #1a2226;
  display: flex; flex-direction: column;
}
.markup-bar {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: calc(8px + var(--safe-t)) 10px 8px;
  background: #111;
}
.markup-bar button {
  min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px;
  background: #2a3338; color: #fff; font-weight: 650; font-size: 13px;
}
.markup-bar button.on { background: var(--teal); }
.markup-bar button.save { background: var(--ok); }
.markup-colours { display: flex; gap: 4px; }
.swatch { width: 28px !important; min-height: 28px !important; min-width: 28px; border-radius: 14px !important; border: 2px solid transparent !important; padding: 0 !important; }
.swatch.on { border-color: #fff !important; }
.markup-stage { flex: 1; display: grid; place-items: center; overflow: hidden; }
.markup-stage canvas { touch-action: none; max-width: 100%; max-height: 100%; background: #000; }
.markup-text-input {
  position: absolute; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b));
  min-height: 48px; border-radius: 10px; border: 0; padding: 10px 12px;
}

.pdf-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Pricing, pests, dashboard */
.pest-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.pest-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--teal-soft, #e8f4f6); padding: 5px 8px; border-radius: 999px; }
.kpi-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.kpi { background: var(--teal-soft, #e8f4f6); border-radius: 12px; padding: 10px 12px; min-width: 42%; flex: 1; }
.kpi strong { display: block; font-size: 18px; color: var(--teal, #00829B); }
.kpi span { font-size: 11px; color: var(--muted); }
.row.wrap { flex-wrap: wrap; }
.filters { flex-wrap: wrap; }

.update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: var(--teal); color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(26,34,38,.15);
}
.update-banner button {
  min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 0;
  background: #fff; color: var(--teal-dark); font-weight: 700; font-size: 13px;
}
body.has-update-banner { padding-top: 48px; }

.scroll.home-scroll { overscroll-behavior-y: contain; }
.ptr-indicator {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 0; overflow: hidden; margin: 0 -14px 0;
  color: var(--teal-dark); font-size: 13px; font-weight: 600;
  pointer-events: none;
}
.ptr-indicator.show { /* height set inline while pulling */ }
.ptr-spinner {
  width: 16px; height: 16px; border: 2px solid var(--line);
  border-top-color: var(--teal); border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: 0; flex: 0 0 auto;
}
.ptr-indicator.ready .ptr-spinner,
.ptr-indicator.busy .ptr-spinner { opacity: 1; }

.library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.library-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  text-align: left; width: 100%; border: 1px solid var(--line); background: #fff;
  padding: 8px; border-radius: 10px;
}
.library-row:active { background: var(--teal-soft); }
.library-thumb {
  width: 100%; height: auto; aspect-ratio: 54 / 76; object-fit: cover; object-position: top center;
  flex: 0 0 auto; border-radius: 6px; border: 1px solid var(--line); background: var(--bg);
}
.library-meta { min-width: 0; flex: 1; }
.library-meta strong { display: block; font-size: 13px; }
.library-meta span { font-size: 11px; color: var(--muted); }
.artwork-preview {
  display: block; width: 100%; max-width: 360px; height: auto;
  border-radius: 8px; border: 1px solid var(--line); margin: 8px 0 0;
  background: var(--bg);
}
@media (min-width: 720px) {
  .library-grid { grid-template-columns: 1fr; }
  .library-row { flex-direction: row; align-items: flex-start; gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .library-thumb { width: 108px; height: 152px; aspect-ratio: auto; flex: 0 0 108px; }
  .library-meta strong { font-size: 14px; }
  .library-meta span { font-size: 12px; }
}

.quote-card { flex-wrap: wrap; }
.quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.quote-actions .btn { flex: 1 1 calc(50% - 8px); min-width: 96px; }
.quote-actions .btn:not(.secondary):not(.danger) { font-weight: 700; }
.cc-list { margin: 0 0 12px; padding-left: 20px; }
.cc-list li { font-size: 14px; color: var(--ink, #1a2a33); }
.quote-lifecycle-card .quote-actions { margin-top: 8px; }
.chip.archived { background: #eceff1; color: #455a64; }
.reason-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.reason-pick {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  min-height: 40px;
}
.reason-pick.on {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}
.audit-entry h3 { margin-bottom: 4px; }

/* Team invites */
.user-row .user-status { display: inline-block; margin-left: 6px; vertical-align: middle; }
.user-status.invited { background: #fff4d6; color: #7a5b00; }
.user-status.active { background: var(--teal-soft); color: var(--teal-dark); }
.user-meta { margin: 4px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.user-actions .btn { flex: 1 1 auto; min-width: 120px; }
.temp-pin-once {
  margin: 10px 0;
  padding: 12px 14px;
  background: var(--teal-soft);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.temp-pin-once strong.pin {
  display: block;
  margin: 6px 0 0;
  font-size: 26px;
  letter-spacing: 0.16em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
}
.team-audit { margin-top: 16px; }
.team-audit .tiny + .tiny { margin-top: 6px; }

.user-status.not-invited { background: #f3efe4; color: #6a5420; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; font-size: 14px; }
.check input { width: 20px; height: 20px; }

/* Consultant pipelines */
.pipe-card { cursor: pointer; }
.pipe-card .pipe-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 8px; }
.pipe-card .pipe-kpis span { display: block; font-size: 11px; color: var(--muted); }
.pipe-card .pipe-kpis strong { display: block; font-size: 15px; }
.pipe-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
@media (min-width: 720px) {
  .pipe-tiles { grid-template-columns: repeat(4, 1fr); }
}
.pipe-tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pipe-tile span { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
.pipe-tile strong { display: block; margin-top: 4px; font-size: 16px; letter-spacing: -0.02em; }
.pipe-tile.accent { background: var(--teal-soft); border-color: var(--teal); }
.pipe-tabs { display: flex; gap: 6px; margin: 0 0 14px; }
.pipe-bars { display: flex; align-items: flex-end; gap: 4px; height: 88px; margin: 8px 0 16px; padding: 0 2px; }
.pipe-bars button { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; background: none; border: 0; padding: 0; min-width: 0; cursor: pointer; color: inherit; }
.pipe-bars i { display: block; width: 100%; max-width: 22px; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; }
.pipe-bars button.on i { background: var(--ink); }
.pipe-bars em { font-style: normal; font-size: 9px; color: var(--muted); }
.pipe-month-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 720px) {
  .pipe-month-grid { grid-template-columns: 1fr 1fr; }
}
.pipe-month { text-align: left; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; color: inherit; }
.pipe-month.on { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.pipe-month h3 { margin: 0 0 6px; font-size: 16px; }
.pipe-track { height: 10px; background: #ece8df; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.pipe-track > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.pipe-client { margin-bottom: 8px; }
.pipe-client .row-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; margin: 6px 0; font-size: 13px; }
.pipe-table-wrap { display: none; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 16px; }
.pipe-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pipe-table th, .pipe-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.pipe-table th { font-size: 11px; color: var(--muted); font-weight: 600; }
.pipe-table td.notes { white-space: normal; min-width: 140px; }
.pipe-cards { display: block; }
@media (min-width: 900px) {
  .pipe-cards { display: none; }
  .pipe-table-wrap { display: block; }
}
.pipe-phone { color: var(--teal); text-decoration: none; font-weight: 600; }
.pipe-sheet { background: #fff; border-top: 1px solid var(--line); padding: 12px 14px 24px; }
.pipe-year { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.pipe-year select { font-size: 16px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }
.pipe-pay { margin: 0 0 8px; }

.pipe-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.pipe-list-head .pipe-year { margin: 0; }
.pipe-chrome {
  flex: 0 0 auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px 0;
  z-index: 15;
}
.pipe-chrome .pipe-year { margin-bottom: 8px; }
.pipe-chrome .pipe-tabs { margin: 0; padding-bottom: 8px; }
.pipe-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
@media (min-width: 720px) {
  .pipe-hero { grid-template-columns: repeat(4, 1fr); }
}
.pipe-hero-tile {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 14px 12px; color: inherit; min-height: 108px;
  box-shadow: var(--shadow);
}
.pipe-hero-tile span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; line-height: 1.3; }
.pipe-hero-tile strong { display: block; margin: 6px 0 2px; font-size: 22px; letter-spacing: -0.03em; color: var(--ink); }
.pipe-hero-tile em { display: block; font-style: normal; font-size: 11px; color: var(--muted); line-height: 1.35; }
.pipe-hero-tile.accent { background: var(--teal-soft); border-color: var(--teal); }
.pipe-hero-tile.warn { background: var(--warn-bg); border-color: var(--warn); }
.pipe-hero-tile .pipe-track { margin: 8px 0 6px; }
.pipe-fold { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; padding: 0 12px 12px; }
.pipe-fold summary { cursor: pointer; list-style: none; font-weight: 650; padding: 14px 0 8px; }
.pipe-fold summary::-webkit-details-marker { display: none; }
.pipe-fold summary::after { content: "›"; float: right; color: var(--muted); font-size: 18px; transform: rotate(90deg); }
.pipe-fold[open] summary::after { transform: rotate(-90deg); }
.pipe-status { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.pipe-status.green { background: var(--ok); }
.pipe-status.amber { background: var(--warn); }
.pipe-status.red { background: var(--danger); }
.pipe-month-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.pipe-month-head h3 { margin: 0; font-size: 16px; }
.pipe-paid { font-size: 11px; font-weight: 650; color: var(--muted); }
.pipe-paid.paid { color: var(--ok); }
.pipe-paid.unpaid { color: var(--danger); }
.pipe-paid.part-paid { color: var(--warn); }
.pipe-month.status-red { border-color: #e8c4c3; }
.pipe-month.status-amber { border-color: #ead7a8; }
.pipe-month.status-green { border-color: var(--line); }
.pipe-month p { margin: 0 0 2px; font-size: 14px; }
.pipe-client-simple { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: start; }
.pipe-client-simple .pipe-actions { grid-column: 1 / -1; }
.pipe-client-main h3 { margin: 0 0 2px; }
.pipe-client-meta { text-align: right; }
.pipe-client-meta strong { display: block; font-size: 15px; }
.pipe-client-meta .chip { margin-top: 4px; }
.pipe-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.pipe-actions .btn { text-decoration: none; }
.pipe-bucket { margin: 0 0 18px; }
.pipe-bucket h2 { display: flex; align-items: baseline; justify-content: space-between; font-size: 15px; margin: 0 0 8px; }
.pipe-bucket h2 span { font-size: 12px; color: var(--muted); font-weight: 600; }
.pipe-statement { margin-bottom: 10px; }
.pipe-statement-jobs { margin-top: 10px; }
.pipe-compare-pair { margin: 0 0 14px; }
.pipe-compare-pair h3 { margin: 0 0 8px; font-size: 14px; }
.pipe-compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pipe-compare-cols span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.pipe-compare-cols strong { display: block; font-size: 18px; letter-spacing: -0.02em; margin: 2px 0 4px; }

.pipe-hero-wide { grid-template-columns: 1fr; margin-top: 0; }
@media (min-width: 720px) {
  .pipe-hero-wide { grid-template-columns: 1fr 1fr; }
}
.pipe-stage-filters { margin: 0 0 10px; flex-wrap: wrap; }
.chip.stage-hot { background: var(--ok-bg); color: var(--ok); }
.chip.stage-warm { background: var(--warn-bg); color: var(--warn); }
.chip.stage-cooling { background: #F8E8D8; color: #C05616; }
.chip.stage-cold { background: #E4EEF8; color: #2B5C8A; }
.chip.stage-frozen { background: #ECEDEE; color: #5C666E; }
.pipe-client-simple.is-faded { opacity: 0.62; }
.pipe-client-simple.is-faded:hover, .pipe-client-simple.is-faded:focus-within { opacity: 0.9; }
.stage-setting { margin: 0 0 10px; }
.stage-setting h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }

.pipe-rates { margin-bottom: 14px; }
.costs-breakdown { margin: 8px 0 10px; }
.costs-breakdown p { margin: 0 0 2px; }
#costs-to-finalise, [data-testid="costs-to-finalise"] { margin: 0 0 14px; }
[data-testid="costs-to-finalise"] .pipe-client { width: 100%; text-align: left; margin: 8px 0 0; }

.pipe-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.pipe-tabs button { flex: 0 0 auto; }

.kpi-bars { display: grid; gap: 10px; margin: 0 0 14px; }
.kpi-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi-bar header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0 0 6px; }
.kpi-bar header span { font-size: 12px; font-weight: 650; }
.kpi-bar header strong { font-size: 13px; }
.kpi-bar .pipe-track { margin: 0 0 6px; }
.kpi-bar .pipe-track.pace-green > i { background: var(--ok); }
.kpi-bar .pipe-track.pace-amber > i { background: var(--warn); }
.kpi-bar .pipe-track.pace-red > i { background: var(--danger); }
.kpi-bar .pipe-track.pace-grey > i { background: #c5c0b6; }
.kpi-bar em { display: block; font-style: normal; font-size: 11px; color: var(--muted); }
.kpi-hit { color: var(--ok); font-weight: 650; }
.kpi-missed { color: var(--danger); font-weight: 650; }
.kpi-upcoming, .kpi-none { color: var(--muted); font-weight: 650; }
.pipe-month .kpi-line { margin-top: 6px; font-size: 12px; }
.pipe-month .kpi-line span { display: block; }

.fc-periods { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 0 10px; margin: 0 0 8px; }
.fc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.fc-note { margin: 0 0 12px; }
.fc-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 2px 0 0; margin: 8px 0 16px; }
.fc-col { flex: 0 0 22px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 22px; }
.fc-col-bars { display: flex; align-items: flex-end; gap: 1px; height: 96px; width: 100%; }
.fc-col-bars i { display: block; flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; }
.fc-col-bars i.actual { background: var(--teal); }
.fc-col-bars i.forecast { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); opacity: 0.55; }
.fc-col.on i.forecast { opacity: 0.9; box-shadow: inset 0 0 0 1.5px var(--teal); }
.fc-col em { font-style: normal; font-size: 8px; color: var(--muted); line-height: 1; }
.fc-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin: 0 0 12px; }
.fc-legend i { display: inline-block; width: 8px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.fc-legend i.actual { background: var(--teal); }
.fc-legend i.forecast { box-shadow: inset 0 0 0 1.5px var(--ink); }

.kpi-editor .grid-3 { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) {
  .kpi-editor .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.opt-card { margin-top: 12px; }
.opt-card h3 { margin: 0; }
.rec-check { font-size: 13px; font-weight: 650; color: var(--teal-dark); white-space: nowrap; }
