/* ==========================================================================
   Fieldstamp — inspector console and capture page, on top of design-tokens.css
   + ui.css + sdk-app.css.

   Two screens with opposite jobs. The console is dense: a live picture, a list
   of things still to photograph, and a log you scan. The capture page is the
   opposite of dense — it is held at arm's length, outdoors, by somebody who
   has never seen it before, so there is one instruction on it at a time and
   the type is large enough to read in sunlight.
   ========================================================================== */

#connectionModal { z-index: 9999 !important; }
#connectionModal.active { backdrop-filter: blur(8px); }

:root {
    --fs-ok:   #34d399;
    --fs-bad:  #f87171;
    --fs-warn: #fbbf24;
}

/* ========================================================== inspector console */

.fs-console { display: grid; gap: var(--sp-4); min-height: 0; overflow-y: auto; }
@media (min-width: 1000px) {
    .fs-console { grid-template-columns: minmax(0, 1.35fr) minmax(min(320px, 100%), 0.85fr); align-items: start; }
}

.fs-video-wrap {
    position: relative;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    aspect-ratio: 16 / 10;
}
.fs-video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.fs-novideo {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--sp-2);
    text-align: center;
    padding: var(--sp-6);
    color: var(--text-muted);
}
.fs-novideo svg { width: 34px; height: 34px; color: var(--text-faint); }
.fs-novideo strong { color: var(--text); font-weight: 600; }

.fs-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); align-items: center; }
.fs-actions .fs-spacer { flex: 1; }

.fs-counts { display: flex; align-items: baseline; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.fs-counts b { font-family: var(--font-mono); font-size: var(--fs-lg); color: var(--text); }
#rejectCount { color: var(--fs-bad); }

.fs-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
}
.fs-card__title {
    font-size: var(--fs-xs);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--sp-3);
    display: flex;
    justify-content: space-between;
    gap: var(--sp-2);
}

.fs-empty { font-size: var(--fs-sm); color: var(--text-faint); padding: var(--sp-2) 0; list-style: none; }

/* ---- prompt checklist ---------------------------------------------------- */
.fs-prompts { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-2); }
.fs-prompt {
    display: grid;
    grid-template-columns: 18px 1fr auto auto;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-md);
}
.fs-prompt__tick { color: var(--fs-ok); font-family: var(--font-mono); }
.fs-prompt__text { color: var(--text-body); line-height: var(--lh-snug); }
.fs-prompt.is-done .fs-prompt__text { color: var(--text-faint); text-decoration: line-through; }

.fs-addrow { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); }

/* ---- evidence log -------------------------------------------------------- */
.fs-log { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); max-height: 46vh; overflow-y: auto; }
.fs-entry {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: var(--sp-3);
    padding: var(--sp-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    cursor: pointer;
}
.fs-entry:hover { border-color: var(--border-strong); }
.fs-entry__thumb { width: 64px; height: 48px; object-fit: cover; border-radius: var(--r-sm); background: #000; }
.fs-entry__body { min-width: 0; }
.fs-entry__head { display: flex; align-items: baseline; gap: var(--sp-2); }
.fs-entry__seq { font-family: var(--font-mono); color: var(--text-faint); font-size: var(--fs-sm); }
.fs-entry__prompt { font-size: var(--fs-md); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-entry__meta { font-size: var(--fs-xs); color: var(--text-muted); }
.fs-entry__hash { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

.fs-verify {
    margin-top: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    font-size: var(--fs-sm);
    color: var(--text-body);
    background: var(--surface-2);
}
.fs-verify.is-ok  { border-color: rgba(52,211,153,.4);  color: var(--fs-ok); background: var(--success-bg); }
.fs-verify.is-bad { border-color: rgba(248,113,113,.4); color: var(--fs-bad); background: var(--danger-bg); }

/* ---- viewer -------------------------------------------------------------- */
.fs-viewer {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: var(--overlay);
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    backdrop-filter: blur(6px);
}
.fs-viewer__panel {
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: var(--sp-5);
    box-shadow: var(--shadow-3);
}
.fs-viewer__head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.fs-viewer__head h3 { margin: 0; font-size: var(--fs-xl); }
.fs-viewer__head .fs-spacer { flex: 1; }
.fs-viewer img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); display: block; background: #000; }

.fs-stamp { display: grid; grid-template-columns: 110px 1fr; gap: 4px var(--sp-3); margin: var(--sp-4) 0 0; font-size: var(--fs-sm); }
.fs-stamp dt { color: var(--text-muted); }
.fs-stamp dd { margin: 0; color: var(--text-body); }
.fs-hash { font-family: var(--font-mono); font-size: 11px; word-break: break-all; color: var(--text-muted); }
.fs-dim { color: var(--text-faint); }

.fs-note { width: 100%; margin-top: var(--sp-4); }

/* ============================================================ capture page */

.fs-capture {
    display: grid;
    gap: var(--sp-3);
    grid-template-rows: auto 1fr auto;
    height: 100%;
    min-height: 0;
}

.fs-prompt-box {
    background: var(--brand-subtle);
    border: 1px solid var(--brand);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    text-align: center;
}
.fs-prompt-box__label {
    font-size: var(--fs-xs);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand-ink);
    display: block;
    margin-bottom: var(--sp-2);
}
.fs-prompt-box__text {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    line-height: var(--lh-snug);
    margin: 0;
    text-wrap: balance;
}

.fs-preview-wrap {
    position: relative;
    background: #000;
    border-radius: var(--r-lg);
    overflow: hidden;
    min-height: 240px;
    border: 1px solid var(--border);
}
.fs-preview-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }

.fs-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}
.fs-flash.is-on { animation: fs-flash 420ms ease-out; }
@keyframes fs-flash { 0% { opacity: .85; } 100% { opacity: 0; } }

.fs-camera-off {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--sp-3);
    text-align: center;
    padding: var(--sp-6);
    background: var(--surface-1);
}

.fs-capture-foot { display: grid; gap: var(--sp-3); }
.fs-status {
    font-size: var(--fs-base);
    color: var(--text-body);
    text-align: center;
    min-height: 1.6em;
}
.fs-status.is-bad { color: var(--fs-bad); }

.fs-geo {
    display: grid;
    gap: var(--sp-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    background: var(--surface-1);
}
.fs-geo__row { display: flex; align-items: center; gap: var(--sp-3); }
.fs-geo__row label { font-size: var(--fs-md); color: var(--text); flex: 1; }
.fs-geo__row input { width: 20px; height: 20px; accent-color: var(--brand); }
.fs-geo__note { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }

.fs-sent { display: flex; justify-content: center; gap: var(--sp-2); align-items: baseline; font-size: var(--fs-sm); color: var(--text-muted); }
.fs-sent b { font-family: var(--font-mono); font-size: var(--fs-xl); color: var(--text); }

.fs-done { text-align: center; padding: var(--sp-12) var(--sp-4); }
.fs-done h2 { font-size: var(--fs-2xl); margin: 0 0 var(--sp-3); }
.fs-done p { color: var(--text-body); margin: 0 0 var(--sp-2); }

@media (max-width: 720px) {
    .fs-prompt-box { padding: var(--sp-3); }
    .fs-entry { grid-template-columns: 52px 1fr; }
    .fs-entry__thumb { width: 52px; height: 40px; }
}


/* --- Phone --------------------------------------------------------------- */
/* The console header carries a title, a session name, a status sentence and a
   count. On a narrow phone the count's WORD is the part worth losing: the
   number still tells the inspector where they are. */
@media (max-width: 640px) {
    .fs-counts__label { display: none; }
    .fs-counts { min-width: 0; }
}
