:root {
    color-scheme: light;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    --page-background: #eef2f6;
    --card-background: #ffffff;
    --heading-color: #18263a;
    --body-color: #536174;
    --muted-color: #718096;
    --accent-color: #2371a7;
    --accent-hover: #195c8b;
    --accent-soft: #e8f3fa;
    --border-color: #d9e0e8;
    --input-border: #bcc7d3;
    --error-color: #a12626;
    --success-color: #17683a;
    --shadow-color: rgb(24 38 58 / 10%);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    background: var(--page-background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--body-color);
    background: radial-gradient(circle at top, #ffffff 0, transparent 34rem), var(--page-background);
}

button,
input,
select {
    font: inherit;
}

.site-header {
    border-bottom: 1px solid var(--border-color);
    background: rgb(255 255 255 / 92%);
    box-shadow: 0 0.25rem 1.25rem var(--shadow-color);
}

.brand {
    display: flex;
    width: min(100%, 64rem);
    min-height: 5.5rem;
    align-items: center;
    gap: 1rem;
    margin: 0 auto;
    padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
}

.product-mark {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    flex: 0 0 auto;
    border-radius: 0.8rem;
    color: #ffffff;
    background: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    place-items: center;
}

.product-category {
    margin: 0 0 0.15rem;
    color: var(--accent-color);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--heading-color);
    font-size: 1.65rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.page-shell {
    display: grid;
    width: min(100%, 64rem);
    gap: 1.5rem;
    margin: 0 auto;
    padding: 2rem max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.card {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 1.1rem;
    background: var(--card-background);
    box-shadow: 0 1rem 2.5rem var(--shadow-color);
}

.hauler-card {
    position: relative;
    z-index: 2;
    overflow: visible;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hauler-card,
.capture-card,
.result-card {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.section-heading {
    margin-bottom: 1.5rem;
}

.section-heading h2 {
    margin: 0;
    color: var(--heading-color);
    font-size: clamp(1.35rem, 4vw, 1.8rem);
    line-height: 1.2;
}

.section-heading p {
    max-width: 42rem;
    margin: 0.5rem 0 0;
    line-height: 1.55;
}

.initial-selection-grid {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr);
    gap: 1rem;
    max-width: 48rem;
}

.hauler-combobox {
    position: relative;
}

.hauler-options {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.4rem);
    right: 0;
    left: 0;

    max-height: min(22rem, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;

    border: 1px solid var(--input-border);
    border-radius: 0.7rem;

    background: #ffffff;

    box-shadow: 0 0.75rem 2rem rgb(24 38 58 / 16%);

    scrollbar-width: thin;
}

.hauler-option {
    display: flex;
    width: 100%;
    min-height: 3rem;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--heading-color);
    background: #ffffff;
    font-size: 0.95rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.hauler-option:last-child {
    border-bottom: 0;
}

.hauler-option:hover,
.hauler-option:focus-visible {
    background: var(--accent-soft);
    outline: none;
}

.hauler-option:active {
    background: #dcecf7;
}

.hauler-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.selected-hauler-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.8rem;
    background: var(--accent-soft);
}

.selected-context-summary {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
}

.selected-hauler-summary {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.selected-hauler-summary strong {
    overflow-wrap: anywhere;
    color: var(--heading-color);
}

.selected-hauler-label {
    color: var(--accent-color);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.button-compact {
    min-height: 2.5rem;
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
}

.capture-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.button {
    display: inline-flex;
    min-height: 2.9rem;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        box-shadow 120ms ease,
        transform 120ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgb(35 113 167 / 24%);
    outline-offset: 2px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button-primary {
    color: #ffffff;
    background: var(--accent-color);
}

.button-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.button-secondary {
    color: var(--heading-color);
    border-color: var(--border-color);
    background: #ffffff;
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--input-border);
    background: #f6f8fa;
}

.preview-panel {
    margin-top: 1.25rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    background: #f6f8fa;
}

.photo-preview {
    display: block;
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    background: #dfe5eb;
}

.preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
}

.file-summary {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--muted-color);
    font-size: 0.9rem;
}

.process-button {
    flex: 0 0 auto;
}

.status-message {
    min-height: 1.5rem;
    margin: 1rem 0 0;
    font-weight: 650;
    line-height: 1.5;
}

.status-message[data-state="ready"] {
    color: var(--accent-color);
}

.status-message[data-state="success"] {
    color: var(--success-color);
}

.status-message[data-state="error"] {
    color: var(--error-color);
}

.status-message[data-state="loading"] {
    color: var(--accent-color);
}

.status-message[data-state="loading"]::before {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.55rem;
    border: 2px solid rgb(35 113 167 / 25%);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    content: "";
    animation: status-spin 700ms linear infinite;
}

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

.form-field {
    display: grid;
    gap: 0.4rem;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.form-field label {
    color: var(--heading-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.form-field input,
.form-field select {
    width: 100%;
    min-height: 2.8rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.6rem;
    color: var(--heading-color);
    background: #ffffff;
}

.form-field input:hover,
.form-field select:hover {
    border-color: #8fa0b1;
}

.form-field input[readonly],
.form-field input:disabled,
.form-field select:disabled {
    color: var(--muted-color);
    background: #f6f8fa;
}

.form-field select:disabled {
    cursor: not-allowed;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

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

@media (max-width: 40rem) {
    .page-shell {
        padding-top: 1rem;
    }

    .hauler-card,
    .capture-card,
    .result-card {
        border-radius: 0.9rem;
    }

    .initial-selection-grid {
        grid-template-columns: 1fr;
    }

    .selected-hauler-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .selected-context-summary {
        display: grid;
        gap: 0.75rem;
    }

    .button-compact {
        width: 100%;
    }

    .capture-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
    }

    .result-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .preview-footer {
        align-items: stretch;
        flex-direction: column;
    }

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

    .form-field-wide {
        grid-column: auto;
    }
    .hauler-options {
        max-height: min(20rem, 45vh);
        border-radius: 0.65rem;
    }

    .hauler-option {
        min-height: 3.25rem;
        padding: 0.8rem 0.9rem;
        font-size: 1rem;
    }
}
