/* phone_bid.css: the phone bid screen (2026-11-22, Jared: "the app should get
 * its own version of the estimator tab ... tailored just for the phone").
 *
 * Everything here is scoped to #pbRoot or to html.pb-on, so the desktop
 * estimator and its own phone styles are untouched. html.pb-on is set by the
 * small head script in app.html on a phone (or in the iPhone app) before the
 * first paint, and phone_bid.js builds #pbRoot over the estimator once the
 * engine is ready. The desk estimator keeps running underneath: this screen
 * only reads its numbers and presses its own controls.
 *
 * Light only, like the rest of the phone app (field.tokens.css values).
 */

html.pb-on, html.pb-on body { overflow: hidden !important; }
/* Covers the desk layout while the engine loads, so the phone never flashes
   the cramped desktop first. #pbRoot paints over it once it is built. */
html.pb-on body::before {
  content: "Opening the bid\2026";
  position: fixed; inset: 0; z-index: 8990;
  display: flex; align-items: center; justify-content: center;
  background: #f5f6fa; color: #646b7e;
  font: 600 16px/1.4 "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}
html.pb-ready body::before { content: none; display: none; }
/* Desk-only guides that pop on a phone and would sit on top of this screen. */
html.pb-on #onboardOverlay,
html.pb-on #mobileHelpModal,
html.pb-full #onboardOverlay,
html.pb-full #mobileHelpModal { display: none !important; }
/* The desk's "From the field" card opened over the phone bid and covered it
   (TestFlight 10, "this big pop-up"). The job page shows the sketch photo
   and what was read; the phone bid leaves it out. */
html.pb-on #fieldOriginPanel { display: none !important; }

#pbRoot {
  --pb-blue: #3a62e0; --pb-blue-ink: #2f50c4; --pb-wash: #e6ecfc;
  --pb-ink: #1a1d27; --pb-ink-2: #4a4f6a; --pb-muted: #646b7e;
  --pb-bg: #f5f6fa; --pb-surface: #ffffff; --pb-surface-2: #f0f1f5;
  --pb-line: #e0e2ed; --pb-press: #e7eaf3;
  --pb-warn: #8a5a00; --pb-warn-bg: #fbf0d9;
  --pb-bad: #b3261e; --pb-bad-bg: #fbe9e7;
  --pb-ok: #196f43; --pb-ok-bg: #e2f3e9;
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column;
  background: var(--pb-bg); color: var(--pb-ink);
  font: 400 16px/1.45 "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#pbRoot[hidden] { display: none !important; }
#pbRoot *, #pbRoot *::before, #pbRoot *::after { box-sizing: border-box; }
:where(#pbRoot) button { font: inherit; color: inherit; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.pb-top {
  flex: none; display: flex; align-items: center; gap: 4px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px));
  background: var(--pb-bg);
}
.pb-top h1 {
  flex: 1; min-width: 0; margin: 0; font-size: 19px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pb-ib {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--pb-blue); display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
.pb-ib svg { width: 24px; height: 24px; }
.pb-ib:active { background: var(--pb-press); }
.pb-title-btn {
  flex: 1; min-width: 0; border: 0; background: transparent; text-align: left;
  padding: 4px 6px; border-radius: 10px; cursor: pointer;
}
.pb-title-btn b { display: block; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-title-btn small { display: block; font-size: 13px; color: var(--pb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-title-btn:active { background: var(--pb-press); }

/* ── Scrolling body ──────────────────────────────────────────────────── */
.pb-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.pb-sec {
  margin: 8px 2px -4px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--pb-muted);
}
.pb-card { background: var(--pb-surface); border-radius: 16px; padding: 2px 14px; }
.pb-note { font-size: 13px; color: var(--pb-muted); text-align: center; margin: 2px 8px; }
.pb-sub { margin: 0 2px -6px; font-size: 13px; font-weight: 600; color: var(--pb-muted); }
.pb-hint { font-size: 12.5px; line-height: 1.35; color: var(--pb-muted); margin: -4px 2px 0; }
.pb-lock .tov2-lock { margin-top: 0 !important; border-radius: 12px !important; font-size: 13px !important; }
.pb-lock .tov2-lock-btn { min-height: 36px; padding: 8px 14px !important; font-size: 13px !important; }
.pb-btn.pb-slim { min-height: 40px; padding: 8px 12px; font-size: 14px; font-weight: 600; }

/* Total */
.pb-total {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  width: 100%; border: 0; text-align: left; cursor: pointer;
  background: var(--pb-surface); border-radius: 18px; padding: 16px;
}
.pb-total:active { background: var(--pb-press); }
.pb-total small { display: block; font-size: 13px; color: var(--pb-muted); }
.pb-total .pb-n { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.pb-total .pb-r { text-align: right; font-variant-numeric: tabular-nums; }
.pb-total .pb-link { color: var(--pb-blue); font-weight: 700; }

/* Flags */
.pb-flag {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; text-align: left;
  background: var(--pb-warn-bg); color: var(--pb-warn); border-radius: 12px;
  padding: 11px 12px; font-size: 14px; line-height: 1.4; font-weight: 500; cursor: pointer;
}
.pb-flag.pb-bad { background: var(--pb-bad-bg); color: var(--pb-bad); }
.pb-flag.pb-ok { background: var(--pb-ok-bg); color: var(--pb-ok); cursor: default; }
.pb-flag b { font-weight: 700; }
.pb-flag .pb-link { font-weight: 700; text-decoration: underline; white-space: nowrap; }
div.pb-flag { cursor: default; }

/* Rows */
.pb-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; border-top: 1px solid var(--pb-line); background: transparent;
  padding: 13px 0; text-align: left; cursor: pointer; min-height: 56px;
}
.pb-card > .pb-row:first-child { border-top: 0; }
.pb-row:active { background: var(--pb-surface-2); }
.pb-row .pb-t { flex: 1; min-width: 0; }
.pb-row .pb-t b { display: block; font-size: 16px; font-weight: 700; }
.pb-row .pb-t small { display: block; font-size: 13px; color: var(--pb-muted); margin-top: 2px; }
.pb-row .pb-v { text-align: right; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-row .pb-v small { display: block; font-weight: 500; font-size: 12px; color: var(--pb-muted); }
.pb-row .pb-v.pb-np { color: var(--pb-warn); }
.pb-chev { flex: none; width: 9px; height: 15px; color: #b6bacb; }
.pb-row.pb-static { cursor: default; }
.pb-row.pb-static:active { background: transparent; }
.pb-row.pb-sum .pb-t b, .pb-row.pb-sum .pb-v { font-size: 18px; font-weight: 800; }

/* Buttons */
.pb-btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 10px 14px;
  background: var(--pb-blue); color: #fff !important; font-weight: 700; font-size: 15px;
  text-align: center; cursor: pointer; text-decoration: none; min-height: 44px;
}
.pb-btn:active { background: var(--pb-blue-ink); }
.pb-btn.pb-ghost { background: var(--pb-surface); color: var(--pb-blue) !important; }
.pb-btn.pb-ghost:active { background: var(--pb-press); }
.pb-btn.pb-danger { background: var(--pb-surface); color: var(--pb-bad) !important; }
.pb-btn[disabled] { opacity: .5; cursor: default; }
.pb-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Big start choices */
.pb-big {
  display: flex; gap: 14px; align-items: center; width: 100%; border: 0; text-align: left;
  background: var(--pb-surface); border-radius: 16px; padding: 16px; cursor: pointer;
  text-decoration: none; color: var(--pb-ink) !important; min-height: 76px;
}
.pb-big:active { background: var(--pb-press); }
.pb-big .pb-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--pb-wash); color: var(--pb-blue); }
.pb-big .pb-ic svg { width: 24px; height: 24px; }
.pb-big b { display: block; font-size: 17px; font-weight: 700; }
.pb-big small { display: block; color: var(--pb-muted); font-size: 13px; margin-top: 2px; }

/* Dock (thumb bar) */
.pb-dock {
  flex: none; display: flex; gap: 8px;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: var(--pb-surface); border-top: 1px solid var(--pb-line);
}
.pb-dock[hidden] { display: none; }
.pb-dock > * {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: 14px; padding: 7px 0; min-height: 56px;
  background: transparent; color: var(--pb-ink-2) !important; font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.pb-dock > * svg { width: 26px; height: 26px; color: var(--pb-blue); }
.pb-dock > *:active { background: var(--pb-press); }
.pb-dock > .pb-main { background: var(--pb-blue); color: #fff !important; }
.pb-dock > .pb-main svg { color: #fff; }
.pb-dock > .pb-on { color: var(--pb-blue-ink) !important; background: var(--pb-wash); }
/* The shape lock, loud and first (TestFlight 10). */
.pb-lockcard { display: flex; flex-direction: column; gap: 10px; background: #fde7d6; color: #8a3a00;
  border: 2px solid #f97316; border-radius: 14px; padding: 14px; font-size: 15px; line-height: 1.4; }
.pb-lockcard b { font-weight: 800; }
.pb-lockcard .pb-btn { background: #c2410c; }
.pb-lockcard .pb-btn:active { background: #9a3412; }
.pb-addby .pb-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pb-addby .pb-btn svg { width: 18px; height: 18px; }

/* ── Sheets (Add piece, piece, money edits) ──────────────────────────── */
.pb-sheet {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  background: var(--pb-bg);
}
.pb-sheet[hidden] { display: none; }
.pb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pb-chip {
  border: 1px solid var(--pb-line); background: var(--pb-surface); border-radius: 999px;
  padding: 5px 12px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 32px;
}
.pb-chip[aria-pressed="true"] { background: var(--pb-blue); border-color: var(--pb-blue); color: #fff; }
.pb-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pb-fields.pb-f2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pb-fld {
  border: 2px solid transparent; background: var(--pb-surface); border-radius: 14px;
  padding: 9px 12px; text-align: left; cursor: pointer; min-width: 0; min-height: 64px;
}
.pb-fld.pb-on { border-color: var(--pb-blue); }
.pb-fld small { display: block; font-size: 12px; font-weight: 600; color: var(--pb-muted); }
.pb-fld b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; }
.pb-fld b:empty::after { content: "\2013"; color: #b6bacb; }
.pb-live { text-align: center; font-size: 15px; color: var(--pb-ink-2); font-variant-numeric: tabular-nums; min-height: 22px; }
.pb-live b { color: var(--pb-ink); }
.pb-err { color: var(--pb-bad); font-size: 14px; text-align: center; min-height: 20px; }

/* Number pad */
.pb-keys {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: #d3d6de;
}
.pb-keys button {
  border: 0; border-radius: 9px; background: #fff; min-height: 48px;
  font-size: 22px; font-weight: 500; cursor: pointer; padding: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.pb-keys button:active { background: #e3e5ec; }
.pb-keys .pb-k2 { background: #bcc0cb; font-size: 16px; font-weight: 600; }
.pb-keys .pb-go { background: var(--pb-blue); color: #fff; font-size: 16px; font-weight: 700; }
.pb-keys .pb-go:active { background: var(--pb-blue-ink); }

/* Text fields (customer info) */
.pb-in { display: block; }
.pb-in span { display: block; font-size: 13px; font-weight: 600; color: var(--pb-muted); margin: 0 2px 4px; }
.pb-in input {
  width: 100%; border: 1px solid var(--pb-line); border-radius: 12px; background: var(--pb-surface);
  padding: 13px 12px; font: inherit; font-size: 17px; color: var(--pb-ink);
}
.pb-in input:focus { outline: 2px solid var(--pb-blue); outline-offset: 0; border-color: transparent; }

/* Toast */
.pb-toast {
  position: absolute; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 5; background: var(--pb-ink); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 15px; font-weight: 600; max-width: calc(100% - 32px); text-align: center;
}
.pb-toast[hidden] { display: none; }

#pbRoot :focus-visible { outline: 2px solid var(--pb-blue); outline-offset: 2px; }

/* Back to the phone screen from the full estimator on a phone. */
.pb-back-phone {
  position: fixed; z-index: 10005; right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  border: 0; border-radius: 999px; padding: 12px 16px; background: #3a62e0; color: #fff;
  font: 700 15px/1 "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 6px 20px rgba(58, 98, 224, .38); cursor: pointer;
}
.pb-back-phone[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .pb-sheet:not([hidden]) { animation: pbIn .16s ease-out; }
  @keyframes pbIn { from { transform: translateY(14px); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* One price with its unit (TestFlight 10). */
.pb-fld.pb-amt { width: 100%; text-align: left; font-family: inherit; }
.pb-amt-row b { font-family: inherit; }
.pb-amt-row { display: flex; align-items: baseline; gap: 6px; }
.pb-amt-row b { font-size: 34px !important; min-width: 1ch; }
.pb-amt-row i { font-style: normal; font-size: 20px; font-weight: 700; color: var(--pb-muted); white-space: nowrap; }
