/* [needs-analysis-intake] build: v28-2026-07-22 */
:root {
  color-scheme: light;
  --accent: #2f6b3a;
  --accent-dark: #234f2b;
  --brand-blue: #114b5f;
  --brand-blue-dark: #0c3646;
  --ink: #1f2a24;
  --muted: #6b7a71;
  --line: #dde5e0;
  --bg-soft: #f4f8f5;
  --chip-bg: #eef3ef;
  --chip-active: #2f6b3a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.brand-bar {
  background: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px;
}
.brand-logo {
  height: 42px;
  width: auto;
  max-width: 90%;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 24px 20px 80px; }
header.app-header { margin-bottom: 20px; }
h1 { font-size: 21px; margin: 0 0 4px; color: var(--accent-dark); }
.subtitle { color: var(--muted); margin: 0 0 8px; font-size: 13px; }
.build-info {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.build-info.info { background: var(--bg-soft); color: var(--muted); }
.build-info.ok { background: #eaf6ec; color: var(--accent-dark); }
.build-info.error { background: #fbe9e9; color: #93261f; font-weight: 600; }

.auth-debug {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.auth-gate {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(20, 30, 24, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.auth-gate-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 30px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.auth-gate-box h2 { margin: 0 0 10px; font-size: 17px; color: var(--accent-dark); }
.auth-gate-box p { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.auth-gate-box button { width: 100%; padding: 10px 14px; font-size: 13.5px; }
/* v25: shown only when a login was rejected for being the wrong HubSpot
   account (portal restriction) -- reuses the app's established red. */
.auth-gate-reason { color: #c0392b; font-size: 12.5px; font-weight: 600; margin: -8px 0 16px; line-height: 1.5; }
.auth-status {
  font-size: 12px; color: var(--muted); margin-top: 6px;
}
.auth-status a { color: var(--accent-dark); }

/* v23: "Adjust Aerial Area" overlay -- reuses .auth-gate/.auth-gate-box for
   the fixed centered-overlay backdrop, with overrides here for its wider,
   left-aligned box and normal (non-full-width) buttons. */
.aerial-adjust-box { max-width: 640px; width: 100%; text-align: left; }
.aerial-adjust-box button { width: auto; }
.aerial-adjust-box .footer-actions { justify-content: flex-end; margin-top: 4px; }
.aerial-adjust-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #e5e9e6;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 4px 0 10px;
  cursor: crosshair;
}
#aerialAdjustImg { width: 100%; height: 100%; object-fit: cover; display: block; }
.aerial-adjust-status { min-height: 18px; margin: 0 0 4px; }

/* v26: generic Save/Load Draft dialog (confirmation, iOS tip, draft list) --
   same wider/left-aligned/normal-button overrides as the aerial adjust box. */
.draft-dialog-box { max-width: 420px; width: 100%; text-align: left; }
.draft-dialog-box button { width: auto; }
.draft-dialog-box .footer-actions { justify-content: flex-end; margin-top: 4px; }
.draft-dialog-box p { margin: 0 0 12px; }
.draft-dialog-box code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  word-break: break-all;
}
.draft-list { max-height: 320px; overflow-y: auto; margin: 4px 0 14px; }
.draft-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.draft-list-row:hover { background: var(--bg-soft); border-color: var(--accent); }
.draft-list-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-list-date { color: var(--muted); font-size: 12px; flex-shrink: 0; }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
  background: #fff;
}
.card h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent-dark);
  margin: 0 0 12px;
}
.card.form-section h2 {
  font-size: 17px;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
  background: var(--accent-dark);
  margin: -16px -18px 18px;
  padding: 14px 18px;
  border-radius: 10px 10px 0 0;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=text], input[type=date], input[type=number], textarea, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}
textarea { min-height: 54px; resize: vertical; }
button {
  font-family: inherit;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--accent-dark); }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
#dealQuery { flex: 1; min-width: 200px; }
.deal-result {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px;
  cursor: pointer; background: var(--bg-soft);
}
.deal-result:hover { border-color: var(--accent); }
.deal-result .name { font-weight: 600; }
.deal-result .meta { color: var(--muted); font-size: 12px; }
.selected-deal-wrap { margin-top: 8px; }
.selected-deal {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft); border: 1px solid var(--accent); border-radius: 8px;
  padding: 10px 12px; flex-wrap: wrap; gap: 8px;
}
.selected-deal a { color: var(--accent-dark); font-size: 12px; }
.contact-pull-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.pull-contact-btn { background: #1d6fa5; border-color: #1d6fa5; color: #fff; font-weight: 600; }
.pull-contact-btn:hover { background: #185d8c; border-color: #185d8c; }
.contact-pull-status { font-size: 12.5px; }
.contact-pull-status.ok { color: var(--accent-dark); }
.contact-pull-status.err { color: #93261f; }
.form-toggles { display: flex; gap: 16px; flex-wrap: wrap; }
.form-toggle {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; cursor: pointer; flex: 1; min-width: 220px;
}
.form-toggle.on { border-color: var(--accent); background: var(--bg-soft); }
.form-toggle input { width: 16px; height: 16px; }
.form-section { display: none; }
.form-section.visible { display: block; }
.field-block { margin-bottom: 14px; }
.field-block label.block-label {
  display: block; font-weight: 600; font-size: 12px; color: var(--accent-dark);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em;
}
.field-block.group-block {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 2px solid var(--line);
}
.field-block.group-block:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.field-block.group-block > label.block-label {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-blue);
  padding: 5px 12px;
  border-radius: 5px;
  margin-bottom: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; user-select: none;
}
.chip.active { background: var(--chip-active); border-color: var(--chip-active); color: #fff; }
.other-input { margin-top: 6px; max-width: 260px; }
.status { font-size: 12.5px; margin-top: 10px; padding: 8px 10px; border-radius: 6px; }
.status.ok { background: #eaf6ec; color: var(--accent-dark); }
.status.err { background: #fbe9e9; color: #93261f; }
.status.info { background: var(--bg-soft); color: var(--muted); }
.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* v24: Print, Generate/Send, Save Draft, and Start Over all sit in one row,
   equal width regardless of their different label lengths. flex-basis: 0
   with flex-grow: 1 divides the row evenly; flex-wrap on the shared
   .footer-actions rule already handles narrow screens (each button just
   drops to its own line, same as the mobile @media rule below). */
.footer-actions-quad button { flex: 1 1 0; min-width: 150px; }

.start-over-btn { background: #c0392b; border-color: #c0392b; color: #fff; font-weight: 600; }
.start-over-btn:hover { background: #a5301f; border-color: #a5301f; }

.install-app-btn {
  width: 100%;
  margin-bottom: 16px;
  background: #1d6fa5;
  border-color: #1d6fa5;
  color: #fff;
  font-weight: 600;
}
.install-app-btn:hover { background: #185d8c; border-color: #185d8c; }

.elev-section { margin-top: 14px; }
.elev-side-label { display: block; font-weight: 700; font-size: 13px; color: var(--accent-dark); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.elev-actions-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.elev-wrap { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--bg-soft); }
.elev-increment-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.elev-increment-label { font-size: 12px; color: var(--muted); }
.elev-table { width: 100%; border-collapse: collapse; background: #fff; }
.elev-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--accent-dark); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.elev-table td { padding: 4px 6px; border-bottom: 1px dotted var(--line); }
.elev-table td.elev-dist { font-weight: 600; font-size: 12.5px; white-space: nowrap; width: 60px; }
.elev-table input[type=text] { padding: 4px 6px; font-size: 12.5px; }

.elev-photo-panel { margin: 4px 0 16px; }
.elev-photo-recommend { margin: 0 0 8px; }
.elev-photo-hint { margin: 0 0 8px; font-weight: 600; color: var(--accent-dark); }
.elev-photo-skipped { margin: 0 0 8px; color: var(--muted); font-style: italic; }
/* v22: zoom-viewport is the fixed-size, overflow:hidden box every
   photo/sketch canvas now sits inside; the canvas itself becomes an
   absolutely-positioned child that fills it, so a CSS transform (applied by
   js/zoom-pan.js) can zoom/pan it without ever resizing its actual pixel
   backing store. touch-action: none disables the browser's own native
   pinch-zoom/pan on these elements so our own two-finger gesture handling
   gets the events instead. */
.zoom-viewport { position: relative; overflow: hidden; touch-action: none; }
.zoom-viewport canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }

.zoom-controls { display: flex; gap: 6px; margin: 2px 0 10px; flex-wrap: wrap; }
.zoom-btn { min-width: 40px; padding: 4px 12px; font-size: 16px; font-weight: 700; line-height: 1.2; }
.zoom-reset-btn { min-width: 0; font-size: 11px; font-weight: 600; }

.elev-photo-panel { margin: 4px 0 16px; }
.elev-photo-recommend { margin: 0 0 8px; }
.elev-photo-hint { margin: 0 0 8px; font-weight: 600; color: var(--accent-dark); }
.elev-photo-skipped { margin: 0 0 8px; color: var(--muted); font-style: italic; }
.elev-photo-viewport {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: crosshair;
  margin-bottom: 10px;
}
.elev-photo-btn { background: #1d6fa5; border-color: #1d6fa5; color: #fff; font-weight: 600; }
.elev-photo-btn:hover { background: #185d8c; border-color: #185d8c; }

.am-photo-block { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; background: #fff; }
.am-photo-viewport {
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: crosshair;
  margin-bottom: 10px;
}
.am-measurement-list { list-style: none; margin: 0 0 10px; padding: 0; font-size: 12.5px; }
.am-measurement-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px dotted var(--line); }
.am-measurement-num { color: var(--accent-dark); margin-right: 2px; }
.am-remove-btn { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 12px; padding: 2px 6px; text-decoration: underline; }
.am-add-photo-row { text-align: center; margin-top: 4px; }

.draw-wrap { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg-soft); }
.draw-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.draw-toolbar label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.draw-toolbar input[type=color] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); }
.draw-toolbar input[type=range] { width: 100px; }
.sketch-canvas-viewport {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 6px;
  cursor: crosshair;
}

/* v22: Load Draft (amber/orange, user-approved) and Save Draft (light
   green). Both distinct from the app's other action colors (blue = pull/
   photo actions, red = Start Over/destructive). */
.load-draft-btn { background: #e0932c; border-color: #e0932c; color: #fff; font-weight: 600; }
.load-draft-btn:hover { background: #c67d1e; border-color: #c67d1e; }
.save-draft-btn { background: #8bc34a; border-color: #8bc34a; color: #fff; font-weight: 600; }
.save-draft-btn:hover { background: #7cb342; border-color: #7cb342; }

/* v28: small line under the Finish row showing where drafts currently save
   (Google Drive vs This Device Only), with a link-style button to change it
   at any time via promptDraftStorageChoice(). */
.draft-storage-line { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.draft-storage-line #draftStorageLabel { font-weight: 600; color: var(--text, #333); }
.link-btn {
  background: none; border: none; padding: 0; margin-left: 6px;
  color: #2a6fb0; font-size: 12.5px; font-weight: 600; text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: #1c5488; }

@media (max-width: 640px) {
  .brand-bar { padding: 12px 14px; }
  .brand-logo { height: 32px; }
  .wrap { padding: 16px 12px 60px; }
  h1 { font-size: 18px; }
  .card { padding: 14px 14px; }
  .card.form-section h2 { margin: -14px -14px 14px; padding: 12px 14px; font-size: 15.5px; }
  .row { flex-direction: column; }
  .row button { width: 100%; }
  .footer-actions { flex-direction: column; align-items: stretch; }
  .footer-actions button { width: 100%; }
  .form-toggles { flex-direction: column; gap: 10px; }
  .form-toggle { min-width: 0; }
  .selected-deal { flex-direction: column; align-items: flex-start; }
  .draw-toolbar input[type=range] { width: 70px; }
}

/* v14: the old #print-area / @media print rules are gone -- "Print / Save as
   PDF" now downloads the same jsPDF-generated file used for the HubSpot
   upload (see doPrint() in app.js) instead of rendering a separate HTML
   layout for the browser's native print dialog. */
