/* survey.det.land stylesheet.
 *
 * One file by deliberate choice — kept under a single download so
 * cross-page navigation reuses the cached payload and we don't have
 * to maintain per-page <link> sets. ~5700 lines feels long but is
 * navigable via the table of contents below; jump to a section with
 * Cmd+F on the marker line.
 *
 * If/when this gets painful enough to split, the natural shape is
 * one file per logical SECTION below (auth.css, runner.css,
 * launcher.css, profile.css, dashboard.css, welcome.css,
 * builder.css, …) concatenated by a small deploy-time script so the
 * browser still gets one file. Don't split-and-load-separately —
 * we'd lose the cache win + add load-order coupling.
 *
 * ── TABLE OF CONTENTS ──────────────────────────────────────────
 *  Auth + chrome
 *    L0001  Login overlay
 *  Survey runtime (/survey)
 *    L0077  Runner panel
 *    L0407  Phase B Mapillary-centered layout
 *    L2112  Mapillary sequence-controls restyle
 *    L2192  Image-attribution caption
 *    L2631  Phase Z right-column split
 *    L2756  Per-parcel toast
 *    L2790  Survey-completion card
 *  Session launcher (/survey runtime modal)
 *    L0656  Session launcher
 *  Survey builder (/surveys/new)
 *    L1268  Survey builder modal
 *    L1833  Builder question cards
 *    L5744  Survey-new page shell
 *  Survey runtime page shell (/survey)
 *    L5824  Survey runtime page shell
 *  Profile (/profile)
 *    L2870  Profile page core
 *    L3567  Profile orgs section + create modal
 *  Welcome (/welcome)
 *    L3285  Welcome landing page
 *  Org dashboard (/orgs/{id})
 *    L3793  Org dashboard
 *    L3830  Invite UI (Slice 5)
 *    L3860  Per-member admin controls (Slice 6a)
 *    L3912  Inline edit affordances (Slice 6b)
 *  Admin console (/admin)
 *    L4175  Admin console
 *  Per-survey dashboard (/surveys/{id})
 *    L4343  Per-survey dashboard
 *    L4428  Activity feed
 *    L4696  Edit modal
 *  Session dashboard (/sessions/{id})
 *    L5159  Session dashboard
 *
 *  Line numbers above are approximate (each Slice add nudges them by
 *  a few lines). Search for the section banner comment ("/* ── X ──")
 *  for an exact jump.
 */

/* ── Login overlay ───────────────────────────────────────────────────── */
.survey-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(13, 17, 23, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}
.survey-login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    /* Slice 8 — also set visibility: hidden so the overlay is
       definitively gone even when a CSS transition gets pinned to
       its FROM frame by compositor contention (seen on
       /surveys/new where the MapLibre boot was racing the
       overlay's opacity transition). Visibility is non-animatable
       and applies instantly. */
    visibility: hidden;
}
/* SPA opt-out: page modules that show their own sign-in UI inline
 * (e.g., /welcome with its wordmark + "Continue with X" buttons)
 * add `spa-suppress-login-overlay` to <body> on mount and remove
 * it on teardown. CSS force-hides the shared overlay regardless of
 * auth state so the page's inline UI isn't covered. */
body.spa-suppress-login-overlay #login-overlay {
    display: none !important;
}

.survey-login-card {
    width: min(420px, 90vw);
    background: #fff;
    border-radius: 12px;
    padding: 28px 28px 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
    box-sizing: border-box;
}
.survey-login-card h1 {
    margin: 0 0 6px;
    font-size: 22px;
    /* WCAG 2.1 AA: #0066cc on white is ~5.1:1 in theory — clears
     * the 4.5:1 spec for normal text. axe-core under-reports the
     * contrast (~4.45:1) because the parent overlay's
     * `backdrop-filter: blur(6px)` confuses its pixel sampler.
     * font-weight: 700 makes this qualify as "large bold text"
     * (16.5pt ≥ 14pt bold) which has a 3:1 threshold instead of
     * 4.5:1, so axe-core's computed value passes either way.
     * The visual weight also reads better as a wordmark. */
    color: #0066cc;
    font-weight: 700;
}
.survey-login-card p {
    margin: 0 0 20px;
    color: #5a6470;
    font-size: 14px;
}
.survey-login-btn {
    display: block;
    width: 100%;
    padding: 11px 14px;
    margin: 8px 0;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    color: #1a1f24;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.survey-login-btn:hover:not([disabled]) {
    background: #f6f8fa;
    border-color: #0080ff;
}
.survey-login-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}
.survey-login-status {
    margin: 12px 0 0;
    min-height: 18px;
    font-size: 12px;
    color: #8893a0;
}

/* ── Runner panel (mounts inside #survey-runner above #panel-chip-row) ── */
.survey-runner-header {
    /* Position:relative so the absolutely-positioned flag icon
     * anchors to the header's top-right corner regardless of
     * which other elements (eyebrow / title / progress / banners)
     * render inside. */
    position: relative;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #eee;
}
.survey-runner-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7682;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
/* Consolidated meta line — replaces the eyebrow + survey-title
 * + boundary-in-progress trio with one compact "SURVEYING · survey ·
 * boundary" string. Reads as a small, dim header above the parcel
 * address. Leaves room for the title to dominate visually. */
.survey-runner-meta {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7682;
    /* Reserve right gutter for the flag icon (36px wide + 8px from
     * edge + 8px inner gap = 52px); otherwise long meta strings
     * collide with the icon on narrow phones. */
    padding-right: 52px;
    line-height: 1.4;
    /* Truncate cleanly on very narrow phones rather than wrap into
     * a multi-line header. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* M1 follow-up: flag affordance is an icon button in the runner
 * header's top-right corner. Visual language mirrors the Mapillary
 * toolbar buttons (.mapillary-toolbar-btn family):
 *   default → muted grey bg, neutral icon
 *   .is-on  → solid det.land-blue fill, white icon (flag panel open)
 *   hover   → subtle bg shift
 * Keeps the surveyor reading tool-state at a glance the same way
 * across both rails. */
.survey-runner-flag-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef0f3;
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #4a5260;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    z-index: 2;
}
.survey-runner-flag-icon:hover {
    background: #e3e6ea;
}
.survey-runner-flag-icon.is-on {
    background: #0080ff;
    border-color: #0080ff;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 128, 255, 0.35);
}
.survey-runner-flag-icon.is-on:hover {
    background: #0070e0;
    border-color: #0070e0;
}
.survey-runner-flag-icon:focus-visible {
    outline: 2px solid #0080ff;
    outline-offset: 2px;
}
@media (max-width: 768px), (max-height: 600px) {
    /* Bump to 44×44 hit target on touch devices per WCAG 2.1 AA. */
    .survey-runner-flag-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        /* M6: drag-handle bar occupies the top 24px of the sheet —
         * shift the flag down so it sits in the header proper
         * rather than overlapping the grabber. */
        top: 32px;
    }
}

.survey-flag-panel {
    padding: 4px 0;
}
.survey-flag-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1f24;
    margin-bottom: 12px;
}
.survey-flag-reasons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.survey-flag-reason {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1a1f24;
    cursor: pointer;
}
.survey-flag-note-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #6b7682;
}
.survey-flag-note-label textarea {
    font: inherit;
    font-size: 13px;
    color: #1a1f24;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: vertical;
}
.survey-flag-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
}
.survey-btn--flag {
    background: #dc2626;
    color: white;
    border-color: #b91c1c;
}
.survey-btn--flag:hover { background: #b91c1c; }
.survey-btn--flag:disabled { opacity: 0.6; cursor: wait; }

body.theme-dark .survey-runner-flag-btn {
    border-color: #b91c1c;
    color: #fca5a5;
}
body.theme-dark .survey-runner-flag-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}
body.theme-dark .survey-flag-title { color: #e6eaee; }
body.theme-dark .survey-flag-reason { color: #e6eaee; }
body.theme-dark .survey-flag-note-label textarea {
    background: #1c2634;
    border-color: #3b454f;
    color: #e6eaee;
}
.survey-runner-title {
    margin: 2px 0 4px;
    font-size: 18px;
    font-weight: 600;
    color: #1a1f24;
}
.survey-runner-survey {
    font-size: 13px;
    color: #5a6470;
}
.survey-runner-body {
    padding: 10px 14px;
}

.survey-question {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 10px 12px;
}
.survey-question-prompt {
    font-size: 15px;
    font-weight: 500;
    color: #1a1f24;
    margin-bottom: 8px;
    line-height: 1.35;
}
.survey-helper {
    font-size: 12px;
    color: #6b7682;
    margin-bottom: 10px;
    font-style: italic;
}

.survey-answer-row {
    display: flex;
    gap: 8px;
}
/* image_annotation question — drawn polygons + tag picker */
.survey-annotation-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.survey-annotation-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-annotation-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f3f5f7;
    border-radius: 6px;
    font-size: 13px;
}
.survey-annotation-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--anno-hue, #2563eb);
    color: white;
    font-weight: 600;
    font-size: 12px;
}
.survey-annotation-points {
    color: #6b7682;
    font-size: 12px;
    flex: 1;
}
.survey-annotation-remove {
    border: none;
    background: transparent;
    color: #b91c1c;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.survey-annotation-remove:hover:not([disabled]) { background: #fee2e2; }
.survey-annotation-empty {
    color: #6b7682;
    font-size: 12px;
    font-style: italic;
    padding: 6px 10px;
}
.survey-annotation-drawing {
    padding: 8px 10px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: #78350f;
    font-size: 13px;
    line-height: 1.4;
}
.survey-annotation-drawing strong { font-weight: 700; }
.survey-annotation-add {
    display: flex;
    gap: 8px;
    align-items: center;
}
.survey-annotation-add select,
.survey-annotation-add .survey-annotation-tag-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    font-family: inherit;
    color: inherit;
}
.survey-annotation-add .survey-annotation-tag-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.survey-btn--secondary {
    background: #f3f5f7;
}
body.theme-dark .survey-annotation-row { background: #1c252e; }
body.theme-dark .survey-annotation-empty,
body.theme-dark .survey-annotation-points { color: #9aa6b2; }
body.theme-dark .survey-annotation-add select,
body.theme-dark .survey-annotation-add .survey-annotation-tag-input {
    background: #0f1620;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .survey-annotation-drawing {
    background: #3b2f0c;
    border-color: #6b531f;
    color: #fde68a;
}
body.theme-dark .survey-btn--secondary { background: #1c252e; }
.survey-answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.survey-btn {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    color: #1a1f24;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.survey-btn:hover:not([disabled]) {
    background: #f0f4f8;
    border-color: #0080ff;
    color: #0080ff;
}
.survey-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}
/* Slice F: highlight the previously-selected value when editing an
 * already-answered question, so the surveyor sees what they had
 * chosen at a glance even before deciding to revise it. */
.survey-btn.is-current {
    background: #eef4fc;
    border-color: #2563eb;
    color: #1d4fd1;
    font-weight: 600;
}
.survey-btn.is-current:hover:not([disabled]) {
    background: #dbe7fa;
    border-color: #1d4fd1;
    color: #1d4fd1;
}
body.theme-dark .survey-btn.is-current {
    background: #1c2a3d;
    border-color: #4493d6;
    color: #cfe4f7;
}
body.theme-dark .survey-btn.is-current:hover:not([disabled]) {
    background: #233a52;
    border-color: #69b3ee;
    color: #ffffff;
}

/* multi_choice answer control: a stack of check-all-that-apply options,
 * styled to match the .survey-btn chips, plus a submit below. */
.survey-multi-form { display: flex; flex-direction: column; gap: 8px; }
.survey-answer-checks { display: flex; flex-direction: column; gap: 8px; }
.survey-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    color: #1a1f24;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.survey-check:hover { background: #f0f4f8; border-color: #0080ff; }
.survey-check input { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; flex: none; }
.survey-check:has(input:checked) {
    background: #eef4fc;
    border-color: #2563eb;
    color: #1d4fd1;
    font-weight: 600;
}
body.theme-dark .survey-check {
    background: #2a333c;
    color: #e6eaee;
    border-color: #3b454f;
}
body.theme-dark .survey-check:hover { background: #34404a; border-color: #4493d6; }
body.theme-dark .survey-check:has(input:checked) {
    background: #1c2a3d;
    border-color: #4493d6;
    color: #cfe4f7;
}

/* Slice F: edit-banner shown at the top of the runner when the
 * surveyor is revisiting an already-answered question, with a
 * Cancel button to bail out without changing anything. */
.survey-edit-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    color: var(--color-warning-fg);
    border-radius: 6px;
    font-size: 13px;
}
/* Dark variant inherits automatically via the --color-warning-*
 * tokens defined in theme.css. No body.theme-dark override needed. */

/* Slice F: review-state action row hosts both Edit-previous and
 * Submit buttons side-by-side. */
.survey-review-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}
.survey-back-row {
    margin-top: 8px;
}

/* Slice F: per-row Edit affordance in the answers summary. The
 * summary used to be display-only — now each row has a small Edit
 * button that flips the runner into edit mode for that question. */
.survey-answers-summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0;
}
.survey-answers-summary-text { flex: 1; min-width: 0; }
.survey-answer-edit {
    flex-shrink: 0;
    padding: 3px 10px;
    background: transparent;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    color: #2563eb;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.survey-answer-edit:hover:not([disabled]) {
    background: #eef4fc;
    border-color: #2563eb;
}
.survey-answer-edit[disabled] { opacity: 0.5; cursor: not-allowed; }
body.theme-dark .survey-answer-edit {
    border-color: #2f3a44;
    color: #69b3ee;
}
body.theme-dark .survey-answer-edit:hover:not([disabled]) {
    background: #1c2a3d;
    border-color: #4493d6;
}

.survey-text-form { display: flex; flex-direction: column; gap: 8px; }
.survey-text-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}

.primary-btn {
    padding: 10px 14px;
    border: 1px solid #0080ff;
    background: #0080ff;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.primary-btn:hover:not([disabled]) { background: #0070e0; }
.primary-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: #0080ff;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}

.survey-state-card {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 14px;
}
.survey-state-card.success {
    background: #e8f5ee;
    border-color: #a3d3b6;
    color: #0a4d2a;
}
.survey-state-card strong { display: block; margin-bottom: 6px; }
.survey-state-card p { margin: 0 0 12px; color: #5a6470; }

/* Edit-prune confirm — shown when re-answering an earlier question lands on a
 * different branch and would clear later answers (A: edit invalidates
 * downstream). Amber to flag the destructive clear. */
.survey-prune-confirm {
    background: #fff8ec;
    border: 1px solid #f0c674;
    border-radius: 8px;
    padding: 14px;
}
.survey-prune-confirm-title { font-weight: 700; margin-bottom: 6px; color: #7a4f01; }
.survey-prune-confirm-msg { margin: 0 0 12px; color: #5a6470; font-size: 0.92em; line-height: 1.45; }
.survey-prune-confirm-actions { display: flex; gap: 8px; }
.survey-prune-confirm-actions button { flex: 1; }
.secondary-btn {
    background: #fff;
    color: #1a2a3a;
    border: 1px solid #c8cdd3;
    border-radius: 8px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.secondary-btn:hover:not([disabled]) { background: #f1f3f5; }
.secondary-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
body.theme-dark .survey-prune-confirm { background: #2a2410; border-color: #6b5a1f; }
body.theme-dark .survey-prune-confirm-title { color: #f0c674; }
body.theme-dark .secondary-btn { background: #1b2430; color: #e6eaee; border-color: #3a4654; }
body.theme-dark .secondary-btn:hover:not([disabled]) { background: #243041; }

/* Multi-year Slice C — prior-year recap card.
 *
 * Shown above the question runner when a session is multi-year and a
 * prior-year response exists for the active parcel + walking year.
 * Two-action layout: "No change" (primary, one-click clone+submit)
 * and "Yes, re-answer" (secondary, dismisses the card and reveals
 * the question runner). */
.survey-runner-recap {
    background: #eef4fc;
    border: 1px solid #c5d8ee;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #1a2a3a;
}
.survey-runner-recap-eyebrow {
    font-size: 12px;
    color: #4b5560;
    margin-bottom: 6px;
}
.survey-runner-recap-eyebrow strong {
    color: #1a2a3a;
    font-weight: 700;
}
.survey-runner-recap-answers {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.survey-runner-recap-answers li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border-bottom: 1px dashed rgba(37, 99, 235, 0.18);
}
.survey-runner-recap-answers li:last-child { border-bottom: none; }
.survey-runner-recap-answers .survey-runner-recap-prompt {
    color: #4b5560;
    flex: 1;
}
.survey-runner-recap-answers .survey-runner-recap-value {
    color: #1a2a3a;
    font-weight: 600;
}
.survey-runner-recap-empty {
    color: #6b7682;
    font-style: italic;
    margin-bottom: 12px;
}
.survey-runner-recap-question {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1a2a3a;
    text-align: center;
}
.survey-runner-recap-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
/* Prior-year answers, now collapsed below the buttons (B: buttons-first). */
.survey-runner-recap-details {
    margin-top: 10px;
    border-top: 1px solid rgba(37, 99, 235, 0.18);
    padding-top: 8px;
}
.survey-runner-recap-details > summary {
    cursor: pointer;
    font-size: 12px;
    color: #5a6470;
    list-style: revert;
}
.survey-runner-recap-details[open] > summary { margin-bottom: 6px; }
body.theme-dark .survey-runner-recap-details { border-top-color: rgba(120,160,230,0.25); }
body.theme-dark .survey-runner-recap-details > summary { color: #9aa6b2; }

/* C — dataset-mode quick-fill card on "Something changed". */
.survey-quickfill {
    background: #eef6ff;
    border: 1px solid #b6d4f5;
    border-radius: 8px;
    padding: 14px;
}
.survey-quickfill-eyebrow {
    font-size: 11px;
    font-weight: 700;
    color: #1971c2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}
.survey-quickfill-stat { font-size: 12px; color: #5a6470; margin: 6px 0 12px; text-align: center; }
.survey-quickfill-actions { display: flex; flex-direction: column; gap: 8px; }
body.theme-dark .survey-quickfill { background: #14233a; border-color: #2f4a6b; }
body.theme-dark .survey-quickfill-eyebrow { color: #6ab0f3; }
body.theme-dark .survey-quickfill-stat { color: #9aa6b2; }
.survey-runner-recap-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #c5d8ee;
    background: #fff;
    color: #1a2a3a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.survey-runner-recap-btn:hover:not([disabled]) {
    background: #f3f5f7;
}
.survey-runner-recap-btn--no-change {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.survey-runner-recap-btn--no-change:hover:not([disabled]) { background: #1d4fd1; }
.survey-runner-recap-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
body.theme-dark .survey-runner-recap {
    background: #1c2a3d;
    border-color: #2c3e57;
    border-left-color: #4493d6;
    color: #e6eaee;
}
body.theme-dark .survey-runner-recap-eyebrow { color: #9aa6b2; }
body.theme-dark .survey-runner-recap-eyebrow strong { color: #e6eaee; }
body.theme-dark .survey-runner-recap-answers li {
    border-bottom-color: rgba(68, 147, 214, 0.20);
}
body.theme-dark .survey-runner-recap-answers .survey-runner-recap-prompt { color: #9aa6b2; }
body.theme-dark .survey-runner-recap-answers .survey-runner-recap-value { color: #e6eaee; }
body.theme-dark .survey-runner-recap-question {
    color: #e6eaee;
    border-top-color: rgba(68, 147, 214, 0.20);
}
body.theme-dark .survey-runner-recap-btn {
    background: #1c252e;
    border-color: #2c3e57;
    color: #e6eaee;
}
body.theme-dark .survey-runner-recap-btn:hover:not([disabled]) { background: #2a3340; }
body.theme-dark .survey-runner-recap-btn--no-change { background: #4493d6; border-color: #4493d6; color: #fff; }
body.theme-dark .survey-runner-recap-btn--no-change:hover:not([disabled]) { background: #3478b8; }

/* Slice H (revised): no-imagery years auto-skip silently — no card
 * needed. The viewer's date stamp + a brief toast convey the skip.
 * The dropped card classes are intentionally not preserved as a
 * stub. */

.survey-answers-summary {
    margin-top: 14px;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 13px;
}
.survey-answers-summary summary {
    cursor: pointer;
    color: #5a6470;
    font-weight: 500;
}
.survey-answers-summary ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #1a1f24;
}
.survey-answers-summary li { margin: 4px 0; }
.survey-photo-tally {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7682;
}

/* Property-history timeline (runner context). A clock icon in the header
 * (mirrors the flag icon) drops this panel down over the body; lazy-loaded
 * + cached on first open. */
.survey-runner-timeline-icon {
    position: absolute;
    top: 8px;
    right: 52px;   /* left of the flag icon (8 + 36 + 8) */
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef0f3;
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #4a5260;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    z-index: 2;
}
.survey-runner-timeline-icon svg { width: 19px; height: 19px; }
.survey-runner-timeline-icon:hover { background: #e3e6ea; }
.survey-runner-timeline-icon.is-on {
    background: #0080ff;
    border-color: #0080ff;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 128, 255, 0.35);
}
.survey-runner-timeline-icon:focus-visible { outline: 2px solid #0080ff; outline-offset: 2px; }
@media (max-width: 768px), (max-height: 600px) {
    .survey-runner-timeline-icon { width: 44px; height: 44px; top: 32px; right: 60px; }
    .survey-runner-timeline-icon svg { width: 22px; height: 22px; }
}
.survey-runner-timeline-dropdown {
    position: absolute;
    top: 100%;
    left: 8px;
    right: 8px;
    margin-top: -4px;
    z-index: 6;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 26px rgba(20, 30, 45, 0.20);
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px 12px 12px;
}
.survey-runner-timeline-dhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a96a3;
    margin-bottom: 8px;
}
.survey-runner-timeline-close {
    border: none; background: transparent; font-size: 18px; line-height: 1;
    color: #98a3b0; cursor: pointer; padding: 0 2px;
}
.survey-runner-timeline-note { font-size: 12.5px; color: #8a96a3; padding: 4px 0 6px; }
.survey-runner-timeline-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.survey-runner-timeline-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 999px; background: #f1f4f8; color: #3b4654;
}
.survey-runner-timeline-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.survey-runner-timeline-feed { list-style: none; margin: 0; padding: 0; position: relative; }
.survey-runner-timeline-feed::before {
    content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: #eef1f4;
}
.survey-runner-timeline-row {
    position: relative; padding: 6px 0 6px 22px; cursor: pointer;
    display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline;
}
.survey-runner-timeline-row + .survey-runner-timeline-row { border-top: 1px solid #f4f6f8; }
.survey-runner-timeline-node {
    position: absolute; left: 1px; top: 10px; width: 11px; height: 11px;
    border-radius: 50%; border: 2px solid #fff;
}
.survey-runner-timeline-yr { font-size: 11px; font-weight: 700; color: #98a3b0; }
.survey-runner-timeline-label { font-size: 13px; font-weight: 600; color: #1a1f24; line-height: 1.25; }
.survey-runner-timeline-detail {
    display: none; grid-column: 2; font-size: 12px; color: #5b6672; line-height: 1.35; margin-top: 3px;
}
.survey-runner-timeline-row.is-open .survey-runner-timeline-detail { display: block; }
.survey-runner-timeline-more {
    margin-top: 8px; width: 100%; text-align: center; background: #f1f4f8; border: none;
    border-radius: 6px; padding: 7px; font: inherit; font-size: 12px; font-weight: 600;
    color: #3b4654; cursor: pointer;
}

/* ── Property facts block — sits above the chronological event feed.
 * Same visual language as the timeline rows (subtle borders, muted
 * keys, accent badges for the tier chip) so the two read as one card.
 */
.survey-runner-facts {
    display: grid;
    row-gap: 5px;
    padding: 8px 0 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eef1f4;
}
.survey-runner-facts-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: 10px;
    align-items: baseline;
    font-size: 12.5px;
    line-height: 1.4;
}
.survey-runner-facts-key {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a96a3;
}
.survey-runner-facts-val {
    color: #1a1f24;
    font-weight: 500;
    word-break: break-word;
}
.survey-runner-facts-val--warn { color: #b25500; font-weight: 600; }

/* Ownership tier badge — colored by tier the same way confidence
 * chips elsewhere are. Compact pill, inline with the value. */
.survey-runner-facts-tier {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    background: #eef2f6;
    color: #3b4654;
    border: 1px solid transparent;
    vertical-align: 2px;
}
.survey-runner-facts-tier--high   { background: #e2f3ea; color: #1e6b3f; border-color: #c7e6d3; }
.survey-runner-facts-tier--medium { background: #fff3d6; color: #8a5a00; border-color: #f2dca6; }
.survey-runner-facts-tier--low    { background: #fde2e1; color: #94322c; border-color: #f0c5c2; }
.survey-runner-facts-tier--public { background: #e0e9f4; color: #2a4a73; border-color: #c4d4e8; }

/* Inline status tag — sits next to the value (e.g. "mail to parcel"
 * after PRE %, "brand-new owner" after a fresh sale). */
.survey-runner-facts-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 4px;
    background: #f1f4f8;
    color: #5b6672;
    vertical-align: 1px;
}
.survey-runner-facts-tag--ok    { background: #e2f3ea; color: #1e6b3f; }
.survey-runner-facts-tag--warn  { background: #fde2e1; color: #94322c; }
.survey-runner-facts-tag--fresh { background: #e0e9f4; color: #2a4a73; }

/* Dark theme — the existing det.land theme-enhancements.js sets
 * body.theme-dark. Mirror our light-mode classes. */
body.theme-dark .survey-login-card {
    background: #1f262d;
    color: #e6eaee;
}
body.theme-dark .survey-login-card p { color: #9aa6b2; }
body.theme-dark .survey-login-btn {
    background: #2a333c;
    color: #e6eaee;
    border-color: #3b454f;
}
body.theme-dark .survey-login-btn:hover:not([disabled]) {
    background: #34404a;
    border-color: #4493d6;
    color: #e6eaee;
}
body.theme-dark .survey-runner-title { color: #f0f3f6; }
body.theme-dark .survey-runner-survey { color: #9aa6b2; }
body.theme-dark .survey-question,
body.theme-dark .survey-state-card,
body.theme-dark .survey-answers-summary {
    background: #232c34;
    border-color: #2f3a44;
    color: #e6eaee;
}
body.theme-dark .survey-question-prompt { color: #e6eaee; }
body.theme-dark .survey-runner-timeline-icon { background: #2a333c; border-color: #3b454f; color: #cdd5dd; }
body.theme-dark .survey-runner-timeline-icon:hover { background: #34404a; }
body.theme-dark .survey-runner-timeline-icon.is-on { background: #0080ff; border-color: #0080ff; color: #fff; }
body.theme-dark .survey-runner-timeline-dropdown { background: #232c34; border-color: #2f3a44; }
body.theme-dark .survey-runner-timeline-chip { background: #2b3640; color: #cdd5dd; }
body.theme-dark .survey-runner-timeline-feed::before { background: #2f3a44; }
body.theme-dark .survey-runner-timeline-row + .survey-runner-timeline-row { border-top-color: #2a333c; }
body.theme-dark .survey-runner-timeline-node { border-color: #232c34; }
body.theme-dark .survey-runner-timeline-label { color: #e6eaee; }
body.theme-dark .survey-runner-timeline-detail { color: #9aa6b2; }
body.theme-dark .survey-runner-facts { border-bottom-color: #2f3a44; }
body.theme-dark .survey-runner-facts-key { color: #7a8694; }
body.theme-dark .survey-runner-facts-val { color: #e6eaee; }
body.theme-dark .survey-runner-facts-val--warn { color: #f0a05a; }
body.theme-dark .survey-runner-facts-tier { background: #2b3640; color: #cdd5dd; }
body.theme-dark .survey-runner-facts-tier--high   { background: #1d3a2a; color: #7ddca0; border-color: #28523b; }
body.theme-dark .survey-runner-facts-tier--medium { background: #3d3018; color: #f0c971; border-color: #5a4626; }
body.theme-dark .survey-runner-facts-tier--low    { background: #3d1f1f; color: #f0a5a0; border-color: #5a2c2c; }
body.theme-dark .survey-runner-facts-tier--public { background: #1f2d3d; color: #a0c4f0; border-color: #2c425a; }
body.theme-dark .survey-runner-facts-tag { background: #2b3640; color: #9aa6b2; }
body.theme-dark .survey-runner-facts-tag--ok    { background: #1d3a2a; color: #7ddca0; }
body.theme-dark .survey-runner-facts-tag--warn  { background: #3d1f1f; color: #f0a5a0; }
body.theme-dark .survey-runner-facts-tag--fresh { background: #1f2d3d; color: #a0c4f0; }
body.theme-dark .survey-runner-timeline-more { background: #2b3640; color: #cdd5dd; }
body.theme-dark .survey-state-card.success {
    background: #1f2d24;
    border-color: #2c4234;
    color: #c8e6d3;
}
body.theme-dark .survey-btn {
    background: #2a333c;
    color: #e6eaee;
    border-color: #3b454f;
}
body.theme-dark .survey-btn:hover:not([disabled]) {
    background: #34404a;
    border-color: #4493d6;
    color: #e6eaee;
}
body.theme-dark .survey-text-form textarea {
    background: #1f272f;
    color: #e6eaee;
    border-color: #3b454f;
}

/* ── Phase B: Mapillary-centered layout ──────────────────────────────────
 *
 * Earlier this rule hid `#panel-body` while survey mode was active, on
 * the theory that surveyors don't need the parcel detail content
 * (permits, sales, blight). It turned out to break Mapillary: the
 * shared selection-panel.js reparents `#mapillary-container` into
 * `#mobile-mapillary-slot` *inside* `#panel-body` whenever a parcel is
 * selected — that's how det.land shows the viewer as part of the
 * parcel card. Hiding panel-body took the Mapillary container with it.
 *
 * For now the parcel detail content stays visible; surveyors get
 * orientation chrome plus the runner above it. A cleaner version of
 * the layout pivot will need to either (a) move the runner OUT of the
 * sidebar so it can coexist with parcel chrome, or (b) target only
 * the bigquery-rendered detail rows inside panel-body (leaving the
 * mapillary slot intact).
 */

/* Hide the legend in swap mode so it stops covering the map PiP. */
body.survey-active.sv-swapped #map-legend,
body.survey-active.sv-swapped #legend-toggle-btn {
    display: none !important;
}

/* Survey brand chip — replaces det.land's floating-header (which had
 * the home button + search). Same visual language as det.land's home
 * button (white pill, blue bold text) so the brand reads identically;
 * just narrower because there's no search input next to it. The whole
 * chip is a single button — clicking it flies the map back to the
 * overview center.
 */
#survey-brand-chip {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    pointer-events: none;
}
#survey-brand-chip > * { pointer-events: auto; }

#survey-brand-chip #home-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 10px;
    background: #ffffff;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #0080ff;
    font-family: inherit;
    font-size: 20px;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}
#survey-brand-chip #home-button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.16);
}
#survey-brand-chip .survey-brand-icon {
    flex: 0 0 auto;
    color: #0080ff;
    width: 20px;
    height: 20px;
}

body.theme-dark #survey-brand-chip #home-button {
    background: #1f262d;
    color: #6db5ff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
body.theme-dark #survey-brand-chip .survey-brand-icon {
    color: #6db5ff;
}

/* Survey-settings popover (opens from the brand chip). For now its only
 * entry toggles the on-screen debug log. */
.survey-settings-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(20, 30, 45, 0.18);
    padding: 10px 12px;
    z-index: 1001;
}
.survey-settings-popover[hidden] { display: none; }
.survey-settings-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a96a3;
    margin-bottom: 8px;
}
.survey-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1f24;
    cursor: pointer;
}
.survey-settings-row input { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; flex: none; }
body.theme-dark .survey-settings-popover { background: #1f262d; border-color: #2f3a44; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
body.theme-dark .survey-settings-title { color: #9aa6b2; }
body.theme-dark .survey-settings-row { color: #e6eaee; }

/* Push the floating info chip below the brand chip so they don't
 * overlap when both are visible. */
.survey-info-chip {
    top: 60px;
}

/* Hide the floating-viewer's title bar in two cases:
 *
 *   1. body.survey-mode.sv-swapped — Mapillary is full-bleed; the bar
 *      would read as a white stripe across the top of the canvas.
 *      Users still have a path back to map-big via #map-pip-chrome.
 *
 *   2. body.survey-active — in-session survey runtime, on every
 *      viewport. The header chrome (Detroit Street View title, History
 *      pill, Gallery pill, Swap, Minimize) serves no purpose during a
 *      walk: year is dictated by the schedule (not History), swapping
 *      is disabled (rule below), and minimizing would hide the surface
 *      the surveyor needs. On mobile the 32px strip especially wasted
 *      vertical space inside the 65%-tall imagery pane.
 */
body.survey-mode.sv-swapped .floating-viewer-header,
body.survey-active .floating-viewer-header {
    display: none !important;
}

/* Reclaim the 32px the floating-viewer-header used to occupy when
 * we hide it. theme-enhancements.js (line ~1627) pushes
 * #mapillary-viewer down by `top: 32px` and constrains its height to
 * `calc(100% - 32px)` so the canvas sits below the header. With the
 * header hidden, that offset leaves a 32px strip of the container's
 * white background showing at the top. Override in both hide
 * conditions so the canvas fills the container edge-to-edge.
 */
body.survey-mode.sv-swapped #mapillary-container.floating-viewer #mapillary-viewer,
body.survey-active #mapillary-container.floating-viewer #mapillary-viewer {
    top: 0 !important;
    height: 100% !important;
}
body.survey-mode.sv-swapped #mapillary-container.floating-viewer #mapillary-spinner,
body.survey-active #mapillary-container.floating-viewer #mapillary-spinner {
    top: 50% !important;
}

/* "No swapping in survey-mode" applies on every viewport — the
 * surveyor never has a reason to flip map↔panorama mid-walk. Kill
 * both swap buttons + the map-PiP chrome that hosts one of them.
 * The desktop split-layout uses these same rules, so this also
 * supersedes the duplicates that previously lived inside the
 * `@media (min-width: 769px)` block below (now removed).
 */
body.survey-active #map-pip-chrome,
body.survey-active .floating-viewer-swap-btn,
body.survey-active .map-pip-swap-btn {
    display: none !important;
}

/* ── Mapillary viewer toolbar — vertical icon rail on the right edge,
 * mirrors the map's icon rail pattern. Icon-only square buttons in a
 * vertical stack so the user reads each one by hover-tooltip; nothing
 * competes with Mapillary's own `< >` sequence arrows at the top or
 * the brand chip at the top-left. ID + !important pins display so
 * the cascade can't collapse children of #mapillary-container in any
 * survey-* layout. */
.mapillary-toolbar,
#mapillary-toolbar {
    /* Mirror the existing `#icon-rail` pattern exactly so the
     * Mapillary toolbar reads as the same UI family as the map's
     * vertical icon rail. Base: pinned 10px from the top + right of
     * the viewport. Two overrides below cascade for the account-chip
     * and sidebar-visible states (same as #icon-rail does). */
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
    pointer-events: none;
}
/* Slide DOWN below the Dexter account chip — same offset as
 * `body.has-account-chip #icon-rail { top: 54px; }` so the two
 * rails line up vertically when both are on screen. */
body.has-account-chip .mapillary-toolbar,
body.has-account-chip #mapillary-toolbar {
    top: 54px !important;
}
/* Slide LEFT off the sidebar's inner edge in any layout that has
 * a visible right sidebar — sidebar-visible (det.land flow) or
 * survey-active (this app's session layout). Same calc the icon-
 * rail uses; --sidebar-width is set globally and defaults to 380px
 * (matches the deployed `.account-chip` rule). */
body.sidebar-visible .mapillary-toolbar,
body.sidebar-visible #mapillary-toolbar,
body.survey-active .mapillary-toolbar,
body.survey-active #mapillary-toolbar {
    right: calc(var(--sidebar-width, 380px) + 10px) !important;
}
.mapillary-toolbar > * { pointer-events: auto; }
.mapillary-toolbar-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #e0e6ed;
    background: #fff;
    color: #1a2a3a;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.mapillary-toolbar-btn:hover {
    background: #f5f7fa;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
}
.mapillary-toolbar-btn.is-off {
    /* Toggle-off state — slightly grey bg, neutral icon. Reads as
     * "muted / inactive" at a glance. No blue highlight. */
    color: #4a5260;
    background: #eef0f3;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}
.mapillary-toolbar-btn.is-on {
    /* Toggle-on state — solid det.land blue fill, white icon.
     * Reads unmistakably as "active" against the white / grey
     * inactive states. */
    color: #ffffff;
    background: #0080ff;
    border-color: #0080ff;
    box-shadow: 0 2px 10px rgba(0, 128, 255, 0.35);
}
.mapillary-toolbar-btn.is-on:hover {
    background: #0070e0;
    border-color: #0070e0;
}
.mapillary-toolbar-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
/* The Map-toggle button only makes sense on mobile, where the map
 * is hidden by default and needs an explicit affordance to reveal.
 * On desktop the split-screen always shows both, so the button is
 * dead weight. Hide it via a viewport rule below (kept here as a
 * base default so the button stays accessible if a future layout
 * resurfaces it). */
.mapillary-toolbar-btn--mobile-only { display: none; }
@media (max-width: 768px), (max-height: 600px) {
    .mapillary-toolbar-btn--mobile-only { display: inline-flex; }
}

.mapillary-toolbar-btn-label {
    /* Icon-only rail — hide any text label that ships in the markup. */
    display: none !important;
}
body.theme-dark .mapillary-toolbar-btn {
    background: #1c252e;
    color: #e6eaee;
    border-color: #2a3340;
}
body.theme-dark .mapillary-toolbar-btn:hover { background: #2a3340; }
body.theme-dark .mapillary-toolbar-btn.is-off {
    background: #0f1620;
    color: #9aa6b2;
}

/* ── Annotation panel (toolbar action) ───────────────────────────────
 * Icon-rail-style strip opened by the Annotate toolbar button.
 * Mirrors #icon-rail's elevated-card visuals (rounded corners,
 * shadow, tokenized colors) so the surveyor reads the toolbar +
 * panel as one UI family.
 *
 * Three render states from annotation-tools.js's renderPanel():
 *   - tools:    [ point ] [ polygon ]              (default)
 *   - drawing:  "Click vertices…" + cancel icon    (mid-draw)
 *   - tagging:  [ name input ] [ ✓ ] [ × ]         (post-draw)
 * Plus a vertical list of saved annotations below the tools row.
 *
 * Positioned just to the LEFT of the toolbar (uses the same
 * sidebar-aware right offset). See `.mapillary-toolbar` above —
 * the !important on BOTH the base right + the survey-active
 * override is load-bearing; without it the panel ends up at the
 * viewport's right edge, hidden behind #details-sidebar.
 */
.mapillary-annotation-panel {
    position: fixed !important;
    top: 10px !important;
    right: 56px !important;
    /* Sits left of the toolbar (36px wide + 10px gap = 46px →
     * +10 internal gap = 56px from viewport right at base).
     * With account chip on, drop to align with the toolbar's
     * shifted-down position. */
    z-index: 1100;
    display: none !important;
    flex-direction: column;
    gap: var(--space-1, 4px);
    padding: var(--space-1, 4px);
    background: var(--color-bg-elevated, #fff);
    border-radius: var(--radius-lg, 8px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.15));
    font-family: inherit;
    color: var(--color-fg-primary, #1a2a3a);
    /* Slide-in: starts shifted right (collapsed into the toolbar),
     * eases out when .is-open is added. */
    transform: translateX(8px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform var(--motion-base, 0.2s) ease,
        opacity var(--motion-base, 0.2s) ease;
}
.mapillary-annotation-panel.is-open {
    display: flex !important;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}
body.has-account-chip .mapillary-annotation-panel { top: 54px !important; }
body.sidebar-visible .mapillary-annotation-panel,
body.survey-active .mapillary-annotation-panel {
    /* Toolbar at right: calc(sidebar + 10) + toolbar width 36 +
     * 10px inter-element gap = sidebar + 56. Same load-bearing
     * !important as the toolbar override. */
    right: calc(var(--sidebar-width, 380px) + 56px) !important;
}

/* Horizontal row inside the panel — used for the tool picker,
 * the drawing hint, and the tagging prompt. */
.anno-panel-row {
    display: flex;
    align-items: center;
    gap: var(--space-1, 4px);
}
.anno-panel-drawing-row,
.anno-panel-tag-row {
    padding: 4px 6px;
}
.anno-panel-drawing-hint {
    font-size: 12px;
    color: var(--color-fg-secondary, #6b7682);
    white-space: nowrap;
    padding-right: 4px;
}

/* Icon button — same dimensions / hover semantics as
 * .icon-rail-button in theme.css so the panel reads as part of
 * the rail family. */
.anno-panel-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md, 6px);
    color: var(--color-fg-secondary, #6b7682);
    cursor: pointer;
    padding: 0;
    transition:
        background-color var(--motion-fast, 0.15s),
        color var(--motion-fast, 0.15s);
}
.anno-panel-icon-btn:hover {
    background-color: var(--color-bg-hover, #f3f5f7);
    color: var(--color-fg-primary, #1a2a3a);
}
.anno-panel-icon-btn:focus-visible {
    outline: 2px solid var(--color-accent, #2563eb);
    outline-offset: 2px;
}
.anno-panel-icon-btn--commit { color: var(--color-success-accent); }
.anno-panel-icon-btn--commit:hover {
    background-color: color-mix(in srgb, var(--color-success-accent) 12%, transparent);
    color: var(--color-success-fg);
}
.anno-panel-icon-btn--cancel { color: var(--color-danger-accent); }
.anno-panel-icon-btn--cancel:hover {
    background-color: color-mix(in srgb, var(--color-danger-accent) 10%, transparent);
    color: var(--color-danger-fg);
}
.anno-panel-icon-btn--remove {
    width: 24px;
    height: 24px;
    color: var(--color-danger-accent);
}
.anno-panel-icon-btn--remove:hover {
    background-color: color-mix(in srgb, var(--color-danger-accent) 10%, transparent);
}

/* Tag input — small inline field that appears post-draw. */
.anno-panel-tag-input {
    flex: 1;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--color-border-strong, #d0d7de);
    border-radius: var(--radius-md, 6px);
    background: var(--color-bg-base, #fff);
    font-size: 13px;
    font-family: inherit;
    color: var(--color-fg-primary, #1a2a3a);
}
.anno-panel-tag-input:focus {
    outline: none;
    border-color: var(--color-accent, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Saved-annotations list — compact, sits below the tool row.
 * Hidden when empty (renderPanel returns '' for the section). */
.anno-panel-list {
    list-style: none;
    margin: 4px 0 0 0;
    padding: 4px 0 0 0;
    border-top: 1px solid var(--color-border, #e6eaee);
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
}
.anno-panel-list-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    font-size: 12px;
}
.anno-panel-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--anno-hue, #2563eb);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dark theme overrides — mirror what theme.css does for the
 * icon-rail. The tokens above pick up the dark values
 * automatically; these are the few raw colors that need to flip. */
body.theme-dark .anno-panel-tag-input {
    background: #0f1620;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .anno-panel-list { border-top-color: #2a3340; }

/* ── Annotation preview-confirm modal ────────────────────────────────
 * Centered overlay shown after the surveyor finishes drawing a
 * geometry. The crop preview lets them confirm the polygon actually
 * captured the feature they meant — name + save commits, cancel
 * deletes the geometry from the viewer. Backdrop click = cancel.
 *
 * Higher z-index than #icon-rail / sidebar / annotation panel since
 * it should sit ABOVE all other survey chrome while up.
 */
.anno-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 20px;
    animation: anno-modal-fade-in 0.18s ease;
}
@keyframes anno-modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
.anno-modal {
    background: var(--color-bg-elevated, #fff);
    color: var(--color-fg-primary, #1a2a3a);
    border-radius: var(--radius-lg, 8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.40);
    width: min(420px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
    animation: anno-modal-pop-in 0.20s cubic-bezier(0.2, 0.8, 0.4, 1);
}
@keyframes anno-modal-pop-in {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.anno-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border, #e6eaee);
    font-size: 14px;
}
.anno-modal-header strong { text-transform: capitalize; }
.anno-modal-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--color-fg-secondary, #6b7682);
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    padding: 0;
    transition: background-color var(--motion-fast, 0.15s);
}
.anno-modal-close:hover { background: var(--color-bg-hover, #f3f5f7); color: var(--color-fg-primary, #1a2a3a); }
.anno-modal-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1620;
    min-height: 200px;
    padding: 12px;
}
.anno-modal-preview[data-state="loading"] .anno-modal-preview-image,
.anno-modal-preview[data-state="loading"] .anno-modal-preview-error,
.anno-modal-preview[data-state="ready"] .anno-modal-spinner,
.anno-modal-preview[data-state="ready"] .anno-modal-preview-error,
.anno-modal-preview[data-state="error"] .anno-modal-spinner,
.anno-modal-preview[data-state="error"] .anno-modal-preview-image {
    display: none;
}
.anno-modal-preview-image {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-repeat: no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30);
}
.anno-modal-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    animation: anno-modal-spin 0.8s linear infinite;
}
@keyframes anno-modal-spin { to { transform: rotate(360deg); } }
.anno-modal-preview-error {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    text-align: center;
    padding: 24px 16px;
}
.anno-modal-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 0;
}
.anno-modal-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-fg-secondary, #6b7682);
    font-weight: 600;
}
.anno-modal-input {
    padding: 9px 12px;
    border: 1px solid var(--color-border-strong, #d0d7de);
    border-radius: var(--radius-md, 6px);
    background: var(--color-bg-base, #fff);
    color: var(--color-fg-primary, #1a2a3a);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--motion-fast, 0.15s), box-shadow var(--motion-fast, 0.15s);
}
.anno-modal-input:focus {
    outline: none;
    border-color: var(--color-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.anno-modal-input--invalid {
    border-color: #b91c1c;
    animation: anno-modal-shake 0.32s ease;
}
@keyframes anno-modal-shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}
.anno-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 16px 16px;
}
.anno-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md, 6px);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition:
        background-color var(--motion-fast, 0.15s),
        color var(--motion-fast, 0.15s),
        border-color var(--motion-fast, 0.15s);
}
.anno-modal-btn--ghost {
    background: transparent;
    border-color: var(--color-border-strong, #d0d7de);
    color: var(--color-fg-secondary, #6b7682);
}
.anno-modal-btn--ghost:hover { background: var(--color-bg-hover, #f3f5f7); color: var(--color-fg-primary, #1a2a3a); }
.anno-modal-btn--primary {
    background: var(--color-accent, #2563eb);
    color: #fff;
}
.anno-modal-btn--primary:hover { background: #1d4fd1; }

body.theme-dark .anno-modal-preview { background: #0a0f15; }
body.theme-dark .anno-modal-header { border-bottom-color: #2a3340; }
body.theme-dark .anno-modal-close { color: #9aa6b2; }
body.theme-dark .anno-modal-close:hover { background: #2a3340; color: #e6eaee; }
body.theme-dark .anno-modal-input {
    background: #0f1620;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .anno-modal-btn--ghost {
    border-color: #2a3340;
    color: #9aa6b2;
}
body.theme-dark .anno-modal-btn--ghost:hover { background: #2a3340; color: #e6eaee; }

/* Hide the "Viewing: Parcels / Neighborhoods" mode pill on
 * survey.det.land. Its top-left position collides with the survey
 * brand chip — the surveying flow is parcel-only at the zoom levels
 * surveyors operate at, so the mode indicator adds no value here.
 */
body.survey-mode .viewing-mode-chip {
    display: none !important;
}

/* Floating property info chip — Phase B-3.
 * Anchored to the page (not the Mapillary canvas). */
.survey-info-chip {
    position: fixed;
    top: 60px;
    left: 16px;
    z-index: 850;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    line-height: 1.4;
    color: #222;
    max-width: min(360px, 40vw);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.survey-info-chip.visible {
    opacity: 1;
    transform: translateY(0);
}
.survey-info-chip-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    margin-bottom: 2px;
}
.survey-info-chip-address {
    font-size: 14px;
    font-weight: 600;
    color: #1a1f24;
}
.survey-info-chip-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #5a6470;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.survey-info-chip-meta > span + span::before {
    content: "·";
    margin-right: 8px;
    color: #b8c0c8;
}

/* Mapillary popup card content (survey-mode replacement for the old
 * blue lightbulb SimpleMarker). Mapillary's PopupComponent wraps our
 * DOM in `.mapillary-popup-content` + a tip — we just style what's
 * inside. Compact 4-line address card.
 */
.survey-mapillary-popup {
    min-width: 180px;
    max-width: 240px;
    color: #1a1f24;
    line-height: 1.35;
}
.survey-mapillary-popup-eyebrow {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0080ff;
    margin-bottom: 2px;
}
.survey-mapillary-popup-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1f24;
}
.survey-mapillary-popup-highlights {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}
.survey-mapillary-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.survey-mapillary-popup-label {
    color: #6b7682;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
    align-self: center;
}
.survey-mapillary-popup-value {
    color: #1a1f24;
    font-weight: 600;
    text-align: right;
}
/* The SDK paints a white default background on `.mapillary-popup-content`
 * but its border-radius is small — round it a bit and add a soft shadow
 * to match the rest of the survey chrome. */
body.survey-mode .mapillary-popup-content {
    border-radius: 8px !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18) !important;
    padding: 10px 12px !important;
}

body.theme-dark .survey-info-chip {
    background: rgba(34, 41, 49, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e6eaee;
}
body.theme-dark .survey-info-chip-eyebrow { color: #9aa6b2; }
body.theme-dark .survey-info-chip-address { color: #f0f3f6; }
body.theme-dark .survey-info-chip-meta { color: #9aa6b2; }
body.theme-dark .survey-info-chip-meta > span + span::before { color: #4a5560; }

@media (max-width: 768px), (max-height: 600px) {
    .survey-info-chip { display: none; }
}

/* ── Phase C: Session launcher ─────────────────────────────────────────
 *
 * Empty-state CTA — a centered card overlay over the map, dimming
 * the surroundings. Visible only when (signed in && no parcel
 * selected && no active session). Designed to direct the user into
 * the session flow rather than sit as a passive button.
 */
.session-launcher-cta {
    position: fixed;
    inset: 0;
    z-index: 870;
    background: rgba(13, 17, 23, 0.18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none; /* let map underneath stay clickable for free-explore */
}
.session-launcher-cta[hidden] { display: none; }

.session-launcher-cta-card {
    pointer-events: auto;
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    padding: 28px 28px 22px;
    text-align: center;
    box-sizing: border-box;
    animation: session-launcher-cta-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes session-launcher-cta-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.session-launcher-cta-icon {
    color: #0080ff;
    margin-bottom: 8px;
}
.session-launcher-cta-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: #1a1f24;
}
.session-launcher-cta-sub {
    margin: 0 0 22px;
    font-size: 14px;
    line-height: 1.5;
    color: #5a6470;
}
.session-launcher-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: #0080ff;
    color: #fff;
    border: none;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 128, 255, 0.32);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease,
                transform 0.15s ease;
}
.session-launcher-cta-btn:hover {
    background: #0070e0;
    box-shadow: 0 6px 18px rgba(0, 128, 255, 0.42);
    transform: translateY(-1px);
}
.session-launcher-cta-btn:active { transform: translateY(0); }

/* Slice 7.5 — Resume previous session list inside the CTA card.
   One row per active session, each is its own card with metadata +
   action buttons. */
.session-launcher-cta-resume {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d9dee4;
    width: 100%;
    box-sizing: border-box;
}
.session-launcher-cta-resume[hidden] { display: none; }
.session-launcher-cta-resume-label {
    font-size: 12px;
    color: #6b7682;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.session-launcher-cta-resume-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.session-launcher-cta-resume-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
}
.session-launcher-cta-resume-row-meta {
    flex: 1;
    min-width: 0;
}
.session-launcher-cta-resume-row-where {
    font-size: 14px;
    font-weight: 600;
    color: #1a1f24;
    margin-bottom: 2px;
}
.session-launcher-cta-resume-row-detail {
    font-size: 12px;
    color: #6b7682;
}
.session-launcher-cta-resume-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.session-launcher-cta-resume-btn {
    background: #fff;
    border: 1px solid #0080ff;
    color: #0080ff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.session-launcher-cta-resume-btn:hover {
    background: rgba(0, 128, 255, 0.08);
}
.session-launcher-cta-resume-dismiss {
    background: none;
    border: none;
    color: #6b7682;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.session-launcher-cta-resume-dismiss:hover { color: #1a1f24; }
body.theme-dark .session-launcher-cta-resume { border-top-color: #2a3340; }
body.theme-dark .session-launcher-cta-resume-label { color: #9aa6b2; }
body.theme-dark .session-launcher-cta-resume-row {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .session-launcher-cta-resume-row-where { color: #e6eaee; }
body.theme-dark .session-launcher-cta-resume-row-detail { color: #9aa6b2; }
body.theme-dark .session-launcher-cta-resume-btn {
    background: transparent;
    border-color: #6db5ff;
    color: #6db5ff;
}
body.theme-dark .session-launcher-cta-resume-btn:hover {
    background: rgba(109, 181, 255, 0.12);
}
body.theme-dark .session-launcher-cta-resume-dismiss { color: #9aa6b2; }
body.theme-dark .session-launcher-cta-resume-dismiss:hover { color: #e6eaee; }

body.theme-dark .session-launcher-cta {
    background: rgba(13, 17, 23, 0.45);
}
body.theme-dark .session-launcher-cta-card {
    background: #1f262d;
}
body.theme-dark .session-launcher-cta-title { color: #f0f3f6; }
body.theme-dark .session-launcher-cta-sub { color: #9aa6b2; }
body.theme-dark .session-launcher-cta-icon { color: #6db5ff; }

/* Launcher v2 — left-rail panel that slides in from the left. The
 * right side of the viewport stays the live map (Slice B will dim
 * unrelated chrome and add boundary/parcel preview shading). */
.session-launcher-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(460px, 90vw);
    z-index: 1900;
    background: #fff;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    animation: session-launcher-slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.session-launcher-panel[hidden] { display: none; }

/* Slice C2 — autoStart loading state.
 *
 * Slice 8 originally hid the panel entirely while autoStart created
 * the session ("Start a session" from the dashboard skips the wizard
 * and drops the user directly on a parcel). But the full transition
 * runs 2–5 seconds across survey-fetch + centroid scan + lease query
 * + Firestore write + map flyTo + Mapillary picker. A blank wait
 * felt frozen.
 *
 * Now we keep the panel mounted, hide the wizard sections, and show
 * a clean centered loading card whose label mirrors setStatus()'s
 * progression: "Loading survey config…" → "Mapping N parcels…" →
 * "Coordinating with team…" → "Creating session…" → "Loading first
 * parcel…". Hits the same modal real estate but with helpful copy
 * instead of dead air.
 */
.session-launcher-panel--auto-running .session-launcher-header,
.session-launcher-panel--auto-running .session-launcher-body,
.session-launcher-panel--auto-running .session-launcher-actions {
    display: none;
}
.session-launcher-auto-loading {
    display: none;
}
.session-launcher-panel--auto-running .session-launcher-auto-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    min-height: 220px;
}
.session-launcher-auto-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e1e8ef;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: session-launcher-auto-loading-spin 1s linear infinite;
}
.session-launcher-auto-loading-label {
    font-size: 14px;
    font-weight: 500;
    color: #1a2a3a;
    text-align: center;
}
@keyframes session-launcher-auto-loading-spin {
    to { transform: rotate(360deg); }
}
body.theme-dark .session-launcher-auto-loading-spinner {
    border-color: #3b454f;
    border-top-color: #6db5ff;
}
body.theme-dark .session-launcher-auto-loading-label { color: #e6eaee; }
@keyframes session-launcher-slide-in {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

.session-launcher-header {
    padding: 18px 20px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    flex: 0 0 auto;
}
.session-launcher-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7682;
    margin-bottom: 4px;
}
.session-launcher-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1f24;
    line-height: 1.25;
}
.session-launcher-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f0f4f8;
    color: #5a6470;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}
.session-launcher-close:hover { background: #e1e8ef; color: #1a1f24; }

.session-launcher-body {
    padding: 4px 20px 8px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.session-launcher-section {
    padding: 16px 0;
    border-bottom: 1px solid #f0f4f8;
}
.session-launcher-section:last-child { border-bottom: none; }
.session-launcher-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.session-launcher-section-step {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #eaf4ff;
    color: #0080ff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.session-launcher-section-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1a1f24;
}
.session-launcher-section-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #8893a0;
    font-style: italic;
    margin-left: 6px;
}
.session-launcher-section-hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: #5a6470;
    line-height: 1.5;
}

.session-launcher-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.session-launcher-field > span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* "+ Create new" pill sits inline with the SURVEY label. Hidden by
 * default (gated on /surveyAuthors membership in session-launcher.js).
 */
.session-launcher-field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.session-launcher-create-survey {
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: #0080ff;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}
.session-launcher-create-survey:hover { text-decoration: underline; }
.session-launcher-field select {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: #1a1f24;
    appearance: auto;
}
.session-launcher-field select:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.18);
}

/* Boundary chip picker */
.session-launcher-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 24px;
}
.session-launcher-chips-empty {
    font-size: 12px;
    color: #8893a0;
    font-style: italic;
    line-height: 1.5;
}
.session-launcher-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 10px;
    background: #eaf4ff;
    color: #1864ab;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.session-launcher-chip-remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(24, 100, 171, 0.15);
    color: #1864ab;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.session-launcher-chip-remove:hover {
    background: rgba(24, 100, 171, 0.3);
}
/* Slice 8 — chips pinned by the survey definition (read-only). */
.session-launcher-chip--pinned {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
    padding-right: 10px;
}
.session-launcher-chip-pin-mark {
    margin-left: 6px;
    font-size: 11px;
    opacity: 0.65;
}
body.theme-dark .session-launcher-chip--pinned {
    background: #1e2733;
    color: #cbd5e1;
    border-color: #2a3340;
}
.session-launcher-search {
    position: relative;
}
.session-launcher-search input[type="text"] {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: #1a1f24;
    box-sizing: border-box;
}
.session-launcher-search input[type="text"]:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.18);
}
.session-launcher-suggestions {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    list-style: none;
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
}
.session-launcher-suggestions[hidden] { display: none; }
.session-launcher-suggestions li {
    padding: 7px 12px;
    font-size: 13px;
    color: #1a1f24;
    cursor: pointer;
}
.session-launcher-suggestions li:hover {
    background: #f0f4f8;
    color: #0080ff;
}

/* Big count widget */
.session-launcher-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 14px 16px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.session-launcher-count[data-state="loading"] { background: #fff7ed; border-color: #fed7aa; }
.session-launcher-count[data-state="ok"] { background: #e8f5ee; border-color: #a3d3b6; }
.session-launcher-count[data-state="empty"] { background: #fef2f2; border-color: #fecaca; }
.session-launcher-count-num {
    font-size: 26px;
    font-weight: 700;
    color: #0080ff;
    font-variant-numeric: tabular-nums;
}
.session-launcher-count[data-state="ok"] .session-launcher-count-num { color: #0a4d2a; }
.session-launcher-count[data-state="empty"] .session-launcher-count-num { color: #7a1a1a; }
.session-launcher-count-label {
    font-size: 12px;
    color: #5a6470;
    line-height: 1.4;
    flex: 1 1 auto;
}
.session-launcher-compute {
    display: block;
    width: 100%;
    height: 36px;
    padding: 0 14px;
    border: 1px solid #0080ff;
    background: #fff;
    color: #0080ff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.session-launcher-compute:hover { background: #eaf4ff; }
.session-launcher-compute:disabled { opacity: 0.55; cursor: not-allowed; }

.session-launcher-status {
    margin: 8px 0 0;
    min-height: 18px;
    font-size: 12px;
    color: #6b7682;
}

.session-launcher-actions {
    padding: 14px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #eee;
    flex: 0 0 auto;
}
.session-launcher-cancel {
    padding: 9px 14px;
    border: 1px solid #d0d7de;
    background: #fff;
    color: #1a1f24;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.session-launcher-cancel:hover { background: #f6f8fa; }
.session-launcher-cancel:disabled,
.session-launcher-start:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.session-launcher-start {
    padding: 9px 16px;
    background: #0080ff;
    border: 1px solid #0080ff;
    color: #fff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.session-launcher-start:hover:not(:disabled) {
    background: #0070e0;
    border-color: #0070e0;
}

/* ── Survey builder modal (Phase F) ─────────────────────────────────
 * Visually mirrors the session-launcher modal — same overlay, card,
 * header, footer pattern. Builder-specific bits (textarea, validation
 * status, suggested-target fieldset) get their own rules below.
 */
.survey-builder-modal {
    position: fixed;
    inset: 0;
    z-index: 1950; /* sits above session-launcher-modal */
    background: rgba(13, 17, 23, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.survey-builder-modal[hidden] { display: none; }
/* Slice 8 — inline mode for the side-by-side /surveys/new layout.
   No overlay, no backdrop; the builder card stretches to fill the
   left-column form host. */
.survey-builder-modal--inline {
    position: static;
    inset: auto;
    z-index: auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    display: block;
}
.survey-builder-modal--inline .survey-builder-card {
    width: 100%;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
    border: none;
    background: transparent;
}
.survey-builder-modal--inline .survey-builder-header {
    /* Slice 8 — inline-mode header shouldn't carry the modal's
       prominent title bar. /surveys/new has its own H1 above the
       builder host; the modal's redundant "Create a survey" title
       gets hidden via display: none here. The × close button stays
       (used as the form's cancel affordance). */
    border-bottom: none;
    padding: 0 0 8px 0;
    justify-content: flex-end;
}
.survey-builder-modal--inline .survey-builder-header h2 {
    display: none;
}
.survey-builder-modal--inline .survey-builder-body {
    padding: 0 0 24px;
}
.survey-builder-modal--inline .survey-builder-actions {
    padding: 18px 0 4px;
    border-top: 1px solid #e6eaee;
    margin-top: 8px;
}
body.theme-dark .survey-builder-modal--inline .survey-builder-actions { border-top-color: #2a3340; }

/* Slice 8 — detached scope/org field. When the builder's
   [data-scope-field] gets moved out of the modal body to a host
   element above the map, it picks up this card chrome so it reads
   as a top-of-page section, not as a misplaced form field. */
.survey-builder-field--detached {
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 12px;
    padding: 14px 16px 16px;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
/* Slice 8 — `display: flex` on the detached field would normally win
   over [hidden] { display: none } at the same specificity (later
   wins). Explicit `[hidden]` rule here keeps the field gone when
   populateScope decides it shouldn't show. */
.survey-builder-field--detached[hidden] { display: none !important; }
.survey-builder-field--detached input[type="text"],
.survey-builder-field--detached textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 15px;
    color: #1a1f24;
    box-sizing: border-box;
}
.survey-builder-field--detached input[type="text"]:focus,
.survey-builder-field--detached textarea:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
body.theme-dark .survey-builder-field--detached input[type="text"],
body.theme-dark .survey-builder-field--detached textarea {
    background: #1f272f;
    border-color: #2a3340;
    color: #e6eaee;
}

/* Slice 8 — hover popup on the builder map showing the
   neighborhood name. Pill-shaped, dark, low-key — doesn't compete
   with the boundary highlight. */
.builder-map-hover-popup .maplibregl-popup-content {
    background: rgba(28, 35, 48, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    pointer-events: none;
}
.builder-map-hover-popup .maplibregl-popup-tip {
    display: none;
}

/* Slice 8 — selected boundary summary card (rendered below the map
   when the user has picked at least one neighborhood). */
.survey-new-boundary-summary-card {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
}
.survey-new-boundary-summary-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #075985;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.survey-new-boundary-summary-names {
    font-size: 14px;
    color: #0c4a6e;
    line-height: 1.5;
}
body.theme-dark .survey-new-boundary-summary-card {
    background: rgba(7, 89, 133, 0.18);
    border-color: rgba(186, 230, 253, 0.3);
}
body.theme-dark .survey-new-boundary-summary-label { color: #7dd3fc; }
body.theme-dark .survey-new-boundary-summary-names { color: #bae6fd; }
.survey-builder-field--detached > span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #6b7682;
    text-transform: uppercase;
}
.survey-builder-field--detached select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: #1a1f24;
}
.survey-builder-field--detached select:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
body.theme-dark .survey-builder-field--detached {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .survey-builder-field--detached > span { color: #9aa6b2; }
body.theme-dark .survey-builder-field--detached select {
    background: #1f272f;
    border-color: #2a3340;
    color: #e6eaee;
}

/* Slice 8 — form-column header on /surveys/new (above the builder
   host). Page-level title; matches the dashboard's section header
   style. */
.survey-new-form-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e6eaee;
}
.survey-new-form-header h1 {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 600;
    color: #1a1f24;
    letter-spacing: -0.01em;
}
.survey-new-form-header p {
    margin: 0;
    color: #6b7682;
    font-size: 14px;
    line-height: 1.5;
}
body.theme-dark .survey-new-form-header { border-bottom-color: #2a3340; }
body.theme-dark .survey-new-form-header h1 { color: #f0f3f6; }
body.theme-dark .survey-new-form-header p { color: #9aa6b2; }
.survey-builder-card {
    width: min(640px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.survey-builder-header {
    padding: 18px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}
.survey-builder-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1a1f24;
}
.survey-builder-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f0f4f8;
    color: #5a6470;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.survey-builder-close:hover { background: #e1e8ef; color: #1a1f24; }
.survey-builder-body {
    padding: 16px 20px 8px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.survey-builder-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.survey-builder-field > span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.survey-builder-field input[type="text"],
.survey-builder-field textarea,
.survey-builder-field select {
    padding: 8px 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: #1a1f24;
    background: #fff;
    box-sizing: border-box;
}
.survey-builder-field textarea[name="questions"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    min-height: 200px;
    resize: vertical;
}
.survey-builder-field input:focus,
.survey-builder-field textarea:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.18);
}
.survey-builder-target {
    border: 1px solid #e1e8ef;
    border-radius: 8px;
    padding: 10px 12px 12px;
    margin: 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.survey-builder-target legend {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    padding: 0 4px;
}
.survey-builder-target label {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    color: #1a1f24;
}
.survey-builder-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #8a949f;
    margin-left: 6px;
}
/* Slice 8 — Mapillary vintage picker on the builder. Same chrome
   as the parcel-type fieldset above so the form reads as one
   continuous "what kind of survey is this" pass. */
.survey-builder-imagery {
    border: 1px solid #e1e8ef;
    border-radius: 8px;
    padding: 10px 12px 12px;
    margin: 0 0 14px;
}
.survey-builder-imagery legend {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    padding: 0 4px;
}
.survey-builder-imagery-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-top: 6px;
}
.survey-builder-imagery-years {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.survey-builder-imagery-year {
    background: #fff;
    border: 1px solid #d9dee4;
    color: #1a1f24;
    font: inherit;
    font-size: 15px;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.survey-builder-imagery-year:hover {
    background: #f5f8fb;
    border-color: #b9c4d0;
}
.survey-builder-imagery-year.is-selected {
    background: #0080ff;
    border-color: #0080ff;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 128, 255, 0.32);
}
.survey-builder-imagery-year.is-selected:hover {
    background: #0070e0;
    border-color: #0070e0;
}
.survey-builder-imagery-custom-toggle {
    margin-top: 8px;
}
/* Opt-in pill — matches the year pills; reveals the date inputs on click. */
.survey-builder-imagery-custom-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font: inherit;
    font-size: 15px;
    color: #1a1f24;
    background: #fff;
    border: 1px solid #d9dee4;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.survey-builder-imagery-custom-trigger:hover {
    background: #f5f8fb;
    border-color: #b9c4d0;
}
.survey-builder-imagery-custom-trigger[aria-expanded="true"] {
    border-color: #0080ff;
}
.survey-builder-imagery-custom-chevron {
    font-size: 11px;
    color: #7a8693;
    transition: transform 0.15s ease;
}
.survey-builder-imagery-custom-trigger.is-open .survey-builder-imagery-custom-chevron {
    transform: rotate(180deg);
}
.survey-builder-imagery-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-top: 6px;
    padding: 10px;
    background: #fafbfc;
    border: 1px solid #e1e6ec;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
/* The `display: flex` above outranks the browser's [hidden]{display:none},
   so without this the panel stays visible even when the hidden attr is set.
   Keep it collapsed until the user opts in via the pill. */
.survey-builder-imagery-custom[hidden] { display: none; }
body.theme-dark .survey-builder-imagery-custom-trigger {
    background: #1c2330;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .survey-builder-imagery-custom-trigger:hover {
    background: #2a3340;
    border-color: #3a4654;
}
body.theme-dark .survey-builder-imagery-custom {
    background: #1c2330;
    border-color: #2a3340;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
body.theme-dark .survey-builder-imagery-year {
    background: #1c2330;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .survey-builder-imagery-year:hover {
    background: #2a3340;
    border-color: #3a4654;
}
body.theme-dark .survey-builder-imagery-year.is-selected {
    background: #2563eb;
    border-color: #2563eb;
}
body.theme-dark .survey-builder-imagery-custom {
    background: #1c2330;
    border-color: #2a3340;
}

/* Slice 8 — boundary picker on the builder. Same chrome as the
   parcel-type fieldset so the form reads as one continuous pass. */
.survey-builder-boundaries {
    border: 1px solid #e1e8ef;
    border-radius: 8px;
    padding: 10px 12px 12px;
    margin: 0 0 14px;
}
.survey-builder-boundaries legend {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    padding: 0 4px;
}
.survey-builder-boundary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 32px;
}
.survey-builder-boundary-empty {
    font-size: 12px;
    color: #8a949f;
    align-self: center;
}
.survey-builder-boundary-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    padding: 3px 6px 3px 12px;
    font-size: 13px;
    font-weight: 500;
}
.survey-builder-boundary-chip-x {
    background: transparent;
    border: none;
    color: #075985;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 6px;
    border-radius: 50%;
}
.survey-builder-boundary-chip-x:hover {
    background: rgba(7, 89, 133, 0.15);
}
body.theme-dark .survey-builder-boundaries { border-color: #2a3340; }
body.theme-dark .survey-builder-boundaries legend { color: #9aa6b2; }
body.theme-dark .survey-builder-boundary-empty { color: #7a8693; }
body.theme-dark .survey-builder-boundary-chip {
    background: rgba(7, 89, 133, 0.35);
    color: #bae6fd;
    border-color: rgba(186, 230, 253, 0.4);
}
body.theme-dark .survey-builder-boundary-chip-x { color: #bae6fd; }
body.theme-dark .survey-builder-boundary-chip-x:hover {
    background: rgba(186, 230, 253, 0.15);
}
.survey-builder-imagery-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b7682;
}
.survey-builder-imagery-row input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #d9dee4;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    color: #1a1f24;
    background: #fff;
}
.survey-builder-imagery-row input[type="date"]:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
.survey-builder-imagery-clear {
    font-size: 12px;
}
body.theme-dark .survey-builder-imagery {
    border-color: #2a3340;
}
body.theme-dark .survey-builder-imagery legend { color: #9aa6b2; }
body.theme-dark .survey-builder-imagery-row label { color: #9aa6b2; }
body.theme-dark .survey-builder-imagery-row input[type="date"] {
    background: #1c2330;
    border-color: #2a3340;
    color: #e6eaee;
}
.survey-builder-reset {
    background: transparent;
    border: none;
    color: #0080ff;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.survey-builder-reset:hover { text-decoration: underline; }
.survey-builder-validation {
    min-height: 18px;
    font-size: 12px;
    color: #6b7682;
    margin-bottom: 4px;
}
.survey-builder-validation.ok { color: #1a8753; }
.survey-builder-validation.error { color: #c0392b; }
.survey-builder-actions {
    padding: 12px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #eee;
}
.survey-builder-cancel {
    padding: 9px 14px;
    border: 1px solid #d0d7de;
    background: #fff;
    color: #1a1f24;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.survey-builder-cancel:hover { background: #f6f8fa; }
.survey-builder-cancel:disabled,
.survey-builder-publish:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.survey-builder-publish {
    padding: 9px 16px;
    background: #0080ff;
    border: 1px solid #0080ff;
    color: #fff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.survey-builder-publish:hover:not(:disabled) {
    background: #0070e0;
    border-color: #0070e0;
}

/* ── Builder question cards (Phase F v1) ──────────────────────────────
 * Replaces the v0 JSON textarea with a structured list. Each card is
 * a question with prompt + type + required + (choices) + branching.
 */
.survey-builder-questions {
    margin: 0 0 12px;
}
.survey-builder-questions-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.survey-builder-questions-header > span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
}
.survey-builder-question-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* Slice 8 — question card visual refresh. Matches the rest of the
   survey app (profile-session-card, activity-card): clean white,
   subtle border, no garish blue header bar. */
.survey-builder-question-card {
    border: 1px solid #e6eaee;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.survey-builder-question-card:hover {
    border-color: #d0d7de;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.survey-builder-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    background: transparent;
    border-bottom: 1px solid #f0f2f5;
}
.survey-builder-question-num {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #6b7682;
    text-transform: uppercase;
}
body.theme-dark .survey-builder-question-card {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .survey-builder-question-card:hover { border-color: #3a4654; }
body.theme-dark .survey-builder-question-header { border-bottom-color: #2a3340; }
body.theme-dark .survey-builder-question-num { color: #9aa6b2; }
.survey-builder-question-actions {
    display: flex;
    gap: 4px;
}
.survey-builder-question-actions .iconbtn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: #5a6470;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.survey-builder-question-actions .iconbtn:hover:not(:disabled) {
    background: #e1e8ef;
    color: #1a1f24;
}
.survey-builder-question-actions .iconbtn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.survey-builder-question-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.survey-builder-question-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-builder-question-row > span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
}
.survey-builder-question-row input[type="text"],
.survey-builder-question-row textarea,
.survey-builder-question-row select {
    padding: 7px 9px;
    border: 1px solid #d0d7de;
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
    color: #1a1f24;
    background: #fff;
    box-sizing: border-box;
}
.survey-builder-question-row input:focus,
.survey-builder-question-row textarea:focus,
.survey-builder-question-row select:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.18);
}
.survey-builder-question-row-inline {
    flex-direction: row;
    gap: 12px;
    align-items: flex-end;
}
.survey-builder-question-typewrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-builder-question-required {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #1a1f24;
    padding: 0 0 8px; /* align with select baseline */
}
.survey-builder-question-branch {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-builder-question-branch-single {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-builder-add-question {
    margin-top: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 1px dashed #b0bac5;
    border-radius: 6px;
    background: transparent;
    color: #5a6470;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 150ms ease;
}
.survey-builder-add-question:hover:not(:disabled) {
    border-color: #0080ff;
    color: #0080ff;
    background: rgba(0, 128, 255, 0.04);
}
.survey-builder-add-question:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Questions step redesign ──────────────────────────────────────── */
.survey-builder-questions-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.survey-builder-questions-intro .survey-builder-reset { flex: 0 0 auto; white-space: nowrap; }

/* Inline answer-type switcher — segmented icon pills. */
.survey-builder-qtype-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-builder-qtype {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #d9dee4;
    border-radius: 999px;
    background: #fff;
    color: #495057;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.survey-builder-qtype:hover { background: #f5f8fb; border-color: #b9c4d0; }
.survey-builder-qtype-icon { width: 16px; height: 16px; display: inline-flex; }
.survey-builder-qtype-icon svg { width: 100%; height: 100%; }
.survey-builder-qtype.is-active { background: #0080ff; border-color: #0080ff; color: #fff; }
body.theme-dark .survey-builder-qtype { background: #1c2330; border-color: #2a3340; color: #c2cad3; }
body.theme-dark .survey-builder-qtype:hover { background: #2a3340; }
body.theme-dark .survey-builder-qtype.is-active { background: #0080ff; border-color: #0080ff; color: #fff; }

/* Required toggle switch. */
.survey-builder-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1a1f24;
    cursor: pointer;
}
.survey-builder-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.survey-builder-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: #cfd6dd;
    transition: background 0.15s ease;
    flex: 0 0 auto;
}
.survey-builder-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}
.survey-builder-toggle input:checked + .survey-builder-toggle-track { background: #0080ff; }
.survey-builder-toggle input:checked + .survey-builder-toggle-track::after { transform: translateX(16px); }
.survey-builder-toggle input:focus-visible + .survey-builder-toggle-track { box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.3); }
body.theme-dark .survey-builder-toggle { color: #e6eaee; }
body.theme-dark .survey-builder-toggle-track { background: #3a4654; }

/* Live "Surveyor sees" preview. */
.survey-builder-qpreview {
    border: 1px dashed #dbe0e6;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
}
.survey-builder-qpreview-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa6b2;
    margin-bottom: 6px;
}
.survey-builder-qpreview-prompt { font-size: 14px; font-weight: 600; color: #1a1f24; margin-bottom: 8px; }
.survey-builder-qpreview-btns,
.survey-builder-qpreview-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-builder-qpreview-btn {
    display: inline-flex;
    padding: 6px 14px;
    border: 1px solid #cdd5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #1a1f24;
}
.survey-builder-qpreview-text {
    padding: 8px 10px;
    border: 1px solid #cdd5dd;
    border-radius: 8px;
    background: #fff;
    color: #9aa6b2;
    font-size: 13px;
}
.survey-builder-qpreview-note { font-size: 12px; color: #7a8693; }
.survey-builder-qpreview-checks { display: flex; flex-direction: column; gap: 4px; }
.survey-builder-qpreview-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: 1px solid #cdd5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #1a1f24;
}
.survey-builder-qpreview-check::before {
    content: '';
    width: 13px;
    height: 13px;
    border: 1.5px solid #aab4bf;
    border-radius: 3px;
    flex: none;
}
body.theme-dark .survey-builder-qpreview-check { background: #1c2330; border-color: #2a3340; color: #e6eaee; }
.survey-builder-qpreview-draw { display: flex; flex-direction: column; gap: 6px; }
.survey-builder-qpreview-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.survey-builder-qpreview-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e9eef3;
    color: #495057;
}
body.theme-dark .survey-builder-qpreview { background: #161c27; border-color: #2a3340; }
body.theme-dark .survey-builder-qpreview-prompt { color: #e6eaee; }
body.theme-dark .survey-builder-qpreview-btn,
body.theme-dark .survey-builder-qpreview-text { background: #1c2330; border-color: #2a3340; color: #e6eaee; }

/* Footer: required toggle + skip-logic disclosure. */
.survey-builder-question-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.survey-builder-skiplogic { font-size: 13px; }
.survey-builder-skiplogic > summary {
    cursor: pointer;
    color: #5a6470;
    font-size: 12px;
    list-style: none;
    user-select: none;
}
.survey-builder-skiplogic > summary::-webkit-details-marker { display: none; }
.survey-builder-skiplogic > summary::before { content: '▸ '; color: #9aa6b2; }
.survey-builder-skiplogic[open] > summary::before { content: '▾ '; }
.survey-builder-skiplogic-body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
body.theme-dark .survey-builder-skiplogic > summary { color: #9aa6b2; }

/* Add-question type gallery. */
.survey-builder-add-question-wrap { margin-top: 12px; }
.survey-builder-add-question-plus { font-weight: 700; }
.survey-builder-add-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.survey-builder-add-gallery[hidden] { display: none; }
.survey-builder-add-type {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 12px;
    border: 1px solid #e1e6ec;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.survey-builder-add-type:hover {
    border-color: #0080ff;
    box-shadow: 0 2px 8px rgba(0, 128, 255, 0.12);
    transform: translateY(-1px);
}
.survey-builder-add-type-icon { width: 22px; height: 22px; color: #0080ff; }
.survey-builder-add-type-icon svg { width: 100%; height: 100%; }
.survey-builder-add-type-label { font-size: 14px; font-weight: 600; color: #1a1f24; }
.survey-builder-add-type-blurb { font-size: 12px; color: #7a8693; line-height: 1.35; }
body.theme-dark .survey-builder-add-type { background: #1c2330; border-color: #2a3340; }
body.theme-dark .survey-builder-add-type-label { color: #e6eaee; }

/* "Start from a template" picker at the top of the questions step. */
.survey-builder-templates { margin: 4px 0 16px; }
.survey-builder-templates-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7a8693;
    margin-bottom: 8px;
}
.survey-builder-template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.survey-builder-template-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid #e1e6ec;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.survey-builder-template-card:hover {
    border-color: #0080ff;
    box-shadow: 0 2px 8px rgba(0, 128, 255, 0.12);
    transform: translateY(-1px);
}
.survey-builder-template-card.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb inset;
    background: #f5f9ff;
}
.survey-builder-template-icon { width: 24px; height: 24px; color: #0080ff; }
.survey-builder-template-icon svg { width: 100%; height: 100%; }
.survey-builder-template-name { font-size: 14px; font-weight: 600; color: #1a1f24; }
.survey-builder-template-blurb { font-size: 12px; color: #7a8693; line-height: 1.35; }
body.theme-dark .survey-builder-template-card { background: #1c2330; border-color: #2a3340; }
body.theme-dark .survey-builder-template-card.is-active { background: #1c2a3d; border-color: #4493d6; box-shadow: 0 0 0 1px #4493d6 inset; }
body.theme-dark .survey-builder-template-name { color: #e6eaee; }

/* Choice options editor — add/remove rows. */
.survey-builder-choices { display: flex; flex-direction: column; gap: 6px; }
.survey-builder-choice-row { display: flex; align-items: center; gap: 6px; }
.survey-builder-choice-row input[type="text"] { flex: 1 1 auto; }
.survey-builder-choice-row .iconbtn {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #8a94a0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.survey-builder-choice-row .iconbtn:hover:not(:disabled) { background: #fdeaea; color: #c0392b; }
.survey-builder-choice-row .iconbtn:disabled { opacity: 0.3; cursor: not-allowed; }
.survey-builder-add-choice {
    align-self: flex-start;
    margin-top: 2px;
    padding: 4px;
    border: none;
    background: transparent;
    color: #0080ff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.survey-builder-add-choice:hover { text-decoration: underline; }

/* Annotation tags editor — chips + inline add input. */
.survey-builder-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
}
.survey-builder-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #0064cc;
    font-size: 13px;
}
.survey-builder-tag-remove {
    border: none;
    background: transparent;
    color: #0064cc;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
}
.survey-builder-tag-remove:hover { background: rgba(0, 100, 204, 0.18); }
.survey-builder-tags .survey-builder-tag-input {
    flex: 1 1 80px;
    min-width: 80px;
    border: none;
    outline: none;
    padding: 4px;
    font: inherit;
    font-size: 13px;
    background: transparent;
    box-shadow: none;
}
body.theme-dark .survey-builder-tags { background: #1c2330; border-color: #2a3340; }
body.theme-dark .survey-builder-tag-chip { background: #1f3350; color: #8fc0ff; }
body.theme-dark .survey-builder-tag-remove { color: #8fc0ff; }

body.theme-dark .session-launcher-panel {
    background: #1f262d;
    color: #e6eaee;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.5);
}
body.theme-dark .session-launcher-header { border-bottom-color: #2f3a44; }
body.theme-dark .session-launcher-header h2 { color: #f0f3f6; }
body.theme-dark .session-launcher-eyebrow { color: #9aa6b2; }
body.theme-dark .session-launcher-section { border-bottom-color: #2f3a44; }
body.theme-dark .session-launcher-section-header h3 { color: #f0f3f6; }
body.theme-dark .session-launcher-section-step {
    background: rgba(0, 128, 255, 0.18);
    color: #6db5ff;
}
body.theme-dark .session-launcher-section-hint { color: #9aa6b2; }
body.theme-dark .session-launcher-close {
    background: #2a333c;
    color: #c5cdd6;
}
body.theme-dark .session-launcher-close:hover {
    background: #34404a;
    color: #f0f3f6;
}
body.theme-dark .session-launcher-field select,
body.theme-dark .session-launcher-search input[type="text"] {
    background: #1f272f;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .session-launcher-suggestions {
    background: #1f262d;
    border-color: #3b454f;
}
body.theme-dark .session-launcher-suggestions li { color: #e6eaee; }
body.theme-dark .session-launcher-suggestions li:hover {
    background: #2a333c;
    color: #6db5ff;
}
body.theme-dark .session-launcher-chip {
    background: rgba(0, 128, 255, 0.18);
    color: #6db5ff;
}
body.theme-dark .session-launcher-count {
    background: #232c34;
    border-color: #2f3a44;
}
body.theme-dark .session-launcher-count[data-state="loading"] { background: #2d2517; border-color: #4a3a1a; }
body.theme-dark .session-launcher-count[data-state="ok"] { background: #1f2d24; border-color: #2c4234; }
body.theme-dark .session-launcher-count[data-state="empty"] { background: #2d1f1f; border-color: #4a2828; }
body.theme-dark .session-launcher-count-label { color: #9aa6b2; }
body.theme-dark .session-launcher-compute {
    background: rgba(0, 128, 255, 0.10);
    border-color: #6db5ff;
    color: #6db5ff;
}
body.theme-dark .session-launcher-compute:hover { background: rgba(0, 128, 255, 0.20); }
body.theme-dark .session-launcher-actions { border-top-color: #2f3a44; }
body.theme-dark .session-launcher-cancel {
    background: #2a333c;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .session-launcher-cancel:hover { background: #34404a; }

/* Session-progress strip in the runner header — compact one-line
 * layout: thin bar on top, single count line beneath. The
 * boundary moved into the meta line above; "by you this session"
 * lives in the tooltip + the recap/activity feed rather than
 * eating header rows. */
.survey-session-progress {
    margin-top: 8px;
    font-size: 12px;
    color: #5a6470;
}
.survey-session-progress-bar {
    height: 4px;
    background: #e1e8ef;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 4px;
}
.survey-session-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0080ff 0%, #4ec3ff 100%);
    transition: width 0.3s ease;
}
.survey-session-progress-counts {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
    color: #5a6470;
}
.survey-session-progress-counts strong {
    color: #0080ff;
    font-weight: 700;
}
.survey-session-progress-pct {
    color: #8590a0;
    font-size: 11px;
}
body.theme-dark .survey-session-progress { color: #9aa6b2; }
body.theme-dark .survey-session-progress-bar { background: #2f3a44; }
body.theme-dark .survey-session-progress-mine { color: #7a8595; }

/* ── Mapillary sequence-controls restyle (survey-mode only) ──────────
 *
 * Mapillary 4.1.2 puts the play / step-prev / step-next stepper plus a
 * playback / timeline / expander group at the bottom of the viewer.
 * Only the prev/next arrows are useful for surveying — the surveyor
 * is stepping through frames manually as they answer questions, not
 * playing back a tour. So we:
 *   1) Move the stepper to the TOP of the viewer (so the bottom of
 *      the panorama is uncluttered and the runner panel + image
 *      caption have full bottom-real-estate).
 *   2) Hide the play / stop buttons and the playback + timeline +
 *      expander controls. Just left + right arrows remain.
 *
 * Direction (cross-sequence) controls stay disabled at the SDK layer
 * (mapillary-viewer.js sets `direction: false` in survey mode).
 */
body.survey-mode .mapillary-sequence-container {
    /* Override Mapillary's own bottom anchor — surveyor wants this
     * out of the way of the runner panel + caption. */
    bottom: auto !important;
    top: 14px !important;
}
body.survey-mode .mapillary-sequence-stepper {
    /* Pill shape with subtle shadow — matches the brand chip + map-PiP
     * chrome aesthetic. Width shrinks to fit just the 2 visible step
     * buttons (the SDK reserves space for 4 by default — prev/play/
     * stop/next — and our display:none on play+stop doesn't shrink
     * that reservation). inline-flex + width:fit-content collapses
     * the pill to just what's actually rendered. */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: fit-content !important;
    width: -moz-fit-content !important;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    padding: 0 4px;
}
/* The SDK wraps the stepper in `.mapillary-sequence-container` and
 * centers it via its own width math. With the stepper now narrower,
 * the container's anchor still needs to track the new content size
 * — switching to inline-flex centers it cleanly over the canvas. */
body.survey-mode .mapillary-sequence-container {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    pointer-events: none;
}
body.survey-mode .mapillary-sequence-container > * { pointer-events: auto; }
/* Drop the play / stop buttons + playback / timeline panels.
 * Surveyor only needs prev/next arrows. */
body.survey-mode .mapillary-sequence-play,
body.survey-mode .mapillary-sequence-play-inactive,
body.survey-mode .mapillary-sequence-stop,
body.survey-mode .mapillary-sequence-controls,
body.survey-mode .mapillary-sequence-playback,
body.survey-mode .mapillary-sequence-timeline {
    display: none !important;
}
body.survey-mode .mapillary-sequence-step-next,
body.survey-mode .mapillary-sequence-step-next-inactive,
body.survey-mode .mapillary-sequence-step-next-highlight,
body.survey-mode .mapillary-sequence-step-prev,
body.survey-mode .mapillary-sequence-step-prev-inactive,
body.survey-mode .mapillary-sequence-step-prev-highlight {
    /* Explicit hit-target — the SDK renders these as backgrounds on
     * elements with no intrinsic width, so the stepper's
     * `width: fit-content` collapses unless we give each button a
     * defined footprint. 36 × 36 matches the rest of the icon-
     * button family on this app (toolbar buttons, icon-rail). */
    display: inline-block !important;
    width: 36px !important;
    height: 36px !important;
    background-size: 18px 18px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: transparent !important;
    /* Keep the SDK's SVG glyph; recolor by tinting the background-image
     * with a CSS filter — the glyphs are white in the source SVG, so
     * `invert + sepia + …` shifts them toward our brand blue. */
    filter: invert(48%) sepia(94%) saturate(2700%) hue-rotate(192deg)
            brightness(99%) contrast(101%);
    transition: filter 0.15s ease, background-color 0.15s ease;
}
body.survey-mode .mapillary-sequence-play:hover,
body.survey-mode .mapillary-sequence-step-next:hover,
body.survey-mode .mapillary-sequence-step-prev:hover,
body.survey-mode .mapillary-sequence-stop:hover {
    background-color: rgba(0, 128, 255, 0.10) !important;
    filter: invert(34%) sepia(96%) saturate(2870%) hue-rotate(195deg)
            brightness(94%) contrast(104%);
}
/* Inactive states — visibly dimmed, no hover lift */
body.survey-mode .mapillary-sequence-play-inactive,
body.survey-mode .mapillary-sequence-step-next-inactive,
body.survey-mode .mapillary-sequence-step-prev-inactive {
    opacity: 0.35 !important;
    cursor: default !important;
}

body.theme-dark.survey-mode .mapillary-sequence-stepper {
    background: rgba(34, 41, 49, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ── Image-attribution caption (Phase C polish) ─────────────────────── */
.survey-image-caption {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 5;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #f4f6f8;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.3;
    pointer-events: none;
    user-select: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.survey-image-caption[hidden] { display: none; }
.survey-image-caption-sep {
    margin: 0 6px;
    opacity: 0.5;
}
.survey-image-caption-source {
    opacity: 0.85;
}

/* Survey-target hint inside the launcher modal (Phase C) */
.session-launcher-target {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -10px 0 16px;
    font-size: 12px;
    color: #5a6470;
    font-style: italic;
}
.session-launcher-target svg {
    flex: 0 0 auto;
    color: #0080ff;
    opacity: 0.85;
}
.session-launcher-target[hidden] { display: none; }
body.theme-dark .session-launcher-target { color: #9aa6b2; }

/* Multi-select filter fieldsets in the launcher modal (Phase C-2) */
.session-launcher-filters {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin: 0 0 14px;
    padding: 10px 12px 12px;
}
.session-launcher-filters legend {
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
}
.session-launcher-filters-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #8893a0;
    font-style: italic;
    margin-left: 4px;
}
.session-launcher-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: #1a1f24;
    cursor: pointer;
    user-select: none;
}
.session-launcher-filters input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #0080ff;
    cursor: pointer;
}
.session-launcher-filters input[type="checkbox"]:disabled,
.session-launcher-filters label:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}
/* Live count badge next to each filter checkbox — populated by
 * `computeFilterBreakdown` after chip changes. Empty when no
 * boundaries are picked. */
.session-launcher-filter-text {
    flex: 1 1 auto;
}
.session-launcher-filter-count {
    font-size: 12px;
    font-weight: 600;
    color: #6b7682;
    background: #f0f4f8;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 28px;
    text-align: center;
}
.session-launcher-filter-count.is-loading {
    opacity: 0.5;
}
.session-launcher-filter-count:empty {
    display: none;
}

body.theme-dark .session-launcher-filters {
    border-color: #2f3a44;
}
body.theme-dark .session-launcher-filter-count {
    background: #2a333c;
    color: #b8c0c8;
}
body.theme-dark .session-launcher-filters legend { color: #9aa6b2; }
body.theme-dark .session-launcher-filters-hint { color: #6e7884; }
body.theme-dark .session-launcher-filters label { color: #e6eaee; }

/* Survey-years section — year-precision Mapillary filter + multi-year
 * walk picker. Single year = today's behavior. Multiple selected =
 * walk each parcel through every year (runner-side walk in a later
 * slice). Header carries a live count pill (boundary-scoped image
 * count); body is a grid of year chips + quick-pick row. */
.session-launcher-imagery-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #6b7682;
    background: #f0f4f8;
    padding: 3px 10px;
    border-radius: 999px;
    min-width: 36px;
    text-align: center;
}
.session-launcher-imagery-count[data-state="loading"] { opacity: 0.5; }
.session-launcher-imagery-count[data-state="ok"] { color: #0080ff; }
.session-launcher-imagery-count[data-state="empty"] { color: #c43c3c; }
.session-launcher-year-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.session-launcher-year-chip {
    padding: 6px 12px;
    border: 1px solid #d0d7de;
    border-radius: 999px;
    background: #fff;
    color: #1a2a3a;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    min-width: 56px;
    text-align: center;
}
.session-launcher-year-chip:hover {
    background: #f3f5f7;
    border-color: #b8c0c8;
}
.session-launcher-year-chip[data-selected="true"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.session-launcher-year-chip[data-selected="true"]:hover { background: #1d4fd1; }
.session-launcher-year-chip:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.session-launcher-year-quickpicks {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.session-launcher-year-quick {
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: #6b7682;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.session-launcher-year-quick:hover { color: #2563eb; }
.session-launcher-year-quick:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
body.theme-dark .session-launcher-imagery-count {
    background: #2a333c;
    color: #b8c0c8;
}
body.theme-dark .session-launcher-year-chip {
    background: #1c252e;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .session-launcher-year-chip:hover {
    background: #2a3340;
    border-color: #4b5560;
}
body.theme-dark .session-launcher-year-chip[data-selected="true"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
body.theme-dark .session-launcher-year-quick { color: #9aa6b2; }
body.theme-dark .session-launcher-year-quick:hover { color: #60a5fa; }
/* Legacy dark-mode hook retained until firestore.rules / data
 * migration removes any chance an old <input type="month"> slips
 * back in during a dev rollback. */
body.theme-dark .session-launcher-imagery-field { color: #9aa6b2; }
body.theme-dark .session-launcher-imagery-field input[type="month"] {
    background: #1c252e;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .session-launcher-imagery-field input[type="month"]:focus {
    border-color: #6db5ff;
    box-shadow: 0 0 0 2px rgba(109, 181, 255, 0.18);
}

/* "Create new" inline button next to the Survey dropdown label
 * (Phase F v0). */
.session-launcher-create-btn {
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: transparent;
    border: 1px solid #d0d7de;
    border-radius: 999px;
    color: #0080ff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.session-launcher-create-btn:hover {
    background: #eaf4ff;
    border-color: #0080ff;
}
.session-launcher-create-btn svg { color: #0080ff; }
body.theme-dark .session-launcher-create-btn {
    border-color: #3b454f;
    color: #6db5ff;
}
body.theme-dark .session-launcher-create-btn:hover {
    background: rgba(0, 128, 255, 0.15);
    border-color: #6db5ff;
}

/* Slice 8 — old duplicate `.survey-builder-modal` block deleted. It
   was a stale copy of the rules from ~line 1217 and was overriding
   the inline-mode (.survey-builder-modal--inline) variant because
   cascading order put it after. Canonical builder styles live
   above; dark-theme overrides for them live below. */
.survey-builder-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.survey-builder-field > span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.survey-builder-field input[type="text"],
.survey-builder-field textarea {
    padding: 9px 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: #1a1f24;
    box-sizing: border-box;
    resize: vertical;
}
.survey-builder-field textarea[name="questions"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    min-height: 240px;
}
.survey-builder-field input[type="text"]:focus,
.survey-builder-field textarea:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.18);
}
.survey-builder-reset {
    background: none;
    border: none;
    padding: 0;
    color: #0080ff;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.survey-builder-target {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin: 0 0 14px;
    padding: 10px 12px 12px;
}
.survey-builder-target legend {
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
}
.survey-builder-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #8893a0;
    font-style: italic;
    margin-left: 4px;
}
.survey-builder-target label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: #1a1f24;
    cursor: pointer;
}
.survey-builder-target input[type="radio"] {
    accent-color: #0080ff;
    cursor: pointer;
}

.survey-builder-validation {
    margin: 0 0 8px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 6px;
    background: #f6f8fa;
    color: #5a6470;
    min-height: 18px;
    border: 1px solid transparent;
}
.survey-builder-validation.is-ok {
    background: #e8f5ee;
    border-color: #a3d3b6;
    color: #0a4d2a;
}
.survey-builder-validation.is-error {
    background: #fdecec;
    border-color: #f3b8b8;
    color: #7a1a1a;
}

.survey-builder-actions {
    padding: 12px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    border-top: 1px solid #eee;
}
.survey-builder-cancel {
    padding: 9px 14px;
    border: 1px solid #d0d7de;
    background: #fff;
    color: #1a1f24;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.survey-builder-cancel:hover { background: #f6f8fa; }
.survey-builder-publish {
    padding: 9px 16px;
}
.survey-builder-cancel:disabled,
.survey-builder-publish:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.theme-dark .survey-builder-card { background: #1f262d; }
body.theme-dark .survey-builder-header { border-bottom-color: #2f3a44; }
body.theme-dark .survey-builder-header h2 { color: #f0f3f6; }
body.theme-dark .survey-builder-close {
    background: #2a333c;
    color: #c5cdd6;
}
body.theme-dark .survey-builder-close:hover { background: #34404a; color: #f0f3f6; }
body.theme-dark .survey-builder-field input[type="text"],
body.theme-dark .survey-builder-field textarea {
    background: #1f272f;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .survey-builder-target { border-color: #2f3a44; }
body.theme-dark .survey-builder-target legend { color: #9aa6b2; }
body.theme-dark .survey-builder-target label { color: #e6eaee; }
body.theme-dark .survey-builder-validation {
    background: #232c34;
    color: #9aa6b2;
}
body.theme-dark .survey-builder-validation.is-ok {
    background: #1f2d24;
    border-color: #2c4234;
    color: #c8e6d3;
}
body.theme-dark .survey-builder-validation.is-error {
    background: #2d1f1f;
    border-color: #4a2828;
    color: #f0b8b8;
}
body.theme-dark .survey-builder-actions { border-top-color: #2f3a44; }
body.theme-dark .survey-builder-cancel {
    background: #2a333c;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .survey-builder-cancel:hover { background: #34404a; }

/* Slice C: locked sections + completed step indicators */
.session-launcher-section.is-locked {
    opacity: 0.45;
    pointer-events: none;
}
.session-launcher-section.is-locked .session-launcher-section-header h3 {
    color: #8893a0;
}
.session-launcher-section.is-locked .session-launcher-section-step {
    background: #e1e8ef;
    color: #8893a0;
}
.session-launcher-section-step.is-done {
    background: #0080ff;
    color: #fff;
    font-size: 13px;
}
body.theme-dark .session-launcher-section.is-locked .session-launcher-section-header h3 {
    color: #6e7884;
}
body.theme-dark .session-launcher-section.is-locked .session-launcher-section-step {
    background: #2a333c;
    color: #6e7884;
}

/* Slice B: dim unrelated chrome on the right side of the viewport
 * while the launcher panel is open, so the surveyor's eye is drawn
 * to the boundary preview overlay. The brand chip + map PiP swap
 * are intentionally exempt. */
body.session-launcher-open #icon-rail,
body.session-launcher-open #map-legend,
body.session-launcher-open #legend-toggle-btn {
    opacity: 0.4;
    transition: opacity 200ms ease;
}

/* ── Phase Z layout — split right column ─────────────────────────────
 *
 * When the surveyor is mid-session (`body.survey-active`) we redesign
 * the screen as:
 *
 *   ┌─────────────────────────────────┬───────────────┐
 *   │                                 │  SURVEY       │
 *   │                                 │  RUNNER       │
 *   │   MAPILLARY PANORAMA            │  (top 50%)    │
 *   │   (left 60% of viewport)        ├───────────────┤
 *   │                                 │  CONTEXT      │
 *   │                                 │  MAP          │
 *   │                                 │  (bottom 50%) │
 *   └─────────────────────────────────┴───────────────┘
 *
 * - theme-enhancements.js's `body.sv-swapped` swap/PiP rules are gated
 *   to `:not(.survey-active)`, so they no longer apply in the survey
 *   runtime (the runner sets streetView.swapped=true, but survey owns
 *   its own layout). The `body.survey-active` rules below are the sole
 *   source of truth for the survey swap layout.
 * - The parcel-detail panel (BOUNDARIES / OWNERSHIP / TAX) is hidden;
 *   the surveyor doesn't need ownership records mid-session, and
 *   selection-panel.js:463 already short-circuits the panorama-reparent
 *   it'd otherwise do into #panel-body.
 * - Swap chrome is hidden — no swapping in survey-mode anymore.
 *
 * Mobile rollout M1 — the hide-panel-body + runner-fills-sidebar
 * rules USED TO live in the desktop-only @media block, leaving
 * mobile users with the property profile + boundary chips + tab
 * strip rendering below the runner inside the bottom sheet. They
 * had to scroll past det.land parcel-explorer noise to reach the
 * Yes/No question. The hide rules + runner-fills-sidebar are now
 * viewport-agnostic (every device hides them in survey-active);
 * only the SIZE rules (40vw / 50% height) stay desktop-only since
 * mobile has its own bottom-sheet sizing.
 */

/* Hide det.land parcel-explorer surfaces during a survey session
 * regardless of viewport — surveyor doesn't need property profile,
 * boundary chips, tab strip, or the sidebar close button mid-flow. */
body.survey-active #panel-chip-row,
body.survey-active #panel-tab-strip,
body.survey-active #panel-body,
body.survey-active #panel-close,
body.survey-active #panel-expand {
    display: none !important;
}

/* The mobile sheet drag-handle is hidden by default — only the phone
 * breakpoint shows it (rule in the @media block below). Without this
 * global hide the button's only display rules lived inside that media
 * query, so on desktop it fell back to the native <button> default
 * (display:inline-block) and rendered as a tiny unstyled grey nub in
 * the top-left corner of the runner. */
.sv-mobile-drag-handle { display: none; }

/* Runner fills its sidebar slot on every viewport. Height:100% picks
 * up whatever vertical space the sidebar gets — desktop's 50%
 * (rule below) or mobile's 60%/70% (in the @media max-width: 768px
 * / 480px blocks elsewhere in this file). */
body.survey-active #survey-runner {
    display: block;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Pin the runner header (parcel address + progress bar) so it stays
 * visible while the question/answers area scrolls underneath —
 * otherwise the surveyor loses their "what am I answering for"
 * anchor the moment the body gets tall enough to scroll. Desktop
 * only: on the mobile sheet the sticky drag-handle already pins the
 * top and the 35vh budget is too short to give up to a fixed header. */
@media (min-width: 769px) and (min-height: 601px) {
    body.survey-active .survey-runner-header {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #fff;
    }
    body.theme-dark.survey-active .survey-runner-header { background: #1e1e1e; }
}

@media (min-width: 769px) and (min-height: 601px) {
    /* Sidebar grows to 40vw so the layout reads as 60% panorama / 40%
     * panel. The --sidebar-width custom property cascades through
     * theme-enhancements.js's runtime CSS (icon-rail offsets, etc.). */
    body.survey-active {
        --sidebar-width: 40vw;
    }
    body.survey-active #details-sidebar {
        width: 40vw !important;
        height: 50% !important;
        display: block !important;
        /* The sidebar occupies the top 50% of the right column so the
         * map can paint cleanly underneath in the bottom 50% — without
         * this, the sidebar's white bg sits on top of the map canvas
         * (sidebar has its own stacking context that wins regardless
         * of the map's z-index). */
    }

    /* Bottom half = map. Override body.sv-swapped #map's bottom-right
     * PiP rect rules (theme.css:2845-2865, all `!important`).
     * Match-strength `!important` + later source order means we win. */
    body.survey-active #map {
        position: absolute !important;
        right: 0 !important;
        left: auto !important;
        top: 50% !important;
        bottom: 0 !important;
        width: 40vw !important;
        height: 50% !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 950 !important;
    }

    /* Panorama claims left 60%. Override body.sv-swapped #mapillary-
     * container.floating-viewer (theme.css:2815) which uses inset:0
     * for full-bleed. */
    body.survey-active #mapillary-container.floating-viewer {
        left: 0 !important;
        right: 40vw !important;
        top: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        height: auto !important;
        border-radius: 0 !important;
        /* Previously inherited from theme-enhancements.js's
         * body.sv-swapped rule (now gated to :not(.survey-active)).
         * Set here so the full-bleed panorama keeps clean edges. */
        border: none !important;
        box-shadow: none !important;
        z-index: 920 !important;
    }

    /* (Swap-button + map-PiP hide rules moved to the universal
     * `body.survey-active` block above so they apply on mobile too —
     * the desktop-only scoping was an accident, not a constraint.)
     */

    /* Move the icon rail (just the AERIAL button, since survey-main
     * doesn't init the others) onto the bottom-right map instead of
     * floating over the panorama. The map sits at top:50% right:0,
     * so the rail belongs at top: 50% + 10px right: 10px to land
     * inside its top-right corner. Override the
     * `body.sidebar-visible #icon-rail` rule from theme.css that
     * shifts it left by `--sidebar-width + 10px` (which during
     * survey-active = 40vw + 10px = lands on the panorama). */
    body.survey-active #icon-rail {
        top: calc(50% + 10px) !important;
        right: 10px !important;
    }
}

/* ── Per-parcel toast (Slice 1) ──────────────────────────────────────── */
/* Fixed-position pill anchored to the top-center of the viewport.
 * Slides down on appear, fades out on dismiss. Single instance —
 * showToast replaces the existing element rather than stacking. */
.survey-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translate(-50%, -120%);
    background: #1a2a3a;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.4, 1),
                opacity 220ms ease-out;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
}
.survey-toast.visible {
    transform: translate(-50%, 0);
    opacity: 1;
}
body.theme-dark .survey-toast {
    background: #2a333c;
    color: #f0f3f6;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
/* Error variant — loud, wraps for longer messages, lingers (5s). */
.survey-toast--error {
    background: #c0392b;
    color: #fff;
    white-space: normal;
    max-width: min(440px, calc(100vw - 32px));
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 12px 28px rgba(192, 57, 43, 0.35);
}
body.theme-dark .survey-toast--error {
    background: #c0392b;
    color: #fff;
}

/* ── Survey-completion card (Slice 1) ────────────────────────────────── */
/* Fills the runner panel (#survey-runner / #details-sidebar) when a
 * session exhausts its queue. Inherits the launcher CTA card's
 * dimensions / shadow so the visual language between "ready" and
 * "complete" is consistent. */
.survey-completion-card {
    margin: 24px;
    text-align: center;
    position: relative;
}
.survey-completion-icon {
    color: #1a9c5f;
    margin-bottom: 8px;
}
.survey-completion-title {
    font-size: 22px;
    font-weight: 600;
    color: #1a2a3a;
    margin: 0 0 6px;
}
.survey-completion-sub {
    font-size: 14px;
    color: #4a5563;
    margin: 0 0 4px;
}
.survey-completion-meta {
    font-size: 12px;
    color: #7a8693;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}
.survey-completion-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}
.survey-completion-actions .primary-btn {
    width: 100%;
}
.survey-completion-actions .link-btn {
    background: transparent;
    border: 0;
    color: #0080ff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px;
    font-family: inherit;
}
.survey-completion-actions .link-btn:hover { text-decoration: underline; }
.survey-completion-dismiss {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: #7a8693;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}
.survey-completion-dismiss:hover {
    background: #f0f4f8;
    color: #1a2a3a;
}
body.theme-dark .survey-completion-title { color: #f0f3f6; }
body.theme-dark .survey-completion-sub { color: #b8c0c8; }
body.theme-dark .survey-completion-meta { color: #6e7884; }
body.theme-dark .survey-completion-icon { color: #4dd198; }
body.theme-dark .survey-completion-dismiss { color: #b8c0c8; }
body.theme-dark .survey-completion-dismiss:hover {
    background: #2a333c;
    color: #f0f3f6;
}

/* ── Profile page (Slice 1) ──────────────────────────────────────────── */
/* /profile.html — surveyor's own past sessions + drill-down. */
.profile-brand-chip {
    position: fixed;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    /* WCAG 2.1 AA color-contrast fix (Phase 3 known debt). #0080ff
     * on white gave ~3.4:1; spec requires 4.5:1 for body text.
     * #0066cc on white is ~5.1:1. Dark-theme variant below already
     * passes at #6db5ff on #1c252e (~6.2:1) so untouched. */
    color: #0066cc;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}
.profile-brand-chip:hover { background: #f5f9ff; }
.profile-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px 80px;
}

/* Slice C5.1 — two-column shell.
 *
 * Below 1024px: single column, identical to the pre-C5 stack.
 * 1024px and up: actionable items left (Continue session, orgs,
 * surveys list), activity feed right. The 1fr / 1.4fr ratio gives
 * the feed more breathing room since its rows have horizontal
 * content (thumb + parcel + meta) that wants width, while the
 * left-column cards are short rows that read well in a narrower
 * column.
 *
 * Header + stats + edit modal stay above the grid so they read as
 * a unified top of the page rather than splitting awkwardly across
 * columns. */
.profile-twocol {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 1024px) {
    .profile-twocol {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
        gap: 32px;
        align-items: start; /* prevent the columns stretching to equal heights */
    }
}
.profile-twocol-left,
.profile-twocol-right {
    min-width: 0; /* let inner content honor max-widths instead of overflowing */
}
/* Sections inside each column already have their own margin-bottom
 * for vertical rhythm; reset the LAST section so the column ends
 * cleanly. */
.profile-twocol-left > section:last-child,
.profile-twocol-right > section:last-child {
    margin-bottom: 0;
}
.profile-loading,
.profile-error {
    text-align: center;
    color: #7a8693;
    padding: 60px 24px;
    font-size: 15px;
}
.profile-error { color: #c43c3c; }

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: #e6eaee;
    flex: 0 0 auto;
}
.profile-avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0080ff;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}
.profile-header-body { min-width: 0; flex: 1 1 auto; }
.profile-name {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: #1a2a3a;
    line-height: 1.2;
}
.profile-email {
    margin: 0;
    font-size: 14px;
    color: #7a8693;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.profile-stat {
    background: #fff;
    border-radius: 12px;
    padding: 18px 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.profile-stat-num {
    font-size: 26px;
    font-weight: 700;
    color: #0080ff;
    line-height: 1.1;
}
.profile-stat-label {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-active-session {
    background: #eaf4ff;
    border: 1px solid #b6d7ff;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.profile-active-session-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #1a2a3a;
}
.profile-active-session-meta span { font-size: 13px; color: #4a5563; }

/* Slice C1 — start-session CTA card. Same visual treatment as the
 * active-session callout but with a neutral accent so users between
 * runs / first-timers see a clear "start surveying" prompt rather
 * than having to find the small inline link. */
.profile-start-cta {
    background: #f4f6fa;
    border: 1px solid #d6dde6;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.profile-start-cta-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #1a2a3a;
}
.profile-start-cta-meta strong { font-size: 15px; }
.profile-start-cta-meta span { font-size: 13px; color: #4a5563; }
body.theme-dark .profile-start-cta {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
body.theme-dark .profile-start-cta-meta { color: #f0f3f6; }
body.theme-dark .profile-start-cta-meta span { color: #a4adb7; }

.profile-sessions-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}
.profile-sessions-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #1a2a3a;
}
.profile-cta-link {
    font-size: 13px;
    font-weight: 600;
    color: #0080ff;
    text-decoration: none;
}
.profile-cta-link:hover { text-decoration: underline; }

.profile-session-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 150ms ease;
}
.profile-session-card.is-expanded { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); }
.profile-session-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
}
.profile-session-card-head:hover { background: #fafbfc; }
.profile-session-card-title-block { flex: 1 1 auto; min-width: 0; }
.profile-session-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a2a3a;
    margin-bottom: 2px;
}
.profile-session-card-sub {
    font-size: 12px;
    color: #6b7682;
}
/* Slice C3 — clickable survey title in the session card sub-line.
 * Easy escape hatch from session row → per-survey dashboard. */
.profile-session-card-survey-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.profile-session-card-survey-link:hover { text-decoration: underline; }
body.theme-dark .profile-session-card-survey-link { color: #93c5fd; }

/* Slice C4 — per-survey contribution rollup. Replaces the per-session
 * spam as the primary "what have I worked on?" surface on /profile.
 * One card per survey, showing total parcels you've surveyed and the
 * boundaries you've touched. Continue/Start CTA + Dashboard link at
 * the right. */
.profile-surveys { margin-bottom: 32px; }
.profile-survey-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e1e8ef;
    border-radius: 10px;
    margin-bottom: 8px;
}
.profile-survey-card-body {
    flex: 1;
    min-width: 0;
}
.profile-survey-card-title {
    display: block;
    color: #1a2a3a;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    margin-bottom: 2px;
}
.profile-survey-card-title:hover { color: #2563eb; }
.profile-survey-card-meta {
    color: #6b7682;
    font-size: 12px;
}
.profile-survey-card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.profile-survey-card-dashboard {
    color: #2563eb;
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
}
.profile-survey-card-dashboard:hover { text-decoration: underline; }
.profile-survey-card-cta {
    /* primary-btn already styled; just sizing tweak for the row */
    font-size: 13px;
    padding: 6px 12px;
}
body.theme-dark .profile-survey-card {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .profile-survey-card-title { color: #e6eaee; }
body.theme-dark .profile-survey-card-title:hover { color: #93c5fd; }
body.theme-dark .profile-survey-card-meta { color: #a4adb7; }
body.theme-dark .profile-survey-card-dashboard { color: #93c5fd; }

/* ── M5: survey/session cards stack on mobile ────────────────────
 * Default desktop layout puts the title block + actions in a
 * horizontal flex row. On narrow phones the actions get pushed
 * off-screen or the title compresses to a few chars per line.
 * Collapse to a vertical stack: title block on top, actions
 * stretched full-width below. Touch targets bumped to 44px per
 * WCAG 2.1 AA at the same time. */
@media (max-width: 768px), (max-height: 600px) {
    /* .profile-survey-card — "what have I worked on" rollup card */
    .profile-survey-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .profile-survey-card-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }
    .profile-survey-card-cta {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 14px;
        text-align: center;
    }
    .profile-survey-card-dashboard {
        text-align: center;
        padding: 8px;
        min-height: 32px;
    }

    /* .profile-session-card — per-session collapsible row */
    .profile-session-card-head {
        gap: 10px;
        padding: 12px 14px;
    }

    /* .manage-survey-row — admin survey-list row */
    .manage-survey-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 16px;
    }
    .manage-survey-row-actions {
        align-self: stretch;
    }
}

/* Slice C4 follow-up — activity feed of contributions. Each row is
 * one response (one parcel surveyed), tagged with the survey it
 * belongs to. Replaces the session-card list. */
.profile-activity-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.profile-activity-row {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: white;
    border: 1px solid #e1e8ef;
    border-radius: 8px;
}
/* Slice C4 follow-up — thumbnail slot. Fixed width so rows are
 * visually aligned regardless of which surveys have imagery. */
.profile-activity-row-thumb {
    width: 140px;
    height: 90px;
    flex-shrink: 0;
    background: #f4f6fa;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.profile-activity-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}
.profile-activity-row-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.profile-activity-row-parcel {
    color: #1a2a3a;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-activity-row-parcelid {
    color: #6b7682;
    font-size: 12px;
    font-weight: normal;
}
.profile-activity-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7682;
}
.profile-activity-row-when { white-space: nowrap; }
.profile-activity-row-edited {
    color: #9aa6b2;
    font-style: italic;
}
.profile-activity-row-flagged {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.profile-activity-row-sub {
    margin-bottom: 2px;
}
.profile-activity-row-survey-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}
.profile-activity-row-survey-link:hover { text-decoration: underline; }
.profile-activity-row-answers {
    color: #4a5563;
    font-size: 12px;
}
.profile-activity-row-answer {
    color: #1a2a3a;
}
body.theme-dark .profile-activity-row {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .profile-activity-row-parcel { color: #e6eaee; }
body.theme-dark .profile-activity-row-parcelid,
body.theme-dark .profile-activity-row-meta,
body.theme-dark .profile-activity-row-answers { color: #a4adb7; }
body.theme-dark .profile-activity-row-survey-link { color: #93c5fd; }
body.theme-dark .profile-activity-row-answer { color: #e6eaee; }

/* ── /welcome landing page (Slice L1) ──────────────────────────────
 * Minimal first-impression surface for new users: wordmark +
 * three-verb tagline + sign-in buttons. Per-user feedback, the
 * original marketing copy + feature trio + footer were removed —
 * the wordmark IS the explanation; people who need more know what
 * survey.det.land is from context (an invite, a teammate). Keep
 * the page sparse and quick to act on.
 *
 * Returning users see a "Welcome back" variant (renderSignedIn)
 * that uses .welcome-headline + .welcome-sub instead of the
 * wordmark + tagline. Same hero frame, different copy.
 */
.welcome-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 80px 24px 80px;
}
.welcome-hero {
    text-align: center;
    padding: 24px 0 48px;
}
.welcome-hero--minimal {
    /* Tight vertical rhythm for the signed-out variant — the page
     * has no other sections, so we let it sit a bit higher on the
     * viewport rather than centering all the way down. */
    padding: 80px 0 24px;
}
.welcome-hero--returning { padding-bottom: 24px; }
.welcome-hero-body {
    max-width: 640px;
    margin: 0 auto;
}
.welcome-wordmark {
    color: #2563eb;
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}
.welcome-tagline {
    color: #6b7280;
    font-size: 14px;
    letter-spacing: 0.04em;
    margin: 0 0 32px;
}
.welcome-headline {
    /* Used by the "Welcome back, {name}" returning-user state. */
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    line-height: 1.15;
    color: #0f1620;
    margin: 0 0 16px;
}
.welcome-sub {
    font-size: 17px;
    line-height: 1.55;
    color: #4a5563;
    margin: 0 auto 28px;
    max-width: 540px;
}
.welcome-cta-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}
.welcome-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #d6dde6;
    background: white;
    color: #1a2a3a;
    text-decoration: none;
    cursor: pointer;
    transition: transform 80ms ease, box-shadow 80ms ease;
}
.welcome-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(15, 22, 32, 0.08);
}
.welcome-cta-btn--primary {
    background: #2563eb;
    color: white;
    border-color: #1d4ed8;
}
.welcome-cta-btn--primary:hover { background: #1d4ed8; }
.welcome-cta-status {
    color: #6b7280;
    font-size: 13px;
    margin: 4px 0 0;
    min-height: 1.2em;
}

/* Dark-mode variants */
body.theme-dark .welcome-wordmark { color: #93c5fd; }
body.theme-dark .welcome-tagline { color: #a4adb7; }
body.theme-dark .welcome-headline { color: #f0f3f6; }
body.theme-dark .welcome-sub { color: #a4adb7; }
body.theme-dark .welcome-cta-btn {
    background: #1c2634;
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .welcome-cta-btn:hover { background: #243044; }
body.theme-dark .welcome-cta-btn--primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: white;
}
.profile-session-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}
.profile-session-card-count {
    font-size: 14px;
    color: #4a5563;
}
.profile-session-card-count strong { color: #1a2a3a; font-weight: 700; }
/* Slice 7.5 — inline Resume link on active session rows. */
.profile-session-card-resume {
    font-size: 12px;
    font-weight: 600;
    color: #0080ff;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid #0080ff;
    border-radius: 999px;
    background: #fff;
}
.profile-session-card-resume:hover {
    background: rgba(0, 128, 255, 0.08);
}
body.theme-dark .profile-session-card-resume {
    background: transparent;
    color: #6db5ff;
    border-color: #6db5ff;
}
body.theme-dark .profile-session-card-resume:hover {
    background: rgba(109, 181, 255, 0.12);
}
.profile-session-card-chevron {
    color: #7a8693;
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.profile-session-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f0f4f8;
    color: #6b7682;
}
.profile-session-badge.is-active { background: #eaf4ff; color: #0080ff; }
.profile-session-badge.is-completed { background: #e6f7ee; color: #1a9c5f; }
.profile-session-badge.is-abandoned { background: #fbeae8; color: #c43c3c; }

.profile-session-detail {
    border-top: 1px solid #ecedf0;
    background: #fafbfc;
    padding: 14px 18px;
}
.profile-session-loading {
    color: #7a8693;
    font-size: 13px;
    text-align: center;
    padding: 12px;
}
.profile-session-empty {
    color: #6b7682;
    font-size: 13px;
    margin: 0;
}
.profile-response-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.profile-response-row {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.profile-response-row:last-child { margin-bottom: 0; }
.profile-response-row-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    color: #1a2a3a;
}
.profile-response-row-date {
    font-size: 12px;
    color: #7a8693;
    flex: 0 0 auto;
}
.profile-response-row-answers {
    font-size: 13px;
    color: #4a5563;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.profile-response-answer { white-space: nowrap; }
.profile-response-answer em {
    color: #7a8693;
    font-style: normal;
    margin-right: 4px;
}
.profile-response-answer--empty {
    color: #a3acb6;
    font-style: italic;
}

.profile-empty-card {
    margin: 0;
    text-align: center;
}
.profile-empty-card h3 {
    font-size: 18px;
    margin: 0 0 6px;
    color: #1a2a3a;
}
.profile-empty-card p {
    font-size: 14px;
    color: #5a6470;
    margin: 0 0 18px;
}

body.theme-dark .profile-brand-chip {
    background: #1c252e;
    color: #6db5ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
body.theme-dark .profile-stat,
body.theme-dark .profile-session-card,
body.theme-dark .profile-response-row {
    background: #1c252e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.theme-dark .profile-name,
body.theme-dark .profile-session-card-title,
body.theme-dark .profile-response-row-head,
body.theme-dark .profile-empty-card h3 {
    color: #f0f3f6;
}
body.theme-dark .profile-email,
body.theme-dark .profile-session-card-sub,
body.theme-dark .profile-stat-label,
body.theme-dark .profile-response-row-date {
    color: #9aa6b2;
}
body.theme-dark .profile-stat-num { color: #6db5ff; }
body.theme-dark .profile-active-session {
    background: #1c2c40;
    border-color: #2f4566;
}
body.theme-dark .profile-active-session-meta { color: #f0f3f6; }
body.theme-dark .profile-active-session-meta span { color: #b8c0c8; }
body.theme-dark .profile-session-card-head:hover { background: #2a333c; }
body.theme-dark .profile-session-detail {
    background: #161e28;
    border-top-color: #2a333c;
}
body.theme-dark .profile-response-row-answers { color: #c8d0d8; }

/* ── Profile orgs section + create modal (Slice 2.5) ────────────────── */
.profile-orgs {
    margin-bottom: 28px;
}
.profile-cta-link--btn {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.profile-cta-link--btn:hover { text-decoration: underline; }
.profile-orgs-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.profile-org-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 150ms ease, transform 150ms ease;
    /* org-page renders the row's content inline (meta + actions);
     * the user-profile flow wraps it all in `.profile-org-row-link`
     * which carries its own padding. Drop default padding when a
     * link wrapper is present so we don't double-pad. */
    padding: 14px 18px;
}
.profile-org-row:has(.profile-org-row-link) { padding: 0; }
.profile-org-row:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.profile-org-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.profile-org-row-delete {
    padding: 6px 12px;
    border: 1px solid #b91c1c;
    background: white;
    color: #b91c1c;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.profile-org-row-delete:hover { background: #fee2e2; }
body.theme-dark .profile-org-row-delete {
    background: #1c252e;
    border-color: #b91c1c;
    color: #fca5a5;
}
body.theme-dark .profile-org-row-delete:hover { background: #2a1b1b; }
/* Wrap the row's interactive surface in an <a> so the whole card
 * is a click target. Reset link defaults to look like the static
 * card it replaced. */
.profile-org-row-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    text-decoration: none;
    color: inherit;
}
.profile-org-row-meta {
    flex: 1 1 auto;
    min-width: 0;
}
.profile-org-row-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a2a3a;
    margin-bottom: 2px;
}
.profile-org-row-sub {
    font-size: 12px;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-orgs-empty {
    color: #6b7682;
    font-size: 14px;
    margin: 0;
    padding: 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
body.theme-dark .profile-org-row,
body.theme-dark .profile-orgs-empty {
    background: #1c252e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.theme-dark .profile-org-row-name { color: #f0f3f6; }
body.theme-dark .profile-org-row-sub,
body.theme-dark .profile-orgs-empty { color: #9aa6b2; }

/* Create-org modal */
.profile-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 38, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    animation: profile-modal-fade 160ms ease-out;
}
@keyframes profile-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.profile-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    width: 100%;
    max-width: 460px;
    margin: 24px;
    animation: profile-modal-rise 220ms cubic-bezier(0.2, 0.8, 0.4, 1);
}
@keyframes profile-modal-rise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
}
.profile-modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #1a2a3a;
}
.profile-modal-close {
    background: transparent;
    border: 0;
    font-size: 22px;
    line-height: 1;
    color: #7a8693;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.profile-modal-close:hover {
    background: #f0f4f8;
    color: #1a2a3a;
}
.profile-modal-body {
    padding: 4px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.profile-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-modal-field em {
    font-style: normal;
    text-transform: none;
    color: #a3acb6;
    font-weight: 500;
    letter-spacing: 0;
}
.profile-modal-field input,
.profile-modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1a2a3a;
    background: #fff;
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    resize: vertical;
}
.profile-modal-field input:focus,
.profile-modal-field textarea:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
.profile-modal-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fdecea;
    color: #c43c3c;
    font-size: 13px;
}
.profile-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 4px;
}
.profile-modal-actions .link-btn {
    background: transparent;
    border: 0;
    color: #6b7682;
    font: inherit;
    cursor: pointer;
    padding: 8px 4px;
}
.profile-modal-actions .link-btn:hover { color: #1a2a3a; }
body.theme-dark .profile-modal {
    background: #1c252e;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
body.theme-dark .profile-modal-header h2 { color: #f0f3f6; }
body.theme-dark .profile-modal-close { color: #b8c0c8; }
body.theme-dark .profile-modal-close:hover {
    background: #2a333c;
    color: #f0f3f6;
}
body.theme-dark .profile-modal-field { color: #9aa6b2; }
body.theme-dark .profile-modal-field input,
body.theme-dark .profile-modal-field textarea {
    background: #161e28;
    border-color: #3b454f;
    color: #f0f3f6;
}
body.theme-dark .profile-modal-field input:focus,
body.theme-dark .profile-modal-field textarea:focus {
    border-color: #6db5ff;
    box-shadow: 0 0 0 2px rgba(109, 181, 255, 0.18);
}
body.theme-dark .profile-modal-error {
    background: #4a1f1c;
    color: #ff8a82;
}
body.theme-dark .profile-modal-actions .link-btn { color: #9aa6b2; }
body.theme-dark .profile-modal-actions .link-btn:hover { color: #f0f3f6; }

/* ── Org dashboard (Slice 3) ──────────────────────────────────────── */
/* /org.html?id=<orgId>. Re-uses .profile-* card vocabulary; adds an
 * org-specific header block and a "(you)" pill on the active member. */
.org-header {
    margin-bottom: 28px;
}
.org-header-eyebrow {
    font-size: 12px;
    font-weight: 600;
    color: #0080ff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.org-name {
    font-size: 26px;
    font-weight: 700;
    color: #1a2a3a;
    margin: 0 0 6px;
    line-height: 1.2;
}
.org-description {
    font-size: 15px;
    color: #4a5563;
    margin: 0;
}
.org-self {
    font-size: 12px;
    font-weight: 500;
    color: #0080ff;
    margin-left: 4px;
}
body.theme-dark .org-name { color: #f0f3f6; }
body.theme-dark .org-description { color: #b8c0c8; }
body.theme-dark .org-header-eyebrow,
body.theme-dark .org-self { color: #6db5ff; }

/* ── Slice 5: invite UI ──────────────────────────────────────────────── */
.org-invite-cancel {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: #7a8693;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}
.org-invite-cancel:hover {
    background: #fdecea;
    color: #c43c3c;
}
.profile-modal-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #6b7682;
    line-height: 1.4;
}
body.theme-dark .org-invite-cancel { color: #b8c0c8; }
body.theme-dark .org-invite-cancel:hover {
    background: #4a1f1c;
    color: #ff8a82;
}
body.theme-dark .profile-modal-hint { color: #9aa6b2; }

/* ── Slice 6a: per-member admin controls ────────────────────────────── */
.org-member-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.org-member-role-select {
    padding: 4px 8px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1a2a3a;
    background: #fff;
    cursor: pointer;
}
.org-member-role-select:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
.org-member-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: #7a8693;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.org-member-remove:hover {
    background: #fdecea;
    color: #c43c3c;
}
body.theme-dark .org-member-role-select {
    background: #1c252e;
    border-color: #3b454f;
    color: #f0f3f6;
}
body.theme-dark .org-member-role-select:focus {
    border-color: #6db5ff;
    box-shadow: 0 0 0 2px rgba(109, 181, 255, 0.18);
}
body.theme-dark .org-member-remove { color: #b8c0c8; }
body.theme-dark .org-member-remove:hover {
    background: #4a1f1c;
    color: #ff8a82;
}

/* ── Slice 6b: inline Edit affordance next to profile/org names ────── */
.profile-name-edit {
    margin-left: 12px;
    padding: 4px 12px;
    border: 1px solid #d0d7de;
    border-radius: 999px;
    background: transparent;
    color: #0080ff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    vertical-align: middle;
    transition: background 150ms ease, border-color 150ms ease;
}
.profile-name-edit:hover {
    background: #eaf4ff;
    border-color: #0080ff;
}
body.theme-dark .profile-name-edit {
    border-color: #3b454f;
    color: #6db5ff;
}
body.theme-dark .profile-name-edit:hover {
    background: #1c2c40;
    border-color: #6db5ff;
}

/* STAGING badge — only visible when firebase-init.js stamped `env-staging`
   on <body>. Bottom-right pill so it doesn't collide with the
   top-right account chip. */
body.env-staging::after {
    content: "STAGING";
    position: fixed;
    bottom: 8px;
    right: 8px;
    z-index: 9999;
    background: #f9c74f;
    color: #1a2a3a;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
body.theme-dark.env-staging::after {
    background: #e1a90b;
    color: #0f1620;
}

/* Account chip — top-right "who am I" indicator mounted by
   js/shared/account-chip.js. Auto-hides while signed-out (login
   overlay covers the page in that state). */
.account-chip {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9998;
    font-size: 13px;
}
.account-chip[hidden] {
    display: none;
}
.account-chip-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 3px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    color: #1f2937;
    font: inherit;
}
.account-chip-trigger:hover {
    background: white;
    border-color: #9ca3af;
}
/* Signed-out variant — just the silhouette icon in a round button.
   Compact, low-emphasis until the user clicks it. */
.account-chip-trigger--signed-out {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.account-chip-trigger--signed-out:hover {
    color: #1f2937;
}
.account-chip-silhouette {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.account-chip-signin-status {
    margin: 6px 10px 4px;
    padding: 0;
    color: #6b7280;
    font-size: 12px;
    min-height: 1em;
}
body.theme-dark .account-chip-trigger--signed-out {
    color: #9ca3af;
}
body.theme-dark .account-chip-trigger--signed-out:hover {
    color: #e6eaee;
}
body.theme-dark .account-chip-signin-status { color: #9ca3af; }
.account-chip-photo {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: block;
}
.account-chip-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-weight: 600;
    font-size: 12px;
}
.account-chip-name {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-chip-caret {
    color: #6b7280;
    font-size: 10px;
    margin-left: 2px;
}
.account-chip-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    padding: 4px;
}
.account-chip-info {
    padding: 8px 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
}
.account-chip-info-name {
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-chip-info-email {
    color: #6b7280;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}
.account-chip-link,
.account-chip-signout {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 10px;
    color: #1f2937;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    box-sizing: border-box;
    font: inherit;
}
.account-chip-link:hover,
.account-chip-signout:hover {
    background: #f3f4f6;
}
.account-chip-signout {
    color: #dc2626;
    border-top: 1px solid #e5e7eb;
    margin-top: 4px;
    padding-top: 9px;
}
/* Slice C1 — primary action variant for "+ Start a session" so the
 * shortcut stands out at the top of the chip dropdown. Reachable
 * from any signed-in page. */
.account-chip-link--primary {
    color: #2563eb !important;
    font-weight: 600;
}
.account-chip-link--primary:hover {
    background: #eff6ff !important;
}
.account-chip-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* Dark theme variants */
body.theme-dark .account-chip-trigger {
    background: rgba(28, 38, 52, 0.95);
    border-color: #3b454f;
    color: #e6eaee;
}
body.theme-dark .account-chip-trigger:hover {
    background: #1c2634;
    border-color: #6db5ff;
}
body.theme-dark .account-chip-menu {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .account-chip-info-name { color: #e6eaee; }
body.theme-dark .account-chip-info-email { color: #9ca3af; }
body.theme-dark .account-chip-link,
body.theme-dark .account-chip-signout {
    color: #e6eaee;
}
body.theme-dark .account-chip-link--primary { color: #93c5fd !important; }
body.theme-dark .account-chip-link--primary:hover { background: rgba(59, 130, 246, 0.12) !important; }
body.theme-dark .account-chip-divider { background: #3b454f; }
body.theme-dark .account-chip-link:hover,
body.theme-dark .account-chip-signout:hover {
    background: #243044;
}
body.theme-dark .account-chip-signout {
    color: #f87171;
    border-top-color: #3b454f;
}
body.theme-dark .account-chip-info {
    border-bottom-color: #3b454f;
}

/* Push the map app's icon-rail down so it clears the account-chip
   pill in the top-right. Applies anywhere the chip is mounted —
   account-chip.js stamps `body.has-account-chip` on mount. During an
   active survey the rail moves to bottom-right via the
   body.survey-active rule and this offset is overridden. */
body.has-account-chip #icon-rail {
    top: 54px;
}

/* Slide the account chip left when the selection sidebar is visible
   so it doesn't sit on top of the sidebar's content. Mirrors the
   #icon-rail shift in theme.css. On mobile the sidebar slides up
   from the bottom (not in from the right), so the chip stays pinned
   to the top-right corner. */
body.sidebar-visible .account-chip {
    right: calc(var(--sidebar-width, 380px) + 10px);
}
@media (max-width: 768px), (max-height: 600px) {
    body.sidebar-visible .account-chip {
        right: 10px;
    }
}

/* ── Slice A: admin console ─────────────────────────────────────── */
.admin-tab-nav {
    display: flex;
    gap: 4px;
    margin: 16px 0;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 4px;
}
.admin-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    color: #6b7280;
    font: inherit;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.admin-tab:hover {
    color: #1f2937;
}
.admin-tab--active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.admin-table-wrap {
    overflow-x: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th,
.admin-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f1f3;
    vertical-align: middle;
}
.admin-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-table tbody tr:last-child td {
    border-bottom: none;
}
.admin-table tbody tr:hover {
    background: #f9fafb;
}
.admin-user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}
.admin-user-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-weight: 600;
}
.admin-user-name {
    color: #1f2937;
    font-weight: 500;
}
.admin-user-email {
    color: #6b7280;
    font-size: 12px;
}
.admin-user-me {
    color: #2563eb;
    font-weight: 500;
}
.admin-user-when {
    color: #6b7280;
    white-space: nowrap;
}
.admin-user-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #1f2937;
}
.admin-user-toggle input[disabled] + * {
    opacity: 0.6;
}
.admin-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
.admin-pill--green {
    background: #dcfce7;
    color: #166534;
}
.admin-pill--gray {
    background: #f3f4f6;
    color: #6b7280;
}
.admin-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.admin-link:hover {
    text-decoration: underline;
}
.admin-table-hint {
    margin: 8px 4px 0;
    color: #9ca3af;
    font-size: 12px;
}
body.theme-dark .admin-table-wrap {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .admin-table th {
    background: #243044;
    color: #9ca3af;
}
body.theme-dark .admin-table td {
    border-bottom-color: #2c3848;
}
body.theme-dark .admin-table tbody tr:hover {
    background: #243044;
}
body.theme-dark .admin-tab-nav {
    border-bottom-color: #3b454f;
}
body.theme-dark .admin-tab {
    color: #9ca3af;
}
body.theme-dark .admin-tab:hover {
    color: #e6eaee;
}
body.theme-dark .admin-tab--active {
    color: #6db5ff;
    border-bottom-color: #6db5ff;
}
body.theme-dark .admin-user-name { color: #e6eaee; }
body.theme-dark .admin-user-toggle label { color: #e6eaee; }
body.theme-dark .admin-pill--green {
    background: #064e3b;
    color: #6ee7b7;
}
body.theme-dark .admin-pill--gray {
    background: #243044;
    color: #9ca3af;
}
body.theme-dark .admin-link { color: #6db5ff; }

/* ── Slice 7: per-survey dashboard ─────────────────────────────── */
.survey-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.survey-dashboard-titleblock {
    flex: 1 1 320px;
    min-width: 0;
}
.survey-dashboard-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.survey-dashboard-meta-when {
    color: #6b7280;
    font-size: 12px;
}
.survey-dashboard-desc {
    color: #4b5563;
    margin-top: 8px;
    max-width: 60ch;
}
.survey-dashboard-cta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.survey-dashboard-secondary-btn {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 0;
}
.survey-dashboard-secondary-btn:hover {
    text-decoration: underline;
}
body.theme-dark .survey-dashboard-secondary-btn { color: #6db5ff; }

/* Coverage map — embedded MapLibre instance on the per-survey
   dashboard. Mirrors the runtime app's tech stack but a smaller,
   non-interactive surface (results-viewing, not selection). */
/* Back-to-top button for the long dashboard. */
.dash-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-bg-elevated, #fff);
    color: #0080ff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}
.dash-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dash-to-top svg { width: 20px; height: 20px; }
.dash-to-top:hover { border-color: #0080ff; background: rgba(0, 128, 255, 0.04); }
body.theme-dark .dash-to-top { background: #1c2330; border-color: #2a3340; }

/* The dashboard earns more width than the reading-width profile/org pages —
   the two-pane map+feed wants room. (Scoped so other .profile-page users
   keep the 1200px reading width.) */
.profile-page.survey-dashboard-page { max-width: min(1760px, calc(100vw - 48px)); }

/* Two-pane: sticky coverage map (left) + scrolling activity feed (right). */
.dash-two-pane {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--space-4, 16px);
    align-items: start;
    margin-bottom: var(--space-4, 16px);
}
.dash-two-pane > .profile-section { margin-bottom: 0; }
.dash-two-pane > #dash-activity { min-width: 0; }
/* Map fills the left column at viewport height and sticks while the feed
   scrolls — no more short map with dead space below it. */
.dash-two-pane > #dash-coverage {
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
}
.dash-two-pane > #dash-coverage .coverage-map-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dash-two-pane > #dash-coverage .coverage-map-canvas {
    flex: 1 1 auto;
    height: auto;
    min-height: 240px;
}
@media (max-width: 768px), (max-height: 600px) {
    .dash-two-pane { grid-template-columns: 1fr; }
    .dash-two-pane > #dash-coverage { position: static; height: auto; }
    .dash-two-pane > #dash-coverage .coverage-map-canvas { flex: none; height: 360px; }
}

/* Quick-nav icon chips under the stats strip. */
.dashboard-nav { display: flex; flex-wrap: wrap; gap: var(--space-3, 12px); margin: var(--space-3, 12px) 0 var(--space-6, 24px); }
.dashboard-nav-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-3, 12px) var(--space-5, 20px);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-pill, 999px);
    background: var(--color-bg-elevated, #fff);
    color: var(--color-fg-secondary, #495057);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.dashboard-nav-link:hover { border-color: var(--color-accent, #0080ff); color: var(--color-accent, #0080ff); background: rgba(0, 128, 255, 0.04); }
.dashboard-nav-icon { width: 18px; height: 18px; display: inline-flex; }
.dashboard-nav-icon svg { width: 100%; height: 100%; }
body.theme-dark .dashboard-nav-link { background: #1c2330; border-color: #2a3340; color: #c2cad3; }
.profile-section[id] { scroll-margin-top: 16px; }

/* ── Dashboard cleanup pass ───────────────────────────────────────
   .profile-section-title has no base rule (renders as a browser
   default h2), so sections used to hard-code `font-size: 1rem`
   inline — and a few newer sections forgot to, leaving three
   different title sizes on one page. Unify them here; the page
   title keeps a larger size via the --title modifier. */
.survey-dashboard-page .profile-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 var(--space-3, 12px);
    color: var(--color-fg-primary, #333);
}
.survey-dashboard-page .profile-section-title.survey-dashboard-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 var(--space-1, 4px);
}

/* Muted empty-state / helper copy. Tokenized so dark mode is free. */
.dash-empty { color: var(--color-fg-muted, #6b7280); margin: 0; }
.dash-empty-sub { color: var(--color-fg-muted, #6b7280); font-size: 13px; margin: 0; }
.dash-pinned-note { color: var(--color-fg-primary, #1f2937); margin: 0 0 var(--space-1, 4px); }
.activity-card-links--empty { color: var(--color-fg-muted, #9ca3af); }

/* Error / not-found cards: drop the default h2 top margin. */
.session-launcher-cta-card h2 { margin-top: 0; }

/* Keyboard focus rings for the role="button" surfaces (gallery
   tiles + activity thumbs) that onMountKeydown activates. */
.gallery-tile:focus-visible,
.activity-card-thumb[role="button"]:focus-visible,
.activity-grouped-thumb:focus-visible {
    outline: 2px solid var(--color-accent, #0080ff);
    outline-offset: 2px;
}

/* Activity cards size to their COLUMN, not the viewport. In the
   two-pane layout the feed sits in the narrow right column, where a
   fixed 220px thumb + body crushes the text to a few words per line.
   A container query stacks thumb-over-body once the feed itself gets
   tight — independent of viewport width, so it works on a wide
   desktop with a narrow feed column just as well as on a phone. */
.dash-two-pane .activity-feed {
    container-type: inline-size;
    container-name: dash-activity-feed;
}
@container dash-activity-feed (max-width: 480px) {
    .activity-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .activity-card-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
    }
}

/* Gallery — photo grid. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3, 12px);
}
.gallery-tile { cursor: pointer; }
.gallery-tile-img {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-md, 10px);
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gallery-tile:hover .gallery-tile-img { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); }
.gallery-tile-cap {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gallery-more { font-size: 12px; color: #7a8693; margin-top: var(--space-3, 12px); }
body.theme-dark .gallery-tile-img { background: #243044; }
body.theme-dark .gallery-tile-cap { color: #c2cad3; }

/* Coverage progress hero — sits above the map. */
.coverage-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4, 16px);
    flex-wrap: wrap;
    margin-bottom: var(--space-3, 12px);
}
.coverage-hero-stat { display: flex; flex-direction: column; }
.coverage-hero-num {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--color-text, #1f2937);
    letter-spacing: -0.01em;
}
.coverage-hero-denom { font-size: 20px; font-weight: 600; color: #9aa6b2; }
.coverage-hero-label { font-size: 13px; color: #7a8693; margin-top: 4px; }
.coverage-hero-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 420px;
}
.coverage-hero-pct {
    font-size: 18px;
    font-weight: 700;
    color: #0080ff;
    font-variant-numeric: tabular-nums;
}
.coverage-hero-bar {
    flex: 1 1 auto;
    height: 10px;
    border-radius: 999px;
    background: var(--color-bg-muted, #eef1f4);
    overflow: hidden;
}
.coverage-hero-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22a565, #0080ff);
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.4, 1);
}
body.theme-dark .coverage-hero-num { color: #e6eaee; }
body.theme-dark .coverage-hero-bar { background: #243044; }

/* "What changed year over year" feed. */
.changes-sub { font-size: 13px; color: #7a8693; margin: 0 0 var(--space-3, 12px); }
.changes-list { display: flex; flex-direction: column; gap: var(--space-2, 8px); }
.changes-row {
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 10px);
    background: var(--color-bg-elevated, #fff);
    padding: var(--space-3, 12px) var(--space-4, 16px);
}
.changes-head { display: flex; align-items: baseline; gap: var(--space-2, 8px); margin-bottom: 6px; }
.changes-head strong { font-size: 14px; color: var(--color-text, #1f2937); }
.changes-years {
    font-size: 11px;
    font-weight: 700;
    color: #0064cc;
    background: #eef4ff;
    padding: 1px 8px;
    border-radius: 999px;
}
.changes-detail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2, 8px);
    font-size: 13px;
    padding: 2px 0;
}
.changes-q { flex: 1 1 160px; color: #495057; }
.changes-from { color: #9aa6b2; text-decoration: line-through; }
.changes-arrow { color: #c2410c; font-weight: 700; }
.changes-to { color: var(--color-text, #1f2937); font-weight: 600; }
body.theme-dark .changes-row { background: #1c2330; border-color: #2a3340; }
body.theme-dark .changes-head strong,
body.theme-dark .changes-to { color: #e6eaee; }
body.theme-dark .changes-years { background: #1f3350; color: #8fc0ff; }

/* Top-surveyors leaderboard. */
.leaderboard { display: flex; flex-direction: column; gap: var(--space-2, 8px); }
.leaderboard-row {
    display: grid;
    grid-template-columns: 20px 28px minmax(80px, 1fr) minmax(80px, 2fr) auto;
    align-items: center;
    gap: var(--space-3, 12px);
}
.leaderboard-rank { font-size: 13px; font-weight: 700; color: #9aa6b2; text-align: center; }
.leaderboard-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #cdd5dd;
}
.leaderboard-avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #0080ff;
}
.leaderboard-name {
    font-size: 14px;
    color: var(--color-text, #1f2937);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.leaderboard-bar { height: 8px; border-radius: 999px; background: var(--color-bg-muted, #eef1f4); overflow: hidden; }
.leaderboard-fill { display: block; height: 100%; border-radius: 999px; background: #0080ff; }
.leaderboard-count { font-size: 13px; font-weight: 600; color: #495057; font-variant-numeric: tabular-nums; }
body.theme-dark .leaderboard-name { color: #e6eaee; }
body.theme-dark .leaderboard-bar { background: #243044; }

.coverage-map-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.coverage-map-canvas {
    width: 100%;
    height: 360px;
    background: #eef2f6;
}
.coverage-map-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2, 8px) var(--space-4, 16px);
    margin: 0;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    color: var(--color-fg-muted, #6b7280);
    font-size: 12px;
}
.coverage-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1, 4px);
}
.coverage-map-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.coverage-map-swatch--surveyed {
    background: #22c55e;
}
.coverage-map-swatch--boundary {
    background: rgba(37, 99, 235, 0.18);
    border: 2px solid #2563eb;
    box-sizing: border-box;
}
.coverage-map-swatch--bobby {
    background: #f59e0b;
}
.coverage-map-swatch--filter {
    background: #7c3aed;
}
/* ── Coverage-map year stepper + attribute filter (Slice C) ── */
.coverage-map-filterbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
}
.coverage-map-filterbar--loading { color: #6b7280; }
.coverage-map-yearstep { display: inline-flex; align-items: center; gap: 6px; }
.coverage-map-yearbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
}
.coverage-map-yearbtn:disabled { opacity: 0.4; cursor: default; }
.coverage-map-year {
    min-width: 3.5em;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.coverage-map-catfilter { display: inline-flex; align-items: center; gap: 6px; color: #6b7280; }
.coverage-map-catselect {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: #1f2937;
}
.coverage-map-matchcount { margin-left: auto; font-weight: 600; color: #6d28d9; }
.coverage-map-matchcount--muted { color: #6b7280; font-weight: 400; }
/* QC console — paginated lane "load more" bar */
.qc-loadmore { display: flex; align-items: center; gap: 12px; padding: 6px 0 2px; font-size: 13px; color: #6b7280; flex-wrap: wrap; }
.qc-loadmore-text { font-weight: 500; }
/* Flash an activity card when navigated to from a map click. */
.activity-card--flash { animation: activity-flash 1.6s ease-out; }
@keyframes activity-flash {
    0%, 12% { box-shadow: 0 0 0 3px #7c3aed; }
    100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}
/* Insights panel source tabs (Accepted vs Bobby AI + Human) */
.insights-tabs { display: inline-flex; gap: 4px; margin-bottom: 12px; background: #f3f4f6; padding: 3px; border-radius: 10px; }
.insights-tab { padding: 5px 12px; border: 0; background: transparent; border-radius: 7px; font: inherit; font-size: 13px; color: #6b7280; cursor: pointer; }
.insights-tab--on { background: #fff; color: #1f2937; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* ── Slice 7.3: activity feed (per-survey dashboard) ───────────── */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.activity-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    overflow: hidden;
}
.activity-card-thumb {
    width: 220px;
    height: 130px;
    border-radius: 6px;
    overflow: hidden;
    background: #e5e7eb;
    position: relative; /* Mapillary SDK absolute-positions its canvas */
    display: flex;
    align-items: center;
    justify-content: center;
}
.activity-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* CSS-positioned thumbnails (Slice 7.4). The activity-thumb module
   loads Mapillary's thumb_2048 URL + the image's intrinsic compass
   angle, then positions the equirectangular panorama so the captured
   bearing lands at container center. Lighter than the SDK and always
   fills the slot. */
.activity-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.activity-thumb-pano {
    width: 100%;
    height: 100%;
    /* backgroundImage / backgroundSize / backgroundPosition /
       backgroundRepeat set inline by activity-thumb.js per-card. */
}
/* Thumb shows a click affordance when it has imagery. The whole
   thumb slot is the hit-target (220×130). */
.activity-card--clickable .activity-card-thumb {
    cursor: zoom-in;
    transition: transform 120ms ease;
}
.activity-card--clickable .activity-card-thumb:hover {
    transform: scale(1.02);
}

/* Lightbox modal — opens full-viewport with a centered card holding
   the Mapillary SDK viewer at the captured bearing. */
.activity-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.activity-lightbox[hidden] {
    display: none;
}
.activity-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}
.activity-lightbox-card {
    position: relative;
    width: min(1100px, 92vw);
    max-height: 92vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.activity-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.activity-lightbox-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}
.activity-lightbox-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}
.activity-lightbox-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 6px;
}
.activity-lightbox-close:hover { color: #1f2937; }
.activity-lightbox-viewer-wrap {
    background: #000;
    padding: 0;
    /* The SDK fills 100% of its container. We give it ~16:9 aspect
       and let it scale up to the viewport. */
}
.activity-lightbox-viewer {
    width: 100%;
    height: min(640px, calc(92vh - 140px));
    position: relative; /* Mapillary SDK needs this */
}
.activity-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #6b7280;
}
body.theme-dark .activity-lightbox-card {
    background: #1c2634;
}
body.theme-dark .activity-lightbox-header,
body.theme-dark .activity-lightbox-footer {
    border-color: #3b454f;
}
body.theme-dark .activity-lightbox-title { color: #e6eaee; }
body.theme-dark .activity-lightbox-subtitle,
body.theme-dark .activity-lightbox-footer { color: #9ca3af; }
body.theme-dark .activity-lightbox-close { color: #9ca3af; }
body.theme-dark .activity-lightbox-close:hover { color: #e6eaee; }
.activity-card-thumb-placeholder {
    color: #9ca3af;
    font-size: 12px;
}
.activity-card-thumb-placeholder--empty {
    font-style: italic;
}
/* Multi-year follow-up — capture-date overlay on the activity
 * thumbnail. Sits in the bottom-third of the image with a soft
 * gradient backdrop so the date is legible against any imagery
 * (light sky, dark pavement, mixed). Reviewers can tell at a
 * glance what vintage of imagery the surveyor was looking at
 * without having to expand the card or open Mapillary. */
.activity-card-thumb-date {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 8px 6px;
    /* White text + dark gradient is theme-AGNOSTIC by design — the
     * overlay sits ON the Mapillary imagery and reads identically in
     * both light + dark mode. Don't add a body.theme-dark override
     * here; the dark gradient already provides the contrast. */
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.30) 60%,
        rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
}
.activity-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.activity-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Slice 8 — make the header span the full card width so the menu
   button can dock to the right. Wraps surveyor+when in a flex-grow
   middle column. */
.activity-card-header-meta {
    flex: 1;
    min-width: 0;
}
.activity-card-menu-btn {
    background: transparent;
    border: none;
    color: #6b7682;
    font-size: 18px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.activity-card-menu-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}
.activity-card-menu-btn:disabled {
    opacity: 0.4;
    cursor: wait;
}
body.theme-dark .activity-card-menu-btn { color: #9aa6b2; }
body.theme-dark .activity-card-menu-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e6eaee;
}
.activity-card-menu {
    position: absolute;
    top: 38px;
    right: 8px;
    background: #fff;
    border: 1px solid #d9dee4;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 50;
    min-width: 180px;
    overflow: hidden;
    animation: activity-card-menu-in 120ms ease-out;
}
@keyframes activity-card-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.activity-card-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    color: #1f2937;
}
.activity-card-menu-item:hover {
    background: #f3f4f6;
}
.activity-card-menu-item--danger { color: #b91c1c; }
.activity-card-menu-item--danger:hover { background: #fef2f2; }
body.theme-dark .activity-card-menu {
    background: #1f262d;
    border-color: #2a3340;
}
body.theme-dark .activity-card-menu-item { color: #e6eaee; }
body.theme-dark .activity-card-menu-item:hover { background: #2a3340; }
body.theme-dark .activity-card-menu-item--danger { color: #fca5a5; }
body.theme-dark .activity-card-menu-item--danger:hover { background: rgba(220, 38, 38, 0.12); }

/* Card needs relative positioning for the menu's absolute popover. */
.activity-card { position: relative; }
.activity-card--busy { opacity: 0.55; pointer-events: none; }

.activity-card-version-badge {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 6px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: help;
}
body.theme-dark .activity-card-version-badge {
    background: rgba(30, 64, 175, 0.4);
    color: #93c5fd;
}
.activity-card-edited {
    /* Migrated to --color-fg-muted so it tracks theme automatically.
     * Previously hardcoded slate (#9aa6b2) read OK in both themes
     * but didn't follow the rest of the secondary-text palette. */
    color: var(--color-fg-muted);
    font-style: italic;
}

/* ── Edit modal (Slice 8) ─────────────────────────────────────────── */
.edit-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9000;
    animation: edit-modal-fade-in 180ms ease-out;
}
@keyframes edit-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.edit-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    animation: edit-modal-pop-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes edit-modal-pop-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.edit-modal-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #eef0f3;
}
.edit-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1f24;
}
.edit-modal-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7682;
}
.edit-modal-form {
    padding: 18px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.edit-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.edit-modal-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #1a1f24;
}
.edit-modal-input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    color: #1a1f24;
    background: #fff;
}
.edit-modal-input:focus {
    outline: none;
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.15);
}
.edit-modal-input--reason {
    background: #fafbfc;
}
.edit-modal-input--readonly {
    background: #f3f5f7;
    color: #4a5660;
    cursor: default;
    user-select: none;
}
body.theme-dark .edit-modal-input--readonly {
    background: #1c252e;
    color: #9aa6b2;
}
.edit-modal-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.edit-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1a1f24;
    cursor: pointer;
}
.edit-modal-check input { width: 15px; height: 15px; accent-color: #2563eb; cursor: pointer; flex: none; }
body.theme-dark .edit-modal-check { color: #e6eaee; }
.edit-modal-field-note {
    font-size: 11px;
    color: #b45309;
}
.edit-modal-empty {
    padding: 20px;
    text-align: center;
    color: #6b7682;
    font-size: 13px;
}
.edit-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid #eef0f3;
}
.edit-modal-cancel {
    background: transparent;
    border: none;
    color: #4a5563;
    font: inherit;
    font-size: 14px;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 6px;
}
.edit-modal-cancel:hover { background: #f3f4f6; }
.edit-modal-save {
    background: #0080ff;
    border: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(0, 128, 255, 0.32);
}
.edit-modal-save:hover { background: #0070e0; }
body.theme-dark .edit-modal {
    background: #1f262d;
}
body.theme-dark .edit-modal-header { border-bottom-color: #2a3340; }
body.theme-dark .edit-modal-header h2 { color: #f0f3f6; }
body.theme-dark .edit-modal-subtitle { color: #9aa6b2; }
body.theme-dark .edit-modal-field-label { color: #f0f3f6; }
body.theme-dark .edit-modal-input {
    background: #1c2330;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .edit-modal-input--reason { background: #1c2330; }
body.theme-dark .edit-modal-empty { color: #9aa6b2; }
body.theme-dark .edit-modal-footer { border-top-color: #2a3340; }
body.theme-dark .edit-modal-cancel { color: #c1cad3; }
body.theme-dark .edit-modal-cancel:hover { background: #2a3340; }

/* ── "Bobby" — AI surveyor nav item, progress card, run modal ──────── */
/* Bobby sits in the dashboard nav strip but is an action, not a section
   jump — a persistent accent tint sets it apart from the neutral pills. */
.dashboard-nav-link--action {
    color: var(--color-accent, #0080ff);
    border-color: rgba(0, 128, 255, 0.4);
    background: rgba(0, 128, 255, 0.06);
}
.dashboard-nav-link--action:hover { background: rgba(0, 128, 255, 0.12); }

/* Inline run-progress card under the stats strip. */
.bobby-run-card { padding: 14px 18px; }
.bobby-run-head { display: flex; align-items: center; gap: 12px; }
.bobby-run-icon { display: inline-flex; color: #0080ff; flex: none; }
.bobby-run-icon svg { width: 22px; height: 22px; }
.bobby-run-meta { flex: 1 1 auto; min-width: 0; }
.bobby-run-title { font-size: 14px; font-weight: 600; color: #1a1f24; }
.bobby-run-status { font-size: 13px; color: #6b7682; margin-top: 2px; }
.bobby-run-card--ok .bobby-run-icon { color: #1f9d57; }
.bobby-run-card--warn .bobby-run-icon { color: #c2562f; }
.bobby-run-card--warn .bobby-run-status { color: #c2562f; }
.bobby-progress {
    margin-top: 10px;
    height: 6px;
    border-radius: 999px;
    background: #e7ebf0;
    overflow: hidden;
}
.bobby-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #0080ff;
    transition: width 400ms ease;
}
body.theme-dark .bobby-run-title { color: #f0f3f6; }
body.theme-dark .bobby-run-status { color: #9aa6b2; }
body.theme-dark .bobby-progress { background: #2a3340; }

/* Run modal — reuses .edit-modal shell. */
.bobby-modal { max-width: 520px; }
.bobby-title-icon { display: inline-flex; vertical-align: -3px; color: #0080ff; }
.bobby-title-icon svg { width: 1.05em; height: 1.05em; }
.bobby-modal-body {
    padding: 18px 24px 4px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.bobby-modal .edit-modal-footer { padding: 14px 24px 20px; margin-top: 0; }
.bobby-modal-intro { margin: 0; font-size: 13px; line-height: 1.5; color: #4a5563; }
.bobby-modal-intro strong { color: #1a1f24; }
.bobby-modal-loading { font-size: 14px; color: #6b7682; padding: 12px 0; }
.bobby-modal-error {
    font-size: 13px;
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 8px;
    padding: 8px 12px;
}
.bobby-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bobby-field--col { align-items: flex-start; flex-direction: column; gap: 6px; }
.bobby-years { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.bobby-year { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #4a5563; }
body.theme-dark .bobby-year { color: #c1cad3; }
.bobby-field-label { font-size: 13px; font-weight: 600; color: #1a1f24; min-width: 78px; }
.bobby-field-suffix { font-size: 12px; color: #8a949f; }
.bobby-input {
    font: inherit;
    font-size: 14px;
    padding: 7px 10px;
    border: 1px solid #d4d9df;
    border-radius: 8px;
    background: #fff;
    color: #1a1f24;
}
.bobby-input--n { width: 96px; }
.bobby-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #4a5563; line-height: 1.4; }
.bobby-cost {
    font-size: 13px;
    font-weight: 600;
    color: #0080ff;
    background: #f0f7ff;
    border-radius: 8px;
    padding: 9px 12px;
}
.bobby-runs { border-top: 1px solid #eef0f3; padding-top: 12px; }
.bobby-runs-head { font-size: 12px; font-weight: 600; color: #8a949f; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.bobby-runs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bobby-run-row { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; color: #4a5563; }
.bobby-run-when { color: #8a949f; flex: none; width: 64px; }
.bobby-run-rmodel { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bobby-run-rstat { flex: none; font-weight: 600; }
.bobby-run-row--done .bobby-run-rstat { color: #1f9d57; }
.bobby-run-row--failed .bobby-run-rstat { color: #c2562f; }
.bobby-run-row--running .bobby-run-rstat, .bobby-run-row--queued .bobby-run-rstat { color: #0080ff; }
body.theme-dark .bobby-runs { border-top-color: #2a3340; }
body.theme-dark .bobby-run-row { color: #c1cad3; }
body.theme-dark .bobby-modal-intro { color: #c1cad3; }
body.theme-dark .bobby-modal-intro strong { color: #f0f3f6; }
body.theme-dark .bobby-field-label { color: #f0f3f6; }
body.theme-dark .bobby-input { background: #1c2330; border-color: #2a3340; color: #e6eaee; }
body.theme-dark .bobby-check { color: #c1cad3; }
body.theme-dark .bobby-cost { background: #16202c; }
.bobby-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.bobby-field-row .bobby-field { flex: 1 1 220px; min-width: 200px; }
.bobby-key-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafb;
    border: 1px solid #eef0f3;
    border-radius: 8px;
}
body.theme-dark .bobby-key-block { background: #161d27; border-color: #2a3340; }
.bobby-input--key { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; }
.bobby-field-hint { font-size: 12px; color: #8a949f; line-height: 1.4; }
.bobby-field-hint--saved { color: #1f9d57; font-weight: 600; }
body.theme-dark .bobby-field-hint { color: #8a949f; }

/* ── Manage survey panel (survey-dashboard) ───────────────────────── */
.manage-survey { /* uses .profile-section spacing */ }
.manage-survey-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e6eaee;
    margin-bottom: 10px;
}
.manage-survey-row:last-child { margin-bottom: 0; }
.manage-survey-row-body { flex: 1; min-width: 0; }
.manage-survey-row-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #1a2a3a;
}
.manage-survey-row-desc {
    margin: 0;
    color: #6b7682;
    font-size: 13px;
    line-height: 1.5;
}
.manage-survey-row-actions {
    flex-shrink: 0;
    align-self: center;
}
.manage-survey-field {
    display: block;
    margin-bottom: 12px;
}
.manage-survey-field:last-child { margin-bottom: 0; }
.manage-survey-field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.manage-survey-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d8df;
    border-radius: 6px;
    background: white;
    color: #1a2a3a;
    box-sizing: border-box;
    font-family: inherit;
}
.manage-survey-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.manage-survey-input--textarea { resize: vertical; min-height: 38px; }
.manage-survey-input:disabled {
    background: #f3f5f7;
    cursor: not-allowed;
}
.manage-survey-publish-btn {
    flex-shrink: 0;
    padding: 9px 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}
.manage-survey-publish-btn:hover { background: #1f56d4; }
.manage-survey-publish-btn--unshare {
    background: white;
    color: #6b7682;
    border: 1px solid #d1d8df;
    box-shadow: none;
}
.manage-survey-publish-btn--unshare:hover {
    background: #f3f5f7;
    color: #1a2a3a;
}
.manage-survey-publish-btn:disabled { opacity: 0.6; cursor: not-allowed; }

body.theme-dark .manage-survey-row {
    background: #1c252e;
    border-color: #2a3340;
}
body.theme-dark .manage-survey-row-title { color: #f0f3f6; }
body.theme-dark .manage-survey-row-desc { color: #9aa6b2; }
body.theme-dark .manage-survey-field-label { color: #9aa6b2; }
body.theme-dark .manage-survey-input {
    background: #0f1620;
    border-color: #2a3340;
    color: #e6eaee;
}
body.theme-dark .manage-survey-input:disabled { background: #1a2230; }
body.theme-dark .manage-survey-publish-btn--unshare {
    background: #1c252e;
    border-color: #2a3340;
    color: #9aa6b2;
}
body.theme-dark .manage-survey-publish-btn--unshare:hover {
    background: #2a3340;
    color: #f0f3f6;
}

/* ── Delete button (reused inside Manage panel + on org rows) ─────── */
.danger-zone-btn {
    flex-shrink: 0;
    padding: 10px 18px;
    border: 1px solid #b91c1c;
    background: white;
    color: #b91c1c;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}
.danger-zone-btn:hover { background: #fee2e2; }
.danger-zone-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.danger-zone-btn--confirm {
    background: #b91c1c;
    color: white;
    border-color: #b91c1c;
    box-shadow: 0 3px 10px rgba(185, 28, 28, 0.32);
}
.danger-zone-btn--confirm:hover { background: #991b1b; }

.delete-survey-modal-body { padding: 20px 24px 8px; }
.delete-survey-modal-warning {
    margin: 0 0 16px;
    padding: 12px 14px;
    background: #fef2f2;
    border-left: 3px solid #b91c1c;
    color: #7f1d1d;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 4px;
}
.delete-survey-modal-list {
    margin: 0;
    padding-left: 22px;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.7;
}
.delete-survey-modal-list li strong { font-weight: 700; }

body.theme-dark .danger-zone-btn {
    background: #1f262d;
    border-color: #b91c1c;
    color: #fca5a5;
}
body.theme-dark .danger-zone-btn:hover { background: #2a1b1b; }
body.theme-dark .delete-survey-modal-warning {
    background: #2a1b1b;
    color: #f6cccc;
}
body.theme-dark .delete-survey-modal-list { color: #e6eaee; }

.activity-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}
.activity-card-avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: white;
    font-weight: 600;
    font-size: 13px;
}
.activity-card-surveyor {
    color: #1f2937;
    font-weight: 600;
    font-size: 13px;
}
.activity-card-when {
    color: #6b7280;
    font-size: 12px;
}
.activity-card-parcel {
    color: #1f2937;
    font-size: 13px;
}
.activity-card-parcel-id {
    color: #6b7280;
    font-size: 12px;
}
/* Slice 7.5 — flagged-response pill on activity cards. */
.activity-card-flagged-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* ── Activity feed: surveyor filter + source provenance (humans + Bobby) ── */
.activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.activity-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}
.activity-filter-select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: #1f2937;
}
.activity-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}
.activity-source svg { width: 1em; height: 1em; flex: none; }
.activity-source--verified,
.activity-source--via-bobby {
    background: #ecfdf5;
    color: #047857;
}
.activity-source--mixed {
    background: #eef2ff;
    color: #4338ca;
}
.activity-source--pending {
    background: #fff7ed;
    color: #c2410c;
}
.activity-bobby-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 13px;
}
.activity-bobby-banner-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: none;
    color: #c2410c;
}
.activity-bobby-banner-icon svg { width: 100%; height: 100%; }
.activity-bobby-banner-text { flex: 1 1 240px; }
.activity-bobby-banner a { margin-left: auto; }
.activity-card--bobby { border-left: 3px solid #f59e0b; }
.activity-card-avatar--bobby {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #c2410c;
    background: #fff7ed;
    border-radius: 999px;
}
.activity-card-avatar--bobby svg { width: 18px; height: 18px; }
.activity-card-model { color: #6b7280; font-weight: 400; }
body.theme-dark .activity-card-flagged-pill {
    background: #450a0a;
    color: #fca5a5;
}
/* Slice 8 — conflict pill on parcels with 2+ surveyor responses. */
.activity-card-conflict-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    cursor: help;
}
body.theme-dark .activity-card-conflict-pill {
    background: rgba(146, 64, 14, 0.35);
    color: #fcd34d;
}
/* Vegetation-obscured pill — surveyor flagged a LIKELY structure they
   couldn't cleanly see from the street. Green reads as "overgrowth",
   distinct from the red flagged + amber conflict pills. */
.activity-card-obscured-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    cursor: help;
}
body.theme-dark .activity-card-obscured-pill {
    background: rgba(22, 101, 52, 0.35);
    color: #86efac;
}
/* Navigation-trail summary — how many street-view images the surveyor
   moved through before making the call. Muted: forensic context, not a
   primary signal. */
.activity-card-nav {
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
    cursor: help;
}
body.theme-dark .activity-card-nav { color: #94a3b8; }
.activity-card-answers {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.activity-card-answers li {
    display: flex;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
}
.activity-card-q {
    color: #6b7280;
    flex: 1 1 auto;
    min-width: 0;
}
.activity-card-a {
    color: #1f2937;
    font-weight: 500;
    flex-shrink: 0;
}
.activity-card-noanswers {
    color: #9ca3af;
    font-style: italic;
    margin: 4px 0 0;
    font-size: 12px;
}
.activity-card-more {
    color: #9ca3af;
    font-size: 11px;
}
/* Per-polygon crops on activity cards (image_annotation answers).
 * The placeholder div + caption are rendered synchronously; the
 * background image + sizing land asynchronously via mountPolygonCrops
 * once the Mapillary thumbnail URL + source dimensions are fetched. */
.activity-card-crops {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.activity-card-crop {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.activity-card-crop-image {
    /* Placeholder until mountPolygonCrops lands the URL + sizing.
     * Min height keeps the row from collapsing during the brief
     * window before the fetch resolves. Position relative so the
     * tag overlay (Slice H follow-up: tag on top of image, like
     * the date overlay) can anchor inside it. */
    position: relative;
    background: #f3f5f7;
    background-repeat: no-repeat;
    border-radius: 4px;
    border: 1px solid #e6eaee;
    min-width: 60px;
    min-height: 60px;
    overflow: hidden;
}
.activity-card-crop--missing .activity-card-crop-image {
    background: repeating-linear-gradient(45deg, #f3f5f7, #f3f5f7 6px, #e1e8ef 6px, #e1e8ef 12px);
}
/* Tag overlay on the crop image — mirrors the capture-date overlay
 * on the activity-card thumbnail. Soft gradient backdrop keeps the
 * label legible against any imagery. pointer-events:none so the
 * crop's underlying click affordance (if any added later) still
 * works through the overlay. */
.activity-card-crop-tag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 6px 4px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.60) 0%,
        rgba(0, 0, 0, 0.30) 60%,
        rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.theme-dark .activity-card-crop-image {
    background: #1c252e;
    border-color: #2a3340;
}
/* Crop is clickable — opens the source image in the activity
 * lightbox. Affordance only when there's actually an image to
 * open (the attribute selector skips crops with missing imageId
 * so we don't suggest interactivity where nothing happens). */
.activity-card-crop[data-mly-image-id]:not([data-mly-image-id=""]) {
    cursor: pointer;
    transition: transform 0.15s ease;
}
.activity-card-crop[data-mly-image-id]:not([data-mly-image-id=""]):hover .activity-card-crop-image {
    border-color: #0066cc;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.18);
}
body.theme-dark .activity-card-crop[data-mly-image-id]:not([data-mly-image-id=""]):hover .activity-card-crop-image {
    border-color: #4ea3ff;
    box-shadow: 0 2px 8px rgba(78, 163, 255, 0.28);
}
/* Slice H follow-up: legacy .activity-card-crop-caption is no
 * longer rendered (tag moved onto the image via .activity-card-crop-tag).
 * Keep this comment as the breadcrumb so future grep finds the
 * removal context if a regression resurrects the caption. */
.activity-card-links {
    margin-top: auto;
    padding-top: 4px;
    font-size: 12px;
}

/* ── Slice E: multi-year grouped activity card ──────────────────────
 * When the same parcel has responses across multiple years (multi-
 * year session walk), the single-card layout doesn't apply — there's
 * no one "the" thumbnail or "the" answer. Grouped card replaces the
 * left-side thumb column with a full-width horizontal thumbnail
 * strip, and the answers summary becomes a per-question row that
 * either collapses "all years agree" into a single cell or fans out
 * year-by-year when the answer changed. */
/* The grouped card has no left-side single-thumb column (the thumbs
 * move INTO the body as a gallery strip), so collapse the parent
 * grid to a single full-width column. flex-direction was the wrong
 * override — .activity-card is grid, not flex, so display mode has
 * to be overridden with grid-template-columns. */
.activity-card--grouped { grid-template-columns: 1fr; }
.activity-card-body--grouped {
    width: 100%;
    min-width: 0;
    gap: 10px;
}

/* ── M4: activity card stacks on mobile ──────────────────────────
 * Default desktop layout uses a 2-col grid (220px thumb + 1fr body).
 * On phones that's wider than the viewport — the card horizontally
 * scrolls or the body crushes to a few characters per line. Collapse
 * to one full-width column, thumb on top, body below. Touch-friendly
 * sizing on the menu trigger + items per WCAG 2.1 AA. */
@media (max-width: 768px), (max-height: 600px) {
    .activity-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .activity-card-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
    }
    .activity-card-menu-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 4px 12px;
        font-size: 20px;
    }
    .activity-card-menu-item {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 14px;
    }
}
/* Grid layout so thumbnails behave like an image gallery: as many
 * columns as fit, each thumbnail fills its column equally, and the
 * grid collapses to fewer columns as the viewport narrows. minmax
 * floor of 160px keeps thumbnails legible at every breakpoint;
 * 1fr ceiling lets each thumb take an equal share of any remaining
 * row width so we never leave a long trailing whitespace stripe.
 * aspect-ratio fixes the proportions regardless of column width
 * (matches the 16:10-ish shape of the single-card thumb). */
.activity-grouped-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}
.activity-grouped-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.activity-grouped-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10);
}
.activity-grouped-thumb-flag {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(185, 28, 28, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
/* Per-year obscured marker (top-LEFT, clear of the top-right flag). */
.activity-grouped-thumb-obscured {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(22, 101, 52, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 999px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
/* Per-year navigation badge (bottom-LEFT, clear of the bottom-right
   capture-date overlay). */
.activity-grouped-thumb-nav {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
body.theme-dark .activity-grouped-thumb { background: #243044; }

.activity-grouped-answers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.activity-grouped-answer-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed #e6eaee;
}
.activity-grouped-answer-row:last-child { border-bottom: none; }
.activity-grouped-answer-row .activity-card-q {
    flex: 0 0 220px;
    color: #4b5560;
    font-size: 13px;
}
.activity-grouped-answer-row .activity-card-a {
    color: #1a2a3a;
    font-weight: 600;
    font-size: 13px;
}
.activity-grouped-allyears {
    margin-left: 6px;
    color: #6b7682;
    font-size: 11px;
    font-weight: 500;
    font-style: italic;
}
.activity-grouped-yearcells {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}
.activity-grouped-yearcell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #f3f5f7;
    border-radius: 999px;
    font-size: 12px;
}
.activity-grouped-yearcell-label {
    color: #6b7682;
    font-weight: 600;
}
.activity-grouped-yearcell-value {
    color: #1a2a3a;
    font-weight: 600;
}
body.theme-dark .activity-grouped-answer-row { border-bottom-color: #2a3340; }
body.theme-dark .activity-grouped-answer-row .activity-card-q { color: #9aa6b2; }
body.theme-dark .activity-grouped-answer-row .activity-card-a { color: #e6eaee; }
body.theme-dark .activity-grouped-allyears { color: #6b7682; }
body.theme-dark .activity-grouped-yearcell {
    background: #1c252e;
}
body.theme-dark .activity-grouped-yearcell-label { color: #9aa6b2; }
body.theme-dark .activity-grouped-yearcell-value { color: #e6eaee; }

@media (max-width: 600px) {
    .activity-card {
        grid-template-columns: 1fr;
    }
    .activity-card-thumb {
        width: 100%;
        height: 180px;
    }
}

body.theme-dark .activity-card {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .activity-card-thumb { background: #243044; }
body.theme-dark .activity-card-thumb-placeholder { color: #6b7280; }
body.theme-dark .activity-card-surveyor { color: #e6eaee; }
body.theme-dark .activity-card-when { color: #9ca3af; }
body.theme-dark .activity-card-parcel { color: #e6eaee; }
body.theme-dark .activity-card-parcel-id { color: #9ca3af; }
body.theme-dark .activity-card-q { color: #9ca3af; }
body.theme-dark .activity-card-a { color: #e6eaee; }
body.theme-dark .coverage-map-card {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .coverage-map-legend {
    border-top-color: #3b454f;
    color: #9ca3af;
}
.survey-scope-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}
.survey-scope-badge--org {
    background: #fef3c7;
    color: #92400e;
}
.survey-scope-badge--org:hover {
    background: #fde68a;
}

/* Slice 9D — conflict-resolution section CSS lives below.
 * See conflict-card / conflict-chip rules near the end of the file. */

/* Slice 9B — active-surveyors strip.
 * Sits above the stats strip when ≥1 surveyor's session has bumped
 * lastActivityAt within the last 5 minutes. Hidden entirely when 0
 * active. Green dot pulses to make "right now" feel immediate. */
.active-surveyors-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    font-size: 13px;
    color: #065f46;
}
.active-surveyors-strip strong { font-weight: 600; }
.active-surveyors-names {
    color: #047857;
    opacity: 0.8;
}
.active-surveyors-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
    animation: active-surveyors-pulse 2s infinite;
    flex-shrink: 0;
}
@keyframes active-surveyors-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
body.theme-dark .active-surveyors-strip {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}
body.theme-dark .active-surveyors-names { color: #a7f3d0; opacity: 0.85; }

/* Stats strip — flex row of summary cards. */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3, 12px);
}

/* "What surveyors are seeing" — answer-breakdown panel. */
.survey-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4, 16px);
}
.survey-stat-q {
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
    background: var(--color-bg-elevated, #fff);
    padding: var(--space-4, 16px);
}
.survey-stat-q-prompt { font-size: 15px; font-weight: 600; color: var(--color-text, #1f2937); }
.survey-stat-q-meta { font-size: 12px; color: #7a8693; margin: 2px 0 var(--space-3, 12px); }
.survey-stat-bars { display: flex; flex-direction: column; gap: var(--space-2, 8px); }
.survey-stat-bar-row {
    display: grid;
    grid-template-columns: minmax(64px, 110px) 1fr auto;
    align-items: center;
    gap: var(--space-2, 8px);
    font-size: 13px;
}
.survey-stat-bar-label {
    color: var(--color-text, #1f2937);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.survey-stat-bar-track {
    height: 8px;
    border-radius: 999px;
    background: var(--color-bg-muted, #eef1f4);
    overflow: hidden;
}
.survey-stat-bar-fill { display: block; height: 100%; background: #0080ff; border-radius: 999px; }
.survey-stat-bar-val {
    font-size: 12px;
    color: #495057;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.survey-stat-note { font-size: 13px; color: #495057; }
.survey-stat-tags { display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); margin-top: var(--space-2, 8px); }
.survey-stat-tag {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--color-bg-muted, #eef1f4);
    color: #495057;
}
.survey-stat-tag b { color: var(--color-text, #1f2937); }
body.theme-dark .survey-stat-q { background: #1c2330; border-color: #2a3340; }
body.theme-dark .survey-stat-q-prompt,
body.theme-dark .survey-stat-tag b { color: #e6eaee; }
body.theme-dark .survey-stat-bar-track,
body.theme-dark .survey-stat-tag { background: #243044; }
/* Dashboard stat tiles. Own class names (`dash-stat*`) on purpose:
   the bare `.stat-card` / `.stat-card-value` names collide with the
   global flex-row chart-stat component in theme.css (display:flex,
   icon + title + value), which was leaking its row layout onto these
   tiles and crushing the number + label onto one line. */
.dash-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1, 4px);
    text-align: center;
    background: var(--color-bg-elevated, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-lg, 8px);
    padding: var(--space-4, 16px);
}
.dash-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-accent, #0080ff);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.dash-stat-label {
    color: var(--color-fg-muted, #6b7280);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    line-height: 1.2;
}

/* Questions list — read-only display. */
.survey-q-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.survey-q-row {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f1f3;
}
.survey-q-row:last-child {
    border-bottom: none;
}
.survey-q-prompt {
    color: #1f2937;
    font-weight: 500;
}
.survey-q-num {
    color: #9ca3af;
    margin-right: 6px;
    font-variant-numeric: tabular-nums;
}
.survey-q-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.survey-q-type,
.survey-q-required {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
}
.survey-q-required {
    background: #fef3c7;
    color: #92400e;
}
.survey-q-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.survey-q-choice {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f4f8;
    color: #1f2937;
    font-size: 12px;
}

.survey-r-parcel {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: #6b7280;
}

body.theme-dark .dash-stat {
    background: #1c2634;
    border-color: #3b454f;
}
/* .dash-stat-value color comes from --color-accent, which the dark
   theme already overrides — no explicit dark value needed. */
body.theme-dark .dash-stat-label { color: #9ca3af; }
body.theme-dark .survey-q-list {
    background: #1c2634;
    border-color: #3b454f;
}
body.theme-dark .survey-q-row { border-bottom-color: #2c3848; }
body.theme-dark .survey-q-prompt { color: #e6eaee; }
body.theme-dark .survey-q-num { color: #6b7280; }
body.theme-dark .survey-q-type {
    background: #243044;
    color: #9ca3af;
}
body.theme-dark .survey-q-required {
    background: #422006;
    color: #fbbf24;
}
body.theme-dark .survey-q-choice {
    background: #243044;
    color: #e6eaee;
}
body.theme-dark .survey-dashboard-desc { color: #9ca3af; }
body.theme-dark .survey-dashboard-meta-when { color: #9ca3af; }
body.theme-dark .survey-scope-badge {
    background: #312e81;
    color: #c7d2fe;
}
body.theme-dark .survey-scope-badge--org {
    background: #422006;
    color: #fbbf24;
}

/* ── Session dashboard (Slice 7.5) ─────────────────────────────────── */
/* Renders at /sessions/{id}. Read-only landing page with a "Continue
   surveying" CTA that bridges to /?session={id} on the runtime. */

.session-page { display: flex; flex-direction: column; gap: 22px; }
.session-page-loading {
    text-align: center;
    color: #7a8693;
    padding: 60px 24px;
    font-size: 15px;
}
.session-page-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.session-page-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7682;
}
.session-page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1a1f24;
    line-height: 1.2;
}
.session-page-subtitle {
    font-size: 15px;
    color: #4a5563;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.session-page-status-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e6eaee;
    color: #4a5563;
}
.session-page-status-badge.is-active {
    background: #dcfce7;
    color: #166534;
}
.session-page-status-badge.is-completed {
    background: #dbeafe;
    color: #1e40af;
}
.session-page-status-badge.is-abandoned {
    background: #fee2e2;
    color: #991b1b;
}

.session-page-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.session-page-stat {
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.session-page-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1f24;
    line-height: 1;
}
.session-page-stat-sep {
    color: #7a8693;
    font-weight: 500;
    font-size: 20px;
}
.session-page-stat-label {
    font-size: 12px;
    color: #6b7682;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.session-page-progress-bar {
    height: 8px;
    background: #e6eaee;
    border-radius: 999px;
    overflow: hidden;
}
.session-page-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0080ff, #0070e0);
    transition: width 0.3s ease;
}

.session-page-meta {
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.session-page-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: #1a1f24;
}
.session-page-meta-label {
    color: #6b7682;
    flex: 0 0 auto;
}
.session-page-meta-value {
    text-align: right;
    color: #1a1f24;
}

.session-page-cta-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.session-page-cta-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    background: #0080ff;
    color: #fff;
    border: none;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 128, 255, 0.32);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    align-self: center;
    transition: background 0.15s ease, box-shadow 0.15s ease,
                transform 0.15s ease;
}
.session-page-cta-primary:hover {
    background: #0070e0;
    box-shadow: 0 6px 18px rgba(0, 128, 255, 0.42);
    transform: translateY(-1px);
}
.session-page-cta-primary:active { transform: translateY(0); }
.session-page-cta-disabled {
    text-align: center;
    color: #6b7682;
    font-size: 14px;
    padding: 14px;
    background: #fafbfc;
    border: 1px dashed #d9dee4;
    border-radius: 10px;
}

.session-page-responses-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #1a1f24;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.session-page-responses-count {
    font-size: 13px;
    font-weight: 500;
    color: #7a8693;
    background: #e6eaee;
    padding: 2px 10px;
    border-radius: 999px;
}
.session-page-responses-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.session-page-response-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 8px;
    padding: 10px 14px;
}
.session-page-response-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    color: #1a1f24;
}
.session-page-response-when {
    font-size: 11px;
    color: #7a8693;
    margin-top: 2px;
}
.session-page-response-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e6eaee;
    color: #4a5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.session-page-response-badge.is-submitted {
    background: #dcfce7;
    color: #166534;
}
.session-page-response-badge.is-flagged {
    background: #fee2e2;
    color: #991b1b;
}
.session-page-responses-empty {
    background: #fafbfc;
    border: 1px dashed #d9dee4;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    color: #6b7682;
    font-size: 14px;
}
.session-page-responses-more {
    text-align: center;
    color: #7a8693;
    font-size: 12px;
    padding: 8px;
}

.session-page-empty {
    text-align: center;
    padding: 60px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.session-page-empty-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #1a1f24;
}
.session-page-empty-sub {
    margin: 0;
    color: #6b7682;
    font-size: 14px;
}
.session-page-empty-sub code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #4a5563;
}

/* Dark theme variants */
body.theme-dark .session-page-title { color: #f0f3f6; }
body.theme-dark .session-page-eyebrow { color: #9aa6b2; }
body.theme-dark .session-page-subtitle { color: #c1cad3; }
body.theme-dark .session-page-status-badge {
    background: #2a3340;
    color: #c1cad3;
}
body.theme-dark .session-page-status-badge.is-active {
    background: rgba(16, 101, 52, 0.35);
    color: #86efac;
}
body.theme-dark .session-page-status-badge.is-completed {
    background: rgba(30, 64, 175, 0.4);
    color: #93c5fd;
}
body.theme-dark .session-page-status-badge.is-abandoned {
    background: rgba(153, 27, 27, 0.35);
    color: #fca5a5;
}
body.theme-dark .session-page-stat {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .session-page-stat-value { color: #f0f3f6; }
body.theme-dark .session-page-stat-sep { color: #9aa6b2; }
body.theme-dark .session-page-stat-label { color: #9aa6b2; }
body.theme-dark .session-page-progress-bar { background: #2a3340; }
body.theme-dark .session-page-meta {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .session-page-meta-row { color: #f0f3f6; }
body.theme-dark .session-page-meta-label { color: #9aa6b2; }
body.theme-dark .session-page-meta-value { color: #f0f3f6; }
body.theme-dark .session-page-cta-disabled {
    background: #1c2330;
    border-color: #2a3340;
    color: #9aa6b2;
}
body.theme-dark .session-page-responses-title { color: #f0f3f6; }
body.theme-dark .session-page-responses-count {
    background: #2a3340;
    color: #9aa6b2;
}
body.theme-dark .session-page-response-row {
    background: #1c2330;
    border-color: #2a3340;
}
body.theme-dark .session-page-response-id { color: #e6eaee; }
body.theme-dark .session-page-response-when { color: #9aa6b2; }
body.theme-dark .session-page-response-badge {
    background: #2a3340;
    color: #c1cad3;
}
body.theme-dark .session-page-response-badge.is-submitted {
    background: rgba(16, 101, 52, 0.35);
    color: #86efac;
}
body.theme-dark .session-page-response-badge.is-flagged {
    background: rgba(153, 27, 27, 0.35);
    color: #fca5a5;
}
body.theme-dark .session-page-responses-empty {
    background: #1c2330;
    border-color: #2a3340;
    color: #9aa6b2;
}
body.theme-dark .session-page-empty-title { color: #f0f3f6; }
body.theme-dark .session-page-empty-sub { color: #9aa6b2; }
body.theme-dark .session-page-empty-sub code {
    background: #2a3340;
    color: #c1cad3;
}

/* Slice 9D — conflict-resolution section.
 * Cards stack above the activity feed. Each card lists conflicting
 * responses as chips with a "Make canonical" pick button. Yellow
 * accent ties visually to the inline "⚠ Conflict" pill on the
 * activity card row. */
.conflict-section-sub {
    color: #6b7280;
    font-size: 13px;
    margin-top: -4px;
    margin-bottom: 12px;
}
.conflict-section-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.conflict-card {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 14px;
}
.conflict-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 8px;
}
.conflict-card-icon { color: #b45309; }
.conflict-card-parcel-id {
    color: #9a8230;
    font-size: 12px;
}
.conflict-card-count {
    margin-left: auto;
    color: #92400e;
    font-size: 12px;
    font-weight: 500;
}
.conflict-card-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.conflict-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #fde68a;
    border-radius: 6px;
}
.conflict-chip--busy {
    opacity: 0.55;
    pointer-events: none;
}
.conflict-chip-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    flex: 1;
    min-width: 0;
}
.conflict-chip-when {
    color: #6b7280;
    font-size: 12px;
}
.conflict-chip-flag-pill {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.conflict-chip-pick-btn {
    background: #2563eb;
    color: white;
    border: 1px solid #1d4ed8;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 80ms ease;
}
.conflict-chip-pick-btn:hover { background: #1d4ed8; }
.conflict-chip-pick-btn:disabled {
    background: #93c5fd;
    border-color: #93c5fd;
    cursor: default;
}
.conflict-chip-pick-locked {
    color: #b8a76b;
    font-size: 16px;
    line-height: 1;
}
body.theme-dark .conflict-card {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.3);
}
body.theme-dark .conflict-card-icon,
body.theme-dark .conflict-card-count { color: #fbbf24; }
body.theme-dark .conflict-chip {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(251, 191, 36, 0.3);
}
body.theme-dark .conflict-chip-when { color: #9ca3af; }

/* Slice C3 — actionable empty state on the dashboard activity feed.
 * Previously a flat "No submitted responses yet" line; now an
 * invitation to start surveying. */
.dashboard-empty-activity {
    background: #f4f6fa;
    border: 1px solid #d6dde6;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
}
.dashboard-empty-activity p {
    color: #4a5563;
    margin: 0 0 12px;
}
body.theme-dark .dashboard-empty-activity {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
body.theme-dark .dashboard-empty-activity p { color: #a4adb7; }

/* Slice 9C — presence banner in the runner panel.
 * Shows when another surveyor's parcel lease is active on the same
 * parcel as the current surveyor. Subtle blue stripe so it informs
 * without alarming — the lease is a hint, not a lock. */
.survey-runner-presence {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.4;
}
.survey-runner-presence-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45);
    animation: survey-runner-presence-pulse 2s infinite;
    flex-shrink: 0;
}
@keyframes survey-runner-presence-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
body.theme-dark .survey-runner-presence {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

/* Submit-recovery banner — shown when finalizeResponse wrote the
 * response but advanceSession (or the post-advance fly) failed. The
 * surveyor's answers are safe; we just need them to retry the
 * advance. Amber instead of the presence-banner's blue so the
 * "needs attention" tone is distinct from "FYI another surveyor". */
/* P3 — offline banner: a thin top strip shown app-wide when the browser
   reports no network. Reassures the surveyor their queued answers will sync. */
#offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-offline-banner);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    background: #78350f;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
/* Explicit display:flex above would otherwise override the [hidden] default. */
#offline-banner[hidden] { display: none; }
.offline-banner-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
}

/* P1 — survey-definition load state (spinner / retry card) shown in the
   runner slot so a slow or offline survey load never reads as a blank screen. */
.survey-runner-loadstate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px 20px;
    text-align: center;
}
.survey-runner-loadstate-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e1e8ef;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: session-launcher-auto-loading-spin 1s linear infinite;
}
.survey-runner-loadstate-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a2a3a;
}
.survey-runner-loadstate--error .survey-runner-loadstate-title { color: #b45309; }
.survey-runner-loadstate-msg {
    margin: 0;
    max-width: 34ch;
    font-size: 13px;
    line-height: 1.45;
    color: #5b6b7a;
}
.survey-runner-loadstate .primary-btn { margin-top: 4px; }
body.theme-dark .survey-runner-loadstate-title { color: #e6eaee; }
body.theme-dark .survey-runner-loadstate-msg { color: #9aa7b4; }
body.theme-dark .survey-runner-loadstate-spinner {
    border-color: #3b454f;
    border-top-color: #6db5ff;
}

.survey-runner-recovery {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: #78350f;
    font-size: 13px;
    line-height: 1.4;
}
.survey-runner-recovery-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.survey-runner-recovery-body strong {
    font-weight: 600;
}
.survey-runner-recovery-retry {
    flex: 0 0 auto;
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 120ms ease;
}
.survey-runner-recovery-retry:hover:not(:disabled) {
    background: #d97706;
}
.survey-runner-recovery-retry:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}
body.theme-dark .survey-runner-recovery {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}
body.theme-dark .survey-runner-recovery-retry:disabled {
    background: #374151;
}

/* ── Survey-new page shell (/surveys/new) ──────────────────────────
 * Side-by-side form + map layout for the builder page. The builder
 * modal itself lives in its own section above; these rules style the
 * single-column page chrome that hosts it inline (org picker, title,
 * map hero, boundary summary). Lifted out of survey-new.html when
 * the route moved into the SPA shell.
 */
#survey-new-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px 24px 80px;
    box-sizing: border-box;
}
.survey-new-page-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e6eaee;
}
.survey-new-page-header h1 {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 600;
    color: #1a1f24;
    letter-spacing: -0.01em;
}
.survey-new-page-header p {
    margin: 0;
    color: #6b7682;
    font-size: 14px;
    line-height: 1.5;
}
body.theme-dark .survey-new-page-header { border-bottom-color: #2a3340; }
body.theme-dark .survey-new-page-header h1 { color: #f0f3f6; }
body.theme-dark .survey-new-page-header p { color: #9aa6b2; }
#survey-new-pre-map {
    margin-bottom: 18px;
}
#survey-new-pre-map:empty { display: none; }
#survey-new-map-section {
    position: relative;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e6eaee;
    background: #eef2f6;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
body.theme-dark #survey-new-map-section {
    border-color: #2a3340;
    background: #0f1620;
}
#survey-new-map-mount {
    position: absolute;
    inset: 0;
}
#survey-new-map-mount .maplibregl-canvas-container {
    cursor: crosshair;
}
#survey-new-parcel-count {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d9dee4;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    color: #1a1f24;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 5;
}
body.theme-dark #survey-new-parcel-count {
    background: rgba(28, 35, 48, 0.95);
    border-color: #2a3340;
    color: #e6eaee;
}


/* ── Survey runtime page shell (/survey) ──────────────────────────
 * Layout chrome lifted out of survey.html's inline <style> when the
 * /survey runtime moved into the SPA shell. The body styles are
 * scoped to .survey-runtime-mounted (added/removed by the SPA page
 * module on mount/teardown) so they don't bleed into other pages.
 * Everything else is keyed on IDs that only exist when the runtime
 * DOM is rendered, so no scoping needed.
 */
/* Layout chrome mirrors index.html so theme-enhancements.js's
 * runtime-injected styles align cleanly. */
body.survey-runtime-mounted {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

#map-hint {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(33, 33, 33, 0.88);
    color: #fff;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 800;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms ease;
}
#map-hint.visible { opacity: 1; }

@media (max-width: 768px), (max-height: 600px) {
    /* M1 (mobile rollout): split the screen 65/35 — Mapillary
     * imagery on top, runner sheet on bottom. The flag link moved
     * into the header as an icon button (M1 follow-up) so the
     * 35% runner budget covers the recap card + question + answers
     * summary without scroll-cramping. */
    #details-sidebar {
        width: 100% !important;
        height: 35dvh !important;
        top: 65dvh !important;
        bottom: 0 !important;
        right: 0 !important;
        box-shadow: 0 -2px 5px rgba(0,0,0,0.1) !important;
        z-index: 900 !important;
        position: fixed !important;
        /* Explicit scroll wiring — base rule already sets overflow-y,
         * but pinning here defends against any future override at
         * higher specificity. The runner can get tall (recap card +
         * answer rows) and needs reliable scroll. */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        /* Smooth transition for the drag-handle expand/collapse so
         * the sheet glides instead of snapping. Only height + top
         * animate — z-index, overflow, etc. stay instant. */
        transition: height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
                    top 220ms cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    }
    /* Drag-handle: a 36×4 pill bar at the top of the sheet, like
     * the iOS bottom-sheet grabber. Tap to toggle between 35vh
     * collapsed and ~85vh expanded so the surveyor can review
     * the full question list / answers-so-far without scrolling
     * the runtime sheet. The button takes 28px of vertical hit
     * area so it's easy to thumb without precision. (Hidden by
     * default via the global rule above; shown here on phones.) */
    body.survey-active.sidebar-visible .sv-mobile-drag-handle {
        display: block;
        position: sticky;
        top: 0;
        width: 100%;
        height: 24px;
        padding: 0;
        margin: 0;
        background: #fff;
        border: none;
        cursor: pointer;
        z-index: 5;
        -webkit-tap-highlight-color: transparent;
        /* The visible grabber is a centered pill drawn via a
         * pseudo-element so the button stays a clean rectangle for
         * the tap target. */
    }
    body.survey-active.sidebar-visible .sv-mobile-drag-handle::before {
        content: '';
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 999px;
        background: #cfd6de;
        transition: background 160ms ease, width 160ms ease;
    }
    body.survey-active.sidebar-visible .sv-mobile-drag-handle:hover::before {
        background: #9aa6b2;
        width: 48px;
        margin-left: -24px;
    }
    /* Expanded state — sheet covers most of the viewport so the
     * surveyor can review the full survey without scrolling the
     * runtime split. A 15vh strip of the imagery stays visible at
     * top so the user remembers there's something behind to swipe
     * back to. */
    body.sv-mobile-panel-expanded #details-sidebar {
        height: 85dvh !important;
        top: 15dvh !important;
    }
    /* ── Mobile layout: PiP in the bottom-right ───────────────────
     *
     * Two states, both with the secondary surface as a small PiP
     * anchored in the BOTTOM-RIGHT of the imagery pane (12px in
     * from the right, sitting just above the 35vh runner sheet).
     *
     * `body.sv-swapped` matches the codebase semantic — set true =
     * Mapillary is primary. runner-panel.js calls
     * setStreetViewSwapped(true) on parcel selection, so the
     * surveyor lands in sv-swapped immediately. The non-swapped
     * state covers the launcher screen + any manual swap-back.
     *
     *   sv-swapped (default during a session):
     *     - Mapillary → primary (100% × 65% top pane)
     *     - Map       → PiP bottom-right (38vw × 22vh)
     *
     *   not sv-swapped (launcher / manual swap-back):
     *     - Map       → primary (100% × 65% top pane)
     *     - Mapillary → PiP bottom-right (38vw × 22vh)
     */

    /* Default state — map primary, Mapillary PiP. */
    body.survey-active.sidebar-visible #map {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        width: 100% !important;
        height: 65dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 800 !important;
    }
    body.survey-active.sidebar-visible #mapillary-container.floating-viewer {
        display: block !important;
        position: fixed !important;
        top: auto !important;
        left: auto !important;
        right: 12px !important;
        bottom: calc(35dvh + 12px) !important;
        width: 38vw !important;
        height: 22dvh !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.28) !important;
        z-index: 851 !important;
    }

    /* sv-swapped — Mapillary primary, map PiP. */
    body.survey-active.sidebar-visible.sv-swapped #mapillary-container.floating-viewer {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        width: 100% !important;
        height: 65dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        z-index: 800 !important;
    }
    body.survey-active.sidebar-visible.sv-swapped #map {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        top: auto !important;
        left: auto !important;
        right: 12px !important;
        bottom: calc(35dvh + 12px) !important;
        width: 38vw !important;
        height: 22dvh !important;
        min-width: 38vw !important;
        min-height: 22dvh !important;
        border-radius: 8px !important;
        border: 2px solid #ffffff !important;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.40) !important;
        z-index: 999 !important;
        overflow: hidden !important;
        background: #cdd6e0 !important;
    }
    /* MapLibre's canvas-container + canvas inherit their size from
     * the parent #map. When the PiP is small, MapLibre's internal
     * resize sometimes lags the CSS pane swap and the canvas stays
     * at its pre-swap dimensions (often clipped to 0 by the new
     * container). Pinning the children to 100% × 100% defends the
     * footprint regardless of when MapLibre runs its own resize. */
    body.survey-active.sidebar-visible.sv-swapped #map .maplibregl-canvas-container,
    body.survey-active.sidebar-visible.sv-swapped #map .maplibregl-canvas {
        width: 100% !important;
        height: 100% !important;
    }

    /* PiP hidden: collapse whichever surface is currently the PiP.
     * Default → PiP is Mapillary. sv-swapped → PiP is map. */
    body.survey-active.sidebar-visible.sv-mobile-pip-hidden:not(.sv-swapped) #mapillary-container.floating-viewer {
        display: none !important;
    }
    body.survey-active.sidebar-visible.sv-swapped.sv-mobile-pip-hidden #map {
        display: none !important;
    }

    /* Toolbar must stay above the PiP (z:851) so the globe + flag
     * remain tappable when the PiP sits in the bottom-right corner.
     * Base #mapillary-toolbar z-index is 100 — bump it on mobile so
     * it wins against the PiP's overlay stacking. */
    body.survey-active #mapillary-toolbar,
    body.survey-active .mapillary-toolbar {
        z-index: 900 !important;
    }
    /* On mobile the runner sheet is a BOTTOM bar (not a right
     * column), so the desktop right-offset rule
     *   right: calc(var(--sidebar-width) + 10px)
     * pushes the toolbar entirely off-screen. Pin to the right
     * edge of the viewport instead — same offset as #icon-rail's
     * mobile rule. */
    body.survey-active .mapillary-toolbar,
    body.survey-active #mapillary-toolbar,
    body.sidebar-visible .mapillary-toolbar,
    body.sidebar-visible #mapillary-toolbar {
        right: 10px !important;
    }

    /* ── #icon-rail visibility on mobile ─────────────────────────
     * Map controls (AERIAL, Legend) live on the map and only make
     * sense when the map is the surface you're using. Show when
     * map is primary (default state); hide when map is a small PiP
     * (sv-swapped — the surveyor is focused on the imagery and a
     * 38vw × 22vh map can't fit AERIAL/Legend in any useful way).
     */
    body.survey-active.sv-swapped #icon-rail {
        display: none !important;
    }
    /* Mapillary-tool buttons (Hide info, Annotate) only apply when
     * Mapillary is the primary surface — drawing or info-toggling
     * a 22vh thumbnail is pointless. Hide when Mapillary is the
     * PiP (default unswapped). The globe stays in both modes so
     * the surveyor can hide/show whichever surface is the PiP. */
    body.survey-active:not(.sv-swapped) #mapillary-toggle-popup,
    body.survey-active:not(.sv-swapped) #mapillary-toggle-annotate {
        display: none !important;
    }
    /* When BOTH rails are visible (default state: map primary,
     * icon-rail at top-right; mapillary-toolbar at top-right with
     * just the globe), push the Mapillary toolbar down so it sits
     * BELOW the icon-rail. Both anchor at top:54px right:10px on
     * mobile; without this offset icon-rail (z:1000) re-covers the
     * toolbar. Icon-rail height with 2 buttons + padding/gap ≈ 84px;
     * +6px gap = 144px. */
    body.survey-active:not(.sv-swapped) #mapillary-toolbar {
        /* M2: icon-rail buttons grew 36→44 with 4px gap + 4px
         * padding × 2 = 100px tall. Push toolbar to top 162px
         * so it stacks below cleanly (54 anchor + 100 rail height
         * + 8px gap). */
        top: 162px !important;
    }

    /* ── M2: WCAG 2.1 AA touch targets (44×44 min on touch) ──────
     * Bump every interactive control above 44px on mobile. Desktop
     * stays at the tighter 36px since pointer accuracy is fine
     * with a mouse. Items already at ≥44px (survey-runner-flag-icon
     * from M1) aren't repeated here. */
    .mapillary-toolbar-btn,
    .icon-rail-button,
    .anno-panel-icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
    /* Bump the inline SVG icons so they don't look lost inside the
     * larger 44×44 button footprint (14×14 was sized for 36×36).
     * Also disable pointer-events on the SVG — iOS Safari sometimes
     * intercepts taps on SVG children rather than bubbling to the
     * button, which silently kills click handlers (the source of
     * the "pencil doesn't open anything on mobile" bug). With
     * pointer-events:none on the SVG, the tap always lands on the
     * button itself. */
    .mapillary-toolbar-btn > svg,
    .icon-rail-button > svg {
        width: 20px;
        height: 20px;
        pointer-events: none;
    }
    /* Suppress the iOS default blue tap-highlight flash on these
     * buttons — the is-on state already provides clear feedback. */
    .mapillary-toolbar-btn,
    .icon-rail-button,
    .survey-runner-flag-icon,
    #mobile-pip-swap-btn,
    #mobile-pip-minimize-btn {
        -webkit-tap-highlight-color: transparent;
    }

    /* ── Annotation draw vertices: bigger + first-vertex emphasis ─
     * MapillaryJS ships polygon vertices at 6×6 (interior) and
     * ~8×8 (completer / first vertex) by default — invisible on
     * a phone. The completer is the green dot the surveyor taps
     * to close the polygon, so size + color need to be obvious
     * on a thumb-tappable surface.
     *
     * Bump dimensions and add a white outline so the dots stand
     * out against busy imagery. .mapillary-tag-vertex has
     * pointer-events:none from the SDK (the click target is the
     * .mapillary-tag-completer / -interactor overlay) — the
     * size we set here is purely visual. */
    .mapillary-tag-vertex {
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: #ffffff !important;
        border: 2px solid #0080ff !important;
        box-shadow: 0 0 0 1px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,0.4) !important;
    }
    /* The completer is the FIRST vertex — the surveyor taps it
     * to close the polygon. Make it noticeably bigger + bright
     * green so they spot it and can hit it confidently. */
    .mapillary-tag-completer {
        width: 22px !important;
        height: 22px !important;
        border-radius: 50% !important;
        background: #22c55e !important;
        border: 2px solid #ffffff !important;
        box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6), 0 2px 6px rgba(0,0,0,0.4) !important;
        cursor: pointer;
    }
    .mapillary-tag-interactor {
        width: 16px !important;
        height: 16px !important;
        border-radius: 50% !important;
    }

    /* ── M3: recap card mobile tightening ─────────────────────────
     * The prior-year recap is the densest block in the runner
     * sheet on multi-year sessions — it stacks the eyebrow, an
     * answer list (one row per Q), and the two change buttons. At
     * desktop padding/font sizing it eats 60–70% of the 35% mobile
     * sheet before the surveyor sees a single answer button.
     * Tighten the box so the question stays visible without
     * scrolling. */
    .survey-runner-recap {
        padding: 10px 12px;
        margin-bottom: 10px;
        font-size: 12px;
        border-left-width: 3px;
    }
    .survey-runner-recap-eyebrow {
        font-size: 11px;
        margin-bottom: 6px;
    }
    .survey-runner-recap-answers {
        margin-bottom: 8px;
        gap: 2px;
    }
    .survey-runner-recap-answers li {
        padding: 3px 0;
        font-size: 12px;
    }
    .survey-runner-recap-question {
        margin: 8px 0;
        padding-top: 8px;
        font-size: 13px;
    }
    /* Buttons sit side-by-side at equal width so the surveyor's
     * thumb has predictable hit areas — neither shrinks to its text
     * width and disappears into a corner. Both meet the 44px
     * touch-target spec from M2. */
    .survey-runner-recap-actions {
        gap: 6px;
    }
    .survey-runner-recap-btn {
        flex: 1;
        min-height: 44px;
        padding: 10px 8px;
        font-size: 13px;
    }

    /* ── M3: session-launcher year chips touch-friendly ───────────
     * Bump from ~25–32px to 44px+ so the year picker works on a
     * thumb. The existing flex-wrap on .session-launcher-year-grid
     * already handles overflow — chips wrap to a second row as
     * needed. */
    .session-launcher-year-chip {
        min-height: 44px;
        padding: 10px 14px;
    }
    /* Mapillary sequence pill — explicit 44 on both step buttons
     * keeps the pill tappable; background-size adjusted in tandem
     * so the chevrons don't drift off-center inside the bigger
     * button. */
    body.survey-mode .mapillary-sequence-step-next,
    body.survey-mode .mapillary-sequence-step-next-inactive,
    body.survey-mode .mapillary-sequence-step-next-highlight,
    body.survey-mode .mapillary-sequence-step-prev,
    body.survey-mode .mapillary-sequence-step-prev-inactive,
    body.survey-mode .mapillary-sequence-step-prev-highlight {
        width: 44px !important;
        height: 44px !important;
        background-size: 20px 20px !important;
    }
    /* Answer Yes/No buttons. Padding 10→12 lifts the rendered
     * height from ~40px to ~44px without changing the visual
     * weight too much. */
    .survey-btn {
        padding: 12px 14px;
        min-height: 44px;
    }
    /* Edit buttons in the "Answers so far" summary — tiny by
     * design (secondary action) but currently below 44px touch
     * minimum. Bump padding so the click box is 44×44 even
     * though the visible text stays compact. */
    .survey-answer-edit {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px;
    }
    /* PiP swap + minimize — 32×32 was decorative; bump to 44 so
     * mobile users can actually hit them with a thumb. */
    body.survey-active.sidebar-visible #mobile-pip-swap-btn,
    body.survey-active.sidebar-visible.sv-swapped #mobile-pip-minimize-btn {
        width: 44px !important;
        height: 44px !important;
    }

    /* ── Annotation panel — pop out from the right-pinned toolbar ─
     * Base rule positions the panel at `right: calc(--sidebar-width
     * + 56px)`. On mobile --sidebar-width falls back to 380px, so
     * the panel lands ~436px off-screen left and the surveyor sees
     * nothing when they tap Annotate. Pin to right:56px on mobile —
     * directly to the left of the toolbar (toolbar at right:10px,
     * 36px wide, +10px gap = 56px). Constrain max-width so the
     * panel fits even on the narrowest phones.
     *
     * Vertical: anchor below the toolbar. Toolbar top defaults to
     * 54px (has-account-chip) or 144px (default mode where it's
     * pushed below the icon-rail). Use the same anchor as the
     * toolbar so the panel reads as popped-out from the rail. */
    body.survey-active .mapillary-annotation-panel,
    body.sidebar-visible .mapillary-annotation-panel {
        right: 56px !important;
        max-width: calc(100vw - 76px) !important;
    }
    body.survey-active:not(.sv-swapped) .mapillary-annotation-panel {
        top: 144px !important;
    }

    /* ── Map swap chrome (currently DISABLED in the survey app) ───
     * Hidden per design direction — the survey runner doesn't need
     * a manual swap. The button + JS handler stay in the codebase
     * for easy re-enable; the positioning rules below are dead
     * code until then. */
    body.survey-active #mobile-pip-swap-btn {
        display: none !important;
    }
    body.survey-active.sidebar-visible #mobile-pip-swap-btn {
        display: inline-flex;
        position: fixed;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(0, 0, 0, 0.10);
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
        color: #1a2a3a;
        cursor: pointer;
        /* Must sit above the map PiP (z:999 from the visibility-
         * hardening rule) — otherwise the canvas covers the button. */
        z-index: 1001;
        /* Default state — map is PRIMARY (full top 65%). Anchor
         * the button at the bottom-left of the map (10px from the
         * left edge, 10px above the runner sheet which starts at
         * 65vh). Top-left would collide with the brand chip; top-
         * right with #icon-rail. Bottom-left is clean. */
        top: calc(65dvh - 12px - 32px);
        left: 10px;
        right: auto;
    }
    body.survey-active.sidebar-visible #mobile-pip-swap-btn:hover {
        background: #f5f7fa;
    }
    /* sv-swapped — map is the PiP at bottom-right (right:12px,
     * bottom:calc(35dvh + 12px), 38vw × 22vh). Anchor button at the
     * PiP's top-LEFT corner, 6px inset. */
    body.survey-active.sidebar-visible.sv-swapped #mobile-pip-swap-btn {
        top: calc(100dvh - 35dvh - 12px - 22dvh + 6px);
        left: calc(100% - 12px - 38vw + 6px);
        right: auto;
    }
    /* When the PiP is hidden in sv-swapped state, the map is gone
     * too — hide the swap button with it. In default state the
     * button stays (map is the primary view, always visible). */
    body.survey-active.sidebar-visible.sv-swapped.sv-mobile-pip-hidden #mobile-pip-swap-btn {
        display: none;
    }

    /* ── Minimize button (PiP top-right) ─────────────────────────
     * Discoverability companion to the toolbar's globe — sits on
     * the map PiP's top-right corner so the dismiss action is
     * obvious from the PiP itself. Only meaningful when the map
     * IS the PiP (i.e., sv-swapped state); in unswapped state the
     * map is the primary view and can't be minimized. Hidden when
     * the PiP is already hidden. */
    #mobile-pip-minimize-btn { display: none; }
    body.survey-active.sidebar-visible.sv-swapped #mobile-pip-minimize-btn {
        display: inline-flex;
        position: fixed;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(0, 0, 0, 0.10);
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
        color: #1a2a3a;
        cursor: pointer;
        /* Same z-index rationale as the swap button — must beat the
         * map PiP's z:999 from the visibility-hardening rule. */
        z-index: 1002;
        /* Map PiP at right:12px bottom:calc(35dvh + 12px), 38vw × 22vh.
         * Anchor at PiP top-RIGHT, 6px inset from the edges. */
        top: calc(100dvh - 35dvh - 12px - 22dvh + 6px);
        right: calc(12px + 6px);
        left: auto;
    }
    body.survey-active.sidebar-visible.sv-swapped #mobile-pip-minimize-btn:hover {
        background: #f5f7fa;
    }
    /* When the PiP is hidden, the minimize button has nothing to
     * minimize — hide with it. The globe in the toolbar handles
     * re-showing the PiP. */
    body.survey-active.sidebar-visible.sv-swapped.sv-mobile-pip-hidden #mobile-pip-minimize-btn {
        display: none;
    }

    /* ── Mobile chrome shrink ─────────────────────────────────────
     * Top-bar real estate is precious on a phone: a "survey.det.land"
     * wordmark + a "Dexter ▾" pill eat both corners and crowd the
     * floating flag icon between them. Reduce each to its icon:
     *   - Brand chip → clipboard icon only, tighter pill padding
     *   - Account chip → avatar only (name + caret hidden)
     * The full versions are still rendered in the DOM so menus and
     * deep-links keep working; only the visual chrome is collapsed. */
    #survey-brand-chip .survey-brand-text { display: none; }
    #survey-brand-chip #home-button {
        padding: 6px 8px;
        gap: 0;
    }
    .account-chip-name,
    .account-chip-caret {
        display: none !important;
    }
    #legend-toggle-btn { display: none !important; }
    /* M1 viewport lock: pin html/body + main-container so the
     * 65/35 imagery+runner split stays fixed and only the
     * #details-sidebar's own overflow-y scrolls. SCOPED to
     * body.survey-active so it only applies on the runtime page —
     * unscoped, this lock killed scroll on the dashboard, profile,
     * launcher, and every other survey-app page.
     * Bug reported May 2026: "can't scroll on the survey dashboard". */
    body.survey-active,
    html:has(body.survey-active) {
        height: 100%;
        overflow: hidden;
    }
    body.survey-active #main-container {
        height: 100% !important;
        position: fixed !important;
        overflow: hidden !important;
    }
}

/* M1 follow-up: at phone widths, ratio stays 65/35 (same as
 * tablet). The earlier "more sheet on small phones" tweak was
 * superseded by moving the flag link into a header icon — the
 * runner doesn't need extra height because nothing now eats a
 * dedicated row inside it. */

#floating-header {
    position: fixed;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 5px 10px;
    border-radius: 4px;
    z-index: 1000;
    font-size: 20px;
    font-weight: bold;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
#floating-header.search-expanded {
    max-width: 500px;
    width: auto;
}
#home-button { color: #0080ff; }

#search-container {
    margin-left: 15px;
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1500;
}
.search-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    padding: 0;
}
.search-icon-button:hover {
    background-color: #e9ecef;
    border-color: #0080ff;
    color: #0080ff;
}

.search-form-container {
    display: none;
    position: relative;
    width: 350px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}
.search-form-container.expanded {
    display: block;
    opacity: 1;
    transform: translateX(0);
}
#search-form { display: flex; width: 100%; position: relative; }
#search-input {
    flex: 1;
    height: 36px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
}
#search-input:focus {
    border-color: #0080ff;
    box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.1);
}
#search-button {
    height: 36px;
    padding: 0 12px;
    background-color: #0080ff;
    color: white;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}
#search-button:hover { background-color: #0070e0; }
.search-close-button {
    height: 36px;
    width: 36px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
}
.search-close-button:hover { background-color: #e9ecef; color: #333; }

#search-results {
    position: absolute !important;
    top: 38px !important;
    left: 0 !important;
    width: 100% !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    background-color: white !important;
    border: 2px solid #0080ff !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
    display: none;
}
#search-results.visible { display: block !important; }
.search-result {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    line-height: 1.5;
}
.search-result:hover { background-color: #f5f5f5; }
.search-result:last-child { border-bottom: none; }

@media (max-width: 768px), (max-height: 600px) {
    #floating-header {
        left: 5px;
        top: 5px;
        padding: 3px 8px;
        font-size: 18px;
    }
    #floating-header.search-expanded {
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
    }
    #search-container { margin-left: 8px; }
    .search-form-container { width: calc(100vw - 120px); max-width: 300px; }
    .search-icon-button { width: 32px; height: 32px; }
    #search-input,
    #search-button,
    .search-close-button { height: 32px; }
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
    z-index: 100;
    margin: 0;
    padding: 0;
}
body.sidebar-visible #map.main-area {
    width: calc(100% - 380px);
}
/* Slice L2 — full-screen bootstrap overlay.
 *
 * Used while:
 *   (a) the map / PMTiles / Mapillary libs load (always, on
 *       every /survey hit), and
 *   (b) the session is resolving — URL has ?survey= or
 *       ?session= but no ?parcel= yet, so we're mid-flight
 *       between "click Start" and "first parcel rendered."
 *
 * Replaces the prior small "Loading…" card that hovered over
 * a half-rendered map. Going to /survey from the dashboard
 * used to flash the map + a launcher modal before settling
 * on a parcel; now the overlay covers everything until the
 * URL fully forms.
 */
#survey-bootstrap {
    display: none;
    position: fixed;
    inset: 0;
    background: #f5f7fa;
    z-index: 9000;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#survey-bootstrap.is-visible {
    display: flex;
}
#survey-bootstrap-card {
    text-align: center;
    padding: 24px;
    max-width: 360px;
}
#survey-bootstrap-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 16px;
    border: 3px solid #e1e8ef;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
#survey-bootstrap-label {
    font-size: 14px;
    font-weight: 500;
    color: #1a2a3a;
}
body.theme-dark #survey-bootstrap { background: #0f1620; }
body.theme-dark #survey-bootstrap-spinner {
    border-color: #3b454f;
    border-top-color: #6db5ff;
}
body.theme-dark #survey-bootstrap-label { color: #e6eaee; }
#debug {
    display: none;
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: white;
    padding: 10px;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
}
#details-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--sidebar-width, 380px);
    height: 100%;
    background: var(--color-bg-elevated, #fff);
    /* Directional left-edge shadow (the panel hugs the right edge and
       casts onto the map). No --shadow-* token matches a horizontal
       offset, so this stays an explicit one-off. */
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    overflow-y: auto;
    display: none;
    box-sizing: border-box;
    z-index: 900;
}
#panel-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 15px 8px;
    border-bottom: 1px solid #eee;
}
#panel-body {
    padding: 12px 15px 20px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}
#panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    padding: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
#panel-close:hover { background: #ccc; color: #333; }
#panel-expand {
    position: absolute;
    top: 8px;
    right: 40px;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    padding: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
#panel-expand:hover { background: #ccc; color: #333; }
@media (max-width: 599px) {
    #panel-expand { display: none; }
}

.detail-row {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border, #eee);
    display: flex;
    justify-content: space-between;
}
.detail-row:last-child { border-bottom: none; }

#main-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    transition: all 0.3s ease;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#floating-viewer-host {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 950;
}
#floating-viewer-host > * { pointer-events: auto; }
#mapillary-viewer { width: 100%; height: 100%; }

#mapillary-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0,0,0,0.1);
    border-top: 4px solid #0080ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 102;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Page-state primitives ─────────────────────────────────────
 * Shared loading / empty / error states for index pages (/orgs,
 * /surveys, /admin) and other dashboard surfaces. The page
 * modules previously either inlined `style="color: #6b7280;"`
 * onto raw <p> tags or borrowed `.session-launcher-cta-card` for
 * generic message cards. These classes are the cleaner home for
 * those cases.
 *
 * Pattern (loading):
 *   <section class="profile-section">
 *     <div class="page-state page-state-loading">
 *       <div class="page-spinner" aria-hidden="true"></div>
 *       <p class="page-state-text">Loading orgs…</p>
 *     </div>
 *   </section>
 *
 * Pattern (empty):
 *   <div class="page-state page-state-empty">
 *     <div class="page-state-icon">○</div>
 *     <h2 class="page-state-title">No surveys yet</h2>
 *     <p class="page-state-text">…</p>
 *     <a class="page-state-cta" href="…">Back to profile</a>
 *   </div>
 */
.page-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 36px 24px;
    gap: 10px;
}
.page-state-icon {
    font-size: 32px;
    line-height: 1;
    opacity: 0.55;
    margin-bottom: 4px;
}
.page-state-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1f24;
}
.page-state-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #5a6470;
    max-width: 480px;
}
.page-state-cta {
    margin-top: 6px;
    color: #0066cc;
    text-decoration: none;
    font-size: 14px;
}
.page-state-cta:hover { text-decoration: underline; }

/* Spinner — own keyframes so we don't collide with the
 * Mapillary spinner above (which translates from center). */
.page-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e3e6ea;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: page-spinner-rotate 0.9s linear infinite;
}
@keyframes page-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* CTA + heading spacing helpers for index pages. Anchor variants
 * of .primary-btn need explicit `display: inline-block` so their
 * padding sits right; `.page-cta-button` adds that plus the
 * standard bottom margin so the next section has breathing room. */
.page-cta-button {
    display: inline-block;
    margin-bottom: 18px;
    text-decoration: none;
}
.page-section-subhead {
    margin-top: 24px;
}
.page-permission-note {
    margin: 0 0 18px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

/* Variant of the brand chip that flows inline instead of
 * position: fixed. Used on /surveys/new where the chip sits
 * above the page header rather than floating in the corner. */
.profile-brand-chip-static {
    position: static;
    margin-bottom: 18px;
}

/* Dark theme */
body.theme-dark .page-state-title { color: #e6eaee; }
body.theme-dark .page-state-text { color: #9aa6b2; }
body.theme-dark .page-state-cta { color: #4ea3ff; }
body.theme-dark .page-permission-note { color: #9aa6b2; }
body.theme-dark .page-spinner {
    border-color: #2a3340;
    border-top-color: #4ea3ff;
}

/* ── Slice 1b: builder dataset-scope picker ────────────────────
 * Mirrors the .survey-builder-imagery fieldset style so the new
 * "Scope by dataset" section reads as a peer to imagery date-range
 * + boundaries in the form.
 */
.survey-builder-dataset-scope {
    border: 1px solid #e1e8ef;
    border-radius: 8px;
    padding: 10px 12px 12px;
    margin: 0 0 14px;
}
.survey-builder-dataset-scope legend {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
    padding: 0 4px;
}
.survey-builder-dataset-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    /* Override legend defaults so the label inside doesn't inherit
     * the uppercase treatment that's meant for the legend text. */
    text-transform: none;
    letter-spacing: normal;
    color: #1a1f24;
    font-size: 13px;
    font-weight: 600;
}
.survey-builder-dataset-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.survey-builder-dataset-fields {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.survey-builder-dataset-fields[hidden] {
    display: none;
}
.survey-builder-dataset-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}
.survey-builder-dataset-field span,
.survey-builder-dataset-dates label > span {
    font-size: 11px;
    font-weight: 600;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.survey-builder-dataset-field select {
    padding: 6px 8px;
    border: 1px solid #d9dee4;
    border-radius: 6px;
    background: #fff;
    color: #1a1f24;
    font-size: 13px;
    font-family: inherit;
}
.survey-builder-dataset-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.survey-builder-dataset-dates label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-builder-dataset-dates input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #d9dee4;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}
/* Incident-type category chips (fire_incidents only for v1).
 * Multi-select checkboxes styled as pill chips. Empty selection =
 * no filter. */
.survey-builder-dataset-categories {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.survey-builder-dataset-category-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7682;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.survey-builder-dataset-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.survey-builder-dataset-category-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #d9dee4;
    border-radius: 999px;
    background: #fff;
    color: #1a1f24;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.survey-builder-dataset-category-chip:hover {
    background: #f5f8fb;
}
.survey-builder-dataset-category-chip:has(input:checked) {
    background: #e6f0ff;
    border-color: #0066cc;
    color: #0050a0;
    font-weight: 600;
}
.survey-builder-dataset-category-chip input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.survey-builder-dataset-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.survey-builder-dataset-preview-status {
    font-size: 12px;
    color: #5a6470;
}
.survey-builder-dataset-preview-status.is-error {
    color: #b3261e;
}
.survey-builder-dataset-preview-status.is-success {
    color: #16a34a;
    font-weight: 600;
}
/* Boundaries fieldset gets hidden via [hidden] attribute when
 * dataset scope is enabled. Belt-and-suspenders rule in case the
 * attribute is stripped by a future template change. */
.survey-builder-boundaries[hidden] {
    display: none;
}

body.theme-dark .survey-builder-dataset-scope {
    border-color: #2a3340;
}
body.theme-dark .survey-builder-dataset-toggle { color: #e6eaee; }
body.theme-dark .survey-builder-dataset-field select,
body.theme-dark .survey-builder-dataset-dates input[type="date"] {
    background: #1c252e;
    color: #e6eaee;
    border-color: #2a3340;
}
body.theme-dark .survey-builder-dataset-preview-status { color: #9aa6b2; }
body.theme-dark .survey-builder-dataset-preview-status.is-error { color: #ff8a85; }
body.theme-dark .survey-builder-dataset-preview-status.is-success { color: #4ade80; }
body.theme-dark .survey-builder-dataset-category-chip {
    background: #1c252e;
    color: #e6eaee;
    border-color: #2a3340;
}
body.theme-dark .survey-builder-dataset-category-chip:hover {
    background: #243044;
}
body.theme-dark .survey-builder-dataset-category-chip:has(input:checked) {
    background: #15355c;
    border-color: #4ea3ff;
    color: #aed1ff;
}

/* ── Survey-creation wizard (Stage 1 shell) ───────────────────────────
 * The wizard chrome that wraps the existing builder form: a progress
 * stepper at the top and a Back/Next bar at the bottom. `.wizard-hidden`
 * collapses any section not in the current step (see builder-wizard.js).
 * Tokens only — no raw magic numbers (see CLAUDE.md design system). */
.wizard-hidden { display: none !important; }

.survey-wizard-stepper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-4) 0 var(--space-5);
}
.survey-wizard-step {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-bg-elevated);
    color: #7a8693;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.survey-wizard-step:hover { border-color: #9aa6b2; color: #495057; }
.survey-wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e9ecef;
    color: #495057;
    font-size: 12px;
}
.survey-wizard-step.is-active {
    border-color: #0080ff;
    color: #0d2d4a;
    background: #eaf4ff;
}
.survey-wizard-step.is-active .survey-wizard-step-num { background: #0080ff; color: #fff; }
.survey-wizard-step.is-done { color: #495057; }
.survey-wizard-step.is-done .survey-wizard-step-num { background: #22c55e; color: #fff; }
.survey-wizard-step-sep {
    flex: 0 0 16px;
    height: 1px;
    background: var(--color-border-strong);
}

.survey-wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-6) 0 var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}
.survey-wizard-back {
    background: transparent;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}
.survey-wizard-back:hover { background: var(--color-bg-muted); }
.survey-wizard-position {
    font-size: 13px;
    color: #7a8693;
    margin-left: auto;
    margin-right: auto;
}
.survey-wizard-next { min-width: 120px; }

/* Phone-class: narrow OR short (matches the app-wide breakpoint rule).
 * Collapse step chips to numbered dots so the stepper fits one row. */
@media (max-width: 768px), (max-height: 600px) {
    .survey-wizard-step-title { display: none; }
    .survey-wizard-step { padding: var(--space-2); border-radius: 50%; }
    .survey-wizard-step-sep { flex-basis: 8px; }
    .survey-wizard-nav { margin-top: var(--space-5); }
}

/* Coverage plain-English summary (Slice 1a) — see
 * docs/design/survey-creator-coverage.md. */
.survey-new-coverage-headline {
    font-size: 15px;
    color: var(--color-fg-primary);
    margin-bottom: var(--space-1);
}
.survey-new-coverage-headline strong { color: #0080ff; }
.survey-new-coverage-nudge {
    margin-top: var(--space-2);
    font-size: 12.5px;
    color: #7a8693;
}

/* Geography step — inquisitive intro + lens cards (Slice 1c). */
.survey-new-map-collapsed { display: none; }

.survey-new-geo-intro { margin-bottom: var(--space-4); }
.survey-new-step-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-fg-primary);
    margin: 0 0 var(--space-2);
}
.survey-new-step-help {
    font-size: 14px;
    color: #7a8693;
    margin: 0;
    max-width: 60ch;
}

/* Imagery step (Slice 1k) — Detroit Street View showcase. Reuses the
   activity feed's .activity-grouped-thumbs grid + .activity-grouped-thumb
   tiles for the strip; only the intro, label, and empty state are new. */
/* Break the imagery step out of the ~760px form column so the showcase
   uses the full window (centered), same trick as .survey-new-geo-row.
   Reset to the column width on phone (below). */
#survey-new-imagery-host:not(.wizard-hidden) {
    display: block;
    width: min(1280px, calc(100vw - 48px));
    margin-left: calc((100% - min(1280px, calc(100vw - 48px))) / 2);
}
.survey-new-imagery-intro { text-align: center; margin-bottom: var(--space-4); }
.survey-new-imagery-intro .survey-new-step-help { margin-inline: auto; }
.survey-new-imagery-showcase { margin-bottom: var(--space-5); text-align: center; }
/* Bigger, centered tiles than the dashboard feed's auto-fit/1fr grid. */
.survey-new-imagery-strip {
    grid-template-columns: repeat(auto-fit, minmax(220px, 240px));
    justify-content: center;
    gap: var(--space-3);
}
.survey-new-imagery-thumb--empty {
    cursor: default;
    border: 1px dashed var(--color-border-strong);
    background: var(--color-bg-muted);
}
.survey-new-imagery-thumb--empty:hover { transform: none; box-shadow: none; }
.survey-new-imagery-thumb-icon {
    color: #b3bdc7;
    width: 28px;
    height: 28px;
}
.survey-new-imagery-thumb-icon svg { width: 100%; height: 100%; }
.survey-new-imagery-empty-note {
    margin-top: var(--space-2);
    font-size: 13px;
    color: #7a8693;
}

/* Review step — stylized summary of the whole survey config. */
.survey-new-review { display: flex; flex-direction: column; gap: var(--space-4); }
.survey-new-review-intro { margin-bottom: var(--space-1); }
.survey-new-review-card {
    border: 1px solid var(--color-border, #e6eaee);
    border-radius: var(--radius-lg, 12px);
    background: var(--color-bg-elevated, #fff);
    padding: var(--space-4);
}
.survey-new-review-card-title {
    margin: 0 0 var(--space-3);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7a8693;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.survey-new-review-count {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #e9eef3;
    color: #495057;
    font-weight: 700;
}
.survey-new-review-survey-title { font-size: 18px; font-weight: 700; color: var(--color-text, #1a1f24); }
.survey-new-review-desc { margin: var(--space-2) 0 0; color: #495057; font-size: 14px; line-height: 1.5; }
.survey-new-review-badges { margin-top: var(--space-3); }
.survey-new-review-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #0064cc;
    font-size: 12px;
    font-weight: 600;
}
.survey-new-review-sentence { margin: 0; font-size: 15px; color: var(--color-text, #1a1f24); line-height: 1.5; }
.survey-new-review-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.survey-new-review-chip {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border-strong, #d0d7de);
    background: var(--color-bg-elevated, #fff);
    font-size: 13px;
    color: #495057;
}
.survey-new-review-qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.survey-new-review-q {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border, #eef0f3);
}
.survey-new-review-q:last-child { border-bottom: none; }
.survey-new-review-q-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #eef4ff;
    color: #0064cc;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.survey-new-review-q-prompt { flex: 1 1 auto; font-size: 14px; color: var(--color-text, #1a1f24); }
.survey-new-review-q-type {
    flex: 0 0 auto;
    font-size: 11px;
    color: #7a8693;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f0f2f5;
}
.survey-new-review-q-req {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #c2410c;
    letter-spacing: 0.04em;
}

/* Coverage hero — map snapshot + headline parcel count. */
.survey-new-review-coverage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: stretch;
}
.survey-new-review-mapwrap {
    border-radius: var(--radius-md, 10px);
    overflow: hidden;
    border: 1px solid var(--color-border, #e6eaee);
    min-height: 200px;
    background: #eef1f4;
}
.survey-new-review-map {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 200px;
    object-fit: cover;
}
.survey-new-review-coverage-info { display: flex; flex-direction: column; gap: var(--space-3); }
.survey-new-review-stat { display: flex; flex-direction: column; gap: 1px; }
.survey-new-review-stat-num {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    color: var(--color-text, #1a1f24);
    letter-spacing: -0.01em;
}
.survey-new-review-stat-label { font-size: 14px; font-weight: 600; color: #495057; }
.survey-new-review-stat-sub { font-size: 12px; color: #7a8693; }
@media (max-width: 768px), (max-height: 600px) {
    .survey-new-review-coverage-grid { grid-template-columns: 1fr; }
}

/* Bulk parcel-list uploader (reusable widget). */
.parcel-bulk { display: flex; flex-direction: column; gap: var(--space-3); }
.parcel-bulk-drop {
    border: 1px dashed var(--color-border-strong, #d0d7de);
    border-radius: var(--radius-md, 10px);
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-bg-muted, #f8fafc);
}
.parcel-bulk-drop.is-over { border-color: #0080ff; background: rgba(0, 128, 255, 0.06); }
.parcel-bulk-drop-hint { font-size: 13px; color: #7a8693; }
.parcel-bulk-paste {
    width: 100%;
    box-sizing: border-box;
    padding: var(--space-3);
    border: 1px solid var(--color-border-strong, #d0d7de);
    border-radius: var(--radius-md, 8px);
    font: inherit;
    font-size: 13px;
    resize: vertical;
}
.parcel-bulk-controls { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.parcel-bulk-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #7a8693; }
.parcel-bulk-field select {
    padding: 6px 9px;
    border: 1px solid var(--color-border-strong, #d0d7de);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    color: var(--color-text, #1a1f24);
    background: #fff;
}
.parcel-bulk-resolve { margin-left: auto; }
.parcel-bulk-status { font-size: 13px; color: #7a8693; min-height: 1em; }
.parcel-bulk-status.is-error { color: #c0392b; }
.parcel-bulk-summary { display: flex; gap: var(--space-3); font-size: 14px; margin-bottom: var(--space-2); }
.parcel-bulk-summary-ok { color: #1a7f37; font-weight: 600; }
.parcel-bulk-summary-bad { color: #c2410c; font-weight: 600; }
.parcel-bulk-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--color-border, #e6eaee);
    border-radius: 8px;
}
.parcel-bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.parcel-bulk-table th,
.parcel-bulk-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--color-border, #eef0f3); }
.parcel-bulk-table th {
    position: sticky;
    top: 0;
    background: var(--color-bg-elevated, #fff);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7a8693;
}
.parcel-bulk-row.is-bad .parcel-bulk-status-cell { color: #c2410c; }
.parcel-bulk-row.is-ok .parcel-bulk-status-cell { color: #1a7f37; }
.parcel-bulk-use { margin-top: var(--space-3); }
.survey-new-upload-confirm {
    margin-top: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md, 8px);
    background: #eef7f0;
    color: #1a7f37;
    font-size: 14px;
}

.survey-new-lens-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.survey-new-lens-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-4);
    text-align: left;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color var(--motion-fast) ease,
                box-shadow var(--motion-fast) ease,
                background var(--motion-fast) ease;
}
.survey-new-lens-card:hover { border-color: #9aa6b2; box-shadow: var(--shadow-sm); }
.survey-new-lens-card.is-active {
    border-color: #0080ff;
    background: #eaf4ff;
    box-shadow: 0 0 0 1px #0080ff;
}
.survey-new-lens-card-icon { color: #0080ff; }
.survey-new-lens-card-icon svg { width: 24px; height: 24px; display: block; }
.survey-new-lens-card-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-fg-primary);
}
.survey-new-lens-card-desc {
    font-size: 12.5px;
    color: #7a8693;
    line-height: 1.4;
}

/* Upload step placeholder (Slice 1f). */
.survey-new-upload-drop {
    padding: var(--space-6);
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    text-align: center;
}
.survey-new-upload-note { margin-top: var(--space-3); font-size: 12.5px; color: #7a8693; }

/* Refine route sub-sections (Slice 1g). */
.refine-hidden { display: none !important; }
.survey-new-refine-sub { margin-top: var(--space-5); }
.survey-new-refine-sub-label {
    font-size: 13px;
    font-weight: 600;
    color: #7a8693;
    margin-bottom: var(--space-2);
}

/* Data menu (Slice 1h). */
.survey-new-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: var(--space-2);
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-bg-elevated);
    color: #7a8693;
    font-size: 11px;
    font-style: italic;
    font-weight: 700;
    cursor: pointer;
}
.survey-new-info-btn:hover { color: #0080ff; border-color: #0080ff; }
.survey-new-info-note {
    margin: var(--space-2) 0 var(--space-3);
    padding: var(--space-3);
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
    background: var(--color-bg-muted);
    border-radius: var(--radius-md);
}
.survey-new-soon {
    margin-left: var(--space-1);
    padding: 0 var(--space-1);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #7a8693;
    background: #e9ecef;
    border-radius: var(--radius-sm);
}
.survey-new-lens-card.is-disabled { opacity: 0.5; cursor: not-allowed; }
.survey-new-lens-card.is-disabled:hover { border-color: var(--color-border-strong); box-shadow: none; }
.survey-new-date-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.survey-new-date-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}
.survey-new-date-field input[type="date"] {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 400;
    color: var(--color-text);
    background: var(--color-bg-elevated);
}
.survey-new-date-field input[type="date"]:focus {
    outline: none;
    border-color: #0080ff;
}
.survey-new-chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.survey-new-chip {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-bg-elevated);
    font-size: 13px;
    color: #495057;
    cursor: pointer;
}
.survey-new-chip:hover { border-color: #9aa6b2; }
.survey-new-chip.is-on { background: #eaf4ff; border-color: #0080ff; color: #0d2d4a; }

/* "Survey by road" step — street picker + house-number range + side. */
.survey-new-road-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-width: 520px;
}
.survey-new-road-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}
.survey-new-road-field input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 400;
    color: var(--color-text);
    background: var(--color-bg-elevated);
}
.survey-new-road-field input:focus { outline: none; border-color: #0080ff; }
.survey-new-road-range { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.survey-new-road-range .survey-new-road-field input { width: 8rem; }
.survey-new-road-hint { font-size: 12px; font-weight: 500; color: #6b7785; min-height: 1em; }
.survey-new-road-hint.is-error { color: #c0392b; }
.survey-new-road-side { display: flex; flex-direction: column; gap: var(--space-2); }
.survey-new-road-autocomplete { position: relative; }
.survey-new-road-autocomplete input { width: 100%; box-sizing: border-box; }
.survey-new-road-suggest {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    margin: 0;
    padding: var(--space-1);
    max-height: 16rem;
    overflow-y: auto;
    list-style: none;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.survey-new-road-suggest[hidden] { display: none; }
.survey-new-road-suggest-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-weight: 400;
    cursor: pointer;
}
.survey-new-road-suggest-item:hover,
.survey-new-road-suggest-item.is-active { background: #eaf4ff; }
.survey-new-road-suggest-name { color: var(--color-text); }
.survey-new-road-suggest-range { font-size: 12px; color: #6b7785; white-space: nowrap; }

/* Two-pane Geography: map left, Selected-areas panel right (Slice 1d). */
.survey-new-map-hint {
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: #eaf4ff;
    border: 1px solid #b9dcff;
    border-radius: var(--radius-md);
    color: #0d2d4a;
    font-size: 13px;
    font-weight: 500;
}
.survey-new-map-hint.is-hidden { display: none; }

.survey-new-geo-row {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    /* Break out of the 760px form column so the map uses the room a full
     * window offers. The form steps stay narrow + readable; only this row
     * widens (centered). Reset to the column width on phone (below). */
    width: min(1280px, calc(100vw - 48px));
    margin-left: calc((100% - min(1280px, calc(100vw - 48px))) / 2);
}
.survey-new-geo-row #survey-new-map-section { flex: 1 1 auto; min-width: 0; }
#survey-new-selected-panel { flex: 0 0 260px; }
#survey-new-selected-panel:empty { display: none; }

.survey-new-selected-card {
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-bg-elevated);
    overflow: hidden;
}
.survey-new-selected-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}
.survey-new-selected-title { font-size: 13px; font-weight: 700; color: var(--color-fg-primary); }
.survey-new-selected-count {
    display: inline-block;
    min-width: 18px;
    padding: 0 var(--space-1);
    margin-left: var(--space-1);
    text-align: center;
    border-radius: var(--radius-pill);
    background: #eaf4ff;
    color: #0080ff;
    font-size: 12px;
}
.survey-new-selected-clear {
    background: transparent;
    border: none;
    font-size: 12px;
    color: #7a8693;
    cursor: pointer;
}
.survey-new-selected-clear:hover { color: #c43c3c; }
.survey-new-selected-list {
    list-style: none;
    margin: 0;
    padding: var(--space-1);
    max-height: 320px;
    overflow-y: auto;
}
.survey-new-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 13px;
}
.survey-new-selected-item:hover { background: var(--color-bg-muted); }
.survey-new-selected-item.is-excluded .survey-new-selected-name {
    text-decoration: line-through;
    color: #9aa6b2;
}
.survey-new-selected-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.survey-new-selected-toggle {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-bg-elevated);
    color: #495057;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.survey-new-selected-toggle:hover { border-color: #9aa6b2; }
.survey-new-selected-item.is-excluded .survey-new-selected-toggle { color: #0080ff; border-color: #0080ff; }

@media (max-width: 768px), (max-height: 600px) {
    .survey-new-lens-cards { grid-template-columns: 1fr; }
    .survey-new-step-heading { font-size: 18px; }
    .survey-new-geo-row { flex-direction: column; width: auto; margin-left: 0; }
    #survey-new-imagery-host:not(.wizard-hidden) { width: auto; margin-left: 0; }
    #survey-new-selected-panel { flex: 1 1 auto; width: 100%; }
    #survey-new-map-section { height: 380px; }
}
