:root {
    --fernlea-green: #9dbd76;
    --fernlea-green-dark: #58763b;
    --fernlea-green-deep: #365221;
    --success-green: #22a05a;
    --page-background: #f3f5f1;
    --surface: #ffffff;
    --text: #172012;
    --muted: #63705d;
    --border: #dbe2d6;
    --danger: #b42318;
    --focus: rgba(88, 118, 59, 0.24);
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: var(--page-background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.site-header {
    position: relative;
    z-index: 10;
}

.fernlea-navbar {
    min-height: 68px;
    padding: 0.65rem 0;
    background-color: var(--fernlea-green);
    border-bottom: 1px solid rgba(23, 32, 18, 0.12);
    box-shadow: 0 2px 12px rgba(35, 52, 24, 0.12);
}

.checkin-navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.fernlea-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0;
    color: #15200f;
    font-size: 1rem;
    font-weight: 750;
    text-decoration: none;
}

.fernlea-brand:hover,
.fernlea-brand:focus {
    color: #15200f;
}

.fernlea-brand img {
    width: auto;
    max-width: 128px;
    object-fit: contain;
}

.driver-welcome {
    min-width: 0;
    max-width: 44vw;
    overflow: hidden;
    color: #1c2b13;
    font-size: 0.92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-main {
    flex: 1;
}

.site-footer {
    padding: 1rem 0 1.4rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.checkin-page,
.success-page {
    padding: 1.25rem 0 0.5rem;
}

.checkin-container {
    max-width: 720px;
}

.checkin-card,
.success-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(70, 89, 58, 0.13);
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(42, 57, 32, 0.09);
}

.checkin-heading {
    padding: 1.4rem 1.25rem 1.25rem;
    background: #f8faf6;
    border-bottom: 1px solid var(--border);
}

.eyebrow,
.success-kicker {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--fernlea-green-dark);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.checkin-heading h1,
.success-card h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.75rem, 7vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.checkin-heading p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.checkin-form {
    padding: 1.25rem;
}

.route-section,
.profile-section {
    margin-bottom: 1.6rem;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.section-heading p {
    margin: 0.1rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.step-number {
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #233516;
    background: #9dbd76;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 850;
}

.route-input {
    height: 64px;
    padding: 0.5rem 1rem;
    border: 2px solid #c9d3c3;
    border-radius: 14px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    line-height: 1;
    text-align: center;
}

.route-input::placeholder {
    color: #b8c0b4;
    opacity: 1;
}

.form-field {
    padding: 1rem;
    background: #fbfcfa;
    border: 1px solid var(--border);
    border-radius: 15px;
}

.form-label {
    margin-bottom: 0.4rem;
    color: #273220;
    font-size: 0.86rem;
    font-weight: 750;
}

.form-control {
    min-height: 50px;
    border: 1.5px solid #bfc9ba;
    border-radius: 11px;
    color: var(--text);
    font-size: 1rem;
}

    .form-control:focus {
        border-color: var(--fernlea-green-dark);
        box-shadow: 0 0 0 0.22rem #9dbd76;
    }

.form-control.input-validation-error {
    border-color: var(--danger);
}

.file-input {
    padding-top: 0.72rem;
}

.file-input::file-selector-button {
    margin: -0.72rem 0.8rem -0.72rem -0.75rem;
    padding: 0.85rem 0.9rem;
    color: #26351d;
    background: #9dbd76;
    border: 0;
    border-right: 1px solid #cbd5c5;
    font-weight: 750;
}

.field-help,
.file-feedback {
    display: block;
    margin-top: 0.38rem;
    color: var(--muted);
    font-size: 0.77rem;
}

.field-validation,
.field-validation-error {
    display: block;
    margin-top: 0.35rem;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 650;
}

.field-validation-valid,
.validation-summary-valid {
    display: none;
}

.validation-summary {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    color: #7a271a;
    background: #fff1ef;
    border: 1px solid #f4b4ab;
    border-radius: 12px;
    font-size: 0.88rem;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.profile-fields {
    display: grid;
    gap: 0.8rem;
}

.completed-field {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem;
    background: #f8fbf5;
    border: 1px solid #d6e3cd;
    border-radius: 15px;
}

.completed-content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.completion-check {
    flex: 0 0 2.15rem;
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--success-green);
    border-radius: 50%;
    box-shadow: 0 5px 12px rgba(34, 160, 90, 0.22);
    font-size: 1.15rem;
    font-weight: 900;
    animation: completion-pop 0.42s ease-out both;
    animation-delay: calc(var(--completion-order) * 90ms + 80ms);
}

.completed-copy {
    min-width: 0;
    display: block;
}

.completed-copy strong {
    display: block;
    overflow: hidden;
    color: #233019;
    font-size: 0.96rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.completed-label {
    display: block;
    margin-bottom: 0.08rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.edit-panel {
    position: static;
}

.edit-panel summary {
    padding: 0.45rem 0.65rem;
    color: var(--fernlea-green-deep);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 800;
    list-style: none;
    transition: background-color 0.18s ease;
}

.edit-panel summary::-webkit-details-marker {
    display: none;
}

.edit-panel summary:hover,
.edit-panel summary:focus-visible {
    background: #e6efdf;
    outline: none;
}

.editor-content {
    grid-column: 1 / -1;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #dce5d6;
}

.edit-panel[open] {
    grid-column: 1 / -1;
}

.edit-panel[open] summary {
    position: absolute;
    top: 0.95rem;
    right: 0.95rem;
}

.cancel-edit {
    margin-top: 0.65rem;
    padding: 0.35rem 0;
    color: #596653;
    background: transparent;
    border: 0;
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.checkin-button,
.done-button {
    width: 100%;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.85rem 1.25rem;
    color: #14200d;
    background: var(--fernlea-green);
    border: 1px solid #86a861;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(83, 113, 56, 0.18);
    font-size: 1.05rem;
    font-weight: 850;
    text-align: center;
    text-decoration: none;
    transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.checkin-button:hover,
.done-button:hover {
    color: #14200d;
    background: #90b467;
    box-shadow: 0 10px 22px rgba(83, 113, 56, 0.24);
    transform: translateY(-1px);
}

.checkin-button:focus-visible,
.done-button:focus-visible {
    outline: 3px solid rgba(54, 82, 33, 0.35);
    outline-offset: 3px;
}

.checkin-button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.button-spinner {
    width: 1rem;
    height: 1rem;
    display: none;
    border: 2px solid rgba(20, 32, 13, 0.25);
    border-top-color: #14200d;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.button-spinner.is-visible {
    display: inline-block;
}

.success-container {
    max-width: 620px;
}

.success-card {
    padding: 2rem 1.25rem 1.4rem;
    text-align: center;
}

.success-icon {
    width: 5.25rem;
    height: 5.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: #fff;
    background: var(--success-green);
    border: 7px solid #dff5e8;
    border-radius: 50%;
    box-shadow: 0 12px 28px rgba(34, 160, 90, 0.24);
    font-size: 2.6rem;
    font-weight: 900;
    animation: success-arrive 0.5s ease-out both;
}

.success-kicker {
    margin-bottom: 0.45rem;
}

.success-message {
    max-width: 460px;
    margin: 0.75rem auto 1.5rem;
    color: var(--muted);
    line-height: 1.55;
}

.warehouse-instructions {
    margin-bottom: 1.5rem;
    padding: 1rem;
    color: #3f4d38;
    background: #f6f8f3;
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: left;
}

.warehouse-instructions h2 {
    margin: 0 0 0.45rem;
    color: #26331e;
    font-size: 0.92rem;
    font-weight: 800;
}

.warehouse-instructions p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.55;
}

@keyframes completion-pop {
    0% {
        opacity: 0;
        transform: scale(0.65);
    }
    70% {
        transform: scale(1.08);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes success-arrive {
    from {
        opacity: 0;
        transform: scale(0.72) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

@media (min-width: 576px) {
    .checkin-page,
    .success-page {
        padding-top: 2rem;
    }

    .checkin-heading,
    .checkin-form {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .success-card {
        padding: 2.6rem 2.4rem 2rem;
    }
}

@media (max-width: 420px) {
    .fernlea-brand span {
        display: none;
    }

    .driver-welcome {
        max-width: 54vw;
    }

    .checkin-card,
    .success-card {
        border-radius: 18px;
    }

    .completed-field {
        gap: 0.4rem;
    }

    .completion-check {
        flex-basis: 1.9rem;
        width: 1.9rem;
        height: 1.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
