:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #14181f;
  --muted: #6b7280;
  --line: #e3e6ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --slate: #0f172a;
  --slate-2: #1e293b;
  --amber: #f4b740;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
/* author display rules (grid/flex) would otherwise override the hidden attribute */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px;
  background: var(--slate);
  border-bottom: 1px solid #0b1220;
}
.brand { display: flex; align-items: center; gap: 12px; background: none; border: none; padding: 0; margin: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.brand:hover .logo svg { box-shadow: 0 0 0 2px rgba(244,183,64,.55); }
.brand-txt { display: block; }
.brand-accent { color: var(--amber); }
.logo { width: 38px; height: 38px; display: grid; place-items: center; }
.logo svg { display: block; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.topbar h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; color: #f8fafc; display: flex; align-items: center; gap: 7px; }
.brand-pro { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); background: var(--amber); padding: 2px 6px; border-radius: 5px; }
.tag { margin: 1px 0 0; font-size: 12px; color: #94a3b8; }
.session {
  text-align: right; padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.session-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.session-cost { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 16px; }

main { max-width: 1240px; margin: 0 auto; padding: 22px; }

.banner {
  border: 1px solid #fde68a; background: var(--warn-bg); color: var(--warn);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px;
}
.banner.info { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }

/* ---------- uploader ---------- */
.uploader { display: grid; place-items: center; padding: 6vh 0; }
.dropzone {
  width: min(640px, 92vw); background: var(--panel); border: 2px dashed #cdd3dc;
  border-radius: 20px; padding: 46px 28px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s; box-shadow: var(--shadow);
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: #f3f7ff; }
.dz-icon { font-size: 40px; color: var(--accent); }
.dz-title { font-size: 18px; font-weight: 650; margin: 10px 0 4px; }
.dz-sub { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; }
.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 550; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #c3c9d2; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #265ed6; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }

/* ---------- workspace ---------- */
.workspace { max-width: 600px; margin: 0 auto; }

/* collapsible "what we detected" bar — holds the original; collapses once browsing */
.detected { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.detected-summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; }
.detected-summary::-webkit-details-marker { display: none; }
.detected-summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.detected[open] .detected-summary::before { transform: rotate(90deg); }
.detected-title { flex: 1; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detected[open] .detected-summary { border-bottom: 1px solid var(--line); }
.detected-body { padding: 12px 14px 14px; }
.detected:not([open]) .detected-body { display: none; }
.detected-body .original-wrap { margin-bottom: 10px; }
.detected-body .analysis-status { margin-bottom: 4px; }

.refine-note { font-size: 12.5px; color: var(--accent); background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 10px; padding: 7px 12px; margin-bottom: 12px; }

.left-col { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) { .left-col { position: static; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.original-img { width: 100%; border-radius: 10px; display: block; background: #eef0f3; }

.analysis-status { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.analysis-status.error { color: var(--bad); }
.analysis-summary { font-size: 14px; margin: 2px 0 12px; }
.analysis-summary strong { color: var(--accent); }
.surface-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: #fafbfc; display: inline-flex; align-items: center; gap: 6px;
}
.chip.target { border-color: var(--accent); background: #eef4ff; color: #1d4ed8; font-weight: 600; }
.chip .wear { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10.5px; }
.chip.target .wear { color: #3b6fe0; }
.instruction-box { margin-top: 12px; font-size: 12.5px; }
.instruction-box summary { cursor: pointer; color: var(--muted); }
.instruction-box code { display: block; margin-top: 8px; padding: 10px; background: #0f172a; color: #e2e8f0; border-radius: 8px; font-size: 12px; white-space: pre-wrap; }

/* ---------- results ---------- */
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-head h2 { font-size: 16px; margin: 0; }
.sort { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.sort select { font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }

.results-grid { display: flex; flex-direction: column; gap: 16px; }

/* one panel per model, holding N variant tiles */
.mgroup { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.mgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mgroup-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mgroup-metrics { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mgroup-metrics b { color: var(--ink); font-weight: 600; }
/* horizontal scrollable gallery of large variant tiles */
.mgroup-right { display: flex; align-items: center; gap: 12px; }
.gnav-group { display: flex; gap: 6px; }
.gnav { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); display: grid; place-items: center; }
.gnav:hover { background: #f3f5f8; border-color: #c3c9d2; }
.variants { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 2px 2px 8px; }
.variants::-webkit-scrollbar { height: 8px; }
.variants::-webkit-scrollbar-thumb { background: #cfd5de; border-radius: 4px; }
.vtile { flex: 0 0 46%; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f1f3f6; }
@media (max-width: 900px) { .vtile { flex-basis: 72%; } }
.vmeta { display: flex; align-items: center; gap: 8px; padding: 6px 9px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vmeta b { color: var(--ink); font-weight: 600; }
.vmeta .vlat { margin-left: auto; }
.card-media { position: relative; aspect-ratio: 4 / 3; background: #f1f3f6; display: grid; place-items: center; overflow: hidden; }

/* scanning line — shown on the ORIGINAL photo while working, until the first result appears */
.original-wrap { position: relative; border-radius: 10px; overflow: hidden; }
.original-wrap .scan-veil, .original-wrap .scanline { display: none; }
.original-wrap.scanning .scan-veil { display: block; }
.original-wrap.scanning .scanline { display: block; }
.scan-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(47,109,240,.05), rgba(47,109,240,.16)); pointer-events: none; }
.scanline { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, transparent, rgba(120,170,255,.95), transparent); box-shadow: 0 0 16px 3px rgba(47,109,240,.6); animation: scan 1.9s cubic-bezier(.45,0,.55,1) infinite; pointer-events: none; }
@keyframes scan { 0% { top: 0; opacity: .35; } 10% { opacity: 1; } 50% { top: calc(100% - 4px); } 90% { opacity: 1; } 100% { top: 0; opacity: .35; } }

.placeholder { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }
.placeholder.error { color: var(--bad); }
.spinner { width: 26px; height: 26px; border: 3px solid #d7dbe2; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* before / after slider — defaults to the NEW image; drag left to reveal the original */
.ba { position: relative; width: 100%; height: 100%; --pos: 100%; user-select: none; }
.ba-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-clip { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); } /* original, shown right of divider */
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.ba-grip { position: absolute; top: 50%; left: clamp(18px, var(--pos), calc(100% - 18px)); transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 14px; box-shadow: 0 1px 5px rgba(0,0,0,.35); pointer-events: none; }
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.ba-tag { position: absolute; top: 8px; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: rgba(15,23,42,.6); padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.tag-new { left: 8px; background: rgba(22,101,52,.82); }
.tag-old { right: 8px; }

/* tap-to-enlarge button on each variant tile */
.vexpand { position: absolute; bottom: 8px; left: 8px; z-index: 3; width: 26px; height: 26px; border: none; border-radius: 7px; background: rgba(15,23,42,.55); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.vexpand:hover { background: rgba(15,23,42,.8); }

/* fullscreen lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,12,20,.86); display: grid; place-items: center; padding: 20px; }
.lb-inner { display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 100%; }
.lb-stage { width: min(94vw, 1100px); aspect-ratio: 4 / 3; max-height: 86vh; border-radius: 12px; overflow: hidden; background: #000; }
.lb-stage .ba { border-radius: 12px; }
.lb-caption { color: #e7ebf2; font-size: 13px; text-align: center; }
.lb-close { position: absolute; top: 12px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lb-close:hover { background: rgba(255,255,255,.3); }
/* the sticky topbar's backdrop-filter layer would otherwise peek over the overlay */
body.lb-open .topbar { visibility: hidden; }

/* top-N upgrade list */
.target-upgrades { counter-reset: t; list-style: none; margin: 2px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.target-upgrades li { font-size: 12.5px; line-height: 1.35; padding-left: 22px; position: relative; }
.target-upgrades li::before { counter-increment: t; content: counter(t); position: absolute; left: 0; top: 0; width: 16px; height: 16px; font-size: 9.5px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 50%; display: grid; place-items: center; }
.target-upgrades b { color: var(--ink); }
.target-upgrades .up { color: var(--muted); }

.card-meta { padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.model-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.provider-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.metrics { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metrics b { color: var(--ink); font-weight: 600; }

.pill { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.pill.pending { background: #eef2f7; color: #5b6573; }
.pill.done { background: #e7f7ee; color: var(--good); }
.pill.error { background: #fdecec; color: var(--bad); }

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 16px 40px; }

/* ---------- swipe deck (Tinder-style) ---------- */
.deck-wrap { max-width: 540px; margin: 0 auto; }
.deck-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.deck-progress { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.deck-hint { opacity: .85; }
.deck { position: relative; aspect-ratio: 4 / 3; margin-bottom: 26px; }
.deck-placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; color: var(--muted); border: 1px dashed #cdd3dc; border-radius: 18px; background: var(--panel); }
.deck-placeholder p { margin: 0; font-size: 13.5px; max-width: 84%; }
.card { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 10px 30px rgba(16,24,40,.16), 0 2px 8px rgba(16,24,40,.10); background: #0b0f17; cursor: grab; transition: transform .3s ease, opacity .3s ease; will-change: transform; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.card.dragging { transition: none; cursor: grabbing; }
.card.flying { transition: transform .4s ease, opacity .4s ease; }
.card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.card-badge { position: absolute; top: 12px; left: 12px; background: rgba(15,23,42,.6); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.card-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 13px 12px; background: linear-gradient(transparent, rgba(0,0,0,.18) 30%, rgba(0,0,0,.82)); color: #fff; pointer-events: none; }
.card-checks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; pointer-events: auto; }
.chk { font-size: 11px; line-height: 1; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.55); background: rgba(0,0,0,.3); color: #fff; cursor: pointer; backdrop-filter: blur(2px); }
.chk.on { background: #fff; color: #111; border-color: #fff; font-weight: 600; }
.chk.on::before { content: "✓ "; }
.card-overlay { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; pointer-events: none; }
.card-model { font-size: 14px; font-weight: 650; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.card-provider { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; opacity: .85; margin-top: 2px; }
.card-cost { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; }
.swipe-stamp { position: absolute; top: 24px; font-size: 24px; font-weight: 800; letter-spacing: .08em; padding: 5px 14px; border: 4px solid; border-radius: 12px; opacity: 0; text-transform: uppercase; pointer-events: none; }
.swipe-stamp.like { right: 18px; color: #16a34a; border-color: #16a34a; transform: rotate(13deg); }
.swipe-stamp.nope { left: 18px; color: #dc2626; border-color: #dc2626; transform: rotate(-13deg); }
.deck-actions { display: flex; align-items: center; justify-content: center; gap: 16px; }
.deck-btn { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: transform .08s ease, background .15s, border-color .15s; color: var(--ink); }
.deck-btn:hover:not(:disabled) { border-color: #c3c9d2; }
.deck-btn:active:not(:disabled) { transform: scale(.9); }
.deck-btn.pass, .deck-btn.like { width: 60px; height: 60px; font-size: 24px; }
.deck-btn.pass { color: #dc2626; }
.deck-btn.like { color: #16a34a; }
.deck-btn.view, .deck-btn.undo { width: 46px; height: 46px; font-size: 18px; color: var(--muted); }
.deck-btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.saved-area { margin-top: 26px; }
.saved-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.saved-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-thumb { width: 86px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; }
.saved-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* big swipe feedback: green ♥ on right, red ✕ on left */
.swipe-fx { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .08s; z-index: 4; }
.swipe-fx span { font-size: 110px; line-height: 1; display: block; transition: transform .08s; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
.swipe-fx.like span { color: #22c55e; }
.swipe-fx.nope span { color: #ef4444; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.phase { }
.phase-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 50vh; gap: 14px; }
.phase-head { text-align: center; margin-bottom: 14px; }
.phase-head h2 { font-size: 19px; margin: 0 0 4px; }
.phase-sub { font-size: 13.5px; color: var(--muted); margin: 0; }
.spinner.big { width: 40px; height: 40px; border-width: 4px; }
.continue-bar { text-align: center; margin-top: 16px; }
.continue-bar .btn { min-width: 230px; }

/* phase B — pairwise A/B tournament */
.tour-pair { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: #0b0f17; --pos: 50%; user-select: none; }
.tour-pair .pc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tour-pair .pc-clip { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.tour-pair .pc-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.tour-pair .pc-grip { position: absolute; top: 50%; left: clamp(18px, var(--pos), calc(100% - 18px)); transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 15px; box-shadow: 0 1px 5px rgba(0,0,0,.35); pointer-events: none; }
.tour-pair .pc-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.tour-pair .pc-tag { position: absolute; top: 10px; z-index: 3; font-size: 13px; font-weight: 700; color: #fff; background: rgba(15,23,42,.7); padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.tour-pair .pc-a { left: 10px; }
.tour-pair .pc-b { right: 10px; }
.tour-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.tour-actions .btn { flex: 1; max-width: 240px; }

.final-winner { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: #0b0f17; margin-bottom: 12px; }
.final-winner .ba { position: absolute; inset: 0; }
.final-edit { display: flex; gap: 8px; }
.edit-request { flex: 1; font-size: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); }
.final-edit .btn { white-space: nowrap; }
.edit-status { font-size: 12.5px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.edit-status.error { color: var(--bad); }
.liked-head { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 10px; }

/* phase B — mark features on a liked render */
.mark-card { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: #0b0f17; }
.mark-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mark-checks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 16px; }
.mark-chk { font-size: 13px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.mark-chk.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.mark-chk.on::before { content: "✓ "; }
.mark-actions { display: flex; justify-content: center; }
.mark-actions .btn { min-width: 160px; }

/* phase D — final gallery, pick one */
.final-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.final-tile { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; border: 3px solid transparent; box-shadow: var(--shadow); cursor: pointer; background: #0b0f17; }
.final-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.final-tile .final-model { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; font-size: 11.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.final-tile.chosen { border-color: var(--good); }
.final-tile.chosen::after { content: "✓ Your pick"; position: absolute; top: 8px; right: 8px; background: var(--good); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.final-tile.dim { opacity: .5; }
.final-actions { margin-top: 18px; text-align: center; }

/* projects modal */
.projects-modal { position: fixed; inset: 0; z-index: 90; background: rgba(8,12,20,.6); display: grid; place-items: start center; padding: 6vh 16px; overflow: auto; }
.projects-panel { width: min(640px, 96vw); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.projects-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.projects-head h2 { margin: 0; font-size: 18px; }
.lb-close.dark { position: static; width: 34px; height: 34px; background: var(--line); color: var(--ink); font-size: 22px; }
.projects-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.project-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--bg); }
.project-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eee; }
.project-card .pc-meta { padding: 8px 10px; font-size: 12px; }
.project-card .pc-meta b { display: block; font-size: 12.5px; }
.project-card .pc-meta span { color: var(--muted); }
.projects-empty { color: var(--muted); font-size: 13.5px; padding: 8px; }

/* ---------- auth gate ---------- */
.auth { display: grid; place-items: center; padding: 5vh 0; }
.auth-card { width: min(420px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 26px; text-align: center; }
.auth-logo { display: inline-grid; place-items: center; margin-bottom: 8px; }
.auth-card h2 { margin: 4px 0 4px; font-size: 21px; letter-spacing: -.01em; }
.auth-sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.auth-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.auth-input { width: 100%; font-size: 15px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--ink); }
.auth-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.auth-error { font-size: 13px; color: var(--bad); background: #fdecec; border: 1px solid #f7c5c5; border-radius: 10px; padding: 8px 11px; margin-bottom: 12px; text-align: left; }
.auth-toggle { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.auth-toggle a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-toggle a:hover { text-decoration: underline; }

.btn.big { padding: 12px 18px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; display: block; }

/* ---------- user menu ---------- */
.user-menu { position: relative; }
.user-trigger { display: inline-flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px 5px 5px; cursor: pointer; font: inherit; color: var(--ink); }
.user-trigger:hover { border-color: #c3c9d2; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.user-email { font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { font-size: 10px; color: var(--muted); }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(16,24,40,.16); padding: 6px; z-index: 30; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; border: none; border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.menu-item:hover { background: #f3f5f8; }
.menu-item.danger { color: var(--bad); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---------- upload card (redesigned, mobile-first) ---------- */
.upload-card { width: min(560px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 40px 26px 30px; text-align: center; box-shadow: var(--shadow); transition: border-color .15s, background .15s; outline: none; }
.upload-card.drag { border-color: var(--accent); background: #f3f7ff; }
.up-illus { display: inline-grid; place-items: center; margin-bottom: 6px; }
.up-title { font-size: 21px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.01em; }
.up-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.up-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.up-actions .btn { min-width: 180px; }
.up-drop-hint { color: var(--muted); font-size: 12.5px; margin: 18px 0 0; }

/* ---------- swipe loading (original scan) ---------- */
.swipe-loading { max-width: 540px; margin: 0 auto; text-align: center; }
.swipe-loading .original-wrap { aspect-ratio: 4 / 3; border-radius: 18px; box-shadow: var(--shadow); }
.swipe-loading .original-img { width: 100%; height: 100%; object-fit: cover; }
.loading-text { font-size: 14.5px; color: var(--muted); margin: 16px 0 14px; }
.swipe-deck { max-width: 540px; margin: 0 auto; }

/* delete X on liked-design tiles */
.tile-del { position: absolute; top: 8px; right: 8px; z-index: 4; width: 28px; height: 28px; border: none; border-radius: 50%; background: rgba(220,38,38,.92); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 5px rgba(0,0,0,.35); opacity: 0; transition: opacity .12s; }
.final-tile:hover .tile-del, .final-tile:focus-within .tile-del { opacity: 1; }
@media (hover: none) { .tile-del { opacity: 1; } }

/* final gallery: each design is a cell = tile + inline edit panel */
#final-grid { align-items: start; }
.final-cell { display: flex; flex-direction: column; }
.final-cell.active .final-tile { box-shadow: 0 0 0 3px var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.final-tile.chosen::after { content: none; }   /* green border + caption already mark the pick; keep corners free */

/* per-tile view options: magnify · full screen · before/after */
.tile-icons { position: absolute; top: 8px; left: 8px; z-index: 4; display: flex; gap: 6px; opacity: 0; transition: opacity .12s; }
.final-tile:hover .tile-icons, .final-tile:focus-within .tile-icons { opacity: 1; }
@media (hover: none) { .tile-icons { opacity: 1; } }
.tile-ic { width: 28px; height: 28px; border: none; border-radius: 8px; background: rgba(15,23,42,.6); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.tile-ic:hover { background: rgba(15,23,42,.85); }

/* inline edit panel under a clicked design */
.tile-edit { display: none; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-top: none; border-radius: 0 0 14px 14px; }
.final-cell.active .tile-edit { display: block; }
.tile-edit-row { display: flex; gap: 8px; }
.tile-edit-input { flex: 1; min-width: 0; font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
.tile-edit-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.tile-edit .btn { white-space: nowrap; }
.tile-edit .edit-status { margin-top: 8px; }

/* WhatsApp-style trailing button: mic when empty · send when typed · stop while recording */
.tile-edit-btn { flex: 0 0 auto; width: 40px; height: 40px; border: none; border-radius: 10px; cursor: pointer; display: grid; place-items: center; background: var(--accent); color: #fff; transition: background .15s, box-shadow .15s; }
.tile-edit-btn svg { display: block; }
.tile-edit-btn.mic { background: #eef1f5; color: var(--muted); }
.tile-edit-btn.mic:hover { background: #e3e7ee; color: var(--ink); }
.tile-edit-btn.send { background: var(--accent); color: #fff; }
.tile-edit-btn.send:hover { background: #265ed6; }
.tile-edit-btn.recording { background: var(--bad); color: #fff; animation: recpulse 1.1s ease-in-out infinite; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 7px rgba(220,38,38,0); } }

/* lightbox single-image (magnify / full screen) */
.lb-single { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; cursor: zoom-in; transition: transform .2s; }
.lb-single.zoomed { object-fit: cover; transform: scale(1.6); cursor: zoom-out; }

/* delete X on project cards */
.project-card { position: relative; }
.proj-del { position: absolute; top: 6px; right: 6px; z-index: 4; width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(220,38,38,.92); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 5px rgba(0,0,0,.35); }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .final-grid { grid-template-columns: 1fr; }
  .deck-wrap { max-width: 100%; }
  .deck-hint { display: none; }
  main { padding: 14px 12px; }
  .topbar { padding: 10px 13px; }
  .tag { display: none; }                 /* the dropzone already explains the flow */
  .topbar h1 { font-size: 16px; }
  .logo svg { width: 34px; height: 34px; }
  .user-email { display: none; }          /* avatar only on small screens */
  .up-actions .btn { width: 100%; min-width: 0; }
  .auth-card { padding: 24px 18px; }

  .results-head { flex-wrap: wrap; gap: 8px; }
  .results-head h2 { font-size: 15px; }

  .vtile { flex-basis: 86%; }
  .variants { gap: 10px; }
  .mgroup { padding: 10px 11px; }
  .mgroup-head { flex-wrap: wrap; row-gap: 4px; }
  .mgroup-title .model-name { font-size: 12.5px; }
  .mgroup-metrics { gap: 10px; font-size: 11.5px; }
  .vmeta { padding: 5px 7px; gap: 6px; font-size: 10.5px; }

  .dropzone { padding: 38px 20px; }
}

/* ====================================================================== */
/* PRO TOOL — survey + spec + results                                      */
/* ====================================================================== */
.workspace { max-width: 1180px; margin: 0 auto; }
.muted { color: var(--muted); }
.err { color: var(--bad); }

/* scanning the original while the survey runs */
.scan { max-width: 540px; margin: 4vh auto 0; text-align: center; }
.scan .original-wrap { aspect-ratio: 4 / 3; border-radius: 16px; box-shadow: var(--shadow); }
.scan .original-img { width: 100%; height: 100%; object-fit: cover; }

/* card shell (renamed from .card to avoid the dead swipe-deck .card{position:absolute} rule) */
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 16px 18px; }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pcard-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.conf { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.conf.high { background: #e7f7ee; color: var(--good); }
.conf.medium { background: #eef4ff; color: var(--accent); }
.conf.low { background: var(--warn-bg); color: var(--warn); }

/* plan = two columns */
.plan-grid { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .plan-grid { grid-template-columns: 1fr; } }
.survey.pcard { position: sticky; top: 78px; align-self: start; }
@media (max-width: 880px) { .survey.pcard { position: static; } }

.survey-photo-wrap { position: relative; border-radius: 11px; overflow: hidden; margin-bottom: 12px; }
.survey-photo { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; background: #eef0f3; }
.survey-photo-zoom { position: absolute; bottom: 8px; right: 8px; width: 30px; height: 30px; border: none; border-radius: 8px; background: rgba(15,23,42,.6); color: #fff; font-size: 15px; cursor: pointer; display: grid; place-items: center; }
.survey-photo-zoom:hover { background: rgba(15,23,42,.85); }
/* scanning shimmer on the survey photo while the (non-blocking) survey runs */
.survey-photo-wrap .scan-veil, .survey-photo-wrap .scanline { display: none; }
.survey-photo-wrap.scanning .scan-veil, .survey-photo-wrap.scanning .scanline { display: block; }

.survey-facts { display: flex; flex-direction: column; gap: 9px; }
.fact { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.fact.col { flex-direction: column; gap: 2px; }
.fact-k { flex: 0 0 92px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact.col .fact-k { flex: none; }
.fact-v { color: var(--ink); font-weight: 500; }
.fact-note { font-size: 12px; color: var(--muted); }
.fact-basis { font-size: 11.5px; color: var(--muted); font-style: italic; margin: -4px 0 2px 102px; }
.fact-sep { height: 1px; background: var(--line); margin: 4px 0; }
.dims-inputs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.dims-inputs .x { color: var(--muted); }
.dim-in { width: 52px; font-size: 13.5px; font-weight: 600; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
.dim-in:focus { outline: none; border-color: var(--accent); background: #fff; }
.rec { margin-top: 6px; font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 8px; }
.rec summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.rec-body p { margin: 6px 0 0; color: var(--ink); }

/* spec fields */
.field { margin-bottom: 18px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.hint { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.sel-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.sel-count.active { color: var(--accent); }

.segmented { display: inline-flex; width: 100%; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--bg); }
.seg { flex: 1; appearance: none; border: none; background: transparent; padding: 10px 8px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); transition: background .12s, color .12s; }
.seg:last-child { border-right: none; }
.seg.on { background: var(--accent); color: #fff; }
.seg:not(.on):hover { background: #eaeef4; color: var(--ink); }
.seg-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: 1px; background: var(--accent); color: #fff; }
.seg.on .seg-badge { background: rgba(255,255,255,.28); color: #fff; }

.gallery-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tile-search { flex: 1; min-width: 0; font-size: 13.5px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.tile-search:focus { outline: none; border-color: var(--accent); background: #fff; }
.tile-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tile-filter { flex: 1 1 110px; min-width: 110px; font-size: 12.5px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); cursor: pointer; }
.tile-filter:focus { outline: none; border-color: var(--accent); background: #fff; }

.tile-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 470px; overflow-y: auto; padding: 2px; }
.tile-gallery::-webkit-scrollbar { width: 8px; }
.tile-gallery::-webkit-scrollbar-thumb { background: #cfd5de; border-radius: 4px; }
.tile-card { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .05s; }
.tile-card:hover { border-color: #c3c9d2; box-shadow: var(--shadow); }
.tile-card:active { transform: translateY(1px); }
.tile-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.tile-sw { aspect-ratio: 10 / 7; background: #eef0f3; overflow: hidden; }
.tile-sw svg { width: 100%; height: 100%; display: block; }
/* real product photo overlaid on the SVG swatch; removes itself on load error */
.thumb { position: relative; display: block; width: 100%; height: 100%; }
.thumb svg { width: 100%; height: 100%; display: block; }
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #eef0f3; }
.tile-info { padding: 8px 10px 10px; }
.tile-name { font-size: 13px; font-weight: 650; line-height: 1.2; }
.tile-brand { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tile-spec { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.3; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; }
.tile-price { font-size: 12px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile-app { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.tile-check { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.tile-card.sel .tile-check { opacity: 1; transform: scale(1); }
.tile-link { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 7px; background: rgba(15,23,42,.55); color: #fff; font-size: 12px; display: grid; place-items: center; text-decoration: none; opacity: 0; transition: opacity .12s; }
.tile-card:hover .tile-link { opacity: 1; }
@media (hover: none) { .tile-link { opacity: .9; } }
.empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding: 18px; text-align: center; }

/* floating action bar — sticks to the bottom of the viewport while you're in the
   tile selector, so Generate / Surprise are always reachable without scrolling down */
.spec-actions {
  display: flex; flex-direction: column; gap: 10px;
  position: sticky; bottom: 0; z-index: 8;
  margin: 8px -16px -18px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 16px rgba(16,24,40,.06);
  border-radius: 0 0 16px 16px;
}
.btn.subtle { background: #eef2f8; border-color: #e0e6ef; color: var(--slate-2); }
.btn.subtle:hover { background: #e5ebf4; }
.preserve-note { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; border-left: 3px solid var(--amber); padding-left: 10px; }

/* results */
.results-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-bar-l h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.results-bar-l p { margin: 2px 0 0; font-size: 13px; }
.results-actions { display: flex; gap: 8px; }

.results-grid-pro { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
@media (max-width: 760px) { .results-grid-pro { grid-template-columns: 1fr; } }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.rcard-media { position: relative; aspect-ratio: 4 / 3; background: #0b0f17; }
.rcard-media .ba, .rcard-media .original-wrap { position: absolute; inset: 0; border-radius: 0; }
.rcard-after { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.rcard-after:hover { opacity: .96; }
/* version badge + flip-back strip */
.rcard-version { position: absolute; top: 8px; left: 8px; z-index: 4; border: none; border-radius: 8px; background: rgba(15,23,42,.72); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 1px; }
.rcard-version:hover { background: rgba(15,23,42,.92); }
.rv-total { font-weight: 500; opacity: .8; }
.rcard-versions { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: rgba(15,23,42,.62); border-radius: 10px; }
.rv-thumb { flex: 0 0 auto; position: relative; width: 56px; height: 42px; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; padding: 0; background: none; }
.rv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv-thumb span { position: absolute; bottom: 0; left: 0; right: 0; font-size: 9px; color: #fff; background: rgba(0,0,0,.55); text-align: center; }
.rv-thumb.on { border-color: #fff; }
/* per-surface tile rows under each render (Floor: …, Wall: …) */
.rcard-parts { display: flex; flex-direction: column; gap: 6px; }
.rcard-part { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rpart-sw { flex: 0 0 auto; width: 38px; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.rpart-sw svg, .rpart-sw .thumb { width: 100%; height: 100%; display: block; }
.rpart-txt { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rpart-txt small { color: var(--muted); font-size: 11px; margin-left: 5px; font-weight: 400; }
.rpart-kind { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--accent); background: #eef4ff; border-radius: 5px; padding: 1px 6px; margin-right: 5px; }
.render-tag { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #fff; background: rgba(15,23,42,.7); padding: 5px 11px; border-radius: 999px; }
.rcard-err { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: #fbeaea; }
.rcard-err p { margin: 0; font-size: 12.5px; color: var(--bad); }

.rcard-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 7px; }
.rcard-head { display: flex; align-items: center; gap: 10px; }
.rcard-sw { flex: 0 0 auto; width: 40px; height: 32px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.rcard-sw svg { width: 100%; height: 100%; display: block; }
.rcard-titles { min-width: 0; }
.rcard-title { font-size: 14px; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard-spec { font-size: 12px; color: var(--muted); }
.rcard-est { font-size: 12.5px; font-weight: 600; color: var(--slate-2); background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-variant-numeric: tabular-nums; }
.rcard-actions { display: flex; flex-direction: column; gap: 9px; }
.ract-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ract-big { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; transition: background .15s, border-color .15s, transform .06s, box-shadow .15s; }
.ract-big:hover { background: #f3f7ff; border-color: var(--accent); box-shadow: 0 2px 10px rgba(37,99,235,.10); }
.ract-big:active { transform: translateY(1px); }
.ract-ico { display: grid; place-items: center; height: 28px; }
.ract-ico svg { width: 27px; height: 27px; display: block; color: var(--accent); }
.ract-lbl { font-size: 12.5px; font-weight: 650; letter-spacing: .01em; }
.ract-mini-row { display: flex; gap: 12px; align-items: center; min-height: 18px; }
.ract-mini { font-size: 12px; color: var(--muted); background: transparent; border: none; cursor: pointer; text-decoration: none; padding: 2px; border-radius: 6px; }
.ract-mini:hover { color: var(--ink); }
.ract-mini.danger { margin-left: auto; color: var(--bad); }
.ract-mini.danger:hover { color: #b42318; }
@media (max-width: 430px) { .ract-lbl { font-size: 11.5px; } .ract-ico svg { width: 24px; height: 24px; } .ract-big { padding: 10px 4px 8px; } }
/* lightbox tools (View) */
.lb-tools { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 2px; }
.lb-tool { font-size: 13px; font-weight: 600; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.30); border-radius: 999px; padding: 7px 15px; cursor: pointer; transition: background .15s; }
.lb-tool:hover { background: rgba(255,255,255,.27); }
.lb-hint { font-size: 12px; color: #c4cbd6; }
/* result mini-row: product link(s), store tag, kebab menu */
.ract-mini-row { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.ract-prods { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.prod-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.prod-item.muted { color: var(--muted); }
.prod-sep { color: var(--line); }
.prod-link { color: var(--accent); text-decoration: none; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.prod-link:hover { text-decoration: underline; }
.store-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; padding: 2px 6px; border-radius: 6px; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.store-tag.lowes { background: #eaf1ff; color: #134fc7; }
.store-tag.hd { background: #fff0e2; color: #c2570c; }
.ract-kebab-wrap { position: relative; flex: 0 0 auto; }
.ract-kebab { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.ract-kebab:hover { background: #f3f5f8; border-color: #c3c9d2; }
.ract-menu { position: absolute; right: 0; bottom: calc(100% + 6px); min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 10px 30px rgba(16,24,40,.18); padding: 6px; z-index: 40; }
.ract-menu .menu-item { display: block; width: 100%; text-align: left; background: transparent; border: none; border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.ract-menu .menu-item:hover { background: #f3f5f8; }
.ract-menu .menu-item.danger { color: var(--bad); }
.ract-menu .menu-item.danger:hover { background: #fdecec; }
/* product picker modal + settings autofill */
.modal2-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.autofill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.af-status { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.af-status.ok { color: #1a7f4b; }
.af-status.warn { color: #b45309; }
/* billing: plan pill + upgrade modal + toast */
.plan-pill { font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; }
.plan-pill:hover { border-color: var(--accent); background: #f3f7ff; }
.plan-pill.low { border-color: #f3c0c0; background: #fdecec; color: #b42318; }
.plan-pill.pro { background: linear-gradient(135deg, #f4b740, #e08e0b); border-color: #e08e0b; color: #3a2600; }
.upgrade-panel { width: min(440px, 94vw); position: relative; text-align: center; padding: 30px 26px 22px; }
.upgrade-panel .lb-close { position: absolute; top: 12px; right: 12px; }
.upgrade-body h2 { font-size: 20px; margin: 6px 0 6px; }
.up-hero { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; color: #3a2600; background: linear-gradient(135deg, #f4b740, #e08e0b); }
.up-lead { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.up-feats { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; display: inline-block; }
.up-feats li { padding: 5px 0 5px 26px; position: relative; font-size: 13.5px; }
.up-feats li::before { content: "✓"; position: absolute; left: 4px; color: #1a7f4b; font-weight: 800; }
.up-price { margin: 4px 0 16px; }
.up-price b { font-size: 30px; }
.up-price span { color: var(--muted); font-size: 14px; margin-left: 4px; }
.up-status { min-height: 18px; margin-top: 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.up-status.warn { color: #b45309; }
.up-later { display: block; width: 100%; margin-top: 8px; background: transparent; border: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 6px; }
.up-later:hover { color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 24px); background: #14181f; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.28); font-size: 13.5px; font-weight: 600; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #16692f; }
.toast.warn { background: #92400e; }
.rcard-edit { margin-top: 2px; }
.rcard-edit .tile-edit-row { display: flex; gap: 7px; }
.rcard-edit .edit-status { margin-top: 7px; }

@media (max-width: 880px) {
  main { padding: 16px 13px; }
  .tile-gallery { max-height: none; }
}

/* ---------- bill of materials modal ---------- */
.bom-modal { position: fixed; inset: 0; z-index: 95; background: rgba(8,12,20,.6); display: grid; place-items: start center; padding: 5vh 16px; overflow: auto; }
.bom-panel { width: min(860px, 96vw); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px 22px; }
.bom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bom-head h2 { margin: 0; font-size: 18px; }
.bom-head-actions { display: flex; align-items: center; gap: 10px; }
.bom-body { font-size: 13px; }
.bom-empty { color: var(--muted); padding: 14px; }
.bom-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.bom-img { width: 124px; height: 92px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: 0 0 auto; }
.bom-top-txt { display: flex; flex-direction: column; min-width: 0; }
.bom-top-txt b { font-size: 15px; }
.bom-top-txt span { color: var(--muted); font-size: 12.5px; }
.bom-scroll { overflow-x: auto; }
.bom-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bom-table th, .bom-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.bom-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.bom-table td.num, .bom-table th.num { text-align: right; white-space: nowrap; }
.bom-table tfoot td { border-top: 2px solid var(--line); border-bottom: none; font-size: 14px; padding-top: 12px; }
.bom-tile { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.bom-sw { flex: 0 0 auto; width: 42px; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bom-sw svg { width: 100%; height: 100%; display: block; }
.bom-tile-txt { display: flex; flex-direction: column; }
.bom-tile-txt small { color: var(--muted); font-size: 11px; }
.bom-table a { color: var(--accent); text-decoration: none; }
.bom-auto td { color: var(--muted); font-style: italic; background: #f9fafb; }
.bom-h { margin: 16px 0 4px; font-size: 13px; }
.bom-h span { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.bom-add td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.bom-add-l { width: 100%; }
.bom-rate { color: var(--muted); font-weight: 400; white-space: nowrap; }
#bom-labour { width: 56px; font-size: 12.5px; padding: 3px 6px; margin: 0 1px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
#bom-labour:focus { outline: none; border-color: var(--accent); background: #fff; }
.bom-grand { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 11px; border-top: 2px solid var(--line); font-size: 14px; font-weight: 600; }
.bom-grand b { font-size: 21px; font-variant-numeric: tabular-nums; }
.bom-note { margin: 14px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; border-left: 3px solid var(--amber); padding-left: 10px; }
@media print {
  body > *:not(#bom-modal) { display: none !important; }
  .bom-modal { position: static; background: none; padding: 0; display: block; }
  .bom-panel { box-shadow: none; width: 100%; }
  .bom-head-actions { display: none; }
}

/* ====================================================================== */
/* Landing page + hero animation                                          */
/* ====================================================================== */
.landing { padding: 3vh 0 6vh; }
.landing-inner { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; max-width: 1120px; margin: 0 auto; }
@media (max-width: 880px) { .landing-inner { grid-template-columns: 1fr; gap: 26px; } }
.landing-badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: #eef4ff; border: 1px solid #d8e4ff; padding: 5px 11px; border-radius: 999px; }
.landing-h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -.02em; margin: 16px 0 12px; }
.landing-lead { font-size: 16px; color: var(--muted); margin: 0 0 22px; max-width: 30em; line-height: 1.5; }
.landing-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 320px; }
.landing-cta .btn { width: 100%; justify-content: center; }
.landing-points { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.landing-points li { position: relative; padding-left: 26px; font-size: 13.5px; color: var(--ink); }
.landing-points li::before { content: "✓"; position: absolute; left: 0; top: -1px; width: 18px; height: 18px; font-size: 11px; font-weight: 800; color: #fff; background: var(--good); border-radius: 50%; display: grid; place-items: center; }
.google-slot { min-height: 40px; display: flex; }
.google-slot:empty { display: none; }

.landing-demo { display: flex; flex-direction: column; align-items: center; }
.demo-frame { position: relative; width: 100%; max-width: 460px; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(16,24,40,.20), 0 4px 12px rgba(16,24,40,.10); background: #dfe3e6; }
.demo-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.demo-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .42s ease; }
.demo-layer.on { opacity: 1; }
.demo-stage.sweep::after { content: ""; position: absolute; left: 0; right: 0; top: -45%; height: 45%; z-index: 2; background: linear-gradient(180deg, rgba(120,170,255,0), rgba(120,170,255,.5), rgba(120,170,255,0)); animation: demoSweep .55s ease-out; pointer-events: none; }
@keyframes demoSweep { 0% { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(320%); opacity: 0; } }
.demo-caption { position: absolute; left: 12px; bottom: 12px; z-index: 6; background: rgba(15,23,42,.74); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
/* estimate frame: scanning line + the bill being written line by line */
.demo-stage.scanning::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; z-index: 4; background: linear-gradient(90deg, transparent, rgba(120,170,255,.95), transparent); box-shadow: 0 0 18px 4px rgba(47,109,240,.55); animation: demoScan 1.1s ease-in-out; pointer-events: none; }
@keyframes demoScan { 0% { top: 0; opacity: .4; } 15% { opacity: 1; } 100% { top: 100%; opacity: .15; } }
.demo-estimate { position: absolute; right: 12px; bottom: 46px; z-index: 5; width: min(280px, 74%); background: rgba(11,18,32,.84); color: #fff; border-radius: 12px; padding: 11px 13px; box-shadow: 0 10px 26px rgba(0,0,0,.34); }
.de-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #cfe0ff; margin-bottom: 8px; }
.de-head::after { content: "▍"; animation: deCaret 1s steps(1) infinite; color: #9bc0ff; }
@keyframes deCaret { 50% { opacity: 0; } }
.de-lines { display: flex; flex-direction: column; gap: 5px; }
.de-line { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; overflow: hidden; animation: deType .42s ease both; }
.de-k { color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.de-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.de-line.total { margin-top: 4px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.18); font-size: 13.5px; }
.de-line.total .de-v { color: #7ee2a8; }
@keyframes deType { from { clip-path: inset(0 100% 0 0); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.demo-thumbs { display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.demo-thumb { width: 56px; height: 40px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; opacity: .55; cursor: pointer; padding: 0; background: none; transition: opacity .2s, transform .2s, border-color .2s; }
.demo-thumb svg, .demo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.demo-thumb.on { border-color: var(--accent); opacity: 1; transform: translateY(-3px); }
.demo-hint { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* auth: google slot + back link */
.google-slot-auth { justify-content: center; margin: 12px 0 2px; }
.auth-back { margin: 10px 0 0; font-size: 13px; }
.auth-back a { color: var(--muted); text-decoration: none; }
.auth-back a:hover { color: var(--ink); }

/* workspace back bar */
.workspace-bar { max-width: 1180px; margin: 0 auto 12px; }

/* camera capture modal */
.camera-modal { position: fixed; inset: 0; z-index: 110; background: rgba(8,12,20,.86); display: grid; place-items: center; padding: 18px; }
.camera-panel { width: min(720px, 96vw); background: #0b0f17; border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.camera-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 12px; overflow: hidden; }
/* contain (not cover) so the preview shows the WHOLE frame that gets captured — what you see is what you get */
#camera-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
#camera-video.mirror { transform: scaleX(-1); }   /* mirror only the front/selfie camera */
.camera-grid { position: absolute; inset: 0; pointer-events: none; background-image:
    linear-gradient(rgba(255,255,255,.26) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.26) 1px, transparent 1px);
  background-size: 33.333% 33.333%; background-position: center; opacity: .6; }
.camera-switch { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35); background: rgba(8,12,20,.55); color: #fff; font-size: 18px; cursor: pointer;
  display: grid; place-items: center; }
.camera-switch:hover { background: rgba(8,12,20,.82); }
.camera-hint { color: #9fb0c4; font-size: 12.5px; margin: 10px 2px 0; line-height: 1.4; }
.camera-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.camera-actions .btn.ghost { color: #cbd5e1; border-color: #2a3340; background: transparent; }
.camera-err { color: #fca5a5; font-size: 13px; margin: 10px 2px 0; }

/* ====================================================================== */
/* Settings / quote builder / quotes / share                              */
/* ====================================================================== */
.modal2 { position: fixed; inset: 0; z-index: 96; background: rgba(8,12,20,.6); display: grid; place-items: start center; padding: 5vh 14px; overflow: auto; }
.modal2-panel { width: min(560px, 96vw); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 90vh; }
.modal2-panel.wide { width: min(720px, 96vw); }
.modal2-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal2-head h2 { margin: 0; font-size: 18px; }
.modal2-body { padding: 16px 18px; overflow: auto; }
.modal2-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal2-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.s2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 10px; }
.s2:first-child { margin-top: 0; }
.f2 { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12.5px; }
.f2 > span { color: var(--muted); font-size: 11.5px; }
.f2 input, .f2 select, .f2 textarea { font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
.f2 input:focus, .f2 select:focus, .f2 textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.logo-prev { width: 96px; height: 64px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 11px; background: var(--bg); flex: 0 0 auto; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }

.q-render { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 6px; }
.ql-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: 11px 0 5px; }
.ql-row { display: grid; grid-template-columns: 1fr 64px 58px 82px 78px 26px; gap: 6px; align-items: center; margin-bottom: 5px; }
.ql-row input { font: inherit; font-size: 12.5px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); min-width: 0; }
.ql-row input:focus { outline: none; border-color: var(--accent); background: #fff; }
.ql-total { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ql-del { border: none; background: none; color: var(--bad); font-size: 18px; cursor: pointer; line-height: 1; padding: 0; }
@media (max-width: 520px) { .ql-row { grid-template-columns: 1fr 50px 72px 24px; } .ql-row .ql-unit { display: none; } }
.q-totals, .bom-grand-box { margin-top: 14px; margin-left: auto; width: min(330px, 100%); border-top: 1px solid var(--line); padding-top: 10px; }
.qt-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 2px; font-size: 13.5px; }
.qt-row.grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 9px; font-size: 16px; font-weight: 700; }
.qt-row.grand b { color: var(--good); }

.quote-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.quote-row img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: #eee; flex: 0 0 auto; }
.qr-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qr-meta b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-meta span { color: var(--good); font-weight: 700; font-size: 13px; }
.qr-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.bom-grp td { background: #f6f8fb; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.bom-table .ldetail { color: var(--muted); font-size: 11px; }
.bom-top .btn { white-space: nowrap; align-self: center; margin-left: auto; }

.share-pop { position: fixed; inset: 0; z-index: 120; background: rgba(8,12,20,.55); display: grid; place-items: center; padding: 18px; }
.share-card { width: min(360px, 94vw); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; }
.share-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 6px; }
.share-head b { font-size: 15px; }
.share-body { display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.share-item { text-align: left; background: none; border: none; padding: 12px; border-radius: 10px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.share-item:hover { background: #f3f5f8; }
.share-url { font-size: 11.5px; color: var(--muted); padding: 8px 12px; word-break: break-all; border-top: 1px solid var(--line); margin-top: 4px; }
.qr-acts .danger { color: var(--bad); }

/* ====================================================================== */
/* Site-survey edit · find/choose tiles · selection summary · confirm     */
/* (added 2026-06-29 — review feedback)                                   */
/* ====================================================================== */
.pcard-head-r { display: flex; align-items: center; gap: 8px; }
.survey-edit { white-space: nowrap; }
.survey-edit.editing { background: #eef4ff; border-color: var(--accent); color: var(--accent); }
.sv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.sv-in { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; box-sizing: border-box; }
.sv-in:focus { outline: none; border-color: var(--accent); background: #fff; }
textarea.sv-in { resize: vertical; min-height: 38px; }
.sv-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.rec-find { margin-top: 4px; }

/* mobile-only "Choose tiles ↓" jump button at the bottom of the survey card */
.survey-choose { display: none; width: 100%; margin-top: 12px; }
@media (max-width: 880px) {
  .survey-choose { display: block; }
  .survey-choose[hidden] { display: none; }
}

/* "About to render" tile-selection summary (both surfaces, any tab) */
.sel-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 4px 0 10px; padding: 9px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; line-height: 1.4; }
.sel-summary .ss-k { color: var(--muted); font-weight: 600; }
.sel-summary .ss-v { color: var(--ink); font-weight: 600; }
.sel-summary .ss-dot { color: #c7ccd6; margin: 0 2px; }

/* confirm dialog + welcome-to-profile note */
.modal2-panel.narrow { width: min(420px, 96vw); }
.cf-lead { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.cf-warn { margin: 8px 0; font-size: 13px; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; }
.cf-sub { margin: 6px 0 0; font-size: 12px; }
.welcome-note { background: #eef4ff; border: 1px solid #d7e3fb; border-radius: 10px; padding: 12px 14px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; }
.welcome-note b { font-size: 14px; }
.welcome-note span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.btn.danger { color: var(--bad); border-color: #f3c0c0; background: #fff; }
.btn.danger:hover { background: #fdecec; }

/* Estimate of materials — mobile: keep the price/amount column from getting clipped */
@media (max-width: 560px) {
  .bom-panel { padding: 14px 12px 18px; }
  .bom-body { font-size: 12.5px; }
  .bom-table th, .bom-table td { padding: 7px 6px; }
  .bom-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .q-totals, .bom-grand-box { width: 100%; margin-left: 0; }
  .bom-top { flex-wrap: wrap; }
  .bom-top .btn { margin-left: 0; width: 100%; }
  .bom-grand b { font-size: 19px; }
}

/* ---- estimate assumptions (bom modal) + tile comparison -------------------- */
.bom-top-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.bom-assume { border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; padding: 10px 12px; margin: 12px 0; }
.bom-assume-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.bom-assume-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.bom-assume-controls select { font-size: 13px; padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); min-width: 150px; }
.bom-assume-list { margin-top: 10px; }
.bom-assume-list summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.bom-assume-list ul { margin: 8px 0 2px; padding-left: 18px; }
.bom-assume-list li { font-size: 12.5px; color: var(--ink); margin: 3px 0; line-height: 1.45; }

.cmp-intro { font-size: 13px; color: var(--muted); margin: 2px 0 14px; }
.cmp-cols { display: flex; gap: 12px; flex-wrap: wrap; }
.cmp-col { position: relative; flex: 1 1 180px; min-width: 170px; max-width: 260px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); box-shadow: var(--shadow); }
.cmp-col.low { border-color: var(--accent); box-shadow: 0 0 0 2px #2563eb22; }
.cmp-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--muted); line-height: 1; }
.cmp-sw { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #f1f3f6; margin-bottom: 8px; }
.cmp-sw img, .cmp-sw svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.cmp-brand { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.cmp-psf { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.cmp-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.cmp-line b { color: var(--ink); font-weight: 600; }
.cmp-line.const { color: #8a93a3; }
.cmp-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; font-size: 13px; color: var(--muted); }
.cmp-total b { color: var(--ink); font-size: 16px; }
.cmp-delta { text-align: right; font-size: 11.5px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.cmp-col.low .cmp-delta { color: var(--accent); font-weight: 600; }
.cmp-add { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.cmp-add input { width: 100%; font-size: 14px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.cmp-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 240px; overflow-y: auto; }
.cmp-pick { display: flex; align-items: center; gap: 9px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer; text-align: left; }
.cmp-pick:hover { border-color: var(--accent); background: #f3f7ff; }
.cmp-pick-sw { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: #f1f3f6; flex: 0 0 auto; }
.cmp-pick-sw img, .cmp-pick-sw svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-pick-txt { display: flex; flex-direction: column; min-width: 0; }
.cmp-pick-txt b { font-size: 13px; color: var(--ink); }
.cmp-pick-txt small { font-size: 11.5px; color: var(--muted); }
@media (max-width: 640px) { .cmp-col { flex: 1 1 100%; max-width: none; } .bom-assume-controls select { min-width: 0; flex: 1; } }
