:root {
    --cream: #f8f3ea;
    --blue: #2457e6;
    --orange: #f4a261;
    --navy: #17213a;
    --muted: #687188;
    --pale: #e7edff;
    --line: #e9e5dd;
    --green: #16854a;
    --red: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--cream);
    color: var(--navy);
}

body {
    font-family: Arial, sans-serif;
}

body.crop-modal-open {
    overflow: hidden;
    touch-action: none;
}

button,
input {
    font: inherit;
}

/*
 * Volledige appomgeving
 */

.app-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100svh;
    padding: 30px 20px;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 50% 30%,
            #fff,
            #fbf7f0 48%,
            #f6ecdd
        );
}

/*
 * Achtergronddecoratie
 */

.decor {
    position: absolute;
    width: 250px;
    height: 190px;
    border: 3px solid #f4a26118;
    border-radius: 32px;
}

.decor.left {
    left: -100px;
    bottom: 8%;
    transform: rotate(-18deg);
}

.decor.right {
    right: -100px;
    top: 12%;
    transform: rotate(12deg);
}

/*
 * Hoofdcontainer
 */

.phone-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, 430px);
    height: min(820px, calc(100svh - 40px));
    min-height: 650px;
    overflow: hidden;
    background: #fffffff7;
    border-radius: 32px;
    box-shadow: 0 22px 65px #49311124;
}

/*
 * Bovenbalk
 */

.topbar {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    flex-shrink: 0;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 10px solid var(--cream);
}

.back {
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.topbar i {
    color: var(--blue);
    font-style: normal;
}

.price-chip {
    width: max-content;
    justify-self: end;
    padding: 8px 11px;
    background: var(--pale);
    color: var(--blue);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

/*
 * Schermen
 */

.screen {
    position: relative;
    display: none;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 32px 28px 22px;
    animation: enter 0.22s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.screen.active::after {
    content: "";
    display: block;
    flex: 0 0 12px;
}

/*
 * Algemene typografie
 */

h2 {
    margin: 0 0 12px;
    font-size: 31px;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.lead,
.sub {
    color: var(--muted);
    line-height: 1.55;
}

.lead {
    margin: 0 auto 25px;
    font-size: 17px;
}

.sub {
    margin: 0 0 25px;
    font-size: 14px;
}

/*
 * Algemene knoppen
 */

.primary,
.secondary {
    width: 100%;
    min-height: 58px;
    padding: 15px 20px;
    border: 0;
    border-radius: 18px;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.primary {
    background:
        linear-gradient(
            135deg,
            #2862ef,
            var(--blue)
        );
    color: #fff;
    box-shadow: 0 10px 22px #2457e640;
}

.primary:disabled {
    background: #c6ccda;
    box-shadow: none;
    cursor: not-allowed;
}

.secondary {
    background: var(--pale);
    color: var(--blue);
}

.screen-action {
    margin-top: auto;
    padding-top: 22px;
}

/*
 * Naamveld
 */

.name-field {
    display: grid;
    gap: 8px;
    margin: 0;
}

.name-field > span {
    color: var(--navy);
    font-size: 16px;
    font-weight: 700;
}

.name-field input {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: var(--navy);
}

.name-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px #2457e61a;
}

.name-field input::placeholder {
    color: #a6abba;
}

.name-error {
    min-height: 15px;
    color: var(--red);
    font-size: 11px;
}

/*
 * Aantal labels
 */

.counter {
    display: grid;
    grid-template-columns: 58px 1fr 58px;
    align-items: center;
    margin: 15px 0;
    padding: 12px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 22px;
}

.counter button {
    height: 50px;
    border: 0;
    border-radius: 15px;
    background: #fff;
    color: var(--blue);
    font-size: 28px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.counter div {
    text-align: center;
}

.counter strong {
    display: block;
    font-size: 38px;
}

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

/*
 * Snelle aantalkeuze
 */

.quick-counts {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.quick-counts button {
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.quick-counts button.active {
    border-color: var(--blue);
    background: var(--pale);
    color: var(--blue);
}

/*
 * Prijsoverzicht
 */

.summary {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: #fbfaf7;
    border-radius: 15px;
}

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

/*
 * Betaalkeuzes
 */

.choices {
    display: grid;
    gap: 13px;
    margin: 20px 0;
}

.choices button {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.choices button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.choices small,
.choices strong {
    display: block;
}

.choices small {
    margin-top: 4px;
    color: var(--muted);
}

.choices i {
    font-size: 27px;
}

.choice-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.choice-icon.blue {
    background: #e7edff;
    color: var(--blue);
}

.choice-icon.orange {
    background: #e5f5e9;
    color: #e78327;
}

/*
 * Betaalmeldingen en fouten
 */

.notice {
    display: none;
    margin: 0;
    padding: 12px 14px;
    background: #fff4df;
    color: #8a551d;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.45;
}

.notice:not(:empty) {
    display: block;
}

.error {
    color: var(--red);
    font-size: 12px;
    text-align: center;
}

/*
 * Uploadscherm
 */

.upload {
    padding-top: 27px;
}

#upload-list {
    display: grid;
    gap: 9px;
    max-height: 345px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.upload-item {
    position: relative;
    display: grid;
    grid-template-columns: 43px minmax(0, 1fr) auto;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    padding: 12px;
    background: #fbfcff;
    border: 1px dashed #b9c3d8;
    border-radius: 17px;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}

.upload-item input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-item > b {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    background: var(--pale);
    color: var(--blue);
    border-radius: 13px;
}

.upload-item strong,
.upload-item small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.upload-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.upload-item i {
    color: var(--blue);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

/*
 * Upload voltooid
 */

.upload-item.complete {
    background: #f6fcf8;
    border-style: solid;
    border-color: #bfe6cf;
}

.upload-item.complete > b {
    background: #dff5e7;
    color: var(--green);
}

/*
 * Afbeelding wordt verwerkt
 */

.upload-item.processing {
    background: #f6f8ff;
    border-style: solid;
    border-color: #b8c7f5;
    cursor: wait;
}

.upload-item.processing > b {
    background: var(--pale);
    color: var(--blue);
    animation: processingPulse 1s ease-in-out infinite;
}

.upload-item.processing small {
    color: var(--blue);
}

/*
 * Verwerking mislukt
 */

.upload-item.failed {
    background: #fff7f6;
    border-style: solid;
    border-color: #f0c2bc;
}

.upload-item.failed > b {
    background: #ffebe8;
    color: var(--red);
}

.upload-item.failed small,
.upload-item.failed i {
    color: var(--red);
}

.upload-status {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/*
 * Voortgangsbalk
 */

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    flex-shrink: 0;
    padding: 12px 16px 10px 12px;
    background: #fff;
    border-top: 1px solid var(--cream);
}

.steps div {
    color: #afb5c0;
    text-align: center;
}

.steps b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: auto;
    background: #eff1f6;
    border-radius: 50%;
}

.steps small {
    display: block;
    margin-top: 5px;
    font-size: 10px;
}

.steps .current {
    color: var(--blue);
}

.steps .current b {
    background: var(--blue);
    color: #fff;
}

/*
 * Verzend- en bevestigingsschermen
 */

.center {
    align-items: center;
    justify-content: center;
    text-align: center !important;
}

.printing-icon,
.success {
    display: grid;
    place-items: center;
    width: 90px;
    height: 90px;
    margin: 0 auto 25px;
    background: var(--pale);
    color: var(--blue);
    border-radius: 26px;
    font-size: 38px;
}

.success {
    background: #dff5e7;
    color: var(--green);
    border-radius: 50%;
}

.receipt {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 24px;
    padding: 17px;
    background: #fbfaf7;
    border-radius: 15px;
    font-size: 12px;
    text-align: left;
}

.receipt strong {
    text-align: right;
}

/*
 * Handmatig uitsnijdvenster
 */

.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
    background: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.crop-modal[hidden] {
    display: none;
}

.crop-dialog {
    display: flex;
    flex-direction: column;
    width: min(920px, 100%);
    max-height: calc(100svh - 36px);
    overflow: hidden;
    background: #fff;
    border-radius: 26px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
    animation: cropDialogIn 0.22s ease;
}

.crop-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 20px;
    padding: 22px 24px 12px;
}

.crop-header small {
    display: block;
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.crop-header h2 {
    margin: 0;
    font-size: 25px;
}

.crop-close {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    color: var(--navy);
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.crop-description {
    flex-shrink: 0;
    margin: 0;
    padding: 0 24px 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.crop-stage {
    display: grid;
    place-items: center;
    flex: 1;
    min-height: 240px;
    margin: 0 24px;
    padding: 12px;
    overflow: auto;
    background:
        linear-gradient(
            45deg,
            #111827 25%,
            #182234 25%,
            #182234 50%,
            #111827 50%,
            #111827 75%,
            #182234 75%
        );
    background-size: 24px 24px;
    border-radius: 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#crop-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.crop-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 18px;
    padding: 14px 24px 0;
}

.crop-help span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.crop-help button {
    flex-shrink: 0;
    padding: 8px 11px;
    border: 0;
    border-radius: 10px;
    background: var(--pale);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.crop-actions {
    display: grid;
    grid-template-columns: minmax(130px, 0.65fr) minmax(190px, 1.35fr);
    flex-shrink: 0;
    gap: 12px;
    padding:
        10px
        24px
        max(24px, env(safe-area-inset-bottom));
}

.crop-actions .primary,
.crop-actions .secondary {
    min-height: 54px;
}

/*
 * Animaties
 */

@keyframes enter {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes processingPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.94);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes cropDialogIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/*
 * Mobiele weergave
 */

@media (max-width: 520px) {
    .app-shell {
        padding: 0;
        background: #fff;
    }

    .decor {
        display: none;
    }

    .phone-card {
        width: 100%;
        height: 100svh;
        min-height: 0;
        max-height: 100svh;
        border-radius: 0;
        box-shadow: none;
    }

    .screen {
        padding-right: 24px;
        padding-left: 24px;
    }

    .crop-modal {
        padding: 0;
        background: #fff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .crop-dialog {
        width: 100%;
        height: 100svh;
        max-height: 100svh;
        border-radius: 0;
        box-shadow: none;
        animation: none;
    }

    .crop-header {
        padding:
            max(18px, env(safe-area-inset-top))
            18px
            10px;
    }

    .crop-header h2 {
        font-size: 23px;
    }

    .crop-description {
        padding: 0 18px 13px;
    }

    .crop-stage {
        min-height: 0;
        margin: 0 12px;
        padding: 8px;
        border-radius: 14px;
    }

    .crop-help {
        align-items: flex-start;
        padding: 12px 18px 0;
    }

    .crop-actions {
        grid-template-columns: 0.75fr 1.25fr;
        gap: 8px;
        padding:
            14px
            18px
            max(18px, env(safe-area-inset-bottom));
    }

    .crop-actions .primary,
    .crop-actions .secondary {
        min-height: 52px;
        padding-right: 10px;
        padding-left: 10px;
        font-size: 12px;
    }
}

/*
 * Erg smalle telefoons
 */

@media (max-width: 360px) {
    .crop-help {
        display: grid;
        gap: 8px;
    }

    .crop-help button {
        width: max-content;
    }

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

/*
 * Lage schermen
 */

@media (max-height: 720px) {
    .screen {
        padding-top: 24px;
    }

    .counter {
        margin: 8px 0;
    }

    .quick-counts {
        margin-bottom: 10px;
    }

    .crop-header {
        padding-top: 14px;
        padding-bottom: 8px;
    }

    .crop-description {
        padding-bottom: 10px;
    }

    .crop-help {
        padding-top: 9px;
    }

    .crop-actions {
        padding-top: 10px;
        padding-bottom: 14px;
    }
}

/*
 * Verminderde beweging
 */

@media (prefers-reduced-motion: reduce) {
    .screen,
    .crop-dialog,
    .upload-item.processing > b {
        animation: none;
    }
}