:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --text: #17201c;
  --muted: #647168;
  --brand: #0f3d2e;
  --brand-2: #1d654d;
  --accent: #d9eadf;
  --danger: #a6362f;
  --warning: #9b6c13;
  --success: #276846;
  --border: #dfe5df;
  --shadow: 0 18px 50px rgba(25, 50, 37, .08);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: rgba(245,246,242,.88); border-bottom: 1px solid rgba(223,229,223,.8); }
.topbar-inner { max-width: 1120px; margin: auto; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 34px; height: 38px; border-radius: 11px 11px 14px 14px; background: var(--brand); display: grid; place-items: center; color: white; box-shadow: inset 0 -3px 0 rgba(255,255,255,.08); }
.brand-mark::before { content: "✓"; font-weight: 900; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.page { width: min(1120px, 100%); margin: 0 auto; padding: 28px 20px 110px; }
.hero { display: grid; grid-template-columns: 1.4fr .8fr; gap: 24px; align-items: stretch; }
.hero-card, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { padding: clamp(26px, 5vw, 52px); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; top: -90px; background: radial-gradient(circle, rgba(29,101,77,.18), rgba(29,101,77,0)); }
.eyebrow { color: var(--brand-2); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 7vw, 4.7rem); line-height: .98; letter-spacing: -.055em; margin-bottom: 18px; max-width: 760px; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -.035em; margin-bottom: 8px; }
h3 { font-size: 1.05rem; margin-bottom: 7px; }
.lede { font-size: clamp(1rem, 2vw, 1.2rem); color: var(--muted); max-width: 650px; line-height: 1.6; }
.money { font-size: clamp(2rem, 5vw, 4rem); font-weight: 850; letter-spacing: -.05em; margin: 10px 0 2px; }
.money-label { color: var(--muted); }

.card { padding: 22px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fbfcfa; }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: .88rem; margin-top: 4px; }

.btn { border: 0; border-radius: 13px; padding: 12px 16px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--brand); color: white; }
.btn.secondary { background: var(--surface-2); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--border); }
.btn.danger { background: #f9e6e3; color: var(--danger); }
.btn.danger-outline { background: #fff; color: var(--danger); border: 1px solid #e5b9b5; }
.btn.danger-outline:hover { background: #fdf1ef; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.field { display: grid; gap: 7px; }
label { font-size: .86rem; color: var(--muted); font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 13px; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(29,101,77,.11); }
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.room-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.check-option { display: flex; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 14px; background: white; font-weight: 650; }
.check-option input { width: auto; margin: 0; }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 30px 0 14px; }
.section-head p { margin: 0; color: var(--muted); }
.property-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.property-meta { color: var(--muted); font-size: .92rem; }
.property-title { font-size: 1.12rem; font-weight: 800; margin-bottom: 6px; }

.progress-wrap { display: grid; gap: 8px; }
.progress-track { height: 10px; background: #e4e9e3; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand-2); border-radius: inherit; transition: width .25s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); }

.room-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.room-tabs::-webkit-scrollbar { display: none; }
.room-tab { border: 1px solid var(--border); background: white; border-radius: 999px; padding: 9px 13px; white-space: nowrap; font-weight: 720; color: var(--muted); }
.room-tab.active { background: var(--brand); color: white; border-color: var(--brand); }
.checklist { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: white; }
.check-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); font-weight: 900; }
.check-row.done .check-icon { background: var(--accent); }
.check-title { font-weight: 750; }
.check-sub { color: var(--muted); font-size: .83rem; margin-top: 2px; }
.check-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }

.capture-panel { position: sticky; bottom: 14px; z-index: 15; width: min(680px, calc(100% - 28px)); margin: 16px auto 0; background: rgba(23,32,28,.94); color: white; border-radius: 20px; padding: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.2); backdrop-filter: blur(12px); display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.capture-panel small { color: rgba(255,255,255,.72); }
.capture-panel .btn { background: white; color: var(--brand); }
.capture-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.btn.secondary-light { background: rgba(255,255,255,.18); color: white; border: 1px solid rgba(255,255,255,.28); }

.evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.evidence-card { background: white; border: 1px solid var(--border); border-radius: 17px; overflow: hidden; box-shadow: 0 8px 25px rgba(25,50,37,.05); }
.photo-frame { position: relative; background: #dde4de; line-height: 0; }
.photo-frame.compact { border-radius: 12px; overflow: hidden; }
.photo-frame-image { width: 100%; height: auto; display: block; }
.photo-overlay-box { position: absolute; box-sizing: border-box; border: 3px solid #d83b2d; border-radius: 14px; background: rgba(216,59,45,.08); }
.photo-overlay-label {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(52%, 190px);
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: #d83b2d;
  color: white;
  font-family: inherit;
  font-size: .70rem;
  font-weight: 820;
  line-height: 1.08;
  text-align: left;
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  visibility: hidden;
}
.photo-overlay-label-index {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255,255,255,.96);
  color: #17201c;
  font-size: .68rem;
  font-weight: 900;
}
.photo-overlay-label-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.photo-overlay-editable {
  appearance: none;
  font-family: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
  z-index: 2;
}
.photo-overlay-editable:focus-visible {
  outline: 3px solid rgba(255,255,255,.98);
  outline-offset: 3px;
}
.photo-annotation-badge { position: absolute; right: 10px; bottom: 10px; background: rgba(15,61,46,.92); color: white; font-size: .72rem; font-weight: 800; line-height: 1; padding: 8px 9px; border-radius: 999px; }
.photo-overlay-box.warning { border-color: #d83b2d; background: rgba(216,59,45,.08); }
.photo-overlay-box.success { border-color: #b3261e; background: rgba(179,38,30,.08); }
.photo-overlay-box.rejected { border-color: #2e7d32; background: rgba(46,125,50,.10); }

/* Distinct colors when a photo has multiple findings. The first finding is always red. */
.photo-overlay-box.palette-1 { border-color: #d83b2d; background: rgba(216,59,45,.10); }
.photo-overlay-box.palette-2 { border-color: #2563eb; background: rgba(37,99,235,.10); }
.photo-overlay-box.palette-3 { border-color: #d97706; background: rgba(217,119,6,.11); }
.photo-overlay-box.palette-4 { border-color: #7c3aed; background: rgba(124,58,237,.10); }
.photo-overlay-box.palette-5 { border-color: #0f766e; background: rgba(15,118,110,.10); }
.photo-overlay-box.palette-6 { border-color: #c026d3; background: rgba(192,38,211,.10); }

.photo-overlay-label.warning { background: #d83b2d; }
.photo-overlay-label.success { background: #b3261e; }
.photo-overlay-label.rejected { background: #2e7d32; }
.photo-overlay-label.palette-1 { background: #d83b2d; }
.photo-overlay-label.palette-2 { background: #2563eb; }
.photo-overlay-label.palette-3 { background: #d97706; }
.photo-overlay-label.palette-4 { background: #7c3aed; }
.photo-overlay-label.palette-5 { background: #0f766e; }
.photo-overlay-label.palette-6 { background: #c026d3; }
.photo-overlay-label.active { box-shadow: 0 0 0 2px rgba(255,255,255,.92), 0 3px 10px rgba(0,0,0,.22); }
.photo-overlay-label[data-adjust] { cursor: pointer; touch-action: manipulation; }
.photo-overlay-label[data-adjust]:focus-visible { outline: 3px solid rgba(255,255,255,.98); outline-offset: 2px; }

.photo-overlay-box.active { box-shadow: 0 0 0 2px rgba(255,255,255,.85) inset; }
.evidence-body { padding: 13px; }
.finding-title { font-weight: 800; margin-bottom: 6px; }
.annotation-note { margin-top: 10px; padding: 10px 11px; border-radius: 12px; background: #f7f4ed; color: #6b5320; font-size: .82rem; line-height: 1.42; border: 1px solid #ecdfc2; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--brand); font-size: .73rem; font-weight: 780; }
.tag.warning { background: #fff3d9; color: var(--warning); }
.tag.success { background: #e4f2e9; color: var(--success); }
.tag.rejected { background: #ecefec; color: var(--muted); }
.tag.not-damage { background: #e2f4e6; color: #246a35; }
.finding-desc { color: var(--muted); line-height: 1.45; min-height: 40px; }
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-row { display: flex; gap: 7px; margin-top: 11px; }
.action-row .btn { flex: 1; padding: 9px 10px; font-size: .83rem; }
.finding-actions { flex-wrap: wrap; }
.finding-actions .btn { min-width: 120px; }
.finding-item { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #fbfcfa; }
.finding-item.warning { border-color: #f1dfb5; background: #fffaf0; }
.finding-item.success { border-color: #cfe1d6; background: #f5fbf7; }
.finding-item.rejected { border-color: #c9e3cf; background: #f3fbf5; }
.finding-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; margin-bottom: 8px; }
.finding-mini { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.decision-btn.selected-not-damage { background: #2e7d32; color: white; border: 1px solid #2e7d32; }
.decision-btn.selected-confirmed { background: var(--brand); color: white; border: 1px solid var(--brand); }
.finish-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.attention-pulse { animation: attentionPulse 1.6s ease; }
@keyframes attentionPulse {
  0%, 100% { box-shadow: inherit; }
  20%, 65% { box-shadow: 0 0 0 4px rgba(29,101,77,.22), 0 12px 30px rgba(25,50,37,.10); }
}

.notice { padding: 13px 15px; border-radius: 13px; background: #edf4f0; color: var(--brand); line-height: 1.45; border: 1px solid #d8e8de; }
.notice.warning { background: #fff8e8; border-color: #f1dfb5; color: #79530e; }
.empty { padding: 42px 22px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); background: rgba(255,255,255,.6); }
.empty strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 7px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(9,18,14,.52); display: grid; place-items: center; padding: 18px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: white; border-radius: 24px; padding: 22px; box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.modal-wide { width: min(760px, 100%); }
.adjust-modal { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: min(92dvh, 920px); max-height: min(92dvh, 920px); position: relative; }
.adjust-modal-scroll { flex: 1 1 auto; min-height: 0; padding: 22px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.adjust-action-bar { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; padding: 12px; background: rgba(255,255,255,.98); border-top: 1px solid var(--border); box-shadow: 0 -10px 24px rgba(23,32,28,.08); position: relative; z-index: 5; }
.adjust-action-bar .btn { min-height: 46px; }
.slider-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.slider-value { color: var(--brand-2); font-weight: 800; }
.modal-actions { display: flex; gap: 9px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.bottom-nav { display: none; }
.status-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: var(--success); margin-right: 5px; }
.kicker { color: var(--muted); font-size: .9rem; }

.report-photo-stack { display: grid; gap: 12px; }
.photo-stack-label { font-size: .8rem; font-weight: 800; color: var(--muted); margin-bottom: 7px; }
.report-issue { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 18px; padding: 18px 0; border-top: 1px solid var(--border); }
.report-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; font-size: .86rem; }

.visually-hidden { position: fixed; left: -10000px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
  .evidence-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .report-issue { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .topbar-inner { padding: 12px 14px; }
  .top-actions .desktop-only { display: none; }
  .page { padding: 20px 14px 120px; }
  .hero-card, .card { border-radius: 18px; }
  .hero-card { padding: 26px 20px; }
  h1 { font-size: 2.55rem; }
  .grid.two, .grid.three, .evidence-grid { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .property-row { grid-template-columns: 1fr; }
  .property-row .btn { width: 100%; }
  .capture-panel { bottom: 12px; grid-template-columns: 1fr; }
  .check-row { grid-template-columns: 32px 1fr; }
  .check-actions { grid-column: 1 / -1; justify-content: stretch; }
  .check-actions .btn { flex: 1; }
  .capture-actions { justify-content: stretch; }
  .capture-actions .btn { flex: 1; }
  .room-option-grid, .slider-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 8px; min-height: 100dvh; height: 100dvh; overflow: hidden; align-items: stretch; }
  .adjust-modal {
    width: 100%;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
    margin: 0 auto;
  }
  .adjust-action-bar {
    grid-template-columns: repeat(2, minmax(0,1fr));
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  /* Put the two actions users need to finish the edit in the always-visible first row. */
  #saveAdjust { grid-column: 1; grid-row: 1; }
  #saveConfirmAdjust { grid-column: 2; grid-row: 1; }
  #revertAdjust { grid-column: 1; grid-row: 2; }
  #deleteAdjustBox { grid-column: 2; grid-row: 2; }
  .adjust-action-bar .btn {
    min-width: 0;
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
    white-space: normal;
    line-height: 1.15;
  }
  .adjust-modal-scroll { padding: 16px; }
  .finding-actions .btn { min-width: calc(50% - 5px); }
}

@media print {
  @page { margin: 0.55in; }

  html, body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topbar, .capture-panel, .no-print, .bottom-nav { display: none !important; }
  .page { width: 100%; max-width: none; padding: 0; }
  .card, .hero-card { box-shadow: none; border: 0; padding: 0; }

  /* Start the evidence detail section on a clean page. */
  .report-conditions-card {
    break-before: page;
    page-break-before: always;
  }

  /* Keep a complete issue together instead of splitting an image at a page edge. */
  .report-issue {
    display: block;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
    padding: 16px 0;
    margin: 0;
  }

  /* Original and highlighted versions sit side-by-side in print to reduce page height. */
  .report-photo-stack {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
    align-items: start;
    margin-bottom: 14px;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  .report-photo-stack > div,
  .report-photo-stack .photo-frame,
  .report-photo-stack img {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  .report-photo-stack .photo-frame {
    width: 100%;
    overflow: hidden;
  }

  .report-photo-stack .photo-frame-image {
    width: 100%;
    height: auto;
    display: block;
  }

  .report-issue > div:last-child { margin-top: 8px; }

  .report-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .annotation-note,
  .notice {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }
}

/* Bounding box zoom controls */
.zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 8px;
}
.zoom-btn, .zoom-level {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--brand);
  min-width: 44px;
  height: 40px;
  border-radius: 12px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}
.zoom-btn { font-size: 1.35rem; line-height: 1; }
.zoom-level { min-width: 72px; font-size: .82rem; }
.zoom-btn:disabled { opacity: .38; cursor: default; }
.box-editor-viewport {
  width: 100%;
  overflow: auto;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  background: #dde4de;
  scrollbar-width: thin;
}

/* Direct highlight editor: touch and mouse friendly */
.box-editor {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  border-radius: 16px;
  background: #dde4de;
  margin-top: 0;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.box-editor-image {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.box-editor.is-fitted {
  max-width: none;
}
.box-editor.is-fitted .box-editor-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.editable-box {
  position: absolute;
  border: 3px solid #d83b2d;
  border-radius: 14px;
  background: rgba(216,59,45,.10);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.10), 0 0 0 2px rgba(255,255,255,.85) inset;
  cursor: move;
  touch-action: none;
  min-width: .5%;
  min-height: .5%;
}
.editable-box-label {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #d83b2d;
  color: white;
  font-size: .75rem;
  font-weight: 850;
  line-height: 1;
  padding: 7px 9px;
  border-radius: 9px;
  pointer-events: none;
}
.resize-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid white;
  border-radius: 999px;
  background: #d83b2d;
  box-shadow: 0 2px 7px rgba(0,0,0,.25);
  touch-action: none;
}
.resize-handle.nw { left: -12px; top: -12px; cursor: nwse-resize; }
.resize-handle.ne { right: -12px; top: -12px; cursor: nesw-resize; }
.resize-handle.sw { left: -12px; bottom: -12px; cursor: nesw-resize; }
.resize-handle.se { right: -12px; bottom: -12px; cursor: nwse-resize; }

@media (max-width: 580px) {
  .resize-handle { width: 30px; height: 30px; }
  .resize-handle.nw { left: -15px; top: -15px; }
  .resize-handle.ne { right: -15px; top: -15px; }
  .resize-handle.sw { left: -15px; bottom: -15px; }
  .resize-handle.se { right: -15px; bottom: -15px; }
}


/* Secure cloud account */
.auth-shell { min-height: 100vh; padding: 28px 18px; display: grid; place-items: center; background: radial-gradient(circle at top right, rgba(29,101,77,.12), transparent 35%), var(--bg); }
.auth-brand { position: fixed; top: 24px; left: 28px; display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 1.05rem; letter-spacing: -.02em; }
.auth-card { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow); padding: clamp(24px, 5vw, 42px); }
.auth-card h1 { font-size: clamp(2rem, 7vw, 3.4rem); margin-top: 8px; }
.auth-form { display: grid; gap: 14px; margin-top: 22px; }
.auth-links { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.text-button { appearance: none; border: 0; padding: 0; background: transparent; color: var(--brand-2); font: inherit; font-weight: 750; cursor: pointer; }
.auth-security { margin-top: 24px; padding: 15px; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-size: .85rem; line-height: 1.5; }
.auth-security strong { color: var(--text); }
.account-chip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 11px; font-size: .8rem; }
@media (max-width: 580px) {
  .auth-shell { padding: 78px 14px 20px; place-items: start center; }
  .auth-brand { top: 20px; left: 18px; }
  .auth-card { border-radius: 20px; padding: 24px 18px; }
  .auth-links { display: grid; gap: 12px; }
  .auth-links .text-button { text-align: left; }
}

@media (max-width: 580px) {
  .zoom-toolbar { justify-content: center; }
  .zoom-btn, .zoom-level { height: 44px; }
}


/* First-run instructions */
.onboarding-shell {
  min-height: 100vh;
  padding: 36px 18px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top right, rgba(29,101,77,.10), transparent 36%), var(--bg);
}
.onboarding-card {
  width: min(760px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 44px);
}
.onboarding-card h1 {
  font-size: clamp(2.2rem, 7vw, 4rem);
  margin: 8px 0 10px;
}
.onboarding-steps {
  display: grid;
  gap: 12px;
  margin: 26px 0 18px;
}
.onboarding-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.onboarding-step:first-child { border-top: 0; }
.onboarding-step > span {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-weight: 900;
}
.onboarding-step strong { font-size: 1rem; }
.onboarding-step p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.onboarding-note { margin: 18px 0; }
.onboarding-continue { min-height: 52px; margin-top: 8px; }

.tag.manual { background: #eef2ff; color: #4338ca; }
#manualFlagForm textarea { resize: vertical; min-height: 88px; }


@media (max-height: 520px) {
  .modal-backdrop { padding: 4px; }
  .adjust-modal { height: calc(100dvh - 8px); max-height: calc(100dvh - 8px); border-radius: 14px; }
  .adjust-modal-scroll { padding: 10px 12px; }
  .adjust-modal-scroll .kicker { font-size: .78rem; line-height: 1.3; }
  .adjust-action-bar { padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); gap: 6px; }
  .adjust-action-bar .btn { min-height: 40px; font-size: .78rem; }
}


.room-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 9px;
  margin-top: 8px;
}
.add-room-tab {
  border-style: dashed;
  color: var(--brand);
  font-weight: 850;
}
.add-room-tab:hover {
  border-color: var(--brand);
  background: #edf4f0;
}
@media (max-width: 580px) {
  .room-suggestion-grid { grid-template-columns: 1fr; }
}


/* Tiny defects keep their precise stored bbox, but get a larger display-only target
   so a pinhole/stain remains visible and tappable on mobile. */
.photo-overlay-box.tiny-finding {
  border-radius: 999px;
  background: rgba(216,59,45,.05);
}
.photo-overlay-box.tiny-finding .photo-overlay-label {
  top: auto;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 8px;
  font-size: .68rem;
}
.photo-overlay-box.tiny-finding}


.room-step-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 2px 0 14px;
}
.room-step-actions > :last-child { justify-self: end; }
@media (max-width: 580px) {
  .room-step-actions .btn { width: 100%; }
}


/* Full-screen highlight editor */
.adjust-backdrop {
  padding: 0 !important;
  display: block;
  background: #111;
}
.fullscreen-adjust {
  width: 100vw !important;
  max-width: none !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.adjust-header {
  flex: 0 0 auto;
  min-height: 72px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  z-index: 8;
}
.adjust-header h2 {
  margin: 1px 0 0;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  line-height: 1.1;
}
.adjust-help {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.25;
  margin-top: 3px;
}
.adjust-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.adjust-canvas-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #202522;
}
.fullscreen-adjust .zoom-toolbar {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 10px;
  justify-content: center;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--border);
  z-index: 6;
}
.fullscreen-adjust .box-editor-viewport {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #202522;
}
.fullscreen-adjust .box-editor {
  flex: 0 0 auto;
  border-radius: 0;
  margin: auto;
}
.fullscreen-adjust .adjust-action-bar {
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom)) !important;
  gap: 7px;
  background: #fff;
  z-index: 10;
}
.fullscreen-adjust #saveAdjust { grid-column: 1; grid-row: 1; }
.fullscreen-adjust #saveConfirmAdjust { grid-column: 2; grid-row: 1; }
.fullscreen-adjust #revertAdjust { grid-column: 1; grid-row: 2; }
.fullscreen-adjust #deleteAdjustBox { grid-column: 2; grid-row: 2; }
.fullscreen-adjust .adjust-action-bar .btn {
  min-height: 44px;
  width: 100%;
  white-space: normal;
  line-height: 1.1;
}
@media (max-height: 600px) {
  .adjust-header { min-height: 58px; padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; }
  .adjust-help { display: none; }
  .fullscreen-adjust .zoom-toolbar { padding: 5px 8px; }
  .fullscreen-adjust .adjust-action-bar { padding-top: 6px !important; padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important; }
  .fullscreen-adjust .adjust-action-bar .btn { min-height: 38px; font-size: .78rem; }
}


/* Confirmed findings collapse to a locked green review state. */
.finding-item.confirmed-locked {
  background: #e8f5ec !important;
  border-color: #9fc9ad !important;
  box-shadow: inset 0 0 0 1px rgba(39,104,70,.08);
}
.confirmed-status-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.undo-confirm-btn {
  background: #fff;
  color: var(--success);
  border: 1px solid #a8cdb5;
  padding: 7px 10px;
  min-height: 32px;
  border-radius: 10px;
  font-size: .76rem;
}
.undo-confirm-btn:hover { background: #f7fcf8; }

/* Hard fullscreen override for highlight adjustment. */
.adjust-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}
.adjust-backdrop > .fullscreen-adjust {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 100vw !important;
  min-height: 100dvh !important;
  border-radius: 0 !important;
  transform: none !important;
}
.fullscreen-adjust .adjust-canvas-shell {
  min-height: 0 !important;
  flex: 1 1 0 !important;
}
.fullscreen-adjust .box-editor-viewport {
  min-height: 0 !important;
  flex: 1 1 0 !important;
}


/* Body-level modal portal: guarantees full-viewport highlight editing on mobile. */
#modalPortal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 10000;
  display: none;
  pointer-events: none;
}
#modalPortal.active {
  display: block;
  pointer-events: auto;
}
.movevidence-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}
#modalPortal .adjust-backdrop {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
#modalPortal .adjust-backdrop > .fullscreen-adjust {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
#modalPortal .fullscreen-adjust .adjust-canvas-shell {
  width: 100%;
  min-width: 0;
}
#modalPortal .fullscreen-adjust .box-editor-viewport {
  width: 100%;
  max-width: none;
}


/* Prevent white repaint flashes on mobile during SPA rerenders and modal transitions. */
html {
  background: #f5f6f2 !important;
  min-height: 100%;
  overscroll-behavior-y: none;
}
body,
#app,
.app-shell {
  background: #f5f6f2;
  min-height: 100vh;
  min-height: 100svh;
}
body {
  overflow-x: hidden;
}
#app {
  isolation: isolate;
}
#modalPortal {
  background: transparent;
  overscroll-behavior: contain;
  touch-action: manipulation;
}
#modalPortal.active {
  background: rgba(9,18,14,.52);
}
#modalPortal .modal-backdrop {
  overscroll-behavior: contain;
}


/* Mobile highlight editor is a standalone page, not a modal. */
.mobile-adjust-page {
  width: 100%;
  min-width: 100%;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.mobile-adjust-page .adjust-header {
  flex: 0 0 auto;
}
.mobile-adjust-page .adjust-canvas-shell {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}
.mobile-adjust-page .zoom-toolbar {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 10px;
  justify-content: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.mobile-adjust-page .box-editor-viewport {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: auto !important;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #202522;
}
.mobile-adjust-page .box-editor {
  flex: 0 0 auto;
  max-width: none;
  border-radius: 0;
}
.mobile-adjust-page .adjust-action-bar {
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  gap: 7px;
  padding: 8px 9px calc(8px + env(safe-area-inset-bottom)) !important;
  background: #fff;
  z-index: 10;
}
.mobile-adjust-page #saveAdjust { grid-column: 1; grid-row: 1; }
.mobile-adjust-page #saveConfirmAdjust { grid-column: 2; grid-row: 1; }
.mobile-adjust-page #revertAdjust { grid-column: 1; grid-row: 2; }
.mobile-adjust-page #deleteAdjustBox { grid-column: 2; grid-row: 2; }
.mobile-adjust-page .adjust-action-bar .btn {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 7px;
  font-size: .82rem;
  white-space: normal;
  line-height: 1.1;
}
@media (max-width: 700px) {
  body:has(.mobile-adjust-page) {
    background: #202522;
  }
  .mobile-adjust-page .adjust-header {
    min-height: 64px;
    padding: calc(7px + env(safe-area-inset-top)) 10px 7px;
  }
  .mobile-adjust-page .adjust-close {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
}


/* Stabilize mobile scrolling/compositing. */
@media (max-width: 700px) {
  .topbar {
    background: #f5f6f2 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .capture-panel {
    position: relative !important;
    bottom: auto !important;
    background: #17201c !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 10px 28px rgba(0,0,0,.16);
  }

  .page,
  .card,
  .evidence-card,
  .check-row,
  .finding-item {
    transform: none !important;
    backface-visibility: visible;
  }
}

@media (hover: none), (pointer: coarse) {
  .btn {
    transition: opacity .12s ease, background .12s ease !important;
  }
  .btn:hover,
  .btn:active {
    transform: none !important;
  }
}


/* Mobile highlighter: compact controls and block browser-level pinch zoom. */
@media (max-width: 700px) {
  .mobile-adjust-page {
    touch-action: none;
  }

  .mobile-adjust-page .adjust-header {
    min-height: 52px !important;
    padding: calc(5px + env(safe-area-inset-top)) 8px 5px !important;
    gap: 8px;
  }

  .mobile-adjust-page .adjust-header .eyebrow {
    font-size: .66rem;
    line-height: 1;
  }

  .mobile-adjust-page .adjust-header h2 {
    font-size: .96rem;
    margin: 1px 0 0;
  }

  .mobile-adjust-page .adjust-help {
    display: none;
  }

  .mobile-adjust-page .adjust-close {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    font-size: 1.35rem;
  }

  .mobile-adjust-page .zoom-toolbar {
    padding: 4px 7px !important;
    gap: 6px;
  }

  .mobile-adjust-page .zoom-btn,
  .mobile-adjust-page .zoom-level {
    height: 34px;
    min-width: 38px;
    border-radius: 10px;
  }

  .mobile-adjust-page .zoom-level {
    min-width: 62px;
    font-size: .76rem;
  }

  .mobile-adjust-page .adjust-action-bar {
    grid-template-columns: 1fr 1.35fr 1fr 1fr !important;
    grid-template-rows: 40px !important;
    gap: 5px !important;
    padding: 6px 7px calc(6px + env(safe-area-inset-bottom)) !important;
  }

  .mobile-adjust-page #saveAdjust,
  .mobile-adjust-page #saveConfirmAdjust,
  .mobile-adjust-page #revertAdjust,
  .mobile-adjust-page #deleteAdjustBox {
    grid-column: auto !important;
    grid-row: 1 !important;
  }

  .mobile-adjust-page .adjust-action-bar .btn {
    min-height: 40px !important;
    height: 40px;
    padding: 6px 5px !important;
    font-size: .72rem !important;
    border-radius: 10px;
  }

  .mobile-adjust-page .box-editor-viewport {
    touch-action: none !important;
    overscroll-behavior: none !important;
  }
}


/* Mobile inspection layout rebuild: one true viewport width, no horizontal page overflow. */
@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  #app,
  .app-shell,
  .inspection-page,
  .inspection-page > *,
  .inspection-card,
  .evidence-grid,
  .evidence-card,
  .checklist,
  .check-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .inspection-page {
    padding: 14px 12px 28px !important;
    overflow-x: clip;
  }

  .inspection-summary {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 16px 0 12px !important;
  }

  .inspection-summary > div {
    min-width: 0;
  }

  .inspection-summary h2 {
    font-size: 1.55rem;
    line-height: 1.05;
    margin-bottom: 5px;
    overflow-wrap: anywhere;
  }

  .inspection-summary p {
    font-size: .9rem;
  }

  .inspection-property-btn {
    width: auto !important;
    min-width: 0;
    padding: 10px 12px;
    align-self: center;
  }

  .inspection-card {
    padding: 14px !important;
    border-radius: 16px !important;
    overflow: hidden;
  }

  .progress-wrap {
    gap: 6px;
  }

  .progress-track {
    height: 8px;
  }

  .room-tabs {
    width: 100%;
    max-width: 100%;
    margin-top: 12px !important;
    padding: 0 0 8px;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .room-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 8px 12px;
    font-size: .88rem;
  }

  .room-step-actions {
    grid-template-columns: 1fr !important;
    margin: 0 0 12px !important;
  }

  .room-step-actions > span {
    display: none;
  }

  .room-step-actions .btn {
    width: 100% !important;
    justify-self: stretch !important;
  }

  .inspection-room-head {
    margin: 4px 0 12px;
  }

  .inspection-room-head h3 {
    margin: 0 0 3px;
    font-size: 1.05rem;
  }

  .inspection-room-head .kicker {
    font-size: .82rem;
    line-height: 1.35;
  }

  .checklist {
    gap: 9px;
  }

  .check-row {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    gap: 9px 10px !important;
    padding: 11px !important;
    border-radius: 13px !important;
    overflow: hidden;
  }

  .check-icon {
    width: 32px;
    height: 32px;
  }

  .check-title {
    font-size: .98rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .check-sub {
    font-size: .78rem;
    line-height: 1.25;
  }

  .check-actions {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 7px !important;
  }

  .check-actions .btn {
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 6px !important;
    font-size: .84rem !important;
    white-space: normal;
  }

  .inspection-evidence-head {
    margin: 20px 0 10px !important;
  }

  .inspection-evidence-head h2 {
    font-size: 1.3rem;
  }

  .inspection-evidence-head p {
    font-size: .84rem;
    line-height: 1.35;
  }

  .evidence-grid {
    grid-template-columns: minmax(0,1fr) !important;
  }

  .evidence-card {
    overflow: hidden;
  }

  .evidence-body {
    padding: 11px !important;
  }

  .photo-frame,
  .photo-frame-image {
    width: 100% !important;
    max-width: 100% !important;
  }

  .finding-item-head {
    gap: 6px;
    flex-wrap: wrap;
  }

  .finding-actions,
  .evidence-secondary-actions,
  .action-row {
    width: 100%;
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 7px !important;
  }

  .finding-actions .btn,
  .evidence-secondary-actions .btn,
  .action-row .btn {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Checklist already provides capture controls; remove the duplicate mobile footer. */
  .capture-panel {
    display: none !important;
  }

  .topbar-inner {
    width: 100%;
    max-width: 100%;
  }

  .top-actions {
    min-width: 0;
  }
}


/* When the evidence image is enlarged, pin it to the scroll origin.
   Flex centering of an oversized child makes its top/left overflow unreachable on mobile. */
.box-editor-viewport.is-zoomed,
.mobile-adjust-page .box-editor-viewport.is-zoomed,
.fullscreen-adjust .box-editor-viewport.is-zoomed {
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.box-editor-viewport.is-zoomed .box-editor {
  margin: 0 !important;
  flex: 0 0 auto !important;
}


/* Report evidence sheets: one original image + one combined annotated image per source photo. */
.report-evidence-group {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.report-evidence-group:first-of-type {
  margin-top: 14px;
}
.report-evidence-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.report-evidence-heading h3 {
  margin: 3px 0 0;
}
.report-evidence-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  align-items: start;
}
.report-evidence-pair .photo-frame {
  width: 100%;
  overflow: hidden;
}
.report-evidence-pair .photo-frame-image {
  width: 100%;
  height: auto;
  display: block;
}
.report-evidence-meta {
  display: grid;
  grid-template-columns: .8fr .8fr 1fr 2fr;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8faf7;
  font-size: .8rem;
  line-height: 1.35;
}
.report-evidence-id {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .68rem;
  color: var(--muted);
}
.report-condition-list {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.report-condition-row {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 10px;
  padding: 10px 12px;
  background: white;
}
.report-condition-row + .report-condition-row {
  border-top: 1px solid var(--border);
}
.report-condition-number {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-size: .75rem;
  font-weight: 850;
}
.report-condition-row.palette-1 .report-condition-number { background: #d83b2d; }
.report-condition-row.palette-2 .report-condition-number { background: #2563eb; }
.report-condition-row.palette-3 .report-condition-number { background: #d97706; }
.report-condition-row.palette-4 .report-condition-number { background: #7c3aed; }
.report-condition-row.palette-5 .report-condition-number { background: #0f766e; }
.report-condition-row.palette-6 .report-condition-number { background: #c026d3; }
.report-condition-copy {
  min-width: 0;
}
.report-condition-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}
.report-condition-description {
  margin-top: 3px;
  color: var(--text);
  font-size: .84rem;
  line-height: 1.35;
}
.report-condition-source {
  margin-top: 4px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}

@media (max-width: 700px) {
  .report-evidence-heading {
    align-items: start;
  }
  .report-evidence-pair {
    grid-template-columns: 1fr;
  }
  .report-evidence-meta {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media print {
  /* Each evidence image is the atomic report unit. One source photo may contain
     several confirmed conditions, but the photo pair and common metadata print once. */
  .report-evidence-group {
    border-top: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    break-before: page;
    page-break-before: always;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .report-evidence-group:first-of-type {
    break-before: auto;
    page-break-before: auto;
  }

  .report-evidence-heading {
    margin-bottom: 8px;
  }

  .report-evidence-heading h3 {
    font-size: 1.05rem;
  }

  .report-evidence-pair {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 10px !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  .report-evidence-pair .photo-frame {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden;
  }

  .report-evidence-pair .photo-frame-image {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: fill !important;
    display: block !important;
  }

  .report-evidence-pair .photo-overlay-box {
    box-sizing: border-box !important;
    border-width: 1.5pt !important;
  }

  .report-evidence-meta {
    grid-template-columns: .8fr .8fr 1fr 2fr !important;
    margin-top: 8px;
    padding: 7px 9px;
    font-size: 7.8pt;
  }

  .report-evidence-id {
    font-size: 6.3pt;
  }

  .report-condition-list {
    margin-top: 7px;
  }

  .report-condition-row {
    grid-template-columns: 26px minmax(0,1fr);
    gap: 7px;
    padding: 6px 8px;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .report-condition-number {
    width: 22px;
    height: 22px;
    font-size: 7pt;
  }

  .report-condition-head {
    font-size: 8.5pt;
  }

  .report-condition-head .tag {
    font-size: 6.5pt;
    padding: 3px 5px;
  }

  .report-condition-description {
    margin-top: 1px;
    font-size: 8pt;
    line-height: 1.25;
  }

  .report-condition-source {
    margin-top: 2px;
    font-size: 6.8pt;
  }
}

/* Photo capture choices: camera, upload, or video. */
@media (max-width: 700px) {
  .inspection-page .check-actions {
    grid-template-columns: repeat(3, minmax(0,1fr)) !important;
  }
  .inspection-page .check-actions .btn {
    padding-left: 4px !important;
    padding-right: 4px !important;
    font-size: .79rem !important;
  }
}


/* External annotation callouts stay outside defect boxes and are relaid out before printing. */
@media print {
  .photo-overlay-label {
    max-width: 44% !important;
    padding: 4px 6px !important;
    gap: 4px !important;
    border-radius: 7px !important;
    font-size: 6.5pt !important;
    line-height: 1.05 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.14) !important;
  }
  .photo-overlay-label-index {
    min-width: 16px !important;
    height: 16px !important;
    font-size: 6pt !important;
  }}


.report-intro-note {
  margin-top: 14px;
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #dce9e0;
  border-radius: 12px;
  background: #f3f8f5;
  color: #355046;
  font-size: .78rem;
  line-height: 1.35;
}
.report-intro-note strong {
  color: var(--brand);
  font-size: .82rem;
}

@media print {
  .report-conditions-intro {
    display: none !important;
  }

  .report-conditions-card {
    break-before: page !important;
    page-break-before: always !important;
  }

  .report-conditions-card > .report-evidence-group:first-of-type {
    break-before: auto !important;
    page-break-before: auto !important;
  }

  .report-intro-note {
    margin-top: 10px !important;
    padding: 8px 9px !important;
    font-size: 7.5pt !important;
    line-height: 1.25 !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }
}
