:root {
    color-scheme: light;
    --page: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef6f2;
    --ink: #17202c;
    --muted: #5f6b7a;
    --line: #dce3ec;
    --accent: #176f66;
    --accent-dark: #0d4f49;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.hero {
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2.25rem, 6vw, 4.75rem);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 1.15rem;
}

h3 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.intro {
    max-width: 760px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 1.04rem;
}

.security-note {
    max-width: 920px;
    margin-bottom: 0;
    padding: 12px 14px;
    border: 1px solid #b9decf;
    background: var(--surface-soft);
    color: #164b3b;
    border-radius: 8px;
    font-size: 0.94rem;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.input-panel,
.result-panel {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.input-panel {
    position: sticky;
    top: 18px;
    padding: 18px;
}

.result-panel {
    min-height: 540px;
    padding: 18px;
}

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

.limit-badge,
.status-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 9px;
    background: #dff5ef;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.status-pill.muted {
    background: #eef1f5;
    color: var(--muted);
}

.field,
.field-grid {
    display: grid;
    gap: 7px;
}

.field {
    margin-bottom: 14px;
}

.field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 10px;
}

.field span {
    color: #344256;
    font-size: 0.84rem;
    font-weight: 750;
}

.check-field {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 2px 0 12px;
    color: #344256;
    font-size: 0.88rem;
    font-weight: 750;
}

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

.sweep-settings {
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.sweep-settings summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-size: 0.86rem;
    font-weight: 800;
}

.sweep-settings[open] summary {
    margin-bottom: 12px;
}

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

.sweep-note {
    margin-top: 0;
}

input[type="file"],
input[type="number"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5df;
    border-radius: 6px;
    background: #fbfcfe;
    color: var(--ink);
    font: inherit;
}

input[type="file"] {
    padding: 9px;
}

input[type="number"] {
    padding: 8px 10px;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(23, 111, 102, 0.16);
}

.primary-action {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 850;
    cursor: pointer;
}

.primary-action:hover {
    background: var(--accent-dark);
}

.primary-action:disabled {
    cursor: wait;
    opacity: 0.72;
}

.processing-message {
    display: none;
    margin: 12px 0 0;
    color: var(--accent-dark);
    font-size: 0.9rem;
}

.processing-message.is-visible {
    display: block;
}

.message {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 6px;
    font-size: 0.92rem;
}

.error {
    border: 1px solid #f6b0aa;
    background: var(--danger-bg);
    color: var(--danger);
}

.small-print {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.79rem;
}

.imaging-note {
    margin: 12px 0 0;
    padding: 9px 10px;
    border-radius: 6px;
    background: #f2f7f6;
    color: var(--accent-dark);
    font-size: 0.82rem;
    font-weight: 700;
}

.project-link {
    margin: 8px 0 0;
    font-size: 0.82rem;
}

.project-link a {
    color: var(--accent);
    font-weight: 750;
}

.meta-strip {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.meta-strip span {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafbfc;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.88rem;
}

.meta-strip strong {
    display: block;
    color: var(--ink);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.primary-image {
    max-width: 780px;
    margin: 0 auto 18px;
}

.metric-explainer {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    background: #f4f8f7;
    color: var(--muted);
    font-size: 0.9rem;
}

.artifact-downloads {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.artifact-downloads h3,
.artifact-downloads p {
    margin: 0 0 8px;
}

.artifact-downloads div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.artifact-downloads a {
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-weight: 750;
    text-decoration: none;
}

.zoom-grid {
    align-items: start;
}

.secondary-heading {
    margin: 24px 0 10px;
}

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

figure {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    overflow: hidden;
}

figure img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: white;
}

figcaption {
    border-top: 1px solid var(--line);
    padding: 8px 10px;
    color: #344256;
    font-size: 0.88rem;
    font-weight: 750;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.summary-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
}

dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #edf1f5;
    padding-bottom: 7px;
}

dl div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
    color: var(--ink);
    font-weight: 780;
    text-align: right;
}

.raw-metric {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.contour-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    border-bottom: 1px solid #edf1f5;
    padding: 8px;
    text-align: right;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: left;
}

th {
    color: #344256;
    font-size: 0.78rem;
}

.empty-state {
    display: grid;
    min-height: 440px;
    place-content: center;
    border: 1px dashed #cbd5df;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.empty-state p {
    max-width: 440px;
    margin-bottom: 0;
    color: var(--muted);
}

@media (max-width: 900px) {
    .workspace,
    .summary-grid,
    .image-grid,
    .supporting-grid,
    .meta-strip {
        grid-template-columns: 1fr;
    }

    .input-panel {
        position: static;
    }
}

@media (max-width: 520px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 20px;
    }

    .field-grid,
    .field-grid.three-columns {
        grid-template-columns: 1fr;
    }

    .input-panel,
    .result-panel {
        padding: 14px;
    }
}

/* Shared sizing for calibrated and aerial-only review figures. */
.result-panel { min-width: 0; }
.result-panel figure { margin: 18px 0; }
.result-panel img { display: block; max-width: 100%; height: auto; }
.artifact-downloads { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
