/* ============================================================================
   KromeShot Studio — dark studio theme
   A creator tool for virtual photo shoots, not an admin panel. Near-black layered
   surfaces, a violet primary action, and a warm amber "light-painting" signature
   accent (PROJECT.md §2.3). Semantic tokens (--ks-*) drive the app; the --krome-*
   block re-skins the Krome.Blazor KromeButton (whose inline CSS reads
   var(--krome-*, <light fallback>)) so it matches this dark surface.
   ============================================================================ */
:root {
    color-scheme: dark;

    /* Surfaces — near-black with a faint warm tint, layered for depth */
    --ks-bg: #0b0c10;
    --ks-surface: #14151c;
    --ks-surface-2: #1c1e28;
    --ks-inset: #0f1015;
    --ks-border: #262932;
    --ks-border-strong: #363b47;

    /* Text */
    --ks-text: #edeef3;
    --ks-text-dim: #c4c8d2;
    --ks-text-muted: #8b909e;
    --ks-text-faint: #5f6472;

    /* Primary — violet (safe with white button text) */
    --ks-accent: #7c5cff;
    --ks-accent-2: #9b7bff;
    --ks-accent-ring: rgba(124, 92, 255, 0.35);

    /* Signature — warm amber light-painting glow (highlights, focus, active nav) */
    --ks-signature: #f5b642;
    --ks-signature-2: #ffcf6b;
    --ks-signature-glow: rgba(245, 182, 66, 0.22);

    /* Status */
    --ks-info: #4b8bf5;
    --ks-info-text: #9cc2ff;
    --ks-ok: #29c467;
    --ks-ok-text: #74e5a2;
    --ks-warn: #f5a524;
    --ks-warn-text: #fbc65a;
    --ks-danger: #f0503c;
    --ks-danger-text: #ff9c8f;

    --ks-radius: 14px;
    --ks-radius-sm: 9px;

    /* KromeButton (Krome.Blazor) dark re-skin */
    --krome-primary: var(--ks-accent);
    --krome-primary-hover: var(--ks-accent-2);
    --krome-surface: var(--ks-surface-2);
    --krome-border: var(--ks-border-strong);
    --krome-text-primary: var(--ks-text);
    --krome-text-secondary: var(--ks-text-muted);
    --krome-gray-50: var(--ks-surface-2);
    --krome-gray-100: var(--ks-surface-2);
    --krome-gray-300: var(--ks-border-strong);
    --krome-error: var(--ks-danger);
    --krome-success: var(--ks-ok);
    --krome-warning: var(--ks-warn);
    --krome-radius-md: 10px;
    --krome-radius-sm: 7px;
    --krome-transition-fast: 150ms ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background:
        radial-gradient(1200px 600px at 78% -8%, rgba(124, 92, 255, 0.10), transparent 60%),
        radial-gradient(900px 500px at 8% 108%, var(--ks-signature-glow), transparent 55%),
        var(--ks-bg);
    background-attachment: fixed;
    color: var(--ks-text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ks-accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
code { font-family: "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 0.85em; }

:focus-visible {
    outline: 2px solid var(--ks-signature);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- App shell ------------------------------------------------------------- */
.ks-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }

.ks-sidebar {
    display: flex; flex-direction: column; gap: 8px;
    padding: 22px 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--ks-surface);
    border-right: 1px solid var(--ks-border);
    position: sticky; top: 0; height: 100dvh;
}

.ks-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.ks-mark {
    width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, var(--ks-bg) 26%, transparent 27%),
                conic-gradient(from 210deg, var(--ks-signature), var(--ks-accent), var(--ks-signature));
    box-shadow: 0 0 18px var(--ks-signature-glow);
}
.ks-brand-name { font-weight: 700; letter-spacing: 0.02em; font-size: 17px; }

.ks-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ks-nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--ks-text-dim); font-weight: 550; text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}
.ks-nav-item:hover { background: var(--ks-surface-2); color: var(--ks-text); text-decoration: none; }
.ks-nav-item.active {
    background: linear-gradient(90deg, var(--ks-signature-glow), transparent);
    color: var(--ks-text);
    box-shadow: inset 3px 0 0 var(--ks-signature);
}
.ks-nav-icon { width: 19px; height: 19px; flex: none; }

.ks-operator {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 12px; margin-top: 8px;
    background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: 12px;
}
.ks-operator-id { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ks-operator-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-operator-tenant { color: var(--ks-text-faint); font-size: 11.5px; }
.ks-operator-account { color: var(--ks-text-muted); font-size: 12px; white-space: nowrap; }
.ks-operator-account:hover { color: var(--ks-text); }
.ks-signout-btn {
    background: transparent; border: 1px solid var(--ks-border-strong); color: var(--ks-text-muted);
    padding: 5px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: all 150ms ease;
}
.ks-signout-btn:hover { color: var(--ks-danger-text); border-color: var(--ks-danger); }

/* min-width: 0 lets this grid item shrink below its content (a wide table) so the table scrolls in its own
   wrapper instead of stretching the column and the page (GitLab #128). */
.ks-main { padding: 34px 40px 64px; max-width: 1200px; width: 100%; min-width: 0; }

/* Mobile app-shell chrome (top bar + hamburger + scrim). Hidden on desktop, where the sidebar is the grid
   column; the responsive block below turns these on and slides the sidebar in as a sheet. */
.ks-topbar { display: none; }
.ks-hamburger { display: none; }
.ks-scrim { display: none; }
.ks-brand--bar { padding: 0; }
.ks-bar-end { margin-left: auto; }

/* --- Page chrome ----------------------------------------------------------- */
.pg-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
/* overflow-wrap:anywhere — a long unbroken title token (e.g. a persona name carrying a run id) must wrap
   rather than force horizontal scroll at 390px; without it the h1's min-content pins the page wider than the
   phone viewport (mobile-first, no horizontal overflow). */
.pg-title { font-size: 27px; overflow-wrap: anywhere; }
.pg-sub { color: var(--ks-text-muted); margin: 5px 0 0; max-width: 60ch; }
/* GitLab #103: owner rule — 44px touch targets at every width (same class-level approach as #101). */
.pg-back { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--ks-text-muted); font-size: 13px; margin-bottom: 6px; }

.pg-loading, .ks-route-authorizing { color: var(--ks-text-muted); padding: 40px 0; }
.pg-error {
    background: rgba(240, 80, 60, 0.10); border: 1px solid rgba(240, 80, 60, 0.35);
    color: var(--ks-danger-text); padding: 12px 15px; border-radius: 11px; margin-bottom: 18px;
    white-space: pre-line;
}
.pd-note {
    background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.4);
    color: var(--ks-signature-2); padding: 11px 15px; border-radius: 11px; margin-bottom: 18px;
}
.pg-ok {
    background: rgba(41, 196, 103, 0.10); border: 1px solid rgba(41, 196, 103, 0.35);
    color: var(--ks-ok-text); padding: 12px 15px; border-radius: 11px; margin-bottom: 18px;
}

/* --- Library portability (export/import bundles) --------------------------- */
.pg-header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pg-header-actions .krome-btn { min-height: 44px; min-width: 44px; }
.pg-note {
    background: rgba(41, 196, 103, 0.10); border: 1px solid rgba(41, 196, 103, 0.35);
    color: var(--ks-ok-text); padding: 12px 15px; border-radius: 11px; margin-bottom: 18px;
}
.pg-import { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ks-text-muted); font-size: 13px; }
.pg-import > span { white-space: nowrap; }
.pg-import input[type="file"] { max-width: 190px; font-size: 12px; color: var(--ks-text-muted); }
.lib-item { display: flex; flex-direction: column; gap: 8px; }
.lib-item > .lib-card, .lib-item > a, .lib-item > .pc-card { flex: 1; }

/* --- My account (self-service change password) ----------------------------- */
.ac-panel {
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    padding: 26px 28px; max-width: 520px;
}
.ac-heading { font-size: 18px; margin: 0 0 14px; }
.ac-form { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.ac-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

/* --- Empty states ---------------------------------------------------------- */
.pg-empty {
    text-align: center; max-width: 560px; margin: 40px auto;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    padding: 40px 34px;
}
.pg-empty h2 { font-size: 21px; margin-bottom: 8px; }
.pg-empty p { color: var(--ks-text-muted); }
.pg-empty-mark {
    width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, var(--ks-bg) 30%, transparent 31%),
                conic-gradient(from 200deg, var(--ks-signature), var(--ks-accent), var(--ks-signature));
    box-shadow: 0 0 28px var(--ks-signature-glow);
}
.pg-empty-steps { text-align: left; color: var(--ks-text-dim); margin: 20px auto; max-width: 420px; line-height: 1.9; }
.pg-empty--filtered { padding: 30px; margin: 24px auto; }

/* --- Toolbar / filter chips ------------------------------------------------ */
.pg-toolbar { display: flex; flex-wrap: wrap; gap: 14px 26px; margin-bottom: 22px; }
.pg-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.pg-chip {
    background: var(--ks-surface); border: 1px solid var(--ks-border); color: var(--ks-text-muted);
    padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 550; cursor: pointer;
    transition: all 150ms ease;
}
.pg-chip:hover { color: var(--ks-text); border-color: var(--ks-border-strong); }
.pg-chip.is-active {
    background: var(--ks-accent); border-color: var(--ks-accent); color: #fff;
    box-shadow: 0 0 0 3px var(--ks-accent-ring);
}
/* Library category/tag pill filter (feature: library-categories-tags) — hierarchical children read as
   indented, lighter pills; each pill carries a scoped "(N)" count; the tag row gets a small lead label. */
.lib-filters { gap: 12px 22px; }
.pg-chip--child[data-depth="1"] { margin-left: 6px; }
.pg-chip--child[data-depth="2"] { margin-left: 12px; }
.pg-chip--child { background: var(--ks-surface-2); font-weight: 500; }
.pg-chip--child::before { content: "› "; color: var(--ks-text-faint); }
.pg-chip-count { margin-left: 6px; font-size: 11px; font-weight: 600; opacity: 0.75; font-variant-numeric: tabular-nums; }
.pg-filters-label { align-self: center; color: var(--ks-text-faint); font-size: 12px; font-weight: 600; margin-right: 2px; }

/* --- Persona grid + cards -------------------------------------------------- */
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }

.pc-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    color: inherit; transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.pc-card:hover {
    transform: translateY(-3px); border-color: var(--ks-border-strong);
    box-shadow: 0 14px 34px rgba(0,0,0,0.42);
}
/* The rest of the card is one stretched link to detail: its ::after overlays the whole card, so a tap
   anywhere navigates — except the avatar button, which is lifted above it and opens the lightbox instead. */
.pc-link { display: block; color: inherit; text-decoration: none; }
.pc-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--ks-radius); }
.pc-avatar { position: relative; z-index: 2; }
.pc-cover {
    position: relative; aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center;
}
.pc-cover--person { background: radial-gradient(120% 120% at 30% 20%, #3a2f6b, #171826); }
.pc-cover--product { background: radial-gradient(120% 120% at 30% 20%, #6b4a24, #1c1712); }
.pc-cover--thing { background: radial-gradient(120% 120% at 30% 20%, #1f4d54, #131c1e); }
.pc-subject {
    position: absolute; top: 10px; left: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase; color: rgba(255,255,255,0.85); background: rgba(0,0,0,0.30);
    padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(3px);
}
/* "Ready to review" cover badge (persona-preview-pv3b) — a freshly trained character awaiting the owner's verdict. */
.pc-review-badge {
    position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
    color: #1a1206; background: var(--ks-signature-2); padding: 3px 9px; border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.pc-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; }
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-name { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-desc { color: var(--ks-text-muted); font-size: 13px; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.pc-trigger { font-family: "Cascadia Code", monospace; font-size: 11.5px; color: var(--ks-signature-2);
    background: var(--ks-signature-glow); padding: 2px 8px; border-radius: 6px; }
.pc-version { font-size: 11.5px; color: var(--ks-text-faint); }

/* --- Badges ---------------------------------------------------------------- */
.ks-badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.ks-badge--neutral { background: var(--ks-surface-2); color: var(--ks-text-dim); border-color: var(--ks-border); }
.ks-badge--info { background: rgba(75,139,245,0.14); color: var(--ks-info-text); border-color: rgba(75,139,245,0.32); }
.ks-badge--success { background: rgba(41,196,103,0.14); color: var(--ks-ok-text); border-color: rgba(41,196,103,0.32); }
.ks-badge--warning { background: rgba(245,165,36,0.14); color: var(--ks-warn-text); border-color: rgba(245,165,36,0.32); }
.ks-badge--danger { background: rgba(240,80,60,0.14); color: var(--ks-danger-text); border-color: rgba(240,80,60,0.32); }
/* A tappable badge (FR-DC-KS-03 fact-check note / near-duplicate link) — a phone has no hover, so the note
   surfaces on tap. The pill stays visually the same small size; ::after invisibly pads the hit area to the
   ~44px mobile tap-target floor without shifting layout. */
.asset-badge-tap { appearance: none; -webkit-appearance: none; font: inherit; cursor: pointer; text-decoration: none; position: relative; }
.asset-badge-tap::after { content: ""; position: absolute; inset: -12px -6px; }

/* --- Wizard (create flow) -------------------------------------------------- */
.wz-steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; }
.wz-steps li { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--ks-surface); border: 1px solid var(--ks-border); color: var(--ks-text-faint); }
.wz-steps li.is-active { color: #fff; background: var(--ks-accent); border-color: var(--ks-accent); box-shadow: 0 0 0 3px var(--ks-accent-ring); }
.wz-steps li.is-done { color: var(--ks-ok-text); border-color: rgba(41,196,103,0.4); }

.wz-panel { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); padding: 26px; max-width: 720px; }
.wz-form { display: flex; flex-direction: column; gap: 17px; }
.wz-field { display: flex; flex-direction: column; gap: 6px; }
.wz-field > span { font-size: 13px; font-weight: 600; color: var(--ks-text-dim); }
.wz-field em { color: var(--ks-text-faint); font-style: normal; }
.wz-field small { color: var(--ks-text-faint); font-size: 12px; }
input[type=text], input[type=email], input[type=password], textarea, select {
    background: var(--ks-inset); border: 1px solid var(--ks-border-strong); color: var(--ks-text);
    border-radius: var(--ks-radius-sm); padding: 10px 12px; font: inherit; font-size: 14px; width: 100%;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ks-accent); box-shadow: 0 0 0 3px var(--ks-accent-ring); }
textarea { resize: vertical; }

.wz-hint { color: var(--ks-text-muted); font-size: 13.5px; margin: 0; }
.wz-subhead { font-size: 14px; color: var(--ks-text-dim); margin: 4px 0 0; }
.wz-actions { display: flex; gap: 10px; margin-top: 6px; }
.wz-actions--split { justify-content: space-between; }
.wz-ok { color: var(--ks-ok-text); font-size: 13.5px; margin: 0; }

/* Shown-storyboard checkpoint (wave W3) — mobile-first scene cards + live cost, CapCut-style clip list. */
.sb-progress { display: flex; align-items: center; gap: 12px; padding: 28px 4px; color: var(--ks-text-dim); font-size: 15px; }
.sb-spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--ks-border-strong);
    border-top-color: var(--ks-accent); animation: sb-spin 0.8s linear infinite; flex: none; }
@keyframes sb-spin { to { transform: rotate(360deg); } }

.sb-scenes { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; transition: opacity 150ms ease; }
.sb-scenes.is-locked { opacity: 0.55; pointer-events: none; }
.sb-scene { background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sb-scene-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sb-scene-no { font-weight: 700; font-size: 14px; color: var(--ks-text); }
.sb-scene-transition { font-size: 12.5px; color: var(--ks-text-muted); }
.sb-field { display: flex; flex-direction: column; gap: 6px; }
.sb-field-label { font-size: 12px; font-weight: 600; color: var(--ks-text-dim); }
.sb-field textarea { min-height: 52px; }
.sb-field--duration { max-width: 220px; }
.sb-duration { display: flex; align-items: center; gap: 8px; }
.sb-duration input[type=number] { width: 88px; }
.sb-duration-unit { font-size: 13px; color: var(--ks-text-muted); }

.sb-estimate { margin: 18px 0 8px; padding: 16px 18px; border-radius: var(--ks-radius-sm);
    background: rgba(124,92,255,0.08); border: 1px solid var(--ks-accent-ring); }
.sb-estimate-main { font-size: 18px; color: var(--ks-text); }
.sb-estimate-main strong { color: var(--ks-accent); }
.sb-estimate-sub { font-size: 12.5px; color: var(--ks-text-muted); margin-top: 4px; }

/* PB-3: the Playbook lessons applied to the shown storyboard. Wraps at 390; long titles/citations break, never overflow. */
.sb-playbook { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--ks-radius-sm); border: 1px solid var(--ks-border); }
.sb-playbook-title { margin: 0 0 8px; font-size: 14px; color: var(--ks-text); }
.sb-playbook-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sb-playbook-item { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.sb-playbook-cat { color: var(--ks-accent); font-weight: 600; }
.sb-playbook-name { color: var(--ks-text); }
.sb-playbook-cite { color: var(--ks-text-muted); }
.sb-playbook-link { color: var(--ks-accent); display: inline-block; padding: 10px 0; min-height: 44px; box-sizing: border-box; }

.sb-cta-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sb-draft-note { font-size: 12.5px; color: var(--ks-text-muted); max-width: 260px; }

@media (max-width: 560px) {
    .sb-field--duration { max-width: none; }
    .wz-actions--split { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
    .sb-cta-group { justify-content: stretch; }
    .sb-cta-group > * { flex: 1; }
}

/* Video-first shoot page (wave W3) — preview-first, CapCut-style clip tray + scene list. */
.vid-progress { margin: 8px 0 18px; }
.vid-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.vid-stages li { display: flex; align-items: center; gap: 12px; color: var(--ks-text-faint); font-size: 15px; }
.vid-stages li.is-done { color: var(--ks-text-dim); }
.vid-stages li.is-current { color: var(--ks-text); font-weight: 600; }
.vid-stage-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ks-border-strong); flex: none; }
.vid-stages li.is-done .vid-stage-dot { background: var(--ks-ok-text); border-color: var(--ks-ok-text); }
.vid-stages li.is-current .vid-stage-dot { border-color: var(--ks-accent); box-shadow: 0 0 0 3px var(--ks-accent-ring); }

.vid-clip-progress { margin: 14px 0 0; font-size: 15px; color: var(--ks-text-dim); font-variant-numeric: tabular-nums; }

/* Failed-build card (GitLab #53) — a card, not a toast; one primary action, mobile-first. */
.vid-failed { background: rgba(240, 80, 60, 0.10); border: 1px solid rgba(240, 80, 60, 0.35); border-radius: 11px;
    padding: 16px; margin: 8px 0 18px; display: flex; flex-direction: column; gap: 10px; }
.vid-failed-title { margin: 0; font-size: 18px; color: var(--ks-danger-text); }
.vid-failed-saved { margin: 0; color: var(--ks-text-dim); font-size: 14px; }
.vid-failed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
/* Owner rule: 44px touch targets — the paid primary action gets the same floor as the rest of the app. */
.vid-failed-actions button { min-height: 44px; }
.vid-failed-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--ks-accent); }

.vid-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.vid-frame { flex: none; width: 128px; aspect-ratio: 9 / 16; border-radius: var(--ks-radius-sm); overflow: hidden;
    border: 1px solid var(--ks-border); background: var(--ks-inset); cursor: pointer; padding: 0; scroll-snap-align: start; }
.vid-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-frame-ph { display: block; width: 100%; height: 100%;
    background: repeating-linear-gradient(45deg, var(--ks-inset), var(--ks-inset) 8px, var(--ks-surface) 8px, var(--ks-surface) 16px); }

.vid-stage { margin: 8px 0 18px; }
.vid-player-tap { display: block; width: 100%; padding: 0; border: none; background: #000; border-radius: var(--ks-radius); overflow: hidden; cursor: zoom-in; }
.vid-player { width: 100%; max-height: 70vh; display: block; background: #000; }
.vid-stage[style*="--shoot-aspect"] .vid-player-tap { width: auto; max-width: 100%; margin: 0 auto; }
.vid-stage[style*="--shoot-aspect"] .vid-player { width: auto; max-width: 100%; aspect-ratio: var(--shoot-aspect); margin: 0 auto; }
.vid-rendering { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 48px 16px;
    color: var(--ks-text-dim); font-size: 15px; background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); }
.vid-cta { display: flex; gap: 10px; margin-top: 14px; }

.vid-segments { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vid-segment { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 14px; background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); }
.vid-segment-label { font-weight: 600; font-size: 14px; }
/* .vid-segment-confirm / .vid-segment-cost retired (feature/media-delete-ux) — the regenerate confirm now
   renders via the shared ConfirmDialog. */

@media (max-width: 560px) {
    .vid-cta { flex-direction: column; }
    .vid-cta > * { width: 100%; }
    .vid-segment { flex-direction: column; align-items: stretch; }
}

.wz-drop { display: flex; align-items: center; justify-content: center; gap: 10px;
    border: 1.5px dashed var(--ks-border-strong); border-radius: var(--ks-radius-sm); padding: 22px;
    color: var(--ks-text-muted); cursor: pointer; transition: border-color 150ms ease, background 150ms ease; position: relative; }
.wz-drop:hover { border-color: var(--ks-accent); background: rgba(124,92,255,0.05); }
.wz-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.wz-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.wz-thumb { position: relative; margin: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--ks-border); background: var(--ks-inset); }
.wz-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wz-thumb--done { border-color: rgba(41,196,103,0.4); }
/* The whole ingested-reference tile is a button that opens the shared full-screen carousel. */
.wz-thumb-open { display: block; width: 100%; height: 100%; padding: 0; border: none; background: none; cursor: pointer; }
.wz-thumb-open:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.wz-thumb-open .ref-thumb { width: 100%; height: 100%; }
.wz-thumb-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,0,0,0.6); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 1; }
.wz-thumb-remove:hover { background: var(--ks-danger); }

/* --- Auto-upload per-file states (progress while in flight, retry on failure) --------------- */
.wz-thumb--uploading img { opacity: 0.55; }
.wz-thumb--failed { border-color: rgba(240,80,60,0.55); }
.wz-thumb--failed img { opacity: 0.45; }

/* Indeterminate progress: a base64 one-shot POST gives no byte-progress, so animate an honest
   "working" bar rather than fake a percentage. Falls still on reduced-motion. */
.wz-thumb-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
    background: rgba(0,0,0,0.35); overflow: hidden; }
.wz-thumb-bar { display: block; width: 40%; height: 100%; background: var(--ks-accent);
    animation: wz-indeterminate 1100ms ease-in-out infinite; }
@keyframes wz-indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
    .wz-thumb-bar { animation: none; width: 100%; opacity: 0.7; }
}

.wz-thumb-badge { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--ks-danger); color: #fff; font-size: 13px; font-weight: 700; line-height: 20px;
    text-align: center; }
.wz-thumb-fail-actions { position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px; }
.wz-retry-btn { background: var(--ks-accent); color: #fff; border: none; border-radius: var(--ks-radius-sm);
    padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; line-height: 1; }
.wz-retry-btn:hover { filter: brightness(1.08); }
.wz-thumb-fail-actions .wz-thumb-remove { position: static; width: auto; height: auto; padding: 3px 8px;
    border-radius: var(--ks-radius-sm); font-size: 12px; }

.wz-scopes { display: flex; flex-direction: column; gap: 9px; border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); padding: 14px 16px; }
.wz-scopes legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--ks-text-dim); }
.wz-scopes label { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ks-text-dim); }
.wz-scopes input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--ks-accent); }

.wz-summary { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.wz-summary li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--ks-border); }
.wz-summary li span { color: var(--ks-text-muted); }

/* --- Reference thumb (presigned image loader) ------------------------------ */
.ref-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--ks-inset); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb--empty { color: var(--ks-text-faint); }
.ref-thumb-fallback svg { width: 34px; height: 34px; opacity: 0.5; }
.ref-thumb-skeleton { width: 60%; height: 60%; border-radius: 8px;
    background: linear-gradient(100deg, var(--ks-surface-2) 30%, var(--ks-border) 50%, var(--ks-surface-2) 70%);
    background-size: 200% 100%; animation: ks-shimmer 1.3s infinite; }
@keyframes ks-shimmer { to { background-position: -200% 0; } }

/* --- Persona detail -------------------------------------------------------- */
.pd-identity { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.pd-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.pd-subject { color: var(--ks-text-muted); font-size: 13px; }
.pd-trigger { font-family: "Cascadia Code", monospace; font-size: 12px; color: var(--ks-signature-2);
    background: var(--ks-signature-glow); padding: 2px 9px; border-radius: 6px; overflow-wrap: anywhere; }
.pd-desc { color: var(--ks-text-dim); max-width: 70ch; margin: 0 0 24px; }
.pd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.pd-section { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); padding: 20px; }
.pd-section h2 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.pd-section--wide { grid-column: 1 / -1; }
.pd-count { font-size: 12px; color: var(--ks-text-faint); font-weight: 500; }
.pd-muted { color: var(--ks-text-muted); font-size: 13.5px; }

/* Spend-vs-cap meter + retention rollup (CP5) */
.pd-meter { margin-bottom: 16px; }
.pd-meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 13.5px; }
.pd-meter-track { height: 8px; border-radius: 999px; background: var(--ks-border); overflow: hidden; }
.pd-meter-fill { height: 100%; border-radius: 999px; background: var(--ks-info); transition: width 0.2s ease; }
.pd-meter-fill--over { background: var(--ks-danger); }
.pd-rollup { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.pd-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--ks-border); border-radius: var(--ks-radius); }
.pd-stat-value { font-size: 20px; font-weight: 600; }

.pd-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.pd-shot { margin: 0; }
/* The whole reference tile is a button that opens the shared full-screen carousel. */
.pd-shot-open { position: relative; display: block; width: 100%; padding: 0; border: none; background: none; cursor: pointer; border-radius: 10px; }
.pd-shot-open:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.pd-shot .ref-thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--ks-border); }
.pd-shot figcaption { font-size: 11px; color: var(--ks-text-faint); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A finished-render tile: the video keeps its native inline controls; the expand button (top-right, clear of
   the controls at the bottom) opens the shared full-screen carousel without hijacking play/scrub. */
.pd-shot-media { position: relative; }
.pd-shot-expand { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; display: inline-flex;
    align-items: center; justify-content: center; border: none; border-radius: 999px;
    background: rgba(4, 5, 8, 0.55); color: #fff; cursor: pointer; }
.pd-shot-expand:hover { background: rgba(4, 5, 8, 0.78); }
.pd-shot-expand:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.pd-shot-expand svg { width: 20px; height: 20px; }

/* Reference curation (Task A): per-tile Replace (CaptureUploadButtons, compact)/Remove + the add control
   below the gallery. */
.pd-ref-guidance { border-left: 3px solid var(--ks-accent); padding-left: 12px; margin-bottom: 12px; }
.pd-shot-actions { display: flex; align-items: stretch; gap: 6px; margin-top: 6px; }
/* Owner rule: 44px touch targets. The compact CaptureUploadButtons and Remove fill the tile width and are
   tall enough to tap reliably on a phone (the reported mis-tap opened the lightbox instead of removing). */
.pd-shot-actions .cap-buttons { flex: 1 1 0; }
.pd-shot-remove { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0;
    min-height: 44px; background: none; border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm);
    color: var(--ks-warn-text); font-size: 11px; padding: 3px 8px; cursor: pointer; }
.pd-shot-remove:hover:not(:disabled) { border-color: var(--ks-warn); }
.pd-shot-remove:disabled { opacity: 0.55; cursor: default; }

/* Multi-select delete (feature/media-delete-ux, owner report 2026-09-10: "multiple delete of photos/videos
   should be supported"). Toolbar above the gallery toggles select mode; a checkbox overlays each tile; a
   sticky bottom bar (mobile-first — reachable with the on-screen keyboard closed, no scroll needed) drives
   the batch remove. */
.pd-gallery-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.pd-gallery-select-count { font-size: 12.5px; color: var(--ks-text-muted); font-weight: 600; }
.pd-gallery-select-link { background: none; border: none; padding: 6px 0; min-height: 32px; color: var(--ks-accent);
    font-size: 13px; font-weight: 600; cursor: pointer; }
.pd-gallery-select-link:hover { text-decoration: underline; }
.pd-shot-open--select { cursor: pointer; }
.pd-shot.is-selected .pd-shot-open--select .ref-thumb { outline: 2px solid var(--ks-accent); outline-offset: -2px; }
.pd-shot-checkbox { position: absolute; top: 6px; right: 6px; z-index: 1; width: 24px; height: 24px;
    border-radius: 6px; border: 2px solid #fff; background: rgba(4, 5, 8, 0.55); }
.pd-shot-checkbox.is-checked { background: var(--ks-accent); border-color: var(--ks-accent); }
.pd-shot-checkbox.is-checked::after { content: "✓"; position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700; }
.pd-gallery-selectbar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px;
    background: var(--ks-surface); border: 1px solid var(--ks-border-strong); border-radius: var(--ks-radius);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.35); }
.pd-gallery-selectbar-count { font-size: 13px; color: var(--ks-text-muted); }
.pd-gallery-selectbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Blank 1×1 placeholder-frame marker + bulk relief (owner report 2026-09-10). */
.pd-shot-blank { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center;
    max-width: calc(100% - 12px); padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 600;
    letter-spacing: 0.02em; background: rgba(4, 5, 8, 0.72); color: #fff; pointer-events: none; }
.pd-shot-blank-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-blank-relief { margin: 4px 0 12px; }
.pd-blank-relief-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 10px 12px; border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm);
    background: var(--ks-inset); }
.pd-blank-relief-note { flex: 1 1 180px; font-size: 12px; color: var(--ks-text-muted); }
.pd-blank-relief-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--ks-warn);
    border-radius: var(--ks-radius-sm); background: none; color: var(--ks-warn-text); font-size: 13px;
    font-weight: 600; cursor: pointer; }
.pd-blank-relief-btn:hover:not(:disabled) { background: var(--ks-warn); color: #241a00; }
.pd-blank-relief-btn:disabled { opacity: 0.55; cursor: default; }
.pd-ref-add { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.pd-ref-add-label { min-height: 52px; }

.pd-consent--ok { border-left: 3px solid var(--ks-ok); padding-left: 13px; }
.pd-consent--missing { border-left: 3px solid var(--ks-warn); padding-left: 13px; color: var(--ks-warn-text); }
.pd-consent--missing p { margin: 0 0 8px; }

/* --- In-page consent form (Task 1) ---------------------------------------- */
.pd-consent-form { margin-top: 16px; display: flex; flex-direction: column; gap: 14px;
    border-top: 1px solid var(--ks-border); padding-top: 16px; }
.pd-consent-form p { margin: 0; }

/* --- "What's missing before training" checklist (Task 2) ------------------ */
.pd-checklist {
    background: var(--ks-surface); border: 1px solid var(--ks-border);
    border-left: 3px solid var(--ks-accent); border-radius: var(--ks-radius);
    padding: 16px 18px; margin-bottom: 18px;
}
.pd-checklist-title { font-size: 15px; margin: 0 0 4px; }
.pd-checklist-sub { color: var(--ks-text-muted); font-size: 13px; margin: 0 0 12px; }
.pd-checklist-items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.pd-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.pd-check-mark { flex: none; width: 20px; text-align: center; font-weight: 700; }
.pd-check.is-done { color: var(--ks-text-muted); }
.pd-check.is-done .pd-check-mark { color: var(--ks-ok-text); }
.pd-check.is-todo .pd-check-mark { color: var(--ks-warn-text); }
.pd-check a { color: var(--ks-accent); text-decoration: none; font-weight: 600; }
.pd-check a:hover { text-decoration: underline; }

/* --- Actionable consent banner + reference-add affordance ------------------ */
.pd-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pd-note-action {
    background: var(--ks-signature-2); color: #fff; border: none; border-radius: 999px;
    font-size: 13px; font-weight: 600; padding: 8px 16px; min-height: 40px; cursor: pointer; margin-left: auto;
}
.pd-note-action:hover { filter: brightness(1.05); }
.pd-ref-progress { font-size: 13px; margin: 0 0 4px; font-weight: 600; }
.pd-ref-progress.is-done, .pd-ref-progress.done { color: var(--ks-ok-text); }
.pd-ref-progress.is-todo, .pd-ref-progress.todo { color: var(--ks-warn-text); }
.pd-ref-add-cta { font-weight: 600; }
.pd-save-ok { margin-left: auto; }
.pd-scopes { list-style: none; padding: 0; margin: 8px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.pd-scopes li { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--ks-border); }
.pd-scopes li.yes { color: var(--ks-ok-text); border-color: rgba(41,196,103,0.35); }
.pd-scopes li.no { color: var(--ks-text-faint); text-decoration: line-through; }

.pd-timeline { list-style: none; padding: 0; margin: 0; }
.pd-tl-item { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.pd-tl-item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--ks-border); }
.pd-tl-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; flex: none; z-index: 1; box-shadow: 0 0 0 4px var(--ks-surface); }
.pd-tl-dot--success { background: var(--ks-ok); }
.pd-tl-dot--info { background: var(--ks-info); }
.pd-tl-dot--danger { background: var(--ks-danger); }
.pd-tl-dot--neutral { background: var(--ks-text-faint); }
.pd-tl-head { display: flex; align-items: center; gap: 10px; }
.pd-tl-meta { color: var(--ks-text-muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 5px; flex-wrap: wrap; }
.pd-tl-job { font-family: "Cascadia Code", monospace; }
.pd-tl-active {
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--ks-ok-text); background: rgba(41, 196, 103, 0.12);
    border: 1px solid rgba(41, 196, 103, 0.35); padding: 1px 8px; border-radius: 999px;
}

/* Canonical identity anchor badge (GitLab #58 S1) */
.pd-tl-anchor {
    margin-top: 4px; font-size: 12.5px; color: var(--ks-text-muted);
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.pd-tl-anchor-badge {
    font-size: 11.5px; font-weight: 600; color: var(--ks-text-muted);
    background: rgba(148, 163, 184, 0.14); border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 1px 8px; border-radius: 999px;
}

/* --- Training-preview review gate (persona-lifecycle-pv1) ------------------- */
.pd-tl-review {
    margin-top: 10px; padding: 12px 14px; border-radius: 11px;
    background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.4);
}
.pd-tl-review p { margin: 0 0 10px; }
.pd-tl-review-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Generated previews of the trained character (persona-preview-pv2) ------ */
/* A responsive thumbnail strip that never forces horizontal overflow on a phone (auto-fill, min 88px). */
.pd-preview-strip {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px; margin: 0 0 10px;
}
.pd-preview-thumb {
    display: block; padding: 0; border: 1px solid rgba(245,182,66,0.4); background: none;
    cursor: pointer; border-radius: 9px; overflow: hidden; aspect-ratio: 4 / 5;
}
.pd-preview-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-preview-thumb:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.pd-preview-likeness { font-weight: 600; }
.pd-preview-preparing { font-style: italic; }
.pd-tl-review-link { margin: 8px 0 0; font-size: 13px; }
.pd-tl-request-previews {
    margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ks-accent-2); background: transparent;
    border: 1px solid var(--ks-border-strong); border-radius: 8px; padding: 7px 10px; cursor: pointer;
    min-height: 40px; max-width: 100%;
}
.pd-tl-request-previews:hover:not(:disabled) { border-color: var(--ks-accent); color: var(--ks-text); }
.pd-tl-request-previews:disabled { opacity: 0.5; cursor: default; }

/* --- "Your character's look" strip (persona-previews-on-demand addendum 1) ---
   Accepted/rejected versions' own previews, surfaced outside the review block so they never vanish once a
   verdict lands. Mobile-safe grid (auto-fill, no forced horizontal overflow at 390px). */
.pd-look-strip { margin-bottom: 22px; }
.pd-look-title { font-size: 15px; margin: 0 0 10px; }
.pd-look-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
}
.pd-look-thumb {
    position: relative; display: block; padding: 0; border: 1px solid var(--ks-border-strong);
    background: var(--ks-surface-2); cursor: pointer; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 5;
}
.pd-look-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-look-thumb:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
/* A rejected version's previews are context, never the persona's current look — greyed and desaturated. */
.pd-look-thumb.is-rejected img { filter: grayscale(0.85); opacity: 0.55; }
.pd-look-rejected-badge {
    position: absolute; bottom: 6px; left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
    color: #fff; background: rgba(4, 5, 8, 0.7); padding: 2px 7px; border-radius: 999px;
}

/* --- "Review your trained character" block (persona-preview-pv3b) ----------- */
/* Top-of-page pending nudge with a jump to the review block. */
.pd-review-banner {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 13px 16px;
    border-radius: 12px; background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.45);
}
.pd-review-banner-icon {
    flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px;
    color: #1a1206; background: var(--ks-signature-2);
}
.pd-review-banner-body { flex: 1 1 auto; min-width: 0; }
.pd-review-banner-body strong { display: block; color: var(--ks-signature-2); }
.pd-review-banner-body p { margin: 2px 0 0; color: var(--ks-text-muted); font-size: 13px; }
.pd-review-banner-jump {
    flex: none; font-weight: 600; color: #1a1206; background: var(--ks-signature-2);
    padding: 8px 14px; border-radius: 9px; white-space: nowrap;
}
.pd-review-banner-jump:hover { text-decoration: none; filter: brightness(1.05); }

.pd-review {
    margin-bottom: 22px; padding: 18px 18px 20px; border-radius: 14px;
    background: linear-gradient(180deg, rgba(245,182,66,0.10), transparent), var(--ks-surface);
    border: 1px solid rgba(245,182,66,0.40);
}
.pd-review-title { margin: 0 0 4px; font-size: 18px; }
.pd-review-intro { margin: 0 0 14px; color: var(--ks-text-muted); font-size: 14px; }
.pd-review-preparing { margin: 0; font-style: italic; color: var(--ks-text-muted); }

/* Responsive gallery — 2-up on a phone, auto-fill wider. Never forces horizontal overflow. */
.pd-review-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin: 0 0 14px;
}
.pd-review-item { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-review-thumb {
    position: relative; display: block; padding: 0; border: 1px solid var(--ks-border-strong);
    background: var(--ks-surface-2); cursor: pointer; border-radius: 11px; overflow: hidden; aspect-ratio: 4 / 5;
}
.pd-review-item.is-hero .pd-review-thumb { border-color: var(--ks-signature); box-shadow: 0 0 0 2px var(--ks-signature-glow); }
.pd-review-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-review-thumb:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.pd-review-hero-badge {
    position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
    color: #1a1206; background: var(--ks-signature-2); padding: 2px 8px; border-radius: 999px;
}
.pd-review-score { font-size: 12.5px; color: var(--ks-text-muted); }
.pd-review-pick {
    font-size: 12.5px; font-weight: 600; color: var(--ks-accent-2); background: transparent;
    border: 1px solid var(--ks-border-strong); border-radius: 8px; padding: 7px 10px; cursor: pointer;
    min-height: 40px; text-align: center;
}
.pd-review-pick:hover:not(:disabled) { border-color: var(--ks-accent); color: var(--ks-text); }
.pd-review-pick:disabled { opacity: 0.5; cursor: default; }
.pd-review-picked { font-size: 12.5px; font-weight: 600; color: var(--ks-ok-text); }
.pd-review-likeness { margin: 0 0 2px; font-weight: 600; }
.pd-review-warning { margin: 6px 0 0; color: var(--ks-warn-text); font-size: 13.5px; }
.pd-review-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
/* .pd-review-reject retired (feature/media-delete-ux) — "not this one" / "try again" confirms now render
   via the shared ConfirmDialog (.ks-confirm), which supplies its own surface/border. */

/* --- "Also animate" tick + living-portrait clip (persona-preview-pv4) ------- */
.pd-animate-option {
    display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 4px;
    padding: 11px 13px; border-radius: 11px;
    background: var(--ks-surface-2); border: 1px solid var(--ks-border);
    cursor: pointer;
}
.pd-animate-option input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--ks-accent); }
.pd-animate-option-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.pd-animate-option-text .pd-muted { font-size: 12.5px; }

.pd-review-clip { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ks-border); }
.pd-review-clip-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.pd-review-clip-video {
    width: 100%; max-width: 360px; border-radius: 12px; background: #000;
    border: 1px solid var(--ks-border-strong); display: block;
}
.pd-review-clip-thumb {
    display: flex; align-items: center; justify-content: center;
    width: 100%; max-width: 360px; min-height: 132px; border-radius: 12px;
    background: var(--ks-surface-2); border: 1px dashed var(--ks-border-strong);
    color: var(--ks-text-muted); cursor: pointer;
}
.pd-review-clip-expand {
    margin-top: 8px; background: none; border: none; padding: 6px 0;
    color: var(--ks-accent); font-weight: 600; cursor: pointer; min-height: 44px;
}
.pd-review-clip-status { margin: 4px 0 8px; color: var(--ks-text-muted); font-size: 13.5px; }
.pd-review-clip-sample { margin: 6px 0 0; color: var(--ks-warn-text); font-size: 12.5px; font-weight: 600; }

/* Mobile-first: the primary review actions dock to a sticky, safe-area-aware bottom bar so Approve is always
   in thumb reach on a phone; the block reserves bottom padding so content isn't hidden behind it. */
@media (max-width: 640px) {
    .pd-review { padding-bottom: 88px; }
    .pd-review-gallery { grid-template-columns: repeat(2, 1fr); }
    .pd-review-actions--sticky {
        position: sticky; bottom: 0; z-index: 30; margin: 16px -18px -20px; padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--ks-surface); border-top: 1px solid var(--ks-border-strong);
    }
    .pd-review-actions--sticky .krome-btn:first-child { flex: 1 1 100%; }
}

/* --- Dashboard "ready to review" nudge (persona-preview-pv3b) --------------- */
.dash-review-nudge {
    display: flex; align-items: center; gap: 11px; margin-bottom: 12px; padding: 11px 14px;
    border-radius: 11px; background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.40);
}
.dash-review-nudge:hover { text-decoration: none; border-color: rgba(245,182,66,0.65); }
.dash-review-nudge-icon {
    flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px;
    color: #1a1206; background: var(--ks-signature-2);
}
.dash-review-nudge-body { display: flex; flex-direction: column; }
.dash-review-nudge-body strong { color: var(--ks-signature-2); font-size: 13.5px; }
.dash-review-nudge-body span { color: var(--ks-text-muted); font-size: 12.5px; }

/* .pd-confirm retired (feature/media-delete-ux) — every destructive confirm now renders via the shared
   ConfirmDialog (.ks-confirm), a real modal instead of this in-flow amber panel (owner report 2026-09-10:
   the in-flow panel could land above the fold, out of the phone viewport). .pd-confirm-actions survives —
   still used as a plain button-row style outside a confirm (the deleted-persona "Restore" row). */
.pd-confirm-actions { display: flex; gap: 10px; }

/* --- Live training status (PROJECT.md §5.2) -------------------------------- */
.pd-training-status {
    background: var(--ks-surface); border: 1px solid var(--ks-border);
    border-left: 3px solid var(--ks-signature-2); padding: 12px 16px; border-radius: 11px; margin-bottom: 18px;
}
.pd-ts-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-ts-elapsed { color: var(--ks-text-muted); font-size: 13px; }
.pd-ts-spinner {
    width: 13px; height: 13px; border-radius: 50%; flex: none;
    border: 2px solid rgba(245,182,66,0.35); border-top-color: var(--ks-signature-2);
    animation: pd-ts-spin 0.85s linear infinite;
}
@keyframes pd-ts-spin { to { transform: rotate(360deg); } }
.pd-ts-overdue { margin: 9px 0 0; color: var(--ks-warn-text); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .pd-ts-spinner { animation: none; } }

/* --- Video-to-reference ingest (Task D) — mobile-first capture flow -------- */
/* The "Add from video" CTA is visually distinct from the photo add (accent-tinted, camera glyph) so the
   two ingest paths read as siblings, not one control. 52px min touch target (>=44pt) for phone taps. */
.pd-ref-video { margin-top: 12px; }
.pd-video-cta { min-height: 52px; gap: 8px; border-style: dashed; border-color: var(--ks-accent);
    color: var(--ks-text); background: rgba(124,92,255,0.06); font-weight: 600; }
.pd-video-cta:hover { background: rgba(124,92,255,0.12); }
.pd-video-cta:has(input:disabled) { opacity: 0.55; cursor: default; }
.pd-video-cta-icon { display: inline-flex; color: var(--ks-accent); }
/* Live extraction status: mirrors the training-status card, info-toned; flips to ok/danger on completion. */
.pd-video-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-left: 3px solid var(--ks-info);
    padding: 11px 14px; border-radius: 11px; margin: 12px 0; font-size: 13.5px; }
.pd-video-status--done { border-left-color: var(--ks-ok); color: var(--ks-ok-text); }
.pd-video-status--error { border-left-color: var(--ks-danger); color: var(--ks-danger-text); }
/* "Try again" on a failed ingest (persona-video-ingest-live-fix): a compact inline file-picker that re-runs the
   capture. Mobile-first tap target (>=44px), the native file input visually hidden but still operable. */
.pd-video-retry { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; margin-left: auto;
    border: 1px solid var(--ks-danger); border-radius: 9px; color: var(--ks-danger-text); font-weight: 600;
    cursor: pointer; white-space: nowrap; }
.pd-video-retry:hover { background: rgba(220,53,69,0.10); }
.pd-video-retry input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pd-video-retry:has(input:disabled) { opacity: 0.55; cursor: default; }

/* --- Pre-train reference-consistency gate (Task C) ------------------------- */
/* One banner near the Start-training path, toned by verdict. Icon + wording carry the meaning (never colour
   alone). Mirrors the training/video status card idiom (left-border accent) so the page reads as one system. */
.pd-gate { display: flex; align-items: flex-start; gap: 10px; background: var(--ks-surface);
    border: 1px solid var(--ks-border); border-left: 3px solid var(--ks-border-strong);
    padding: 12px 15px; border-radius: 11px; margin-bottom: 18px; }
.pd-gate-icon { display: inline-flex; flex: 0 0 auto; margin-top: 1px; }
.pd-gate-body { min-width: 0; }
.pd-gate-body strong { display: block; font-weight: 600; }
.pd-gate-body p { margin: 3px 0 0; font-size: 13.5px; color: var(--ks-text-dim); }
.pd-gate--block { border-left-color: var(--ks-danger); background: rgba(240,80,60,0.07); }
.pd-gate--block .pd-gate-icon, .pd-gate--block .pd-gate-body strong { color: var(--ks-danger-text); }
.pd-gate--warn { border-left-color: var(--ks-warn); background: var(--ks-signature-glow); }
.pd-gate--warn .pd-gate-icon, .pd-gate--warn .pd-gate-body strong { color: var(--ks-signature-2); }
.pd-gate--ok { border-left-color: var(--ks-ok); }
.pd-gate--ok .pd-gate-icon, .pd-gate--ok .pd-gate-body strong { color: var(--ks-ok-text); }
.pd-gate--checking { align-items: center; }
.pd-gate--muted { border-left-color: var(--ks-border-strong); }
.pd-gate--muted .pd-gate-body p { color: var(--ks-text-muted); }
.pd-gate-action {
    margin-top: 10px; background: var(--ks-signature-2); color: #fff; border: none; border-radius: 999px;
    font-size: 13px; font-weight: 600; padding: 8px 16px; min-height: 44px; cursor: pointer;
}
.pd-gate-action:hover { filter: brightness(1.05); }

/* Per-photo flag badge, overlaid on the reference tile. Icon + word so it is legible without colour. */
.pd-shot { position: relative; }
.pd-shot-flag { position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 4px;
    max-width: calc(100% - 12px); padding: 3px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
    line-height: 1; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.45); pointer-events: none; }
.pd-shot-flag-icon { display: inline-flex; flex: 0 0 auto; }
.pd-shot-flag-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-shot-flag--block { background: var(--ks-danger); }
.pd-shot-flag--warn { background: var(--ks-warn); color: #241a00; }

/* --- Settings -------------------------------------------------------------- */
.st-group { margin-bottom: 26px; }
.st-category { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ks-signature-2); margin-bottom: 10px; }
.st-table { border: 1px solid var(--ks-border); border-radius: var(--ks-radius); overflow: hidden; }
.st-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--ks-border); background: var(--ks-surface); }
.st-row:last-child { border-bottom: none; }
.st-row--inactive { opacity: 0.55; }
.st-key code { color: var(--ks-text); font-size: 13px; }
.st-desc { display: block; color: var(--ks-text-muted); font-size: 12.5px; margin-top: 3px; }
.st-inactive-tag { display: inline-block; margin-top: 4px; font-size: 10.5px; text-transform: uppercase; color: var(--ks-warn-text); }
.st-value { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-current { font-family: "Cascadia Code", monospace; font-size: 13px; color: var(--ks-text-dim);
    word-break: break-word; overflow-wrap: anywhere; }
.st-edit-btn { background: transparent; border: 1px solid var(--ks-border-strong); color: var(--ks-text-muted);
    padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: all 150ms ease; flex: none; }
.st-edit-btn:hover { color: var(--ks-text); border-color: var(--ks-accent); }
.st-edit { display: flex; align-items: center; gap: 8px; width: 100%; }
.st-save-error { color: var(--ks-danger-text); font-size: 12px; margin-top: 6px; }

/* Audience sections on the hub: "Your settings" (plain) vs gated "Operator settings" (mechanics review #3). */
.st-section { margin-bottom: 34px; }
.st-section-title { font-size: 15px; font-weight: 600; color: var(--ks-text); margin: 0 0 4px;
    padding-bottom: 8px; border-bottom: 1px solid var(--ks-border); }
.st-section-sub { color: var(--ks-text-muted); font-size: 13px; line-height: 1.5; margin: 8px 0 16px; max-width: 70ch; }
.st-table + .sh-grid { margin-top: 16px; }
/* Plain, non-technical label for a User-audience setting (no raw key / monospace). */
.ys-name { display: block; font-size: 14px; font-weight: 600; color: var(--ks-text); }

/* Mobile-first: the two-column key/value row stacks to one column on narrow screens (375px judgment). */
@media (max-width: 560px) {
    .st-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .st-value { justify-content: flex-start; }

    /* Mobile /personas overflow fix (smoke rider, deploy 0a11694): the import control is a fixed ~280px
       block that did not collapse under 900px and pushed its <input> off-screen (35px overflow at 390px).
       Stack the header and let the import control + its native file input shrink to the viewport. */
    .pg-header { flex-direction: column; align-items: stretch; }
    .pg-header-actions { width: 100%; }
    .pg-import { flex: 1 1 100%; min-width: 0; }
    .pg-import input[type="file"] { max-width: 100%; min-width: 0; flex: 1 1 auto; }
}

/* --- Settings hub (hub-and-spoke, KCP-derived) ----------------------------- */
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.sh-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    text-decoration: none; color: inherit;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease; }
.sh-card:hover { transform: translateY(-3px); border-color: var(--ks-border-strong); text-decoration: none;
    box-shadow: 0 14px 34px rgba(0,0,0,0.42); }
.sh-card--accent { border-color: var(--ks-accent); box-shadow: 0 0 0 1px var(--ks-accent-ring) inset; }
.sh-card-title { font-size: 16px; font-weight: 600; color: var(--ks-text); }
.sh-card-blurb { color: var(--ks-text-muted); font-size: 13px; line-height: 1.5; flex: 1; }
.sh-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sh-card-open { color: var(--ks-signature-2); font-size: 13px; font-weight: 600; }

/* --- Provider connections (spoke; cn- prefix avoids the .pc- persona-card set) --- */
.cn-head-actions { display: flex; gap: 10px; align-items: center; }
/* GitLab #101: settings-spoke header actions (Operators "Add operator", ProviderConnections
   "Refresh"/"New connection") rendered at krome-btn-sm's compact ~25px height at EVERY width —
   below the owner's 44px tap-target minimum. Scoped to .cn-head-actions so other krome-btn-sm
   consumers (e.g. table row actions) keep their compact size; the Small visual weight (padding,
   font-size) is otherwise unchanged, so desktop layout doesn't visually balloon. */
.cn-head-actions .krome-btn { min-height: 44px; min-width: 44px; }
.cn-panel { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    padding: 20px 22px; margin-bottom: 22px; }
.cn-panel--accent { border-color: var(--ks-accent); box-shadow: 0 0 0 1px var(--ks-accent-ring) inset; }
.cn-panel-title { font-size: 15px; margin: 0 0 14px; color: var(--ks-text); }
.cn-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cn-status { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 12px; background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); }
.cn-status-name { font-size: 13px; color: var(--ks-text-dim); }
.cn-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cn-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cn-field { display: flex; flex-direction: column; gap: 6px; }
.cn-field--wide { grid-column: 1 / -1; }
.cn-field-label { font-size: 13px; font-weight: 600; color: var(--ks-text-dim); }
.cn-hint { color: var(--ks-text-faint); font-size: 12px; }
.cn-input--readonly { opacity: 0.7; cursor: not-allowed; }
.cn-model-custom { margin-top: 8px; }
/* Non-technical key/value config editor (wave conn-ux Scope D) — replaces the raw-JSON textarea. */
.cn-kv { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cn-kv-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ks-text-faint); font-weight: 600; }
.cn-kv-head > span:last-child { min-width: 72px; }
.cn-kv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.cn-kv-key, .cn-kv-val { width: 100%; }
.cn-kv-remove { white-space: nowrap; }
.cn-kv-actions { margin-top: 10px; }
.cn-subhead { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ks-signature-2); margin: 4px 0 10px; }
.cn-webhook { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.cn-webhook-value { font-family: "Cascadia Code", monospace; font-size: 12.5px; color: var(--ks-text-dim);
    background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); padding: 8px 10px; word-break: break-all; }
.cn-toggles { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.cn-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ks-text-dim); }
.cn-check input { width: auto; }
.cn-form-actions { display: flex; gap: 10px; }
.cn-table { width: 100%; border-collapse: collapse; border: 1px solid var(--ks-border); border-radius: var(--ks-radius); overflow: hidden; }
.cn-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ks-text-faint); font-weight: 600; padding: 11px 14px; background: var(--ks-surface-2); border-bottom: 1px solid var(--ks-border); }
.cn-table td { padding: 12px 14px; border-bottom: 1px solid var(--ks-border); font-size: 13.5px; vertical-align: middle; }
.cn-table tr:last-child td { border-bottom: none; }
.cn-cell-strong { font-weight: 600; color: var(--ks-text); display: flex; align-items: center; gap: 8px; }
.cn-meta { color: var(--ks-text-muted); font-size: 12.5px; }
.cn-no-test { font-style: italic; }
.cn-test { font-size: 12.5px; }
.cn-test--ok { color: var(--ks-ok-text); }
.cn-test--warn { color: var(--ks-warn-text); }
.cn-test--err { color: var(--ks-danger-text); }
.cn-discover { font-size: 12.5px; margin-top: 6px; max-width: 340px; }
.cn-discover--warn { color: var(--ks-warn-text); }
.cn-row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cn-btn { background: transparent; border: 1px solid var(--ks-border-strong); color: var(--ks-text-muted);
    padding: 5px 10px; border-radius: var(--ks-radius-sm); font: inherit; font-size: 12.5px; cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease; }
.cn-btn:hover:not(:disabled) { color: var(--ks-text); border-color: var(--ks-accent); }
.cn-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cn-btn--danger { color: var(--ks-danger-text); border-color: rgba(240,80,60,0.35); }
.cn-btn--danger:hover:not(:disabled) { color: var(--ks-danger-text); border-color: var(--ks-danger); }

/* Mobile: the 7-column table (724px min-content at 390 — mobile-overflow-connections) restacks into one
   labelled card per connection instead of scrolling horizontally. Membership mirrors the <thead> text via
   each <td>'s data-label; the browser draws it as a ::before line above the cell's own content. */
@media (max-width: 560px) {
    .cn-table, .cn-table tbody, .cn-table tr, .cn-table td { display: block; width: 100%; }
    .cn-table thead { display: none; }
    .cn-table tr { padding: 12px 14px; }
    .cn-table td { padding: 6px 0; border-bottom: none; }
    .cn-table td::before {
        content: attr(data-label); display: block; margin-bottom: 3px;
        font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
        color: var(--ks-text-faint); font-weight: 600;
    }
}

/* --- Sign in --------------------------------------------------------------- */
.ks-signin-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.lg-card { width: 100%; max-width: 380px; background: var(--ks-surface); border: 1px solid var(--ks-border);
    border-radius: 18px; padding: 30px; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.lg-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.lg-mark { width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: radial-gradient(circle at 50% 50%, var(--ks-bg) 26%, transparent 27%),
                conic-gradient(from 210deg, var(--ks-signature), var(--ks-accent), var(--ks-signature));
    box-shadow: 0 0 22px var(--ks-signature-glow); }
.lg-title { font-size: 19px; }
.lg-tagline { color: var(--ks-text-muted); font-size: 12.5px; margin: 2px 0 0; }
.lg-form { display: flex; flex-direction: column; gap: 15px; }
.lg-field { display: flex; flex-direction: column; gap: 6px; }
.lg-field > span { font-size: 12.5px; font-weight: 600; color: var(--ks-text-dim); }
.lg-submit { background: var(--ks-accent); color: #fff; border: none; border-radius: var(--ks-radius-sm);
    padding: 11px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; margin-top: 4px;
    transition: background 150ms ease, box-shadow 150ms ease; }
.lg-submit:hover { background: var(--ks-accent-2); box-shadow: 0 0 0 3px var(--ks-accent-ring); }
.lg-error { background: rgba(240,80,60,0.10); border: 1px solid rgba(240,80,60,0.35); color: var(--ks-danger-text);
    padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 15px; white-space: pre-line; }
.lg-notice { background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.4); color: var(--ks-signature-2);
    padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 15px; }
/* 44px tap targets on the sign-in surfaces (mobile-first). */
.lg-field input { min-height: 44px; }
.lg-submit { min-height: 44px; }
.lg-submit--link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.lg-hint { color: var(--ks-text-muted); font-size: 12.5px; margin: 0; }
.lg-field input[readonly] { opacity: 0.75; }
.lg-change { display: block; text-align: center; line-height: 44px; text-decoration: none; }

.ks-notfound { padding: 40px 0; }

/* --- Blazor error UI ------------------------------------------------------- */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #2a1416; color: var(--ks-danger-text); padding: 12px 20px; border-top: 1px solid var(--ks-danger);
    box-shadow: 0 -6px 20px rgba(0,0,0,0.4); }
#blazor-error-ui .reload { color: var(--ks-signature-2); margin-left: 10px; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* --- Responsive ------------------------------------------------------------ */
/* --- Nav section labels ---------------------------------------------------- */
.ks-nav-section {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
    color: var(--ks-text-faint); padding: 14px 12px 5px;
}

/* --- Dashboard ------------------------------------------------------------- */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.dash-stat {
    display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; text-decoration: none; color: inherit;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.dash-stat:hover { transform: translateY(-2px); border-color: var(--ks-border-strong); text-decoration: none; box-shadow: 0 12px 28px rgba(0,0,0,0.36); }
.dash-stat-num { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dash-stat-label { font-size: 13px; color: var(--ks-text-dim); font-weight: 600; }
.dash-stat-sub { font-size: 12px; color: var(--ks-signature-2); }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.dash-panel { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); padding: 20px; }
.dash-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.dash-panel-head h2 { font-size: 15px; }
.dash-link { font-size: 12.5px; color: var(--ks-text-muted); }
.dash-hint { color: var(--ks-text-muted); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 8px 0; }
.dash-hint-sub { font-size: 13px; }
.dash-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.dash-list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 13px; border-radius: var(--ks-radius-sm); text-decoration: none; color: inherit;
    background: var(--ks-inset); border: 1px solid var(--ks-border); transition: border-color 150ms ease;
}
.dash-list-item:hover { border-color: var(--ks-border-strong); text-decoration: none; }
.dash-list-name { flex: 1; min-width: 0; font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Library search (phone-first filter over a 50+ row catalogue) ---------- */
.lib-search { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.lib-search-input {
    flex: 1; min-width: 0; padding: 11px 14px; font-size: 15px;
    background: var(--ks-surface); color: var(--ks-text);
    border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
}
.lib-search-input:focus { outline: none; border-color: var(--ks-border-strong); }
.lib-search-count { flex: none; color: var(--ks-text-faint); font-size: 12.5px; white-space: nowrap; }

/* --- Wizard picker search + paging (concepts-2000-merge): the shoot wizard's location/concept pickers page
   and search like the library landings so they never render the whole catalogue as option cards. --------- */
.wz-picker-search { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.wz-search {
    flex: 1; min-width: 0; padding: 11px 14px; font-size: 15px;
    background: var(--ks-surface); color: var(--ks-text);
    border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
}
.wz-search:focus { outline: none; border-color: var(--ks-border-strong); }
.wz-picker-count { flex: none; color: var(--ks-text-faint); font-size: 12.5px; white-space: nowrap; }
.wz-more { display: flex; justify-content: center; margin: 14px 0 4px; }

/* --- Library cards (locations + concepts) ---------------------------------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.lib-card {
    display: flex; flex-direction: column; gap: 11px; position: relative; overflow: hidden;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); padding: 18px 19px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.lib-card:hover { border-color: var(--ks-border-strong); box-shadow: 0 12px 30px rgba(0,0,0,0.34); }

/* Card taxonomy chips + row actions (feature: library-categories-tags) */
.lib-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lib-meta-cat {
    font-size: 11.5px; font-weight: 600; color: var(--ks-text); padding: 3px 9px;
    background: var(--ks-surface-2); border: 1px solid var(--ks-border); border-radius: 999px;
}
.lib-meta-tag { font-size: 11.5px; color: var(--ks-text-faint); }
.lib-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-actions > * { flex: 0 0 auto; }

/* Landing skeleton — placeholder cards shown while the first page loads on a cold interactive visit with
   no persisted prerender state. A shimmer reads as "content is coming", not "broken", and unlike the old
   "Loading concepts…"/"Loading locations…" text it holds the grid's shape so there is no layout jump when
   the real cards land (mobile-first-responsiveness, 2026-09-10). */
.lib-grid--skeleton { pointer-events: none; }
.lib-skeleton-card {
    height: 220px; border-radius: var(--ks-radius);
    border: 1px solid var(--ks-border); background: var(--ks-surface);
    position: relative; overflow: hidden;
}
.lib-skeleton-card::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    transform: translateX(-100%); animation: ks-skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes ks-skeleton-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .lib-skeleton-card::after { animation: none; } }

/* Shared destructive-action confirm dialog (feature: library-categories-tags; consolidated onto ONE
   component by feature/media-delete-ux — every inline .pd-confirm / hand-rolled backdrop now renders this
   markup). position: fixed + inset: 0 means the dialog is centred in the VIEWPORT, not the document, so it
   can never land out of view below a scroll position (the owner's "toast at the top, out of viewport"
   report) — mobile-first (full-width with a comfortable max) and centred both axes. */
.ks-confirm-backdrop {
    position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(0,0,0,0.58); backdrop-filter: blur(2px);
}
.ks-confirm {
    width: 100%; max-width: 420px; max-height: calc(100dvh - 40px); overflow-y: auto;
    background: var(--ks-surface); border: 1px solid var(--ks-border-strong);
    border-radius: var(--ks-radius); padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; gap: 12px;
}
.ks-confirm-title { margin: 0; font-size: 18px; font-weight: 650; color: var(--ks-text); }
.ks-confirm-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ks-text-muted); }
.ks-confirm-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ks-confirm-actions .krome-btn { flex: 1 1 auto; }

/* Body-scroll lock while a ConfirmDialog is open (js/confirm-dialog.js toggles this on <body>) — keeps the
   page from scrolling behind the fixed dialog, e.g. with an on-screen keyboard open on a short viewport. */
body.ks-confirm-scroll-lock { overflow: hidden; }

/* Manage categories & tags surface (feature: library-categories-tags) — two panels, mobile-first
   (stacked at phone width, side-by-side on wider screens). */
.mng-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 760px) { .mng-cols { grid-template-columns: 1fr 1fr; } }
.mng-panel {
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.mng-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mng-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); background: var(--ks-surface-2);
}
.mng-row[data-depth="1"] { margin-left: 14px; }
.mng-row[data-depth="2"] { margin-left: 28px; }
.mng-name { font-size: 14px; font-weight: 550; color: var(--ks-text); min-width: 0; overflow-wrap: anywhere; }
.mng-row-actions, .mng-edit-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.mng-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.mng-edit input, .mng-edit select, .mng-add input, .mng-add select {
    padding: 8px 11px; font-size: 14px; background: var(--ks-surface); color: var(--ks-text);
    border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); min-width: 0; flex: 1;
}
.mng-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.mng-shared-note { margin: 0; font-size: 12px; }
.lib-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lib-card-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card-desc { color: var(--ks-text-muted); font-size: 13px; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-fragment { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.lib-fragment-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ks-text-faint); font-weight: 600; }
.lib-fragment code { display: block; color: var(--ks-signature-2); background: var(--ks-signature-glow);
    padding: 8px 11px; border-radius: 8px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.concept-tokens { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 0; }
.concept-tokens > div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: baseline; }
.concept-tokens dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ks-text-faint); font-weight: 600; margin: 0; }
.concept-tokens dd { margin: 0; color: var(--ks-text-dim); font-size: 12.5px; line-height: 1.45; }

.concept-card--signature { border-color: rgba(245,182,66,0.42); box-shadow: 0 0 0 1px rgba(245,182,66,0.16), 0 10px 34px var(--ks-signature-glow); }
.concept-card--signature::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--ks-signature), var(--ks-accent), var(--ks-signature)); }
.concept-signature { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
    font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ks-signature-2); }
.concept-signature-mark { width: 13px; height: 13px; border-radius: 50%;
    background: conic-gradient(from 200deg, var(--ks-signature), var(--ks-accent), var(--ks-signature));
    box-shadow: 0 0 12px var(--ks-signature-glow); }

.wz-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.wz-panel--wide { max-width: 920px; }
.wz-subhead--muted { color: var(--ks-text-muted); margin-top: 22px; }

/* --- Shoot cards ----------------------------------------------------------- */
.shoot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.shoot-card {
    display: flex; flex-direction: column; gap: 11px; padding: 17px 18px; text-decoration: none; color: inherit;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.shoot-card:hover { transform: translateY(-3px); border-color: var(--ks-border-strong); text-decoration: none; box-shadow: 0 14px 32px rgba(0,0,0,0.4); }
.shoot-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shoot-card-name { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shoot-card-meta { display: flex; flex-direction: column; gap: 5px; }
.shoot-card-persona { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ks-text-dim); }
.shoot-card-persona svg { width: 15px; height: 15px; flex: none; color: var(--ks-text-muted); }
.shoot-card-concept { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ks-text-muted); }

/* library-previews-thumbnails: ShootDetail's "Location · Concept" strip. */
.pd-library-strip { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 14px; }
.pd-library-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ks-text-dim); }
.shoot-card-foot { margin-top: 2px; }
.shoot-card-count { font-size: 11.5px; color: var(--ks-text-faint); font-variant-numeric: tabular-nums; }

/* --- Wizard option cards --------------------------------------------------- */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.opt-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
    padding: 15px 16px; background: var(--ks-inset); border: 1px solid var(--ks-border-strong);
    border-radius: var(--ks-radius-sm); cursor: pointer; color: var(--ks-text); font: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.opt-card:hover { border-color: var(--ks-accent); background: rgba(124,92,255,0.05); }
.opt-card.is-selected { border-color: var(--ks-accent); box-shadow: 0 0 0 3px var(--ks-accent-ring); background: rgba(124,92,255,0.08); }
.opt-card--signature { border-color: rgba(245,182,66,0.4); }
.opt-card--signature.is-selected { box-shadow: 0 0 0 3px var(--ks-signature-glow); }
.opt-card--disabled { cursor: not-allowed; opacity: 0.6; }
.opt-card--disabled:hover { border-color: var(--ks-border-strong); background: var(--ks-inset); }
.opt-card-id { display: flex; align-items: center; gap: 10px; }
.wz-review-persona { display: inline-flex; align-items: center; gap: 8px; }
.opt-card-name { font-weight: 600; font-size: 14.5px; }
.opt-card-reason { font-size: 12px; color: var(--ks-text-muted); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Shoot workspace ------------------------------------------------------- */
.ws-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ks-info-text); }
.ws-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ks-info); box-shadow: 0 0 0 0 rgba(75,139,245,0.5); animation: ks-pulse 1.6s infinite; }
@keyframes ks-pulse { 0% { box-shadow: 0 0 0 0 rgba(75,139,245,0.5); } 70% { box-shadow: 0 0 0 7px rgba(75,139,245,0); } 100% { box-shadow: 0 0 0 0 rgba(75,139,245,0); } }

.ws-summary { display: flex; align-items: center; gap: 13px; padding: 14px 18px; margin-bottom: 20px;
    background: rgba(41,196,103,0.10); border: 1px solid rgba(41,196,103,0.34); border-radius: var(--ks-radius); color: var(--ks-ok-text); }
.ws-summary svg { width: 22px; height: 22px; flex: none; color: var(--ks-ok); }
.ws-summary strong { color: var(--ks-text); }

.ws-pipeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ws-pipe-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); }
.ws-pipe-no { font-weight: 600; font-size: 13.5px; min-width: 68px; }
.ws-pipe-regen { font-size: 12px; color: var(--ks-signature-2); }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.asset-tile { margin: 0; display: flex; flex-direction: column; overflow: hidden;
    background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius); }
.asset-tile--below { border-color: rgba(245,165,36,0.34); }
.asset-frame { position: relative; aspect-ratio: var(--shoot-aspect, 4 / 5); display: flex; align-items: center; justify-content: center;
    background: radial-gradient(120% 120% at 30% 20%, #2a2550, #14151c); color: var(--ks-text-faint); }
.asset-tile--below .asset-frame { background: radial-gradient(120% 120% at 30% 20%, #4a3a1c, #1c1712); }
.asset-frame-icon { width: 40px; height: 40px; opacity: 0.55; }
/* The still is a button that opens the shoot's stills in the shared full-screen carousel. */
.asset-still-open { position: absolute; inset: 0; padding: 0; border: none; background: none; cursor: pointer; }
.asset-still-open:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: -2px; }
.asset-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-frame-note { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: rgba(255,255,255,0.82); background: rgba(0,0,0,0.34); padding: 3px 10px;
    border-radius: 999px; backdrop-filter: blur(3px); white-space: nowrap; }
.asset-shot-no { position: absolute; top: 10px; left: 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
    color: rgba(255,255,255,0.9); background: rgba(0,0,0,0.32); padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(3px); }
.asset-attempt { position: absolute; top: 10px; right: 12px; font-size: 11px; color: rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.32); padding: 3px 9px; border-radius: 999px; }
.asset-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 9px; }
.asset-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.asset-note { font-size: 12px; color: var(--ks-warn-text); margin: 0; line-height: 1.4; }
.asset-note--danger { color: var(--ks-danger-text); }
.asset-actions { display: flex; gap: 8px; margin-top: 2px; }

/* --- Manual retry (feature/compose-retry-policy): regenerate a settled shot --- */
.asset-retry { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.asset-retry-icon { width: 15px; height: 15px; flex-shrink: 0; }
.asset-retry-note { font-size: 12px; color: var(--ks-text-muted); line-height: 1.4; }

/* --- Motion: animate an accepted asset (video-editor.md §6) ------------------ */
.asset-clip { margin-top: 2px; border-top: 1px solid var(--ks-border); padding-top: 10px; }
.asset-clip-open { margin-top: 6px; font-size: 12px; color: var(--ks-text-dim); background: none; border: 1px solid var(--ks-border); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.asset-clip-open:hover { color: var(--ks-text); border-color: var(--ks-border-strong); }
.asset-video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--ks-radius-sm);
    background: var(--ks-inset); border: 1px solid var(--ks-border); display: block; }
.asset-clip-status { display: flex; align-items: center; gap: 8px; margin-top: 2px; border-top: 1px solid var(--ks-border); padding-top: 10px; }
/* Honest placeholder for a stand-in (fake) clip with no playable object — never a broken <video>. */
.asset-placeholder { display: flex; flex-direction: column; gap: 4px; padding: 14px;
    background: var(--ks-inset); border: 1px dashed var(--ks-border-strong); border-radius: var(--ks-radius-sm);
    aspect-ratio: 16 / 9; align-items: center; justify-content: center; text-align: center; }
.asset-placeholder strong { color: var(--ks-text); font-size: 13px; }
.asset-placeholder span { color: var(--ks-text-muted); font-size: 12px; line-height: 1.4; max-width: 34ch; }
.asset-animate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px;
    border-top: 1px solid var(--ks-border); padding-top: 10px; }
.asset-animate-label { font-size: 12px; color: var(--ks-text-muted); font-weight: 550; }
.asset-animate-select { flex: 1 1 auto; min-width: 120px; min-height: 40px; padding: 8px 10px;
    background: var(--ks-inset); color: var(--ks-text); border: 1px solid var(--ks-border-strong);
    border-radius: var(--ks-radius-sm); font-size: 13px; }
.asset-animate-select:focus-visible { outline: 2px solid var(--ks-accent-ring); outline-offset: 1px; }
.asset-animate-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
    /* Mobile-primary app shell (app-mechanics review #9/#13): the desktop sidebar would render inline above
       the page and push content ~2 screens down. Instead the shell is a single column with a compact sticky
       top bar, and the sidebar becomes an off-canvas sheet the hamburger slides in over a scrim — so content
       is above the fold on every route and nav is one tap away (CapCut pattern). */
    .ks-shell { display: block; min-width: 0; }

    .ks-topbar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 0; z-index: 40;
        padding: 10px 14px; min-height: 56px;
        background: var(--ks-surface); border-bottom: 1px solid var(--ks-border);
    }
    .ks-hamburger {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; flex: none;         /* ≥44px touch target */
        background: transparent; border: 1px solid var(--ks-border-strong); border-radius: 10px;
        color: var(--ks-text); cursor: pointer; transition: background 150ms ease;
    }
    .ks-hamburger:hover { background: var(--ks-surface-2); }
    .ks-hamburger svg { width: 22px; height: 22px; }
    .ks-brand--bar { padding: 0; }

    /* The sidebar slides in from the left as a sheet; off-canvas by default. */
    .ks-sidebar {
        position: fixed; top: 0; left: 0; z-index: 60;
        height: 100dvh; width: min(84vw, 300px); min-width: 0;
        transform: translateX(-100%); transition: transform 220ms ease;
        overflow-y: auto; box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    .ks-shell--nav-open .ks-sidebar { transform: translateX(0); }

    .ks-scrim {
        display: block; position: fixed; inset: 0; z-index: 50;
        background: rgba(0,0,0,0.55);
    }
    .ks-scrim[hidden] { display: none; }

    .ks-main { padding: 20px 18px 48px; min-width: 0; max-width: none; }
    .pd-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-cols { grid-template-columns: minmax(0, 1fr); }
    .wz-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
    .ks-sidebar { transition: none; }
}

/* ============================================================================
   Editor shell (video-editor.md §3) — a pro-tool three-pane surface: preview
   stage + live overlay compositing, a canvas timeline with DOM track headers,
   and a selected-layer inspector. Dark-studio aesthetic, --ks- tokens.
   ============================================================================ */
.ed-shell { display: flex; flex-direction: column; gap: 14px; margin: -10px 0 0; }

/* --- Top bar --------------------------------------------------------------- */
.ed-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ed-topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ed-title { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.ed-topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ed-save { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ks-border); white-space: nowrap; }
.ed-save-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ed-save--ok { color: var(--ks-ok-text); border-color: rgba(41,196,103,0.32); }
.ed-save--dirty { color: var(--ks-text-muted); }
.ed-save--saving { color: var(--ks-info-text); border-color: rgba(75,139,245,0.32); }
.ed-save--saving .ed-save-dot { animation: ks-pulse 1.4s infinite; }
.ed-save--conflict { color: var(--ks-warn-text); border-color: rgba(245,165,36,0.4); background: rgba(245,165,36,0.10); }
.ed-save--error { color: var(--ks-danger-text); border-color: rgba(240,80,60,0.4); }

.ed-tool-btn { background: var(--ks-surface-2); border: 1px solid var(--ks-border-strong); color: var(--ks-text-dim);
    padding: 7px 11px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
    transition: all 150ms ease; white-space: nowrap; }
.ed-tool-btn:hover:not(:disabled) { color: var(--ks-text); border-color: var(--ks-accent); background: rgba(124,92,255,0.08); }
.ed-tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ed-tool-btn--warn:hover:not(:disabled) { border-color: var(--ks-warn); color: var(--ks-warn-text); background: rgba(245,165,36,0.10); }
/* AI-assist actions carry the amber signature accent so they read as "the AI does a pass". */
.ed-tool-btn--ai { color: var(--ks-signature-2); border-color: rgba(245,182,66,0.30); display: inline-flex; align-items: center; gap: 6px; }
.ed-tool-btn--ai:hover:not(:disabled) { border-color: var(--ks-signature); color: var(--ks-signature-2); background: var(--ks-signature-glow); }
.ed-tool-sep { width: 1px; height: 22px; background: var(--ks-border); margin: 0 2px; }

.ed-conflict { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: rgba(245,165,36,0.10); border: 1px solid rgba(245,165,36,0.4); color: var(--ks-warn-text);
    padding: 11px 15px; border-radius: 11px; }
.ed-conflict-actions { display: flex; gap: 8px; }

/* Segment re-generation before/after (video-editor.md §5 item 7 — the USP capstone). */
.ed-regen { background: var(--ks-surface); border: 1px solid var(--ks-signature); border-radius: var(--ks-radius);
    padding: 14px 16px; box-shadow: 0 0 0 3px var(--ks-signature-glow); }
.ed-regen-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.ed-regen-head strong { color: var(--ks-signature-2); font-size: 14px; }
.ed-regen-head span { color: var(--ks-text-muted); font-size: 12px; }
.ed-regen-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ed-regen-take { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ed-regen-take figcaption { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ks-text-dim); font-weight: 700; }
.ed-regen-video { width: 100%; max-height: 260px; background: #000; border-radius: 9px; border: 1px solid var(--ks-border); }
.ed-regen-noprev { display: grid; place-items: center; height: 120px; background: var(--ks-inset);
    border: 1px dashed var(--ks-border-strong); border-radius: 9px; color: var(--ks-text-muted); font-size: 12px; }
.ed-regen-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Deferred AI assists: voiceover / overlay / music / light-painting (video-editor.md §5 items 3-6).
   The plate picker carries the amber signature accent (#f5a524) — the same hue the timeline paints the
   Effect lane in, so the control and the layer it creates are visibly the same thing. */
.ed-assist { background: var(--ks-surface); border: 1px solid var(--ks-border-strong); border-radius: var(--ks-radius);
    padding: 14px 16px; max-width: 560px; }
.ed-assist-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ed-assist-head strong { color: var(--ks-text); font-size: 14px; }
.ed-assist-close { background: none; border: none; color: var(--ks-text-muted); font-size: 20px; line-height: 1;
    cursor: pointer; padding: 0 4px; border-radius: 6px; }
.ed-assist-close:hover { color: var(--ks-text); }
.ed-assist-err { background: rgba(240,80,60,0.10); border: 1px solid rgba(240,80,60,0.4); color: var(--ks-danger-text);
    padding: 8px 11px; border-radius: 9px; font-size: 12.5px; margin-bottom: 10px; }
.ed-assist-notice { background: var(--ks-signature-glow); border: 1px solid rgba(245,182,66,0.4);
    color: var(--ks-signature-2); padding: 9px 13px; border-radius: 11px; font-size: 12.5px; }
.ed-assist-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--ks-text-dim); font-weight: 700; margin: 10px 0 5px; }
.ed-assist-input { width: 100%; background: var(--ks-inset); border: 1px solid var(--ks-border-strong);
    color: var(--ks-text); border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 13px; }
.ed-assist-input:focus-visible { outline: 2px solid var(--ks-signature); outline-offset: 1px; border-color: var(--ks-signature); }
.ed-assist-area { resize: vertical; min-height: 72px; line-height: 1.45; }
.ed-assist-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--ks-text-dim); }
.ed-assist-hint { color: var(--ks-text-muted); font-size: 12px; margin: 10px 0 0; line-height: 1.45; }
.ed-assist-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.ed-plates { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-plate { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
    background: var(--ks-inset); border: 1px solid var(--ks-border-strong); border-radius: 11px;
    padding: 10px 12px; font: inherit; color: var(--ks-text); transition: all 150ms ease; }
.ed-plate:hover:not(:disabled) { border-color: #f5a524; background: rgba(245,165,36,0.08); }
.ed-plate:disabled { opacity: 0.5; cursor: not-allowed; }
.ed-plate-swatch { flex: none; width: 34px; height: 34px; border-radius: 8px;
    background: radial-gradient(circle at 30% 70%, #f5a524, transparent 62%), #0d0e13;
    border: 1px solid rgba(245,165,36,0.45); }
.ed-plate-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ed-plate-copy strong { font-size: 13px; }
.ed-plate-copy span { font-size: 11.5px; color: var(--ks-text-muted); }
.ed-plate-blend { flex: none; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; color: #f5a524; border: 1px solid rgba(245,165,36,0.35);
    border-radius: 999px; padding: 3px 8px; }

/* The topbar's light-painting button reads as the signature action, distinct from the generic AI ones. */
.ed-tool-btn--plate { color: #f5a524; border-color: rgba(245,165,36,0.32); display: inline-flex; align-items: center; gap: 6px; }
.ed-tool-btn--plate:hover:not(:disabled) { border-color: #f5a524; color: #ffcf6b; background: rgba(245,165,36,0.10); }

/* --- Body: stage + inspector ----------------------------------------------- */
.ed-body { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: stretch; }

.ed-stage { display: flex; flex-direction: column; gap: 12px; background: var(--ks-inset);
    border: 1px solid var(--ks-border); border-radius: var(--ks-radius); padding: 16px; min-width: 0; }
.ed-video-wrap { position: relative; margin: 0 auto; height: 44vh; max-height: 520px; max-width: 100%; aspect-ratio: 9 / 16;
    background: #000; border-radius: var(--ks-radius-sm); overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    container-type: size; }
.ed-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.ed-scrub-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
    pointer-events: none; display: none; background: #000; }
.ed-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* The stage box has the canvas shape (EditorPresenter.StageAspectCss), so this layer IS the picture: a title at (x, y) sits where the
   export puts it, and a line longer than the frame is clipped at the picture edge exactly like the export plane. */
/* Mount point for the audio-lane <audio> elements (editor-preview-audio) — off-screen, not display:none, so
   playback is never affected by layout engine quirks around hidden media elements. */
.ed-audio-layers { position: absolute; width: 1px; height: 1px; overflow: hidden; pointer-events: none; }
/* Expand affordance over the stage preview: opens the proxy full-screen in the shared carousel. Top-right,
   clear of the transport controls below, ≥44px touch target — never sits on the timeline so it can't clash
   with clip drag/select. */
.ed-stage-expand { position: absolute; top: 8px; right: 8px; z-index: 3; width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 999px;
    background: rgba(4, 5, 8, 0.55); color: #fff; cursor: pointer; }
.ed-stage-expand:hover { background: rgba(4, 5, 8, 0.78); }
.ed-stage-expand:focus-visible { outline: 2px solid var(--ks-accent); outline-offset: 2px; }
.ed-stage-expand svg { width: 20px; height: 20px; }
.ed-ov { position: absolute; transform: translate(-50%, -50%); align-items: center; justify-content: center;
    max-width: 92%; text-align: center; }
/* Title look = the export (GitLab #166 A1): the SAME bundled Inter Bold file the render worker draws with, a hard shadow of
   0.04em (EdlFilterGraphBuilder.TitleShadowEm), line-height = Inter's own line (2478/2048, the metric the export centres on),
   and NO auto-wrap - a line breaks only where the user typed one (drawtext cannot wrap). Lines are left-aligned inside the
   block like drawtext; the block as a whole is centred on (X, Y). */
@font-face { font-family: "KromeShot Title"; src: url("/fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: block; }
.ed-ov-text { font-family: "KromeShot Title", sans-serif; font-weight: 700; line-height: 1.21; white-space: pre; max-width: none; width: max-content; text-align: left;
    text-shadow: 0.04em 0.04em 0 rgba(0,0,0,0.6); padding: 2px 6px; }
.ed-ov-text.is-selected, .ed-ov-image.is-selected, .ed-ov-video.is-selected { outline: 1.5px dashed var(--ks-signature); outline-offset: 3px; }
.ed-ov-image img { display: block; width: 100%; height: auto; }
.ed-ov-video { overflow: hidden; }
.ed-ov-video video { display: block; width: 100%; height: 100%; object-fit: contain; }
.ed-pip-cap-chip { position: absolute; left: 8px; bottom: 8px; z-index: 3; pointer-events: none; padding: 3px 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(15,16,21,0.82); border: 1px solid var(--ks-border-strong); }
.ed-ov.ed-ov--gesturable { pointer-events: auto; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ed-ov.ed-ov--gesturable:active { cursor: grabbing; }
.ed-ov.ed-ov--gesturable:focus-visible { outline: 2px solid var(--ks-signature); outline-offset: 3px; }
/* Snap guides (E4b-3): one hairline per active snap target, inside #ks-overlay, never hit-testable. */
.ed-stage-guide { position: absolute; pointer-events: none; background: var(--ks-signature); opacity: 0.9; z-index: 5; }
.ed-stage-guide[data-guide="vCentre"] { left: 50%; top: 0; bottom: 0; width: 1px; }
.ed-stage-guide[data-guide="hCentre"] { top: 50%; left: 0; right: 0; height: 1px; }
.ed-stage-guide[data-guide="left"] { left: 0; top: 0; bottom: 0; width: 1px; }
.ed-stage-guide[data-guide="right"] { right: 0; top: 0; bottom: 0; width: 1px; }
.ed-stage-guide[data-guide="top"] { top: 0; left: 0; right: 0; height: 1px; }
.ed-stage-guide[data-guide="bottom"] { bottom: 0; left: 0; right: 0; height: 1px; }
.ed-ov-placeholder { background: rgba(124,92,255,0.25); border: 1px dashed var(--ks-accent-2); color: #fff;
    font-size: 11px; padding: 8px 10px; border-radius: 6px; }

.ed-stage-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 20px; color: var(--ks-text-muted); font-size: 13px; pointer-events: none;
    background: radial-gradient(120% 120% at 50% 40%, rgba(124,92,255,0.10), transparent 70%); }
.ed-stage-hint strong { color: var(--ks-text-dim); }

/* Subtle "updating preview" chip — the last-known-good proxy keeps playing underneath (§3.2 pt 4). */
.ed-stage-chip { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
    display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 24px);
    padding: 5px 12px; border-radius: 999px; font-size: 12px; line-height: 1.3; white-space: nowrap;
    background: rgba(12,12,18,0.72); border: 1px solid var(--ks-border-strong); color: var(--ks-text-dim);
    backdrop-filter: blur(6px); box-shadow: 0 4px 16px rgba(0,0,0,0.4); pointer-events: none; }
.ed-stage-chip--warn { color: var(--ks-warning, #f5a524); border-color: var(--ks-warning, #f5a524); }

/* Honest placeholder panel shown INSTEAD of a black, broken <video> when a take has no playable object. */
.ed-stage-placeholder { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px;
    color: var(--ks-text-muted); font-size: 13px;
    background: radial-gradient(120% 120% at 50% 40%, rgba(124,92,255,0.12), rgba(10,10,14,0.94) 72%); }
.ed-stage-placeholder strong { color: var(--ks-text); font-size: 15px; }
.ed-stage-placeholder span { max-width: 42ch; line-height: 1.5; }
.ed-stage-placeholder-mark { width: 40px; height: 40px; border-radius: 10px; border: 1.5px dashed var(--ks-accent-2);
    background: rgba(124,92,255,0.14); }

.ed-transport { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ed-tp-btn { width: 40px; height: 40px; display: grid; place-items: center; background: var(--ks-surface-2);
    border: 1px solid var(--ks-border-strong); color: var(--ks-text-dim); border-radius: 10px; cursor: pointer;
    font-size: 14px; transition: all 150ms ease; }
.ed-tp-btn:hover { color: var(--ks-text); border-color: var(--ks-accent); }
.ed-tp-play { background: var(--ks-accent); border-color: var(--ks-accent); color: #fff; width: 46px; height: 46px; }
.ed-tp-play:hover { background: var(--ks-accent-2); color: #fff; }
.ed-tp-play:disabled, .ed-tp-play[aria-disabled="true"] { opacity: 0.55; cursor: default; background: var(--ks-accent); border-color: var(--ks-accent); }
.ed-tp-play .ws-live-dot { background: #fff; }
.ed-tp-time { font-family: "Cascadia Code", monospace; font-size: 13px; color: var(--ks-text-dim);
    font-variant-numeric: tabular-nums; margin-left: 6px; min-width: 96px; }

.ed-export { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 13px;
    padding-top: 4px; border-top: 1px solid var(--ks-border); }
.ed-export-ok { color: var(--ks-ok-text); font-weight: 600; }
.ed-export-err { color: var(--ks-danger-text); }
.ed-export-link { color: var(--ks-signature-2); font-weight: 600; }

/* --- Inspector ------------------------------------------------------------- */
.ed-inspector-pane { background: var(--ks-surface); border: 1px solid var(--ks-border);
    border-radius: var(--ks-radius); padding: 16px; overflow-y: auto; }
.ed-insp-segmented { display: flex; gap: 0; border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm); overflow: hidden; }
.ed-insp-seg { flex: 1; min-height: 44px; background: var(--ks-surface-2); border: 0; color: var(--ks-text); font-size: 13px; cursor: pointer; }
.ed-insp-seg + .ed-insp-seg { border-left: 1px solid var(--ks-border); }
.ed-insp-seg.is-active { background: var(--ks-accent); color: #fff; font-weight: 600; }
.ed-inspector-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; height: 100%; min-height: 200px; color: var(--ks-text-faint); text-align: center; padding: 20px; }
.ed-inspector-empty svg { width: 34px; height: 34px; opacity: 0.5; }
.ed-inspector-empty p { font-size: 13px; max-width: 26ch; }

.ed-insp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ed-insp-kind { font-size: 14px; font-weight: 700; color: var(--ks-text); }
.ed-insp-del { background: transparent; border: 1px solid var(--ks-border-strong); color: var(--ks-text-muted);
    padding: 4px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: all 150ms ease; }
.ed-insp-del:hover:not(:disabled) { color: var(--ks-danger-text); border-color: var(--ks-danger); }
.ed-insp-del:disabled { opacity: 0.4; cursor: not-allowed; }

.ed-insp-group { padding: 12px 0; border-top: 1px solid var(--ks-border); }
.ed-insp-group:first-of-type { border-top: none; padding-top: 0; }
.ed-insp-legend { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--ks-signature-2); font-weight: 700; margin-bottom: 9px; }
.ed-insp-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.ed-insp-field > span { font-size: 12px; color: var(--ks-text-dim); font-weight: 550; }
.ed-insp-notice { margin: 0 0 10px; padding: 8px 10px; font-size: 12px; line-height: 1.4; color: var(--ks-text); background: var(--ks-accent-ring); border: 1px solid var(--ks-border-strong); border-radius: 8px; }
.ed-insp-field input[type=number], .ed-insp-field textarea, .ed-insp-field select {
    background: var(--ks-inset); border: 1px solid var(--ks-border-strong); color: var(--ks-text);
    border-radius: var(--ks-radius-sm); padding: 7px 9px; font: inherit; font-size: 13px; width: 100%; }
.ed-insp-field input[type=range] { width: 100%; accent-color: var(--ks-accent); }
.ed-insp-field input[type=color] { width: 44px; height: 30px; padding: 2px; background: var(--ks-inset);
    border: 1px solid var(--ks-border-strong); border-radius: 8px; cursor: pointer; }
.ed-insp-xy { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* --- Consistency badge (video-editor.md §5 item 1) ------------------------- */
.ed-insp-consistency-row { display: flex; flex-direction: column; gap: 6px; }
.ed-insp-consistency-note { font-size: 11.5px; line-height: 1.45; color: var(--ks-text-muted); }

/* --- Timeline -------------------------------------------------------------- */
.ed-timeline { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius);
    padding: 12px 14px 14px; }
.ed-tl-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ed-tl-label { font-size: 13px; font-weight: 700; color: var(--ks-text-dim); }
.ed-tl-zoom { display: flex; gap: 6px; }

.ed-tl-grid { display: grid; grid-template-columns: 168px 1fr; border: 1px solid var(--ks-border);
    border-radius: var(--ks-radius-sm); overflow: hidden; max-height: 40vh; }
.ed-tl-headers { background: var(--ks-inset); border-right: 1px solid var(--ks-border); }
.ed-tl-ruler-spacer { height: 26px; border-bottom: 1px solid var(--ks-border); background: #0f1015; }
.ed-tl-head { display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 12.5px; font-weight: 600;
    color: var(--ks-text-dim); border-bottom: 1px solid var(--ks-border); }
.ed-tl-head-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ed-tl-head-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
/* Track-header controls (video-editor.md parity spec §2.2/§3.1, E4a: lock/mute-or-hide/reorder/remove). Compact
   (22px) on desktop; at <= 900px each control is a full 44px touch target (owner rule) and the rail grows to fit
   the controls instead (see the @media block below), dropping the text label (the colour dot + aria-label stay). */
.ed-tl-head-controls { display: flex; align-items: center; gap: 2px; flex: none; }
.ed-tl-head-btn { width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--ks-text-dim);
    font-size: 11px; line-height: 1; cursor: pointer; }
.ed-tl-head-more, .ed-tl-sheet-backdrop { display: none; }
.ed-tl-head-btn:hover:not(:disabled) { border-color: var(--ks-border-strong); color: var(--ks-text); }
.ed-tl-head-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ed-tl-head-btn.is-active { color: var(--ks-accent); border-color: var(--ks-accent); background: rgba(124,92,255,0.12); }
.ed-tl-head-btn--danger:hover:not(:disabled) { color: var(--ks-warn-text); border-color: var(--ks-warn); background: rgba(245,165,36,0.10); }
.ed-tl-scroll { overflow-y: auto; overflow-x: hidden; background: var(--ks-surface); }
.ed-tl-canvas { display: block; width: 100%; cursor: pointer; touch-action: none; transition: opacity 0.1s ease; }
/* Not-yet-interactive skeleton (editor-canvas-tap-gate, CapCut-style): a visible shimmer instead of a blank
   default-sized canvas while the JS island paints its first scene; clears the instant data-tl-ready="true". */
.ed-tl-canvas[data-tl-ready="false"] { cursor: wait; min-height: 72px;
    background: linear-gradient(100deg, var(--ks-surface-2) 30%, var(--ks-border) 50%, var(--ks-surface-2) 70%);
    background-size: 200% 100%; animation: ks-shimmer 1.3s infinite; }
/* Pointer-down acknowledgement (editor-canvas-tap-gate): the island's pointer listeners bind ahead of the
   sized/painted canvas, so a tap always gets an instant, purely client-side visual response — queued and
   replayed (tap) or refused (drag) by EditorPresenter once the real scene is on screen, never a silent drop. */
.ed-tl-canvas--pressed { opacity: 0.72; }

.ed-tl-scrollbar { width: 100%; margin-top: 10px; accent-color: var(--ks-accent); }

/* Swipe-delete undo toast (video-editor.md parity spec §3.1, E4a) — a single ripple-delete is instantly
   reversible, so it gets this lighter, auto-dismissing toast rather than a ConfirmDialog interrupt; fixed to
   the viewport bottom so it is never scrolled out of view on a phone (memory: confirm-dialog-not-toast — the
   same "never out of viewport" rule the shared ConfirmDialog itself follows, applied to a lighter pattern for
   a reversible action). */
.ed-undo-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 45;
    display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 999px;
    background: rgba(20,20,28,0.92); border: 1px solid var(--ks-border-strong); color: var(--ks-text);
    font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.45); backdrop-filter: blur(6px); }
/* Locked-track gesture refusal (parity spec §3.1) — same shape, no Undo action, an amber border reads as a
   refusal rather than a completed/reversible action. */
.ed-undo-toast--notice { border-color: var(--ks-warn, #f5a524); }

/* Touch long-press "Select" menu (UI-0c) — a floating chip above the dock like the undo toast, so it is visible
   without scrolling at 390x844; the transparent backdrop under it turns any outside tap into a dismiss. */
.ed-hold-backdrop { position: fixed; inset: 0; z-index: 44; background: transparent; }
.ed-hold-menu { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 45;
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 999px;
    background: rgba(20,20,28,0.92); border: 1px solid var(--ks-border-strong); color: var(--ks-text);
    font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.45); backdrop-filter: blur(6px); }

/* Media drawer (video-editor.md parity spec §3.1 row 15, E4a) — a bottom sheet at any width. */
.ed-drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(6,6,10,0.6);
    display: flex; align-items: flex-end; justify-content: center; }
.ed-drawer { width: 100%; max-width: 520px; max-height: 70vh; overflow-y: auto; background: var(--ks-surface);
    border: 1px solid var(--ks-border-strong); border-bottom: none; border-radius: var(--ks-radius) var(--ks-radius) 0 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.ed-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ed-drawer-head strong { color: var(--ks-text); font-size: 14px; }
.ed-drawer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ed-drawer-item { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 10px 12px; background: var(--ks-surface-2); border: 1px solid var(--ks-border);
    border-radius: var(--ks-radius-sm); color: var(--ks-text); font-size: 13px; cursor: pointer; text-align: left; }
.ed-drawer-item:hover { border-color: var(--ks-accent); background: rgba(124,92,255,0.08); }
.ed-drawer-item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-drawer-item-meta { flex: none; color: var(--ks-text-dim); font-size: 12px; }

@media (max-width: 900px) {
    .ed-body { grid-template-columns: minmax(0, 1fr); }
    /* the inspector becomes a bottom sheet (EditorSheet Inline): the pane chrome goes, the sheet brings its own */
    .ed-inspector-pane { background: none; border: 0; padding: 0; max-height: none; overflow: visible; }
    /* the fixed sheet must not trap the last rows of the page (timeline, zoom, tool dock) under it: reserve its height at the page end so they scroll clear */
    body:has(.eds--inline.eds--peek:not(.eds--idle)) { padding-bottom: 104px; }
    body:has(.eds--inline.eds--half:not(.eds--idle)) { padding-bottom: 50dvh; }
    body:has(.eds--inline.eds--full:not(.eds--idle)) { padding-bottom: 85dvh; }
    .ed-tl-grid { grid-template-columns: max-content minmax(0, 1fr); }
    .ed-tl-head { padding: 0 4px; gap: 4px; }
    .ed-tl-head-label { display: none; }
    /* The rail is the colour dot + ONE 44px "more" button; the track's controls open as a bottom sheet (fixed, so the
       grid's overflow:hidden cannot clip it), each item a full-width 44px-tall row with its text label. */
    .ed-tl-head-more { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
        font-size: 20px; background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--ks-text-dim); cursor: pointer; }
    .ed-tl-head-more.is-active { color: var(--ks-accent); border-color: var(--ks-accent); }
    .ed-tl-sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.45); }
    .ed-tl-head-controls { display: none; }
    .ed-tl-head-controls.is-open { display: flex; flex-direction: column; align-items: stretch; gap: 0; position: fixed; left: 0; right: 0; bottom: 0;
        z-index: 61; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--ks-surface); border-top: 1px solid var(--ks-border-strong); }
    .ed-tl-head-controls.is-open .ed-tl-head-btn { width: 100%; height: 44px; justify-content: flex-start; gap: 12px; padding: 0 12px; font-size: 16px; }
    .ed-tl-head-controls.is-open .ed-tl-head-btn::after { content: attr(title); font-size: 14px; font-weight: 600; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Circuit reconnection modal (persona-page-circuit) ---------------------------------------------
   Blazor's boot JS toggles the state classes on #components-reconnect-modal when the SignalR circuit
   drops. Default state (`-hide`) is invisible; `-show` (retrying), `-failed` (retries exhausted) and
   `-rejected` (server no longer holds the circuit) darken the screen and surface the matching message. */
#components-reconnect-modal { display: none; }

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(8, 8, 12, 0.72);
    backdrop-filter: blur(2px);
}

#components-reconnect-modal .crm-card {
    max-width: 22rem;
    width: 100%;
    text-align: center;
    padding: 1.5rem 1.25rem;
    border-radius: 14px;
    background: var(--ks-surface, #16161d);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    color: var(--ks-text, #e8e8ee);
}

#components-reconnect-modal .crm-spinner {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 0.85rem;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--ks-accent, #f5b642);
    border-radius: 50%;
    animation: crm-spin 0.8s linear infinite;
}

#components-reconnect-modal .crm-reload {
    color: var(--ks-accent, #f5b642);
    font-weight: 600;
    text-decoration: underline;
}

/* Show only the message that matches the current state. */
#components-reconnect-modal .crm-retrying,
#components-reconnect-modal .crm-failed,
#components-reconnect-modal .crm-rejected { display: none; margin: 0; }
#components-reconnect-modal.components-reconnect-show .crm-retrying { display: block; }
#components-reconnect-modal.components-reconnect-failed .crm-spinner,
#components-reconnect-modal.components-reconnect-rejected .crm-spinner { display: none; }
#components-reconnect-modal.components-reconnect-failed .crm-failed { display: block; }
#components-reconnect-modal.components-reconnect-rejected .crm-rejected { display: block; }

@keyframes crm-spin { to { transform: rotate(360deg); } }

/* ── Genre-first concept browse (concepts-2000 §3.5) ─────────────────────────────────────────────── */
/* A phone-first top switch + genre chips, calm neutral surface, one accent, 44px touch targets, chips
   scroll horizontally on phones, no horizontal page overflow at 390px. */
.genre-switch {
    display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 4px 0 8px; margin: 0 0 8px; scrollbar-width: thin;
}
.genre-switch::-webkit-scrollbar { height: 6px; }
.genre-switch-btn {
    flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px;
    background: var(--ks-surface-2); color: var(--ks-text-dim);
    border: 1px solid var(--ks-border); font-size: 14px; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background .12s, color .12s, border-color .12s;
}
.genre-switch-btn:hover { color: var(--ks-text); border-color: var(--ks-border-strong); }
.genre-switch-btn.is-active {
    background: var(--ks-accent); color: #fff; border-color: var(--ks-accent);
}
.genre-chips {
    display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 2px 0 10px; scrollbar-width: thin;
}
.genre-chips .pg-chip { flex: 0 0 auto; min-height: 40px; }

/* Card enrichments — logline, the duration/aspect/cast meta row, mood chips */
.lib-card-logline { color: var(--ks-text-dim); font-size: 14px; line-height: 1.45; margin: 2px 0 8px; }
.concept-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.concept-meta-item {
    font-size: 12px; font-weight: 600; color: var(--ks-text-muted);
    background: var(--ks-inset); border: 1px solid var(--ks-border);
    border-radius: 6px; padding: 2px 8px; font-variant-numeric: tabular-nums;
}
.concept-moods { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.concept-mood {
    font-size: 11px; font-weight: 600; color: var(--ks-signature-2);
    background: var(--ks-signature-glow); border-radius: 999px; padding: 2px 9px; text-transform: capitalize;
}

/* Clickable card wrapper (opens the detail sheet) */
.lib-card-tap { cursor: pointer; border-radius: 12px; outline: none; }
.lib-card-tap:focus-visible { box-shadow: 0 0 0 2px var(--ks-accent-ring); }

/* "Show more" — reveal the next page of the paged concept grid (coordinator DECISION: land full, page 60). */
.lib-more { display: flex; justify-content: center; margin: 22px 0 4px; }

/* Detail sheet — bottom sheet on phones, centred panel on desktop */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60;
    display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.sheet {
    background: var(--ks-surface); border-top: 1px solid var(--ks-border);
    width: 100%; max-height: 88vh; overflow-y: auto; border-radius: 16px 16px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--ks-text); }
.sheet-logline { color: var(--ks-text-dim); font-size: 14px; margin: 4px 0 0; }
.sheet-close {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--ks-border);
    background: var(--ks-surface-2); color: var(--ks-text-dim); font-size: 22px; line-height: 1; cursor: pointer;
}
.sheet-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.sheet-setting, .sheet-desc { color: var(--ks-text-muted); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.sheet-subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ks-text-faint); margin: 16px 0 8px; }
.shot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.shot { background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: 10px; padding: 12px; }
.shot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.shot-beat { font-weight: 700; font-size: 14px; color: var(--ks-text); }
.shot-secs { font-size: 12px; color: var(--ks-text-muted); font-variant-numeric: tabular-nums; }
.shot-scene { color: var(--ks-text-dim); font-size: 13px; line-height: 1.45; margin: 6px 0 0; }
.shot-vo { color: var(--ks-signature-2); font-size: 13px; font-style: italic; margin: 6px 0 0; }
.shot-cam { color: var(--ks-text-faint); font-size: 12px; margin: 6px 0 0; }
.shot-continuity { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; font-size: 11.5px; color: var(--ks-text-faint); }
.shot-transition { font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ks-text-muted); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.cast-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cast-member { background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: 10px; padding: 12px; }
.cast-role { font-weight: 700; font-size: 13px; color: var(--ks-text); }
.cast-desc { color: var(--ks-text-dim); font-size: 13px; margin: 6px 0 0; }
.cast-appearance { color: var(--ks-text-faint); font-size: 12px; margin: 4px 0 0; }

@media (min-width: 720px) {
    .sheet-backdrop { align-items: center; padding: 24px; }
    .sheet { max-width: 640px; border-radius: 16px; border: 1px solid var(--ks-border); }
}

/* Concept authoring form (concept-form-parity): ONE form for New and Edit, incl. the shot-list and cast CRUD. */
.cf-section { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ks-text-faint); margin: 18px 0 2px; padding-top: 12px; border-top: 1px solid var(--ks-border); }
.cf-empty { color: var(--ks-text-faint); font-size: 13px; margin: 4px 0; }
.cf-warnings { margin: 0; padding-left: 18px; font-size: 13px; }
.cf-toggle { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ks-text-dim); }
.cf-toggle input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--ks-accent); }

.cf-shots, .cf-cast { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cf-shot-row, .cf-cast-row { background: var(--ks-inset); border: 1px solid var(--ks-border); border-radius: 10px;
    padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cf-shot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cf-shot-number { font-weight: 700; font-size: 13px; color: var(--ks-text-dim); }
.cf-shot-row-actions { display: flex; gap: 6px; }
.cf-icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--ks-border);
    background: var(--ks-surface-2); color: var(--ks-text-dim); font-size: 14px; cursor: pointer; }
.cf-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cf-icon-btn--danger:hover:not(:disabled) { border-color: var(--ks-danger); color: var(--ks-danger); }
.cf-persona-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ks-text-dim); }
.cf-persona-toggle input[type=radio] { width: 16px; height: 16px; accent-color: var(--ks-accent); }
.cf-shots-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.cf-shots-count { font-size: 12.5px; color: var(--ks-text-faint); font-variant-numeric: tabular-nums; }
.cf-add-row { border: 1px dashed var(--ks-border-strong); background: transparent; color: var(--ks-text-dim);
    border-radius: var(--ks-radius-sm); padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cf-add-row:disabled { opacity: 0.4; cursor: not-allowed; }
.cf-add-row:hover:not(:disabled) { border-color: var(--ks-accent); color: var(--ks-text); }

@media (max-width: 560px) {
    .wz-grid-2 { grid-template-columns: 1fr; }
    .cf-sticky-actions { position: sticky; bottom: 0; background: var(--ks-surface); padding: 10px 0;
        margin: 6px -4px 0; border-top: 1px solid var(--ks-border); }
}

/* --- stock-audio-library-ui: /library/audio page + editor picker sheet --------------------------- */

.sa-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; }
.sa-tab { flex: none; border: 1px solid var(--ks-border); background: var(--ks-surface); color: var(--ks-text-dim);
    border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sa-tab--active { background: var(--ks-accent); border-color: var(--ks-accent); color: #fff; }

.sa-chip-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.sa-chip { flex: none; border: 1px solid var(--ks-border); background: transparent; color: var(--ks-text-faint);
    border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.sa-chip--active { border-color: var(--ks-accent); color: var(--ks-text); background: rgba(255,255,255,0.06); }

.sa-search { flex: 1 1 200px; min-width: 0; background: var(--ks-surface); border: 1px solid var(--ks-border);
    border-radius: var(--ks-radius-sm); padding: 8px 12px; color: var(--ks-text); font-size: 14px; }
.sa-duration { background: var(--ks-surface); border: 1px solid var(--ks-border); border-radius: var(--ks-radius-sm);
    padding: 8px 10px; color: var(--ks-text); font-size: 13px; }
.sa-toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ks-text-dim); white-space: nowrap; }

.sa-list { display: flex; flex-direction: column; gap: 8px; }
.sa-list--skeleton { pointer-events: none; }
.sa-skeleton-row { height: 64px; border-radius: var(--ks-radius-sm); background: var(--ks-surface);
    border: 1px solid var(--ks-border); position: relative; overflow: hidden; }
.sa-skeleton-row::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent); animation: ks-shimmer 1.4s infinite; }
@media (prefers-reduced-motion: reduce) { .sa-skeleton-row::after { animation: none; } }

.sa-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--ks-border);
    border-radius: var(--ks-radius-sm); background: var(--ks-surface); }
.sa-row--playing { border-color: var(--ks-accent); }
.sa-play, .sa-fav { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ks-border);
    background: transparent; color: var(--ks-text-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sa-play:disabled { opacity: 0.4; cursor: not-allowed; }
.sa-fav--on { color: #e0567c; border-color: #e0567c; }
.sa-row-body { flex: 1; min-width: 0; }
.sa-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sa-row-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-row-duration { flex: none; font-size: 12px; color: var(--ks-text-faint); font-variant-numeric: tabular-nums; }
.sa-row-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sa-row-genre { font-size: 12px; color: var(--ks-text-dim); text-transform: capitalize; }
.sa-row-mood { font-size: 11.5px; color: var(--ks-text-faint); }
.sa-row-mood::before { content: "· "; }
.sa-row-note { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sa-row-note--warn { color: #d99a3d; font-size: 12.5px; }
.sa-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ks-border); color: var(--ks-text-faint); }
.sa-badge--free { border-color: rgba(88, 200, 140, 0.4); color: #6fce9c; }
.sa-badge--attrib { border-color: rgba(120, 170, 220, 0.4); color: #85b6e6; }
.sa-badge--contentid { border-color: rgba(217, 154, 61, 0.4); color: #d99a3d; }
.sa-badge--licence { border-color: var(--ks-border); color: var(--ks-text); font-weight: 600; }
.sa-licence { display: inline-block; }
.sa-licence > summary { position: relative; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.sa-licence > summary::-webkit-details-marker { display: none; }
/* 44 px touch target without growing the pill or the row: a transparent hit box around the badge. */
.sa-licence > summary::before { content: ""; position: absolute; left: -4px; right: -4px; top: -13px; bottom: -13px; }
.sa-licence > summary::after { content: "\25B8"; font-size: 10px; color: var(--ks-text-muted); transition: transform 0.15s; }
.sa-licence[open] > summary::after { transform: rotate(90deg); }
.sa-licence-credit { display: block; font-size: 12px; color: var(--ks-text-muted); padding: 2px 0 6px; overflow-wrap: anywhere; }

.sa-count { font-size: 12px; color: var(--ks-text-faint); text-align: center; margin: 8px 0; }
.sa-show-more { display: block; margin: 0 auto 16px; border: 1px solid var(--ks-border); background: transparent;
    color: var(--ks-text-dim); border-radius: var(--ks-radius-sm); padding: 8px 18px; font-size: 13px; cursor: pointer; }
.sa-show-more:disabled { opacity: 0.5; cursor: not-allowed; }

.sa-player-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    background: var(--ks-surface); border-top: 1px solid var(--ks-border); }
.sa-player-bar audio { width: 100%; height: 32px; }
#sa-waveform { flex: 1; min-width: 0; height: 36px; cursor: pointer; color: var(--ks-accent); }

@media (max-width: 480px) {
    .sa-row-mood:nth-child(n+3) { display: none; }
}

.sa-picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.sa-picker-row { display: flex; align-items: center; gap: 8px; }
.sa-picker-row .sa-row { flex: 1; min-width: 0; }

/* stock-audio-library-ui-4: mobile tap targets >= 44 CSS px (owner rule, mobile-first) at <= 900px. The
   text controls use line-height to reach the target height (a single line of text centers within its own
   line box), so the chip/tab pill stays visually compact rather than growing a chunky block. */
@media (max-width: 900px) {
    .sa-tab, .sa-chip { padding-top: 0; padding-bottom: 0; line-height: 44px; }
    .sa-show-more { padding-top: 0; padding-bottom: 0; line-height: 44px; }
    .sa-play, .sa-fav { width: 44px; height: 44px; }
    /* KromeButton's scoped rule (.krome-btn[b-x]) ties on class count, so the element selector wins; the
       button is already inline-flex/centered, so min-height alone reaches the target. */
    .sa-picker-row button.krome-btn { min-height: 44px; }
}

/* Background jobs spoke: the shared JobsSettingsEditor's table stays inside the page at 390 (it scrolls
   within its own box, never the page) and its row actions meet the 44 px tap target. */
.jobs-spoke { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.jobs-spoke .jse-edit-btn, .jobs-spoke .jse-editor button, .jobs-spoke .jse-editor input { min-height: 44px; }

/* Wizard shoot-shape chips (GitLab #104): large touch targets, plain words + a small shape icon. */
.wz-aspects { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .75rem; }
.wz-aspect { display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; min-width: 44px; padding: .5rem 1rem; border: 2px solid var(--kromeshot-border, #cbd5e1); border-radius: 12px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.wz-aspect--on { border-color: var(--kromeshot-accent, #6366f1); background: rgba(99, 102, 241, .12); font-weight: 600; }
.wz-aspect__shape { display: inline-block; height: 22px; border: 2px solid currentColor; border-radius: 3px; }

/* Editor canvas follows the shoot shape (GitLab #104); the default 9:16 box keeps its fixed height. */
.ed-video-wrap[data-aspect="landscape_16_9"] { height: auto; width: min(100%, 720px); max-height: none; }
.ed-video-wrap[data-aspect="square"] { height: auto; width: min(100%, 44vh, 520px); max-height: none; }

.ed-insp-look { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; min-height: 44px; }
.ed-insp-look-pct { opacity: 0.8; font-variant-numeric: tabular-nums; }

/* PWA update toast (js/pwa-register.js, fast path F1b): bottom-anchored above the safe area, 44px tap target. */
.ks-update-toast {
    position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 2000; /* clear of the mobile bottom navigation */
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--ks-surface-2); color: var(--ks-text);
    border: 1px solid var(--ks-border-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.ks-update-toast button {
    min-height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: #f5b642; color: #0d0d12; font-weight: 600; cursor: pointer;
}
.ks-update-toast .ks-update-actions { display: flex; align-items: center; gap: 8px; }
.ks-update-toast button.ks-update-dismiss { min-width: 44px; padding: 0; background: transparent; color: var(--ks-text); border: 1px solid var(--ks-border-strong); font-size: 20px; line-height: 1; }
@media (min-width: 768px) { .ks-update-toast { left: auto; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 360px; } }

/* Add-to-home-screen nudge (GitLab #188, F1c): reuses the shared bottom sheet; the 44px targets and the iOS steps are the only additions. */
.pwa-nudge .krome-btn { min-height: 44px; min-width: 88px; }
.pwa-nudge-steps { margin: 8px 0 0; padding-left: 22px; color: var(--ks-text-dim); font-size: 15px; line-height: 1.6; }
.pwa-nudge-steps li { margin: 8px 0; }
.pwa-nudge-icon { width: 22px; height: 22px; vertical-align: -5px; color: var(--ks-text); }
