:root {
    --brand: #00843d;
    --brand-dark: #006a31;
    --text: #1d2327;
    --muted: #5f6b73;
    --border: #d5dbdf;
    --bg: #ffffff;
    --surface: #f5f7f8;
    --error: #b42318;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.shop { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 1.6rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin-bottom: 16px; }
.grid .wide { grid-column: span 2; }
@media (max-width: 520px) {
    .grid { grid-template-columns: 1fr; }
    .grid .wide { grid-column: auto; }
}

label { display: flex; flex-direction: column; gap: 4px; }
label > span { font-size: .875rem; font-weight: 600; }
input, select {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); font-size: .8125rem; }

fieldset { border: 0; border-top: 1px solid var(--border); padding: 16px 0 0; margin: 0 0 24px; }
legend { font-weight: 700; font-size: 1.1rem; padding-right: 8px; }

.check { flex-direction: row; align-items: flex-start; gap: 10px; margin: 8px 0; }
.check > span { font-weight: 400; font-size: 1rem; }
.check input { margin-top: 4px; padding: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: center; margin: 8px 0 16px; }
.choices-label { font-weight: 600; font-size: .875rem; width: 100%; }

.billing-fields, .sepa-fields { margin-top: 12px; }
form:has(#billing_same:checked) .billing-fields { display: none; }
form:not(:has(#pay_sepa:checked)) .sepa-fields { display: none; }

.products { display: grid; gap: 12px; margin-bottom: 24px; }
.product {
    flex-direction: row;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}
.product:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.product input { margin-top: 4px; }
.product-body { display: flex; flex-direction: column; gap: 4px; }
.product-name { font-weight: 700; font-size: 1.1rem; }
.product-desc { color: var(--muted); font-size: .9375rem; }
.product-price { font-weight: 700; color: var(--brand-dark); }

.summary { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; display: grid; gap: 8px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.summary span { color: var(--muted); }

.alert { background: #fdecea; color: var(--error); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.btn {
    display: inline-block;
    font: inherit;
    font-weight: 700;
    padding: 12px 24px;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--brand-dark); text-decoration: underline; cursor: pointer; }
.inline { margin-top: 16px; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.footer { max-width: 720px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 16px; font-size: .8125rem; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }

[hidden] { display: none !important; }

.btn-secondary { background: var(--bg); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--border); }
.btn-secondary:hover { background: var(--surface); }
.btn:disabled { opacity: .7; cursor: progress; }

.address-search { display: flex; flex-direction: column; align-items: flex-start; }
.combobox { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; width: 100%; }
.combobox > label { font-size: .875rem; font-weight: 600; }
.combobox-field { position: relative; }
.combobox input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 44px;
    font-size: 1.0625rem;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
.combobox input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 132, 61, .18); }
.combobox input[aria-expanded="true"] { border-color: var(--brand); }
.combobox-icon {
    position: absolute;
    left: 14px;
    top: 26px;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    fill: var(--muted);
    pointer-events: none;
}
.combobox-field:focus-within .combobox-icon { fill: var(--brand); }
.clear {
    position: absolute;
    right: 4px;
    top: 26px;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    padding: 12px;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}
.clear svg { display: block; width: 20px; height: 20px; fill: var(--muted); }
.clear:hover svg { fill: var(--text); }
.spinner {
    position: absolute;
    right: 16px;
    top: 26px;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    border: 2px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 10;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: drop .12s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.option + .option { margin-top: 2px; }
.option[aria-selected="true"] { background: var(--surface); }
.option:active { background: #e8f3ec; }
.option-icon { flex: none; width: 20px; height: 20px; fill: var(--muted); }
.option[aria-selected="true"] .option-icon { fill: var(--brand); }
.option-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.option-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-main mark { background: none; color: var(--brand-dark); font-weight: 800; }
.option-sub { font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-arrow { flex: none; font-size: 1.5rem; line-height: 1; color: var(--muted); }
.option-empty { padding: 12px; color: var(--muted); font-size: .9375rem; }
.hint { margin: 0; min-height: 1.2em; font-size: .8125rem; color: var(--muted); }

.choices-list { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0 0 20px; width: 100%; }
.choice {
    font: inherit;
    text-align: left;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}
button.choice:hover { border-color: var(--brand); background: var(--surface); }
.choice-street { color: var(--muted); cursor: default; }

.confirm {
    padding: 20px;
    border: 1px solid var(--brand);
    border-radius: 12px;
    background: #f3faf5;
    box-shadow: 0 0 0 3px rgba(0, 132, 61, .08);
    animation: drop .15s ease-out;
}
.confirm:focus { outline: none; }
.confirm-title { margin: 0 0 12px; font-weight: 700; font-size: 1.125rem; }
.confirm-address { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.confirm-address > span { display: flex; flex-direction: column; }
.confirm-icon { flex: none; width: 28px; height: 28px; fill: var(--brand); }
.confirm-street { font-size: 1.25rem; }
.confirm-city { color: var(--muted); }
.confirm-note { margin: 0 0 16px; font-size: .875rem; color: var(--muted); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 12px; }

@media (max-width: 639px) {
    .shop { padding: 16px 16px 24px; }
    h1 { font-size: 1.375rem; }
    .options { position: static; margin-top: 6px; max-height: none; box-shadow: 0 4px 16px rgba(16, 24, 40, .08); }
    .address-search > .btn, .confirm-actions .btn { width: 100%; text-align: center; min-height: 52px; }
    .confirm { padding: 16px; }
    .confirm-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .options, .confirm { animation: none; }
    .spinner { animation-duration: 2s; }
}
