/* listing-manager.css — Shared listing management styles */

/* ========== LISTING CARDS ========== */
.listing-card {
  background: var(--white, #fff); border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1)); border: 1px solid var(--gray-200, #e5e7eb);
  overflow: hidden; transition: var(--transition, all 0.2s);
  cursor: pointer; position: relative;
}
.listing-card:hover { box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.15)); }
.listing-card-hero {
  aspect-ratio: 4/3; background: linear-gradient(135deg, var(--gray-100, #f3f4f6), var(--gray-200, #e5e7eb));
  overflow: hidden; position: relative;
}
.listing-card-hero img { width: 100%; height: 100%; object-fit: cover; }
.listing-card .hero-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted, #9ca3af); font-size: 2.5rem;
}
.listing-card-body { padding: 16px 18px; }
.listing-card-body .listing-addr {
  font-weight: 700; font-size: 0.95rem; color: var(--text, #111); margin-bottom: 4px;
}
.listing-card-body .listing-date {
  font-size: 0.8rem; color: var(--text-light, #6b7280); margin-bottom: 8px;
}
.listing-card-pay {
  position: absolute; bottom: 12px; right: 12px;
  background: var(--primary, #1a1a2e); color: var(--white, #fff); border: none;
  padding: 6px 14px; border-radius: var(--radius-sm, 8px); font-size: 0.82rem;
  font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: var(--transition, all 0.2s); box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
}
.listing-card-pay:hover { background: var(--primary-light, #22223a); box-shadow: var(--shadow-md); }

/* ========== LISTING DETAIL VIEW ========== */
.listing-detail-view { display: none; }
.listing-detail-view.active { display: block; }
.listing-detail-back {
  background: none; border: none; color: var(--accent, #4361ee); font-size: 0.92rem;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 0; margin-bottom: 16px; font-weight: 600;
}
.listing-detail-back:hover { text-decoration: underline; }
.listing-detail-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.listing-detail-header h3 { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* ========== LISTING TOOLBAR ========== */
.listing-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding: 10px 0; margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.listing-toolbar .toolbar-left,
.listing-toolbar .toolbar-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ========== GALLERY GRID ========== */
.listing-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.listing-gallery-grid.collapsed { position: relative; }
.listing-gallery-grid.collapsed::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 50%; background: linear-gradient(to bottom, transparent, var(--white, #fff));
  pointer-events: none; z-index: 1;
}
.gallery-show-all-wrapper { text-align: center; padding: 4px 0 16px; }
.gallery-show-all-btn {
  display: inline-block; padding: 8px 24px; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm, 8px); cursor: pointer;
  background: transparent; color: var(--accent, #3b82f6); border: 2px solid var(--accent, #3b82f6);
  transition: background 0.15s, color 0.15s;
}
.gallery-show-all-btn:hover {
  background: var(--accent, #3b82f6); color: var(--white, #fff);
}
.listing-gallery-item {
  aspect-ratio: 4/3; border-radius: var(--radius-sm, 8px); overflow: hidden;
  cursor: pointer; position: relative;
  transition: var(--transition, transform 0.2s, box-shadow 0.2s);
}
/* Rollover "float" — lift + shadow on hover (restores the effect the gallery
   lost when the grid moved to the .listing-gallery-item class; the float used
   to live on the old .gallery-item rule). Suppressed while a hide animation is
   in flight so it doesn't fight the .hiding scale-down. */
.listing-gallery-item:not(.hiding):hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg, 0 10px 24px rgba(0,0,0,0.18));
}
.listing-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.listing-gallery-item .gallery-download { opacity: 0; }
.listing-gallery-item:hover .gallery-download { opacity: 1; }

/* ========== HIDE / UNHIDE BUTTONS ========== */
.gallery-hide-btn {
  position: absolute; bottom: 10px; left: 10px;
  background: rgba(0,0,0,0.7); color: var(--white, #fff);
  width: 32px; height: 32px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.2s, transform 0.15s;
  z-index: 2;
}
.listing-gallery-item:hover .gallery-hide-btn { opacity: 1; }
.gallery-hide-btn:hover { background: rgba(0,0,0,0.9); transform: scale(1.1); }

.listing-gallery-item .hide-overlay {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); z-index: 1;
}
.listing-gallery-item .hide-overlay svg { width: 48px; height: 48px; opacity: 0.8; }
.listing-gallery-item.hiding .hide-overlay { display: flex; }
.listing-gallery-item.hiding > img { opacity: 0.3; transition: opacity 0.4s ease; }

/* Hidden section items */
.lm-hidden-grid .listing-gallery-item { opacity: 0.5; }
.lm-hidden-grid .listing-gallery-item > img { opacity: 0.5; }
.lm-hidden-grid .listing-gallery-item .hide-overlay { display: flex; background: rgba(0,0,0,0.3); }

.gallery-unhide-btn {
  position: absolute; bottom: 10px; left: 10px;
  background: var(--accent, #3b82f6); color: var(--white, #fff);
  width: 32px; height: 32px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.2s, transform 0.15s;
  z-index: 2;
}
.lm-hidden-grid .listing-gallery-item:hover .gallery-unhide-btn { opacity: 1; }
.gallery-unhide-btn:hover { background: var(--accent-hover, #2563eb); transform: scale(1.1); }

/* ========== MANAGEMENT SECTION ========== */
.listing-management-section {
  margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--gray-200, #e5e7eb);
}

/* ========== HERO BANNER ========== */
.listing-hero-banner {
  width: 100%; max-height: 400px; border-radius: var(--radius-md, 12px);
  overflow: hidden; margin-bottom: 20px; background: var(--gray-100, #f3f4f6);
}
.listing-hero-banner img {
  width: 100%; height: 100%; max-height: 400px; object-fit: cover; display: block;
}

/* ========== HIDDEN PHOTOS SECTION ========== */
.lm-hidden-section { margin-top: 12px; }
.lm-hidden-toggle {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--gray-50, #f9fafb); border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-sm, 8px); cursor: pointer; width: 100%;
  font-size: 0.85rem; font-weight: 600; color: var(--text-light, #6b7280);
  transition: var(--transition, all 0.2s);
}
.lm-hidden-toggle:hover { background: var(--gray-100, #f3f4f6); }
.lm-hidden-toggle .chevron {
  transition: transform 0.2s; display: inline-block; font-size: 0.7rem;
}
.lm-hidden-toggle .chevron.open { transform: rotate(180deg); }
.lm-hidden-grid {
  display: none; gap: 10px; padding: 10px 0;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.lm-hidden-grid.expanded { display: grid; }

/* Hide animation */
.listing-gallery-item.hiding {
  opacity: 0; transform: scale(0.85); transition: opacity 0.8s, transform 0.8s;
}

/* ========== MATTERPORT MODAL ========== */
.lm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.lm-modal {
  background: var(--white, #fff); border-radius: 12px; width: 90%; max-width: 540px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18); overflow: hidden;
  max-height: 90vh; display: flex; flex-direction: column;
}
.lm-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200, #e5e7eb);
  flex-shrink: 0;
}
.lm-modal-header h3 { margin: 0; font-size: 1.1rem; }
.lm-modal-body { padding: 20px; overflow-y: auto; }
.lm-modal-close {
  background: none; border: none; font-size: 1.4rem; cursor: pointer;
  color: var(--text-light, #6b7280); line-height: 1;
}
.lm-modal-close:hover { color: var(--text, #111); }
.lm-modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--gray-200, #e5e7eb); flex-shrink: 0;
}

/* ========== CONFIRM DIALOG (module-owned, lmConfirm in listing-manager.js) ==========
   Every host portal gets a dialog with real button labels — only the
   photographer portal supplies `showConfirmModal`, and the native
   window.confirm the other two fell back to cannot be labelled at all.
   Selectors are TWO classes deep on purpose: portal inline CSS loads AFTER
   this file, so a single-class rule would lose the tie to `.btn`. */
/* Stacking: ABOVE every full-screen surface this module owns. The plain
   .lm-modal-overlay is z 1000, but a confirm can open while the IFP editor
   (9990), the Edit Gallery (9998), the download modal (9999) or the fxlb
   viewer (10010) is up: a CubiCasa Re-sync that returns after the editor was
   opened asks "Restore deleted floor plans?". At 1000 that dialog was
   INVISIBLE yet held focus on its OK button, so Enter restored deleted plans
   with no visible confirm (D-2). 10020 still sits under the customer (10060)
   and photographer (10050) toast containers; the admin container (9999) is
   already under the viewer and download modal, same trade-off. Pinned by
   tests/test_floorplan_modal_close_frontend.py. */
.lm-modal-overlay.lm-confirm-overlay { z-index: 10020; }
.lm-confirm-overlay .lm-modal { max-width: 460px; }
.lm-confirm-overlay .lm-modal-header h3 { font-size: 1rem; }
.lm-confirm-overlay .lm-modal-body { padding: 16px 20px; }
.lm-confirm-overlay .lm-modal-body p {
  margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--text, #111);
}
.lm-modal .lm-confirm-ok {
  background: var(--accent, #4361ee);
  border: 1px solid var(--accent, #4361ee);
  color: #fff;
}
.lm-modal .lm-confirm-ok:hover {
  background: var(--accent-hover, #2563eb);
  border-color: var(--accent-hover, #2563eb);
  color: #fff;
}
.lm-form-group { margin-bottom: 16px; }
.lm-form-group:last-child { margin-bottom: 0; }
.lm-form-label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text, #111); margin-bottom: 6px;
}
.lm-form-input {
  width: 100%; padding: 10px 14px; font-size: 0.95rem; font-family: inherit;
  border: 1.5px solid var(--gray-300, #d1d5db); border-radius: var(--radius-sm, 8px);
  background: var(--white, #fff); color: var(--text, #111);
  outline: none; transition: border-color 0.2s;
}
.lm-form-input:focus { border-color: var(--accent, #4361ee); }
.lm-form-input-group { display: flex; align-items: stretch; }
.lm-form-input-group .lm-form-input {
  border-radius: var(--radius-sm, 8px) 0 0 var(--radius-sm, 8px);
  border-right: none; flex: 1;
}
.lm-form-ext-label {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--gray-100, #f3f4f6); border: 1.5px solid var(--gray-300, #d1d5db);
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
  font-size: 0.85rem; color: var(--text-muted, #9ca3af); white-space: nowrap;
}

/* ========== FULLSCREEN GALLERY OVERLAY ========== */
.lm-fs-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  z-index: 9998; display: none; overflow-y: auto;
}
.lm-fs-overlay.active { display: block; }
/* `flex-wrap` is what lets the PR-2 selection bar sit BESIDE Save Gallery /
   Discard (R-H) without ever pushing them off the edge: on a narrow window the
   bar drops to its own line instead of overflowing. The drag auto-scroll is
   unaffected because it MEASURES this header's height every pass rather than
   assuming one (D-10.1), so a two-line header simply moves the hot zone down. */
.lm-fs-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky; top: 0; z-index: 1; background: rgba(0,0,0,0.95);
  flex-wrap: wrap;
}
.lm-fs-header h3 {
  color: #fff; font-size: 1.1rem; font-weight: 700; margin: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lm-fs-actions { display: flex; gap: 8px; }
.lm-fs-actions .btn {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
  transition: background 0.15s;
}
.lm-fs-actions .btn:hover { background: rgba(255,255,255,0.22); }
.lm-fs-actions .btn-accent {
  background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6);
}
.lm-fs-actions .btn-accent:hover { background: #2563eb; }
/* ---- Contextual action bar (D-5 / R-H) ----
   Rendered only while something is selected, and it sits BESIDE the header
   actions rather than replacing them — Save Gallery must stay one click away
   while a selection is live.
   `[hidden]` needs an explicit rule here: the attribute's UA default is
   `display: none`, which a `display: flex` on the same element OUT-SPECIFIES,
   so without this the empty bar would still occupy the header. */
.lm-fs-selbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 4px 10px; border-radius: 10px;
  background: rgba(59,130,246,0.14); border: 1px solid rgba(59,130,246,0.45);
}
.lm-fs-selbar[hidden] { display: none; }
.lm-fs-selcount {
  color: #fff; font-size: 0.8rem; font-weight: 700; white-space: nowrap;
  padding: 0 4px;
}
.lm-fs-selbar .btn {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.22);
  padding: 5px 12px; border-radius: 8px; font-size: 0.8rem; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.lm-fs-selbar .btn:hover { background: rgba(255,255,255,0.24); }

/* ---- The "Select photos" reveal (brief OQ-1 FALLBACK) ----
   The owner's PR-2 walk answered OQ-1 — "will agents discover the checkbox?" —
   with a clear no: every selection control is `opacity: 0` until hover and
   nothing in the overlay's visible text says selecting exists. So the header
   carries a way IN, and a sentence saying what to do next.

   It is a REVEAL, not a mode: pressing it changes no click semantics anywhere.
   The button retires the moment something IS selected, because the action bar
   then stands as proof that selecting exists and two explainers in one header
   is noise. `[hidden]` is spelled out on both, for the same reason the bar
   needs it: the UA default is out-specified by a `display` on the element. */
.lm-fs-hintbtn {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.lm-fs-hintbtn:hover { background: rgba(255,255,255,0.22); }
.lm-fs-hintbtn[aria-pressed="true"] {
  background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6);
}
.lm-fs-hintbtn[hidden] { display: none; }
.lm-fs-selhint {
  display: flex; align-items: center; color: #fff;
  font-size: 0.8rem; padding: 4px 10px; border-radius: 10px;
  background: rgba(59,130,246,0.14); border: 1px solid rgba(59,130,246,0.45);
}
.lm-fs-selhint[hidden] { display: none; }

.lm-fs-close {
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 1.3rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lm-fs-close:hover { background: rgba(255,255,255,0.25); }
.lm-fs-grid {
  padding: 20px 24px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px;
  /* Positioned ancestor for .lm-fs-insert-caret — without it the caret is laid
     out against the viewport and points at nothing. */
  position: relative;
}

/* ---- Density toggle (D-9) ----
   Galleries are 30-50 photos and only ~16 fit on a 1440x900 laptop at the 240px
   minimum, which is what turns every long move into a drop-and-scroll relay.
   S (~120px) puts a 50-photo gallery on roughly one screen.

   PRECEDENCE, deliberately, and it has two halves:
   1. These are TWO-class selectors (0,2,0) while the generic
      `@media (max-width: 900px) { .lm-fs-grid }` override below is a single
      class (0,1,0) — and a media query adds no specificity — so an explicit
      density choice wins at every width, with no `!important` and no dependence
      on source order. The mobile rule still supplies its own padding, which
      these do not touch.
   2. Because of (1), the narrow-width column minimums have to be restated per
      level inside that media block, or the default M would silently make tiles
      BIGGER below 900px than they are today. Those twins carry the same
      specificity and win on source order (the media block is later), which is
      the ordinary mobile-last cascade. Change one, change the other. */
.lm-fs-grid.lm-fs-density-s { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.lm-fs-grid.lm-fs-density-m { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lm-fs-grid.lm-fs-density-l { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
/* ⚠️ NOTHING DISAPPEARS AT S. S is the headline relief — the density that
   finally fits a 50-photo gallery on one screen — so it must not also be the
   density where capabilities silently vanish. The ☰ grip, the eye, the position
   badge and (since PR-2) the selection checkbox and the Primary button all
   stay. They SHRINK to sit on a 120px tile, and their corners are unchanged so
   nothing moves house between densities (grip top-left, eye top-right, badge
   bottom-right, checkbox bottom-left, Primary centred). */
.lm-fs-grid.lm-fs-density-s .lm-fs-drag-handle {
  padding: 2px 5px; font-size: 0.72rem; top: 4px; left: 4px;
}
.lm-fs-grid.lm-fs-density-s .gallery-hide-btn {
  width: 24px; height: 24px; top: 4px; right: 4px;
}
.lm-fs-grid.lm-fs-density-s .gallery-hide-btn svg { width: 12px; height: 12px; }
.lm-fs-grid.lm-fs-density-s .lm-fs-order-badge {
  width: 18px; height: 18px; font-size: 0.6rem; bottom: 4px; right: 4px;
}
.lm-fs-grid.lm-fs-density-s .lm-fs-select-box {
  width: 20px; height: 20px; bottom: 4px; left: 4px;
}
.lm-fs-grid.lm-fs-density-s .lm-fs-select-box svg { width: 11px; height: 11px; }
/* At S the bottom edge is only ~74px of clear space between the 20px checkbox
   and the 18px badge, so the pill drops its LABEL and keeps the star. The
   BUTTON itself stays — nothing disappears at S; it just gets terser. */
.lm-fs-grid.lm-fs-density-s .lm-fs-primary-btn {
  padding: 4px 7px; font-size: 0.62rem; gap: 0; bottom: 4px;
}
.lm-fs-grid.lm-fs-density-s .lm-fs-primary-label { display: none; }

.lm-fs-density { display: flex; gap: 2px; }
.lm-fs-density-btn {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2);
  min-width: 30px; padding: 5px 8px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.lm-fs-density-btn:first-child { border-radius: 8px 0 0 8px; }
.lm-fs-density-btn:last-child { border-radius: 0 8px 8px 0; }
.lm-fs-density-btn:hover { background: rgba(255,255,255,0.22); }
.lm-fs-density-btn.is-active {
  background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6);
}

.lm-fs-item {
  border-radius: 8px; overflow: hidden;
  position: relative; cursor: pointer;
}
.lm-fs-item img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  transition: transform 0.2s;
}
.lm-fs-item:hover img { transform: scale(1.03); }
.lm-fs-item.dragging { opacity: 0.4; }
/* FLIP (D-10.5): a drop moves the existing tiles and plays the move back, so
   the user can see WHAT moved instead of the grid teleporting. Kept in lockstep
   with FS_FLIP_MS in listing-manager.js. */
.lm-fs-item.lm-fs-flipping { transition: transform 150ms ease; }
/* The SHARED insertion visual (D-10.4). PR-3's click-to-place strips render the
   same class, so a drag and a click teach the same thing. pointer-events:none is
   load-bearing — a caret that swallowed the drop would recreate M-1. */
.lm-fs-insert-caret {
  position: absolute; width: 4px; border-radius: 2px; z-index: 2;
  background: var(--accent, #3b82f6); box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
  transform: translateX(-50%); pointer-events: none; display: none;
}
.lm-fs-insert-caret.is-active { display: block; }

/* ---- Click-to-place insertion strips (PR-3: D-4 / R-P2, R-P3, R-P7) ----
   "Tiles select, GAPS place." One strip on each tile's LEFT edge plus a
   trailing one on the last tile's right edge gives every one of the n+1 caret
   positions a real click target; the row-end gutters and the grid's own padding
   are covered by the delegated grid handler, which resolves the same caret
   position from pointer coordinates (R-P2).

   ABSOLUTE, INSIDE THE TILE, and that is a requirement rather than a
   convenience: a real grid child would join the `auto-fill` column math and
   reflow the entire gallery the moment a selection appeared. The tile is
   already `position: relative` for the caret.

   The strip is transparent and draws nothing of its own — the SHARED
   `.lm-fs-insert-caret` above is the hover/focus feedback, so a click-to-place
   and a drag teach the same thing (D-10.4).

   It carries no z-index on purpose. It is emitted first inside the tile, so
   every corner control is a later sibling and paints — and hit-tests — above
   the 14px the strip overhangs into the tile edge. That band is where the grip
   (top-left) and the checkbox (bottom-left) live, and a placement target that
   swallowed the checkbox would take away the only control that starts a
   selection. The caret itself sits at z-index 2 and is pointer-events:none, so
   it draws above the strip without ever eating the click. */
.lm-fs-insert-strip {
  display: none; position: absolute; top: 0; bottom: 0;
  left: -14px; width: 28px; padding: 0; margin: 0;
  border: none; background: transparent; cursor: pointer;
}
.lm-fs-insert-strip.lm-fs-insert-end { left: auto; right: -14px; }
/* R-P3 — a STATE rule, and the only thing that makes the strips appear. With
   nothing selected there is nothing to place, so a tile click must reach the
   photo viewer exactly as it does today and no strip may intercept it. This is
   NOT a density rule: the strips are sized from the tile and work at S, where
   the 28px width straddles the narrower 10px gutter (R-P7). */
.lm-fs-grid.lm-fs-selecting .lm-fs-insert-strip { display: block; }
/* Only the LAST tile's trailing strip is a real slot — every other tile's
   "after" gap IS the next tile's "before" gap, and a second target for one gap
   would double the tab stops for nothing. `is-last` is stamped by
   _fsApplyInsertStrips on both render paths, because a keyed patch relocates
   tiles without rebuilding them. */
.lm-fs-grid.lm-fs-selecting .lm-fs-insert-strip.lm-fs-insert-end { display: none; }
.lm-fs-grid.lm-fs-selecting .lm-fs-insert-strip.lm-fs-insert-end.is-last { display: block; }
/* The keyboard path's own feedback. A mouse user gets the caret from hover; a
   keyboard user gets the caret from focus AND this ring, because the strip is
   otherwise invisible and a focus stop you cannot see is not a focus stop. */
.lm-fs-insert-strip:focus-visible {
  outline: 2px solid var(--accent, #3b82f6); outline-offset: -2px;
}

.lm-fs-drag-handle {
  display: none; position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.6); color: #fff; padding: 3px 7px;
  border-radius: 4px; font-size: 0.85rem; cursor: grab;
}
/* The grip is the real drag handle now (D-10.6) — it is the only draggable
   element in a tile, so a click on the photo can never start a drag. */
.lm-fs-drag-handle:hover { background: rgba(0,0,0,0.8); }
.lm-fs-drag-handle:active { cursor: grabbing; }
.lm-fs-order-badge {
  position: absolute; bottom: 6px; right: 6px;
  background: var(--accent, #3b82f6); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.lm-rearrange-mode .lm-fs-drag-handle { display: block; }
.lm-rearrange-mode .lm-fs-order-badge { display: flex; }
/* No `cursor: grab` on the tile body: the body is not draggable any more (the
   ☰ grip is), and a grab cursor on a click target that opens the viewer taught
   exactly the wrong affordance (L-3). */
.lm-rearrange-mode .lm-fs-item {
  outline: 2px solid rgba(255,255,255,0.15); outline-offset: -2px;
}

/* In-overlay Hide control (Edit Gallery). The shared .gallery-hide-btn reveal
   selector keys off .listing-gallery-item:hover, which the overlay grid items
   are NOT — so re-arm visibility on .lm-fs-item hover (and always-on at touch
   widths where there is no hover). Position top-right so it doesn't collide with
   the drag handle (top-left) or the order badge (bottom-right). */
.lm-fs-item .gallery-hide-btn {
  top: 6px; right: 6px; bottom: auto; left: auto;
}
.lm-fs-item:hover .gallery-hide-btn { opacity: 1; }
@media (hover: none) {
  .lm-fs-item .gallery-hide-btn { opacity: 1; }
}

/* ---- Selection (PR-2: D-1, D-3, R-I) ----
   The checkbox takes the ONE free corner — grip top-left, eye top-right, badge
   bottom-right — so nothing had to move house to make room for it. It is
   hover-revealed like the eye, but a SELECTED tile keeps its box visible at all
   times: the checkmark is the state, and a state you can only see by hovering
   is not a state.
   D-3: checkmark + accent border, and no selection-sequence number — a placed
   group lands in gallery order (D-6), so a number would promise an ordering the
   operation does not honour. */
.lm-fs-item .lm-fs-select-box {
  position: absolute; bottom: 6px; left: 6px;
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  background: rgba(0,0,0,0.65); color: transparent;
  border: 2px solid rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s;
  z-index: 3;
}
.lm-fs-item:hover .lm-fs-select-box { opacity: 1; }
/* The reveal's SOLE mechanism — the entire difference the header button makes
   is that the checkboxes stop waiting for a hover. It wins on specificity
   (0,4,0 against the base rule's 0,2,0), so it does not depend on source order,
   and it is deliberately `opacity` rather than `display`: nothing may ever hide
   this control, at any density (R-I). */
.lm-fs-grid.lm-fs-select-hint .lm-fs-item .lm-fs-select-box { opacity: 1; }
.lm-fs-item .lm-fs-select-box:hover { background: rgba(0,0,0,0.85); }
.lm-fs-item.is-selected .lm-fs-select-box {
  opacity: 1; color: #fff;
  background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6);
}
.lm-fs-item.is-selected {
  outline: 3px solid var(--accent, #3b82f6); outline-offset: -3px;
}
/* The tile outline is the selected state, so it must beat the generic
   rearrange-mode outline regardless of source order. */
.lm-rearrange-mode .lm-fs-item.is-selected {
  outline: 3px solid var(--accent, #3b82f6); outline-offset: -3px;
}
/* While a selection is live a plain click TOGGLES rather than opening the
   viewer, so the hover zoom — which is the "click to look closer" affordance —
   is suppressed. Deliberately NOT a cursor change: `copy` reads as duplicate
   and `pointer` is already the tile's cursor, so neither would say anything
   true. The checkmarks and the action bar are the real signal. */
.lm-fs-grid.lm-fs-selecting .lm-fs-item:hover img { transform: none; }

/* ---- Set as Primary, per-tile (D-7) ----
   Position 1 is the public listing's og:image, the 2x2 hero tile and the first
   photo in the REPLACE-ALL MLS push, so "make this the hero" gets a one-click
   path that needs no selection at all.

   BOTTOM-CENTRE, not tile-centre. A centred pill sits exactly where the two
   most common gestures land: with nothing selected the middle of a tile is the
   viewer's QC click, and in selecting state it is the toggle — so a pill there
   turns both into an accidental reorder, worst of all at S where it would span
   more than half a 120px tile. On the bottom edge it lives in the gap between
   the checkbox (bottom-left) and the position badge (bottom-right) and overlaps
   none of the four corner controls at any density. */
.lm-fs-item .lm-fs-primary-btn {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px; border: none;
  background: rgba(0,0,0,0.78); color: #fff;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap;
  cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s;
  z-index: 3;
}
.lm-fs-item:hover .lm-fs-primary-btn { opacity: 1; }
.lm-fs-item .lm-fs-primary-btn:hover { background: var(--accent, #3b82f6); }
/* The ONE place the pill is hidden, and it is a STATE rule, not a density rule:
   while a selection is live a tile click means "toggle", and the bar's own
   "Set as Primary" (enabled at exactly one selected) covers the operation. A
   hover control that reorders the gallery has no business under a gesture that
   is supposed to tick a checkbox. This does not weaken "nothing disappears at
   S" — leave selecting state and the pill is back at every density. */
.lm-fs-grid.lm-fs-selecting .lm-fs-item .lm-fs-primary-btn { display: none; }
@media (hover: none) {
  .lm-fs-item .lm-fs-select-box { opacity: 1; }
  .lm-fs-item .lm-fs-primary-btn { opacity: 1; }
}

/* In-overlay Hidden Photos section (mirrors the retired main-card section). */
.lm-fs-hidden-section {
  margin: 16px 12px 24px;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 12px;
}
.lm-fs-hidden-section .lm-hidden-toggle {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
}
.lm-fs-hidden-section .lm-hidden-toggle:hover { background: rgba(255,255,255,0.12); }
.lm-fs-hidden-note {
  margin: 8px 4px 0; font-size: 0.78rem; color: rgba(255,255,255,0.55);
}
.lm-fs-hidden-grid { margin-top: 10px; }

/* Toolbar buttons disabled while the Edit Gallery editor is dirty / saving /
   the post-save re-zip is still building (spec §4.3 #4 / M-3). */
.btn.is-disabled, .btn:disabled {
  opacity: 0.5; pointer-events: none; cursor: not-allowed;
}

/* ========== DOWNLOAD MODAL ========== */
.lm-dl-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.lm-dl-modal {
  background: var(--white, #fff); border-radius: 12px; width: 90%; max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18); overflow: hidden;
}
.lm-dl-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.lm-dl-header h3 { margin: 0; font-size: 1.1rem; }
.lm-dl-body { padding: 20px; }
.lm-dl-body label {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  cursor: pointer; font-size: 0.9rem;
}
.lm-dl-custom-inputs {
  display: none; gap: 8px; align-items: center; padding: 0 0 0 26px;
  margin-bottom: 10px;
}
.lm-dl-custom-inputs.visible { display: flex; }
.lm-dl-custom-inputs input {
  width: 80px; padding: 6px 8px; border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 6px; font-size: 0.85rem;
}
.lm-dl-footer {
  display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .listing-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .listing-detail-header h3 { font-size: 1.05rem; }
  .listing-toolbar { gap: 6px; }
  .listing-toolbar .toolbar-left,
  .listing-toolbar .toolbar-right { gap: 6px; }
  .lm-fs-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 12px; }
  /* Density twins — see the D-9 precedence note above. The M row IS the 160px
     the generic rule sets, restated because the desktop M rule would otherwise
     out-specify it and make narrow-screen tiles bigger than they are today. */
  .lm-fs-grid.lm-fs-density-s { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .lm-fs-grid.lm-fs-density-m { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .lm-fs-grid.lm-fs-density-l { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .lm-fs-header { padding: 12px 16px; gap: 8px; }
  .lm-fs-actions { gap: 4px; flex-wrap: wrap; }
  .lm-fs-density-btn { min-width: 26px; padding: 5px 6px; }
}

/* ========== MEDIA UPLOAD — shared base ==========
   ListingManager is loaded by the admin, photographer, and customer portals,
   but the `.media-upload-area` rules were only ever defined inline in
   customer-portal.html. That left every ListingManager upload box (floor
   plans, documents, and the staff video control) UNSTYLED in the admin and
   photographer portals. Defining the base here fixes them. customer-portal.html
   links this stylesheet BEFORE its own inline <style>, so its inline copy still
   wins the cascade there — no change to the customer portal. */
.media-upload-area {
  border: 2px dashed var(--gray-300, #c9cfe0);
  border-radius: var(--radius-md, 12px);
  padding: 40px; text-align: center; cursor: pointer;
  background: var(--gray-50, #f8f9fc);
  transition: var(--transition, all 0.2s);
}
.media-upload-area:hover {
  border-color: var(--accent, #4361ee);
  background: var(--accent-light, rgba(67,97,238,0.12));
}
.media-upload-area p { color: var(--text-light, #6b7280); font-size: 0.9rem; margin-top: 8px; }
.media-upload-area .upload-icon { font-size: 2rem; color: var(--text-muted, #9aa2b8); }

/* ========== LISTING VIDEO — staff "Upload finished video" control ==========
   Hero affordance for the Track A (FrameX -> Vimeo) listing-video feature.
   Renders only for admin/photographer (customers are link-only). Styled as a
   film-themed dropzone so the primary staff action reads as intentional rather
   than as bare text. Markup in js/listing-manager.js renderVideoSectionControls. */
.lm-video-upload {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; margin-bottom: 10px;
  border: 2px dashed var(--gray-300, #c9cfe0);
  border-radius: var(--radius-md, 12px);
  background: var(--gray-50, #f8f9fc);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.lm-video-upload:hover,
.lm-video-upload--drag {
  border-color: var(--accent, #4361ee);
  background: var(--accent-light, rgba(67,97,238,0.12));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.12));
}
/* Slightly stronger cue while a file is being dragged over the dropzone. */
.lm-video-upload--drag {
  border-style: solid;
}
.lm-video-upload-badge {
  flex: 0 0 auto;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; line-height: 1;
  background: var(--accent-light, rgba(67,97,238,0.12));
}
.lm-video-upload-copy { flex: 1 1 auto; min-width: 0; text-align: left; }
.lm-video-upload-title {
  margin: 0; font-weight: 700; font-size: 0.95rem;
  color: var(--text, #1a1a2e);
}
.lm-video-upload-hint {
  margin: 3px 0 0; font-size: 0.78rem; line-height: 1.3;
  color: var(--text-muted, #9aa2b8);
}

/* Upload / processing status banner. JS toggles inline display:block and sets
   textContent, so this stays a block layout (the spinner is an inline ::before
   so it survives the inline display override). */
.lm-video-status {
  padding: 10px 14px; margin-bottom: 10px;
  font-size: 0.82rem; line-height: 1.45;
  color: var(--accent, #4361ee);
  background: var(--accent-light, rgba(67,97,238,0.12));
  border-radius: var(--radius-sm, 8px);
}
.lm-video-status::before {
  content: ""; display: inline-block; vertical-align: -2px;
  width: 13px; height: 13px; margin-right: 8px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: lm-video-spin 0.7s linear infinite;
}
@keyframes lm-video-spin { to { transform: rotate(360deg); } }

/* Standalone loading spinner (Push-to-MLS "Pushing…" / "Checking connection…"
   states). The markup carries only inline width/height/border-width, so without
   this rule it rendered as an invisible borderless square — this supplies the
   ring style, color, rounding, and animation. Size/border-width are overridable
   inline; reuses the lm-video-spin keyframe above. */
.lm-spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--border, #e5e7eb);
  border-top-color: var(--accent, #4361ee);
  border-radius: 50%;
  animation: lm-video-spin 0.7s linear infinite;
}

/* "or paste a link" divider above the staff link field. */
.lm-video-link-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 10px;
  color: var(--text-muted, #9aa2b8); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.lm-video-link-divider::before,
.lm-video-link-divider::after {
  content: ""; flex: 1 1 auto; height: 1px;
  background: var(--gray-200, #e2e6ef);
}

@media (max-width: 900px) {
  .lm-video-upload { padding: 16px; gap: 12px; }
  .lm-video-upload-badge { width: 42px; height: 42px; font-size: 1.3rem; }
}

/* ========== FLOOR PLAN PREVIEW CARDS (brief floor-plan-downloads) ==========
   One card per plan: a preview image that opens the plan large, the name, and
   a Download button (present only when the server emitted a download_url).
   Markup in js/listing-manager.js _renderFloorplanCards / viewFloorplan.
   Plans are line drawings, so the preview is object-fit: CONTAIN on white —
   cropping a plan to fill the tile would hide rooms. */
.lm-fp-bar { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.lm-fp-note {
  margin: 0 0 10px; font-size: 0.78rem; line-height: 1.4;
  color: var(--text-muted, #9aa2b8);
}
.lm-fp-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.lm-fp-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-sm, 8px); overflow: hidden;
}
.lm-fp-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 4/3; padding: 6px; margin: 0;
  border: 0; border-bottom: 1px solid var(--gray-200, #e5e7eb);
  background: var(--white, #fff); cursor: zoom-in; overflow: hidden;
}
.lm-fp-thumb img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  transition: transform 0.2s;
}
.lm-fp-thumb:hover img { transform: scale(1.03); }
.lm-fp-thumb:focus-visible { outline: 2px solid var(--accent, #4361ee); outline-offset: -2px; }
.lm-fp-placeholder { font-size: 2rem; color: var(--text-muted, #9aa2b8); }
/* A PDF plan: an icon face, never an <img> (it is opened via Download). */
.lm-fp-doc {
  flex-direction: column; gap: 4px; cursor: default;
  background: var(--gray-50, #f9fafb);
}
.lm-fp-doc-icon { font-size: 2.2rem; line-height: 1; }
.lm-fp-doc-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted, #9aa2b8);
}
/* A link / non-plan file keeps its classic row, spanning the whole grid so
   the display order is preserved. */
.lm-fp-row { grid-column: 1 / -1; min-width: 0; }
.lm-fp-row > div { margin-bottom: 0 !important; }
.lm-fp-meta { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; min-width: 0; }
.lm-fp-title {
  font-size: 0.85rem; font-weight: 500; color: var(--text, #111);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lm-fp-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lm-fp-actions .lm-fp-download { margin-right: auto; }
/* Version badges (brief floor-plan-versions piece C): what the file is, which
   CubiCasa version it is, and which version the Interactive Floor Plan shows.
   They wrap under the title; never truncated, never hidden. */
.lm-fp-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.lm-fp-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; line-height: 1.5;
  background: rgba(100,116,139,0.12); color: var(--text-muted, #475569);
  border: 1px solid rgba(100,116,139,0.25);
}
.lm-fp-badge--ifp {
  background: rgba(37,99,235,0.10); color: #1d4ed8; border-color: rgba(37,99,235,0.35);
}

/* The large view reuses the module modal shell, widened for a drawing. */
.lm-fp-viewer .lm-fp-viewer-modal { width: 96vw; max-width: 1100px; }
.lm-fp-viewer .lm-modal-header h3 {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lm-fp-viewer-body {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--white, #fff);
}
.lm-fp-viewer-body img {
  display: block; max-width: 100%; max-height: calc(90vh - 140px); object-fit: contain;
}

@media (max-width: 480px) {
  .lm-fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lm-fp-bar .lm-fp-download-all { width: 100%; }
}

/* ========== INTERACTIVE FLOOR PLAN EDITOR (spec-interactive-floor-plan §6) ==========
   Markup: js/listing-manager.js `_ifpInject` / `_ifpRender*`. Full-screen,
   modelled on Aryeo's editor: dark top bar, photo strip on the left, the plan
   on a light canvas. Every control is delegated off `.lm-ifp-overlay`.
   Rules that must survive the next touch:
   - NOTHING is display:none at any width. Narrow screens re-flow (the strip
     becomes a horizontal row above the plan); they never hide a control.
     The only display:none rules below are STATE rules ([hidden], not .active).
   - Dots are positioned in % of `.lm-ifp-frame`, which shrink-wraps the plan
     <img> exactly, so the stored 0..1 coordinates land on the same spot at any
     size. `touch-action: none` on a dot is what lets an iPad finger DRAG it
     instead of scrolling the page.
   - z-index 9990 sits under every portal toast container (9999 / 10050 / 10060)
     so save errors stay visible. */
.lm-ifp-overlay {
  position: fixed; inset: 0; z-index: 9990; display: none;
  flex-direction: column; background: #e9ecf1; color: var(--text, #111);
}
.lm-ifp-overlay.active { display: flex; }
.lm-ifp-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.lm-ifp-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #1f2433; color: #fff; flex: 0 0 auto;
}
.lm-ifp-header h3 { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; white-space: nowrap; }
.lm-ifp-plan-pick select {
  font: inherit; font-size: 0.9rem; font-weight: 600; max-width: 260px;
  padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25);
  background: #eef0f5; color: #111;
}
.lm-ifp-switch {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.85rem; cursor: pointer; color: #fff;
}
.lm-ifp-switch input { width: 18px; height: 18px; accent-color: var(--accent, #3b82f6); cursor: pointer; }
.lm-ifp-dirty { font-size: 0.8rem; color: #fcd34d; font-weight: 600; }
.lm-ifp-header-actions { margin-left: auto; display: flex; gap: 8px; }
.lm-ifp-header .btn {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  padding: 7px 16px; border-radius: 8px; font-size: 0.88rem; cursor: pointer;
}
.lm-ifp-header .btn:hover { background: rgba(255,255,255,0.22); }
.lm-ifp-header .btn.btn-accent { background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6); }
.lm-ifp-header .btn:disabled { opacity: 0.6; cursor: wait; }

.lm-ifp-body { flex: 1 1 auto; min-height: 0; display: flex; }
.lm-ifp-strip {
  flex: 0 0 220px; overflow-y: auto; padding: 12px; background: #f7f8fa;
  border-right: 1px solid #d7dbe3; display: flex; flex-direction: column; gap: 10px;
}
.lm-ifp-photo {
  position: relative; display: block; width: 100%; aspect-ratio: 3/2; padding: 0;
  border: 3px solid transparent; border-radius: 8px; overflow: hidden;
  background: #dfe3ea; cursor: pointer; flex: 0 0 auto;
}
.lm-ifp-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lm-ifp-photo:focus-visible { outline: 3px solid var(--accent, #3b82f6); outline-offset: 1px; }
.lm-ifp-photo.is-selected { border-color: var(--accent, #3b82f6); box-shadow: 0 0 0 3px rgba(59,130,246,0.35); }
/* D3: a used photo is dimmed and cannot be selected (aria-disabled). */
.lm-ifp-photo.is-used { cursor: not-allowed; }
.lm-ifp-photo.is-used img { opacity: 0.35; }
.lm-ifp-photo-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 1.6rem; }
.lm-ifp-used {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  background: rgba(17,24,39,0.78); color: #fff; font-size: 0.7rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}

.lm-ifp-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
/* min-height: the Step 1 and Step 2 prompts must be the SAME height. A bar
   that grows when Step 2's Cancel button appears shifts the plan by ~8px
   between selecting a photo and placing it, so the dot lands off the spot
   the user aimed at (caught in the pre-PR browser smoke test). */
.lm-ifp-step {
  flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  min-height: 48px; box-sizing: border-box;
  padding: 8px 16px; background: #fff; border-bottom: 1px solid #d7dbe3;
  color: #1d4ed8; font-size: 0.95rem;
}
.lm-ifp-step .btn { padding: 3px 10px; line-height: 1.3; }
.lm-ifp-step-num { font-weight: 700; }
.lm-ifp-step-hint { color: var(--text-muted, #6b7280); font-size: 0.82rem; }
.lm-ifp-count { margin-left: auto; color: var(--text-muted, #6b7280); font-size: 0.8rem; }
.lm-ifp-hidden-note {
  font-size: 0.78rem; font-weight: 600; color: #b45309;
  background: rgba(245,158,11,0.14); padding: 2px 8px; border-radius: 8px;
}
.lm-ifp-canvas {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px;
  display: flex; align-items: flex-start; justify-content: center;
}
.lm-ifp-stage { max-width: 100%; }
.lm-ifp-frame { position: relative; display: inline-block; background: #fff; line-height: 0; }
.lm-ifp-frame.is-placing .lm-ifp-plan-img { cursor: crosshair; }
.lm-ifp-plan-img {
  display: block; max-width: 100%; max-height: calc(100vh - 150px);
  width: auto; height: auto; user-select: none; -webkit-user-select: none;
}
.lm-ifp-empty { padding: 40px; color: var(--text-muted, #6b7280); line-height: 1.4; }
/* A plan whose preview is missing (PR-1 sends image_url + thumbnail_url null):
   a placeholder instead of the plan, and its existing dots as a list so they
   can still be opened, captioned and deleted. No full-res fallback, ever. */
.lm-ifp-noimg {
  width: min(720px, 100%); padding: 28px 24px; border-radius: 10px;
  background: #fff; border: 2px dashed #c7cdd8; text-align: center;
}
.lm-ifp-noimg-msg { margin: 0 0 6px; font-size: 1rem; font-weight: 600; color: #374151; }
.lm-ifp-noimg-sub { margin: 14px 0 8px; font-size: 0.82rem; color: var(--text-muted, #6b7280); }
.lm-ifp-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lm-ifp-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px;
  padding: 4px 10px 4px 4px; border: 1px solid #d7dbe3; border-radius: 20px;
  background: #f7f8fa; cursor: pointer; font-size: 0.82rem; color: #111;
}
.lm-ifp-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.lm-ifp-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-ifp-chip.is-unavailable { border-style: dashed; color: #6b7280; }
.lm-ifp-chip:focus-visible { outline: 3px solid var(--accent, #3b82f6); outline-offset: 2px; }

.lm-ifp-dot {
  position: absolute; width: 34px; height: 34px; padding: 0; margin: 0;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid #fff; background: #4b5563; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45); cursor: grab; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.lm-ifp-dot img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.lm-ifp-dot:focus-visible { outline: 3px solid var(--accent, #3b82f6); outline-offset: 2px; }
.lm-ifp-dot.is-dragging { cursor: grabbing; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 2; }
/* A dot whose photo is hidden / removed / on a canceled order: greyed, kept. */
.lm-ifp-dot.is-unavailable { background: #9ca3af; border-style: dashed; opacity: 0.8; }
.lm-ifp-dot-missing { color: #fff; font-weight: 700; font-size: 0.9rem; line-height: 1; }
.lm-ifp-overlay.is-saving .lm-ifp-strip,
.lm-ifp-overlay.is-saving .lm-ifp-stage { pointer-events: none; opacity: 0.7; }

.lm-ifp-pop-backdrop {
  position: absolute; inset: 0; z-index: 3; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lm-ifp-pop-backdrop[hidden] { display: none; }
.lm-ifp-pop {
  position: relative; width: 100%; max-width: 620px; max-height: 100%; overflow: auto;
  background: #fff; border-radius: 12px; padding: 48px 20px 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; gap: 10px;
}
.lm-ifp-pop-x {
  position: absolute; top: 8px; right: 10px; width: 36px; height: 36px;
  border: none; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #374151;
}
.lm-ifp-pop-img { display: block; width: 100%; max-height: 55vh; object-fit: contain; border-radius: 8px; background: #f3f4f6; }
.lm-ifp-pop-missing {
  padding: 16px; border-radius: 8px; background: #f3f4f6; color: #374151;
  font-size: 0.88rem; line-height: 1.45; margin-top: 24px;
}
.lm-ifp-cap-label { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; }
.lm-ifp-cap-count { font-weight: 400; color: var(--text-muted, #6b7280); }
.lm-ifp-pop-actions { display: flex; justify-content: space-between; gap: 10px; }
.lm-ifp-pop .lm-ifp-delete { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.lm-ifp-pop .lm-ifp-delete:hover { background: #991b1b; }

/* Tile side: the entry button in the Floor Plans header, and the D12 banner. */
.lm-ifp-entry { display: inline-flex; }
.lm-ifp-entry:empty { display: none; }
.lm-ifp-banner {
  margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm, 8px);
  background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.45);
  color: #92400e; font-size: 0.82rem; line-height: 1.45;
}
/* One line per cleared plan, each with its own Dismiss (brief ifp-followups
   item 2). Wraps, never hides, at any width. */
.lm-ifp-banner-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px;
}
.lm-ifp-banner-line .lm-ifp-dismiss { padding: 2px 10px; line-height: 1.3; }
.lm-ifp-banner-tail { margin-top: 6px; }
.lm-ifp-banner-note { margin-top: 6px; font-weight: 600; }
/* "Dots go on: [Without dimensions ▾]" (brief floor-plan-versions piece C):
   one row per floor with two CubiCasa versions, IFP editors only. Rows wrap,
   never hide, at any width. */
.lm-ifp-versions {
  margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm, 8px);
  background: rgba(37,99,235,0.06); border: 1px solid rgba(37,99,235,0.25);
  font-size: 0.82rem; line-height: 1.45; color: var(--text, #111);
}
.lm-ifp-versions-head span { color: var(--text-muted, #475569); }
.lm-ifp-version-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 8px;
}
.lm-ifp-version-floor { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lm-ifp-version-pick { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lm-ifp-version-pick select {
  font: inherit; font-size: 0.85rem; padding: 4px 8px; border-radius: 6px;
  border: 1px solid #cbd5e1; background: #fff; color: #111; max-width: 100%;
}
.lm-ifp-version-busy, .lm-ifp-version-locked { color: var(--text-muted, #475569); font-style: italic; }
.lm-ifp-version-note { margin-top: 8px; font-weight: 600; color: #1d4ed8; }
.lm-ifp-version-note.is-error { color: #b91c1c; }
/* The same selector in the editor's dark top bar. */
.lm-ifp-header .lm-ifp-version-pick { color: #fff; font-size: 0.85rem; }
.lm-ifp-header .lm-ifp-version-pick select {
  border-color: rgba(255,255,255,0.25); background: #eef0f5; font-weight: 600;
}
.lm-ifp-header .lm-ifp-version-busy { color: #fcd34d; }
/* Keyboard placement of a new dot: the plan image takes focus (Enter places
   the selected photo's dot at the centre). */
.lm-ifp-plan-img:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* Toasts while the editor is open. Every portal's toast container is
   `#toast-container`, fixed TOP-right, which is exactly where Close and
   Save & Exit sit, so a "photo already used" toast hid them for seconds.
   `body.lm-ifp-open` is set by openInteractiveFloorPlan and cleared by
   _ifpTeardown, so no other toast moves. The id+class selector outranks each
   portal's own `#toast-container` / `.toast-container` rule. */
body.lm-ifp-open #toast-container {
  top: auto;
  bottom: 16px;
}

@media (max-width: 800px) {
  /* Re-flow, never hide: the strip becomes a scrolling row above the plan. */
  .lm-ifp-body { flex-direction: column; }
  .lm-ifp-strip {
    flex: 0 0 auto; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: 0; border-bottom: 1px solid #d7dbe3; padding: 8px;
  }
  .lm-ifp-photo { width: 120px; }
  .lm-ifp-plan-img { max-height: calc(100vh - 260px); }
  .lm-ifp-header { padding: 8px 10px; gap: 8px; }
  .lm-ifp-header-actions { margin-left: 0; }
}
@media (max-width: 480px) {
  /* The Floor Plans tile header carries two actions; let them wrap rather
     than squeezing the title to nothing. */
  #lm-tile-floor_plans .lm-tile-header { flex-wrap: wrap; }
  .lm-ifp-plan-pick select { max-width: 100%; }
}

/* ========== UNIFIED MANAGEMENT TILES ==========
   One collapsible-bar component for EVERY listing-management surface
   (Listing Status, Listing URLs, MLS Data, Videos, Floor Plans, 3D Content,
   Files, Co-listing Agents). Replaces the old mix of always-open `.card`
   blocks and inline-styled media bars so all surfaces read identically:
   a tappable bar (icon · title · status · one action · chevron) that
   expands to reveal its controls — the "Videos" interaction, applied
   everywhere. Markup: js/listing-manager.js `_tile()` + `renderMediaSections()`.
   Shared by the customer, photographer, and admin portals. */
.lm-tile {
  background: var(--white, #fff);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md, 12px);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.lm-tile:hover { border-color: var(--gray-300, #d1d5db); }
.lm-tile.open { box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08)); }

.lm-tile-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; width: 100%;
  background: none; border: none; font: inherit; text-align: left;
  color: var(--text, #111); cursor: pointer; user-select: none;
}
.lm-tile-header:hover { background: var(--gray-50, #f9fafb); }
.lm-tile-header:focus-visible { outline: 2px solid var(--accent, #4361ee); outline-offset: -2px; }
.lm-tile-icon {
  flex: 0 0 auto; width: 1.5rem; text-align: center;
  font-size: 1.15rem; line-height: 1;
}
.lm-tile-title {
  flex: 1 1 auto; min-width: 0;
  font-weight: 700; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lm-tile-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.lm-tile-actions { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.lm-tile-chevron {
  flex: 0 0 auto; font-size: 0.7rem; color: var(--text-muted, #9ca3af);
  transition: transform 0.2s; display: inline-block;
}
.lm-tile.open .lm-tile-chevron { transform: rotate(180deg); }

.lm-tile-body { padding: 4px 16px 16px; }
.lm-tile-body[hidden] { display: none; }

/* Count badge (Videos [2], Files [3], Co-agents [1]). Goes accent once it
   holds items so a populated section reads at a glance from the bar. */
.lm-tile-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--gray-100, #f3f4f6); color: var(--text-light, #6b7280);
  border-radius: 10px; font-size: 0.75rem; font-weight: 700;
}
.lm-tile-count.has-items { background: var(--accent-light, rgba(67,97,238,0.12)); color: var(--accent, #4361ee); }

/* State pills (Published / Draft; the MLS status pill and its sync-health
   counterpart — "Active · Jul 29, 2026" / "Synced 2h ago" / "Not linked" /
   "Draft — no MLS# yet"). The leading dot is a status light; `--plain` drops it
   for label-style pills like a bare MLS number. */
.lm-tile-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.lm-tile-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.lm-tile-pill--on { background: rgba(16,185,129,0.12); color: var(--success, #059669); }
.lm-tile-pill--off { background: var(--gray-100, #f3f4f6); color: var(--text-muted, #9ca3af); }
.lm-tile-pill--info { background: var(--accent-light, rgba(67,97,238,0.12)); color: var(--accent, #4361ee); }
/* MLS status tones (spec-mls-sync-integrity-and-spark-guard §5.4, Andrew's
   product ruling). The MLS status pill is a SEPARATE signal from sync health,
   and its colour carries meaning that must not drift:
     --warn    amber  = Pending / Under Contract. Deliberately NOT green:
                        green reads as "available" and Pending is under contract.
     --neutral grey   = Sold / Closed. **NEVER red** — a sale is the agent's
                        ACHIEVEMENT and stays visible as dated history. Readable
                        contrast (not the faded ``--off`` muted grey) precisely
                        because it is a fact worth showing, not an "off" state.
     --danger  red    = Expired / Withdrawn / Cancelled — red means ACTION
                        NEEDED, which is true only for these. */
.lm-tile-pill--warn { background: rgba(245,158,11,0.14); color: #b45309; }
.lm-tile-pill--neutral { background: var(--gray-100, #f3f4f6); color: #4b5563; }
.lm-tile-pill--danger { background: rgba(239,68,68,0.12); color: #dc2626; }
.lm-tile-pill--plain::before { display: none; }

/* A light divider above grouped controls inside a tile body (e.g. the
   visibility checkbox row that sits above uploaded items). */
.lm-tile-controls {
  display: flex; gap: 20px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--gray-50, #f9fafb); border-radius: var(--radius-sm, 8px);
}
.lm-tile-controls label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; cursor: pointer;
}

@media (max-width: 600px) {
  .lm-tile-header { gap: 8px; padding: 12px 14px; }
  .lm-tile-body { padding: 4px 14px 14px; }
  .lm-tile-controls { gap: 12px; }
}

/* ============================================================
   Push-to-MLS "launch button" — armed/unarmed + one-time party
   Spec: logs/specs/spec-mls-launch-button-2026-06-19.md
   All states stay within the SAME footprint (glow via box-shadow,
   motion via transform/pseudo-elements) — zero reflow.
   ============================================================ */

/* Base (UNARMED). Also gives the modal launch buttons a real accent look —
   the modal's .btn-accent is otherwise unstyled (grey) outside .lm-fs-actions. */
.lm-mls-launch-btn {
  position: relative;
  background: var(--accent, #4361ee);
  color: #fff;
  border: 1px solid var(--accent, #4361ee);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}
.lm-mls-launch-btn:hover { background: var(--accent-hover, #2563eb); border-color: var(--accent-hover, #2563eb); color: #fff; }

/* ARMED — CALM variant (every push after the first): clean, distinct, no fireworks. */
.lm-mls-launch-btn.is-armed {
  background: linear-gradient(135deg, var(--accent, #4361ee), #6d28d9);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.30);
}

/* PARTY visuals (glow + wiggle + sparks + icon jitter) — the "full send".
   Triggered by .is-party ALONE, so it works on BOTH the armed launch button
   (.is-armed.is-party → purple gradient + party) AND the first-time "Connect
   to MLS" button (.is-party on the accent base → blue + party). */
.lm-mls-launch-btn.is-party {
  animation: lm-launch-glow 1.1s ease-in-out infinite,
             lm-launch-wiggle 0.5s ease-in-out infinite;
}
@keyframes lm-launch-glow {
  0%, 100% { box-shadow: 0 0 14px 3px rgba(99, 102, 241, 0.45), 0 0 0 3px rgba(99, 102, 241, 0.30); }
  50%      { box-shadow: 0 0 30px 9px rgba(139, 92, 246, 0.85), 0 0 0 5px rgba(139, 92, 246, 0.45); }
}
@keyframes lm-launch-wiggle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-1px) rotate(-0.7deg); }
  75%      { transform: translateY(1px) rotate(0.7deg); }
}

/* Rocket jitter — only on the party variant (the rocket is wrapped in .lm-rocket). */
.lm-rocket { display: inline-block; }
.lm-mls-launch-btn.is-party .lm-rocket {
  animation: lm-rocket-jitter 0.22s steps(3, jump-none) infinite;
}
@keyframes lm-rocket-jitter {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(0.5px, -1.5px) rotate(10deg); }
  100% { transform: translate(-0.5px, 0) rotate(-7deg); }
}

/* Sparks — pseudo-element sparkles flickering at the corners (party only). */
.lm-mls-launch-btn.is-party::before,
.lm-mls-launch-btn.is-party::after {
  content: "\2726"; /* sparkle */
  position: absolute;
  font-size: 0.7rem;
  color: #fde68a;
  pointer-events: none;
  opacity: 0;
  animation: lm-launch-spark 1.05s ease-in-out infinite;
}
.lm-mls-launch-btn.is-party::before { top: -7px; left: 12%; animation-delay: 0.05s; }
.lm-mls-launch-btn.is-party::after  { bottom: -7px; right: 14%; animation-delay: 0.55s; }
@keyframes lm-launch-spark {
  0%, 100% { opacity: 0; transform: scale(0.5) translateY(0); }
  40%      { opacity: 1; transform: scale(1.15) translateY(-4px); }
}

/* FIRING — quick pop + flash, then the button hands off to the pushing spinner. */
.lm-mls-launch-btn.is-firing {
  animation: lm-launch-fire 0.4s ease-out forwards;
  pointer-events: none;
}
@keyframes lm-launch-fire {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.85); }
  35%  { transform: scale(1.09); box-shadow: 0 0 32px 13px rgba(255, 255, 255, 0.9); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); opacity: 0.85; }
}

/* The armed disclosure / "tap to launch" hint line (toggled by JS). */
.lm-mls-arm-hint {
  font-size: 0.78rem;
  color: var(--text-muted, #9ca3af);
  margin: 10px 0 0;
  line-height: 1.4;
}

/* Toolbar "catch" — the PRE-push opener button invites the click (the launch
   drama lives inside the modal). Two tiers:
   - FIRST run per agent: an animated gradient that flows THROUGH the button
     interior (a moving shimmer) — eye-catching, "something new here".
   - Every time after: a calm, subtle breathing glow. */
.lm-mls-toolbar-firstrun {
  position: relative;
  overflow: hidden;
  color: #fff !important;
  border-color: transparent !important;
  /* The button stays FULLY colored the whole time (a solid accent→violet
     gradient); the movement is a light "shine" that sweeps across (below),
     NOT the gradient itself sliding — which read as a repeating loading bar. */
  background-image: linear-gradient(135deg, var(--accent, #4361ee), #7c3aed) !important;
}
.lm-mls-toolbar-firstrun::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Match the button's rounding: the transform below gives this pseudo its own
     compositing layer, which can escape the parent's overflow:hidden corner
     clip — so round the shine layer itself or it squares off the corners. */
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.40) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: lm-toolbar-shine 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lm-toolbar-shine {
  0%, 12%   { transform: translateX(-130%); }
  55%, 100% { transform: translateX(130%); }
}
.lm-mls-toolbar-catch { animation: lm-toolbar-breathe 2.6s ease-in-out infinite; }
@keyframes lm-toolbar-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
  50%      { box-shadow: 0 0 12px 2px rgba(67, 97, 238, 0.40); }
}

/* Reduced motion: no animation anywhere; the armed state stays a clear,
   STATIC distinct look (still obviously "armed"). */
@media (prefers-reduced-motion: reduce) {
  .lm-mls-launch-btn.is-armed,
  .lm-mls-launch-btn.is-party {
    animation: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.40);
  }
  .lm-mls-launch-btn.is-party::before,
  .lm-mls-launch-btn.is-party::after { display: none; }
  .lm-mls-launch-btn.is-party .lm-rocket,
  .lm-mls-launch-btn.is-firing,
  .lm-mls-toolbar-catch { animation: none; }
  /* First-run keeps its solid gradient (still distinct) but drops the moving shine. */
  .lm-mls-toolbar-firstrun::after { display: none; }
}

/* ========== FULL-SCREEN PHOTO VIEWER (fxlb-) ==========
   Spec: logs/specs/spec-portal-photo-viewer-pr2-viewer-2026-09-08.md.

   Z-INDEX 10010 IS LOAD-BEARING. The viewer is opened FROM the Edit Gallery
   overlay (.lm-fs-overlay, 9998) and must clear it and the download modal
   (.lm-dl-overlay, 9999), or it renders invisibly behind the surface that
   launched it — the exact live failure mode the customer portal already has
   with its own lightbox. 10010 matches the photographer portal's documented
   .review-lightbox precedent; the two never coexist (different screens).
   Pinned by tests/test_portal_photo_viewer_frontend.py, which derives the
   floor from the two rules below rather than hardcoding it.

   It sits ABOVE the customer (10000) and admin (9999) toast containers. That
   is an accepted trade-off ONLY because this viewer is read-only and emits no
   toast of its own; adding any write action here means raising those
   containers to 10060 FIRST (parent spec 6.3). */
.fxlb-overlay {
  position: fixed; inset: 0; z-index: 10010; display: none;
}
.fxlb-overlay.active { display: block; }

.fxlb-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.94); }

/* The image is INERT (D-9): only the backdrop and the ✕ close the viewer.
   Deliberately does NOT copy the public listing page's pointer-events pair,
   which makes clicking the photo close it — hostile on a QC tool. */
.fxlb-img {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: 100vw; max-height: 100vh; object-fit: contain;
  display: block; user-select: none;
}

.fxlb-chrome {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}
.fxlb-chrome > * { pointer-events: auto; }

.fxlb-badge {
  background: rgba(255, 255, 255, 0.16); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px;
  padding: 4px 12px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
}
.fxlb-badge[hidden] { display: none; }

.fxlb-counter {
  color: #fff; font-size: 0.9rem; font-weight: 600;
  margin-right: auto; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.fxlb-close {
  background: rgba(255, 255, 255, 0.14); border: none; color: #fff;
  width: 44px; height: 44px; min-width: 44px; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.fxlb-close:hover { background: rgba(255, 255, 255, 0.28); }

.fxlb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.14); border: none; color: #fff;
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.fxlb-nav:hover { background: rgba(255, 255, 255, 0.28); }
.fxlb-prev { left: 12px; }
.fxlb-next { right: 12px; }

.fxlb-close:focus-visible,
.fxlb-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Phone: the arrows stay reachable with a thumb and the ✕ keeps a 44px target. */
@media (max-width: 480px) {
  .fxlb-nav { width: 44px; height: 44px; font-size: 1.25rem; }
  .fxlb-prev { left: 6px; }
  .fxlb-next { right: 6px; }
  .fxlb-chrome { padding: 10px 10px; gap: 8px; }
  .fxlb-counter { font-size: 0.82rem; }
}
