/* CRM — the car review (car-review.js). Tokens only; phone-safe (16px inputs, no sideways scroll). */

.cr { display: grid; gap: 14px; min-width: 0; }
.cr .card { margin: 0; }
.cr .card-h { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 10px; }
.cr .card-h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cr .card-h-row .card-h { margin: 0; }

/* header: the car's picture, what it is, whose it is, and the way to the enquiry / deal / stock */
.cr-head { display: grid; grid-template-columns: 168px minmax(0, 1fr) auto; gap: 14px 18px; align-items: start; }
.cr-head-pic { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow: hidden; padding: 0; cursor: pointer; display: grid; place-items: center; color: var(--text-muted); font: inherit; font-size: 13px; }
.cr-head-pic[disabled] { cursor: default; }
.cr-head-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-head-pic:focus-visible, .cr-tile-pic:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cr-head-id { min-width: 0; }
.cr-kicker { color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.cr-title { margin: 4px 0 0; font-size: 22px; font-weight: 800; color: var(--text); overflow-wrap: anywhere; }
.cr-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 14px; color: var(--text); }
.cr-dot { color: var(--text-muted); }
.cr-who { margin-top: 8px; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.cr-who-k { display: inline-block; min-width: 68px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.cr-who .pp-link { font-size: 13.5px; }

/* two columns: what the AI sees and the photos; the proposal and the car beside them */
.cr-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 14px; align-items: start; }
.cr-main, .cr-side { display: grid; gap: 14px; min-width: 0; }

/* what the AI sees */
.cr-ai-sum { margin: 0 0 12px; font-size: 15px; line-height: 1.55; color: var(--text); }
.cr-ai-k { margin: 12px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.cr-ai-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--text); }
.cr-ai-concerns li::marker { color: var(--accent); }
.cr-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cr-checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); }
.cr-check-ico { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.cr-checks li.ok .cr-check-ico { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.cr-checks li.bad .cr-check-ico { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--accent); }
.cr-ai-meta { margin: 14px 0 0; }
.cr-ai-working { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text-muted); font-size: 14px; }

/* photos: every photo the customer sent, with what the AI read and wrote */
.cr-missing { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; }
.cr-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.cr-tile { min-width: 0; display: grid; gap: 6px; align-content: start; }
.cr-tile-pic { position: relative; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; padding: 0; background: var(--surface-2); cursor: zoom-in; }
.cr-tile-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-shot { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 2px 8px; border-radius: 20px; background: var(--steel-d); color: var(--drawer-text-strong); font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-reads { margin: 0; font-size: 12px; font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
.cr-desc { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }

/* the proposal */
.cr-offer { display: grid; gap: 6px; }
.cr-amount { font-size: 28px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cr-offer-type { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text); }
.cr-offer .pp-notes, .cr-offer .pp-warn { margin: 6px 0 0; }
.cr-offer-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.cr-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.cr-done { margin: 12px 0; font-size: 14px; color: var(--text); }
.cr-rule { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.cr-form { display: grid; gap: 10px; }
.cr-form .pp-hint { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.cr-form .cr-noemail { margin: 0; font-size: 13px; }
.cr-form-acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.cr-again { margin-top: 12px; }
.cr-older { margin-top: 14px; font-size: 13.5px; }
.cr-older summary { cursor: pointer; color: var(--text-muted); font-weight: 700; }
.cr-older-row { font-size: 13.5px; color: var(--text); }
.cr-btn-spin { width: 12px; height: 12px; vertical-align: -2px; }

/* the car's details: where each one came from */
.cr-src { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 20px; font-size: 10.5px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); vertical-align: 1px; }
.cr-src-corrected, .cr-src-typed { background: var(--accent-soft); color: var(--accent); }
.cr-src-photo, .cr-src-decoded { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }

/* the photo viewer */
.cr-viewer .crm-conv-box { width: min(980px, calc(100vw - 32px)); max-width: none; }
.cr-v-fig { margin: 0; display: grid; gap: 10px; }
.cr-v-fig img { width: 100%; max-height: 64vh; object-fit: contain; background: var(--surface-2); border-radius: 8px; }
.cr-v-fig figcaption { display: grid; gap: 4px; font-size: 14px; color: var(--text); }
.cr-viewer .crm-conv-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

@media (max-width: 1100px) {
  .cr-head { grid-template-columns: 140px minmax(0, 1fr); }
  .cr-head .pp-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
/* phone: one column; the proposal comes straight after the header, then the AI, the photos, the car, the rest */
@media (max-width: 860px) {
  .cr-cols { display: flex; flex-direction: column; }
  .cr-main, .cr-side { display: contents; }
  .cr-prop { order: 1; } .cr-ai { order: 2; } .cr-photos { order: 3; } .cr-car { order: 4; } .cr-note { order: 5; } .cr-nextact { order: 6; } .cr-history { order: 7; }
}
@media (max-width: 560px) {
  .cr-head { grid-template-columns: 1fr; }
  .cr-head-pic { max-width: none; }
  .cr-title { font-size: 19px; }
  .cr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cr-head .pp-actions .btn { flex: 1 1 auto; }
}
