:root {
    --bg: oklch(0.965 0.006 240);
    --surface: oklch(0.995 0.002 240);
    --fg: oklch(0.22 0.018 250);
    --muted: oklch(0.52 0.018 250);
    --border: oklch(0.86 0.012 245);
    --accent: oklch(0.56 0.13 220);
    --danger: oklch(0.5 0.18 28);
    --success: oklch(0.47 0.11 155);
    --warning: oklch(0.62 0.13 75);
    --shadow: 0 20px 60px oklch(0.2 0.02 250/.10);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    color: var(--fg);
    background: var(--bg)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh
}

button,
input {
    font: inherit
}

button {
    cursor: pointer
}

.hidden {
    display: none !important
}

.mono {
    font-family: "IBM Plex Mono", Consolas, monospace
}

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

:focus-visible {
    outline: 3px solid oklch(0.72 0.14 220);
    outline-offset: 2px
}

.app-shell {
    min-height: 100vh
}

.brand {
    font: 700 18px/1 "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: -.02em
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-right: 9px;
    background: var(--fg);
    color: var(--surface);
    font-size: 14px;
    border-radius: 6px
}

.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted)
}

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 42%) 1fr
}

.auth-panel {
    background: var(--surface);
    padding: 38px clamp(28px, 5vw, 76px);
    display: flex;
    flex-direction: column
}

.auth-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.auth-main {
    width: min(100%, 430px);
    margin: auto
}

.auth-main h1 {
    font: 650 clamp(34px, 4vw, 52px)/1.05 "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: -.045em;
    margin: 0 0 12px
}

.lede {
    color: var(--muted);
    font-size: 17px;
    line-height: 1.55;
    margin: 0 0 30px
}

.auth-aside {
    position: relative;
    overflow: hidden;
    background: var(--fg);
    color: var(--surface);
    padding: 56px;
    display: flex;
    align-items: flex-end
}

.auth-aside:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, transparent 35%, oklch(0.56 0.13 220/.25)), repeating-linear-gradient(90deg, transparent 0 64px, oklch(1 0 0/.05) 65px), repeating-linear-gradient(0deg, transparent 0 64px, oklch(1 0 0/.05) 65px)
}

.orbital {
    position: absolute;
    width: 70%;
    aspect-ratio: 1;
    border: 1px solid oklch(1 0 0/.18);
    border-radius: 50%;
    top: 10%;
    left: 15%
}

.orbital:before,
.orbital:after {
    content: "";
    position: absolute;
    border: 1px solid oklch(1 0 0/.15);
    border-radius: 50%;
    inset: 12%
}

.orbital:after {
    inset: 28%
}

.aside-copy {
    position: relative;
    max-width: 560px
}

.aside-copy h2 {
    font: 600 clamp(30px, 4vw, 58px)/1.02 "IBM Plex Sans", "Segoe UI", sans-serif;
    letter-spacing: -.04em;
    margin: 12px 0 18px
}

.aside-copy p {
    max-width: 45ch;
    color: oklch(.86 .015 240);
    font-size: 18px;
    line-height: 1.55
}

.field {
    margin-bottom: 18px
}

.field label {
    display: block;
    font-weight: 650;
    font-size: 14px;
    margin-bottom: 7px
}

.field input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--fg);
    background: var(--surface)
}

.field input:hover {
    border-color: oklch(.68 .04 240)
}

.field input[aria-invalid=true] {
    border-color: var(--danger)
}

.field-error {
    min-height: 19px;
    margin: 5px 0 0;
    color: var(--danger);
    font-size: 13px
}

.button {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--fg);
    padding: 10px 16px;
    font-weight: 700
}

.button:hover {
    background: oklch(.94 .008 240);
    border-color: oklch(.70 .03 240)
}

.button.primary {
    background: var(--fg);
    color: var(--surface);
    border-color: var(--fg);
    width: 100%
}

.button.primary:hover {
    background: oklch(.31 .02 250);
    color: var(--surface)
}

.button:disabled {
    cursor: not-allowed;
    opacity: .48
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--fg);
    padding: 10px 4px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px
}

.form-status {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border-radius: 6px;
    padding: 11px 12px;
    margin: 0 0 17px;
    font-size: 14px;
    line-height: 1.4
}

.form-status.error {
    background: oklch(.95 .035 28);
    color: oklch(.38 .15 28)
}

.form-status.success {
    background: oklch(.94 .035 155);
    color: oklch(.34 .10 155)
}

.switch-copy {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 18px 0 0
}

.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px
}

.user-chip {
    font-size: 14px;
    color: var(--muted)
}

.workspace {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr) 300px;
    min-height: calc(100vh - 64px)
}

.sidebar,
.review-panel {
    background: var(--surface);
    padding: 22px;
    border-right: 1px solid var(--border)
}

.review-panel {
    border-right: 0;
    border-left: 1px solid var(--border)
}

.batch-id {
    font: 600 17px/1.3 "IBM Plex Sans", "Segoe UI", sans-serif;
    margin: 5px 0 3px
}

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

.progress-line {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin: 8px 0 20px
}

.progress-line span {
    display: block;
    height: 100%;
    background: var(--accent);
    width: 40%;
    transition: width .2s
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border);
    border-radius: 7px;
    margin-bottom: 24px
}

.stat {
    padding: 12px
}

.stat+.stat {
    border-left: 1px solid var(--border)
}

.stat strong {
    display: block;
    font: 700 22px/1 "IBM Plex Sans", "Segoe UI", sans-serif
}

.stat span {
    color: var(--muted);
    font-size: 12px
}

.filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px
}

.filter-title h2 {
    font-size: 14px;
    margin: 0
}

.filter-count {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700
}

.filter-field {
    margin-bottom: 14px
}

.filter-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px
}

.filter-field input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 8px;
    background: var(--surface);
    color: var(--fg)
}

.range-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    min-height: 44px
}

.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent)
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px
}

.filter-actions .button {
    flex: 1;
    padding-inline: 8px
}

.canvas {
    padding: 22px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 15px
}

.canvas-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px
}

.position {
    font: 650 22px/1.15 "IBM Plex Sans", "Segoe UI", sans-serif;
    margin: 2px 0 5px
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: var(--muted);
    font-size: 13px
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 7px 10px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 700
}

.status-pill:before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted)
}

.status-pill.yes:before {
    background: var(--success)
}

.status-pill.no:before {
    background: var(--danger)
}

.image-stage {
    position: relative;
    min-height: 0;
    flex: 1;
    display: grid;
    place-items: center;
    background: oklch(77.547% 0.00116 201.341);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow)
}

.image-stage img {
    display: block;
    aspect-ratio: 1;
    width:400px;
    height: auto;
}

.detection-box {
    position: absolute;
    left: 52%;
    top: 33%;
    width: 18%;
    height: 22%;
    border: 2px solid oklch(.82 .16 93);
    box-shadow: 0 0 0 1px oklch(.15 .02 250/.6)
}

.detection-label {
    position: absolute;
    left: 52%;
    top: calc(33% - 29px);
    background: oklch(.18 .02 250/.92);
    color: white;
    padding: 5px 8px;
    font: 600 11px/1.2 "IBM Plex Mono", Consolas, monospace;
    border-radius: 4px
}

.image-caption {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    gap: 12px
}

.panel-title {
    font: 650 18px/1.2 "IBM Plex Sans", "Segoe UI", sans-serif;
    margin: 0 0 8px
}

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

.decision-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.decision {
    min-height: 78px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    font-weight: 700;
    font-size: 16px
}

.decision small {
    display: block;
    color: var(--muted);
    font: 500 11px/1.2 "IBM Plex Mono", Consolas, monospace;
    margin-top: 5px
}

.decision:hover {
    border-color: var(--fg);
    background: oklch(.95 .008 240)
}

.decision.yes.active {
    background: oklch(.93 .045 155);
    border-color: var(--success)
}

.decision.no.active {
    background: oklch(.94 .04 28);
    border-color: var(--danger)
}

.save-status {
    min-height: 54px;
    margin: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px
}

.save-status.error {
    color: var(--danger)
}

.save-status.success {
    color: var(--success)
}

.retry {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: underline;
    font-weight: 700
}

.nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.shortcut-list {
    margin-top: 22px
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 9px 0;
    font-size: 13px
}

.key {
    font-family: "IBM Plex Mono", Consolas, monospace;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--bg);
    padding: 2px 6px;
    font-size: 11px
}

.empty {
    display: grid;
    place-items: center;
    text-align: center;
    height: 100%;
    padding: 40px
}

.empty h2 {
    font: 650 25px/1.2 "IBM Plex Sans", "Segoe UI", sans-serif;
    margin: 0 0 8px
}

.empty p {
    color: var(--muted);
    max-width: 42ch
}

.mobile-filters {
    display: none
}

@media(max-width:1050px) {
    .workspace {
        grid-template-columns: 220px minmax(0, 1fr)
    }

    .review-panel {
        grid-column: 1/-1;
        border-left: 0;
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: 1fr 1.2fr 1fr;
        gap: 22px
    }

    .review-panel .instruction {
        margin-bottom: 0
    }

    .shortcut-list {
        margin-top: 0
    }

}

@media(max-width:760px) {
    .auth {
        display: block
    }

    .auth-panel {
        min-height: 100vh;
        padding: 24px
    }

    .auth-aside {
        display: none
    }

    .workspace {
        display: block
    }

    .sidebar {
        display: none
    }

    .topbar {
        padding: 0 16px
    }

    .user-chip {
        display: none
    }

    .canvas {
        padding: 16px;
        min-height: calc(100vh - 64px)
    }

    .canvas-head {
        display: block
    }

    .status-pill {
        margin-top: 10px
    }

    .image-stage {
        min-height: 360px
    }

    .review-panel {
        display: block;
        padding: 16px
    }

    .review-panel .instruction {
        margin-bottom: 15px
    }

    .shortcut-list {
        display: none
    }

    .mobile-filters {
        display: inline-flex
    }

    .image-caption {
        display: block
    }

    .image-caption span {
        display: block;
        margin-top: 4px
    }
}

@media(max-width:420px) {
    .canvas-head .meta {
        display: grid;
        grid-template-columns: 1fr
    }

    .image-stage {
        min-height: 300px
    }

    .decision {
        min-height: 70px
    }

    .topbar-actions {
        gap: 8px
    }

    .button {
        padding-inline: 12px
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important
    }
}

/* Server-rendered integration details. */
a {
    color: inherit
}

a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none
}

.topbar .brand {
    text-decoration: none
}

.topbar form {
    margin: 0
}

.image-stage {
    margin: 0;
    min-height: 420px
}

.image-stage img {
    object-fit: contain
}

.sidebar {
    overflow: auto
}

.sidebar .filter-title:first-child {
    margin-bottom: 0
}

.sidebar .filter-title:first-child h2 {
    margin-bottom: 0
}

.sidebar #filter-close {
    display: none
}

.filter-actions {
    align-items: stretch
}

.filter-actions .button {
    min-width: 0
}

.field-error:empty {
    display: none
}

.auth-panel header .button {
    text-decoration: none
}

.form-status {
    max-width: 100%
}

@media(max-width:760px) {
    .sidebar.is-open {
        display: block;
        position: fixed;
        inset: 64px 0 0;
        z-index: 9;
        overflow: auto;
        box-shadow: var(--shadow)
    }

    .sidebar #filter-close {
        display: inline-flex
    }

    .image-stage {
        min-height: 330px
    }

    .review-panel {
        display: block
    }
}

.image-comparison {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
    align-items: start;
}

.spectral-image {
    min-width: 0;
    margin: 0;
}

.spectral-image .image-stage {
    min-height: 0;
    aspect-ratio: 1;
}

.image-comparison .image-stage img {
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: contain;
}

.spectral-image figcaption {
    margin-top: 8px;
    color: var(--muted);
    font: 600 12px/1.4 "IBM Plex Mono", Consolas, monospace;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 900px) {
    .image-comparison {
        grid-template-columns: 1fr;
    }
}

.image-stage [hidden] {
    display: none;
}

.nir-unavailable {
    max-width: 280px;
    margin: 0;
    padding: 24px;
    color: var(--muted);
    font: 600 14px/1.5 "IBM Plex Mono", Consolas, monospace;
    text-align: center;
}