:root {
    color-scheme: light;
    --red: #d61f26;
    --red-dark: #a9141a;
    --orange: #ff6000;
    --yellow: #ffd800;
    --yellow-soft: #fff4b8;
    --cream: #fff8dc;
    --ink: #211d1a;
    --muted: #716a63;
    --line: #ead8bd;
    --white: #fff;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(135deg, #fff8dc 0%, #ffd800 48%, #fff1a8 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, .72), transparent 18rem),
        radial-gradient(circle at 78% 16%, rgba(255, 96, 0, .18), transparent 20rem),
        radial-gradient(circle at 50% 88%, rgba(255, 255, 255, .82), transparent 28rem),
        linear-gradient(150deg, rgba(255, 246, 174, .98) 0%, rgba(255, 216, 0, .92) 44%, rgba(255, 248, 220, .98) 100%);
    content: "";
}

body::after {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(120deg, transparent 0 20%, rgba(255, 255, 255, .25) 20% 21%, transparent 21% 43%, rgba(214, 31, 38, .055) 43% 44%, transparent 44%),
        linear-gradient(rgba(148, 95, 0, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 95, 0, .055) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 248, 220, .74) 74%, rgba(255, 248, 220, .96));
    background-size: auto, 42px 42px, 42px 42px, auto;
    content: "";
    pointer-events: none;
}

button, input { font: inherit; }

.site-header {
    display: flex;
    justify-content: center;
    padding: 22px 20px 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 17px 10px 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 0;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 18px 42px rgba(140, 82, 0, .18);
    color: var(--ink);
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(87, 30, 5, .18));
}

.brand strong, .brand small { display: block; }
.brand strong { color: var(--red); font-family: Georgia, serif; font-size: 22px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.page {
    width: min(100% - 32px, 620px);
    margin: 34px auto 70px;
}

.intro { margin-bottom: 28px; text-align: center; }

.eyebrow {
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .65);
    text-transform: uppercase;
}

h1 {
    margin: 10px 0 12px;
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: clamp(38px, 8vw, 58px);
    font-weight: 600;
    letter-spacing: -.035em;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .45);
}

.intro p {
    width: min(100%, 520px);
    margin: 0 auto;
    color: rgba(33, 29, 26, .72);
    line-height: 1.6;
    text-shadow: none;
}

.search-card, .receipt {
    border: 1px solid rgba(148, 95, 0, .16);
    border-radius: 0;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 28px 80px rgba(140, 82, 0, .18);
    backdrop-filter: blur(14px);
}

.search-card { padding: clamp(24px, 6vw, 40px); }
.card-icon { color: var(--orange); font-size: 35px; line-height: 1; }
.search-card h2 { margin: 10px 0 5px; font-family: Georgia, serif; font-size: 25px; }
.hint, .privacy { color: var(--muted); font-size: 13px; }
.hint { margin: 0 0 24px; }

.alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid #efb9b9;
    border-radius: 0;
    background: #fff2f1;
    color: #8a2025;
    font-size: 14px;
    line-height: 1.45;
}

label {
    display: block;
    margin: 18px 0 7px;
    font-size: 13px;
    font-weight: 750;
}

input {
    width: 100%;
    min-height: 52px;
    padding: 0 15px;
    border: 1px solid #d8cec2;
    border-radius: 0;
    background: #fff;
    color: var(--ink);
    outline: 0;
}

input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 4px rgba(255, 96, 0, .14);
}

form button, .receipt-actions button {
    border: 0;
    border-radius: 0;
    background: linear-gradient(135deg, var(--red), var(--orange));
    color: white;
    cursor: pointer;
    font-weight: 800;
    box-shadow: 0 14px 25px rgba(214, 31, 38, .22);
}

form button {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding: 0 18px;
}

button:hover { background: linear-gradient(135deg, var(--red-dark), #e65000); }
.privacy { margin: 17px 0 0; text-align: center; }

.receipt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

.receipt-actions a { color: var(--ink); font-size: 14px; font-weight: 800; text-decoration: none; text-shadow: 0 1px 0 rgba(255, 255, 255, .65); }
.receipt-action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 6px;
    border: 1px solid rgba(148, 95, 0, .14);
    border-radius: 0;
    background: rgba(255, 255, 255, .32);
    box-shadow: 0 18px 38px rgba(140, 82, 0, .12);
    backdrop-filter: blur(10px);
}
.receipt-actions button, .download-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 0;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .01em;
    line-height: 1;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.receipt-actions button span, .download-button span {
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border-radius: 0;
    background: rgba(255, 255, 255, .18);
    font-size: 14px;
}
.download-button {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, var(--red), var(--orange));
    box-shadow: 0 12px 24px rgba(214, 31, 38, .24);
    color: #fff !important;
    text-shadow: none !important;
}
.download-button-secondary {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, #2f2a24, #8a622f);
    box-shadow: 0 12px 24px rgba(47, 42, 36, .2);
}
.receipt-actions button {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(255, 246, 229, .94));
    box-shadow: 0 12px 24px rgba(47, 42, 36, .14);
    color: var(--ink);
}
.download-button:hover, .receipt-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(47, 42, 36, .24);
}
.receipt { padding: clamp(25px, 7vw, 46px); }

.receipt-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    padding-bottom: 27px;
    text-align: left;
}

.receipt-logo {
    width: 70px;
    height: 70px;
}

.receipt-brand strong, .receipt-brand span { display: block; }
.receipt-brand strong { color: var(--red); font-family: Georgia, serif; font-size: 24px; }
.receipt-brand span { color: var(--muted); font-size: 12px; }

.receipt-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-block: 1px dashed var(--line);
}

.receipt-meta div { padding: 17px 8px; text-align: center; }
.receipt-meta span, .receipt-meta strong { display: block; }
.receipt-meta span { margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.receipt-meta strong { font-size: 14px; }
.merchant { padding: 25px 0; text-align: center; }
.merchant h2 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 20px; }
.merchant p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.products { border-top: 1px dashed var(--line); padding: 24px 0; }
.products h2 { margin: 0 0 14px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.product-line { padding: 6px 0; font-size: 14px; line-height: 1.45; }
.totals { border-block: 1px dashed var(--line); padding: 17px 0; }
.totals div, .payment { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; font-size: 13px; }
.grand-total { align-items: end; margin-top: 8px; padding-top: 14px !important; border-top: 1px solid var(--line); }
.grand-total strong:first-child { font-size: 16px; }
.grand-total strong:last-child { color: var(--red); font-family: Georgia, serif; font-size: 29px; }
.payment { padding: 20px 0; color: var(--muted); }
.payment strong { color: var(--ink); }
.card-receipt { margin-top: 8px; padding: 22px 0; border-top: 1px dashed var(--line); }
.card-receipt h2 { margin: 0 0 14px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.card-receipt pre { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.card-receipt-unavailable { margin: 0; padding: 16px 0; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.receipt-footer { padding-top: 24px; text-align: center; }
.receipt-footer p { margin: 0 0 14px; font-family: Georgia, serif; font-size: 17px; }
.receipt-footer small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.site-footer { padding: 0 20px 28px; color: rgba(33, 29, 26, .62); font-size: 11px; text-align: center; text-shadow: 0 1px 0 rgba(255, 255, 255, .65); }

@media (max-width: 480px) {
    .site-header { padding-top: 18px; }
    .page { margin-top: 22px; }
    .receipt-actions { align-items: stretch; flex-direction: column; }
    .receipt-action-buttons { flex-direction: column; }
    .receipt-actions button, .download-button { min-height: 44px; width: 100%; }
}

@media print {
    @page { margin: 10mm; size: A4; }
    body { background: white; }
    .site-header, .site-footer, .receipt-actions { display: none !important; }
    .page { width: 100%; margin: 0; }
    .receipt { max-width: 90mm; margin: 0 auto; border: 0; border-radius: 0; box-shadow: none; }
}
