    :root {
      /* Aliases onto master tokens from shared.css */
      --border:         var(--border-input);
      --panel:          var(--bg-card);
      --text:           var(--text-heading);
      --muted:          var(--text-secondary);
      --bg:             var(--bg-primary);
      --toolbar-height: 56px;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      height: 100%;
      min-height: 100%;
      font-family: var(--font-primary);
      color: var(--text);
      background: var(--bg-secondary);
    }

    /* Remove old header/footer styles - now using shared components */

    .demo-page {
      margin: 0 auto;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      min-height: 0;
    }

    .top-toolbar {
      min-height: var(--toolbar-height);
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--bg-card);
      padding: 10px 12px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      overflow: visible; /* Ensure pulse glow is not clipped */
    }

    .top-toolbar-group {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .top-toolbar button,
    .top-toolbar .back-link,
    .toolstrip button {
      display: inline-flex;
      align-items: center;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--bg-card);
      color: var(--text);
      font-size: .875rem;
      font-weight: 600;
      padding: 8px 12px;
      text-decoration: none;
      line-height: 1;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    /* ── Toolbar per App Workspace.dc.html ────────────────────────────── */
    .toolbar-divider {
      width: 1px;
      height: 24px;
      background: var(--border);
      flex: none;
    }

    .toolbar-beta-feedback-slot { display: contents; }

    .top-toolbar .toolbar-tutorial-btn,
    .top-toolbar #a22-bw-pill,
    body:not(.app-mode-active) .top-toolbar #app-mode-toggle {
      gap: 7px;
      border-color: var(--accent-fill);
      /* 0.08 not --accent-light (0.14): amber-on-amber at 0.14 is 4.34:1 */
      background: rgba(var(--accent-fill-rgb), 0.08);
      color: var(--accent-primary);
    }

    .top-toolbar #a22-bw-pill {
      padding: 8px 12px;
      border-radius: 6px;
      font-size: .875rem;
      font-weight: 600;
      letter-spacing: normal;
    }
    .top-toolbar #a22-bw-pill svg { width: 11px; height: 11px; }

    .top-toolbar .toolbar-tutorial-btn:hover,
    .top-toolbar #a22-bw-pill:hover,
    body:not(.app-mode-active) .top-toolbar #app-mode-toggle:hover {
      box-shadow: none;
      background: rgba(var(--accent-fill-rgb), 0.16);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    .top-toolbar .toolbar-analyze-btn {
      background: var(--accent-fill);
      border-color: var(--accent-fill);
      color: var(--accent-on);
    }

    .top-toolbar .toolbar-analyze-btn:hover:not(:disabled) {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
      color: var(--accent-on);
    }

    /* ── EXIF settings stack — bottom-left of the photo. Halo is the overlay
       label recipe (.comp-pill label text), not a new shadow style. ───────── */
    .exif-strip {
      position: absolute;
      left: 14px;
      bottom: 12px;
      z-index: 2;
      display: flex;
      align-items: flex-end;
      gap: 8px;
      max-width: calc(100% - 28px);
      color: rgba(255, 255, 255, 0.95);
      font: 600 11px/18px system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      letter-spacing: 0.03em;
      text-rendering: optimizeLegibility;
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.6);
      pointer-events: none;
    }

    .exif-strip[hidden] { display: none; }

    .exif-strip-fields {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
    }

    .exif-row {
      display: flex;
      align-items: center;
      gap: 6px;
      height: 18px;
      min-width: 0;
    }

    .exif-row.is-truncated { pointer-events: auto; }

    .exif-row > span {
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Pure vector, whole-pixel box: 18px at viewBox 24 makes stroke-width 2
       a crisp 1.5px line. No filter anywhere — the dark halo is a wider
       duplicate stroke drawn underneath (.exif-ico-halo). */
    .exif-ico {
      flex: none;
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      shape-rendering: geometricPrecision;
      overflow: visible;
    }

    .exif-ico-halo {
      stroke: rgba(0, 0, 0, 0.55);
      stroke-width: 3.6;
    }

    /* Compact single line when the stack could collide: narrow viewers and
       portrait side-by-side. Camera + lens drops out on narrow viewers; portrait
       side-by-side keeps it as a second line. */
    @media (max-width: 720px) {
      .exif-strip-fields { flex-direction: row; flex-wrap: nowrap; gap: 10px; }
      .exif-row[data-key="camera"] { display: none; }
    }

    .image-viewer.portrait-mode.side-by-side-mode .exif-strip-fields { flex-direction: row; flex-wrap: wrap; gap: 0 10px; }
    .image-viewer.portrait-mode.side-by-side-mode .exif-row[data-key="camera"] { flex-basis: 100%; }

    /* Dark-glass upload chip; frosted panel when expanded. Both sit on the
       photo, so they stay literal rather than token-driven. */
    .viewer-upload-controls > .collapsible-header button,
    .viewer-upload-controls .viewer-upload-toggle {
      background: rgba(17, 24, 39, 0.8);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.25);
      color: #ffffff;
    }

    .viewer-upload-controls > .collapsible-header button:hover,
    .viewer-upload-controls .viewer-upload-toggle:hover {
      background: rgba(17, 24, 39, 0.92);
      border-color: var(--accent-fill);
      color: #ffffff;
    }

    /* ── Score ring chip (App Workspace.dc.html) — the only entry to the
       Scores overlay; replaced the standalone Scores button. ─────────────── */
    .top-toolbar .score-ring-chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 4px 10px 4px 5px;
      background: var(--bg-card);
      border: 1px solid var(--border);
    }

    .top-toolbar .score-ring-chip:hover:not(:disabled) {
      border-color: var(--accent-fill);
      background: var(--bg-secondary);
    }

    .score-ring {
      position: relative;
      width: 28px;
      height: 28px;
      flex: none;
      display: inline-block;
    }

    .score-ring svg {
      width: 28px;
      height: 28px;
      display: block;
      transform: rotate(-90deg);
    }

    .score-ring-track { stroke: var(--border); }
    .score-ring-arc   { stroke: var(--accent-fill); transition: stroke-dasharray 0.3s ease; }

    .score-ring-value {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 9px;
      font-weight: 700;
      color: var(--text-heading);
    }

    .score-ring-text {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      line-height: 1.2;
    }

    .score-ring-verdict {
      font-size: 11.5px;
      font-weight: 650;
      color: var(--text-heading);
    }

    .score-ring-sub {
      font-size: 9.5px;
      color: var(--text-secondary);
    }

    /* OUTLINE hover contract. These are element-selector buttons, so they were
       missed by the class-based pass — they are the most-used controls on
       app.html and had no light-mode :hover rule at all. */
    .top-toolbar button:hover:not(.active),
    .top-toolbar .back-link:hover,
    .toolstrip button:hover:not(.active) {
      background: var(--bg-secondary);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    .scores-overlay-header .scores-header-btn {
      display: inline-flex;
      align-items: center;
      border: 1px solid var(--border-input);
      border-radius: 6px;
      background: transparent;
      color: var(--text-heading);
      font-size: .875rem;
      font-weight: 600;
      padding: 8px 12px;
      text-decoration: none;
      line-height: 1;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    .scores-overlay-header .scores-header-btn:hover {
      background: var(--bg-secondary);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    /* Active state for top nav buttons */
    .top-toolbar button.active {
      background: var(--border);
      border-bottom: 2px solid var(--text-heading);
      border-radius: 0 0 4px 4px;
    }

    /* App Mode button engaged state */
    body.app-mode-active #app-mode-toggle {
      background: var(--accent-fill-strong);
      color: var(--accent-on);
      border-color: var(--accent-fill-strong);
    }

    body.app-mode-active #a22-bw-pill,
    body.app-mode-active #a22-bw-panel,
    body.app-mode-active #a22-info-pop { display: none; }

    /* Overlay Rail - second column of .viewer-column grid, beside the image. */
    .overlay-rail {
      grid-column: 2;
      grid-row: 1;
      align-self: stretch;
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;
      align-items: center;
      gap: clamp(2px, 1vh, 8px);
      pointer-events: all;
      overflow: visible;
      padding-top: 8px;
    }

    /* Buttons scale off available viewport height so an extra button (e.g.
       Shot Card appearing) shrinks the whole row proportionally instead of
       overflowing or squashing gaps to zero — never distorted, still round
       because width/height clamp together. */
    .overlay-rail button {
      width: clamp(28px, 6vh, 52px);
      height: clamp(28px, 6vh, 52px);
      border-radius: 50%;
      background: rgba(17, 24, 39, 0.85);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: rgba(255, 255, 255, 0.9);
      font-size: 0;
      cursor: pointer;
      transition: all 0.2s ease, box-shadow 0.3s ease;
      position: relative;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      /* Without these, iOS/iPadOS Safari can paint its own rectangular
         tap-highlight/native-button chrome over a custom round control —
         ignoring border-radius — on top of (or instead of) the intended
         .active ring below. Scoped to this control only, not site-wide. */
      -webkit-appearance: none;
      appearance: none;
      -webkit-tap-highlight-color: transparent;
    }

    /* Each overlay's identity colour now drives its own active-state glow
       (below) instead of a separate left-edge bar. */
    .overlay-rail button[data-overlay="composition"] {
      --rail-accent: var(--accent-fill);
      --rail-glow: var(--accent-glow);
    }

    .overlay-rail button[data-overlay="subjects"] {
      --rail-accent: #06b6d4;
      --rail-glow: rgba(6, 182, 212, 0.4);
    }

    .overlay-rail button[data-overlay="exposure"] {
      --rail-accent: #f59e0b;
      --rail-glow: rgba(245, 158, 11, 0.4);
    }

    .overlay-rail button[data-overlay="focus"] {
      --rail-accent: #fb923c;
      --rail-glow: rgba(251, 146, 60, 0.4);
    }

    .overlay-rail button[data-overlay="clipping"] {
      --rail-accent: #ef4444;
      --rail-glow: rgba(239, 68, 68, 0.4);
    }

    .overlay-rail button[data-overlay="histogram"] {
      --rail-accent: #a855f7;
      --rail-glow: rgba(168, 85, 247, 0.4);
    }

    .overlay-rail button[data-overlay="saturation"] {
      --rail-accent: #ec4899;
      --rail-glow: rgba(236, 73, 153, 0.4);
    }

    .overlay-rail button[data-overlay="shot-card"] {
      --rail-accent: #10b981;
      --rail-glow: rgba(16, 185, 129, 0.4);
    }

    .overlay-rail button[data-overlay="guided"] {
      --rail-accent: #8b5cf6;
      --rail-glow: rgba(139, 92, 246, 0.4);
    }

    /* Item F: the shot-card toggle only exists while a link is settled —
       display:flex on the base rule would otherwise defeat [hidden]. */
    .overlay-rail button[hidden] {
      display: none;
    }

    .overlay-rail button::after {
      font-size: clamp(10px, 2vh, 16px);
      line-height: 1;
    }

    .overlay-rail button[data-overlay="composition"]::after {
      content: '⊞';
    }

    .overlay-rail button[data-overlay="subjects"]::after {
      content: '◉';
    }

    .overlay-rail button[data-overlay="exposure"]::after {
      content: '☀';
    }

    .overlay-rail button[data-overlay="focus"]::after {
      content: '◎';
    }

    .overlay-rail button[data-overlay="clipping"]::after {
      content: '⚠';
    }

    .overlay-rail button[data-overlay="histogram"]::after {
      content: '▥';
    }

    .overlay-rail button[data-overlay="saturation"]::after {
      content: '◆';
    }

    .overlay-rail button[data-overlay="shot-card"]::after {
      content: '▣';
    }

    .overlay-rail button:hover {
      background: rgba(31, 41, 55, 0.95);
      border-color: var(--accent-fill);
      transform: scale(1.05);
    }

    /* Active: the ring itself carries the overlay's own identity colour
       (--rail-accent/--rail-glow, set per data-overlay above) instead of a
       shared amber ring plus a separate coloured edge bar. */
    .overlay-rail button.active {
      background: rgba(17, 24, 39, 0.95);
      border-color: var(--rail-accent, var(--accent-fill));
      box-shadow: 0 0 0 3px var(--rail-glow, var(--accent-glow)), 0 0 12px var(--rail-glow, var(--accent-glow));
    }

    /* Physical-iPad-only defect: under App Mode's `position: fixed` body —
       a GPU layer-promotion trigger — this button's existing backdrop-filter
       plus the .active box-shadow ring can get clipped square by WebKit's
       compositor instead of following border-radius (a documented Safari
       backdrop-filter/border-radius bug). Confirmed on-device that Normal
       App view (no position:fixed ancestor) is unaffected, so this is scoped
       to touch/no-hover devices, App Mode only, and only the active state —
       -webkit-mask-image forces the composited layer to re-derive its clip
       from the button's own circular shape. The mask itself is a fully
       opaque disc matching the existing border-radius:50%, so it has no
       visible effect beyond fixing the clip; it changes no color, size, or
       ring geometry. */
    @media (hover: none) and (pointer: coarse) {
      body.app-mode-active .overlay-rail button.active {
        -webkit-mask-image: -webkit-radial-gradient(white, white);
      }
    }

    /* Button/gap sizing is now fluid (clamp() above) and shrinks continuously
       with the row's available height, so no stepped override is needed here
       — this is only the last-resort safety net if even the clamp floor
       (28px buttons) can't fit every visible button at once. */
    @media (max-height: 600px) {
      .overlay-rail {
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        scrollbar-width: none; /* Firefox */
      }
      .overlay-rail::-webkit-scrollbar {
        display: none; /* Chrome/Safari — hidden scrollbar */
      }
    }

    /* Floating overlay legend panels */
    .overlay-legend {
      position: absolute;
      left: 8px;
      bottom: 8px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 7px 8px;
      pointer-events: none;
      z-index: 5;
      font: 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      pointer-events: none;
      transition: opacity 200ms ease-in-out;
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .overlay-legend.overlay-legend-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .overlay-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .overlay-legend-row:last-child {
      margin-bottom: 0;
    }

    .overlay-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .overlay-legend-row span {
      color: var(--a22-glass-text);
      white-space: nowrap;
    }


    .main-layout {
      min-height: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 320px; /* viewer-column | sidebar */
      gap: 16px;
    }

    .viewer-column {
      min-width: 0;
      min-height: 0;
      align-self: start; /* don't stretch to sidebar height in normal mode */
      display: grid;
      grid-template-columns: 1fr 60px;        /* image-viewer | rail */
      grid-template-rows: minmax(0, 1fr) auto; /* image-viewer can shrink; coaching bar always visible */
      gap: 16px;
    }

    .image-viewer {
      min-width: 0;
      min-height: 0;
      width: 100%;
      max-width: min(90vw, calc(72vh * 1.6));
      aspect-ratio: 16 / 10;
      max-height: 72vh;
      border: 1.5px solid var(--border-input);
      border-radius: 10px;
      background: var(--bg-secondary);
      margin: 0;
      padding: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      justify-self: center;
      overflow: hidden;
      position: relative;
    }

    .image-viewer.portrait-mode {
      max-width: 60vw;
      max-height: 72vh;
    }

    .image-viewer.landscape-mode {
      max-width: min(90vw, calc(72vh * 1.6));
      max-height: 72vh;
    }

    .hero-media {
      width: 100%;
      max-height: 100%;
      aspect-ratio: 16 / 9;
      border: 1px solid var(--border);
      border-radius: 8px;
      display: block;
      background: var(--border);
    }

    .hero-empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-align: center;
      padding: 24px;
      background: var(--panel);
      color: var(--muted);
    }

    .hero-empty-icon {
      width: 48px;
      height: 48px;
      color: var(--muted);
    }

    .hero-empty-title {
      margin: 0;
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
    }

    .hero-empty-sub {
      margin: 0;
      font-size: 13px;
      color: var(--muted);
    }

    .image-preview-stage {
      display: none;
      width: 100%;
      height: 100%;
      position: relative;
      align-items: center;
      justify-content: center;
      overflow: visible; /* Ensure pulse glow is not clipped */
    }

    .image-preview {
      display: none;
      object-fit: contain;
      object-position: center;
      max-width: 100%;
      max-height: 100%;
      width: auto;
      height: auto;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--border);
    }

    .raw-preview-placeholder {
      display: none;
      max-width: 100%;
      padding: 12px 16px;
      border: 1px dashed var(--border);
      border-radius: 8px;
      background: var(--bg-card);
      color: var(--muted);
      font-size: 13px;
      text-align: center;
      z-index: 1;
    }

    .image-viewer.has-preview .raw-preview-placeholder.is-active {
      display: block;
    }

    .image-viewer.has-preview .hero-media {
      display: none;
    }

    .image-viewer.has-preview .image-preview-stage {
      display: flex;
    }

    .image-viewer.has-preview .image-preview.is-loaded {
      display: block;
    }

    .slider-mask {
      display: none;
      overflow: hidden;
    }

    .image-viewer.has-preview .slider-mask.has-edited {
      display: block;
    }

    .image-viewer.overlay-mode .image-preview-raw.is-loaded,
    .image-viewer.overlay-mode .slider-mask.has-edited .image-preview-edited.is-loaded {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
      margin: 0;
    }

    .image-viewer.overlay-mode .image-preview-raw {
      z-index: 1;
    }

    .image-viewer.overlay-mode .slider-mask.has-edited {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      z-index: 2;
    }

    .image-viewer.overlay-mode .image-preview-edited {
      opacity: 1;
    }

    .image-viewer.side-by-side-mode .image-preview-stage {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .image-viewer.side-by-side-mode .image-preview-raw.is-loaded,
    .image-viewer.side-by-side-mode .slider-mask.has-edited {
      width: 50%;
      height: 100%;
      max-width: 50%;
      max-height: 100%;
    }

    .image-viewer.side-by-side-mode .slider-mask.has-edited .image-preview-edited.is-loaded {
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
    }

    /* Portrait side-by-side —
       consolidated rules
       replaces all previous
       portrait additions */
    .image-viewer.portrait-mode.side-by-side-mode .image-preview-stage {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0;
      overflow: hidden;
    }

    .image-viewer.portrait-mode.side-by-side-mode .image-preview-raw.is-loaded,
    .image-viewer.portrait-mode.side-by-side-mode .slider-mask.has-edited {
      flex: 1 1 0;
      width: 50%;
      max-width: 50%;
      min-width: 0;
      height: 100%;
      max-height: 100%;
      overflow: hidden;
      box-sizing: border-box;
      border: 1px solid rgba(255, 255, 255, 0.15);
    }

    .image-viewer.portrait-mode.side-by-side-mode .image-preview-raw.is-loaded {
      object-fit: contain;
    }

    .image-viewer.portrait-mode.side-by-side-mode .slider-mask.has-edited .image-preview-edited.is-loaded {
      object-fit: contain;
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
    }

    .image-viewer.portrait-mode.side-by-side-mode #analysis-overlay,
    .image-viewer.portrait-mode.side-by-side-mode #composition-concept-overlay {
      display: block;
    }

    /* Portrait side-by-side: center legends and pills across full viewer width */
    .image-viewer.side-by-side-mode .overlay-legend {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .comp-pill {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .comp-legend-panel {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .subjects-legend-panel {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .focus-legend-panel {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .clipping-legend-panel {
      left: 50%;
      transform: translateX(-50%);
    }

    .image-viewer.side-by-side-mode .histogram-legend-panel {
      left: 50%;
      transform: translateX(-50%);
    }

    /* end portrait side-by-side consolidated block */

    .slider-container {
      display: none;
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }

    .slider-container.is-active {
      display: block;
    }

    .slider-handle {
      position: absolute;
      left: 50%;
      top: 0;
      bottom: 0;
      width: 2px;
      transform: translateX(-50%);
      background: rgba(255, 255, 255, 0.95);
      box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.28);
      cursor: col-resize;
      pointer-events: auto;
      touch-action: none;
    }

    .slider-handle:active {
      cursor: col-resize;
    }

    .slider-grip {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 20px;
      height: 40px;
      background: rgba(255, 255, 255, 0.14);
      backdrop-filter: blur(10px) saturate(160%);
      -webkit-backdrop-filter: blur(10px) saturate(160%);
      border: 1px solid rgba(255, 255, 255, 0.28);
      border-radius: 10px;
      box-shadow: 0 1px 8px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
      pointer-events: none;
      transition: background 0.15s ease, box-shadow 0.15s ease;
    }

    .slider-grip::before {
      content: '';
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: calc(50% - 5px);
      width: 8px;
      height: 1.5px;
      background: rgba(255, 255, 255, 0.65);
      border-radius: 1px;
      box-shadow: 0 5px 0 rgba(255, 255, 255, 0.65), 0 10px 0 rgba(255, 255, 255, 0.65);
    }

    .slider-handle:hover .slider-grip {
      background: rgba(255, 255, 255, 0.26);
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }

    .viewer-upload-controls {
      position: absolute;
      left: 20px;
      top: 20px;
      z-index: 2;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 6px;
    }

    .viewer-upload-controls .collapsible-content {
      width: min(460px, calc(100% - 40px));
      overflow-y: auto;
      overflow-x: visible;
      /* Was calc(100vh - 420px), which pushed the commit button below the fold.
         Reserve only enough for the toolbar/margins so the panel grows to fit
         its content and only scrolls on short viewports. */
      max-height: calc(100vh - 140px);
      min-height: 0;
      /* frosted panel per the mock — warm glass, not stark white */
      background: var(--bg-glass-strong);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border-radius: 10px;
      padding: 12px;
      box-shadow: var(--shadow-md);
    }

    /* Keep the commit action reachable even when the panel does scroll: pin it
       to the bottom of the scroll container as a footer. :not([hidden]) so it
       only applies once an upload is staged (it's hidden by default and after a
       successful commit). */
    .viewer-upload-controls #commit-to-library-btn:not([hidden]) {
      position: sticky;
      bottom: 0;
      display: block;
      width: 100%;
      margin-top: 10px;
      background: var(--bg-card);
      box-shadow: 0 -8px 12px -6px rgba(0, 0, 0, 0.18);
      z-index: 10;
    }

    /* The Shot Card panel (#shot-card-reveal) lives inside this container
       but styles its own buttons (.reveal-*, .link-status-*). The :where()
       exclusion carries zero specificity, so this rule keeps its (0,1,1)
       weight for every upload-panel button and simply never reaches a
       button inside .reveal-card / .link-status-badge (2026-09-04). */
    .viewer-upload-controls button:not(:where(.reveal-card, .link-status-badge) *) {
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--bg-card);
      color: var(--text);
      font-size: 0.8rem;
      padding: 6px 12px;
      cursor: pointer;
      z-index: 2;
    }

    .viewer-upload-controls button:disabled:not(:where(.reveal-card, .link-status-badge) *) {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .viewer-upload-section {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--bg-card);
      padding: 12px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }

    /* Inside the upload controls, inner fieldsets blend into the outer card */
    .viewer-upload-controls .viewer-upload-section {
      border: 1px solid rgba(0, 0, 0, 0.07);
      border-radius: 8px;
      background: rgba(248, 249, 250, 0.6);
      padding: 8px 10px;
      box-shadow: none;
      gap: 6px;
    }

    .pillar-summary {
      font-size: 0.8rem;
      color: var(--muted);
      font-style: normal;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      margin: 0 0 8px;
      pointer-events: none;
      user-select: none;
    }

    .pillar-summary.no-data {
      font-style: italic;
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .temperature-unit-toggle {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 4px;
      font-size: 12px;
      color: var(--muted);
    }

    .temperature-unit-toggle label {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
    }

    .gear-remove-btn {
      border: 1px solid transparent;
      background: transparent;
      color: var(--color-error);
      border-radius: 6px;
      padding: 4px 8px;
      font-size: .875rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .gear-remove-btn:hover {
      background: var(--bg-secondary);
      border-color: var(--color-error);
      color: var(--color-error);
    }

    .gear-save-status {
      font-size: 13px;
      color: var(--muted);
    }

    .viewer-upload-controls details > summary {
      cursor: pointer;
      font-size: 13px;
      color: var(--text);
      margin-bottom: 6px;
    }

    .section-metadata-panel {
      width: 100%;
      border-top: 1px solid var(--border);
      padding-top: 8px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
    }

    .section-metadata-panel details + details {
      margin-top: 6px;
    }

    .section-metadata-panel ul {
      margin: 6px 0 0;
      padding-left: 18px;
    }

    .section-metadata-panel li + li {
      margin-top: 4px;
    }

    /* FIX 1: Hide developer/debug elements from upload panel */
    #view-raw-metadata-btn,
    #view-edited-metadata-btn,
    #toggle-metadata-diff-btn,
    #metadata-diff-section,
    #raw-validation,
    #edited-validation {
      display: none !important;
    }

    /* Commit-success banner: shown only after a successful Commit to Library.
       Layout lives here (not inline) so the `hidden` attribute reliably hides it. */
    #commit-success-message {
      display: flex;
      flex-direction: column;
      gap: 6px;
      align-items: flex-start;
    }

    #commit-success-message[hidden] {
      display: none;
    }

    /* FIX 2: Close upload panel link hover */
    #close-upload-panel-link:hover {
      text-decoration: underline;
    }

    /* Upload panel fieldset legend headings */
    #raw-subsection > legend,
    #edited-subsection > legend {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-primary);
      padding: 0 4px;
    }

    /* Upload toggle button: compact card when panel is collapsed */
    #upload-image-btn:not(.upload-btn-compact) {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 8px;
      padding: 8px 14px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }

    /* FIX 3: Compact upload button state */
    #upload-image-btn.upload-btn-compact {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      /* floats over the photo — needs its own chrome, not the transparent
         page-surface ICON rest, or it disappears against the image. */
      background: var(--bg-glass-strong);
      border: 1px solid var(--border-input);
      color: var(--text-secondary);
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 0.3s ease, opacity 0.3s ease, border-color 0.3s ease, color 0.3s ease;
      font-size: 0;
      opacity: 0.45;
    }

    #upload-image-btn.upload-btn-compact:hover {
      background: var(--bg-card);
      border-color: var(--accent-fill);
      color: var(--text-primary);
      opacity: 1;
    }

    #upload-image-btn.upload-btn-compact ~ .info-pill,
    #upload-image-btn.upload-btn-compact ~ .info-pop {
      display: none;
    }

    #upload-image-btn.upload-btn-compact::before {
      content: '';
      display: block;
      width: 0;
      height: 0;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 10px solid var(--text);
      transform: rotate(0deg);
    }

    /* Upload confirmation: button turns green with a check once its file is in.
       Buttons stay clickable so additional files can still be uploaded. */
    button.upload-btn-done {
      background: var(--accent-fill);
      border-color: var(--accent-fill);
      color: var(--accent-on);
    }

    button.upload-btn-done:hover:not(:disabled) {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }

    .toolstrip {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      padding: 12px;
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .toolstrip-bottom {
      display: none;
    }

    .mobile-analysis-toggle,
    .mobile-toolstrip {
      display: none;
    }

    .sidebar {
      min-height: 0;
      border: 1.5px solid var(--border-input);
      border-radius: 10px;
      background: var(--bg-secondary);
      max-height: calc(100vh - 180px);
      padding-top: 6px;
      padding-right: 10px;
      padding-bottom: 10px;
      padding-left: 10px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    
    .sidebar .mobile-bottom-sheet {
      display: flex;
      flex-direction: column;
      min-height: 0;
      flex: 1;
    }
    
    .coaching-panel-wrapper {
  flex: 3 1 0;
  display: flex;
  flex-direction: column;
  max-height: none;
  min-height: 0;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--bg-card);
  overflow: hidden;
}

    .sidebar section {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-card);
      padding: 12px;
      overflow: hidden;
    }

    .sidebar section + section {
      margin-top: 12px;
    }

    .sidebar h2 {
      margin: 0 0 8px;
      font-size: 16px;
    }

    .sidebar p {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.45;
    }

    /* overflow:hidden zeroes the dock's automatic min-height, so its floor is
       spelled out: fixed chrome (padding+border 22, header 40, compose 60)
       plus the smallest usable message area. */
    .coach-chat-dock {
      --companion-msgs-min: 96px;
      display: flex;
      flex-direction: column;
      flex: 2 1 0;
      min-height: calc(var(--companion-msgs-min) + 122px);
      border: 1px solid var(--border-input);
      border-radius: 8px;
      background: var(--bg-card);
      padding: 10px;
      overflow: hidden;
    }

    #coaching-output {
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 10px;
      margin-top: 8px;
      margin-bottom: 0;
      overflow-y: auto;
      background: var(--bg-card);
      flex: 1 1 auto;
      min-height: 0;
    }

    .coach-chat-messages {
      flex: 1 1 0;
      overflow-y: auto;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: var(--companion-msgs-min);
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--bg-card);
    }

    .coach-chat-message {
      margin: 0;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 13px;
      line-height: 1.45;
      max-width: 85%;
    }

    .coach-chat-message.user {
      background: var(--accent-fill-strong);
      color: var(--accent-on);
      border-color: var(--accent-fill-strong);
      align-self: flex-end;
      margin-left: auto;
    }

    .coach-chat-message.assistant {
      background: var(--bg);
      color: var(--muted);
      border-color: var(--border);
      align-self: flex-start;
      margin-right: auto;
    }

    .coach-chat-message.typing {
      font-style: italic;
      opacity: 0.7;
    }

    /* Markdown rendered inside assistant chat messages — compact spacing */
    .coach-chat-message.assistant {
      line-height: 1.35;
    }

    .coach-chat-message.assistant p {
      margin: 0 0 4px;
    }

    .coach-chat-message.assistant ul {
      margin: 0;
      padding-left: 18px;
    }

    .coach-chat-message.assistant li {
      margin-bottom: 4px;
      line-height: 1.35;
    }

    .coach-chat-message.assistant li p {
      margin: 0;
    }

    .coach-chat-message.assistant strong {
      font-weight: 600;
    }

    .coach-chat-message.assistant h3,
    .coach-chat-message.assistant h4 {
      margin: 8px 0 4px;
      font-size: 13px;
      font-weight: 600;
    }

    /* No top margin on the first element, no bottom margin on the last */
    .coach-chat-message.assistant > :first-child {
      margin-top: 0;
    }

    .coach-chat-message.assistant > :last-child {
      margin-bottom: 0;
    }

    .coach-chat-compose {
      flex: none;
      display: flex;
      gap: 8px;
      padding: 8px;
      margin-top: 8px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--bg-card);
    }

    .coach-chat-input {
      flex: 1;
      min-width: 0;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 8px 10px;
      font: inherit;
      font-size: 13px;
      color: var(--text);
      background: var(--bg);
    }

    .coach-chat-send {
      border: 1px solid var(--accent-fill);
      border-radius: 6px;
      padding: 8px 16px;
      background: var(--accent-fill);
      color: var(--accent-on);
      font-size: .875rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .coach-chat-send:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }

    .coach-chat-send:disabled {
      background: var(--bg-subtle);
      border-color: var(--border);
      color: var(--text-secondary);
      cursor: not-allowed;
    }

    .chat-header-container {
      flex: none;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
    }

    .chat-header-container h2 {
      margin: 0;
      flex: 1;
    }

    /* ── Expanded Chat Panel — Fixed Floating Bottom-Right ──────────────── */
    .chat-expanded-panel {
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 480px;
      max-height: 50vh;
      background: var(--bg-card);
      border: 1.5px solid var(--border-input);
      border-radius: 12px;
      box-shadow: var(--shadow-md);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transform-origin: bottom right;
      transition: transform 0.3s ease, opacity 0.3s ease;
    }

    /* Small screens: edge-to-edge. */
    @media (max-width: 600px) {
      .chat-expanded-panel {
        left: 12px;
        right: 12px;
        width: auto;
      }
    }

    .chat-expanded-panel.hidden {
      display: none;
    }

    .chat-expanded-panel:not(.hidden) {
      animation: chatExpandIn 0.3s ease;
    }

    @keyframes chatExpandIn {
      from {
        transform: scale(0);
        opacity: 0;
      }
      to {
        transform: scale(1);
        opacity: 1;
      }
    }

    .chat-expanded-panel.chat-closing {
      animation: chatExpandOut 0.3s ease;
    }

    @keyframes chatExpandOut {
      from {
        transform: scale(1);
        opacity: 1;
      }
      to {
        transform: scale(0);
        opacity: 0;
      }
    }

    .chat-expanded-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 14px 16px;
      background: var(--bg-card);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .chat-expanded-header h2 {
      margin: 0;
      flex: 1;
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
    }


    .chat-expanded-messages {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      background: var(--bg-secondary);
      min-height: 0;
    }

    .chat-expanded-compose {
      display: flex;
      gap: 8px;
      padding: 12px;
      background: var(--bg-card);
      border-top: 1px solid var(--border);
      flex-shrink: 0;
    }

    .metadata-list {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
    }

    .metadata-list li + li {
      margin-top: 6px;
    }

    /* Coaching Focus Bar */
    .coaching-focus-bar {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 10px 12px;
      background: var(--panel);
      border: 2px solid var(--border-input);
      border-radius: 10px;
      grid-column: 1 / -1; /* span image-viewer + rail columns */
      width: 100%;
      max-width: 90vw;
      justify-self: center;
    }

    .coaching-focus-header {
      display: flex;
      align-items: center;
      gap: 6px;
      justify-content: space-between;
      width: 100%;
    }

    .coaching-focus-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.5px;
      color: var(--text-secondary);
      text-transform: uppercase;
    }

    .coaching-focus-info {
      color: var(--text-secondary);
      font-size: 14px;
      cursor: help;
      user-select: none;
    }

    .genre-mood-pills {
      display: flex;
      gap: 8px;
      align-items: center;
      margin-left: auto;
    }

    .genre-mood-pill {
      background: var(--bg-subtle);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 3px 10px;
      font-size: 0.75rem;
      display: inline-flex;
      align-items: center;
      cursor: help;
    }

    .genre-mood-pill-label {
      color: var(--text-secondary);
    }

    .genre-mood-pill-value {
      color: var(--text-primary);
    }

    .coaching-focus-rows {
      display: flex;
      flex-direction: column;
      gap: 5px;
      overflow: visible; /* Allow pulse glow to be visible */
    }

    .coaching-focus-row {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 5px;
      overflow: visible; /* Allow pulse glow to be visible */
    }

    .coaching-focus-btn {
      padding: 5px 13px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: transparent;
      color: var(--text);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
      border-bottom-width: 2px;
      border-bottom-style: solid;
      white-space: nowrap;
    }

    /* Accent colors for bottom border */
    .coaching-focus-btn[data-accent="neutral"] { border-bottom-color: var(--chip-neutral); }
    .coaching-focus-btn[data-accent="blue"] { border-bottom-color: var(--chip-blue); }
    .coaching-focus-btn[data-accent="green"] { border-bottom-color: var(--accent-fill); }
    .coaching-focus-btn[data-accent="teal"] { border-bottom-color: var(--chip-teal); }
    .coaching-focus-btn[data-accent="emerald"] { border-bottom-color: var(--accent-fill); }
    .coaching-focus-btn[data-accent="cyan"] { border-bottom-color: var(--chip-cyan); }
    .coaching-focus-btn[data-accent="amber"] { border-bottom-color: var(--chip-amber); }
    .coaching-focus-btn[data-accent="orange"] { border-bottom-color: var(--chip-orange); }
    .coaching-focus-btn[data-accent="red"] { border-bottom-color: var(--chip-red); }
    .coaching-focus-btn[data-accent="purple"] { border-bottom-color: var(--chip-purple); }
    .coaching-focus-btn[data-accent="pink"] { border-bottom-color: var(--chip-pink); }
    .coaching-focus-btn[data-accent="gold"] { border-bottom-color: var(--chip-gold); }

    /* Hover state */
    .coaching-focus-btn:hover {
      background: var(--bg-glass);
      border-top-color: var(--accent-fill);
      border-left-color: var(--accent-fill);
      border-right-color: var(--accent-fill);
    }

    /* Active/selected state */
    .coaching-focus-btn[aria-pressed="true"] {
      /* amber tint per the mock; the per-data-accent stripe below still
         carries the colour coding via border-top-color */
      background: rgba(var(--accent-fill-rgb), 0.10);
      border-color: var(--accent-fill);
      color: var(--text);
      border-bottom-width: 1px;
      border-top-width: 2px;
      border-top-style: solid;
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="neutral"] {
      border-top-color: var(--chip-neutral);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="blue"] {
      border-top-color: var(--chip-blue);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="green"] {
      border-top-color: var(--accent-fill);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="teal"] {
      border-top-color: var(--chip-teal);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="emerald"] {
      border-top-color: var(--accent-fill);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="cyan"] {
      border-top-color: var(--chip-cyan);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="amber"] {
      border-top-color: var(--chip-amber);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="orange"] {
      border-top-color: var(--chip-orange);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="red"] {
      border-top-color: var(--chip-red);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="purple"] {
      border-top-color: var(--chip-purple);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="pink"] {
      border-top-color: var(--chip-pink);
    }

    .coaching-focus-btn[aria-pressed="true"][data-accent="gold"] {
      border-top-color: var(--chip-gold);
    }

    /* Expanded Coaching Panel Overlay */
    .coaching-expanded-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 40%;
      bottom: 0;
      background: rgba(245, 247, 250, 0.75);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px); /* Safari support */
      z-index: 9998;
      display: flex;
      align-items: flex-start;
      justify-content: flex-start;
      padding: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
    }
    
    /* Fallback for browsers that don't support backdrop-filter */
    @supports not (backdrop-filter: blur(8px)) {
      .coaching-expanded-backdrop {
        background: rgba(255, 255, 255, 0.92);
      }
    }

    .coaching-expanded-backdrop.hidden {
      display: none;
    }

    .coaching-expanded-panel {
      background: transparent;
      border-radius: 0;
      box-shadow: none;
      width: 100%;
      height: 100vh;
      display: flex;
      flex-direction: column;
      transform: translateX(0);
      transition: transform 0.3s ease;
      pointer-events: auto;
      padding: var(--space-lg);
      gap: var(--space-md);
      position: relative;
    }

    .coaching-expanded-backdrop:not(.hidden) .coaching-expanded-panel {
      animation: slideInFromLeft 0.3s ease;
    }

    @keyframes slideInFromLeft {
      from {
        transform: translateX(-100%);
      }
      to {
        transform: translateX(0);
      }
    }
    
    /* Closing animation: reverse of slideInFromLeft */
    @keyframes slideOutToLeft {
      from {
        transform: translateX(0);
      }
      to {
        transform: translateX(-100%);
      }
    }
    
    .coaching-expanded-backdrop.coaching-overlay-closing {
      opacity: 0;
    }
    
    .coaching-expanded-backdrop.coaching-overlay-closing .coaching-expanded-panel {
      animation: slideOutToLeft 0.3s ease;
    }

    /* ── Scores Overlay Panel (Slide-in from Right) ──────────────────────── */
    .scores-overlay-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      /* warm scrim per App Workspace.dc.html, not neutral black */
      background: rgba(20, 16, 10, 0.5);
      z-index: 9998;
      display: flex;
      align-items: flex-start;
      justify-content: flex-end;
      padding: 0;
      transition: opacity 0.3s ease;
      pointer-events: auto;
    }

    .scores-overlay-backdrop.hidden {
      display: none;
    }

    .scores-overlay-panel {
      background: var(--bg-card);
      position: fixed;
      top: 0;
      right: 0;
      width: 560px;
      max-width: 92vw;
      height: auto;
      max-height: 82vh;
      display: flex;
      flex-direction: column;
      box-shadow: -4px 4px 16px var(--shadow);
      border-left: 1.5px solid var(--border-input);
      border-radius: 0 0 0 8px;
      padding: 20px;
      overflow-y: auto;
      transform: translateX(100%);
      transition: transform 0.3s ease;
      pointer-events: auto;
      z-index: 9999;
    }

    .scores-overlay-backdrop:not(.hidden) .scores-overlay-panel {
      transform: translateX(0);
      animation: slideInFromRight 0.3s ease;
    }

    @keyframes slideInFromRight {
      from {
        transform: translateX(100%);
      }
      to {
        transform: translateX(0);
      }
    }
    
    @keyframes slideOutToRight {
      from {
        transform: translateX(0);
      }
      to {
        transform: translateX(100%);
      }
    }
    
    .scores-overlay-backdrop.scores-overlay-closing .scores-overlay-panel {
      transform: translateX(100%);
      animation: slideOutToRight 0.3s ease;
    }

    .scores-overlay-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0 var(--space-md) 0;
      border-bottom: 1px solid var(--border);
      background: var(--bg-card);
      margin-bottom: 0;
    }


    .scores-overlay-content {
      flex: 1;
      overflow-y: auto;
      /* the mock gives the content block a single 10px rhythm and its own
         top padding; the header no longer adds a second margin below it */
      padding: var(--space-md) 0 0 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
      color: var(--text);
    }

    @keyframes slideIn {
      from {
        transform: scale(0.9);
        opacity: 0;
      }
      to {
        transform: scale(1);
        opacity: 1;
      }
    }
    
    /* Closing animation: reverse of slideIn (for responsive centered modal) */
    @keyframes slideOut {
      from {
        transform: scale(1);
        opacity: 1;
      }
      to {
        transform: scale(0.9);
        opacity: 0;
      }
    }

    .coaching-expanded-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      background: var(--bg-card);
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
    }

    .coaching-expanded-header h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: var(--text);
    }


    .coaching-expanded-content {
      flex: 1;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 16px;
      min-height: 0;
      padding: 24px;
    }
    
    /* Make coaching focus bar solid white in expanded view */
    .coaching-focus-bar-expanded {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
    }

    .coaching-output-expanded {
      padding: 16px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
      max-height: 62vh;
      overflow-y: auto;
      white-space: pre-wrap;
      font-size: 14px;
      line-height: 1.6;
    }

    .coaching-focus-bar-expanded {
      margin-bottom: 0;
    }

    /* Coaching expand button (now in coaching panel header) */
    #coaching-expand-btn {
      border: 1px solid var(--border);
      border-radius: 4px;
      background: transparent;
      color: var(--text);
      padding: 4px 6px;
      cursor: pointer;
      transition: background-color 0.2s, border-color 0.2s;
      line-height: 1;
      flex-shrink: 0;
    }
    .coaching-expand-btn-inline {
      border: 1px solid transparent;
      border-radius: 4px;
      background: transparent;
      color: var(--text-secondary);
      font-size: 1rem;
      padding: 4px 6px;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
      line-height: 1;
      flex-shrink: 0;
    }

    #coaching-expand-btn:hover {
      background: var(--panel);
      border-color: var(--muted);
    }
    .coaching-expand-btn-inline:hover {
      background: var(--bg-secondary);
      border-color: var(--accent-fill);
      color: var(--text-primary);
    }

    #coaching-expand-btn svg,
    .coaching-expand-btn-inline svg {
      display: inline-block;
      vertical-align: middle;
    }
    
    /* Companion shutter logo as info trigger + viewport-anchored pop */
    .companion-header-avatar {
      cursor: pointer;
    }

    .companion-info-pop {
      position: fixed;
      z-index: 10100;
      max-width: 280px;
      padding: 10px 13px;
      border-radius: 8px;
      background: var(--bg-card, #fff);
      border: 1px solid var(--border, #E2E8F0);
      box-shadow: 0 4px 16px rgba(0,0,0,0.12);
      font-size: 12.5px;
      line-height: 1.55;
      color: var(--text, #374151);
      pointer-events: none;
    }

    /* Coaching header container */
    .coaching-header {
      margin-top: -8px;
      margin-bottom: 4px;
    }
    
    .coaching-header h2 {
      margin: 0;
    }

    /* Re-run Coach Review controls: expanded overlay, stale banner */
    #rerun-coach-review-btn,
    .coach-rerun-btn {
      background: none;
      border: none;
      color: var(--text-secondary);
      font-size: 0.7rem;
      cursor: pointer;
      padding: 0;
      margin-left: auto;
      transition: color 0.2s ease, text-decoration 0.2s ease;
    }

    #rerun-coach-review-btn:hover,
    .coach-rerun-btn:hover {
      color: var(--text-secondary);
      text-decoration: underline;
    }

    .coach-rerun-btn {
      font-size: 0.75rem;
      text-decoration: underline;
    }

    #rerun-coach-review-btn:disabled,
    .coach-rerun-btn:disabled {
      cursor: default;
      opacity: 0.6;
      text-decoration: none;
    }

    /* Re-run confirmation warning */
    .rerun-warning {
      background: var(--bg-subtle);
      color: var(--text-primary);
      border-left: 3px solid var(--border-input);
      border-radius: 6px;
      padding: 12px;
      font-size: 0.875rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
      max-width: 320px;
      z-index: 10;
    }

    .rerun-warning-text {
      margin: 0 0 8px 0;
      line-height: 1.4;
    }

    .rerun-warning-buttons {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }

    .rerun-warning-buttons button {
      padding: 4px 12px;
      border-radius: 4px;
      font-size: .875rem;
      font-weight: 600;
      cursor: pointer;
      border: 1px solid transparent;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .rerun-warning-buttons .btn-cancel {
      background: transparent;
      border-color: var(--border-input);
      color: var(--text-heading);
    }

    .rerun-warning-buttons .btn-cancel:hover {
      background: var(--bg-secondary);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    .rerun-warning-buttons .btn-confirm {
      background: var(--accent-fill);
      color: var(--accent-on);
      border-color: var(--accent-fill);
    }

    .rerun-warning-buttons .btn-confirm:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }

    #coaching-stale-banner {
      background: var(--bg-subtle);
      color: var(--text-primary);
      border-left: 3px solid #B8860B;
      border-radius: 4px;
      padding: 6px 10px;
      margin: 6px 0 4px;
      font-size: 12px;
      line-height: 1.4;
    }

    /* Responsive adjustments */
    /* Below 1200px: fall back to centered modal (chat covered) */
    @media (max-width: 1199px) {
      .coaching-expanded-backdrop {
        right: 0;
        align-items: center;
        justify-content: center;
        padding: 20px;
        pointer-events: auto;
      }

      .coaching-expanded-panel {
        width: 100%;
        max-width: 900px;
        height: auto;
        max-height: 85vh;
        border-radius: 12px;
      }

      .coaching-expanded-backdrop:not(.hidden) .coaching-expanded-panel {
        animation: slideIn 0.3s ease;
      }
      
      /* Responsive closing animation */
      .coaching-expanded-backdrop.coaching-overlay-closing .coaching-expanded-panel {
        animation: slideOut 0.3s ease;
      }
    }

    @media (max-width: 1199px) {
      /* Below 1200px: scores panel remains 320px on right */
      .scores-overlay-panel {
        width: 320px;
      }
    }

    @media (max-width: 820px) {
      .coaching-focus-bar {
        max-width: 100%;
      }

      .coaching-focus-row {
        grid-template-columns: repeat(3, 1fr);
      }

      .coaching-expanded-panel {
        max-width: 95vw;
        max-height: 90vh;
      }

      /* Scores Overlay - Tablet: slightly narrower */
      .scores-overlay-panel {
        width: 280px;
      }
    }

    @media (max-width: 480px) {
      .coaching-focus-bar {
        padding: 8px 10px;
      }

      .coaching-focus-btn {
        font-size: 12px;
        padding: 4px 10px;
      }

      /* Scores Overlay - Mobile: Most of screen width */
      .scores-overlay-panel {
        width: 90vw;
        max-width: 320px;
      }

      .scores-overlay-header {
        padding: 0 0 12px 0;
        margin-bottom: 12px;
      }

      .coaching-focus-row {
        gap: 4px;
      }

      .coaching-expanded-panel {
        max-width: 100vw;
        max-height: 95vh;
        border-radius: 8px;
      }

      .coaching-expanded-content {
        padding: 12px;
      }

      .coaching-focus-rows {
        gap: 4px;
      }
    }

    body.app-mode-active {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100dvh;
      overflow: hidden;
    }
    body.app-mode-active #site-header { display: none; }
    body.app-mode-active #site-footer { display: none; }
    body.app-mode-active .shared-navbar { /* handled by display:none in shared.css */ }
    body.app-mode-active .shared-footer { /* handled by display:none in shared.css */ }
    body.app-mode-active .demo-page { 
      height: 100dvh;
      padding: 0;
      margin: 0;
      max-width: none;
      gap: 0;
      overflow: hidden;
    }
    body.app-mode-active .main-layout { flex: 1; min-height: 0; }
    body.app-mode-active .viewer-column { min-height: 0; overflow: hidden; align-self: stretch; /* definite height so minmax(0,1fr) row can resolve */ }
    body.app-mode-active .sidebar { max-height: none; }
    body.app-mode-active .image-viewer {
      aspect-ratio: auto;
      min-height: 0;
      width: 100%;
      max-width: 100vw;
      max-height: calc(100vh - 40px);
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    body.app-mode-active .image-viewer.portrait-mode {
      max-width: 60vw;
      max-height: min(75vh, calc(100vh - 40px));
    }

    body.app-mode-active .image-viewer.landscape-mode {
      max-width: 90vw;
      max-height: min(75vh, calc(100vh - 40px));
    }

    body.app-mode-active .top-toolbar {
      border-radius: 0;
      border-left: 0;
      border-right: 0;
    }

    body.app-mode-active .main-layout {
      padding: 16px;
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
      overflow: hidden;
    }

    @media (width < 960px) {
      .main-layout {
        /* viewer-column (with internal rail) + sidebar stacks below */
        grid-template-columns: 1fr;
      }

      .sidebar {
        max-height: none;
        overflow: visible;
      }
      
      .sidebar .mobile-bottom-sheet {
        display: block;
        flex: none;
      }
      
      .coaching-panel-wrapper {
        max-height: none;
        min-height: 0;
        overflow: visible;
      }
      
      .coach-chat-dock {
        flex: none;
        min-height: auto;
        max-height: none;
      }
    }

    /* Optional iPad portrait refinement only (820px aligns with common iPad portrait viewport width). */
    @media (max-width: 820px) and (orientation: portrait) and (min-width: 481px) {
      .main-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
      }

      .image-viewer {
        min-height: 470px;
      }

      .sidebar {
        overflow: hidden;
      }

      .sidebar .mobile-bottom-sheet {
        display: flex;
        flex: 1;
      }

      .coaching-panel-wrapper {
        flex: 3 1 0;
        overflow: hidden;
      }

      .coach-chat-dock {
        flex: 2 1 0;
        min-height: calc(var(--companion-msgs-min) + 122px);
      }
    }

    /* Smart mobile layout: 480px targets phone portrait width and phone landscape height. */
    @media (max-width: 480px), (max-height: 480px) {
      .demo-page {
        padding: 12px;
        gap: 12px;
      }

      /* Hide overlay rail on mobile - use mobile toolstrip instead */
      .overlay-rail {
        display: none;
      }

      .main-layout {
        display: block;
        position: relative;
      }

      .viewer-column {
        display: block;
      }

      .image-viewer {
        width: 100%;
        /* Keep hero dominant on mobile while preserving room for controls below. */
        height: 52vh;
        border: 0;
        border-radius: 0;
        padding: 0;
        margin: 0;
      }

      @supports (height: 100dvh) {
        .image-viewer {
          height: 52dvh;
        }
      }

      .hero-media {
        border: 0;
        border-radius: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: cover;
      }

      .toolstrip {
        display: none;
      }

      .mobile-analysis-toggle {
        display: inline-flex;
        margin-top: 10px;
        border: 1px solid var(--border-input);
        border-radius: 999px;
        background: transparent;
        color: var(--text-heading);
        font-size: .875rem;
        font-weight: 600;
        padding: 8px 12px;
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
      }

      .mobile-analysis-toggle:hover {
        background: var(--bg-secondary);
        border-color: var(--accent-fill);
        color: var(--accent-primary);
      }

      .mobile-toolstrip {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--bg-card);
        padding: 8px;
        margin-top: 12px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .mobile-toolstrip::-webkit-scrollbar { display: none; }

      /* Match coaching-focus-btn sizing and feel */
      .mobile-toolstrip button {
        border: 1px solid var(--border);
        border-bottom-width: 2px;
        border-bottom-color: var(--border);
        border-radius: 6px;
        background: var(--bg-card);
        color: var(--text);
        font-size: 13px;
        font-weight: 500;
        padding: 5px 13px;
        min-height: 44px;
        flex: 0 0 auto;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        -webkit-appearance: none;
        appearance: none;
        -webkit-tap-highlight-color: transparent;
      }

      /* Per-overlay color indicators — 2px bottom border (inactive) */
      .mobile-toolstrip button[data-overlay="composition"] { border-bottom-color: var(--accent-fill); }
      .mobile-toolstrip button[data-overlay="subjects"]    { border-bottom-color: #06b6d4; }
      .mobile-toolstrip button[data-overlay="exposure"]    { border-bottom-color: #f59e0b; }
      .mobile-toolstrip button[data-overlay="focus"]       { border-bottom-color: #fb923c; }
      .mobile-toolstrip button[data-overlay="clipping"]    { border-bottom-color: #ef4444; }
      .mobile-toolstrip button[data-overlay="histogram"]   { border-bottom-color: #a855f7; }
      .mobile-toolstrip button[data-overlay="saturation"]  { border-bottom-color: #ec4899; }
      .mobile-toolstrip button[data-overlay="guided"]      { border-bottom-color: #8b5cf6; }

      .mobile-toolstrip button:hover {
        background: var(--border);
      }

      /* Active: accent fill + overlay color on top border for identity */
      .mobile-toolstrip button.active {
        background: var(--accent-fill);
        border-color: var(--accent-fill);
        border-bottom-width: 1px;
        border-top-width: 2px;
        color: var(--accent-on);
      }
      .mobile-toolstrip button.active[data-overlay="composition"] { border-top-color: var(--accent-fill); }
      .mobile-toolstrip button.active[data-overlay="subjects"]    { border-top-color: #06b6d4; }
      .mobile-toolstrip button.active[data-overlay="exposure"]    { border-top-color: #f59e0b; }
      .mobile-toolstrip button.active[data-overlay="focus"]       { border-top-color: #fb923c; }
      .mobile-toolstrip button.active[data-overlay="clipping"]    { border-top-color: #ef4444; }
      .mobile-toolstrip button.active[data-overlay="histogram"]   { border-top-color: #a855f7; }
      .mobile-toolstrip button.active[data-overlay="saturation"]  { border-top-color: #ec4899; }
      .mobile-toolstrip button.active[data-overlay="guided"]      { border-top-color: #8b5cf6; }

      .sidebar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 30;
        border: 0;
        border-radius: 0;
        padding: 0;
        background: transparent !important;
        overflow: visible;
        pointer-events: none;
      }

      .mobile-bottom-sheet {
        /* Keep the sheet large enough for useful content without fully covering the hero area. */
        max-height: min(72dvh, 560px);
        overflow-y: auto;
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
        border: 1.5px solid var(--border-input);
        border-bottom: 0;
        border-radius: 16px 16px 0 0;
        background: var(--panel);
        transform: translateY(105%);
        transition: transform 180ms ease-out;
        box-shadow: 0 -10px 24px rgba(17, 24, 39, 0.18);
        pointer-events: auto;
      }

      @supports not (height: 100dvh) {
        .mobile-bottom-sheet {
          max-height: min(72vh, 560px);
        }
      }

      .sidebar.mobile-sheet-open .mobile-bottom-sheet {
        transform: translateY(0);
      }

      body.app-mode-active .demo-page {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
      }

      body.app-mode-active .mobile-toolstrip {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        margin-top: 0;
        z-index: 40;
      }
    }

    /* Score bars and badges for AI Analysis */
    /* ── Scores overlay category cards (App Workspace.dc.html) ────────
       Scoped to the overlay: .score-bar is also used by displayScores() for
       the sidebar, which keeps its original single-row treatment. */
    .scores-overlay-content .score-bar {
      display: flex;
      flex-direction: column;
      gap: 7px;
      align-items: stretch;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 11px 13px;
      margin-bottom: 0;
    }

    .scores-overlay-content .score-bar-head {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .scores-overlay-content .score-bar-label {
      width: auto;
      flex: none;
      font-size: 13px;
      font-weight: 650;
      color: var(--text-heading);
    }

    .scores-overlay-content .score-bar-value {
      margin-left: auto;
      font-size: 14px;
      font-weight: 700;
      color: var(--text-heading);
    }

    .scores-overlay-content .score-bar-track {
      flex: none;
      width: 100%;
      height: 6px;
      border-radius: 3px;
      /* app.css aliases --border to --border-input (#C8BFAA), which is far
         darker than the mock's track and dropped every tier fill below 3:1.
         --bg-subtle restores the mock's lighter track: all four tiers clear
         3.65-4.45:1 against it. */
      background: var(--bg-subtle);
    }

    [data-theme="dark"] .scores-overlay-content .score-bar-track {
      /* dark --bg-subtle (#141414) would vanish against the panel; the
         existing border tone already gives every tier 3.92-6.81:1 */
      background: var(--border-input);
    }

    .scores-ring-row { padding: 4px 2px 6px; }
    .scores-legend   { padding-bottom: 0; }

    /* ── Scores overlay header: 76px ring + verdict ─────────────────── */
    .scores-ring-row {
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 4px 2px 10px;
    }

    .scores-ring {
      position: relative;
      width: 76px;
      height: 76px;
      flex: none;
    }

    .scores-ring svg {
      width: 76px;
      height: 76px;
      display: block;
      transform: rotate(-90deg);
    }

    .scores-ring-track { stroke: var(--border); }
    .scores-ring-arc   { stroke: var(--accent-fill); }

    .scores-ring-value {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 19px;
      font-weight: 700;
      color: var(--text-heading);
    }

    .scores-verdict-title {
      font-size: 14px;
      font-weight: 650;
      color: var(--text-heading);
    }

    .scores-verdict-sub {
      font-size: 12px;
      color: var(--text-secondary);
      line-height: 1.5;
    }

    .scores-legend {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      font-size: 10.5px;
      color: var(--text-secondary);
      padding-bottom: 10px;
    }

    .scores-legend span {
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .scores-legend i {
      width: 10px;
      height: 10px;
      border-radius: 3px;
      display: inline-block;
    }

    .score-tier-badge {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      padding: 2px 7px;
      border-radius: var(--radius-pill);
      white-space: nowrap;
    }

    .score-bar {
      display: flex;
      align-items: center;
      margin-bottom: 8px;
    }
    .score-bar-label {
      width: 120px;
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--text-primary);
    }
    .score-bar-track {
      flex: 1;
      height: 8px;
      background: var(--border);
      border-radius: 4px;
      overflow: hidden;
    }
    .score-bar-fill {
      height: 100%;
      border-radius: 4px;
      transition: width 0.5s ease;
    }
    .score-bar-value {
      width: 32px;
      text-align: right;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-primary);
    }
    .badge {
      display: inline-block;
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 600;
      margin-right: 6px;
      text-transform: capitalize;
    }
    .badge-genre {
      background: var(--bg-subtle);
      color: var(--text-primary);
      border: 1px solid var(--border);
    }
    .badge-mood {
      background: var(--bg-subtle);
      color: var(--text-primary);
      border: 1px solid var(--border);
    }
    .genre-mood-badges {
      margin-bottom: 12px;
    }
    .coaching-section-header {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text-primary);
      margin-top: 16px;
      margin-bottom: 6px;
    }
    .coaching-section-header:first-child {
      margin-top: 0;
    }
    .coaching-text {
      font-size: 13px;
      color: var(--text-primary);
      line-height: 1.5;
    }
    .coaching-key-lesson {
      background-color: var(--accent-light);
      border-left: 3px solid var(--accent-fill);
      color: var(--text-primary);
      border-radius: 4px;
      padding: 12px 16px;
      margin: 12px 0;
      font-size: 13px;
    }
    .coaching-next-steps {
      padding-left: 20px;
      font-size: 13px;
      color: var(--text-primary);
    }
    .coaching-next-steps li {
      margin-bottom: 8px;
    }

    /* Canvas overlay for analysis regions and composition guides */
    #analysis-overlay, #composition-concept-overlay {
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: none;
      z-index: 4;
      display: block;
    }

    /* Composition's concept-specific geometry (accent lines, crop box,
       rings/connectors, additional-rules boxes) — hidden at rest, faded in
       together with the pills/legend on hover/focus of the Composition
       toolbar button via .comp-visible (see _compApplyReveal in app.js).
       Leave (no class) is the uniform, no-stagger transition every other
       .comp-visible-driven element also uses. */
    #composition-concept-overlay {
      opacity: 0;
      transition: opacity 120ms ease-out;
    }

    #composition-concept-overlay.comp-visible {
      opacity: 1;
      transition: opacity 180ms ease-out;
    }

    .image-viewer:not(.has-preview) #analysis-overlay,
    .image-viewer:not(.has-preview) #composition-concept-overlay {
      display: none;
    }

    .image-viewer.side-by-side-mode #analysis-overlay,
    .image-viewer.side-by-side-mode #composition-concept-overlay {
      display: none;
    }

    /* Shared frosted-glass tokens — every overlay legend (Composition, Guided
       Points, Subjects, Focus, Clipping, Histogram) now consumes these so the
       treatment stays one definition instead of repeated literals. The panels
       sit on top of an arbitrary photograph, not page chrome, so the glass
       itself stays fixed dark in both themes — only the swatch colors below
       vary by theme. */
    :root {
      --a22-glass-bg: rgba(0, 0, 0, 0.50);
      --a22-glass-blur: 12px;
      --a22-glass-border: 0.75px solid rgba(255, 255, 255, 0.25);
      --a22-glass-radius: 6px;
      --a22-glass-shadow: 2px 3px 8px rgba(0, 0, 0, 0.15);
      --a22-glass-text: rgba(255, 255, 255, 0.88);
      --a22-glass-text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
      --a22-glass-divider: rgba(255, 255, 255, 0.15);

      /* ── Overlay premium visual system (2026-09-18) ──────────────────────
         Single source of truth for every color drawn ON the photograph by
         Composition / Subjects / Guided Points. One concept, one hue, never
         reused, theme-invariant (these sit on an arbitrary photo, not page
         chrome, so they don't shift with light/dark like --accent-fill).
         The composition accents below are the TEACHING layer — full-strength,
         saturated. Subjects/faces/text stay structural: differentiated by
         alpha and stroke weight (and a slight, dim temperature shift for
         animals/vehicles), never by a competing saturated hue — see
         AI_TRUST_BOUNDARIES: a person is not a different color from a hat. */
      --a22-accent-gold-rgb:   245, 197,  66; /* #F5C542 — thirds/focal points, crop */
      --a22-accent-violet-rgb: 167, 139, 250; /* #A78BFA — leading lines/movement */
      --a22-accent-mint-rgb:   110, 231, 183; /* #6EE7B7 — balance/symmetry */
      --a22-accent-amber-rgb:  251, 146,  60; /* #FB923C — framing/region boxes */
      --a22-accent-sky-rgb:    125, 211, 252; /* #7DD3FC — depth/layers */
      --a22-accent-green-rgb:  134, 239, 172; /* #86EFAC — negative space */
      --a22-grid-rgb:          255, 255, 255; /* structural proportional grid */

      /* Subject category hues (2026-09-20) — desaturated jewel tones. Alpha-only
         differentiation (white/grey tonal range) proved indistinguishable in a
         live screenshot; these are genuine, distinct hues, one per category,
         but every one is visibly lower-chroma than its nearest composition
         accent so the hierarchy (accents = teaching layer, subjects =
         structural layer) still reads correctly. Flat 0.85 alpha for all. */
      --a22-subject-person-rgb:   127, 181, 196; /* #7FB5C4 desaturated teal */
      --a22-subject-face-rgb:     143, 196, 168; /* #8FC4A8 sage green */
      --a22-subject-headwear-rgb: 184, 155, 201; /* #B89BC9 muted mauve — also clothing/other */
      --a22-subject-eyewear-rgb:  212, 165, 116; /* #D4A574 warm sand — also accessories */
      --a22-subject-animal-rgb:   201, 168, 124; /* #C9A87C soft ochre */
      --a22-subject-vehicle-rgb:  145, 167, 196; /* #91A7C4 slate blue */
      --a22-subject-text-rgb:     168, 162, 158; /* #A8A29E warm stone */

      /* Exposure zones — cool → warm analytical gradient. Zone 5 ("Correct")
         stays unpainted; its legend swatch keeps a neutral dashed outline. */
      --a22-exposure-under2-rgb:  58,  90, 168; /* 0-20%  underexposed */
      --a22-exposure-under4-rgb:  97, 140, 189; /* 21-40% dark tones */
      --a22-exposure-bright7-rgb: 196, 152,  74; /* 61-75% bright tones */
      --a22-exposure-over-rgb:    178,  73,  52; /* 76%+   overexposed */
      --a22-exposure-outline-rgb: 255, 255, 255;

      /* Saturation zones — same grey→blue→amber→orange→magenta order. */
      --a22-sat-desaturated-rgb:  120, 118, 128;
      --a22-sat-low-rgb:           90, 138, 178;
      --a22-sat-moderate-rgb:     196, 158,  74;
      --a22-sat-vivid-rgb:        196, 124,  66;
      --a22-sat-oversaturated-rgb: 178, 74, 110;

      /* Focus bands — absolute classification unchanged, hue only. */
      --a22-focus-sharp-rgb:     58, 168, 110;
      --a22-focus-moderate-rgb:  70, 150, 186;
      --a22-focus-soft-rgb:     196, 158,  74;
      --a22-focus-blur-rgb:     178,  73,  90;

      /* Clipping — kept closest to source hue of any category: diagnostic
         legibility over the actual highlight/shadow pixels is non-negotiable. */
      --a22-clip-highlight-rgb:      214, 58, 42;
      --a22-clip-highlight-base-rgb: 224, 178, 42;
      --a22-clip-shadow-rgb:          58, 92, 204;
    }

    [data-theme="dark"] {
      /* Overlay premium visual system colors are theme-invariant — they sit on
         an arbitrary photo and must not shift with page chrome. No dark
         redefinition; :root's values apply in both themes unchanged. */

      --a22-exposure-under2-rgb:  90, 124, 201;
      --a22-exposure-under4-rgb: 124, 166, 214;
      --a22-exposure-bright7-rgb: 214, 174, 100;
      --a22-exposure-over-rgb:   201,  98,  74;

      --a22-sat-desaturated-rgb: 148, 145, 156;
      --a22-sat-low-rgb:         116, 164, 201;
      --a22-sat-moderate-rgb:    214, 178, 100;
      --a22-sat-vivid-rgb:       214, 146,  90;
      --a22-sat-oversaturated-rgb: 201, 98, 134;

      --a22-focus-sharp-rgb:     79, 191, 132;
      --a22-focus-moderate-rgb:  92, 174, 209;
      --a22-focus-soft-rgb:     214, 178, 100;
      --a22-focus-blur-rgb:     201,  98, 116;

      --a22-clip-highlight-rgb:      224, 84, 68;
      --a22-clip-highlight-base-rgb: 232, 196, 74;
      --a22-clip-shadow-rgb:          92, 124, 224;
    }

    /* Composition on-image annotations share the Guided Point card's frosted
       treatment (same tokens, radius, padding, body type) so both read as one
       annotation system. Only the title keeps its concept accent colour. */
    .comp-pill {
      position: absolute;
      font: 600 11px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-annotation-color, #ffffff);
      padding: 14px 16px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: 8px;
      box-shadow: var(--a22-glass-shadow);
      pointer-events: none;
      z-index: 5;
      opacity: 0;
      transition: opacity 120ms ease-out; /* leave: uniform, no stagger */
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }

    .comp-pill.comp-visible {
      opacity: 1;
      pointer-events: auto;
      transition: opacity 200ms ease-out 90ms; /* reveal, staggered after the legend */
    }

    .comp-rule-pill {
      /* No fixed top/left: placed dynamically alongside the suggestion pill
         and localized guide annotations by the unified placement system in
         _renderAnnotationPills (max-width 480px is a fallback ceiling — JS
         sets the actual responsive max-width inline once placed). */
      max-width: 280px;
      overflow-wrap: break-word;
    }

    .comp-suggestion-pill {
      /* No fixed left — placed dynamically, see .comp-rule-pill above. */
      font: 400 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: rgba(255, 255, 255, 0.85);
      max-width: 280px;
      white-space: normal;
      overflow-wrap: break-word;
    }

    .comp-legend-panel {
      position: absolute;
      left: 8px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 5px 6px;
      pointer-events: none;
      z-index: 5;
      font: 9px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      pointer-events: none;
      transition: opacity 120ms ease-out; /* leave: uniform, no stagger */
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .comp-legend-panel.comp-visible {
      opacity: 1;
      pointer-events: auto;
      transition: opacity 160ms ease-out 60ms; /* reveal, first to appear */
    }

    .comp-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 2px;
    }

    .comp-legend-row:last-child {
      margin-bottom: 0;
    }

    .comp-legend-swatch {
      width: 12px;
      height: 0;
      flex-shrink: 0;
      border-top-width: 1px;
      border-top-style: solid;
    }

    .comp-legend-row.dim {
      opacity: 0.5;
    }

    .comp-annotation-pill {
      position: absolute;
      /* Localized placement sets left/top explicitly and owns centering itself;
         left:50%/translateX(-50%) below is the centered-stack fallback default,
         overridden per-pill in _renderAnnotationPills when a localized
         candidate is accepted. */
      left: 50%;
      transform: translateX(-50%);
      pointer-events: none;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: 8px;
      box-shadow: var(--a22-glass-shadow);
      padding: 14px 16px;
      max-width: 280px;
      opacity: 0;
      transition: opacity 120ms ease-out; /* leave: uniform, no stagger */
      z-index: 15;
    }

    .comp-annotation-pill.comp-visible {
      opacity: 1;
      /* reveal: 200ms, 120ms base delay + up to 80ms more (40ms/pill, capped
         at the 3rd) — the per-pill delay is set inline by _compApplyReveal,
         which overrides this base transition-delay. */
      transition: opacity 200ms ease-out 120ms;
    }

    @media (prefers-reduced-motion: reduce) {
      .comp-pill, .comp-legend-panel, .comp-annotation-pill {
        transition: none;
      }
      #composition-concept-overlay {
        transition: none;
      }
    }

    .comp-annotation-title {
      font: 600 11px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-annotation-color, #ffffff);
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
      margin-bottom: 8px;
    }

    .comp-annotation-note {
      font: 400 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: rgba(255, 255, 255, 0.85);
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
      word-wrap: break-word;
    }

    .comp-pill-rule {
      display: block;
    }

    .comp-pill-note {
      display: block;
      font: 400 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: rgba(255, 255, 255, 0.85);
      margin-top: 8px;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }

    .comp-legend-text {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .comp-legend-note {
      font-size: 9px;
      color: rgba(255, 255, 255, 0.6);
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
      max-width: 320px;
    }

    /* Subjects overlay — frosted-glass legend panel and HTML labels */
    .subjects-legend-panel {
      position: absolute;
      left: 8px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 7px 8px;
      pointer-events: none;
      z-index: 5;
      font: 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      transition: opacity 200ms ease-in-out;
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .subjects-legend-panel.subjects-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .subjects-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .subjects-legend-row:last-child {
      margin-bottom: 0;
    }

    .subjects-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .subjects-legend-note {
      color: rgba(255, 255, 255, 0.55);
      font-style: italic;
    }

    /* Subject/face on-image labels — no panel; text sits directly on the
       photograph. Confidence lives in the title attribute only. */
    .subject-label {
      position: absolute;
      pointer-events: none;
      background: none;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      border: none;
      border-radius: 0;
      padding: 0;
      box-shadow: none;
      font: 600 10.5px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      letter-spacing: 0.03em;
      color: rgba(255, 255, 255, 0.95);
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.6);
      white-space: nowrap;
      transform: translateY(-100%);
      z-index: 6;
      opacity: 0;
      transition: opacity 150ms ease-in-out;
    }

    .subject-label.subjects-visible {
      opacity: 1;
    }

    .subject-label-secondary {
      opacity: 0.55;
      font-size: 9px;
      font-weight: 500;
    }

    /* Applied by _placeSubjectLabels when every collision-free candidate
       is blocked — the label still renders (never dropped), just dimmed
       so it reads as a lower-confidence placement. */
    .subject-label-crowded {
      opacity: 0.5;
    }

    /* Focus overlay — frosted-glass legend panel and HTML zone labels */
    .focus-legend-panel {
      position: absolute;
      left: 8px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 7px 8px;
      pointer-events: none;
      z-index: 5;
      font: 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      transition: opacity 200ms ease-in-out;
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .focus-legend-panel.focus-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .focus-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .focus-legend-row:last-child {
      margin-bottom: 0;
    }

    .focus-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .focus-legend-note {
      color: rgba(255, 255, 255, 0.55);
      font-style: italic;
    }

    .focus-zone-label {
      position: absolute;
      pointer-events: none;
      font: 500 10px/1 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: #ffffff;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
      white-space: nowrap;
      transform: translate(-50%, -50%);
      z-index: 6;
    }

    /* Clipping overlay — frosted-glass legend panel and HTML stat labels */
    .clipping-legend-panel {
      position: absolute;
      left: 8px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 7px 8px;
      pointer-events: none;
      z-index: 5;
      font: 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      transition: opacity 200ms ease-in-out;
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .clipping-legend-panel.clipping-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .clipping-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .clipping-legend-row:last-child {
      margin-bottom: 0;
    }

    .clipping-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .clipping-legend-divider {
      height: 1px;
      background: var(--a22-glass-divider);
      margin: 4px 0;
    }

    .clipping-stat-label {
      position: absolute;
      pointer-events: none;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 3px 7px;
      font: 600 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: #ffffff;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
      white-space: nowrap;
      z-index: 6;
      opacity: 0;
      transition: opacity 150ms ease-in-out;
    }

    .clipping-stat-label.clipping-visible {
      opacity: 1;
    }

    .histogram-legend-panel {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: var(--a22-glass-radius);
      padding: 7px 8px;
      pointer-events: none;
      z-index: 5;
      font: 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--a22-glass-text);
      opacity: 0;
      transition: opacity 200ms ease-in-out;
      text-shadow: var(--a22-glass-text-shadow);
      box-shadow: var(--a22-glass-shadow);
    }

    .histogram-legend-panel.histogram-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .histogram-legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .histogram-legend-row:last-child {
      margin-bottom: 0;
    }

    .histogram-legend-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .toolstrip-btn.active {
      background: var(--accent-light);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    /* Analysis loading overlay styles */
    .analysis-loading-overlay {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.72);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 50;
      border-radius: inherit;
      backdrop-filter: blur(2px);
    }
    .analysis-loading-overlay.hidden {
      display: none;
    }
    .alo-inner {
      width: 80%;
      max-width: 380px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
    }
    .alo-stage-track {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .alo-stage-bar {
      width: 100%;
      height: 3px;
      background: rgba(255, 255, 255, 0.15);
      border-radius: 2px;
      overflow: hidden;
    }
    .alo-stage-fill {
      height: 100%;
      width: 0%;
      background: var(--accent-fill);
      border-radius: 2px;
      transition: width 0.8s ease;
    }
    .alo-stage-dots {
      display: flex;
      justify-content: space-between;
      width: 100%;
    }
    .alo-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.2);
      transition: background 0.4s ease;
    }
    .alo-dot.active {
      background: var(--accent-fill);
    }
    .alo-dot.complete {
      background: var(--accent-light);
    }
    .alo-label {
      font-size: 15px;
      font-weight: 600;
      color: #ffffff;
      text-align: center;
      letter-spacing: 0.01em;
    }
    .alo-sub {
      font-size: 12px;
      color: rgba(255, 255, 255, 0.55);
      text-align: center;
      line-height: 1.5;
      max-width: 280px;
    }

    #vision-panel {
      width: 100%;
      background: var(--panel, #fff);
      border: 1px solid var(--border, #e5e7eb);
      border-radius: 8px;
      padding: 16px;
      margin-top: 8px;
      box-sizing: border-box;
    }

    /* ── Vision Workspace Modal ───────────────────────────────────── */
    .vision-workspace-backdrop {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(20, 16, 10, 0.5);
      backdrop-filter: blur(4px);
      z-index: 9999;
    }
    .vision-workspace-backdrop.hidden {
      display: none;
    }
    .vision-workspace-modal {
      /* Widened (corrective pass, 2026-08-04): the map-first location flow
         needs the notice+stepper+toolbar+map all visible together on open
         at 1440x900 with no scroll — 640px could not fit that. */
      width: min(94vw, 1040px);
      max-height: calc(100vh - 72px);
      overflow: hidden;
      border-radius: 18px;
      background: var(--bg-glass-strong);
      backdrop-filter: blur(20px) saturate(1.2);
      -webkit-backdrop-filter: blur(20px) saturate(1.2);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-lg);
      color: var(--text-primary);
      display: flex;
      flex-direction: column;
    }
    .vision-workspace-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1rem;
      padding: 1.25rem 1.5rem;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .vision-workspace-title-block h2 {
      margin: 0;
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--text-heading);
    }
    .vision-workspace-title-block p {
      margin: 0.35rem 0 0;
      font-size: 0.875rem;
      color: var(--text-secondary);
    }
    .vision-workspace-actions {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      flex-shrink: 0;
    }
    /* v2 (2026-08-04): header "Analysis complete" chip — same positive
       treatment as the notice/findings badges below. */
    .vision-analysis-complete-chip {
      padding: 7px 14px;
      border-radius: var(--radius-pill);
      background: color-mix(in srgb, var(--color-success) 12%, transparent);
      color: var(--color-success);
      font-size: 0.78rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .vision-workspace-content {
      flex: 1;
      overflow-y: auto;
      padding: 1rem 1.5rem 1.25rem;
      display: flex;
      flex-direction: column;
      gap: 0.625rem;
    }
    /* The dark glass modal shows opaque white scrollbar track/corner by
       default in Chromium — keep only the thumb visible. */
    .vision-workspace-content::-webkit-scrollbar { width: 8px; }
    .vision-workspace-content::-webkit-scrollbar-track { background: transparent; }
    .vision-workspace-content::-webkit-scrollbar-corner { background: transparent; }
    .vision-workspace-content::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 8px; }
    .vision-workspace-content { scrollbar-color: var(--scrollbar-thumb) transparent; }

    .coach-review-nudge {
      font-size: 0.75rem;
      color: var(--accent-primary);
      background: rgba(var(--accent-fill-rgb), 0.08);
      border: 1px solid rgba(var(--accent-fill-rgb), 0.3);
      border-radius: 20px;
      padding: 4px 12px;
      margin: 6px 0 0 0;
      text-align: center;
      animation: gentle-pulse 2s ease-in-out infinite;
    }

    .vw-done-row {
      padding-top: 1rem;
      margin-top: 0.5rem;
      border-top: 1px solid rgba(var(--accent-fill-rgb), 0.2);
    }

    .vw-done-btn {
      width: 100%;
      padding: 11px 16px;
      background: var(--accent-fill);
      border: 1.5px solid var(--accent-fill);
      border-radius: 8px;
      color: var(--accent-on);
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .vw-done-btn:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }

    .vision-workspace-banner {
      /* Un-floated: normal document flow, not pinned. It used to be a top-pinned
         banner (top:0, z-index:2) that overlapped the Location field and its map
         as the modal scrolled. It's a one-time confirmation, so it scrolls away
         with the content it sits above. */
      position: static;
      background: rgba(var(--accent-fill-rgb), 0.08);
      border: 1px solid rgba(var(--accent-fill-rgb), 0.3);
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 0.8125rem;
      color: var(--text);
      line-height: 1.5;
    }

    .vision-workspace-banner--complete {
      background: rgba(var(--accent-fill-rgb), 0.05);
      border-color: rgba(var(--accent-fill-rgb), 0.2);
    }

    .vision-workspace-banner p {
      margin: 0;
    }
    .vision-workspace-section {
      padding: 1rem 1.25rem;
      border-radius: 14px;
      background: var(--bg-glass);
      border: 1px solid var(--border);
    }

    /* ── Vision Workspace pill inputs ─────────────────────────────── */
    .vw-label {
      font-size: 12px;
      color: var(--text-secondary);
      font-weight: 500;
      display: block;
    }
    .vw-input,
    .vw-select,
    .vw-textarea {
      width: 100%;
      border: 1px solid var(--border-input);
      border-radius: 20px;
      padding: 8px 14px;
      font-size: 13px;
      font-family: inherit;
      background: var(--bg-secondary);
      color: var(--text-primary);
      transition: border-color 0.18s ease, box-shadow 0.18s ease;
      box-sizing: border-box;
    }
    .vw-textarea {
      border-radius: 14px;
      resize: vertical;
      min-height: 72px;
    }
    .vw-input:focus,
    .vw-select:focus,
    .vw-textarea:focus {
      outline: none;
      border-color: var(--accent-fill);
      box-shadow: 0 0 0 3px var(--accent-glow);
    }
    .vw-input::placeholder,
    .vw-textarea::placeholder {
      color: var(--text-muted);
    }
    .vw-readonly {
      background: var(--bg-subtle);
      color: var(--text-secondary);
      cursor: default;
    }
    .vw-readonly:focus {
      border-color: var(--border-input);
      box-shadow: none;
    }
    /* Collapsible section header buttons inside Vision Workspace */
    .collapsible-header button {
      background: none;
      border: none;
      color: var(--text-heading);
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
      font-family: inherit;
    }
    /* Save buttons inside Vision Workspace sections */
    #vision-save-context-btn,
    #vision-gear-add-btn {
      padding: 8px 16px;
      border-radius: 20px;
      border: 1px solid var(--accent-fill-strong);
      background: var(--accent-fill-strong);
      color: var(--accent-on);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      font-family: inherit;
      transition: background 0.15s, border-color 0.15s;
    }
    #vision-save-context-btn:hover:not(:disabled),
    #vision-gear-add-btn:hover {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
    }
    #vision-save-context-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    @media (max-width: 900px) {
      .vision-workspace-modal {
        width: min(94vw, 760px);
        max-height: 88vh;
      }
      .vision-workspace-header {
        flex-direction: column;
      }
      .vision-workspace-actions {
        width: 100%;
        justify-content: flex-end;
      }
    }
    /* ── end Vision Workspace Modal ───────────────────────────────── */

    /* ── Coaching Display Refinements ─────────────────────────────── */
    /* Use flexbox to reorder sidebar sections: AI Analysis on top, Scoring below */
    .mobile-bottom-sheet {
      display: flex;
      flex-direction: column;
    }

    /* Move Scoring section below AI Analysis */
    section[aria-labelledby="scoring-heading"] {
      order: 2;
    }

    /* Hidden state for Scoring section - permanently hidden now (moved to overlay) */
    section[aria-labelledby="scoring-heading"] {
      display: none !important;
    }

    section[aria-labelledby="analysis-heading"] {
      order: 1;
      border: none;
      padding: 0;
      border-radius: 0;
      overflow: visible;
      max-height: none;
      background: transparent;
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
    }

    /* Ensure content inside Coaching panel doesn't overflow */
    section[aria-labelledby="analysis-heading"] p {
      margin-bottom: 0;
      padding-bottom: 8px;
    }

    /* Hide Coach Assistant section (now redundant with Coaching Focus buttons) */
    section[aria-labelledby="coach-heading"] {
      display: none;
    }

    /* Keep Coach Chat Dock at the bottom */
    .coach-chat-dock {
      order: 99;
    }
    /* ── end Coaching Display Refinements ─────────────────────────── */

    /* ── Guided Flow: Pulsing Button Animation ───────────────────── */
    .pulse-guide {
      animation: gentle-pulse 2s ease-in-out infinite;
    }

    @keyframes gentle-pulse {
      0%, 100% {
        box-shadow: 0 0 0 0 rgba(75, 85, 99, 0.4);
      }
      50% {
        box-shadow: 0 0 0 10px rgba(75, 85, 99, 0);
      }
    }
    
    /* Single pulse for cascade animation */
    .cascade-pulse {
      animation: single-pulse 0.6s ease-out;
    }

    /* Brand pulse for Vision Workspace guided section headers: lavender light, amber dark */
    .vw-section-pulse {
      animation: vw-section-glow 1.4s ease-in-out infinite;
    }

    @keyframes vw-section-glow {
      0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--accent-fill-rgb), 0.5);
        background: rgba(var(--accent-fill-rgb), 0.06);
      }
      50% {
        box-shadow: 0 0 0 9px rgba(var(--accent-fill-rgb), 0);
        background: rgba(var(--accent-fill-rgb), 0.14);
      }
    }
    
    @keyframes single-pulse {
      0% { box-shadow: 0 0 0 0 rgba(75, 85, 99, 0.4); }
      50% { box-shadow: 0 0 0 8px rgba(75, 85, 99, 0); }
      100% { box-shadow: 0 0 0 0 rgba(75, 85, 99, 0); }
    }
    
    /* Vision Workspace accordion sections should not clip pulse animation */
    .collapsible-section {
      overflow: visible;
    }
    .collapsible-header {
      overflow: visible;
    }
    /* ── end Guided Flow ───────────────────────────────────────────── */

    /* ── Guided Points overlay ─────────────────────────────────────── */

    /* Fix: guided-legend has long descriptive text — allow wrapping */
    #guided-legend {
      max-width: 240px;
    }
    #guided-legend .overlay-legend-row span {
      white-space: normal;
      line-height: 1.5;
    }

    /* Guided pulse — a lightweight DOM ring per point, independent of the
       analysis-overlay canvas so the "just turned on" attention animation
       never requires a full overlay redraw. Position (left/top) is set once
       per point in JS; only transform/opacity animate, both compositor-only. */
    .guided-pulse-ring {
      position: absolute;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: 2px solid rgba(var(--accent-fill-rgb), 0.9);
      pointer-events: none;
      z-index: 5;
      animation: guidedPulseRing 1.8s ease-out 2;
    }

    @keyframes guidedPulseRing {
      0%   { transform: scale(0.7); opacity: 0.9; }
      100% { transform: scale(1.6); opacity: 0; }
    }

    @media (prefers-reduced-motion: reduce) {
      .guided-pulse-ring { display: none; }
      .overlay-rail button,
      .mobile-toolstrip button {
        transition: none;
      }
    }

    /* Info card */
    .guided-point-card {
      position: absolute;
      z-index: 20;
      max-width: 280px;
      padding: 14px 16px;
      background: var(--a22-glass-bg);
      backdrop-filter: blur(var(--a22-glass-blur));
      -webkit-backdrop-filter: blur(var(--a22-glass-blur));
      border: var(--a22-glass-border);
      border-radius: 8px;
      box-shadow: var(--a22-glass-shadow);
      opacity: 0;
      transform: scale(0.85) translateY(6px);
      transition: opacity 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                  transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
      pointer-events: none;
    }

    .guided-point-card.guided-card-visible {
      opacity: 1;
      transform: scale(1) translateY(0);
      pointer-events: auto;
    }

    .guided-card-entering {
      opacity: 0;
      transform: scale(0.85) translateY(6px);
    }

    .guided-card-leaving {
      opacity: 0;
      transform: scale(0.85) translateY(6px);
      transition-duration: 150ms;
      transition-timing-function: ease-in;
    }

    /* The card's default transition uses a bouncy overshoot easing
       (cubic-bezier(0.34, 1.56, 0.64, 1)) — drop it so the card appears/
       disappears immediately instead of springing into place. Placed after
       the rules above so equal-specificity cascade order picks this one up. */
    @media (prefers-reduced-motion: reduce) {
      .guided-point-card,
      .guided-card-entering,
      .guided-card-leaving {
        transition: none;
      }
    }

    .guided-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }

    .guided-card-number {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: rgba(139, 92, 246, 0.9);
      border: 2px solid rgba(255, 255, 255, 0.9);
      color: #ffffff;
      font: bold 11px system-ui, sans-serif;
      flex-shrink: 0;
    }

    .guided-card-title {
      flex: 1;
      color: #ffffff;
      font: 600 11px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }

    .guided-card-close {
      color: rgba(255, 255, 255, 0.7);
    }

    .guided-card-close:hover {
      /* icon-on-glass: this control sits on a dark frosted card over the photo,
         so the page-surface hover would be white-on-warm and illegible. */
      background: rgba(255, 255, 255, 0.15);
      color: #ffffff;
    }

    .guided-card-zoom {
      background: transparent;
      border: 1px solid transparent;
      color: rgba(255, 255, 255, 0.5);
      font-size: 1rem;
      cursor: pointer;
      padding: 0 0 0 4px;
      line-height: 1;
      transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
      flex-shrink: 0;
    }

    .guided-card-zoom:hover {
      /* icon-on-glass: this control sits on a dark frosted card over the photo,
         so the page-surface ICON hover would be white-on-warm and illegible. */
      background: rgba(255, 255, 255, 0.15);
      border-color: var(--accent-fill);
      color: #ffffff;
    }

    .guided-card-body {
      color: rgba(255, 255, 255, 0.85);
      font: 400 10px/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
      max-height: 4.5em;
      overflow: hidden;
    }

    .guided-card-expand {
      display: block;
      margin-top: 8px;
      background: transparent;
      border: 1px solid transparent;
      color: var(--accent-fill);
      font: 400 1rem system-ui, sans-serif;
      cursor: pointer;
      padding: 0;
      transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    }

    .guided-card-expand:hover {
      background: var(--bg-secondary);
      border-color: var(--accent-fill);
      color: var(--accent-hover);
    }

    .guided-card-line {
      margin: 0 0 6px 0;
      display: flex;
      gap: 5px;
      align-items: baseline;
    }

    .guided-card-line:last-child {
      margin-bottom: 0;
    }

    .guided-card-prefix {
      flex-shrink: 0;
      font-weight: 700;
      font-size: 10px;
    }

    .guided-card-strength .guided-card-prefix {
      color: var(--color-success);
    }

    .guided-card-tip .guided-card-prefix {
      color: #f59e0b;
    }
    /* ── end Guided Points ─────────────────────────────────────────── */

    /* ── Dark Mode Overrides — app page ──────────────────────────────── */

    /* Kill any gap/bleed by locking html+body to the page base color */
    [data-theme="dark"] html,
    [data-theme="dark"] body {
      background: #191919 !important;
      background-color: #191919 !important;
    }

    [data-theme="dark"] .top-toolbar,
    [data-theme="dark"] .top-toolbar button,
    [data-theme="dark"] .top-toolbar .back-link,
    [data-theme="dark"] .toolstrip button,
    [data-theme="dark"] .scores-overlay-header .scores-header-btn {
      background: var(--bg-card);
      border-color: var(--border);
      color: var(--text-heading);
    }

    /* ── Scores slide-in panel — dark mode text legibility ─────────────────
       Actual classes: .scores-overlay-panel > .scores-overlay-content with
       .score-bar > (.score-bar-label, .score-bar-value) rows and a
       <details><summary>Score Reasoning</summary><p>…</p></details> block.
       The reasoning <p> carries an inline color (#374151) set in app.js, so
       !important is required to win in dark mode. */
    [data-theme="dark"] .scores-overlay-panel,
    [data-theme="dark"] .scores-overlay-backdrop .scores-overlay-panel {
      background: #1E1E1E !important;
      border-left: 1px solid #333333 !important;
    }

    /* Score dimension labels (Composition, Exposure, Focus, …) */
    [data-theme="dark"] .scores-overlay-content .score-bar-label {
      color: #E0E0E0 !important;
    }

    /* Score values (75, 72, 73, …) */
    [data-theme="dark"] .scores-overlay-content .score-bar-value {
      color: #F5F5F7 !important;
    }

    /* "Score Reasoning" disclosure heading */
    [data-theme="dark"] .scores-overlay-content summary {
      color: #E0E0E0 !important;
    }

    /* Score reasoning body text (overrides the inline #374151 from app.js) */
    [data-theme="dark"] .scores-overlay-content details p,
    [data-theme="dark"] .scores-overlay-content details li {
      color: #CCCCCC !important;
    }

    /* RAW / Compare / Edited (and other toolbar) buttons — hover feedback */
    /* These beat `[data-theme="dark"] .top-toolbar button` (0,2,1) which would
       otherwise flatten both back to the neutral chip treatment. */
    [data-theme="dark"] .top-toolbar .toolbar-tutorial-btn,
    [data-theme="dark"] .top-toolbar #a22-bw-pill,
    [data-theme="dark"] body:not(.app-mode-active) .top-toolbar #app-mode-toggle {
      background: rgba(var(--accent-fill-rgb), 0.12);
      border-color: var(--accent-fill);
      color: var(--accent-fill);
    }

    [data-theme="dark"] .top-toolbar .toolbar-tutorial-btn:hover,
    [data-theme="dark"] .top-toolbar #a22-bw-pill:hover,
    [data-theme="dark"] body:not(.app-mode-active) .top-toolbar #app-mode-toggle:hover {
      background: rgba(var(--accent-fill-rgb), 0.22);
      border-color: var(--accent-fill);
      color: var(--accent-fill);
    }

    [data-theme="dark"] .top-toolbar .toolbar-analyze-btn {
      background: var(--accent-fill);
      border-color: var(--accent-fill);
      color: var(--accent-on);
    }

    [data-theme="dark"] .top-toolbar .toolbar-analyze-btn:hover:not(:disabled) {
      background: var(--accent-hover);
      border-color: var(--accent-hover);
      color: var(--accent-on);
    }

    [data-theme="dark"] .top-toolbar button:hover:not(.active) {
      background: #333333;
    }

    /* Active/selected toolbar button — amber so it's clearly the current view */
    [data-theme="dark"] .top-toolbar button.active {
      background: var(--accent-fill);
      border-color: var(--accent-fill);
      color: var(--accent-on);   /* was #FFFFFF — 2.90:1 on the amber fill */
    }

    [data-theme="dark"] .sidebar,
    [data-theme="dark"] .sidebar section {
      background: var(--bg-card);
      border-color: var(--border-input);
    }

    [data-theme="dark"] .coaching-expanded-backdrop {
      background: rgba(0, 0, 0, 0.75);
    }

    @supports not (backdrop-filter: blur(8px)) {
      [data-theme="dark"] .coaching-expanded-backdrop {
        background: rgba(18, 18, 18, 0.97);
      }
    }

    [data-theme="dark"] .coaching-expanded-panel {
      background: var(--bg-elevated);
    }

    [data-theme="dark"] .gear-remove-btn {
      background: rgba(239, 68, 68, 0.12);
      border-color: rgba(239, 68, 68, 0.3);
      color: var(--color-error);
    }

    [data-theme="dark"] .feedback-type-pill.active,
    [data-theme="dark"] .toolstrip-btn.active {
      background: var(--accent-light);
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }

    /* :not(.vision-map-search-input) exclusion (PART 1d): this generic
       dark-mode rule's [data-theme="dark"] input specificity (0,1,1) beats
       .vision-map-search-input's own background:transparent (0,1,0) — it
       was painting --bg-input on the search field unconditionally (not
       just on focus/autofill), the actual root cause of the "white/light
       box" report. The search pill is its own opaque dark chrome (see
       .vision-map-search-box/.vision-map-search-input), same reasoning as
       the NUCLEAR block's exclusion below. */
    [data-theme="dark"] input:not(.vision-map-search-input),
    [data-theme="dark"] select,
    [data-theme="dark"] textarea {
      background: var(--bg-input);
      border-color: var(--border-input);
      color: var(--text-primary);
    }

    [data-theme="dark"] input::placeholder,
    [data-theme="dark"] textarea::placeholder {
      color: #777777;
    }

    [data-theme="dark"] select {
      background-image: none;
    }

    /* Vision Workspace — frosted glass restored (translucent, signature look) */
    /* Vision Workspace — solid dark card (NOT glass). Mirrors the light-mode
       white-card / defined-input clarity, just inverted. Glass is for app
       chrome; this form-heavy workspace prioritises readability. */
    [data-theme="dark"] .vision-workspace-modal {
      background: #222222;
      border: 1px solid #333333;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    /* Inner scrollable content — slightly lighter inner surface */
    [data-theme="dark"] .vision-workspace-content {
      background: #262626;
    }

    /* Input field styling (light fields on the dark card) lives in the
       NUCLEAR block at the end of this file. */

    /* Field labels */
    [data-theme="dark"] .vision-workspace-modal .vw-label {
      color: #AAAAAA;
    }

    /* Checkbox and radio labels — all labels inside the modal */
    [data-theme="dark"] .vision-workspace-modal label {
      color: #CCCCCC;
    }

    /* Section headers (Intent & Session, Location & Conditions, etc.) */
    [data-theme="dark"] .vision-workspace-modal .collapsible-header button {
      color: #E0E0E0;
    }

    /* Save Context — amber fill, white text. #vision-save-location-btn is
       excluded here — it's the v2 sticky footer's .vision-workspace-save-btn
       now, which owns its own per-state color (an ID selector here would
       outrank that class in specificity and fight it). */
    [data-theme="dark"] #vision-save-context-btn,
    [data-theme="dark"] #vision-gear-add-btn {
      color: #FFFFFF;
    }

    [data-theme="dark"] .vw-done-btn {
      background: var(--accent-fill);
      border-color: var(--accent-fill);
      color: var(--accent-on);
    }

    [data-theme="dark"] .vw-done-row {
      border-top-color: rgba(212, 134, 42, 0.25);
    }

    [data-theme="dark"] .vision-workspace-banner {
      background: rgba(212, 134, 42, 0.1);
      border-color: rgba(212, 134, 42, 0.35);
    }

    [data-theme="dark"] .vision-workspace-banner--complete {
      background: rgba(212, 134, 42, 0.07);
      border-color: rgba(212, 134, 42, 0.25);
    }

    [data-theme="dark"] .coach-review-nudge {
      color: #D4862A;
      background: rgba(212, 134, 42, 0.1);
      border-color: rgba(212, 134, 42, 0.35);
    }

    [data-theme="dark"] .vw-section-pulse {
      animation: vw-section-glow-dark 1.4s ease-in-out infinite;
    }

    @keyframes vw-section-glow-dark {
      0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 134, 42, 0.5);
        background: rgba(212, 134, 42, 0.06);
      }
      50% {
        box-shadow: 0 0 0 9px rgba(212, 134, 42, 0);
        background: rgba(212, 134, 42, 0.14);
      }
    }

    /* Upload-controls flyout — was solid white, now dark frosted */
    [data-theme="dark"] .viewer-upload-controls .collapsible-content {
      background: rgba(38, 38, 38, 0.95);
      backdrop-filter: blur(16px) saturate(1.1);
      -webkit-backdrop-filter: blur(16px) saturate(1.1);
    }

    /* Upload buttons — base bg is hardcoded #fff; in dark that became
       white-on-white (text was var(--text) ≈ #F5F5F7). Restore readability. */
    [data-theme="dark"] .viewer-upload-controls button:not(:where(.reveal-card, .link-status-badge) *) {
      background: var(--bg-input);
      border-color: var(--border);
      color: var(--text-primary);
    }

    /* Upload Image button — neutral, same as light mode (no accent fill).
       ID specificity needed to beat the base's hardcoded white bg. */
    [data-theme="dark"] #upload-image-btn:not(.upload-btn-compact) {
      background: #2A2A2A;
      border-color: var(--border);
      color: #E0E0E0;
    }

    /* Collapsed (compact) arrow toggle — dark surface so the arrow shows */
    [data-theme="dark"] #upload-image-btn.upload-btn-compact {
      background: var(--bg-input);
      border-color: var(--border);
    }
    [data-theme="dark"] #upload-image-btn.upload-btn-compact:hover {
      background: var(--bg-card);
    }

    [data-theme="dark"] #coaching-output,
    [data-theme="dark"] .coaching-panel-wrapper {
      background: var(--bg-card);
      border-color: var(--border);
    }

    /* Commit success banner — inline styles in app.html use green;
       override here for dark mode */
    [data-theme="dark"] #commit-success-message {
      background: var(--accent-light) !important;
      border-color: var(--accent-fill) !important;
    }
    [data-theme="dark"] #commit-success-message span[style*="color: #10B981"],
    [data-theme="dark"] #commit-success-message span[style*="color:#10B981"] {
      color: var(--accent-primary) !important;
    }

    [data-theme="dark"] .guided-card-expand {
      color: var(--accent-fill);
    }
    [data-theme="dark"] .guided-card-expand:hover {
      color: var(--accent-hover);
    }

    /* Upload section inner cards — rgba(255,255,255,0.95) bleaches in dark mode */
    [data-theme="dark"] .viewer-upload-section {
      background: #222222 !important;
      border-color: #333333 !important;
    }
    [data-theme="dark"] .viewer-upload-controls .viewer-upload-section {
      background: #262626 !important;
      border-color: #333333 !important;
    }
    [data-theme="dark"] .viewer-upload-controls details {
      background: #262626 !important;
    }
    [data-theme="dark"] .viewer-upload-controls summary,
    [data-theme="dark"] .viewer-upload-section summary {
      color: #E0E0E0 !important;
    }
    /* Element-selector buttons with no light rule and no hover in either
       theme — same shape as the .top-toolbar button gap. */
    .viewer-upload-section button:hover:not(:disabled) {
      border-color: var(--accent-fill);
      color: var(--accent-primary);
    }
    [data-theme="dark"] .viewer-upload-section button:hover:not(:disabled) {
      border-color: var(--accent-fill) !important;
      color: var(--accent-fill) !important;
    }

    [data-theme="dark"] .viewer-upload-section button {
      background: #2A2A2A !important;
      border: 1px solid #777777 !important;
      color: #E0E0E0 !important;
    }

    /* Overlay toggle rail — charcoal pills in dark mode (not generic blue).
       Active state gets each overlay's own ring colour (--rail-accent) so
       border/icon/glow agree — matches the light-theme active treatment. */
    [data-theme="dark"] .overlay-rail button {
      background: #2A2A2A !important;
      border: 1px solid #444444 !important;
      color: #AAAAAA !important;
    }

    [data-theme="dark"] .overlay-rail button:hover {
      background: #333333 !important;
      /* !important needed only to beat the base rule's own !important shorthand */
      border-color: var(--accent-fill) !important;
    }

    [data-theme="dark"] .overlay-rail button.active {
      background: #333333 !important;
      border: 1px solid var(--rail-accent, var(--accent-fill)) !important;
      color: var(--rail-accent, var(--accent-fill)) !important;
    }

    /* Mobile overlay toolstrip — dark mode */
    [data-theme="dark"] .mobile-toolstrip {
      background: #1F1F1F !important;
      border-color: #333333 !important;
    }

    [data-theme="dark"] .mobile-toolstrip button {
      background: #2A2A2A !important;
      border-color: #555555 !important;
      color: #E0E0E0 !important;
      border-bottom-color: #555555 !important;
    }

    /* Restore overlay color indicators in dark mode */
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="composition"] { border-bottom-color: var(--accent-fill) !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="subjects"]    { border-bottom-color: #06b6d4 !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="exposure"]    { border-bottom-color: #f59e0b !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="focus"]       { border-bottom-color: #fb923c !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="clipping"]    { border-bottom-color: #ef4444 !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="histogram"]   { border-bottom-color: #a855f7 !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="saturation"]  { border-bottom-color: #ec4899 !important; }
    [data-theme="dark"] .mobile-toolstrip button[data-overlay="guided"]      { border-bottom-color: #8b5cf6 !important; }

    [data-theme="dark"] .mobile-toolstrip button:hover {
      background: #333333 !important;
    }

    [data-theme="dark"] .mobile-toolstrip button.active {
      background: var(--accent-fill) !important;
      border-color: var(--accent-fill) !important;
      color: #FFFFFF !important;
      border-bottom-color: var(--accent-fill) !important;
    }

    /* Overlay identity on top border when active (dark mode) */
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="composition"] { border-top-color: var(--accent-fill) !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="subjects"]    { border-top-color: #06b6d4 !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="exposure"]    { border-top-color: #f59e0b !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="focus"]       { border-top-color: #fb923c !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="clipping"]    { border-top-color: #ef4444 !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="histogram"]   { border-top-color: #a855f7 !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="saturation"]  { border-top-color: #ec4899 !important; }
    [data-theme="dark"] .mobile-toolstrip button.active[data-overlay="guided"]      { border-top-color: #8b5cf6 !important; }

    /* Ensure hidden overlays stay hidden in dark mode regardless of the
       [data-theme="dark"] backdrop background rules above */
    [data-theme="dark"] .coaching-expanded-backdrop.hidden,
    [data-theme="dark"] .chat-expanded-panel.hidden {
      display: none !important;
    }
    /* ── end Dark Mode Overrides ─────────────────────────────────────── */

/* ============================================
   NUCLEAR: Vision Workspace dark mode
   Targets element types, not classes.
   !important overrides any cascade conflict.
   ============================================ */
/* :not(.vision-map-search-input) exclusion (2026-08-04): this nuclear rule
   targets plain form fields sitting on the modal's own card background —
   the map search pill is different chrome (opaque dark pill floating on the
   map, styled by .vision-map-search-box/.vision-map-search-input below) and
   was getting force-painted with this light #F5F5F5 box on top of its own
   dark pill background, the literal "white insert" bug. */
[data-theme="dark"] .vision-workspace-modal input[type="text"]:not(.vision-map-search-input),
[data-theme="dark"] .vision-workspace-modal textarea,
[data-theme="dark"] .vision-workspace-modal select {
  background: #F5F5F5 !important;
  border: 1px solid #CCCCCC !important;
  color: #2D3748 !important;
}

[data-theme="dark"] .vision-workspace-modal input[type="text"]:not(.vision-map-search-input):focus,
[data-theme="dark"] .vision-workspace-modal textarea:focus,
[data-theme="dark"] .vision-workspace-modal select:focus {
  border-color: var(--accent-fill) !important;
  box-shadow: 0 0 0 2px rgba(212, 134, 42, 0.2) !important;
}

[data-theme="dark"] .vision-workspace-modal input[type="text"]:not(.vision-map-search-input)::placeholder,
[data-theme="dark"] .vision-workspace-modal textarea::placeholder {
  color: #999999 !important;
}

[data-theme="dark"] .vision-workspace-modal input[readonly] {
  background: #E8E8E8 !important;
  border: 1px solid #CCCCCC !important;
  color: #666666 !important;
}

.photo-upload-metadata-tips {
  margin: 12px 0;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-subtle, #F9FAFB);
  border-radius: 4px;
}
.photo-upload-metadata-tips summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}
/* Cap the expanded details element itself — responsive so App Mode's shorter viewport is handled */
.photo-upload-metadata-tips[open] {
  max-height: min(160px, 18vh);
  overflow-y: auto;
}
body.app-mode-active .photo-upload-metadata-tips[open] {
  max-height: min(120px, 15vh);
}
.photo-upload-metadata-tips p {
  margin: 6px 0;
}
[data-theme="dark"] .photo-upload-metadata-tips {
  background: rgba(255, 255, 255, 0.04);
}


@keyframes companion-placeholder-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
/* Pulse only while the placeholder is the sole message — stops naturally once real messages appear */
#coach-chat-messages > .coach-chat-message.assistant:only-child,
#chat-expanded-messages > .coach-chat-message.assistant:only-child {
  animation: companion-placeholder-pulse 2.4s ease-in-out infinite;
}


/* ── Loop closure reveal (Sprint 2 Item F) ─────────────────────────────────
   Per-photo match card rendered from the upload response. Semantic accent
   tokens only — lavender in light mode, amber in dark, no new colors. */

/* 2026-09-04 panel refinement: Root A is a movable, resizable floating
   panel inside .image-viewer. It stays a child of .viewer-upload-controls
   (the delegated action handler keys off [data-reveal-root] here) but is
   taken out of that column's flow: app.js's syncShotCardRevealBound()
   measures .image-viewer's real rendered box and writes left/top/width/
   height (or max-height) inline in px, clamped so the whole panel — header,
   dismiss, collapse, resize handle — always stays inside the viewer. The
   values below are only the pre-JS fallback. */
.shot-card-reveal {
  position: absolute;
  left: 0;
  top: 48px;
  width: 460px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 50vh;
  z-index: 3; /* above the sibling upload collapsible inside this context */
}

/* While the panel is open, lift the whole upload-controls stacking context
   above every in-viewer overlay: legends (5), labels (6), composition
   annotation pill (15), guided-point card (20). Stays under the analysis
   loading overlay (50) and every modal/backdrop (9998+). */
.viewer-upload-controls:has(> .shot-card-reveal:not([hidden])) {
  z-index: 21;
}

.shot-card-reveal.is-dragging,
.shot-card-reveal.is-resizing {
  user-select: none;
  -webkit-user-select: none;
}

/* display:flex above beats the UA's [hidden]{display:none} (author origin
   wins), so Item F's dismiss/toggle — the first hide paths that leave
   content in place — need it restated. */
.shot-card-reveal[hidden] {
  display: none;
}

/* Three regions (2026-09-04 panel refinement): .reveal-header (fixed, the
   Root A drag handle), .reveal-body (the only scrolling region), and
   .reveal-footer (fixed — CTA + manage ladder always reachable). Padding
   lives on the regions, not the card, so the body's scrollbar sits at the
   card edge and never under the footer controls. */
.reveal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-fill);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.reveal-header {
  flex: 0 0 auto;
  padding: 12px 16px 6px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0;
}

.reveal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 6px 16px;
  /* Narrow scrollbar — same treatment as .vision-workspace-content, so a
     Windows/Edge classic 17px bar can't eat the body's text column. */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.reveal-body::-webkit-scrollbar { width: 8px; }
.reveal-body::-webkit-scrollbar-track { background: transparent; }
.reveal-body::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 8px; }

.reveal-footer {
  flex: 0 0 auto;
  padding: 8px 16px 12px 16px;
  border-top: 1px solid var(--border);
}

/* Room in the footer's bottom-left corner for the new resize handle
   (2026-09-11) — same reservation pattern as the header's right-side
   button cluster below. Root A only: :has() naturally scopes this to cards
   that actually carry the handle, so Root B's footer is untouched. */
.reveal-card:has(.reveal-resize-handle-bl) > .reveal-footer {
  padding-left: 30px;
}

/* Room in the header for the top-right button cluster so header text
   never runs under it. Root B's full card carries only
   .reveal-header-collapse, sitting in the same corner slot
   .link-status-dismiss alone would use; Root A also injects that dismiss
   ×, so .reveal-header-collapse shifts left (rule below) and this
   reservation widens to clear both. Sized empirically against the
   buttons' real rendered footprint (a Playwright collision check). */
.reveal-card:has(.reveal-header-collapse) > .reveal-header {
  padding-right: 48px;
}

.reveal-card:has(> .link-status-dismiss) > .reveal-header {
  padding-right: 88px;
}

/* Root A only: the header is the drag handle. touch-action:none keeps a
   touch drag from scrolling the page; the buttons inside are excluded from
   drag start in app.js and stay ordinary keyboard-reachable buttons. */
.shot-card-reveal .reveal-header[data-reveal-drag-handle] {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.shot-card-reveal.is-dragging .reveal-header[data-reveal-drag-handle] {
  cursor: grabbing;
}

/* Root A only: two resize handles, bottom-right (original) and bottom-left
   (mirrored) — dragging the panel's default top-right position toward the
   viewer's left edge is common enough now that only one lower corner isn't
   enough. Both sit in the footer's corner padding — never over a footer
   control, never over the body scrollbar — and share every visual property
   except which corner they occupy and which way the resize cursor and glyph
   point. */
.reveal-resize-handle {
  position: absolute;
  bottom: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  touch-action: none;
  opacity: 0.7;
}

.reveal-resize-handle-br {
  right: 0;
  cursor: nwse-resize;
  border-radius: 0 0 8px 0;
}

.reveal-resize-handle-bl {
  left: 0;
  cursor: nesw-resize;
  border-radius: 0 0 0 8px;
}

.reveal-resize-handle::before {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 10px;
  height: 10px;
}

.reveal-resize-handle-br::before {
  right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 2px 0;
}

.reveal-resize-handle-bl::before {
  left: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 0 2px;
}

.reveal-resize-handle:hover,
.reveal-resize-handle:focus-visible {
  opacity: 1;
  color: var(--accent-primary);
}

.reveal-resize-handle:focus-visible,
.reveal-details-toggle:focus-visible,
.overlay-rail button:focus-visible,
.mobile-toolstrip button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

/* Progressive disclosure: intent, extra findings, trip consistency and
   alternates live here, closed by default. */
.reveal-details-toggle {
  display: inline-block;
  margin: 0 0 8px 0;
  padding: 2px 0;
  border: none;
  background: transparent;
  color: var(--accent-primary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.reveal-details {
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.reveal-details[hidden] {
  display: none;
}

.reveal-details-section {
  margin-top: 6px;
}

/* Planned intent in the details group is normal prose — the label class
   below is the only thing that gets label styling. */
.reveal-intent-full .reveal-intent-text {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.reveal-header strong {
  color: var(--accent-primary);
}

/* 2026-09-04 height fix: always-reachable collapse control, positioned
   like the dismiss × it sits beside (both absolute on .reveal-card) rather
   than as a flex sibling of the header text — a flex layout here fought
   the dismiss ×'s own absolute positioning for the same corner and the two
   controls visually overlapped (caught by an explicit collision check, not
   assumed). The manage ladder's own Collapse button (bottom of the card)
   is exactly what goes unreachable when the card overflows; this is the
   control that's never behind that scroll. */
.reveal-header-collapse {
  position: absolute;
  top: 10px;
  right: 12px; /* Root B: the only top-right button, same slot dismiss alone would use */
}

/* Root A also carries the dismiss × in that corner — shift left to clear
   it instead of sharing the slot. */
.reveal-card:has(> .link-status-dismiss) .reveal-header-collapse {
  right: 50px;
}

.reveal-confidence {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.reveal-consistency {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 10px;
}

.reveal-preview {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  background: var(--accent-light);
  border-radius: 8px;
  margin-bottom: 10px;
}

.reveal-preview-body {
  min-width: 0;
  flex: 1;
}

.reveal-card-desc {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.reveal-planned {
  margin: 3px 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Label styling reaches ONLY the row label (2026-09-04): the old
   `.reveal-planned span` selector also caught the planned-intent body span
   and rendered a full sentence as an uppercase, letter-spaced label. */
.reveal-planned > .reveal-planned-label {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

/* 2026-09-04 height fix: planned_intent was the single biggest height cost
   (~6 unclamped lines). Same max-height:Nem + overflow:hidden clamp
   .guided-card-body already uses; line-height is set explicitly (rather
   than inherited) so 2 lines is an exact 2×, not a guess against whatever
   ambient line-height this element would otherwise inherit — the same
   category of "computed value doesn't match a guessed number" bug that
   broke #shot-card-reveal's height. */
.reveal-intent-text {
  display: block;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
}

.reveal-intent-text.reveal-intent-expanded {
  max-height: none;
}

.reveal-intent-toggle {
  display: block;
  margin-top: 2px;
  border: none;
  background: transparent;
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.reveal-intent-toggle[hidden] {
  display: none;
}

/* Narrow panel (app.js toggles is-narrow under 360px): map and metadata
   stack instead of squeezing the text column. */
.shot-card-reveal.is-narrow .reveal-preview {
  flex-direction: column;
}

/* Collapsed badge inside the floating container: shrink-to-fit, and the
   same delegated drag handler moves it (the badge is its own handle —
   one implementation, not a second one). */
.shot-card-reveal > .link-status-badge {
  width: max-content;
  max-width: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.shot-card-reveal.is-dragging > .link-status-badge {
  cursor: grabbing;
}

/* Siblings of the card inside the container (closing moment, escalation
   panel) keep their natural height; the card is what flexes. */
.shot-card-reveal > .reveal-closing,
.shot-card-reveal > .escalation-panel {
  flex: 0 0 auto;
}

.reveal-map {
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.reveal-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reveal-map-pin {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-fill-strong);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 2px var(--accent-glow);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reveal-map-attr {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 8px;
  color: rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.7);
  padding: 0 2px;
  border-radius: 2px;
  pointer-events: none;
}

.reveal-score {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.reveal-score-badge {
  flex: 0 0 auto;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent-on);
  font-weight: 700;
  font-size: 0.9rem;
}

.reveal-score-content {
  flex: 1 1 auto;
  min-width: 0;
}

.reveal-score-label {
  display: block;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.reveal-findings {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.reveal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.reveal-actions button,
.reveal-actions a {
  font-size: 0.8rem;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid var(--accent-fill);
  background: transparent;
  color: var(--accent-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

/* The plan-navigation pair are real links, so they need the pill shape a
   <button> gets for free. */
.reveal-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.reveal-actions button:hover,
.reveal-actions a:hover {
  background: var(--accent-light);
}

.reveal-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

.reveal-actions .reveal-cta,
.reveal-actions .reveal-confirm {
  background: var(--accent-fill-strong);
  border-color: var(--accent-fill-strong);
  color: var(--accent-on);
  font-weight: 600;
}

.reveal-actions .reveal-cta:hover,
.reveal-actions .reveal-confirm:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Card picker — Path 2 assignment and the "Not this shot?" rematch */

.reveal-picker {
  margin: 4px 0 10px 0;
}

.reveal-picker-heading {
  margin: 0 0 6px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.reveal-picker-loading,
.reveal-picker-empty {
  margin: 4px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.reveal-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.reveal-picker-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.reveal-picker-list button:hover {
  border-color: var(--accent-fill);
  background: var(--accent-light);
}

.reveal-picker-list button:disabled {
  opacity: 0.5;
  cursor: default;
}

.reveal-picker-list .reveal-map {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}

.reveal-picker-desc {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.reveal-picker-time {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Single-select mark (Item B): selected must read differently from hover —
   hover tints, selected tints AND carries the ✓ badge + inset ring. */
.reveal-picker-list button[aria-pressed="true"] {
  border-color: var(--accent-fill);
  background: var(--accent-light);
  box-shadow: inset 0 0 0 1px var(--accent-fill);
}

.reveal-picker-list button[aria-pressed="true"] .reveal-picker-desc {
  font-weight: 600;
}

.reveal-picker-list button[aria-pressed="true"]::after {
  content: "\2713";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent-on);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Item B options 2+3 — the "none" opt-outs, grouped under a divider so the
   card list above stays the primary read and the exits sit together. */
.reveal-picker-optout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.reveal-picker-none {
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.reveal-picker-none:hover {
  border-color: var(--accent-fill);
  color: var(--accent-primary);
  background: var(--accent-light);
}

/* Option 2 still does something (seeds the 📍 pin) — a notch stronger than
   the pure exit below it. */
.reveal-picker-none[data-reveal-action="picker-none-location"] {
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

/* "Back to plans" is a step up the ladder, not an opt-out — show direction. */
.reveal-picker-none[data-reveal-action="esc-back-to-plans"]::before {
  content: "\2190\00a0";
}

/* Item B option 2 — location-only opt-out + its ⓘ disclosure. The ⓘ and its
   popover must stay in this row: the toggle handler resolves the popover via
   the button's parentElement. */
.reveal-picker-location-only {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reveal-picker-info {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-input);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.reveal-picker-info:hover,
.reveal-picker-info[aria-expanded="true"] {
  border-color: var(--accent-fill);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.reveal-picker-info-pop {
  flex: 1 1 100%;
  margin: 0;
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-fill);
  border-radius: 8px;
}

/* Quiet no-match opt-in — a nudge, never a nag */

.reveal-prompt button {
  font-size: 0.78rem;
  color: var(--accent-primary);
  background: var(--accent-light);
  border: 1px solid var(--accent-fill);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
}

.reveal-prompt button:hover {
  background: var(--accent-glow);
}

/* Closing moment — accent-fill token, no gradients */

.reveal-closing {
  background: var(--accent-fill);
  color: var(--accent-on);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.reveal-closing-headline {
  margin: 0 0 4px 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.reveal-closing-subline {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.85;
  letter-spacing: 0.06em;
}

[data-theme="dark"] .reveal-map-attr {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.55);
}

/* ── Escalation panel (Sprint 2 Item G) ─────────────────────────────────
   Stepped ladder: free stored-landmark check → analysis → manual link.
   Same accent tokens as the reveal — the panel is part of the same beat. */

.escalation-panel {
  background: var(--bg-card);
  border: 1.5px solid var(--accent-fill);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.escalation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 10px;
}

.escalation-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: esc-step;
}

.escalation-step {
  counter-increment: esc-step;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-light);
}

.escalation-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.escalation-step-title::before {
  content: counter(esc-step);
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent-on);
  font-size: 0.72rem;
  font-weight: 700;
}

.escalation-cost {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border: 1px solid var(--border-input);
  border-radius: 10px;
  padding: 1px 8px;
}

.escalation-cost-free {
  color: var(--accent-primary);
  border-color: var(--accent-fill);
}

.escalation-note {
  margin: 4px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Direct rung actions only — nested picker lists keep the
   .reveal-picker-list button chrome they already inherit. */
.escalation-step-body > button {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid var(--accent-fill);
  background: transparent;
  color: var(--accent-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

.escalation-step-body > button:hover {
  background: var(--accent-glow);
}

.escalation-step-body > button:disabled {
  opacity: 0.5;
  cursor: default;
}

.escalation-step-body > .escalation-analyze {
  background: var(--accent-fill-strong);
  border-color: var(--accent-fill-strong);
  color: var(--accent-on);
  font-weight: 600;
}

.escalation-step-body > .escalation-analyze:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Suggestion buttons wrap their landmark line onto a second row */

.escalation-suggestions button,
.escalation-plans button {
  flex-wrap: wrap;
}

.escalation-suggestion-plan {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.escalation-suggestion-landmark {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--accent-primary);
}

.escalation-plan-picker {
  margin-top: 8px;
}

/* Workspace linking affordance — promoted ABOVE the map (2026-08-07), so it
   reads as a front door: filled primary ("Browse my plans →") + quiet text
   secondary ("Help me find it"), not the old twin quiet pills. The same
   holder hosts the escalation panel / pickers when they open — its bottom
   margin is the only gap between them and the map. */

.workspace-link-trip {
  margin: 0 0 10px;
}

.workspace-link-affordance {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 2px 0;
}

.workspace-link-affordance-label {
  font-size: 0.8rem;
  color: var(--text-primary);
}

.workspace-link-affordance button {
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.workspace-link-affordance-primary {
  background: var(--accent-fill-strong);
  border: 1px solid var(--accent-fill-strong);
  color: var(--accent-on);
  font-weight: 600;
}

.workspace-link-affordance-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.workspace-link-affordance-help {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.workspace-link-affordance-help:hover {
  background: var(--accent-light);
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

/* Manual-link preview — Sprint 2.5 progressive commitment */

.link-preview {
  margin: 4px 0 10px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.link-preview-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-preview-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  object-fit: cover;
  border-radius: 6px;
}

.link-preview-target {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.link-preview-card {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.link-preview-plan {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.link-preview-context {
  margin: 8px 0 0 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.link-preview-actions {
  margin-top: 10px;
}

.link-preview-warning {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--warning-border, rgba(217, 119, 6, 0.4));
  border-radius: 6px;
  background: var(--warning-bg, rgba(217, 119, 6, 0.08));
}

.link-preview-warning[hidden] {
  display: none;
}

.link-warning-title {
  margin: 0 0 4px 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warning-text, #b45309);
}

.link-warning-reasons {
  list-style: disc;
  margin: 0;
  padding-left: 18px;
}

.link-warning-reasons li {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* Persistent link confirmation — Sprint 2.5, replaces the workspace CTA */

.workspace-link-confirmed {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-primary);
  border: 1px solid var(--accent-fill);
  border-radius: 8px;
  background: var(--accent-light);
  padding: 6px 12px;
}

/* Root A's over-image status badge — accent-light is translucent, fine on a
   card surface but muddy over the photo area; back it opaquely instead. */
.link-status-badge {
  background: color-mix(in srgb, var(--accent-fill) 12%, var(--bg-card));
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.link-confirmed-icon {
  display: inline-flex;
  color: var(--accent-primary);
}

.link-confirmed-label {
  min-width: 0;
}

.link-confirmed-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}

.link-confirmed-actions button {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.link-confirmed-actions button:hover {
  background: var(--accent-light);
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

/* Planned-position link (#5 increment 3): same banner and picker shapes, labelled as a
   planned position, never as a shot card. */
.position-kind-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
}

.position-link-context {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.position-link-confirmed.is-unavailable {
  border-color: var(--border-input);
  background: var(--bg-card);
}

.position-link-confirmed.is-unavailable .link-confirmed-icon,
.position-link-confirmed.is-unavailable .position-kind-tag {
  color: var(--color-warning);
}

.position-link-confirmed [data-position-link-error],
.position-link-saved {
  flex-basis: 100%;
  margin: 0;
}

.position-pick-icon {
  display: inline-flex;
  color: var(--accent-primary);
}

.position-picker-plan {
  font-weight: 400;
  color: var(--text-secondary);
}

.position-draft-section {
  margin-top: 12px;
}

.position-suggestions {
  margin-top: 12px;
}

.position-suggestion-context,
.position-suggestion-reasons {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.position-suggestion-reasons {
  color: var(--accent-primary);
}

.position-link-replacing {
  font-weight: 600;
}

.reveal-picker-list button:focus-visible,
.link-confirmed-actions button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* "What changed?" — declared state + the sheet it opens (Deviation Phase 2a) */
.link-confirmed-declared {
  border-color: var(--accent-primary);
}

.link-deviation-summary {
  flex-basis: 100%;
  font-weight: 600;
  color: var(--accent-primary);
  overflow-wrap: anywhere;
}

.link-deviation-sheet {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--accent-fill);
}

.link-deviation-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-deviation-notes textarea {
  font: inherit;
  resize: vertical;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-input);
  background: var(--bg-card);
  color: var(--text-primary);
}

.link-deviation-error {
  margin: 0;
  color: var(--warning-text);
}

/* Item F: dismiss control on Root A's status badge — hides the over-image
   overlay without touching link state. */
.link-status-dismiss {
  margin-left: auto;
}

/* 2026-09-04 height fix: the collapsed badge's own expand control — see
   renderLinkStatusBadge. margin-left:auto (like .link-status-dismiss
   above) groups both at the flex row's right edge once this one claims the
   leftover space; the dismiss button injected after it just follows. */
.link-status-expand {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.link-status-expand:hover {
  color: var(--accent-primary);
}

/* Change B (2026-09-02): the dismiss × injected into the full card
   (.reveal-card) — Root A's settled-link render is no longer only the
   compact badge, so it needs an anchor point that isn't the badge's flex
   row (margin-left:auto above does nothing outside that flex context). */
.reveal-card > .link-status-dismiss {
  position: absolute;
  top: 10px;
  right: 12px;
  margin-left: 0;
}

.coaching-focus-btn[hidden] {
  display: none;
}

/* Expanded confirmed-card link management — Sprint 2.5 Part 2, Item 4.
   Mirrors .link-confirmed-actions (Part 1's compact indicator) so the two
   surfaces read as one visual language; kept understated on purpose — this
   is a management surface, not a primary CTA. */

.reveal-link-manage {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.reveal-link-manage-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.reveal-link-manage-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

/* Alternates strip (Change D, 2026-09-02) — a hint, not a picker: small,
   dashed (vs. the manage ladder's solid buttons), scrolls horizontally
   rather than growing the card. */

.reveal-alternates-inner {
  margin-top: 8px;
}

.reveal-alternates-heading {
  margin: 0 0 4px 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reveal-alternates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.reveal-alternate-btn {
  flex: 0 0 auto;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px dashed var(--border-input);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.reveal-alternate-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

/* Escalation rung 4 — manual location entry (Sprint 2.5) */

.escalation-location-input {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 7px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
}

.escalation-location-input:focus {
  outline: none;
  border-color: var(--accent-fill);
}

.escalation-location-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.escalation-location-actions button {
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid var(--accent-fill);
  background: transparent;
  color: var(--accent-primary);
}

.escalation-location-actions .escalation-location-save {
  background: var(--accent-fill-strong);
  border-color: var(--accent-fill-strong);
  color: var(--accent-on);
  font-weight: 600;
}

.escalation-location-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

.escalation-location-error {
  color: var(--warning-text, #b45309);
}

.escalation-location-saved .reveal-map {
  width: 120px;
  height: 80px;
  margin: 6px 0;
}

/* ── Map on Upload (2026-07-14) — analyze-surface location map ─────────────
   Provider-abstracted Leaflet map in the Vision Workspace's Location &
   Conditions section. Theme-aware via the shared design tokens. */
/* The search pill, floating top-left on the map in .vision-map-overlay
   (2026-11-03). 360px, not the planner's 220px: the placeholder is longer. */
.vision-map-toolbar {
  flex: 0 1 360px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 8px 4px 14px;
  box-shadow: var(--shadow-md);
}
.vision-location-map {
  width: 100%;
  height: 260px;
  transition: height 0.2s ease;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.map-expandable.expanded .vision-location-map {
  height: 520px;
}

.vision-map-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
/* Standing estimate ring (visual tweaks pass, audit/estimate-ring;
   re-anchored to the STANDING coord by Prompt 3): a translucent-orange halo
   around the linked card's planned standing position — "you stood somewhere
   in this area," refined by the 📷/🧍 pins placed on top of it. A ring, not
   a pin-dot, so it never reads as a fourth marker. Recolored
   to the Aperture accent orange (was --muted/grey — read as too faint
   against the map): --accent-fill-strong is the app's canonical orange
   accent token, already theme-correct (amber-orange in light, warm amber in
   dark — shared.css :root / [data-theme="dark"]). The dotted look itself is
   the Leaflet layer's own dashArray (updateEstimateRing) — CSS only owns
   color here. Non-interactivity is likewise set on the Leaflet layer itself
   — CSS alone can't undo SVG pointer-events for an interactive path. */
.vision-map-estimate-ring {
  stroke: var(--accent-fill-strong);
  stroke-opacity: 0.9;
  fill: var(--accent-fill-strong);
  fill-opacity: 0.18;
}
/* 50 m severity circle around the planned subject: a solid hairline, so it
   reads as a measuring boundary beside the dotted standing ring. */
.vision-map-subject-threshold {
  stroke: var(--accent-fill-strong);
  stroke-opacity: 0.7;
  fill: none;
}
/* Two-tier confidence (Prompt 3, audit/analysis-linking-and-ring-anchor):
   low-confidence variant for cards with NO real planned standing position —
   planned_shooter_source 'anchor_fallback', the coord is just the location
   anchor, so the ring is a guess. Warm terracotta: the accent orange
   (#E0821A light / #D4862A dark) shifted red-ward and muted — deliberately
   NOT alarm red. Pairs with the wider 200m radius set in updateEstimateRing
   so the two cases differ in size AND color: tight orange = trust it, big
   terracotta = rough guess, refine it. */
.vision-map-estimate-ring--fallback {
  stroke: #C65D3B;
  stroke-opacity: 0.85;
  fill: #C65D3B;
  fill-opacity: 0.14;
}
[data-theme="dark"] .vision-map-estimate-ring--fallback {
  stroke: #C4674A;
  fill: #C4674A;
}
/* Discipline pulse (Build 3, audit/estimate-ring — concept v3): when a
   placed pin lands within threshold of ITS planned coord, that MARKER
   pulses — a bold orange halo + subtle scale on the divIcon's inner dot,
   4 beats × 1.4s ≈ 5.6s. Read-only (see maybeFireDisciplinePulse in
   app.js — never snaps/moves/writes a coord). Applied to the inner
   .vision-map-pin-dot, NEVER the .leaflet-marker-icon element — Leaflet
   positions markers via an inline transform there, and animating transform
   on it would stomp the pin's position. The halo is ink overflow around a
   20px dot well inside the map, so no ancestor clip can touch it (the
   lesson from the retired map-frame overlay approach). Distinct from the
   suggested-pin pulse (vision-map-pin-pulse, opacity-only): a discipline
   pulse only ever fires on an authoritative placement, never a suggested
   one, so the two can't collide on one element. */
.vision-pin-discipline-pulse {
  animation: visionPinDisciplinePulse 1.4s ease-in-out 4;
}
@keyframes visionPinDisciplinePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 0 10px rgba(224, 130, 26, 0.45), 0 0 22px 8px rgba(224, 130, 26, 0.9);
  }
}
.vision-discipline-pulse-message {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 1100; /* above Leaflet panes (400) and the ring/pins */
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent-fill-strong);
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.vision-discipline-pulse-message-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Pin (divIcon): a white-filled circle, colored border by role/state — a
   solid confirmed border, or a "suggested, confirm me" muted/pulsing border
   until the user drags/confirms/searches. Circle + center iconAnchor (see
   locationPinIcon/subjectPinIcon) replaces the old rotated-teardrop shape,
   which anchored at its rotated bottom tip — a mismatch between the visual
   point and the true coordinate that showed up as misaligned/overlapping
   pins when the two were close together (final cleanup pass, 2026-08-04). */
.vision-map-pin-dot {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #3A342A; /* the dot stays white over light tiles in both themes */
  border: 3px solid #2F7D4F;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.vision-map-ghost-pin .vision-map-pin-dot { border-color: var(--color-success); }
.vision-map-ghost-pin-subject .vision-map-pin-dot { border-color: var(--accent-fill); }
.vision-map-ghost-pin-faded { opacity: 0.6; }
.vision-map-ghost-pin-faded .vision-map-pin-dot { border-style: dashed; background: rgb(255 255 255 / 0.7); }
.vision-map-moved-line { stroke: var(--color-success); stroke-linecap: round; }
.vision-map-moved-label-wrap { background: none; border: none; }
.vision-map-moved-label {
  display: inline-block;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgb(40 32 18 / 0.15);
}
.vision-map-sight-planned { stroke: var(--text-secondary); stroke-opacity: 0.7; }
.vision-map-sight-faded { stroke-opacity: 0.3; }
.vision-map-sight-hidden { display: none; }
.vision-map-unchanged-wrap { background: none; border: none; }
.vision-map-unchanged-chip {
  display: inline-block;
  transform: translate(-50%, 20px);
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgb(40 32 18 / 0.15);
}
/* Analyze's light --border is the field border (alias at the top of this file); the shared light-surface pin is the page one. */
[data-theme="dark"] :is(.vision-map-toolbar, .vision-pin-toolbar, .vision-map-legend, .vision-pins-toggle, .vision-map-moved-label, .vision-map-unchanged-chip) { border-color: var(--border-input); }
.vision-pins-toggle {
  position: absolute;
  left: 10px;
  bottom: 28px;
  z-index: 800;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}
.vision-pins-toggle button {
  min-height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font: 500 0.75rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
}
.vision-pins-toggle button[aria-pressed="true"] { background: var(--accent-fill); color: var(--accent-on); font-weight: 600; }
.vision-pins-toggle button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
@media (max-width: 480px) { .vision-pins-toggle button { min-height: 36px; } }
.vision-map-pin-selected .vision-map-pin-dot {
  box-shadow: 0 0 0 4px rgba(224, 130, 26, 0.35), 0 1px 4px rgba(0, 0, 0, 0.4);
}
/* The × on a selected pin; app.js unhides it. */
.vision-pin-x {
  position: absolute;
  left: 24px;
  top: -14px;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #262626;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font: 500 14px/1 inherit;
}
.vision-pin-x[hidden] { display: none; }
/* Subject (📷) pin: same shape/provenance model as the standing pin, distinct
   confirmed border color (--accent-fill-strong, the planner's SUBJECT_PIN
   color) so the two stay visually distinct even overlapping. Declared BEFORE
   .vision-map-pin-suggested below so equal-specificity source order lets the
   suggested (muted/pulse) rule win when a subject is both. */
.vision-map-pin-subject .vision-map-pin-dot {
  border-color: #E0821A;
}
/* Location (📍) pin: the coarse/public area anchor — third, distinct color
   (--color-warning) so it never reads as either the standing or subject
   pin, even coincident (EXIF-seeded default). Declared before
   .vision-map-pin-suggested for the same suggested-wins-when-both reason
   as the subject rule above. */
.vision-map-pin-location .vision-map-pin-dot {
  border-color: #3A342A;
}
.vision-map-pin-suggested .vision-map-pin-dot {
  border-color: #8A8171;
  animation: vision-map-pin-pulse 1.4s ease-in-out infinite;
}
@keyframes vision-map-pin-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
/* ══════════════════════════════════════════════════════════════════════
   Analyze Photo location flow (corrective pass, 2026-08-04). Flat, always-
   expanded body content — no collapsible wrapper. Layout/DOM order/sizing
   from design-mocks/design_handoff_analyze_location_2/README.md; behavior
   (disabled-until-deleted arming, docked search) is the verified fix and
   overrides the mockup where the two conflict. Tokens only, both themes.
   ══════════════════════════════════════════════════════════════════════ */

/* 1. Notice: single warning surface, visible only while no location is set
   (hides the instant hasStandingCoord() is true — the stepper row becomes
   the receipt, nothing replaces it). Carries the sole "Auto-fill from
   photo" trigger + info popover. */
.vision-location-notice[hidden] {
  display: none;
}
.vision-location-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-warning) 35%, transparent);
}
.vision-location-notice-text {
  flex: 1;
  min-width: 220px;
  font-size: 0.84rem;
  color: var(--text-primary);
}
.vision-location-notice-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vision-autofill-btn {
  padding: 7px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-input);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.vision-autofill-btn:hover:not(:disabled) {
  border-color: var(--accent-fill);
}
.vision-autofill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.vision-detect-info-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 900;
  width: 290px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
}
.vision-detect-info-title {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 5px;
}
.vision-detect-info-body {
  display: block;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Pin toolbar: the click-to-arm surface, a column of 44px white circles
   bottom-right on the map, lifted above Leaflet's attribution line (28px = its
   ~18px height + the 10px gap) with tooltips opening to its left. Literal
   colours: these sit on map tiles, which stay light in both themes.
   data-state: empty | armed (orange) | placed (green check badge) | locked
   (link badge, set by a linked shot card). The tooltip is the button's
   ::after so it shows on hover and keyboard focus, and still works while the
   button is aria-disabled. */
.vision-pin-toolbar {
  position: absolute;
  right: 10px;
  bottom: 28px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vision-pin-tool {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #FFFFFF;
  color: #6B6355;
  box-shadow: 0 1px 3px rgba(40, 32, 18, 0.12), 0 6px 16px rgba(40, 32, 18, 0.12);
  cursor: pointer;
  font-family: inherit;
}
.vision-pin-tool:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 6px 16px rgba(40, 32, 18, 0.12);
}
.vision-pin-tool[data-state="placed"] { color: #3A342A; }
.vision-pin-tool[data-state="armed"] {
  background: #E0821A;
  color: #111111;
}
.vision-pin-tool[data-state="locked"] {
  background: #F4EFE6;
  color: #8A8171;
  cursor: not-allowed;
}
.vision-pin-tool-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  background: #2F7D4F;
  color: #FFFFFF;
}
.vision-pin-tool[data-state="locked"] .vision-pin-tool-badge { background: #6B6355; }
.vision-pin-tool-badge[hidden] { display: none; }
.vision-pin-tool::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.vision-pin-tool:hover::after,
.vision-pin-tool:focus-visible::after { opacity: 1; }

/* Legend: bottom-left, lifted above the attribution (it spans the full width
   on phones), collapsed to a "Legend" button; expanded it lists only
   what the map is currently drawing. Same light surface as the toolbar. The
   swatches reuse the real pin classes so colours can't drift. */
.vision-map-legend {
  position: absolute;
  left: 10px;
  bottom: 28px;
  z-index: 800;
  max-width: calc(100% - 84px);
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-size: 12px;
}
.vision-map-legend-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.vision-map-legend-btn:hover { background: var(--bg-secondary); }
.vision-map-legend-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Minimize: .a22-ctl, pinned in the corner. */
.vision-map-legend-min {
  position: absolute;
  top: 5px;
  right: 6px;
}
.vision-map-legend-list {
  list-style: none;
  margin: 0;
  padding: 2px 12px 10px;
}
.vision-map-legend-list[hidden] { display: none; }
.vision-map-legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  line-height: 1.3;
}
.vision-legend-swatch {
  flex: none;
  width: 24px;
  display: flex;
  justify-content: center;
}
.vision-legend-swatch .vision-map-pin-dot {
  width: 22px;
  height: 22px;
  border-width: 2px;
  box-shadow: none;
  animation: none;
}
.vision-legend-line {
  width: 22px;
  border-top: 2px dashed #64748b;
}
.vision-legend-ring {
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px dotted var(--accent-fill-strong);
  background: color-mix(in srgb, var(--accent-fill-strong) 18%, transparent);
}
.vision-legend-ring--50 {
  border: 1.5px solid var(--accent-fill-strong);
  background: none;
}

/* Status line under the map: one icon + value per point. */
.vision-pin-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  line-height: 18px;
}
.vision-pin-status-icon { display: inline-flex; }

.vision-location-map-hero .vision-location-map {
  height: 340px;
}
/* One row floating over the map, as planner.css's .plans-world-map-header:
   left clears Leaflet's topleft zoom; the row ignores the pointer so its gaps
   still pan the map, its children take it back. */
.vision-map-overlay {
  position: absolute;
  top: 10px;
  left: 54px;
  right: 10px;
  z-index: 800;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.vision-map-overlay > * { pointer-events: auto; }
.vision-map-top-bar-controls {
  flex-shrink: 0;
  margin-left: auto;
}
.vision-map-top-row { display: flex; align-items: center; gap: 6px; }
/* Phone: search takes the full top row; zoom and the column start beneath it. */
@media (max-width: 480px) {
  .vision-map-overlay { left: 10px; flex-wrap: wrap; }
  .vision-map-toolbar { flex-basis: 100%; }
  .vision-location-map-hero .leaflet-top.leaflet-left { top: 46px; }
  .vision-location-map-hero .vision-map-hint-pill { top: 128px; }
}
/* Absolutely positioned elsewhere (shared.css); here it's a flex item
   beside Standard|Google. */
.vision-map-top-bar-controls .map-expand-btn {
  position: static;
  top: auto;
  right: auto;
}
/* Search box: a plain flex layout, no background/border/radius/shadow of its
   own — .vision-map-toolbar supplies the pill surface. */
.vision-map-search-box {
  flex: 1;
  min-width: 0;
  position: relative; /* anchors .vision-map-search-results below it */
  display: flex;
  align-items: center;
  gap: 8px;
}
/* PART 1c: now a real <button> (was a decorative <span>), moved to the
   right of the input — reset the default button chrome so it still just
   reads as a glyph, with a hover/focus affordance since it's clickable now. */
.vision-map-search-icon {
  flex: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  line-height: 1;
  border-radius: var(--radius-sm, 4px);
}
.vision-map-search-icon:hover,
.vision-map-search-icon:focus-visible {
  color: var(--text-primary);
}
.vision-map-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.86rem;
  outline: none;
  padding: 6px 0;
  font-family: inherit;
}
.vision-map-search-input::placeholder {
  color: var(--text-muted);
}
/* PART 1d: Chrome's autofill heuristics treat this field as an address
   field (id/placeholder both mention "location"/"address") and force-paint
   a light autofill background the instant it's focused/typed into,
   completely ignoring the `background: transparent` above — the "white
   box" bug. autocomplete="off" on the input (app.html) stops most of it;
   this is the standard defeat for the rest: an absurdly long background-
   color transition so the forced fill color never becomes visible, plus
   -webkit-text-fill-color so the (still dark-surface) text stays readable
   through it. Firefox has no equivalent forced-fill mechanism, so this is
   a no-op there. */
.vision-map-search-input:-webkit-autofill,
.vision-map-search-input:-webkit-autofill:hover,
.vision-map-search-input:-webkit-autofill:focus,
.vision-map-search-input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 5000s ease-in-out 0s;
}
.vision-map-search-set-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-success);
  white-space: nowrap;
  padding-right: 8px; /* matches the mockup's inline value exactly */
}
/* Results drop as an anchored dropdown below the search pill — a transient,
   user-triggered overlay (only while results exist), not persistent chrome. */
.vision-map-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vision-map-search-results[hidden] {
  display: none;
}
.vision-map-search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.84rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  font-family: inherit;
}
.vision-map-search-result:hover {
  border-color: var(--accent-fill);
}
.vision-map-search-result-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vision-map-search-result-hint {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}
/* Status row (FIX 1) — "Searching…" / no-match / typed-error copy. Same box
   treatment as .vision-map-search-result so it reads as part of the same
   dropdown. The failure variant is dismissable (PART 1a — a stale banner
   must never be stuck on screen) via .vision-map-search-status-close; the
   transient "Searching…" render has no close button (nothing to dismiss,
   it clears itself). */
.vision-map-search-status {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.82rem;
  box-shadow: var(--shadow-md);
  gap: 8px;
}
.vision-map-search-status-text {
  flex: 1;
  min-width: 0;
}
.vision-location-nudge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.82rem;
}
.vision-location-nudge-text { flex: 1; min-width: 0; }
.vision-location-nudge[hidden],
.vision-location-nudge-action[hidden] { display: none; }
.vision-location-nudge-action {
  flex: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent-primary);
  cursor: pointer;
}

/* Contextual hint pill: what the next map tap does, centred just below the
   top control row. Hidden whenever nothing is armed. */
.vision-map-hint-pill[hidden] {
  display: none;
}
.vision-map-hint-pill {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: var(--accent-fill-strong);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  box-shadow: 0 8px 24px rgba(40, 32, 18, 0.18);
  white-space: nowrap;
  pointer-events: none;
}
.vision-map-hint-pill span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-on);
}

/* Mini accordion: Conditions / Intent & Session (header restyle only) /
   What analysis found. */
.vision-mini-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  /* overflow:hidden zeroes this flex item's automatic min-height, so in the
     scrollable .vision-workspace-content column it gets flex-shrunk to its
     header row instead of pushing the container into scroll — pin it. */
  flex-shrink: 0;
}
.vision-mini-accordion--section.vision-mini-accordion--analyzed {
  border-color: color-mix(in srgb, var(--color-success) 35%, transparent);
}
.vision-mini-accordion-header,
.vision-mini-accordion-header-legacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
}
.vision-mini-accordion-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.vision-mini-accordion-title {
  font-size: 0.82rem;
  font-weight: 700;
}
.vision-mini-accordion-summary {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vision-mini-accordion-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.vision-mini-accordion-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent-on-tint, var(--accent-primary));
  white-space: nowrap;
}
.vision-mini-accordion-badge--neutral {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.vision-mini-accordion-badge--warning {
  background: color-mix(in srgb, var(--color-warning) 12%, transparent);
  color: var(--color-warning);
}
.vision-mini-accordion-badge--success {
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
  color: var(--color-success);
}
.vision-mini-accordion-chevron {
  color: var(--text-muted);
}
.vision-mini-accordion-chevron,
.collapsible-chevron { margin-right: 4px; }
.vision-map-search-result-name svg,
.vision-autofill-btn svg,
.vision-map-search-set-badge svg,
.vision-analysis-complete-chip svg { vertical-align: -2px; }
.vision-map-search-result-name svg { margin-right: 6px; }
.vision-mini-accordion-body[hidden] {
  display: none;
}
.vision-mini-accordion-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.vision-mini-accordion-body.vision-mini-accordion-body--flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vision-mini-accordion-body.vision-mini-accordion-body--flow[hidden] {
  display: none;
}
.vision-findings-row {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  line-height: 1.55;
}
.vision-findings-row-label {
  flex-shrink: 0;
  width: 74px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.vision-findings-row-value {
  color: var(--text-primary);
}
.vision-findings-empty {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Sticky footer — modal-level, always visible regardless of which
   accordion is open. #vision-save-location-btn keeps its id; see the
   dedicated rule below (an ID selector, to outrank the legacy shared
   #vision-save-context-btn/#vision-gear-add-btn group above). */
.vision-workspace-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.vision-workspace-footer > .rerun-warning {
  flex: 1 1 100%;
  margin: 0;
}
.vision-workspace-footer-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.vision-workspace-footer-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.vision-workspace-skip-btn {
  padding: 9px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.vision-workspace-skip-btn:hover {
  border-color: var(--accent-fill);
}
#vision-save-location-btn.vision-workspace-save-btn {
  padding: 9px 22px;
  border-radius: var(--radius-lg);
  border: none;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  transition: background 0.15s ease, color 0.15s ease;
}
#vision-save-location-btn.vision-workspace-save-btn:not(:disabled) {
  background: var(--accent-fill-strong);
  color: var(--accent-on);
  cursor: pointer;
}
#vision-save-location-btn.vision-workspace-save-btn:not(:disabled):hover {
  background: var(--accent-hover);
}
#vision-footer-analyze-btn.vision-workspace-save-btn {
  padding: 9px 22px;
  border-radius: var(--radius-lg);
  border: none;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--accent-fill-strong);
  color: var(--accent-on);
  cursor: pointer;
}
#vision-footer-analyze-btn.vision-workspace-save-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
#vision-save-location-btn.vision-workspace-save-btn.saved {
  background: var(--color-success);
  color: #fff;
  cursor: default;
}

/* Save location, directly under the map — the link-trip affordance that
   used to share this row (space-between, two ends) was promoted above the
   map (2026-08-07), so this is now a single action row: button anchored to
   the map's right edge with its status text beside it, echoing the sticky
   footer's hint-left/action-right convention. */
.vision-under-map-row {
  margin-top: 8px;
}

/* PART 2 — visible per-section "Save location" (save-as-you-go, no
   analysis). Secondary/outline treatment — the sticky footer's
   "Save & run analysis" stays the visually primary commit; this is a
   lighter-weight, in-flow action directly under the map. */
.vision-location-only-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.vision-location-only-save-btn {
  padding: 7px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vision-location-only-save-btn:disabled {
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.vision-location-only-save-btn:not(:disabled):hover {
  border-color: var(--accent-fill);
}
.vision-location-only-save-btn.saved {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
  cursor: default;
}
/* DOM order is button → status (scripts key off both ids); order:-1 puts
   the status text visually left of the button in the right-anchored row. */
.vision-location-only-save-status {
  order: -1;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Topographic tile: the empty state only (shared.css tokens) ───────────── */
/* No image, no overlay open, not App Mode. An image (.has-preview), any open
   backdrop or App Mode unsets --app-topo and both layers go, so the image,
   overlays, shot cards, analysis and the map never sit over the tile. */
body:has(.image-viewer:not(.has-preview)):not(.app-mode-active):not(:has(:is(.vision-workspace-backdrop, .coaching-expanded-backdrop, .scores-overlay-backdrop, .chat-expanded-panel):not(.hidden))) {
  --app-topo: "";
  isolation: isolate;
}
body::before,
.hero-empty-state::before {
  content: var(--app-topo, none);
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--topo-line);
  opacity: var(--topo-o);
  -webkit-mask: url(/img/topo/ridge-tile.svg) 0 0 / 640px 640px repeat;
  mask: url(/img/topo/ridge-tile.svg) 0 0 / 640px 640px repeat;
}
.hero-empty-state { position: relative; isolation: isolate; }
.hero-empty-state::before {
  position: absolute;
  border-radius: inherit;
  opacity: var(--topo-art-o);
  --topo-fade: radial-gradient(ellipse 260px 120px at center, rgb(0 0 0 / 0.1) 60%, black);
  -webkit-mask: url(/img/topo/ridge-tile.svg) 0 0 / 640px 640px repeat, var(--topo-fade);
  -webkit-mask-composite: source-in;
  mask: url(/img/topo/ridge-tile.svg) 0 0 / 640px 640px repeat, var(--topo-fade);
  mask-composite: intersect;
}
@media print {
  body::before,
  .hero-empty-state::before { display: none; }
}
