* { box-sizing: border-box; }

/* `.screen { display: flex }` below would otherwise win the cascade
   over the browser's default `[hidden]{display:none}` rule (author
   styles beat the user-agent stylesheet at equal specificity) — this
   makes `hidden` actually hide things. */
[hidden] { display: none !important; }

:root {
    --ink: #1C1512;
    --paper: #FBF6EF;
    /* Fallback values — index.php overrides these three from config.php
       so a business can retint without touching this file. */
    --accent: #FF5A36;
    --accent-2: #2B3A9F;
    --highlight: #FFD23F;
    --green: #1F9D6F;
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--paper);
    font-family: 'Manrope', system-ui, sans-serif;
    color: var(--ink);
    /* Kiosk display: no accidental text selection, no overscroll bounce */
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}

.kiosk {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}
/* Faint dot texture, matches the approved mockup — subtle, never behind text. */
.kiosk::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .05;
    background-image: radial-gradient(circle, var(--ink) 1px, transparent 1px);
    background-size: 6px 6px;
    z-index: 0;
}

/* -- header -- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(10px, 2vh, 18px) clamp(18px, 3vw, 32px);
    border-bottom: 4px solid var(--ink);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--accent);
    border: 3px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 0 var(--ink);
    transform: rotate(-4deg);
}
.business-name { font-family: 'Bricolage Grotesque', sans-serif; font-size: 18px; font-weight: 800; line-height: 1.1; }
.business-sub { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); margin-top: 1px; }
.pkg-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 999px;
    padding: 8px 14px 8px 10px;
    font-weight: 800;
    font-size: 12.5px;
}
.pkg-badge span {
    background: var(--highlight);
    color: var(--ink);
    border-radius: 999px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
}

/* -- stage -- */
.stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 28px) clamp(24px, 5vw, 60px);
    position: relative;
    min-height: 0;
    z-index: 1;
}

.error-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #fdf1ef;
    border: 2px solid #eab7ac;
    color: #8a3a26;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    z-index: 3;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(14px, 2.5vh, 24px);
    max-width: 900px;
    text-align: center;
}
/* Landscape screens lay their content out as a row (icon beside text,
   or content beside actions) instead of stacking everything vertically —
   there's width to spare and very little height on a wide kiosk screen. */
.screen-row {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 5vw, 56px);
    text-align: left;
    max-width: 1100px;
    width: 100%;
}

/* -- idle -- */
.scan-icon-wrap {
    flex: none;
    width: clamp(96px, 14vh, 150px);
    height: clamp(96px, 14vh, 150px);
    border-radius: 26px;
    background: var(--accent-2);
    border: 4px solid var(--ink);
    box-shadow: 8px 8px 0 var(--ink);
    transform: rotate(-3deg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.idle-text { max-width: 480px; }
h1 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: clamp(22px, 3.6vh, 34px);
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0 0 8px;
    line-height: 1.1;
}
.sub { font-size: clamp(13px, 1.9vh, 16px); color: #5b5049; font-weight: 600; line-height: 1.45; margin: 0; }

.idle-escape {
    display: flex;
    align-items: center;
    gap: clamp(20px, 3vw, 40px);
    flex: none;
}
.idle-escape-divider {
    width: 3px;
    align-self: stretch;
    background: var(--ink);
    opacity: .15;
}
.idle-escape-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 220px; }
.idle-escape-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #8a7f76; }
.btn-escape {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 14px;
    border: 2.5px dashed var(--ink);
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    background: #fff;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-escape:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* -- confirmed -- */
.left-col { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 420px; }
.check-icon {
    flex: none;
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--green);
    border: 4px solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
    display: flex; align-items: center; justify-content: center;
}
.check-icon-lg { width: 96px; height: 96px; box-shadow: 7px 7px 0 var(--ink); }
.tracking-pill {
    font-family: 'Manrope', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .03em;
    color: var(--ink);
    background: #fff;
    display: inline-block;
    padding: 9px 16px;
    border: 3px solid var(--ink);
    border-radius: 10px;
    box-shadow: 4px 4px 0 var(--accent-2);
    transform: rotate(1deg);
}
.question { font-size: 15px; font-weight: 700; margin: 0; }
.button-col { display: flex; flex-direction: column; gap: 12px; width: 300px; flex: none; }

.btn {
    font-family: inherit;
    border: 3px solid var(--ink);
    cursor: pointer;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.btn-secondary { background: #fff; color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.btn-outline { background: transparent; border: 3px solid var(--ink); color: var(--ink); padding: 11px 22px; font-size: 13.5px; box-shadow: none; }

/* -- receipt / label -- */
.label-card {
    width: min(400px, 40vw);
    background: white;
    border: 3px solid var(--ink);
    border-radius: 6px;
    padding: 20px 22px 16px;
    box-shadow: 7px 7px 0 var(--accent-2);
    display: flex;
    flex-direction: column;
    position: relative;
    flex: none;
}
.label-card::before, .label-card::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 14px;
    background-image: radial-gradient(circle at 10px 50%, var(--paper) 7px, transparent 7.5px);
    background-size: 20px 14px;
    background-repeat: repeat-x;
}
.label-card::before { top: -8px; }
.label-card::after { bottom: -8px; transform: rotate(180deg); }

.label-header { margin-bottom: 12px; }
.label-business { font-family: 'Bricolage Grotesque', sans-serif; font-size: 19px; font-weight: 800; }
.label-subtitle { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); margin-top: 2px; }
.label-timestamp { font-size: 10.5px; font-weight: 700; color: #8a7f76; margin-top: 5px; }
.label-rows {
    border-top: 2.5px dashed var(--ink);
    border-bottom: 2.5px dashed var(--ink);
    opacity: 1;
    padding: 12px 0;
    margin-bottom: 12px;
    max-height: 160px;
    overflow-y: auto;
}
.label-row { font-family: monospace; font-size: 13px; font-weight: 700; padding: 4px 0; display: flex; justify-content: space-between; }
.label-row span:first-child { color: #5b5049; }
.label-total { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 800; margin-bottom: 6px; padding-top: 4px; }
.label-total span:last-child {
    background: var(--highlight);
    border: 2.5px solid var(--ink);
    border-radius: 8px;
    padding: 1px 10px;
}
.label-footer { font-size: 10.5px; font-weight: 700; color: #8a7f76; text-align: left; line-height: 1.4; margin-top: 6px; }

.receipt-actions { display: flex; flex-direction: column; gap: 12px; width: min(280px, 30vw); flex: none; }
.btn-print {
    font-family: inherit;
    font-weight: 800;
    font-size: 16px;
    border: 3px solid var(--ink);
    border-radius: 16px;
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent-2);
    color: var(--paper);
    box-shadow: 6px 6px 0 var(--ink);
}
.btn-print:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-no-receipt {
    font-family: inherit;
    font-weight: 700;
    font-size: 13.5px;
    border: 2.5px solid var(--ink);
    border-radius: 14px;
    padding: 11px 16px;
    cursor: pointer;
    background: transparent;
    color: var(--ink);
}
.btn-no-receipt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* -- printing -- */
.spinner {
    width: 56px; height: 56px; border-radius: 50%;
    border: 6px solid #e7ded4;
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.reset-note { font-size: 12px; font-weight: 800; color: #8a7f76; margin: -6px 0 0; text-transform: uppercase; letter-spacing: .04em; }

/* -- footer -- */
.footbar {
    text-align: center;
    padding: clamp(8px, 1.6vh, 13px);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--paper);
    background: var(--ink);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* The scanner-capture input: functionally invisible, but focusable and
   never `display:none` (a scanner "typing" into a hidden field with
   display:none can't receive focus in some browsers). */
#scanner-input {
    position: absolute;
    opacity: 0;
    height: 1px;
    width: 1px;
    padding: 0;
    border: none;
    pointer-events: none;
}
