:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --text: #1e293b;
  --text-mute: #64748b;
  --accent: #2563eb;
  --accent-bg: #eff6ff;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius: 8px;

  /* Alias tokens that newer components (Documents tab, the CompanyCam grid
     redesign, the filing tree) referenced via inline fallbacks before they
     were ever declared. Declaring them here makes those surfaces theme-aware.
     Light values match the prior fallbacks so the light look is unchanged. */
  --surface-2: #f3f4f6;
  --card-bg: var(--surface);
  --border-color: var(--border);
  --text-muted: var(--text-mute);
  --accent-soft: #dbeafe;
  color-scheme: light;

  --phase-before: #dc2626; /* red */
  --phase-during: #ca8a04; /* yellow/amber */
  --phase-after: #16a34a; /* green */

  /* "Replaced" on a document that has a newer version (Lifecycle Contract 6). */
  --replaced: #b45309;
}

/* ── Dark theme tokens ────────────────────────────────────────────────────
   Opt-in via the header toggle; the choice is persisted in localStorage and
   applied to <html data-theme="dark"> before first paint (bootstrap in
   index.html, so there's no flash). Everything that flows through the tokens
   above flips here for free; the handful of surfaces that hardcoded a light
   color literal get selector-level overrides at the END of this file. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1421;
  --surface: #171e2e;
  --surface-2: #1f2838;
  --card-bg: #171e2e;
  --border: #2b3547;
  --border-color: #2b3547;
  --text: #e7ebf3;
  --text-mute: #9aa4b8;
  --text-muted: #9aa4b8;
  --accent: #3b82f6;
  --accent-bg: #18243c;
  --accent-soft: #1c2c4b;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  --replaced: #fbbf24;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
}

/* ── Header ─────────────────────────────────────────────────────────── */

/* The bar's looks are the shared header theme's, SS-107, linked from the Gantt
   in index.html (Ric, #131, 5 Nov 2026: "create a proper theme that they all
   follow I prefer it looks like the dashboard header theme"). Same grey in light
   and dark, as the Dashboard's, which has no dark theme. `#topbar` holds layout
   only: an id out-ranks the shared file, so a look set on it would beat the theme.
   `.top-bar` here is the plain bar for when the Gantt cannot be reached. It ties
   with the shared rule and loads before it, so the shared rule wins when present.
   Everything else in the bar inherits its text colour, so it reads on either. */
#topbar {
  display: grid;
  /* Brand, job label and tabs from the left; the right-hand buttons and the name
     tag against the right edge. Every column but that last one can shrink, so the
     row never grows past the bar. The tabs' column takes the space in between. */
  grid-template-columns: minmax(0, max-content) minmax(0, max-content) minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  /* One height, said once: the three columns below start where it ends. Framed,
     the row is shorter (--bar-h, below). */
  height: var(--bar-h, 56px);
  container-type: inline-size;
}
.top-bar {
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.brand {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}
.env-tag {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
}
.context {
  font-size: 13px;
  opacity: 0.8;
  /* A long customer name must not take the tabs' room. */
  max-width: 200px;
}

.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.vt-btn {
  /* A two-word tab wraps and makes itself taller than its neighbours -- seen
     the moment a tab's label became two words. The bar stays one line. */
  white-space: nowrap;
  cursor: pointer;
}
/* Its colours are the shared theme's. Bold only says which tab is on when the
   Gantt cannot be reached; the shared rule out-ranks it otherwise. */
.vt-btn.active {
  font-weight: 700;
}

.user {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* The Gantt's name tag (Ric, #141, 6 Nov 2026), the markup and the shape. Its colours
   are the shared header theme's, SS-107, which loads after this file and wins. These
   are only the plain fallback the `.top-bar` uses when the Gantt cannot be reached. */
.hdr-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 12px 5px 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
}
.hdr-user-pill .status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.hdr-user-pill .role {
  padding-left: 6px;
  border-left: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
/* On the Gantt a click filters to My Jobs, so the shared rule makes it look clickable.
   Here it is not a control. */
.top-bar .hdr-user-pill {
  cursor: default;
}
.top-bar .hdr-user-pill:hover {
  opacity: 1;
}

/* ── Layout ─────────────────────────────────────────────────────────── */

#layout {
  display: grid;
  position: relative;
  grid-template-columns: var(--left-w, 280px) 1fr 0fr;
  height: calc(100vh - var(--bar-h, 56px));
  transition: grid-template-columns 0.2s ease;
}
#layout.detail-open {
  grid-template-columns: var(--left-w, 280px) 1fr var(--right-w, 420px);
}

/* ── Collapsible panels (Ric, agent-comms #141) ───────────────────────────
   "every panel needs to be collapsible so once the document is selected from
   the second panel the third panel should move and get bigger ... the width
   needs to be wider."

   Each collapse is a class on the grid, not a width written into the element,
   so the saved --left-w / --right-w survive a collapse and come straight back
   on expand. The toggles live on the two resizers, which are already the panel
   edges the user grabs. */
#layout.left-collapsed {
  grid-template-columns: 0 1fr 0fr;
}
#layout.left-collapsed.detail-open {
  grid-template-columns: 0 1fr var(--right-w, 420px);
}
#layout.left-collapsed #sidebar {
  /* The grid track is 0; without this the content paints over the next column. */
  overflow: hidden;
  visibility: hidden;
}
#layout.left-collapsed #resizeLeft {
  left: 0;
}
/* Collapsing the MIDDLE column is what actually makes the document big: the
   grid's `1fr` middle is the photos/documents list, and it is the only column
   with room to give. */
#layout.mid-collapsed.detail-open {
  grid-template-columns: var(--left-w, 280px) 0 1fr;
}
#layout.left-collapsed.mid-collapsed.detail-open {
  grid-template-columns: 0 0 1fr;
}
#layout.mid-collapsed #main {
  overflow: hidden;
  visibility: hidden;
}
#layout.mid-collapsed #resizeRight {
  /* The divider belongs at the document's left edge, which is now the middle
     column's zero-width track. Dragging is meaningless here, so it is the
     expand affordance only. */
  right: auto;
  left: var(--left-w, 280px);
  cursor: default;
}
#layout.left-collapsed.mid-collapsed #resizeRight {
  left: 0;
}
/* The chevron that does the collapsing. It rides the resizer so the control is
   on the edge it moves, and it is always reachable — a collapsed panel still
   leaves its 8px resizer behind to click. */
.col-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 46px;
  margin: -23px 0 0 -9px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-mute);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 31;
}
.col-resizer:hover .col-toggle,
.col-toggle:focus-visible,
#layout.left-collapsed #resizeLeft .col-toggle,
#layout.mid-collapsed #resizeRight .col-toggle {
  /* Always visible once a panel is collapsed — otherwise the only way back is
     to find an invisible strip. */
  opacity: 1;
}
.col-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}
/* Collapsing a panel is applied with NO animation, and this is not taste.
   `transition: grid-template-columns` cannot interpolate a fixed track into
   `1fr`: measured in Chrome, the grid STUCK at the previous template and never
   settled, so expanding a panel left the document at its collapsed width. The
   toggle adds this class, flips the collapse class, forces the new value to
   compute, then drops it again on the next frame. */
#layout.no-anim {
  transition: none;
}
/* No column animation while actively dragging a resizer — keeps the drag 1:1. */
#layout.resizing {
  transition: none;
}
/* Draggable column resizers (Ric 2026-07-08): drag the sidebar edge or the
   detail-panel edge to resize; double-click resets. Widths persist via app.js
   (localStorage) into the --left-w / --right-w custom properties above. */
.col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 30;
  cursor: col-resize;
  touch-action: none;
}
.col-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-1px);
  background: transparent;
  transition: background 0.12s ease;
}
.col-resizer:hover::after,
#layout.resizing .col-resizer::after {
  background: var(--accent, #2563eb);
}
#resizeLeft {
  left: var(--left-w, 280px);
  transform: translateX(-4px);
}
#resizeRight {
  display: none;
  right: var(--right-w, 420px);
  transform: translateX(4px);
}
#layout.detail-open #resizeRight {
  display: block;
}
body.resizing {
  cursor: col-resize;
  user-select: none;
}

#sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}
/* Section heads (Filters). Stand off the page with a
   coloured top stripe + bold weight so the two sidebar sections are
   immediately distinguishable from each other and from the group
   labels inside them. */
.filters h3 {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
/* Spacing between successive sidebar sections so the heads breathe. */
.filters + .filters {
  margin-top: 22px;
}

.filter-group {
  margin-bottom: 18px;
}
/* Filter-panel quick search. Sits above the groups; type to narrow chips. */
.filter-search {
  margin: 0 0 14px;
}
.filter-search input[type='search'] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
.filter-search input[type='search']:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* When the search hides a chip / group, take it fully out of layout so the
   panel collapses tight (overrides `.filters .hidden` if any). */
.filter-group.hidden,
.chip.hidden {
  display: none !important;
}
/* What "Search filters…" narrows away (app.js applyFilterSearch). A class of
   its own, so a rebuild that shows or hides a group cannot undo the search
   (contract 1.7.5, agent-comms #141). */
.search-miss {
  display: none !important;
}
/* How many photos picking this chip would show, under the other filters on. */
.chip .chip-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.chip.active .chip-count,
.chip.related:not(.active) .chip-count {
  color: rgba(255, 255, 255, 0.85);
}
.filters .filter-empty {
  font-size: 12px;
  color: var(--text-mute);
}
/* The videos' Room group, in the Filters panel on Videos (Ric, #141, 27 Nov
   2026): its search box, shown past ten rooms, sits under its heading. */
.wt-room-search {
  margin-bottom: 8px;
}
/* THE ONE LOOK OF A HEADING in the gallery's panels (Ric, agent-comms #141,
   27 Nov 2026: "the left panel should have headers that are distinguished
   between a header and a description underneath … should stand out not poke
   you in the eye … it shouldn't overpower the page"). Every heading in the
   panels takes its look from this rule and from no other: "Browse by" and
   "Views" on the rail, every group in the Filters panel and the document
   filters, and "Rooms in this video" beside the player. A second rule that
   sets a heading's size, weight, case, letter-spacing, colour or under-rule
   is a defect (tests/browse-rail.test.mjs). What a place needs of its own
   (the padding of a box, the room above a group) stays in that place's rule.
   What sits under a heading is an item: normal weight, indented from it. */
.browse-head,
.filter-group > label,
.wt-chapters-head {
  display: block;
  margin-bottom: 8px;
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.filter-group input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.1s;
}
.chip:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.chip.phase-before:not(.active) {
  border-left: 3px solid var(--phase-before);
}
.chip.phase-during:not(.active) {
  border-left: 3px solid var(--phase-during);
}
.chip.phase-after:not(.active) {
  border-left: 3px solid var(--phase-after);
}
/* Room "slot" from a walkthrough video that has no photos yet — a dashed,
   muted chip the operator can bulk-relabel photos into. Stays clickable as a
   filter; the 0 badge signals "empty, waiting for photos". */
.chip.chip-roomslot-empty:not(.active) {
  border-style: dashed;
  color: var(--text-mute);
  background: transparent;
}
.chip .roomslot-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--border);
  color: var(--text-mute);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  vertical-align: middle;
}
.chip.active .roomslot-badge {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}
/* "Related" — a chip whose (data-key, data-value) matches a tag on the
   currently-open photo or any bulk-selected photo. Per Ric (2026-05-30):
   "turn the regular color as if it was selected, not just a border" —
   match the .active fill so it reads at a glance, identical to an applied
   filter. (Functionally still distinct: clicking actually applies it.) */
.chip.related:not(.active) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.chip.related:not(.active) .roomslot-badge {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}
/* Pencil affordance inside a room chip — hidden until the chip is hovered or
   the user is tabbing through with the keyboard. Click triggers rename;
   click-bubbling is stopped in the JS so the chip's filter toggle doesn't
   also fire. */
.chip .chip-edit {
  display: inline-block;
  margin-left: 5px;
  opacity: 0;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-mute);
  transition: opacity 80ms ease-in;
}
.chip:hover .chip-edit,
.chip:focus-within .chip-edit,
.chip-edit:focus {
  opacity: 0.85;
}
.chip .chip-edit:hover {
  opacity: 1;
  color: var(--accent);
}
/* "+ Add room" link — sits at the end of the room chip list. Reads like a
   chip but with a dashed border + accent colour so it's clearly an action,
   not a filter. */
.chip-add-room {
  display: inline-flex;
  align-items: center;
  margin: 4px 0 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed var(--accent);
  border-radius: 99px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.chip-add-room:hover {
  background: var(--accent-bg);
}
/* Inline-edit input that replaces a chip while renaming or adding. Sized to
   match the chip so the layout doesn't jump. */
.chip-edit-input {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  border: 1px solid var(--accent);
  border-radius: 99px;
  background: var(--bg);
  color: var(--text);
  min-width: 110px;
  outline: none;
}
.chip-edit-input:focus {
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.clear-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 12px;
  cursor: pointer;
}
.clear-btn:hover {
  color: var(--text);
  border-color: var(--text-mute);
}

/* ── Main / grid ────────────────────────────────────────────────────── */

#main {
  padding: 16px 20px;
  overflow-y: auto;
  /* The height of the customer search pinned at its top; the photo toolbar pins
     under it (.grid-controls). Pinned offsets count from inside the 16px top
     padding, so "flush with the top" is -16px. */
  --customer-search-h: 55px; /* 36 box + 9 + 9 padding + 1 border */
}

/* ── The customer search, across the top of the page ──────────────────────
   Ric, agent-comms #141, 15 Nov 2026: "go ahead and put it to top that's the
   right idea but keep all the filters on the left". One box, on every tab, pinned
   so that with a customer open its X (back to all customers) is always in sight,
   however far down the photos he is. It bleeds over #main's padding to sit
   flush under the top bar. The sentence under it shows only when there is one;
   the photo toolbar then pins one line lower. */
.customer-search {
  position: sticky;
  top: -16px;
  z-index: 21;
  margin: -16px -20px 12px;
  padding: 9px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.customer-search .project-picker {
  max-width: 720px;
}
.customer-search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.customer-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.customer-search .project-picker button {
  width: 36px;
  height: 36px;
  flex: none;
}
.customer-search .project-picker-status {
  font-size: 12px;
  line-height: 15px;
}
.customer-search .project-picker-status:empty {
  display: none;
}
#main:has(#fProjectStatus:not(:empty)) .grid-controls {
  top: calc(var(--customer-search-h) + 3px);
}

#activeFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
/* With no filter on there is nothing to show, so it takes no room: its reserved
   height was most of the blank band above the toolbar (Ric, #141, 6 Nov 2026: "we
   need to make this look like professional software"). */
#activeFilters:empty {
  display: none;
}
.active-chip {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 99px;
  padding: 3px 9px 3px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* The one-press clear for every filter pill (Ric, #204, 17 Nov 2026). Drawn as a
   plain button so it never reads as one more filter. */
.active-chip.chip-clear-all {
  background: transparent;
  color: var(--text);
  border-color: var(--border, currentColor);
  padding: 3px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.active-chip.chip-clear-all:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.active-chip[data-act='edit-tag'] {
  cursor: pointer;
  padding-left: 8px;
}
.active-chip[data-act='edit-tag']:hover {
  background: var(--accent);
  color: white;
}
.active-chip .pencil {
  font-size: 11px;
  opacity: 0.7;
  margin-right: 2px;
}
.active-chip[data-act='edit-tag']:hover .pencil,
.active-chip.editing .pencil {
  opacity: 1;
}
.active-chip.editing {
  background: var(--accent);
  color: white;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* The milestone link's heading (Ric, #195): the plain sentence of whose photos
   the link opened. A heading first, so it reads larger than a filter pill. */
.active-chip.chip-milestone {
  font-size: 14px;
  font-weight: 600;
  padding: 5px 12px 5px 14px;
  border-radius: 8px;
}
.active-chip .x {
  cursor: pointer;
  opacity: 0.6;
}
.active-chip .x:hover {
  opacity: 1;
}

/* Bulk-edit inline editor — appears below the pill row when the user
   has clicked a pill to rename it. Keeps the editor close to the pills
   so the user can read the original value while typing the replacement. */
.bulk-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12px;
}
.bulk-editor .bulk-label b {
  color: var(--accent);
}
.bulk-editor input[type='text'] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  min-width: 220px;
}
.bulk-editor .bulk-count {
  font-weight: 600;
  color: var(--text-mute);
}
.bulk-editor button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.bulk-editor button:hover {
  background: var(--bg);
}
.bulk-editor #bulkApplyBtn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.bulk-editor #bulkApplyBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tile-side bulk affordances: the checkbox in the corner + the "selected"
   blue ring around the whole tile when checked. */
.photo-card.bulk-mode {
  cursor: pointer;
  /* Stop shift-click from highlighting text across tiles during range-select. */
  user-select: none;
}
/* Per-group "Select all / Deselect" toggle on a room/day section header.
   Pushed to the right edge of the flex header. */
.group-select-btn {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.group-select-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.group-select-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.photo-card .bulk-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  padding: 2px;
  display: flex;
}
.photo-card .bulk-check input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.photo-card.bulk-checked {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  /* "Lit" border so it's obvious which tiles are selected to move/tag. */
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 14px 2px rgba(37, 99, 235, 0.55);
}
/* Trashed tiles (restore view) read as dimmed + desaturated so they're
   visibly "removed" while still pickable for restore. */
.photo-card.trashed .thumb {
  opacity: 0.55;
  filter: grayscale(0.4);
}
.photo-card.trashed::after {
  content: 'TRASHED';
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  background: rgba(176, 0, 32, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Grid-toolbar select / trash controls ──────────────────────────────── */
.select-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}
.select-mode-btn,
.trash-view-btn,
.learn-rooms-btn,
.identify-mode-btn,
.zip-drop-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.select-mode-btn:hover,
.trash-view-btn:hover,
.identify-mode-btn:hover,
.zip-drop-btn:hover {
  background: var(--bg);
}
/* "Identify" tagging mode — teal accent so it reads as distinct from the
   plain Select toggle. When active it's filled. */
.identify-mode-btn {
  border-color: #0d9488;
  color: #0d9488;
}
.identify-mode-btn.active {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
/* A left-panel chip that's been staged for tagging in Identify mode. */
.chip.staged {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.35);
}
/* Identify action row — sits between the customer banner and the photo grid. */
/* Select-mode action row — inline at the top (between banner and grid), same
   spot as the identify bar, not a floating bottom bar. */
.select-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}
.select-bar.hidden {
  display: none;
}
.select-bar .sab-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}
.select-bar .sab-count {
  font-weight: 700;
  white-space: nowrap;
}
.select-bar .sab-hint {
  font-size: 12px;
  color: var(--text-mute);
}
.select-bar .sab-spacer {
  flex: 1 1 8px;
  min-width: 8px;
}
.select-bar button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.select-bar button.sab-ghost {
  background: transparent;
}
.select-bar button.sab-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.select-bar button.sab-danger {
  background: #b00020;
  border-color: #b00020;
  color: #fff;
}
.select-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Drag-into-room: while dragging a photo, room sections hint they're drop
   targets; the one under the cursor highlights. */
body.dragging-photo .grid-room-section {
  outline: 1px dashed var(--border);
  outline-offset: 3px;
}
.grid-room-section.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  background: var(--accent-bg);
  border-radius: var(--radius);
}
.photo-card[draggable='true'] {
  cursor: grab;
}
.photo-card[draggable='true']:active {
  cursor: grabbing;
}
/* Within-room reorder: an accent insertion line on the side of the tile the
   dragged photo will land. .reorder-before = drop to its left, .reorder-after
   = drop to its right (the "move it to the right of the 360" gesture). */
.photo-card.reorder-before,
.photo-card.reorder-after {
  position: relative;
}
.photo-card.reorder-before::before,
.photo-card.reorder-after::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  z-index: 5;
  pointer-events: none;
}
.photo-card.reorder-before::before {
  left: -4px;
}
.photo-card.reorder-after::after {
  right: -4px;
}

.identify-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid #0d9488;
  border-radius: var(--radius);
  background: rgba(13, 148, 136, 0.08);
  font-size: 13px;
}
.identify-bar.hidden {
  display: none;
}
.identify-bar .idbar-count {
  font-weight: 700;
  color: #0f766e;
  white-space: nowrap;
}
.identify-bar .idbar-arrow {
  color: var(--text-mute);
}
.identify-bar .idbar-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.identify-bar .idbar-hint {
  color: var(--text-mute);
  font-size: 12px;
}
.identify-bar .idtag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 99px;
  background: #0d9488;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.identify-bar .idtag-pill .x {
  cursor: pointer;
  opacity: 0.85;
}
.identify-bar .idtag-pill .x:hover {
  opacity: 1;
}
.identify-bar .sab-spacer {
  flex: 1 1 8px;
  min-width: 8px;
}
.identify-bar button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.identify-bar button.sab-primary {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
.identify-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* "✨ Find more like this" — the AI-learn button, accent-tinted so it reads as
   a distinct (AI) action next to the plain Save / Done. */
.identify-bar button.sab-ai {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}
.identify-bar button.sab-ai:hover {
  filter: brightness(0.97);
}

/* ── "Find more like this" confirm queue ───────────────────────────────── */
.learn-queue-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.learn-queue,
.learn-reviewer {
  background: var(--surface, #fff);
  color: var(--text);
  width: min(960px, 100%);
  max-height: 88vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
/* The reviewer is the wider, one-at-a-time variant — large photo on the
   left, reference + tags on the right. Wider modal so the photo paints big. */
.learn-reviewer {
  width: min(1200px, 100%);
}
.learn-reviewer .lr-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.learn-reviewer .lr-head h3 {
  margin: 0 0 3px;
  font-size: 15px;
}
.learn-reviewer .lr-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-mute);
}
.learn-reviewer .lq-x {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-mute);
  line-height: 1;
}
.learn-reviewer .lr-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  flex: 1;
  min-height: 0;
}
.learn-reviewer .lr-main {
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 0;
  position: relative;
}
.learn-reviewer .lr-photo {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.learn-reviewer .lr-photo img {
  max-width: 100%;
  max-height: 64vh;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
}
.learn-reviewer .lr-photo .badge-360 {
  position: absolute;
  top: 8px;
  left: 8px;
}
.learn-reviewer .lr-photo-empty {
  color: #94a3b8;
  font-size: 13px;
}
.learn-reviewer .lr-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface, #fff);
  overflow-y: auto;
  border-left: 1px solid var(--border);
}
.learn-reviewer .lr-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.learn-reviewer .lr-ref {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.learn-reviewer .lr-ref img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.learn-reviewer .lr-ref-empty {
  font-size: 11px;
  color: var(--text-mute);
}
.learn-reviewer .lr-ref-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-mute);
}
.learn-reviewer .lr-tags {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.learn-reviewer .lr-tag-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dashed var(--border);
}
.learn-reviewer .lr-tag-k {
  color: var(--text-mute);
  font-weight: 600;
}
.learn-reviewer .lr-tag-v {
  color: var(--text);
  text-align: right;
  white-space: pre-wrap;
}
.learn-reviewer .lr-tag-empty {
  font-size: 11px;
  color: var(--text-mute);
}
.learn-reviewer .lr-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.learn-reviewer .lr-foot button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.learn-reviewer .lr-foot button.sab-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.learn-reviewer .lr-foot button.committed {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.learn-reviewer .lr-foot button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.learn-reviewer .lr-foot .sab-spacer {
  flex: 1;
}
.learn-reviewer .lr-progress {
  font-size: 12px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.learn-queue .lq-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.learn-queue .lq-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.learn-queue .lq-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-mute);
  max-width: 70ch;
}
.learn-queue .lq-x {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-mute);
  line-height: 1;
}
.learn-queue .lq-body {
  overflow-y: auto;
  padding: 14px 18px;
}
.learn-queue .lq-group {
  margin-bottom: 18px;
}
.learn-queue .lq-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
  position: sticky;
  top: 0;
  background: var(--surface, #fff);
  padding: 2px 0;
}
.learn-queue .lq-gcount {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  background: var(--accent-bg);
  border-radius: 99px;
  padding: 1px 8px;
  margin-left: 4px;
}
.learn-queue .lq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.learn-queue .lq-tile {
  position: relative;
  display: block;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.learn-queue .lq-tile.checked {
  border-color: var(--accent);
}
.learn-queue .lq-tile input[type='checkbox'] {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.learn-queue .lq-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.learn-queue .lq-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.learn-queue .lq-tile:not(.checked) .lq-thumb {
  opacity: 0.4;
}
.learn-queue .lq-nothumb {
  font-size: 11px;
  color: var(--text-mute);
}
.learn-queue .lq-meta {
  padding: 4px 6px;
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learn-queue .lq-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.learn-queue .lq-foot .sab-spacer {
  flex: 1;
}
.learn-queue .lq-foot button {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.learn-queue .lq-foot button.sab-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.learn-queue .lq-foot button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* "Learn rooms" — accent-tinted so the AI action reads as distinct from the
   plain Select / Trash toggles. */
.learn-rooms-btn {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}
.learn-rooms-btn:hover {
  filter: brightness(0.97);
}
.learn-rooms-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.select-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.trash-view-btn.active {
  background: #b00020;
  border-color: #b00020;
  color: #fff;
}

/* ── Floating bulk-action bar (select mode) ────────────────────────────── */
.select-action-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  background: #1f2430;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: sab-rise 0.16s ease-out;
}
@keyframes sab-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.select-action-bar .sab-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.select-action-bar .sab-count {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.select-action-bar .sab-hint {
  font-size: 11px;
  color: #aab2c0;
  white-space: nowrap;
}
.select-action-bar .sab-spacer {
  flex: 1 1 8px;
  min-width: 8px;
}
.select-action-bar button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  background: #3a4252;
  color: #fff;
  white-space: nowrap;
}
.select-action-bar button:hover {
  background: #49526580;
  filter: brightness(1.1);
}
.select-action-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.select-action-bar .sab-ghost {
  background: transparent;
  border-color: #4a5366;
}
.select-action-bar .sab-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.select-action-bar .sab-danger {
  background: #b00020;
  border-color: #b00020;
}
.select-action-bar .sab-relabel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #3a4252;
}
.select-action-bar .sab-relabel select,
.select-action-bar .sab-relabel input[type='text'] {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #4a5366;
  background: #2a3140;
  color: #fff;
}
.select-action-bar .sab-relabel input[type='text'] {
  min-width: 200px;
}

/* ── Transient toast ───────────────────────────────────────────────────── */
.gph-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(8px);
  z-index: 70;
  padding: 10px 16px;
  background: #1f2430;
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.gph-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.grid-status {
  padding: 24px 0;
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
/* Grouped-by-room layout (kicks in when a customer is selected). The
   outer grid becomes a single column of sections; each section has a
   room header and its own card grid inside. */
#grid.grid-grouped {
  display: block;
}
.grid-room-section {
  margin-bottom: 22px;
}
.grid-room-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.grid-room-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-transform: capitalize;
}
.grid-room-count {
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  /* Push the count to the right edge of the header so "Bathroom 2" can't
     read as a name (Ric, 2026-05-30). A subtle pill makes it clearly
     metadata rather than part of the label. */
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--text-mute);
}
.grid-room-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Empty-state customer picker — shown inside #grid when no project_id
   filter is set. Tiles read like the dropdown but at click-size for
   eyeball-scanning. */
.customer-picker {
  display: grid;
  /* Fixed 220px square covers (no 1fr stretch); the leftover row width is
     distributed BETWEEN the tiles via space-between, which opens the spacing
     up beyond the 20px floor (Ric 2026-06-16 — fixed 220×220 covers). */
  grid-template-columns: repeat(auto-fill, 220px);
  gap: 20px;
  justify-content: space-between;
  width: 100%;
  grid-column: 1 / -1;
}
.customer-picker-empty {
  grid-column: 1 / -1;
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
  text-align: center;
}
.customer-tile {
  text-align: left;
  /* Google-Photos album style: no card chrome — a rounded square cover with
     the caption beneath. The tile is a transparent container; the cover
     (.ct-hero) carries the rounding + the hover ring. */
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: visible;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
}
.customer-tile .ct-hero {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.customer-tile .ct-hero.ct-hero-empty {
  background: linear-gradient(135deg, var(--accent-bg), var(--surface));
  position: relative;
}
.customer-tile .ct-hero.ct-hero-empty::after {
  content: '○';
  color: var(--text-mute);
  font-size: 32px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
}
.customer-tile .ct-body {
  padding: 8px 2px 0;
}
.customer-tile .ct-count {
  /* The count lives in the caption, pushed to the bottom-right of the
     .ct-job-row (where the copy button used to be) — NOT on the cover; the
     cover stays clean (Ric 2026-06-16). */
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.customer-tile .ct-count.empty {
  opacity: 0.55;
}
/* Static hover — an accent ring on the cover, nothing moves or grows
   (Ric 2026-06-16). The copy-link button was removed. */
.customer-tile:hover .ct-hero,
.customer-tile:focus-within .ct-hero {
  box-shadow: 0 0 0 2px var(--accent);
}
.customer-tile .ct-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.customer-tile .ct-job {
  font-size: 12px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.customer-tile .ct-job-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
/* The date indicator (.ct-ago) and hover-revealed division chips (.ct-divs)
   were removed from the tile for the clean Google-Photos album look
   (Ric 2026-06-16). */
/* Star button — pin to top. Sits top-left of the hero. */
.customer-tile .ct-star {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 50%;
  color: white;
  font-size: 15px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s,
    transform 0.05s;
}
.customer-tile:hover .ct-star,
.customer-tile .ct-star.on,
.customer-tile:focus-within .ct-star {
  opacity: 1;
}
.customer-tile .ct-star.on {
  background: rgba(255, 193, 7, 0.95);
  color: #1a1a1a;
}
.customer-tile .ct-star:hover {
  transform: scale(1.08);
}
/* Pinned customers are indicated by the filled gold star on the cover
   (.ct-star.on, always shown when pinned); the old card left-stripe was
   dropped along with the card chrome (Ric 2026-06-16). */
.customer-tile .ct-div {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 99px;
  padding: 2px 7px;
}
.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  position: relative;
}
/* Static hover: an accent border only — no lift, scale, or shadow. The tiles
   must not move or grow on hover (Ric, 2026-06-16 — "it should be static, it
   wiggles"). The border is always 1px (transparent/border → accent), so
   recoloring it shifts no layout. */
.photo-card:hover {
  border-color: var(--accent);
}
.photo-card.phase-before {
  border-top: 3px solid var(--phase-before);
}
.photo-card.phase-during {
  border-top: 3px solid var(--phase-during);
}
.photo-card.phase-after {
  border-top: 3px solid var(--phase-after);
}

.photo-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text-mute);
  font-size: 11px;
}
.photo-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-card .thumb .badge-360 {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
/* Video tile badge — uses the same corner-pill pattern as badge-360.
   Sits below if both badges fire on the same tile (unlikely — Drive
   doesn't tag videos as 360, but the cascade is harmless). */
.photo-card .thumb .badge-video {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(220, 38, 38, 0.85);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.photo-card .thumb .badge-360 + .badge-video {
  top: 30px;
}
.photo-card .thumb .photographer {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.photo-card .meta {
  padding: 8px 10px;
}
.photo-card .meta .room {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.photo-card .meta .filename {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
  word-break: break-all;
}
.photo-card .meta .captured {
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.photo-card .tag-strip {
  padding: 0 10px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-mute);
  border: 1px solid var(--border);
}
.tag-pill.cat-phase-before {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.tag-pill.cat-phase-during {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.tag-pill.cat-phase-after {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}
.tag-pill.cat-damage {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.tag-pill.cat-equipment {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* Per-field low-confidence affordance. Yellow dot prefix on the tag pill,
   yellow stripe + corner badge on the card. The 0.7 threshold lives on the
   server (see GET /low-confidence) — the dot is purely cosmetic, mirroring
   the same cutoff. */
.tag-pill.low-conf {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde68a;
}
.tag-pill .conf-dot {
  color: #ca8a04;
  margin-right: 3px;
  font-size: 8px;
  line-height: 1;
}
.photo-card.needs-review {
  box-shadow: inset 4px 0 0 #facc15;
}
.photo-card .thumb .conf-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #facc15;
  color: #422006;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.chip-review.active,
.chip.chip-review.active {
  background: #fde047;
  color: #422006;
  border-color: #facc15;
}
.active-chip.chip-review {
  background: #fde047;
  color: #422006;
  border-color: #facc15;
}

.grid-footer {
  text-align: center;
  margin-top: 18px;
}
.grid-footer button {
  padding: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

/* ── THE ONE X THAT CLEARS A SEARCH BOX ─────────────────────────────────────
   Search Engine contract section 1.7.7: "Every search box has an X to clear
   it, painted by one shared control, so a new box can never be the odd one
   out." The control is `window.SearchClear` in `public/search-clear.js`, shared
   with the phone, and it paints the button with inline styles.

   SO ONLY THREE KINDS OF RULE BELONG HERE: a pseudo-element, which cannot be
   set inline; room inside the box so its text never runs under the button; and
   the places where wrapping a box breaks a layout that positioned the box by
   its parent. `m.html` does not load this stylesheet, so none of this reaches
   the phone's boxes. */

/* WebKit draws its own X in a type=search box. Ours is the shared one, so the
   browser's goes - otherwise these boxes show TWO crosses in Chrome and one in
   Firefox, which is the inconsistency the section exists to stop. The control
   adds this class when it paints a search-type box. */
.search-clear-native-off::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

/* The box fills its host. ROOM FOR THE BUTTON IS NOT SET HERE: a page's own
   rule for its box out-specifies anything this can say about "an input inside
   a host", so the control sets that itself, and only when the box does not
   already leave room. */
.search-clear-host > input {
  width: 100%;
  box-sizing: border-box;
}

/* WHERE THE WRAPPER HAS TO STAND IN FOR THE INPUT. The control gives a box its
   own wrapper when there is nowhere else to hang the button, which puts a new
   element between that box and its parent - so a rule that positioned the
   input by its parent has to name the wrapper instead. This is visible breakage
   if dropped, not tidiness. */
.rail-find-wrap {
  /* The rail's find box used to carry this indent itself; it sits on the
     wrapper now, because the box is positioned by its wrapper. */
  display: block;
  margin: 4px 0 4px 14px;
}

/* Yellow DEV-BYPASS banner. Loud enough that nobody can mistake a bypass-
   on server for a hardened one. Shown only when /health reports
   dev_bypass_auth=true. */
.dev-banner {
  background: #fef3c7;
  color: #78350f;
  border-bottom: 2px solid #f59e0b;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2px;
}

/* ── Detail panel ───────────────────────────────────────────────────── */

/* Flex column + #detailBody flex: 1 gives the walkthrough side panel
   (.wt-side with its tabbed content) a parent with real height to fill.
   For the photo detail view this is also fine — its children stack
   naturally at the top of the flex container. */
#detailPanel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
}
#detailBody {
  flex: 1;
  min-height: 0;
}
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-mute);
}
.close-btn:hover {
  color: var(--text);
}

#detailBody h2 {
  margin: 0 0 4px;
  font-size: 16px;
}
#detailBody .sub {
  color: var(--text-mute);
  font-size: 12px;
  margin-bottom: 12px;
}
#detailBody .preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 12px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
/* 360 sphere viewer fills the preview area like the flat <img> does. PSV
   needs the container to have a definite size — the parent's aspect-ratio
   already gives us that, but inside the container we override to fill
   100% so the WebGL canvas matches the box. */
.psv-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}
.psv-container .psv-canvas-container {
  width: 100% !important;
  height: 100% !important;
}

#detailBody .preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#detailBody .preview video.preview-video {
  width: 100%;
  height: 100%;
  background: black;
  object-fit: contain;
}
#detailBody .preview img.preview-img {
  cursor: zoom-in;
  transition: filter 0.1s;
}
#detailBody .preview img.preview-img:hover {
  filter: brightness(1.05);
}

/* Lightbox: fullscreen overlay for viewing the original-resolution photo.
   Backdrop click and Escape both close. Image scales to viewport but never
   upscales past native — keeps it sharp on hi-DPI displays. */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox-note {
  color: #fff;
  font-size: 16px;
  padding: 24px;
  text-align: center;
}
.lightbox-note button {
  margin-left: 12px;
}
.lightbox-note.hidden {
  display: none;
}
.lightbox.hidden {
  display: none;
}
.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.lightbox img {
  cursor: zoom-in;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox video {
  background: black;
}
.lightbox img.hidden,
.lightbox video.hidden {
  display: none;
}
/* Fullscreen 360 panorama mount (double-click a 360 tile). PSV/WebGL needs an
   explicitly sized container, so give it a large fixed box inside the overlay. */
.lightbox-360 {
  width: 92vw;
  height: 88vh;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-360.hidden {
  display: none;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Walkthroughs panel — in-page layout (no overlay) ─────────────────
   List of thin rows by default; clicking a row replaces the list with
   the big video player. Right #detailPanel slides in for transcript +
   action items + rooms tabs. Sidebar filters drive what's in the list. */

/* Thin row in the list view (replaces the old card with chips). */
.wt-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 6px;
  cursor: pointer;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
.wt-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.wt-row-main {
  flex: 1;
  min-width: 0;
}
.wt-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.wt-row-meta {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}

/* In-page player (replaces the list while a walkthrough is selected). */
.wt-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.wt-player.hidden {
  display: none;
}
.wt-player-header {
  display: flex;
  gap: 12px;
  align-items: center;
}
.wt-player-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.wt-player-back:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.wt-player-title {
  flex: 1;
  min-width: 0;
}
.wt-player-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.wt-player-title .sub {
  margin: 2px 0 0;
  font-size: 12px;
}
.wt-player-fullscreen {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.wt-player-fullscreen:hover {
  background: var(--accent);
  color: white;
}

/* Big video fills the remaining vertical space without cropping.
   No min-height — letterboxing (object-fit: contain) keeps aspect
   regardless of how short the area gets. Double-click goes native
   fullscreen for monitor-fill viewing. The box is what a turned video is fitted
   to (public/video-turn.js), so the video sits in it rather than sizing it. */
.wt-player-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: black;
  border-radius: var(--radius);
  overflow: hidden;
}
.wt-player-stage:fullscreen {
  border-radius: 0;
}
.wt-player-box {
  position: relative;
  flex: 1;
  min-height: 0;
}
.wt-player-video {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: black;
  object-fit: contain;
}

/* Rotate and Reset rotation, office staff only (Ric, #141, 6 Nov 2026). They float
   over the top corner of the video, clear of the native controls at the bottom, so
   they take no room from the video in any window. */
.wt-turn-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.wt-turn-tools.hidden {
  display: none;
}
.wt-turn-tools .wt-player-back {
  background: var(--surface);
}
.wt-turn-status:not(:empty),
.wt-turn-reset {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
}
.wt-turn-status {
  color: var(--text-mute);
}
.wt-turn-status.wt-turn-failed {
  color: var(--danger, #b91c1c);
}
.wt-turn-reset {
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}
.wt-turn-reset.hidden {
  display: none;
}
.wt-turn-tools button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* The page's own control bar: a turned video's native controls would be sideways. */
.wt-turn-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #111;
  color: #eee;
  font-size: 12px;
}
.wt-turn-bar.hidden {
  display: none;
}
.wt-turn-bar button {
  background: transparent;
  border: 1px solid #555;
  border-radius: var(--radius);
  color: inherit;
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
}
.wt-turn-bar button:hover {
  border-color: #aaa;
}
.wt-turn-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wt-turn-seek {
  flex: 1;
  min-width: 60px;
}
.wt-turn-volume {
  width: 70px;
}

/* The video and its "Rooms in this video" list side by side (Ric, agent-comms
   #141, 31 Oct 2026: "click on a room and have a go to that room"). The list
   is always visible; on a narrow main area it drops under the video. */
.wt-player-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 12px;
}
.wt-chapters {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
/* Its look is the one heading rule (search "THE ONE LOOK OF A HEADING"); here
   only the padding of the bordered box it sits in. */
.wt-chapters-head {
  padding: 9px 12px;
}
.wt-chapters-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
}
.wt-chapters-empty {
  margin: 0;
  padding: 12px;
  font-size: 12.5px;
  color: var(--text-mute);
}
.wt-chapter {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  padding: 7px 8px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.wt-chapter:hover {
  background: var(--surface-2);
}
.wt-chapter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.wt-chapter.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
}
.wt-chapter-time {
  flex: 0 0 38px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-mute);
}
.wt-chapter.active .wt-chapter-time {
  color: var(--accent);
}
.wt-chapter-name {
  flex: 1;
  min-width: 0;
}
@media (max-width: 1180px) {
  .wt-player-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .wt-chapters-list {
    max-height: 200px;
  }
}

/* Right detail panel sections — tabs for Rooms / Transcript / Actions */
.wt-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.wt-side-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.wt-side-tab {
  flex: 1;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mute);
  padding: 8px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.wt-side-tab:hover {
  color: var(--text);
}
.wt-side-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.wt-side-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.wt-side-panel.hidden {
  display: none;
}
.wt-side-room {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  margin-bottom: 2px;
}
.wt-side-room:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}
.wt-side-room.active {
  background: var(--accent);
  color: white;
}
.wt-side-room-time {
  flex: 0 0 44px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-mute);
}
.wt-side-room.active .wt-side-room-time {
  color: rgba(255, 255, 255, 0.85);
}
.wt-side-room-name {
  flex: 1;
  font-size: 13px;
}

#detailBody .meta-block {
  margin-bottom: 14px;
}
#detailBody .meta-block dt {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}
#detailBody .meta-block dd {
  margin: 2px 0 0;
  font-size: 13px;
}

.tag-section {
  margin-top: 14px;
}
.tag-section h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mute);
}
.tag-section .row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.tag-section .row .k {
  font-weight: 600;
  min-width: 110px;
}
.tag-section .row .v {
  flex: 1;
}
.tag-section .row .src {
  font-size: 10px;
  color: var(--text-mute);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  align-self: center;
}
.tag-section .row .tag-rm {
  background: transparent;
  border: 0;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  margin-left: 4px;
  align-self: center;
  opacity: 0.5;
}
.tag-section .row:hover .tag-rm {
  opacity: 1;
}
.tag-section .row .tag-rm:hover {
  color: #dc2626;
}
.tag-section .row .tag-rm:disabled {
  opacity: 0.3;
  cursor: wait;
}

.add-tag-section {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.add-tag-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}
.add-tag-row select,
.add-tag-row input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface);
}
.add-tag-row button {
  padding: 5px 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.add-tag-row button:hover {
  filter: brightness(1.05);
}
.add-tag-row button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.add-tag-error {
  margin: 6px 0 0;
  font-size: 11px;
  color: #dc2626;
}

.ai-tag-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.ai-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-tag-row button {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.ai-tag-row button:hover {
  filter: brightness(1.05);
}
.ai-tag-row button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.ai-tag-row span {
  font-size: 11px;
}

/* ── Walkthroughs view ─────────────────────────────────────────────────── */
/* Flex column + height: 100% gives the player a real parent to fill
   so .wt-player → .wt-player-video can flex: 1 without forcing scroll.
   List view (default child) just stacks naturally and overflows up to
   #main if the list is huge. */
#walkthroughsPanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 4px 0 24px;
}
#walkthroughsPanel.hidden {
  display: none;
}
.wt-toolbar {
  padding: 8px 12px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.wt-toolbar h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}
.wt-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.wt-upload-form input[type='text'] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  width: 200px;
  background: var(--surface);
  color: var(--text);
}
.wt-file-pick {
  position: relative;
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-mute);
}
.wt-file-pick input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.wt-file-pick.has-file {
  color: inherit;
  border-color: var(--accent);
}
.wt-upload-form button[type='submit'] {
  padding: 6px 14px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.wt-upload-form button[type='submit']:disabled {
  opacity: 0.5;
  cursor: wait;
}
.wt-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}
.wt-status.error {
  color: #dc2626;
}
.wt-status.success {
  color: #16a34a;
}

.wt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
}

/* Walkthroughs grid view — thumbnail tiles; same List/Grid toggle as Documents.
   No stored poster, so the thumb is a neutral block with a play glyph. */
.wt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 0 12px;
}
.wt-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}
.wt-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.wt-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Video poster — fills the tile with a frame from the video; the play glyph
   overlays it (Ric 2026-06-16 — videos need a thumbnail, not just a play icon).

   TEMPORARILY UNUSED, and deliberately kept. The frame came from
   drive.google.com/thumbnail, and no Google URL may reach a browser (Doc's
   rule 1, agent-comms #54), so the poster was removed rather than left as the
   last Google URL on the page. Ric's 6/16 requirement is NOT withdrawn: the
   repo already extracts video keyframes in lib/ffmpeg.js (walkthrough-processor
   uses it), so restoring the poster means serving that frame from our own door
   — not finding a way to make one. This rule stays ready for that. */
.wt-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wt-play {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}
.wt-thumb .wt-phase-pill {
  position: absolute;
  top: 6px;
  left: 6px;
}
.wt-dur {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}
.wt-tile-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wt-tile-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.wt-tile-meta {
  font-size: 11px;
  color: var(--text-mute);
}
.wt-tile .wt-status-pill {
  align-self: flex-start;
}
.wt-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
}
.wt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.wt-card-project {
  font-size: 13px;
  font-weight: 500;
}
.wt-card-job,
.wt-detail-job {
  color: var(--text-mute);
  font-weight: 400;
}
.wt-card-meta {
  font-size: 11px;
  color: var(--text-mute);
}
.wt-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wt-status-processed {
  background: #dcfce7;
  color: #166534;
}
.wt-phase-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}
.wt-phase-before {
  background: rgba(220, 38, 38, 0.12);
  color: var(--phase-before);
}
.wt-phase-during {
  background: rgba(202, 138, 4, 0.16);
  color: var(--phase-during);
}
.wt-phase-after {
  background: rgba(22, 163, 74, 0.14);
  color: var(--phase-after);
}
.wt-upload-form select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--surface);
}

/* ── Walkthrough compare (Phase G-2) ─────────────────────────────────── */
.wt-compare-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.wt-compare-bar.hidden {
  display: none;
}
.wt-compare-bar select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface);
  max-width: 280px;
}
.wt-compare-vs {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#wtCompareBtn {
  padding: 5px 12px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.wt-compare-back {
  margin-left: auto;
  padding: 5px 10px;
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.wt-compare-back.hidden {
  display: none;
}

.wt-compare-view {
  padding: 0 12px;
}
.wt-compare-view.hidden {
  display: none;
}
.wt-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.wt-compare-side h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
}
.wt-compare-video {
  max-height: 200px;
  margin: 0;
}
.wt-compare-onesided {
  display: flex;
  gap: 24px;
  font-size: 12px;
  color: var(--text-mute);
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 4px;
  margin-bottom: 14px;
}
.wt-compare-rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wt-compare-room {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
}
.wt-compare-room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.wt-compare-jump {
  padding: 4px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.wt-compare-jump:hover {
  background: var(--accent);
  color: white;
}
.wt-compare-changes {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wt-change-field {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-mute);
}
.wt-change-a {
  color: var(--phase-before);
}
.wt-change-b {
  color: var(--phase-after);
}
.wt-change-none {
  font-size: 11px;
  color: var(--text-mute);
  font-style: italic;
}

#wtList.hidden {
  display: none;
}
#wtListStatus.hidden {
  display: none;
}

/* ── Browse-by rail + value cards (Ric, agent-comms #141) ──────────────────
   The column was 1,344px of chips in a 280px strip. It is now a short list
   of axes whose length does not change as photos arrive, and the values it
   used to hold are cards in the main area with a cover photo and a count. */
.browse-rail {
  display: flex;
  flex-direction: column;
  margin: 4px 0 10px;
}
/* A heading's look is the one heading rule (search "THE ONE LOOK OF A
   HEADING"). Here only the room above a heading that follows rows ("Views"
   under the Browse by rows), so each group stands apart. */
.browse-row + .browse-head {
  margin-top: 16px;
}
/* An item under a heading: its text starts 12px inside the heading's left
   edge, so it reads as sitting under it. */
.browse-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px 7px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.browse-row:hover {
  background: var(--surface-2);
}
.browse-row.active {
  background: var(--accent-soft, rgba(47, 111, 208, 0.12));
  box-shadow: inset 3px 0 0 var(--accent, #2f6fd0);
  font-weight: 600;
}
.browse-name {
  flex: 1;
  min-width: 0;
}
.browse-count {
  font-size: 11.5px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
/* A dash is "no number yet"; a 0 would claim "none". They are different
   answers and the reader has to be able to tell them apart. */
.browse-count.blank {
  opacity: 0.55;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.filter-toggle:hover {
  background: var(--surface-2);
}
.filter-toggle.open {
  border-color: var(--accent, #2f6fd0);
}
.filter-toggle-label {
  flex: 1;
  text-align: left;
}
.filter-toggle-count {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: var(--accent, #2f6fd0);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.filter-panel {
  margin-top: 10px;
}

/* One card per VALUE of the open axis: in the photo grid's place on Photos, and
   in the videos' list's place on Videos (Ric, #141, 27 Nov 2026). */
#grid.browse-cards,
#wtList.browse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
#wtList.browse-cards {
  padding: 0 12px; /* the list's own inset (.wt-list) */
}
/* No value to draw a card for: the honest blank in the cards' place. */
.browse-empty {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  color: var(--text-mute);
}
/* The rooms picked on Videos, as pills under the list's toolbar row, in the look
   of the photos' pills (.active-chip). */
#wtToolbar {
  flex-wrap: wrap;
}
.wt-active-rooms {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wt-active-rooms:empty {
  display: none;
}
.browse-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.browse-card:hover {
  border-color: var(--accent, #2f6fd0);
}
/* A value with no photos is still drawn -- Ric's ten photo types are an
   export checklist (2026-06-02) and the empty ones are the ones that still
   need shooting. Dimmed, never hidden. */
.browse-card.empty {
  opacity: 0.62;
}
.browse-card-shot {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.browse-card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.browse-card-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(18, 24, 34, 0.76);
  color: #fff;
  font-size: 11px;
}
.browse-card-body {
  padding: 8px 10px 10px;
}
.browse-card-body b {
  font-size: 13px;
  font-weight: 600;
}

/* ── Project picker (sidebar dropdown sourced from Drive root) ────────── */
.project-picker {
  display: flex;
  gap: 6px;
  align-items: center;
}
/* The one job picker's list (public/search-boxes.js). Fixed to the window, because
   the sidebar it opens from scrolls and is narrower than a customer's name. */
.job-picker-list {
  position: fixed;
  z-index: 1000;
  overflow-y: auto;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  font-size: 13px;
  color: var(--text);
}
.job-picker-row {
  padding: 6px 10px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.job-picker-row:hover {
  background: var(--surface-2);
}
.job-picker-row.active {
  background: var(--accent);
  color: #fff;
}
.job-picker-row.current {
  font-weight: 600;
}
.job-picker-note,
.search-down-note {
  color: var(--text-mute);
  font-size: 12px;
}
.job-picker-note {
  padding: 6px 10px;
}
.search-down-note {
  margin: -8px 0 10px;
}
.project-picker select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
}
.project-picker button {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-mute);
}
.project-picker button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.project-picker-status {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-mute);
}
.project-picker-status.error {
  color: #dc2626;
}
.wt-upload-form select#wtProjectId {
  min-width: 200px;
}
.wt-status-uploaded,
.wt-status-transcribing,
.wt-status-analysing {
  background: #fef3c7;
  color: #92400e;
}
.wt-status-failed {
  background: #fee2e2;
  color: #991b1b;
}
.wt-room-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.wt-room-chip {
  padding: 3px 9px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.wt-room-chip.empty {
  background: var(--surface-2);
  color: var(--text-mute);
}
.wt-transcript {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.5;
  max-height: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wt-error {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  font-size: 11px;
}
.wt-card-clickable {
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}
.wt-card-clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ── Walkthrough detail view (chaptered playback) ──────────────────────── */
.wt-video {
  width: 100%;
  max-height: 280px;
  background: #000;
  border-radius: var(--radius);
  margin: 12px 0;
  display: block;
}
.wt-detail-section {
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.wt-detail-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mute);
}
.wt-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wt-chapter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.1s;
}
.wt-chapter:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.wt-chapter-time {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-mute);
  min-width: 38px;
}
.wt-chapter:hover .wt-chapter-time {
  color: var(--accent);
}
.wt-chapter-name {
  color: var(--text);
  font-weight: 500;
}
.wt-chapter:hover .wt-chapter-name {
  color: var(--accent);
}
/* No max-height/overflow here — the parent .wt-side-panel already has
   overflow-y: auto, so the transcript expands to fill the full panel
   height (or scrolls inside the panel when longer). The old 280px cap
   left it pinned to a quarter of the side panel. */
.wt-transcript-full {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Action items (tick sheet) on the walkthrough detail panel.
   Each item is a checkbox + text + meta row (source badge, room,
   priority, optional jump-to-timestamp). Done items strike through and
   fade; wontdo items are dashed-faded. Source badges color-code where
   the item came from so the operator can tell explicit vs implied at
   a glance. */
.wt-action-status {
  font-weight: 400;
  font-size: 11px;
  margin-left: 6px;
}
.wt-action-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--surface);
}
.wt-action-item.wt-action-done {
  background: var(--surface-2);
}
.wt-action-item.wt-action-done .wt-action-text {
  text-decoration: line-through;
  color: var(--text-mute);
}
.wt-action-item.wt-action-wontdo {
  opacity: 0.5;
  border-style: dashed;
}
.wt-action-check {
  flex: 0 0 auto;
  padding-top: 2px;
}
.wt-action-body {
  flex: 1;
  min-width: 0;
}
.wt-action-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.wt-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}
.wt-action-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  color: white;
}
.wt-action-badge-explicit {
  background: #16a34a; /* green — direct quote */
}
.wt-action-badge-implied {
  background: #2563eb; /* blue — Scrutinizer inferred */
}
.wt-action-badge-standards {
  background: #7c3aed; /* purple — IICRC-anchored (reserved) */
}
.wt-action-badge-admin {
  background: #64748b; /* slate — operator/coordination */
}
.wt-action-room {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 99px;
}
.wt-action-priority {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}
.wt-action-priority-immediate {
  background: #dc2626;
  color: white;
}
.wt-action-priority-today {
  background: #ca8a04;
  color: white;
}
.wt-action-priority-before-extraction {
  background: #ea580c;
  color: white;
}
.wt-action-priority-low {
  background: #e5e7eb;
  color: var(--text-mute);
}
.wt-action-jump {
  background: var(--accent-bg);
  color: var(--accent);
  border: 0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.wt-action-jump:hover {
  background: var(--accent);
  color: white;
}
.wt-action-quote {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 8px;
}
.wt-action-controls {
  margin-top: 10px;
  text-align: right;
}
.wt-action-regen {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.wt-action-regen:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.wt-action-regen:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ── Documents view ────────────────────────────────────────────────────────
 * Read-only browse of customer Drive files alongside the photo gallery.
 * Activated via the "Documents" view-toggle button in the header. The
 * documents-filters sidebar section replaces the photo-filters block while
 * the view is active.
 */

#documentsPanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

#documentsPanel.hidden {
  display: none;
}

#docListStatus {
  padding: 8px 4px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Documents toolbar — status on the left, list/grid toggle on the right. */
.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.doc-view-toggle {
  display: inline-flex;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 0 0 auto;
}
.dv-btn {
  background: var(--surface);
  border: 0;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-mute);
}
.dv-btn + .dv-btn {
  border-left: 0.5px solid var(--border);
}
.dv-btn:hover {
  color: var(--accent);
}
.dv-btn.active {
  background: var(--accent);
  color: #fff;
}
/* Right cluster of the documents toolbar — review toggle + view toggle. */
.doc-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
/* Standalone "Needs review" toggle (not part of the segmented view toggle). */
.doc-review-toggle {
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
}
.doc-review-toggle.active {
  background: var(--phase-before);
  border-color: var(--phase-before);
  color: #fff;
}

/* Grid / thumbnail view — tiles like Google Docs; the Drive thumbnail (PDF
   first page) fills the top, falling back to the file-type icon. */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.doc-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}
.doc-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.doc-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.doc-thumb-icon {
  font-size: 34px;
  opacity: 0.65;
}
.doc-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}
.doc-tile-body {
  padding: 8px 10px;
}
/* The RCV an estimate arrived carrying (Ric, 8 Oct). Sits above the filename
   on a tile, because he said the figure is worth more than the name. The
   "as imported" tag travels WITH the number and is never styled away: the
   Line Items card shows a live figure for the same import, and the two
   separate the first time anyone edits a line. */
/* Whose documents these are. Ric, 10 Oct: "customers name and job number I
   want moved to the top of the page" — before this, the only places either
   appeared were the filter box in the left rail and the front of every file
   name, and neither answers "whose page is this" at a glance. */
.doc-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 10px;
}
.doc-page-header.hidden {
  display: none;
}
.dph-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text, #111827);
}
.dph-job {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute, #6b7280);
}
.dph-div {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--chip-bg, #eef2ff);
  color: var(--chip-fg, #4338ca);
}

.doc-tile-rcv {
  display: flex;
  align-items: baseline;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text, #111827);
}
.doc-rcv {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text, #111827);
}
.doc-tile-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-tile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-mute);
}

.doc-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.doc-card:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.doc-icon {
  font-size: 28px;
  line-height: 1;
  text-align: center;
}

.doc-body {
  min-width: 0;
}

.doc-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  margin-top: 2px;
}

/* A replaced document stays in the list, marked (Lifecycle Contract section 6). */
.doc-replaced {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--replaced);
  border: 1px solid currentColor;
}

.doc-subfolder {
  background: var(--surface-2, #f3f4f6);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.doc-tag {
  background: var(--accent-soft, #dbeafe);
  color: var(--accent, #1e40af);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.doc-actions {
  display: flex;
  align-items: center;
}

.doc-open {
  padding: 6px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--accent, #2563eb);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.doc-open:hover {
  background: var(--accent-soft, #dbeafe);
  border-color: var(--accent, #2563eb);
}
/* A subcontractor's Open on an HTML record is a button (it opens the safe
   preview, not a file), drawn the same as the link beside every other record. */
button.doc-open,
.doc-detail button.dd-open {
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
.doc-detail button.dd-open {
  background: transparent;
}

/* A NARROW LIST STAYS READABLE (#195, 7 Nov). At 1024 wide with a document
   open, the list has about 320px; the card's three columns left its title no
   room and the Open button sat over the tags (the walk's screen 23). Below
   520px the button drops under the text, and the toolbar wraps. Measured on
   the list's own width, not the window's, because the open panel decides it. */
#documentsPanel {
  container-type: inline-size;
}
@container (max-width: 520px) {
  .doc-card {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 6px 10px;
  }
  .doc-card .doc-icon {
    font-size: 22px;
    align-self: start;
  }
  .doc-card .doc-actions {
    grid-column: 2;
    gap: 8px;
  }
  .doc-toolbar {
    flex-wrap: wrap;
  }
}

/* Grid tile: its download button floats top-right over the thumbnail on hover. */
.doc-tile {
  position: relative;
}
.doc-tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.doc-tile:hover .doc-tile-actions,
.doc-tile:focus-within .doc-tile-actions {
  opacity: 1;
}

/* Filter-section hidden state — both the photo-filters block and the new
 * documents-filters block use the same `.hidden` toggle. */
.filters.documents-filters .filter-empty {
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  font-style: italic;
}

/* ── Document filing tree — Folder → Section → Doc-type. The two-level shading
 * copies the Gantt calendar day-view: idle (faint) → has-content (tinted) →
 * selected (accent fill). A required-but-missing state turns an empty
 * non-negotiable document into a visible filing gap. */
.doc-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 46vh;
  overflow-y: auto;
  font-size: 12px;
}
.doc-tchildren {
  padding-left: 14px;
}
.doc-trow {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--text-mute);
  user-select: none;
}
.doc-trow.selectable .doc-tlabel,
.doc-trow.selectable .doc-tcount {
  cursor: pointer;
}
/* level 1 — this job HAS documents under this node */
.doc-trow.has-content {
  color: var(--text);
  background: rgba(37, 99, 235, 0.08);
}
.doc-trow.has-content .doc-tlabel {
  font-weight: 600;
}
.doc-trow.has-content .doc-tcount {
  color: var(--accent);
}
/* level 2 — selected (active filter) */
.doc-trow.selected {
  background: var(--accent);
  color: #fff;
}
.doc-trow.selected .doc-tcount {
  color: #fff;
}
.doc-trow.selectable:hover {
  outline: 1px solid var(--accent);
}
/* required-but-missing — a non-negotiable doc with zero files = filing gap */
.doc-trow.missing-required {
  background: rgba(220, 38, 38, 0.07);
  color: #b91c1c;
  box-shadow: inset 2px 0 0 var(--phase-before);
}
.doc-trow.missing-required .doc-req {
  color: var(--phase-before);
}
.doc-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-size: 9px;
  transition: transform 100ms ease;
}
.doc-caret.open {
  transform: rotate(90deg);
}
.doc-caret.spacer {
  cursor: default;
  visibility: hidden;
}
.doc-req {
  font-size: 10px;
  color: var(--text-mute);
  flex: 0 0 auto;
}
.doc-tlabel {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-tcount {
  flex: 0 0 auto;
  min-width: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-mute);
}
.doc-tcount.missing {
  color: var(--phase-before);
  font-weight: 700;
  text-align: left;
}
.doc-tnode.lvl-folder > .doc-trow .doc-tlabel {
  font-weight: 700;
}
.doc-tnode.lvl-section > .doc-trow .doc-tlabel {
  font-weight: 600;
}
.doc-untyped > .doc-trow .doc-tlabel,
.doc-uncat > .doc-trow .doc-tlabel {
  font-style: italic;
  color: var(--text-mute);
  font-weight: 400;
}
/* ── The cabinet rail and the job binder's dividers ─────────────────────────
   Ric's approved filing tree (agent-comms #147, Q115). The rail reuses the
   filing tree's row styles, so a cabinet and a job look like what they sit
   beside rather than like a second design. */
/* The trail and the held-count line in the binder's header (agent-comms #147,
   Q115). Both sit on their own row above and below the job name. */
.dph-crumbs {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--muted, #6b7280);
}
.dph-held {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* What is narrowing the list, each with its own cross (Ric, agent-comms #147:
   "once an option is selected it doesn't release it there's no button to
   clear"). */
.active-filters.hidden {
  display: none;
}
.af-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--line, #d8dde6);
  border-radius: 999px;
  background: var(--bg, #fff);
  font: inherit;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
}
.af-chip:hover {
  border-color: var(--muted, #9aa3af);
}
.af-k {
  color: var(--muted, #6b7280);
}
.af-v {
  font-weight: 600;
}
.af-x {
  color: var(--muted, #6b7280);
  font-weight: 700;
}
.af-chip:hover .af-x {
  color: inherit;
}
.af-clear {
  padding: 4px 9px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted, #6b7280);
  cursor: pointer;
  text-decoration: underline;
}
.af-clear:hover {
  color: inherit;
}

.doc-cabinets {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
}
.rail-find {
  width: 100%;
  /* THE INDENT IS ON THE WRAPPER, not here: the shared clear control puts this
     input inside one, so a left margin here would push the box out of its own
     column by 14px. */
  margin: 0;
  padding: 4px 7px;
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line, #d8dde6);
  border-radius: 6px;
  background: var(--bg, #fff);
  color: inherit;
}
.rail-more {
  margin-left: 14px;
  padding: 3px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted, #6b7280);
  cursor: pointer;
  text-align: left;
}
.rail-more:hover {
  color: inherit;
  text-decoration: underline;
}

.binder-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line, #d8dde6);
}
.binder-tabs.hidden {
  display: none;
}
.binder-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  margin-bottom: -1px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
}
.binder-tab:hover {
  background: var(--hover, rgba(0, 0, 0, 0.04));
}
/* The divider you are on is the sheet you are looking at, so it joins the
   page rather than sitting on it. */
.binder-tab.active {
  background: var(--bg, #fff);
  border-color: var(--line, #d8dde6);
  font-weight: 600;
}
/* An empty divider is faint, not hidden: Ric's rule that a thing with nothing
   in it still says so rather than disappearing. */
.binder-tab.faint {
  color: var(--muted, #9aa3af);
}
.bt-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #6b7280);
}
.binder-tab.active .bt-count {
  color: inherit;
}

.doc-tree-legend {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-mute);
}
.doc-tree-legend .lg::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.doc-tree-legend .lg-has::before {
  background: rgba(37, 99, 235, 0.5);
}
.doc-tree-legend .lg-missing::before {
  background: var(--phase-before);
}

/* ── 2026-05-27 grid redesign (CompanyCam-inspired) ─────────────────────────
 * Aspect-ratio-locked square tiles, semi-transparent overlay metadata,
 * tight gutters, thin section dividers, customer header banner above the
 * grouped grid.
 *
 * These rules override the older .photo-card / .meta / .grid-room-* styling
 * defined earlier in this stylesheet. Old rules are intentionally left in
 * place so the walkthroughs panel + low-conf review path that share renderCard
 * keep working visually until those views are explicitly restyled.
 */

/* Toolbar above the grid — gridStatus + Group-by toggle on one line. */
/* Sticky controls zone — pins the Group-by + Select/Identify/Learn/Trash
   toolbar and the Identify action row to the top of the scrolling grid so they
   never get buried on a long scroll (Ric, 2026-05-29). The #main padding-top
   shows the same --bg behind it, so content scrolling under reads cleanly. */
.grid-controls {
  position: sticky;
  /* under the customer search, which is pinned above it */
  top: calc(var(--customer-search-h) - 16px);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  /* bleed over #main's 20px side padding so the bar spans edge-to-edge */
  margin: 0 -20px;
  padding: 0 20px;
  box-shadow: 0 4px 8px -6px rgba(15, 23, 42, 0.25);
}
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 12px;
  flex-wrap: wrap;
}
/* `.grid-status` carries 24px above and below for when it stands alone as a
   message. In this row it sets the toolbar's height, so that padding was the rest
   of the blank band. */
.grid-toolbar #gridStatus {
  margin: 0;
  padding: 0;
}
.group-by-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.group-by-toggle .group-by-label {
  margin-right: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.group-by-toggle .gb-btn {
  background: var(--surface, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  color: var(--text, #111827);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}
.group-by-toggle .gb-btn:hover {
  border-color: var(--accent, #2563eb);
}
.group-by-toggle .gb-btn.active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

/* No photo tool on a page with no photos (Ric, agent-comms #141, 15 Nov 2026:
   "Every element on the front page must make sense for the front page. Every
   click into a deeper view must make sense for that view"). Whatever works on
   photos is marked `data-photos-only` where it is made (index.html) and is
   shown only while the page says photos are on screen (app.js photosShowing /
   syncPhotosShowing): a customer's photos or the review queue, on the Photos
   tab. So it is not on the front page, which is a page of customers, and not on
   Videos or Storyboard. One rule per mark, so no button is hidden by hand. What
   works on videos is marked `data-videos-only` and shown only on Videos; the
   Filters button and panel, which serve both, are marked
   `data-photos-or-videos-only` (Ric, #141, 27 Nov 2026: "the left column should
   stay"). The Browse-by rail is drawn by app.js with only what is relevant, so
   it carries no mark. */
body:not([data-photos-showing]) [data-photos-only] {
  display: none;
}
body:not([data-videos-showing]) [data-videos-only] {
  display: none;
}
body:not([data-photos-showing]):not([data-videos-showing]) [data-photos-or-videos-only] {
  display: none;
}

/* Customer header banner — hero image left, info right. Only shows when a
   project is selected. */
.grid-project-header {
  display: grid;
  grid-template-columns: 320px 1fr auto; /* hero · info · clear-X */
  gap: 20px;
  padding: 16px 0 20px;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  align-items: start;
}
/* ✕ on the banner clears just the customer (back to picker). Per Ric
   2026-05-30 — "X next to the customer to delete the customer and start
   new." Tucked into the top-right of the banner; muted until hover. */
.grid-project-header .gph-clear {
  align-self: start;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  width: 28px;
  height: 28px;
  border-radius: 99px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.12s ease;
}
.grid-project-header .gph-clear:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.grid-project-header .gph-hero {
  width: 320px;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.grid-project-header .gph-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.grid-project-header .gph-hero-placeholder {
  color: var(--text-muted, #9ca3af);
  font-size: 12px;
  font-style: italic;
}
.grid-project-header .gph-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.grid-project-header .gph-job {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #2563eb);
  background: var(--accent-soft, #dbeafe);
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
}
.grid-project-header .gph-customer {
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #111827);
  line-height: 1.2;
}
.grid-project-header .gph-stats {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

/* Section headers (room and day groups share this element) — a centred,
   bold name with a divider line either side, so each group reads as a clear
   break in the grid (Ric, #141, 3 Nov 2026: "Center the room name ... make
   it clearer and bolder"). Order: line · name · count pill · line · [Select
   all]. The count pill says "N photos" so it can't read as part of the name
   ("Bathroom 2"), which is why it used to sit at the far right. */
#grid.grid-grouped .grid-room-section {
  margin-bottom: 32px;
}
#grid.grid-grouped .grid-room-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 6px;
  margin-bottom: 14px;
  border-bottom: none;
  background: none;
}
#grid.grid-grouped .grid-room-header::before,
#grid.grid-grouped .grid-room-header::after {
  content: '';
  flex: 1 1 24px;
  min-width: 16px;
  height: 1px;
  background: var(--border-color, #e5e7eb);
}
#grid.grid-grouped .grid-room-header::before {
  order: 0;
}
#grid.grid-grouped .grid-room-header h3 {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  overflow-wrap: break-word;
  color: var(--text, #111827);
}
#grid.grid-grouped .grid-room-header .grid-room-count {
  order: 2;
  flex: 0 0 auto;
  margin-left: 0;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--accent-bg);
  color: var(--text-muted, #6b7280);
}
#grid.grid-grouped .grid-room-header::after {
  order: 3;
}
/* In select mode a "Select all" button is appended; it sits after the right
   line so the name stays visually centred. */
#grid.grid-grouped .grid-room-header .group-select-btn {
  order: 4;
  flex: 0 0 auto;
  margin-left: 0;
}

/* Square aspect-ratio tile grid — auto-fill columns. Larger tiles (~7 across
   on a typical wide monitor, down from 8) with more breathing room between
   them (Ric 2026-06-16). */
#grid.grid-grouped .grid-room-inner,
#grid:not(.grid-grouped) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

/* The card itself is now the square — thumbnail fills it; metadata
   overlays. Older .meta / .filename rules above are unused on this path. */
.photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2, #f3f4f6);
  border: 1px solid transparent;
  /* Only the border animates — no transform, so the tile never moves/grows. */
  transition: border-color 120ms ease;
}
.photo-card:hover {
  border-color: var(--accent, #2563eb);
}
.photo-card:hover .meta-overlay {
  opacity: 1;
}
.photo-card.needs-review {
  border-color: rgba(245, 158, 11, 0.7);
}
.photo-card .thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, #f3f4f6);
}
.photo-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-card .badge-360,
.photo-card .badge-video,
.photo-card .conf-badge {
  position: absolute;
  top: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  z-index: 2;
}
.photo-card .badge-360 {
  right: 6px;
}
.photo-card .badge-video {
  left: 6px;
}
.photo-card .conf-badge {
  right: 6px;
  background: rgba(245, 158, 11, 0.95);
}
.photo-card .bulk-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  padding: 2px 4px;
  /* Visual only — clicks pass through to the whole tile so clicking the
     checkbox selects like clicking anywhere else on the photo (Ric, 2026-05-29). */
  pointer-events: none;
}

/* Overlay metadata — bottom gradient strip, hover-revealed. */
.photo-card .meta-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 24px 8px 6px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.4) 60%,
    transparent 100%
  );
  color: #fff;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
  z-index: 1;
}
.photo-card:focus-within .meta-overlay,
.photo-card.bulk-checked .meta-overlay {
  opacity: 1;
}
.photo-card .meta-overlay .meta-left {
  min-width: 0;
  flex: 1;
}
.photo-card .meta-overlay .meta-room {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-card .meta-overlay .meta-captured {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}
.photo-card .meta-overlay .meta-photographer {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Mobile: 3-up grid on narrow screens. */
@media (max-width: 640px) {
  #grid.grid-grouped .grid-room-inner,
  #grid:not(.grid-grouped) {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .grid-project-header {
    grid-template-columns: 100px 1fr;
  }
  .grid-project-header .gph-hero {
    width: 100px;
    height: 80px;
  }
  .grid-project-header .gph-customer {
    font-size: 16px;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   DARK THEME — selector-level overrides
   The token block at the top of this file flips everything that flows through
   the --bg / --surface / --text / --accent / … variables. The rules below
   catch the surfaces whose color was a fixed light literal (the pastel status
   chips, the detail-preview placeholder gradient, status message text) and
   would otherwise stay light on a dark page. Scoped by :root[data-theme='dark']
   so they win on specificity and never touch the light look.
   ════════════════════════════════════════════════════════════════════════ */

/* Placeholder gradient behind the detail-panel preview before the image loads. */
:root[data-theme='dark'] #detailBody .preview {
  background: linear-gradient(135deg, #1b2333, #232d40);
}

/* Form-field placeholder text reads too dark on a dark field by default. */
:root[data-theme='dark'] input::placeholder {
  color: var(--text-mute);
  opacity: 0.85;
}

/* Identify-mode action bar — its teal tint (rgba(13,148,136,0.08)) all but
   vanishes on a dark page, and the dark-teal count text (#0f766e) drops below
   readable contrast. Brighten both for dark. */
:root[data-theme='dark'] .identify-bar {
  background: rgba(13, 148, 136, 0.22);
  border-color: #2dd4bf;
}
:root[data-theme='dark'] .identify-bar .idbar-count {
  color: #5eead4;
}

/* ── Semantic status chips → translucent dark fills with lightened text ─── */
/* Danger / failure (was #fee2e2 / #fef2f2 fills with dark-red text). */
:root[data-theme='dark'] .tag-pill.cat-phase-before,
:root[data-theme='dark'] .tag-pill.cat-damage,
:root[data-theme='dark'] .wt-status-failed,
:root[data-theme='dark'] .wt-error {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
:root[data-theme='dark'] .doc-trow.missing-required {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}
/* Photo panel Delete and its failure line: the light red on a dark page. */
:root[data-theme='dark'] .pd-delete {
  border-color: #fca5a5;
  color: #fca5a5;
}
:root[data-theme='dark'] .pd-delete:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}
:root[data-theme='dark'] #detailBody .pd-status {
  color: #fca5a5;
}
:root[data-theme='dark'] .grid-project-header .gph-clear:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}
/* Warning / in-progress (was #fef3c7 / #fef9c3 fills with dark-amber text). */
:root[data-theme='dark'] .tag-pill.cat-phase-during,
:root[data-theme='dark'] .tag-pill.low-conf,
:root[data-theme='dark'] .wt-status-uploaded,
:root[data-theme='dark'] .wt-status-transcribing,
:root[data-theme='dark'] .wt-status-analysing {
  background: rgba(234, 179, 8, 0.16);
  color: #fcd34d;
  border-color: rgba(234, 179, 8, 0.3);
}
/* Success / processed (was #d1fae5 / #dcfce7 fills with dark-green text). */
:root[data-theme='dark'] .tag-pill.cat-phase-after,
:root[data-theme='dark'] .wt-status-processed {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}
/* Equipment / info (was #ede9fe fill with purple text). */
:root[data-theme='dark'] .tag-pill.cat-equipment {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.32);
}
/* Low-priority action badge had a light-gray fill. */
:root[data-theme='dark'] .wt-action-priority-low {
  background: var(--surface-2);
  color: var(--text-mute);
}

/* Status / error / success message text — brightened for dark legibility. */
:root[data-theme='dark'] .wt-status.error,
:root[data-theme='dark'] .project-picker-status.error,
:root[data-theme='dark'] .add-tag-error {
  color: #f87171;
}
:root[data-theme='dark'] .wt-status.success {
  color: #4ade80;
}
:root[data-theme='dark'] .tag-section .row .tag-rm:hover {
  color: #f87171;
}

/* ── Document quick-view (single-click right panel) ─────────────────────────
   A single click on a doc row/tile opens the right panel with the ACTUAL file
   embedded (Drive's scrollable preview) + tags/info beneath — readable without
   opening a new tab (Ric 2026-06-16). The panel is widened for docs so the page
   is legible — not a thumbnail. */
/* Opening a document gives the panel most of the window, rather than the flat
   600px it used to take — Ric: "once the document is selected from the second
   panel the third panel should move and get bigger ... it's still too small"
   (agent-comms #141). A fraction of the viewport rather than a fixed number,
   so it is already right on a wide screen instead of needing a drag. A width
   he has dragged and saved still wins: --right-w overrides the default. */
/* THE LIST KEEPS A READABLE WIDTH (#195, 7 Nov). 62% of the window, beside a
   280px sidebar, left the list about 200px at 1280 wide: one word per line
   (the walk's screens 23 and 33). The default now stops where the list would
   drop under 380px, so it still takes most of a wide screen and gives way on a
   narrow one. A width he has dragged and saved still wins. */
#layout.detail-open.doc-quickview {
  grid-template-columns: var(--left-w, 280px) 1fr var(
      --right-w,
      max(420px, min(62vw, 1250px, calc(100vw - var(--left-w, 280px) - 380px)))
    );
}
#layout.detail-open.doc-quickview #resizeRight {
  right: var(--right-w, max(420px, min(62vw, 1250px, calc(100vw - var(--left-w, 280px) - 380px))));
}
/* A collapsed middle column beats the quickview default — the document takes
   everything that is left. */
#layout.mid-collapsed.detail-open.doc-quickview {
  grid-template-columns: var(--left-w, 280px) 0 1fr;
}
#layout.left-collapsed.mid-collapsed.detail-open.doc-quickview {
  grid-template-columns: 0 0 1fr;
}
#layout.left-collapsed.detail-open.doc-quickview {
  grid-template-columns: 0 1fr var(--right-w, min(62vw, 1250px));
}
.doc-card,
.doc-tile {
  cursor: pointer;
}
.doc-card.active,
.doc-tile.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
/* Document viewer layout (Ric, agent-comms #141): "When I click a document, I
   want to read the document first." It was a vertical stack — title, a frame
   fixed at 62vh, then the information — which left a band of unused white
   space underneath and kept the page small.

   Now a two-column grid filling the panel's height: the document takes all the
   width and height going, and a narrow supporting column on the right carries
   the page thumbnails and then the document information. The `min-height: 0`
   pairs are what actually let the frame grow — without them a grid item will
   not shrink below its content, and the column scrolls instead of the page. */
.doc-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}
/* The narrow supporting column: pages, then information. */
.doc-detail .dd-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}
/* Small, vertically scrollable, and secondary to the document. */
.doc-detail .dd-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Takes what is left after the information block, never squeezing it out. */
  flex: 1 1 auto;
  min-height: 0;
}
.doc-detail .dd-page {
  position: relative;
  display: block;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  line-height: 0;
  cursor: pointer;
}
.doc-detail .dd-page:hover {
  border-color: var(--accent);
}
.doc-detail .dd-page.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.doc-detail .dd-page canvas {
  display: block;
  width: 104px;
  height: auto;
}
.doc-detail .dd-page-n {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 0 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
  line-height: 14px;
}
.doc-detail .dd-pages-fail {
  padding: 6px 0;
  color: var(--text-mute);
  font-size: 11px;
  text-align: center;
}
/* In the narrow right-hand column the rows stack — label above value. Left as
   two columns, the 110px label leaves ~70px for the value and "Our Documents"
   breaks into four lines. The information block keeps its own height and
   scrolls if a document carries a lot of tags; the pages rail takes the rest. */
.doc-detail .dd-side .dd-info {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.doc-detail .dd-side .dd-row {
  display: block;
  padding: 4px 0;
}
.doc-detail .dd-side .dd-k {
  flex: none;
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.doc-detail .dd-side .dd-v {
  display: block;
}
.doc-detail .dd-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
/* The open document, in a narrow panel (#195, 7 Nov; at 1024 wide the panel
   is about 420px): the information column goes under the document instead of
   beside it, so the page keeps the width. It sits AFTER the base .doc-detail
   rules above on purpose: same specificity, so the later rule wins, and placed
   before them it never applied. tests/sub-docs-screen.test.mjs holds the order. */
#detailBody {
  container-type: inline-size;
}
@container (max-width: 640px) {
  .doc-detail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .doc-detail .dd-side {
    max-height: 28vh;
  }
  .doc-detail .dd-head {
    flex-wrap: wrap;
  }
}
/* Title, then the revision lines under it (Lifecycle Contract section 6). */
.doc-detail .dd-head-main {
  min-width: 0;
}
/* A replaced document says which one is current, first and plainly; the newer
   one says what it replaces, more quietly. */
.doc-detail .dd-rev {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-mute, #6b7280);
}
.doc-detail .dd-rev-replaced {
  font-size: 13px;
  font-weight: 600;
  color: var(--replaced);
}
.doc-detail .dd-rev-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent, #2563eb);
  text-decoration: underline;
  cursor: pointer;
  word-break: break-word;
  text-align: left;
}
.doc-detail .dd-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  min-width: 0;
}
.doc-detail .dd-open {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.doc-detail .dd-open:hover {
  background: var(--accent);
  color: #fff;
}
/* Download-to-folder + change-folder buttons (Ric 2026-07-08). */
.doc-detail .dd-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dd-download,
.dd-download-folder {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.dd-download-folder {
  background: transparent;
  color: var(--accent);
  padding: 4px 8px;
}
.dd-download:hover {
  filter: brightness(1.08);
}
.dd-download-folder:hover {
  background: var(--accent);
  color: #fff;
}
/* Small per-card download button. */
.doc-dl {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text-mute, #6b7280);
}
.doc-dl:hover {
  background: var(--hover, rgba(0, 0, 0, 0.06));
  color: var(--accent);
}
.doc-card[draggable='true'],
.doc-tile[draggable='true'] {
  cursor: grab;
}
/* Transient "saved to your folder" confirmation. */
.dl-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: var(--success, #16a34a);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 1000;
}
.dl-toast.err {
  background: var(--danger, #dc2626);
}
.dl-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* AI receipt-read block on the document detail (Ric 2026-07-08). */
.rcpt-block {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface, rgba(0, 0, 0, 0.02));
}
.rcpt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mute, #6b7280);
  margin-bottom: 6px;
}
.rcpt-reread {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}
.rcpt-read {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.rcpt-hint {
  font-size: 12px;
  color: var(--text-mute, #6b7280);
  margin-left: 8px;
}
.rcpt-hint.err {
  color: var(--danger, #dc2626);
}
/* The Controller's answer on a receipt (Ric #195, agent-comms #196). */
.rcpt-handover {
  font-weight: 600;
  margin-bottom: 6px;
}
.doc-detail .dd-side .rcpt-handover-accepted .dd-v {
  color: var(--success, #16a34a);
}
.doc-detail .dd-side .rcpt-handover-refused .dd-v {
  color: var(--danger, #dc2626);
}
.rcpt-items {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 12px;
}
.rcpt-items th,
.rcpt-items td {
  text-align: left;
  padding: 3px 6px;
  border-top: 1px solid var(--border);
}
.rcpt-items th:last-child,
.rcpt-items td:last-child {
  text-align: right;
}
/* The dominant thing on the screen. It was `height: 62vh` — a fixed slab that
   ignored the panel's real height and left white space under it whatever the
   window size. Now it fills its grid cell, so the page is as large as the
   screen allows and scrolls naturally (Ric, agent-comms #141). */
.doc-detail .dd-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: block;
}
/* An HTML record (the sub's package) is drawn on its own white page, as it
   was written to be read; the frame's grey would sit behind its text. */
.doc-detail .dd-frame-html {
  background: #fff;
}
/* A subcontractor's step on his package (Ric, #195, 7 Nov: "every step of the
   way has to have a clear call to action"). Lifecycle Contract section 8: the
   current step is the most pronounced thing on the page, so it is the one
   filled, large control here; the record's own buttons stay small beside it. */
.doc-detail .dd-step {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.doc-detail .dd-step-go {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.doc-detail .dd-step-go:hover {
  filter: brightness(1.08);
}
.doc-detail .dd-step-say {
  font-size: 12px;
  color: var(--text-mute);
}
.doc-detail .dd-step-blocked {
  font-size: 13px;
  font-weight: 600;
  color: var(--replaced);
}
.doc-detail .dd-frame-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 240px;
  color: var(--text-mute);
  font-size: 13px;
}
.doc-detail .dd-frame-empty .dd-frame-icon {
  font-size: 40px;
}
.doc-detail .dd-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.doc-detail .dd-row {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.doc-detail .dd-k {
  flex: 0 0 110px;
  color: var(--text-mute);
  font-weight: 600;
}
.doc-detail .dd-v {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}
.doc-detail .dd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* ── Framed: the gallery shown inside the main app's page ───────────────────
   Ric, agent-comms 141, 6895179994 (15 Nov 2026): the gallery "needs to become
   part of the app it's still at Standalone page". The main app shows this page in
   a frame and has the one header, the one name tag and the one Max. So here, and
   only when `<html data-framed>` is set (frame-link.js, the one answer), the
   gallery's own header is not shown: no brand, no name tag, no Max button, no
   theme or fullscreen button, no header look.
   What lives only in that bar and is still needed stays, in the same order, as one
   plain row above the page: the customer on screen, the Photos / Videos /
   Storyboard tabs (and a sub's Documents tab), and Refresh. The customer search
   (#customerSearch) is not in that bar: it is the first row of #main, under it. Nothing is moved
   in the markup and nothing is redrawn: these rules only take away.
   The look is taken off by the bar's class, never its id, like every other look on
   the bar (the shared header theme's rule is on the class).
   In its own window nothing here applies. */
html[data-framed] {
  --bar-h: 44px;
}
html[data-framed] #topbar > .brand,
html[data-framed] #themeToggle,
html[data-framed] #appFullscreen,
html[data-framed] #hdrUserPill,
html[data-framed] #maxLauncher {
  display: none;
}
html[data-framed] .top-bar {
  min-height: 0;
  padding: 4px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

/* ── Max's 380px panel, open ────────────────────────────────────────────────
   The button's resting look is the shared header theme's (SS-107). Only this
   page's own layout is here: with his panel open, the top bar and the three
   columns stop short of it, as the Gantt's `.app-header` and `.page` do, so the
   Max button in the top bar stays reachable to close him (Ric, 31 Oct 2026: Max
   "at the top for uniformity"). */
body.rex-open #topbar,
body.rex-open #layout {
  margin-right: 380px;
}
/* The top-bar columns do not all fit at 1024 with the job label, or at 1366/1280
   with 380px gone. Max and the other right-hand buttons (.user) keep their size. The
   room comes from what matters least, in the steps below: the job label, then the
   environment tag, then the name. Only when even that is not enough do the brand
   truncate and the tabs scroll sideways. The row never grows past the bar, so Max is
   never pushed off it or under his own panel. */
#topbar > .brand,
#topbar > .context {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Named columns, so the tabs and the buttons stay put when the job label goes. */
#topbar > .view-toggle {
  grid-column: 3;
  justify-self: start;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar > .user {
  grid-column: 4;
}
/* Room to spare: the customer and job number whole, as often as names allow. */
@container (min-width: 1400px) {
  #topbar > .context {
    max-width: 360px;
  }
}
#topbar #hdrUserName {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A short bar, whether from a small screen or Max's panel: the same buttons with
   less air, so every tab stays in sight. Spacing only. These widths are the bar's
   inside width, its 22px side padding already taken off, so 1100 is a 1144 window.
   Below 1100 the job label steps aside rather than show a sliver. The environment
   tag goes, which fits all four tabs at a 1024 window at the name's longest. Below 950
   the name goes and the tag keeps the role. Those are
   all words, no controls. Travis, #131, 6 Nov 2026: "at 1024 wide the gallery's last
   tab is cut off at 'Ma'". */
@container (max-width: 1200px) {
  #topbar .dash-btn,
  #topbar .vt-btn {
    padding: 6px 8px;
  }
  #topbar .user {
    gap: 4px;
  }
}
@container (max-width: 1100px) {
  #topbar > .context {
    display: none;
  }
  #topbar .env-tag {
    display: none;
  }
}
@container (max-width: 950px) {
  #topbar #hdrUserName {
    display: none;
  }
}

/* ── Photo panel actions (Ric, 31 Oct 2026: "continuity here across these
   software pages") — the title row and its buttons, laid out like the
   document panel's .dd-head / .dd-actions. Download reuses .dd-download. ── */
#detailBody .pd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
/* The panel's ✕ (.close-btn) is pinned 10px from the top-right corner, on the
   same line as both panels' title rows. The rows stop short of it so no button
   ever sits under it. */
#detailBody .pd-head,
#detailBody .doc-detail .dd-head {
  padding-right: 28px;
}
#detailBody .pd-head h2 {
  min-width: 0;
  word-break: break-word;
}
#detailBody .pd-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-delete,
.pd-restore {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}
.pd-delete {
  border: 1px solid #dc2626;
  color: #dc2626;
}
.pd-delete:hover {
  background: #dc2626;
  color: #fff;
}
.pd-restore {
  border: 1px solid var(--accent);
  color: var(--accent);
}
.pd-restore:hover {
  background: var(--accent);
  color: #fff;
}
.pd-delete:disabled,
.pd-restore:disabled {
  opacity: 0.6;
  cursor: default;
}
#detailBody .pd-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: #dc2626;
}

/* ── Signing on a PC (Ric, agent-comms #141) ───────────────────────────────
   "the ability to type their name and approve the type name as and approved
   signature ... so that if there's no way to manually sign something, in other
   words a computer without a touch screen." Asked what the wording should be,
   he said "whatever most companies do" — so this is DocuSign's
   adopt-a-signature step, not an invention.

   One overlay, three steps, in the same order the field app uses, because it
   is the same obligation: read and accept, adopt a signature, place it and
   confirm. It closes only by its own Cancel — a mis-click must never discard a
   half-finished signature, and must never commit one either. */
.sign-sheet {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.55);
}
.sign-box {
  display: flex;
  flex-direction: column;
  width: min(880px, 94vw);
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}
.sign-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.sign-close {
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text-mute);
  cursor: pointer;
}
.sign-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
.sign-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.sign-hint {
  flex: 1;
  font-size: 12px;
  color: var(--text-mute);
}
.sign-foot button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.sign-foot .sign-go {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.sign-foot .sign-go:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* The disclosure. Scrollable, and the acceptance stays locked until it has
   been read to the end — a disclosure too short to scroll counts as read. */
.sign-disclosure {
  max-height: 34vh;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.5;
}
.sign-disclosure p {
  margin: 0 0 10px;
}
.sign-ack {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0;
  font-size: 13px;
  /* The global label rule is uppercase 800 — an acknowledgement in shouting
     capitals is harder to read and easier to skip, which is the opposite of
     what this step is for (Flo found the same on the phone). */
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}
.sign-ack.locked {
  opacity: 0.55;
}
.sign-field {
  display: block;
  font-size: 13px;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}
.sign-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-mute);
}
.sign-field input {
  width: 100%;
  max-width: 360px;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.sign-lead {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-mute);
}
/* The styles to choose between. */
.sign-styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.sign-style {
  position: relative;
  padding: 10px;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
}
.sign-style.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.sign-style img {
  max-width: 100%;
  max-height: 56px;
}
.sign-style-tag {
  position: absolute;
  left: 6px;
  bottom: 4px;
  font-size: 10px;
  color: var(--text-mute);
}
/* Placing it on the page. */
.sign-pagebar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.sign-pagebar button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.sign-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}
.sign-canvas-wrap canvas {
  border: 1px solid var(--border);
  cursor: crosshair;
  max-width: 100%;
}
.sign-stamp {
  position: absolute;
  pointer-events: none;
}
.sign-loading,
.sign-fail {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
/* The Sign button in the document header. */
.doc-detail .dd-sign {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

/* ── Google Photos zips into a job (Ric, agent-comms #141, 31 Oct 2026) ──
   "a place that I just dropped the zipped folders". Not a bar across the
   page (Ric, 31 Oct: "take up all the real estate that it took up just to
   drop a file into"): a toolbar button styled with Select/Identify/Trash
   above, a drop target over the photos only while files are dragged onto
   them, and a small card in the corner while a drop runs or has a result.
   Tokens only, so the dark theme follows. */
.zip-drop-btn {
  white-space: nowrap;
}
.zip-drop-btn.hidden {
  display: none;
}
.zip-drop-btn.busy {
  opacity: 0.55;
  cursor: default;
}
.zip-drop-btn.busy:hover {
  background: var(--surface);
}
.zip-drop-overlay {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-bg) 88%, transparent);
}
.zip-drop-overlay.hidden {
  display: none;
}
.zip-drop-overlay.busy {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
}
.zdo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 420px;
  text-align: center;
  pointer-events: none; /* the drop lands on the overlay, not on its words */
}
.zdo-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.zdo-hint {
  font-size: 12px;
  color: var(--text-mute);
}
.zip-drop-progress {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 65;
  box-sizing: border-box;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.zip-drop-progress.hidden {
  display: none;
}
.zdp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.zdp-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.zdp-kicker {
  font-size: 11px;
  color: var(--text-mute);
}
.zdp-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
}
.zdp-bar {
  height: 4px;
  margin: 10px 0;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.zdp-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.zdp-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--text-mute);
}
.zdp-counts b {
  color: var(--text);
}
.zdp-counts .zdp-bad b {
  color: #dc2626;
}
.zdp-notes p {
  margin: 8px 0 0;
  color: var(--text-mute);
}
.zdp-failures {
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
}
.zdp-failures summary {
  cursor: pointer;
  color: var(--text-mute);
}
.zdp-failures ul {
  margin: 6px 0 0;
  padding: 0 0 0 18px;
  max-height: 160px;
  overflow: auto;
}
.zdp-failures li {
  margin: 2px 0;
}
.zdp-name {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}
:root[data-theme='dark'] .zdp-counts .zdp-bad b {
  color: #f87171;
}

/* ── The PDF view and its signing steps (public/sign-view.css) ─────────────
   The Field App's own view, shared (Ric, agent-comms #154, 20 Nov 2026). Its
   rules read colour tokens the phone has and this page does not, so they are
   given here, for the view only, from this page's own palette. The view runs
   full screen inside the main app's frame or in its own window; at a desktop
   or tablet width its pages and sheets keep to a readable column. */
#pdfView {
  --muted: var(--text-mute);
  --label: var(--text-mute);
  --accent-text: var(--accent);
  --success: #059669;
  --warn: #b45309;
}
:root[data-theme='dark'] #pdfView {
  --success: #10b981;
  --warn: #fbbf24;
}
#pdfView .back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  padding: 4px 6px;
  cursor: pointer;
}
#pdfView .hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
#pdfView .pdfv-pages {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  /* the pages are drawn to the width measured before they overflow, so the
     scrollbar's room is kept from the start, or a desktop scrollbar pushes them
     sideways */
  scrollbar-gutter: stable;
  /* room under the last page, so a place near its foot can be brought above
     the review sheet */
  padding-bottom: 45vh;
}
#pdfView .sig-box {
  max-width: 720px;
  margin: 0 auto;
  border-radius: 14px 14px 0 0;
}
#pdfView #sigPad {
  max-height: 360px;
  cursor: crosshair;
}
