:root {
    color-scheme: light;
    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --line: rgba(23, 40, 80, 0.10);
    --line-2: rgba(23, 40, 80, 0.18);
    --text: #16243d;
    --muted: #5b6678;
    --hint: #97a0b2;
    --mango: #2f7fce;
    --mango-deep: #173f78;
    --mango-soft: #e9f1fc;
    --ok: #2f8a5b;
    --ok-soft: #e6f3ea;
    --warn: #bb7a12;
    --warn-soft: #fbf0d9;
    --info: #3070b8;
    --info-soft: #e7f0fa;
    --idle: #6b7486;
    --idle-soft: #eef1f6;
    --on-strong: #fff;
    --focus-ring: rgba(47, 127, 206, 0.24);
    --topbar-glass: rgba(238, 242, 248, 0.82);
    --stage-overlay: rgba(238, 242, 248, 0.72);
    --mango-line: #d7e6f7;
    --mango-active-line: rgba(47, 127, 206, 0.52);
    --brand-gradient: linear-gradient(165deg, #3a93e6, #15407c);
    --shadow-raised: 0 18px 70px rgba(15, 28, 48, 0.24);
    --shadow-toast: 0 18px 48px rgba(15, 28, 48, 0.24);
    --ai: #6b3fa0;
    --ai-soft: #f1ebf9;
    --ai-line: #e6d9f5;
    --ok-check-line: #a1ceb7;
    --ok-check-soft: #e0eee6;
    --surface-blend: #fbfcfe;
    --r-sm: 8px;
    --r: 11px;
    --r-lg: 16px;
    --r-pill: 999px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    min-height: 100%;
    margin: 0;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: 0;
}

.page-wrap {
    width: auto;
    max-width: 1040px;
    padding: 26px 0 60px;
    margin-inline: 30px;
}

.page-head {
    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 22px;
}

.page-head p,
.lede,
.muted {
    color: var(--muted);
}

.lede {
    margin-bottom: 18px;
}

.section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 26px 0 12px;
    min-width: 0;
}

.section-title h2 {
    min-width: 0;
    font-size: 15px;
}

.link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: var(--mango-deep);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    min-width: 0;
    cursor: pointer;
    text-decoration: none;
}

.button.primary,
.ghost-button.primary {
    border-color: var(--mango);
    background: var(--mango);
    color: var(--on-strong);
}

.button:hover,
.ghost-button:hover {
    background: var(--surface-2);
}

.button.primary:hover,
.ghost-button.primary:hover {
    background: var(--mango-deep);
}

.grid {
    display: grid;
    gap: 14px;
}

.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid var(--mango-line);
    border-radius: var(--r);
    background: var(--mango-soft);
    color: var(--mango-deep);
    font-weight: 500;
}

.banner .ti {
    font-size: 20px;
}

.banner.caution {
    border-color: var(--warn-soft);
}

.warning-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 13px;
    font-weight: 500;
}

.enrichment-card {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid var(--mango-line);
    border-radius: var(--r);
    background: var(--mango-soft);
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.table-note {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12.5px;
}

.capture-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    margin-bottom: 12px;
    border-radius: var(--r);
    background: var(--idle-soft);
    color: var(--hint);
    text-align: center;
}

.capture-preview .ti {
    font-size: 38px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1000;
    max-width: calc(100vw - 36px);
    padding: 14px 18px;
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-raised);
}

#blazor-error-ui .dismiss {
    margin-left: 12px;
    cursor: pointer;
}

.boot-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.boot-card {
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 48px));
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.boot-card span {
    color: var(--muted);
}

/* Existing capture viewer surface, restyled to the onboarding palette. */
.viewer-page {
    min-height: calc(100vh - 67px);
    padding: 26px 30px 60px;
}

.viewer-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
}

.eyebrow,
.panel-label {
    margin: 0;
    color: var(--hint);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.viewer-topbar h1 {
    font-size: 22px;
}

.viewer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

.viewer-stage {
    position: sticky;
    top: 92px;
    min-height: 72vh;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.viewer-canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 72vh;
}

.stage-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--stage-overlay);
}

.viewer-panel {
    display: grid;
    gap: 14px;
    align-content: start;
}

.glass-card {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    padding: 18px 20px;
}

.glass-card.compact {
    width: min(320px, calc(100vw - 48px));
}

.glass-card h2 {
    margin: 0;
    font-size: 17px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.metadata-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.metadata-list div,
.primitive-row,
.proof-evidence-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 44px;
    border-bottom: 1px solid var(--line);
}

.metadata-list div:last-child,
.proof-evidence-list div:last-child {
    border-bottom: 0;
}

.metadata-list dt,
.proof-evidence-list span {
    color: var(--muted);
}

.metadata-list dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
}

.keyframe-preview-frame {
    margin: 0 0 12px;
}

.keyframe-preview {
    display: block;
    width: 100%;
    border-radius: var(--r);
}

.keyframe-preview-frame figcaption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.keyframe-list,
.primitive-list,
.proof-evidence-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.keyframe-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.keyframe-row.active {
    border-color: var(--mango-active-line);
    background: var(--mango-soft);
}

.empty-evidence {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--muted);
}

.primitive-row {
    min-height: 56px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
}

.primitive-row span {
    display: grid;
}

.primitive-row em,
.primitive-version,
.state-dot {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
}

.state-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ok);
}

@media (max-width: 980px) {
    .viewer-grid {
        grid-template-columns: 1fr;
    }

    .viewer-stage {
        position: static;
        min-height: 58vh;
    }
}

@media (max-width: 760px) {
    .cols-2,
    .cols-3,
    .cols-4 {
        grid-template-columns: 1fr;
    }

    .page-wrap,
    .viewer-page {
        width: auto;
        margin-inline: 16px;
        padding-top: 18px;
    }

    .grid {
        min-width: 0;
    }

    .button,
    .ghost-button,
    select.button {
        max-width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .viewer-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
