/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* Warm cream canvas — the red brand color lives inside the
       container on specific elements (welcome hero, header, buttons)
       rather than drowning the whole viewport. */
    background: #faf7f2;
    min-height: 100vh;
    padding: 0;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    position: relative;
}

/* On desktop, add a soft shadow so the white card separates from the
   warm cream body. No width change — the app is designed as a
   phone/kiosk-style narrow column and that's intentional. */
@media (min-width: 768px) {
    .container {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
    }
}

/* Kiosk mode (Samsung KM24C, ?kiosk=1) gets a wider container — the
   24" touchscreen has plenty of real estate and a 600px column in
   the middle looks forlorn. Desktop browsers WITHOUT kiosk mode keep
   the original phone-column layout (same as phones) so they stay
   consistent with how customers actually use the app on their
   phones via QR. */
body.kiosk-mode .container {
    max-width: 1100px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;    /* for when .back-btn is an <a> */
    flex-shrink: 0;           /* never collapse on narrow viewports */
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.cart-badge {
    position: relative;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.cart-badge:hover {
    background: rgba(255,255,255,0.2);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #b8893a;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content */
.content {
    padding: 20px;
    padding-bottom: 80px;
}

/* ============================================================
   Welcome page — viewport-adaptive sizing
   ============================================================
   Sizes scale with the device's viewport height via clamp():
     clamp(MIN, PREFERRED_vh, MAX)
   - Short landscape phone → everything compresses, CTA stays visible
   - Tall portrait phone → comfortable
   - Tablet → medium-large
   - Desktop → MAX values (unchanged from previous desktop look)
   svh ("small viewport height") honours mobile browser chrome so
   content doesn't hide under the URL bar.
   No pixel breakpoints. The layout reads the viewport. */
.welcome-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;    /* fallback */
    min-height: 100svh;
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    width: 100%;
    padding: clamp(20px, 4vh, 50px) clamp(16px, 5vw, 32px);
    /* Gap between every child — logo/h1/tagline/pill/button/info */
    gap: clamp(8px, 1.8vh, 22px);
}

.logo {
    animation: fadeInDown 0.8s;
    margin: 0;       /* gap on .welcome-content handles spacing */
}

.brand-logo {
    display: block;
    /* Width scales with viewport HEIGHT so short landscape phones get
       a smaller logo and tall screens get a bigger one. Sized for the
       wide wordmark (~2.8:1) — wider clamp than a square logo would need. */
    width: clamp(180px, 36vh, 420px);
    max-width: 80%;  /* also clamp at 80% of available width so
                        narrow screens don't overflow */
    height: auto;
    margin: 0 auto;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* Dark-background variant (legacy, not used with current logo
   which already has its own dark background). */
.brand-logo-on-dark {
    filter: brightness(0) invert(1);
}

/* Identification page logo — smaller than welcome, slightly different
   rhythm since it sits between a header bar and a phone input. */
.identification-logo {
    margin: 0 auto;
}
.identification-logo .brand-logo {
    width: clamp(160px, 30vh, 360px);
}

/* Kiosk mode bumps both — the 24" touchscreen has room. */
body.kiosk-mode .brand-logo        { width: clamp(280px, 44vh, 560px); }
body.kiosk-mode .identification-logo .brand-logo { width: clamp(240px, 38vh, 460px); }

.welcome-content h1 {
    font-size: clamp(22px, 4vh, 32px);
    margin: 0;
    line-height: 1.2;
    animation: fadeInUp 0.8s 0.2s both;
}

.tagline {
    font-size: clamp(14px, 2.2vh, 18px);
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
    animation: fadeInUp 0.8s 0.3s both;
}

/* Feature icons row — stays in the DOM for desktop/kiosk where
   there's room. Hidden when viewport height is too short for
   everything to fit (uses aspect-ratio + height query). */
.features {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 400px;
    margin: 0;
    animation: fadeInUp 0.8s 0.4s both;
}
/* On short viewports — phones in portrait with the address bar
   up, or any landscape phone — hide the decorative features row
   so the CTA stays above the fold. 640px is a height threshold,
   not a width one: it triggers based on how much room the device
   actually gives us. */
@media (max-height: 640px) {
    .features { display: none; }
}

.feature-item {
    text-align: center;
}

.feature-icon {
    font-size: clamp(24px, 4vh, 40px);
    margin-bottom: clamp(4px, 0.8vh, 10px);
}

.feature-text {
    font-size: clamp(11px, 1.6vh, 14px);
    opacity: 0.9;
}

/* Info text under the CTA. */
.info-text {
    margin: 0;
    opacity: 0.85;
    font-size: clamp(12px, 1.8vh, 14px);
    line-height: 1.5;
    animation: fadeInUp 0.8s 0.6s both;
}
/* Same short-viewport rule — hide the info blurb when the screen
   can't afford it. The CTA is the important thing. */
@media (max-height: 640px) {
    .info-text { display: none; }
}

.info-text p {
    margin-bottom: clamp(4px, 0.8vh, 10px);
}
.info-text p:last-child { margin-bottom: 0; }

/* Buttons */
.primary-btn {
    background: white;
    color: #5c5638;
    border: none;
    border-radius: 12px;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: fadeInUp 0.8s 0.5s both;
    width: 100%;
    max-width: 300px;
}

/* Welcome + identification primary buttons — viewport-adaptive
   padding/font so the CTA scales with available room.
   Scoped narrowly so other pages using .primary-btn are untouched. */
.welcome-content .primary-btn,
.identification-section .primary-btn {
    padding: clamp(12px, 2.2vh, 20px) clamp(24px, 5vw, 44px);
    font-size: clamp(15px, 2.2vh, 18px);
    min-height: clamp(48px, 7vh, 64px);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: #4b5563;
}

/* Identification Page — viewport-adaptive.
   Sits below the shared header bar; content stack is:
   logo → phone icon → h2 → subtitle → input → button → help. */
.identification-section {
    text-align: center;
    padding: clamp(16px, 3vh, 40px) clamp(16px, 5vw, 32px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(8px, 1.8vh, 20px);
}

.phone-icon {
    font-size: clamp(36px, 6vh, 60px);
    margin: 0;
    line-height: 1;
}

.identification-section h2 {
    font-size: clamp(18px, 3vh, 24px);
    color: #333;
    margin: 0;
    line-height: 1.25;
}

.subtitle {
    color: #666;
    font-size: clamp(12px, 1.9vh, 14px);
    margin: 0;
    line-height: 1.5;
}

.phone-input-group {
    margin: 0;
}

.phone-input {
    width: 100%;
    padding: clamp(14px, 2.2vh, 20px);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: clamp(18px, 2.6vh, 22px);
    text-align: center;
    letter-spacing: 1px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.phone-input:focus {
    outline: none;
    border-color: #5c5638;
}

.customer-info {
    margin: 0;
}

.info-card {
    background: #f5efde;
    border: 2px solid #5c5638;
    border-radius: 12px;
    padding: clamp(14px, 2.2vh, 20px);
    text-align: left;
}

.info-label {
    font-size: clamp(11px, 1.4vh, 12px);
    color: #5c5638;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.info-value {
    font-size: clamp(16px, 2.4vh, 20px);
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.info-subtitle {
    font-size: clamp(12px, 1.8vh, 14px);
    color: #666;
}

.help-text {
    margin: 0;
    font-size: clamp(12px, 1.8vh, 14px);
    color: #666;
}

/* Search Page */
.customer-greeting {
    background: linear-gradient(135deg, #f5efde 0%, #e8dcb8 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 500;
    color: #333;
    text-align: center;
}

.search-section {
    margin-bottom: 20px;
}

.brand-filter {
    margin-bottom: 20px;
}

.brand-filter label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.brand-filter select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.brand-filter select:focus {
    outline: none;
    border-color: #5c5638;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #5c5638;
}

.voice-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.voice-btn:hover {
    transform: translateY(-50%) scale(1.05);
}

.voice-btn.listening {
    background: #b8893a;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.mic-icon {
    width: 20px;
    height: 20px;
}

.voice-status {
    text-align: center;
    padding: 10px;
    background: #f0f9ff;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #0369a1;
    display: flex;
}

.voice-status.active {
    display: block;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5c5638;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.results {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

.result-item {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s;
    background: white;
}

.result-item:hover {
    border-color: #5c5638;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.product-info {
    margin-bottom: 15px;
}

.product-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    margin-bottom: 5px;
}

/* Detail pills shown under the product name: Type / THC / CBD.
   Only rendered when buildProductPills() returned at least one entry. */
.product-pills {
    display: flex;
    flex-wrap: wrap;        /* wrap onto multiple lines on narrow screens */
    gap: 6px;
    margin: 4px 0 8px 0;
}

.product-pill {
    display: inline-flex;
    align-items: baseline;
    background: #efe6cc;    /* soft tint of the #5c5638 accent */
    color: #444;
    border-radius: 999px;   /* full pill */
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.product-pill-label {
    font-weight: 600;
    color: #3f3a25;
    margin-right: 4px;
}

.product-pill-value {
    color: #333;
}

.product-details {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: #5c5638;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.qty-btn {
    background: #5c5638;
    color: white;
    border: none;
    border-radius: 8px;
    width: 35px;
    height: 35px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.qty-btn:hover {
    background: #3f3a25;
}

/* 2026-09-18: widened for decimal quantities -- "3.5" was clipping at
   60px. The native spinner arrows are hidden: they step by the input's
   `step` and ignore our 0.5-grid snapping, and on the touch panel they
   are far too small to hit anyway. The +/- buttons are the control. */
.qty-input {
    width: 76px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.qty-input:focus {
    outline: none;
    border-color: #5c5638;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

.add-to-cart-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.add-to-cart-btn:hover {
    background: #059669;
}

.add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Empty States */
.empty-state, .no-results, .error-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.empty-state h3, .no-results h3, .error-state h3 {
    color: #666;
    margin-bottom: 10px;
}

.hint {
    color: #5c5638;
    font-size: 14px;
    margin-top: 10px;
}

/* Cart Panel — modal-drawer pattern
 *
 * The panel slides in from the right of the viewport over a dark
 * backdrop that dims the rest of the app. Clicking the backdrop
 * (or pressing Escape) closes the cart. See cart.js wireUI() for
 * the JS side.
 *
 * z-index stacking: backdrop at 1000, panel at 1001, so the panel
 * always sits on top of the scrim. Both are below the site-level
 * header (which is at 100) because the cart is modal while it's
 * open — the header shouldn't peek through. */
.cart-backdrop {
    position: fixed;
    inset: 0;               /* top/right/bottom/left: 0 shorthand */
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    z-index: 1000;
}
.cart-backdrop.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease;
}

.cart-panel {
    position: fixed;
    right: -100%;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0,0,0,0.3);
    transition: right 0.3s;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.cart-panel.open {
    right: 0;
}

.cart-panel-header {
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-panel-header h3 {
    font-size: 20px;
}

.close-cart-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s;
}

.close-cart-btn:hover {
    background: rgba(255,255,255,0.3);
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.cart-item {
    background: #f9fafb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.cart-item-qty {
    font-size: 12px;
    color: #666;
}

.cart-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-item-price {
    font-weight: 700;
    color: #5c5638;
    font-size: 16px;
}

.remove-btn {
    background: #b8893a;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s;
}

.remove-btn:hover {
    background: #9a6f2c;
}

.cart-panel-footer {
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    background: white;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
}

.cart-total span:last-child {
    color: #5c5638;
}

/* Submit Page */
.review-section {
    max-width: 500px;
    margin: 0 auto;
}

.customer-info-card, .order-items-card, .order-total-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.customer-info-card h3, .order-items-card h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.customer-info-card p {
    margin-bottom: 10px;
    color: #666;
}

.review-item {
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.review-item-details {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.review-item-total {
    font-weight: 700;
    color: #5c5638;
    font-size: 18px;
}

.order-total-card {
    background: linear-gradient(135deg, #f5efde 0%, #e8dcb8 100%);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 16px;
}

.grand-total {
    font-size: 24px;
    font-weight: 700;
    color: #5c5638;
    padding-top: 15px;
    border-top: 2px solid #5c5638;
    margin-top: 10px;
}

.submit-order-btn {
    width: 100%;
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: white;
    padding: 18px;
    font-size: 18px;
}

.info-note {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-top: 15px;
    line-height: 1.5;
}

/* Success Section */
.success-section {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.success-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceIn 0.8s;
}

.success-section h2 {
    font-size: 24px;
    color: #10b981;
    margin-bottom: 15px;
}

.order-number {
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 15px;
}

.success-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

/* Pick Ticket */
.pick-ticket {
    border: 2px solid #333;
    border-radius: 12px;
    padding: 20px;
    margin: 30px 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pick-ticket-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.pick-ticket-header h3 {
    font-size: 24px;
    font-weight: 700;
}

.ticket-order-number {
    font-size: 18px;
    color: #5c5638;
    font-weight: 700;
}

.pick-ticket-customer {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.8;
}

.pick-ticket-items table {
    width: 100%;
    border-collapse: collapse;
}

.pick-ticket-items th {
    background: #f3f4f6;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #333;
}

.pick-ticket-items td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.qty-cell {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.pick-ticket-items tfoot td {
    border-top: 2px solid #333;
    padding-top: 15px;
    font-size: 18px;
}

.pick-ticket-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed #ccc;
    font-size: 14px;
    color: #666;
}

.pick-ticket-footer p {
    margin-bottom: 5px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.action-buttons button {
    flex: 1;
}

/* Messages */
.error-message {
    background: #fee2e2;
    border: 2px solid #b8893a;
    color: #991b1b;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
}

.success-message {
    background: #d1fae5;
    border: 2px solid #10b981;
    color: #065f46;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        min-height: 100vh;
    }
    
    .cart-panel {
        max-width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* ============================================================
   Shared header additions
   ============================================================
   The header now carries a logout icon next to the cart badge.
   .header-actions wraps both so the flex layout distributes them
   as a single right-side cluster. .back-btn-placeholder keeps the
   centered title alignment when no back button is rendered
   (e.g. first visit to the department picker). */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
    padding: 0;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.back-btn-placeholder {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* ============================================================
   Department picker (departments.php)
   ============================================================
   3 columns on every viewport, per spec. Buttons stretch to the
   tallest in their row so long names can wrap without making the
   grid look uneven. Each button shows the department name on top
   and the product count below as a muted sub-line. */
.departments-page {
    padding-bottom: 100px;
}

.departments-subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.departments-loading,
.departments-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.departments-error {
    color: #b91c1c;
}

.departments-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.department-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-decoration: none;
    min-width: 0;          /* grid/flex safety: lets cells shrink
                              below the intrinsic width of their
                              longest word. Without this, a single
                              long department name can push the
                              whole grid past the container edge. */
    min-height: 90px;
    padding: 14px 10px;
    background: #fff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.12s ease,
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background 0.2s ease;
    cursor: pointer;
    /* allow buttons to grow vertically with long names but keep
       widths uniform via the 3-col grid */
    height: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;   /* stronger than break-word — will
                                  break a single long word mid-
                                  character rather than overflow */
}

.department-btn:hover,
.department-btn:focus-visible {
    background: #f5f7ff;
    border-color: #5c5638;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.18);
    outline: none;
    transform: translateY(-1px);
}

.department-btn:active {
    transform: translateY(0);
}

.department-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    line-height: 1.3;
    /* wrap across multiple lines when the name is long rather than
       truncating — per product spec, variable-height buttons. */
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.department-count {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #5c5638;
    background: #efe6cc;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
    max-width: 100%;
}

/* On narrow phones 3 columns gets tight — reduce outer content
   padding (gives the grid more usable width) and tighten the
   button padding and gap. We keep 3 columns as explicitly
   requested by the spec; this just lets them breathe. */
@media (max-width: 480px) {
    .departments-page { padding-left: 12px; padding-right: 12px; }
    .departments-grid { gap: 8px; }
    .department-btn {
        min-height: 80px;
        padding: 10px 6px;
    }
    .department-name { font-size: 13px; }
    .department-count { font-size: 11px; padding: 2px 8px; }
}

/* ============================================================
   Change Department row (search.php)
   ============================================================
   Shown at the top of the product list when the user has arrived
   from the picker. Lets them jump back without going through the
   header back button. */
.change-department-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.change-department-btn {
    background: #5c5638;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.change-department-btn:hover {
    background: #3f3a25;
}

.current-dept-label {
    color: #555;
    font-size: 13px;
    font-weight: 500;
}
.current-dept-label:not(:empty)::before {
    content: "› ";
    color: #999;
    margin-right: 4px;
}

/* ============================================================
   Product card — two-column layout
   ============================================================
   Image on the left (fixed width, vertical column); everything
   else is a flex-column on the right that fills remaining space.
   The right column stacks:
     1. Product name — wraps across the full right-column width
     2. Pills        — centered within the right column
     3. Meta row     — price + stock badge side-by-side
     4. Actions row  — qty selector (left) + Add to Cart (right)

   min-width: 0 on .product-info is critical — without it, flex
   children refuse to shrink below their intrinsic content size
   and long product names force the row wider than the card. */

.result-item {
    display: flex;
    flex-direction: row;
    align-items: stretch;   /* image column and info column equal height */
    gap: 15px;
}

.product-image,
.product-image-placeholder {
    flex: 0 0 100px;
    width: 100px;
    max-height: 160px;
    align-self: flex-start;
    object-fit: cover;
    border-radius: 8px;
    background: #f3f4f6;    /* visible when placeholder OR slow image load */
}

.product-info {
    flex: 1 1 auto;
    min-width: 0;           /* see comment above */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-name {
    /* Override the old rule's 16px tight-leading style for this
       wrapping context — a 2-line name should breathe. */
    font-weight: 600;
    color: #333;
    font-size: 16px;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
    text-align: left;
}

.product-pills {
    /* Override the legacy .product-pills alignment so pills center
       themselves under the wrapped name per spec. */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.product-meta .product-price {
    /* keep the accent-blue emphasis from the legacy rule but drop
       the block-level margin so it plays nicely inside flex */
    font-size: 20px;
    font-weight: 700;
    color: #5c5638;
    line-height: 1;
}

.product-meta .product-stock {
    /* inherits .in-stock / .out-of-stock colors from elsewhere in
       this file — just size + align it to sit next to the price */
    font-size: 13px;
    line-height: 1;
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;        /* stacks on very narrow viewports */
    margin: 0;
}

.product-actions .quantity-selector {
    margin: 0;              /* reset legacy bottom-margin */
    flex: 0 0 auto;
}

.product-actions .add-to-cart-btn {
    flex: 0 0 auto;
    min-width: 140px;
}

/* Mobile tightening — cards get a bit cramped under ~420px wide.
   Image narrows, action row can wrap if it really has to. */
@media (max-width: 420px) {
    .product-image,
    .product-image-placeholder {
        flex-basis: 80px;
        width: 80px;
    }
    .result-item { gap: 10px; }
    .product-actions .add-to-cart-btn { min-width: 120px; }
}

/* ============================================================
   Idle-timeout modal (idle_timeout.php + idle_timeout.js)
   ============================================================
   Centered modal dialog shown after IDLE_TIMEOUT_SECONDS of
   inactivity. A dark scrim sits behind it using the same pattern
   as the cart drawer's backdrop. Both sit above everything else
   in the app (z-index 1100/1101) so they can't be obscured.
   The modal is hidden by default; idle_timeout.js toggles .open. */

.idle-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    z-index: 1100;
}
.idle-backdrop.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
}

.idle-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.2s ease,
                opacity  0.2s ease,
                visibility 0s linear 0.2s;
    z-index: 1101;

    width: calc(100% - 40px);
    max-width: 440px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    padding: 28px 24px 22px;
    text-align: center;
}
.idle-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.idle-modal h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
}

.idle-modal p {
    margin: 0 0 22px 0;
    color: #555;
    font-size: 15px;
    line-height: 1.4;
}

.idle-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.idle-modal .primary-btn,
.idle-modal .secondary-btn {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease,
                border-color 0.2s ease;
}

.idle-modal .primary-btn {
    background: #5c5638;
    color: #fff;
}
.idle-modal .primary-btn:hover {
    background: #3f3a25;
}

.idle-modal .secondary-btn {
    background: transparent;
    color: #666;
    border: 1px solid #d1d5db;
}
.idle-modal .secondary-btn:hover {
    background: #f3f4f6;
    color: #333;
    border-color: #9ca3af;
}

/* Side-by-side buttons on wider viewports. The modal is only
   ~400px wide so this kicks in as soon as there's room. */
@media (min-width: 420px) {
    .idle-modal-actions {
        flex-direction: row-reverse;  /* primary on the right */
    }
    .idle-modal .primary-btn,
    .idle-modal .secondary-btn {
        flex: 1;
    }
}

/* ============================================================
   Timeout banner (index.php)
   ============================================================
   Shown only when the user is redirected here via
   index.php?timeout=1 (i.e. idle_timeout_guard.php expired the
   server-side session). The welcome page has a dark gradient
   background, so the banner uses a light translucent pill to
   stay legible without competing with the brand logo. */
.timeout-banner {
    display: inline-block;
    margin: 0 auto 18px auto;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.92);
    color: #3f3a25;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.5s ease both;
}

/* ============================================================
   Order modal (order_modal.php + order_modal.js)
   ============================================================
   Centered dialog pattern matching the idle-timeout modal and
   department picker. Used for the cart view and the review view
   of the ordering flow — both rendered inside the same modal,
   swapped by adding the .view-cart / .view-review class on the
   modal root and toggling each .order-view's .active state.

   z-index stack: backdrop 1000, modal 1001. Idle-timeout modal
   (at 1100/1101) can still appear over the top of this one if a
   session idles while the order modal is open. */

.order-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    z-index: 1000;
}
.order-backdrop.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease;
}

.order-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease,
                visibility 0s linear 0.2s;
    z-index: 1001;

    width: calc(100% - 32px);
    max-width: 520px;
    max-height: 85vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;              /* let children round within radius */
}
.order-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---- Modal chrome ---- */
.order-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: #fff;
    flex: 0 0 auto;
}
.order-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}
/* Title swaps between cart and review depending on which view is active.
   Default: show "cart" title, hide "review" title. */
.order-modal .order-title-review { display: none; }
.order-modal .order-title-stock  { display: none; }
.order-modal.view-review .order-title-cart   { display: none; }
.order-modal.view-review .order-title-review { display: inline; }
.order-modal.view-stock  .order-title-cart   { display: none; }
.order-modal.view-stock  .order-title-stock  { display: inline; }

.order-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}
.order-close-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* ---- Views ---- */
.order-view {
    display: none;
    flex: 1 1 auto;
    min-height: 0;             /* critical for nested flex scroll */
    flex-direction: column;
}
.order-view.active { display: flex; }

/* ---- Cart view ---- */
.order-items-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px;
    min-height: 120px;
}

.empty-cart {
    text-align: center;
    padding: 50px 20px 40px;
    color: #999;
}
.empty-cart p    { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: #666; }
.empty-cart small { font-size: 13px; }

.order-item {
    border: 1px solid #efe6cc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fafbff;
}
.order-item:last-child { margin-bottom: 0; }

.order-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.35;
    word-break: break-word;
}

.order-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.order-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}
.order-qty-btn {
    background: #efe6cc;
    color: #3f3a25;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.order-qty-btn:hover { background: #dde1f7; }

.order-qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    color: #333;
    font-size: 15px;
}

.order-item-lineprice {
    flex: 1 1 auto;
    text-align: right;
    font-weight: 700;
    color: #5c5638;
    font-size: 15px;
}

.order-item-remove {
    background: transparent;
    color: #b91c1c;
    border: 1px solid #fecaca;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}
.order-item-remove:hover {
    background: #b91c1c;
    color: #fff;
}

/* ---- Review view ---- */
.order-view-review {
    padding: 0;
}
.order-view-review > .order-review-customer,
.order-view-review > .order-review-items {
    padding: 14px 18px;
}
.order-review-customer {
    border-bottom: 1px solid #efe6cc;
    background: #f9fafb;
}
.order-review-customer h4,
.order-review-items h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 700;
    color: #3f3a25;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.order-review-customer p {
    margin: 2px 0;
    font-size: 14px;
    color: #333;
}
.order-review-customer strong {
    color: #555;
    font-weight: 600;
    margin-right: 4px;
}

.order-review-items {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 100px;
}

.order-review-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #efe6cc;
}
.order-review-item:last-child { border-bottom: none; }

.order-review-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
}
.order-review-item-qty {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}
.order-review-item-total {
    font-weight: 700;
    color: #5c5638;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
    min-width: 60px;
}

.order-review-error {
    margin: 10px 18px 0;
    padding: 10px 14px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

/* ---- Footer (shared between views) ---- */
.order-modal-footer {
    border-top: 1px solid #efe6cc;
    padding: 14px 18px;
    background: #fff;
    flex: 0 0 auto;
}
.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}
.order-total-row span:last-child {
    color: #5c5638;
}

.order-modal-footer .primary-btn {
    width: 100%;
    padding: 12px 18px;
    background: #5c5638;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.order-modal-footer .primary-btn:hover:not(:disabled) { background: #3f3a25; }
.order-modal-footer .primary-btn:disabled {
    background: #c7cbe8;
    cursor: not-allowed;
}

.order-modal-footer .secondary-btn {
    padding: 12px 18px;
    background: transparent;
    color: #666;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease,
                border-color 0.2s ease;
}
.order-modal-footer .secondary-btn:hover {
    background: #f3f4f6;
    color: #333;
    border-color: #9ca3af;
}

.order-review-note {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0 0 12px 0;
}

.order-review-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 420px) {
    .order-review-actions {
        flex-direction: row;
    }
    .order-review-actions .secondary-btn { flex: 0 0 auto; }
    .order-review-actions .primary-btn   { flex: 1 1 auto; }
}

/* ============================================================
   Continue shopping + Review Order — cart view action row
   ============================================================
   Cart footer now has two buttons side-by-side when there's
   room. Primary (Review Order) stays on the right so the
   user's eye ends on the forward action. */

.order-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
@media (min-width: 420px) {
    .order-cart-actions {
        flex-direction: row;
    }
    .order-cart-actions .secondary-btn { flex: 0 0 auto; }
    .order-cart-actions .primary-btn   { flex: 1 1 auto; }
}

/* ============================================================
   Welcome page — secondary link under the primary CTA
   ============================================================
   Lives below the "Start Your Order" button and routes to
   identification.php?next=orders for returning customers. */

.welcome-secondary-link {
    display: inline-block;
    margin: 14px auto 0 auto;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease,
                text-decoration-color 0.2s ease;
    background: transparent;
    border: none;
}
.welcome-secondary-link:hover {
    color: #fff;
    text-decoration-color: #fff;
}

/* ============================================================
   My Orders list page (orders.php)
   ============================================================
   Card-per-order rows with date + meta on the left, action
   buttons on the right. Stacks on narrow phones. */

.orders-page {
    padding-bottom: 30px;
}

.orders-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 14px 16px;
    border-radius: 10px;
    margin: 8px 0 16px 0;
    font-size: 14px;
    font-weight: 500;
}

.orders-empty {
    text-align: center;
    padding: 40px 20px;
}
.orders-empty-icon {
    font-size: 48px;
    margin-bottom: 14px;
}
.orders-empty h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 8px;
}
.orders-empty p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 22px;
}
.orders-empty .primary-btn {
    padding: 12px 24px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: #fafbff;
    border: 1px solid #efe6cc;
    border-radius: 12px;
    transition: border-color 0.15s ease,
                box-shadow   0.15s ease;
}
.order-row:hover {
    border-color: #c7cbe8;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08);
}

.order-row-main {
    flex: 1 1 auto;
    min-width: 0;
}

.order-row-date {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.order-row-meta {
    font-size: 14px;
    color: #666;
}

.order-row-sep {
    margin: 0 8px;
    color: #c7cbe8;
}

.order-row-total {
    font-weight: 700;
    color: #5c5638;
}

.order-row-actions {
    display: flex;
    gap: 10px;
}
.order-row-actions .secondary-btn,
.order-row-actions .primary-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.order-row-actions .secondary-btn {
    background: transparent;
    color: #5c5638;
    border: 1px solid #c7cbe8;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.order-row-actions .secondary-btn:hover {
    background: #efe6cc;
    border-color: #5c5638;
}
.order-row-actions .primary-btn {
    background: #5c5638;
    color: #fff;
    border: none;
    transition: background 0.2s ease;
}
.order-row-actions .primary-btn:hover:not(:disabled) {
    background: #3f3a25;
}
.order-row-actions .primary-btn:disabled {
    background: #c7cbe8;
    cursor: not-allowed;
}

/* Side-by-side layout on wider screens. */
@media (min-width: 520px) {
    .order-row {
        flex-direction: row;
        align-items: center;
    }
    .order-row-actions {
        flex: 0 0 auto;
    }
    .order-row-actions .secondary-btn,
    .order-row-actions .primary-btn {
        flex: 0 0 auto;
        min-width: 88px;
    }
}

/* ============================================================
   Order detail page (order_detail.php)
   ============================================================ */

.order-detail-page {
    padding-bottom: 30px;
}

.order-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 16px;
    background: #fafbff;
    border: 1px solid #efe6cc;
    border-radius: 12px;
    margin-bottom: 16px;
}
.order-detail-date {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}
.order-detail-total {
    font-size: 14px;
    color: #666;
}
.order-detail-total strong {
    margin-left: 6px;
    color: #5c5638;
    font-size: 16px;
}

.order-detail-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.order-detail-item {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #efe6cc;
    border-radius: 10px;
}
.order-detail-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.35;
    word-break: break-word;
}
.order-detail-item-meta {
    font-size: 13px;
    color: #666;
}
.order-detail-item-line {
    margin-left: 8px;
    color: #5c5638;
    font-weight: 700;
}

.order-detail-actions {
    display: flex;
    justify-content: center;
}
.order-detail-actions .primary-btn {
    min-width: 220px;
    padding: 12px 22px;
    background: #5c5638;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}
.order-detail-actions .primary-btn:hover:not(:disabled) {
    background: #3f3a25;
}
.order-detail-actions .primary-btn:disabled {
    background: #c7cbe8;
    cursor: not-allowed;
}

/* ============================================================
   Reorder banner (inside cart modal)
   ============================================================
   Temporary banner shown at the top of the cart view after a
   reorder action completes, summarizing what happened (added,
   unavailable, clamped, price changes). Auto-dismisses after
   8s, or persists until the next modal render. */

.order-reorder-banner {
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.5;
}
.order-reorder-banner div + div {
    margin-top: 2px;
}

/* ============================================================
   Orders page — product cards with date ribbons
   ============================================================
   The cards reuse .result-item / .product-image / .product-info
   from the search page so the visual matches. The only additions
   are:
     - .product-image-wrapper — positions the image+ribbon as a
       single unit so the ribbon can overlay the top edge
     - .order-date-ribbon    — full-width strip across the top of
       the image with the "Friday 18 of April" text
     - .orders-feedback      — ephemeral toast confirming Add-to-Cart
     - .unavailable / out-of-stock variants of .product-stock to
       match the server-provided labels                         */

.orders-page { padding-bottom: 30px; }

.orders-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.orders-empty { text-align: center; padding: 40px 20px; }
.orders-empty-icon { font-size: 48px; margin-bottom: 14px; }
.orders-empty h2   { font-size: 20px; color: #333; margin-bottom: 8px; }
.orders-empty p    { color: #666; font-size: 14px; line-height: 1.5; margin-bottom: 22px; }
.orders-empty .primary-btn { padding: 12px 24px; }

/* Image + ribbon unit. Takes the 100px-wide slot that search.php's
   bare .product-image uses, so the right-column layout stays
   identical across the two pages. */
.product-image-wrapper {
    flex: 0 0 100px;
    width: 100px;
    position: relative;
    align-self: flex-start;
    border-radius: 8px;
    overflow: hidden;      /* ribbon corners clipped to card radius */
}

/* When nested inside the wrapper, the image fills the whole slot
   (including behind the ribbon, which has its own background). */
.product-image-wrapper > .product-image,
.product-image-wrapper > .product-image-placeholder {
    flex: initial;
    width: 100%;
    max-height: 160px;
    min-height: 100px;
    display: block;
}

.order-date-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 4px 5px;
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.1px;
    line-height: 1.25;
    /* Two-line layout — the 100px-wide slot can't fit "Friday 19 of
       April" on one line at a readable size, so we let it wrap. */
    white-space: normal;
    word-break: normal;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Availability label variants. "In Stock" is the default green
   badge already defined for .product-stock.in-stock in the main
   search styles; these are the two new states. */
.product-stock.out-of-stock {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.product-stock.unavailable {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* Ephemeral feedback ("Added 1x …"). Sits above the cards.
   Uses the same show/hide pattern as the search page's voiceStatus. */
.orders-feedback {
    position: sticky;
    top: 10px;
    z-index: 50;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #10b981;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.orders-feedback.err { background: #b8893a; }
.orders-feedback.open {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Header: My Orders labeled button
   ============================================================
   Pill-shaped button in the header with icon + "My Orders"
   label. More discoverable than an icon alone — not every
   customer interprets a clipboard icon as "order history". */

.header-orders-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;           /* don't let the header squeeze it away */
}
.header-orders-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.header-orders-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.header-orders-label {
    font-weight: 600;
}

/* On narrow phones the text can crowd the header — drop to icon-only.
   Still better than it was before because the button is now a
   consistent pill and users can discover the label by browsing
   at a wider viewport first.

   Breakpoint raised 380px -> 400px on 2026-09-17 to match the Home
   button's. They disagreed, so between 380 and 400 Home went icon-only
   while My Orders kept its label, and the page title wrapped to two
   lines. Keep these two in step if either changes. */
@media (max-width: 400px) {
    .header-orders-btn {
        padding: 9px;
    }
    .header-orders-label {
        display: none;
    }
}

/* ============================================================
   Stock-issues view (order_modal.php .order-view-stock)
   ============================================================
   Shown when submit.php returns error:'stock_unavailable'. Each
   affected cart line gets its own sub-card with 1 or 2 choice
   buttons (Reduce / Remove). The customer must pick for every
   flagged line before Apply becomes clickable.

   Shares .order-review-actions and the footer styles with the
   review view below. */

.order-view-stock {
    padding: 0;
}

.order-stock-intro {
    padding: 14px 18px 10px;
    border-bottom: 1px solid #efe6cc;
    background: #fffbea;
    color: #78350f;
}
.order-stock-intro h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #92400e;
}
.order-stock-intro p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.order-stock-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 18px;
    min-height: 120px;
}

.order-stock-item {
    border: 1px solid #efe6cc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fafbff;
}
.order-stock-item:last-child { margin-bottom: 0; }

.order-stock-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 4px;
    word-break: break-word;
}

.order-stock-item-note {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.4;
}

.order-stock-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-stock-choice {
    padding: 10px 14px;
    background: #fff;
    color: #5c5638;
    border: 1.5px solid #c7cbe8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease,
                color      0.15s ease,
                border-color 0.15s ease;
}
.order-stock-choice:hover {
    background: #efe6cc;
    border-color: #5c5638;
}

/* Selected choice — purple fill so the user sees their pick. */
.order-stock-choice.is-selected {
    background: #5c5638;
    color: #fff;
    border-color: #5c5638;
}
.order-stock-choice.is-selected:hover {
    background: #3f3a25;
    border-color: #3f3a25;
}

/* Two choices side-by-side on wider viewports. */
@media (min-width: 420px) {
    .order-stock-item-actions {
        flex-direction: row;
    }
    .order-stock-choice { flex: 1 1 auto; }
}

/* ============================================================
   Sale pricing display (search.php, orders.php product cards)
   ============================================================
   When a promo applies (backend sets sale=true on the row) the
   card shows three things in the price row instead of one:
     - Retail price struck through (muted grey)
     - Sale price in the usual purple
     - Small red "SALE -N%" badge

   The existing .product-meta is a flex-wrap row, so these extra
   pieces line-wrap gracefully on narrow cards. */

.product-price-was {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* Sale price reuses .product-price's size and weight but tints
   red instead of purple so the "deal" is unmistakable. */
.product-price.product-price-sale {
    color: #9a6f2c;
}

.product-sale-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #9a6f2c;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
}

/* ============================================================
   Deals shortcut button (departments.php)
   ============================================================
   Full-width button above the departments grid. Routes to
   search.php?filter=promo which shows only products currently
   on an active promo. Hidden by default; JS reveals it when the
   brands API reports promo_count > 0. Red gradient so it stands
   out from the purple department tiles — it's a featured
   shortcut, not a regular item in the grid. */

.deals-shortcut {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #b8893a 0%, #9a6f2c 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    font-size: 16px;
    font-weight: 600;
}
.deals-shortcut:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.32);
}
.deals-shortcut:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.deals-shortcut-badge {
    display: inline-block;
    flex: 0 0 auto;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.deals-shortcut-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.deals-shortcut-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}
.deals-shortcut-count {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.92;
    line-height: 1.2;
}

.deals-shortcut-arrow {
    flex: 0 0 auto;
    font-size: 28px;
    line-height: 1;
    opacity: 0.85;
    font-weight: 400;
}

/* Search page — when the "Deals" filter is active, give the
   "All Deals" label a red pill so the customer knows they're
   still in the sale-only view. Overrides the base label which
   is just text. */
.current-dept-label.current-dept-label-deals {
    display: inline-block;
    padding: 4px 10px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}
/* Suppress the "›" prefix on the deals pill — it doesn't make
   sense when the label is styled as a pill rather than a
   breadcrumb continuation. */
.current-dept-label.current-dept-label-deals:not(:empty)::before {
    content: none;
}

/* ============================================================
   Kiosk mode — body.kiosk-mode
   ============================================================
   Triggered by ?kiosk=1 in the URL (stored in a 10-year cookie
   and mirrored to $_SESSION — see kiosk_mode_bootstrap() in
   config.php). Every protected page emits <body class="kiosk-mode">
   when active. Rules below tune the UI for a 24" touchscreen
   viewed from standing distance (~2-3 ft), no physical keyboard.

   Goals:
     - Bigger fonts and touch targets
     - No text selection / context menu (can't highlight / right-click)
     - Hide the product search input (awkward with on-screen keyboard)
     - More generous padding on cards and modals

   Phone/tablet view of the same app keeps its current design.
   Everything below is additive — nothing overrides non-kiosk users. */

/* --- Platform-level: no selection, no callout, no tap highlight --- */
body.kiosk-mode {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    font-size: 17px;          /* bump base up from default 16px */
}
/* But keep the phone search input (identification) editable if
   someone still types there. We're only hiding the product search. */
body.kiosk-mode input,
body.kiosk-mode textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* --- Hide the product search box and "clear all" button. --- */
/* Department + Deals navigation is the only way in/out in kiosk mode. */
body.kiosk-mode .search-box,
body.kiosk-mode #clearAllBtn {
    display: none !important;
}

/* --- Welcome + identification pages: chunkier welcome CTA. --- */
body.kiosk-mode .welcome-btn,
body.kiosk-mode .identify-btn,
body.kiosk-mode .login-btn {
    min-height: 72px;
    font-size: 20px;
    padding: 18px 28px;
}
body.kiosk-mode .phone-input,
body.kiosk-mode input[type="tel"] {
    min-height: 62px;
    font-size: 24px;
    padding: 14px 20px;
}

/* --- Department picker: bigger tiles, bigger text. --- */
body.kiosk-mode .department-btn {
    min-height: 130px;
    padding: 24px 16px;
    font-size: 18px;
    /* Clearer box: thicker, darker outline + stronger shadow so the
       tile edges read clearly for older users on the bright panel. */
    border: 2px solid #b8b29a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
/* Keep the outline obvious (not just a color tint) on tap/hover. */
body.kiosk-mode .department-btn:hover,
body.kiosk-mode .department-btn:focus-visible {
    border-color: #5c5638;
    border-width: 2px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
body.kiosk-mode .department-name {
    font-size: 26px;        /* larger, more legible department name */
    font-weight: 700;       /* bolder for older eyes */
    line-height: 1.25;
}
body.kiosk-mode .department-count {
    font-size: 15px;
    margin-top: 10px;
    padding: 3px 12px;
}

/* Deals shortcut — same width, more presence. */
body.kiosk-mode .deals-shortcut {
    padding: 20px 22px;
    gap: 18px;
}
body.kiosk-mode .deals-shortcut-title {
    font-size: 22px;
}
body.kiosk-mode .deals-shortcut-count {
    font-size: 16px;
}
body.kiosk-mode .deals-shortcut-badge {
    padding: 8px 14px;
    font-size: 14px;
}
body.kiosk-mode .deals-shortcut-arrow {
    font-size: 36px;
}

/* --- Product cards: bigger image, fatter buttons, louder price. --- */
body.kiosk-mode .result-item {
    padding: 18px;
    gap: 18px;
}
body.kiosk-mode .product-image {
    width: 140px;
    height: 140px;
    flex: 0 0 140px;
}
body.kiosk-mode .product-name {
    font-size: 18px;
    line-height: 1.35;
}
body.kiosk-mode .product-meta .product-price,
body.kiosk-mode .product-meta .product-price-sale {
    font-size: 24px;
}
body.kiosk-mode .product-price-was {
    font-size: 17px;
}
body.kiosk-mode .product-stock {
    font-size: 15px;
}
body.kiosk-mode .product-sale-badge {
    font-size: 13px;
    padding: 5px 12px;
}
body.kiosk-mode .add-to-cart-btn {
    min-height: 64px;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 22px;
}
body.kiosk-mode .qty-btn {
    min-width: 56px;
    min-height: 56px;
    font-size: 26px;
}
body.kiosk-mode .qty-input {
    min-width: 104px;          /* 2026-09-18: room for "10.5" at 22px */
    font-size: 22px;
    min-height: 56px;
    /* Tapping this box opens the in-page keypad (qty.js) -- make it read
       as a button, not a dead field. */
    cursor: pointer;
    caret-color: transparent;
}

/* ============================================================
   QUANTITY KEYPAD (kiosk only, added 2026-09-18)
   ============================================================
   The unit has no keyboard, so the +/- arrows were the only way to set
   a quantity -- 3.5 cost seven taps. Tapping the quantity box opens
   this pad instead. It is ONE shared overlay reused by every product
   card, unlike kiosk_keypad.js which injects itself beside its field
   (right for the single phone box, wrong for a grid of cards).
   ============================================================ */
.qty-keypad-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4000;            /* above the sticky header and the cart panel */
    background: rgba(24, 22, 14, 0.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.qty-keypad-overlay.open {
    display: flex;
}

.qty-keypad-box {
    background: #fdfbf5;
    border-radius: 20px;
    padding: clamp(16px, 2.6vh, 28px);
    width: 100%;
    max-width: 460px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.qty-keypad-title {
    font-size: clamp(18px, 2.6vh, 24px);
    font-weight: 700;
    color: #3f3a25;
    text-align: center;
    margin-bottom: 10px;
}

.qty-keypad-display {
    background: #ffffff;
    border: 2px solid #ded8c4;
    border-radius: 12px;
    text-align: center;
    font-size: clamp(30px, 5vh, 46px);
    font-weight: 700;
    color: #3f3a25;
    padding: 10px 14px;
    min-height: 1.4em;
}

.qty-keypad-hint {
    text-align: center;
    font-size: clamp(13px, 1.8vh, 16px);
    color: #7a7358;
    margin: 8px 0 4px;
    min-height: 1.2em;
}

.qty-keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.4vh, 14px);
    margin-top: 10px;
}

.qty-keypad-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 1.4vh, 14px);
    margin-top: clamp(10px, 1.8vh, 18px);
}

/* The keys reuse .kiosk-key, whose sizing lives under body.kiosk-mode
   -- these only add what is specific to this pad. */
/* Specificity note: the base keys are styled by
   `body.kiosk-mode .kiosk-key` (0,2,1), so these overrides carry the
   body selector too or the OK key would stay white. */
body.kiosk-mode .qty-keypad-box .qty-key-cancel {
    background: #f3efe6;
}

body.kiosk-mode .qty-keypad-box .qty-key-ok {
    background: #5c5638;
    border-color: #5c5638;
    color: #ffffff;
}

body.kiosk-mode .qty-keypad-box .qty-key-ok:active {
    background: #3f3a25;
    border-color: #3f3a25;
}

/* --- Orders page card date ribbon and everything else follows --- */
body.kiosk-mode .orders-date-ribbon {
    font-size: 15px;
    padding: 8px 14px;
}

/* --- Cart / order modal — wider and chunkier on kiosk. --- */
body.kiosk-mode .order-modal {
    max-width: 640px;
}
body.kiosk-mode .order-modal-title {
    font-size: 22px;
}
body.kiosk-mode .order-item-name {
    font-size: 17px;
}
body.kiosk-mode .order-item-price {
    font-size: 18px;
}
body.kiosk-mode .order-btn,
body.kiosk-mode .order-btn-primary,
body.kiosk-mode .order-btn-secondary {
    min-height: 60px;
    font-size: 18px;
    padding: 14px 22px;
}
body.kiosk-mode .order-stock-choice {
    min-height: 56px;
    font-size: 16px;
}

/* --- Shared header: back button + cart badge comfortable to tap. ---
   2026-09-17: this block previously targeted .header-back-btn,
   .cart-badge-btn, .header-logout-btn, .header-my-orders-btn and
   .header-title — none of which exist in the markup, so the whole rule
   had never applied and every header control stayed at phone size on
   the 24" panel. Corrected to the classes shared_header.php actually
   emits. (.header-logout-btn is gone for good: the logout icon was
   replaced by .header-home-btn, which carries its own kiosk sizing.) */
body.kiosk-mode .back-btn,
body.kiosk-mode .cart-badge,
body.kiosk-mode .back-btn-placeholder,
body.kiosk-mode .header-action-btn,
body.kiosk-mode .header-orders-btn {
    min-width: 56px;
    min-height: 56px;
}
body.kiosk-mode .header h1 {
    font-size: 22px;
}

/* The back arrow now carries a word, like Home and My Orders on the
   right, so it stops reading as decoration. That makes it a pill
   rather than a circle, so the 56px circle metrics above don't apply
   to it in kiosk mode. */
body.kiosk-mode .back-btn {
    width: auto;
    gap: 9px;
    padding: clamp(10px, 1.6vh, 16px) clamp(16px, 2.2vw, 26px);
    border-radius: 999px;
    font-size: clamp(15px, 2vh, 19px);
    font-weight: 600;
}

/* Label is kiosk-only: on a phone the header has no room for it and
   the arrow is a universally understood control at that size. */
.back-btn-label { display: none; }
body.kiosk-mode .back-btn-label { display: inline; }

/* --- Idle-timeout modal — more room to read. --- */
body.kiosk-mode .idle-modal {
    max-width: 560px;
}
body.kiosk-mode .idle-modal h3 {
    font-size: 24px;
}
body.kiosk-mode .idle-modal p {
    font-size: 17px;
}
body.kiosk-mode .idle-modal button {
    min-height: 60px;
    font-size: 18px;
}

/* --- Change-department row (search page, kiosk). --- */
body.kiosk-mode .change-department-btn {
    min-height: 52px;
    font-size: 16px;
    padding: 12px 20px;
}
body.kiosk-mode .current-dept-label {
    font-size: 16px;
}

/* ============================================================
   Brand acknowledgments
   ============================================================
   Small, quiet lines — not shouty. The welcome page one sits
   under the tagline as a credibility anchor; the confirmation
   page one appears below the Start New Order button as a
   parting thought. Both lean on the existing color/gradient
   palette rather than introducing new tones. */

/* Welcome page — sits between the tagline and the feature row.
   Subtle pill treatment with white background against the red
   gradient hero. */
.indigenous-line {
    display: inline-block;
    margin: 0;
    padding: clamp(4px, 0.9vh, 8px) clamp(12px, 2.8vw, 20px);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    color: #fff;
    font-size: clamp(10px, 1.6vh, 14px);
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: normal;
    max-width: 100%;
}

/* Confirmation page — warm, thankful tone. Sits below the
   "Start New Order" button. Medicine-box red so it feels
   branded without competing with the success green CTAs. */
.indigenous-thanks {
    margin: 24px auto 8px;
    padding: 10px 18px;
    text-align: center;
    color: #3f3a25;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    max-width: 440px;
}
body.kiosk-mode .indigenous-thanks {
    font-size: 16px;
    padding: 14px 24px;
}
body.kiosk-mode .indigenous-line {
    font-size: 15px;
    padding: 8px 20px;
}

/* ============================================================
   Kiosk mode — vertically center the identification (phone entry)
   page on the tall KM24A portrait screen.

   Without this, .content is a top-padded block inside a 100vh
   container, so the logo + phone field + button bunch at the top
   and the lower half of the 24" portrait panel is empty white.

   Scoped to kiosk mode AND to the page that actually contains
   .identification-section, so the phone/QR layout and every other
   page are untouched. The :has() selector lets us target only the
   identification content block.
   ============================================================ */
body.kiosk-mode .content:has(.identification-section) {
    min-height: calc(100vh - 140px); /* viewport minus the sticky header */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 20px;            /* drop the extra 80px bottom pad here */
}

/* ============================================================
   KIOSK ON-SCREEN NUMERIC KEYPAD  (kiosk_keypad.js)
   ============================================================
   Drawn in the page rather than relying on the Windows touch
   keyboard: TabTip only auto-invokes on a real touch on the
   field, so a programmatic focus leaves the customer with
   nothing to type on. See kiosk_keypad.js for the full note.

   Only ever rendered under body.kiosk-mode, so nothing here
   affects the phone/QR layout. Sizing is viewport-relative so
   it fills the 24" portrait panel without a media query per
   unit — the whole pad targets roughly the lower third of the
   screen, which is where a standing customer's hand is.
   ============================================================ */
body.kiosk-mode .kiosk-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.4vh, 16px);
    width: 100%;
    max-width: 520px;
    margin: clamp(14px, 2.4vh, 26px) auto 0;
}

body.kiosk-mode .kiosk-key {
    /* Chunky enough to hit without looking, from 2-3 ft away. */
    min-height: clamp(56px, 8.5vh, 88px);
    font-size: clamp(22px, 3.4vh, 32px);
    font-weight: 600;
    font-family: inherit;
    color: #3f3a25;
    background: #ffffff;
    border: 2px solid #ded8c4;
    border-radius: 14px;
    cursor: pointer;
    /* No tap-highlight/callout: this is a button, not selectable text. */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    /* Opt out of double-tap-to-zoom so repeated taps on the same key
       register immediately instead of waiting out the gesture timeout. */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.12s, transform 0.06s, border-color 0.12s;
}

body.kiosk-mode .kiosk-key:active {
    background: #5c5638;
    border-color: #5c5638;
    color: #ffffff;
    /* Immediate visual ack — on a resistive/capacitive panel with no
       haptics this press state is the only feedback the customer gets. */
    transform: scale(0.97);
}

/* Clear and backspace read as secondary to the digits. */
body.kiosk-mode .kiosk-key-wide {
    background: #f3efe6;
    font-size: clamp(17px, 2.5vh, 24px);
}

/* The keypad replaces the OS keyboard, so the field must not show a
   caret-less "disabled" look — keep the focus ring loud instead. */
body.kiosk-mode .phone-input:focus {
    border-color: #5c5638;
    box-shadow: 0 0 0 4px rgba(92, 86, 56, 0.15);
}

/* The keypad is injected between the input group and the submit
   button, so give the CTA room to breathe — and keep it clear of
   the bottom key row, which is where a mis-tap would otherwise
   submit a half-typed number. */
body.kiosk-mode .kiosk-keypad ~ .primary-btn {
    margin-top: clamp(18px, 3vh, 34px);
}

/* ============================================================
   HOME BUTTON  (home_button.php / home_button.js)
   ============================================================
   Replaced the old unlabelled door-arrow "Logout" icon. Customers
   at a kiosk are not "logged in" and did not read that icon as a
   way out, so this one carries a word. Present on every screen.
   ============================================================ */
.header-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, border-color 0.2s;
}

.header-home-btn:hover,
.header-home-btn:active {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Bigger hit area on the kiosk panel — this is the button a lost
   customer reaches for, so it should be hard to miss and hard to
   mis-tap. */
body.kiosk-mode .header-home-btn {
    padding: clamp(10px, 1.6vh, 16px) clamp(16px, 2.2vw, 26px);
    font-size: clamp(15px, 2vh, 19px);
    gap: 9px;
}

/* Very narrow phones: keep the icon, drop the word rather than
   letting the header wrap. */
@media (max-width: 400px) {
    body:not(.kiosk-mode) .header-home-label { display: none; }
    body:not(.kiosk-mode) .header-home-btn { padding: 8px 10px; }
}

/* Cancel on the new-customer screen. Deliberately NOT .secondary-btn
   (a filled dark-grey block) — Continue is the action we want the
   customer to take, and a solid Cancel sitting under a pale primary
   button pulls the eye to the wrong one. Outlined and quiet instead,
   but still a full-width touch target. */
.new-cust-cancel {
    display: block;
    width: 100%;
    margin: 14px auto 0;
    padding: 14px 24px;
    max-width: 300px;
    box-sizing: border-box;
    background: transparent;
    color: #6b6450;
    border: 2px solid #ded8c4;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.new-cust-cancel:hover,
.new-cust-cancel:active {
    background: #f3efe6;
    border-color: #c9c2a8;
}

body.kiosk-mode .new-cust-cancel {
    max-width: 420px;
    padding: clamp(12px, 2vh, 18px) clamp(16px, 3vw, 28px);
    font-size: clamp(15px, 2vh, 18px);
}

/* ============================================================
   KIOSK SEARCH OVERLAY  (kiosk_search.js + kiosk_keyboard.js)
   ============================================================
   Search was hidden on the kiosk because the unit has no keyboard.
   It is back as a full-screen overlay carrying its own keyboard.
   Full screen because a QWERTY layout has nowhere to live on a 24"
   portrait panel without pushing the product grid off.

   The department grid stays the primary path — this is an addition.
   ============================================================ */
.kiosk-search-btn {
    background: #5c5638;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: clamp(12px, 2vh, 18px) clamp(20px, 3vw, 32px);
    font: 600 clamp(15px, 2vh, 19px)/1 inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kiosk-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: #faf7f2;
    display: none;
    flex-direction: column;
}
.kiosk-search-overlay.open { display: flex; }

.kiosk-search-head {
    display: flex;
    gap: 12px;
    padding: clamp(12px, 2vh, 20px);
    background: linear-gradient(135deg, #5c5638 0%, #3f3a25 100%);
}

.kiosk-search-input {
    flex: 1;
    padding: clamp(12px, 2vh, 18px);
    font-size: clamp(18px, 2.6vh, 24px);
    border: 2px solid #ded8c4;
    border-radius: 12px;
    box-sizing: border-box;
}
.kiosk-search-input:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

/* Always visible, whatever is on screen — with only "Clear and try
   again" on the empty state, this is the single guaranteed way back
   to browsing. */
.kiosk-search-cancel {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 0 clamp(18px, 3vw, 30px);
    font: 600 clamp(15px, 2vh, 19px)/1 inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kiosk-search-results {
    flex: 1;
    overflow-y: auto;
    padding: clamp(10px, 1.6vh, 18px);
    -webkit-overflow-scrolling: touch;
}

/* The overlay renders the grid's own .result-item cards, so they
   inherit the grid styling and look identical. The rules below are the
   older cut-down row, kept only so an old cached kiosk_search.js does
   not render unstyled markup. Safe to delete once every unit has the
   new files. */
.kiosk-sr-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: #fff;
    border: 2px solid #ece7d9;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
    text-align: left;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.kiosk-sr-row:active { background: #f3efe6; }
.kiosk-sr-img   { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.kiosk-sr-noimg { background: #f3efe6; border-radius: 8px; }
.kiosk-sr-name  { flex: 1; font-size: clamp(15px, 2vh, 19px); font-weight: 600; color: #2b2719; }
.kiosk-sr-price { font-size: clamp(15px, 2vh, 19px); font-weight: 700; color: #5c5638; }

/* --- The no-results screen. Deliberately large and wordy. --- */
.kiosk-search-msg {
    text-align: center;
    padding: clamp(20px, 4vh, 48px) clamp(16px, 5vw, 40px);
    max-width: 700px;
    margin: 0 auto;
}
.kiosk-search-msg-icon   { font-size: clamp(40px, 7vh, 72px); line-height: 1; margin-bottom: 12px; }
.kiosk-search-msg-lead   { font-size: clamp(20px, 3.2vh, 30px); font-weight: 700; color: #2b2719; margin-bottom: 10px; }
.kiosk-search-msg-term   { font-size: clamp(16px, 2.2vh, 21px); color: #6b6450; margin-bottom: 14px; word-break: break-word; }
.kiosk-search-msg-detail { font-size: clamp(15px, 2.1vh, 20px); color: #4a4534; line-height: 1.5; margin-bottom: 22px; }

.kiosk-search-clear {
    background: #5c5638;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: clamp(14px, 2.4vh, 22px) clamp(24px, 5vw, 44px);
    font: 700 clamp(16px, 2.2vh, 21px)/1 inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kiosk-search-suggest      { padding: 0 clamp(10px, 2vw, 20px) 8px; }
.kiosk-search-suggest-head { font-size: clamp(15px, 2vh, 19px); font-weight: 700; color: #2b2719; margin-bottom: 10px; }
.kiosk-search-suggest-word { font-weight: 400; color: #6b6450; }

/* --- On-screen QWERTY (kiosk_keyboard.js) --- */
.kiosk-kb-slot { background: #ece7d9; border-top: 2px solid #ded8c4; }
.kiosk-kb {
    padding: clamp(6px, 1vh, 12px);
    display: flex;
    flex-direction: column;
    gap: clamp(5px, 0.8vh, 10px);
}
.kiosk-kb-row { display: flex; gap: clamp(4px, 0.7vw, 9px); justify-content: center; }

.kiosk-kb-key {
    flex: 1 1 0;
    min-width: 0;
    min-height: clamp(44px, 6.5vh, 74px);
    font: 600 clamp(16px, 2.6vh, 26px)/1 inherit;
    color: #2b2719;
    background: #fff;
    border: 1px solid #cfc8b4;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.kiosk-kb-key:active { background: #5c5638; color: #fff; transform: scale(0.97); }
.kiosk-kb-wide   { flex: 1.5 1 0; background: #ded8c4; }
.kiosk-kb-space  { flex: 5 1 0; }
.kiosk-kb-done   { flex: 2 1 0; background: #5c5638; color: #fff; }
.kiosk-kb-active { background: #5c5638; color: #fff; }


/* Add-to-cart feedback must land ON TOP of the search overlay — the
   page's own #voiceStatus is behind it and would be invisible. */
.kiosk-search-status {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 92px;
    z-index: 1210;
}

/* ------------------------------------------------------------------
   Volume / quantity-break pricing  (2026-09-18)
   Shown under a cart line's total when the quantity has reached a
   price band, so the customer can see WHY the total moved when they
   tapped +. Small and secondary — the line total stays the headline.
   ------------------------------------------------------------------ */
.order-item-breakprice {
    display: block;
    margin-top: 2px;
    font-size: 0.72em;
    font-weight: 600;
    line-height: 1.2;
    color: #16a34a;
    white-space: nowrap;
}

body.kiosk-mode .order-item-breakprice {
    font-size: 0.8em;
}

/* ------------------------------------------------------------------
   verify_code.php - email fallback ("I did not receive the Text
   Message"), added 2026-10-07. Panel sits under the Resend button.
   ------------------------------------------------------------------ */
.identification-section .otp-email-toggle {
    margin-top: 8px;
    background: transparent;
    color: #5c5638;
    border: 2px solid #5c5638;
    padding: 12px 20px;
    font-size: clamp(14px, 2vh, 16px);
}
.identification-section .otp-email-toggle:hover {
    background: rgba(92, 86, 56, 0.08);
}
.identification-section .otp-email-panel {
    margin-top: 8px;
    padding: 16px;
    border: 2px solid #e8dcb8;
    border-radius: 12px;
    background: #fbf8ef;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}
.identification-section .otp-email-panel form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.identification-section .otp-email-intro {
    margin: 0;
    color: #333;
    font-size: clamp(14px, 2vh, 16px);
}
.identification-section .otp-email-input {
    width: 100%;
    text-align: center;
    font-size: clamp(16px, 2.4vh, 20px);   /* 16px+ stops iOS zooming on focus */
    letter-spacing: normal;
}
.identification-section .otp-email-send {
    animation: none;   /* .primary-btn fades in after 0.5 s; the panel opens on a tap, so show it at once */
}
.identification-section .otp-email-cancel {
    background: none;
    border: none;
    color: #666;
    text-decoration: underline;
    font-size: 15px;
    padding: 8px;
    cursor: pointer;
    align-self: center;
}
