/*
 * Bosssmarket storefront design system.
 *
 * Broad marketplace conventions (prominent search, category navigation,
 * account/cart in the header, category collections) are used as a familiar
 * shopping pattern. No third-party logo, imagery, wording or layout has been
 * copied.
 *
 * Palette: orange, matching the tone of the operator's Healthie brand. The
 * colour VALUES were sampled from that site; nothing else was taken from it.
 *
 *   brand   orange   shopping actions, header, hero
 *   kash    teal     Superkash, and only Superkash
 *   navy-*  warm dark neutrals for type and chrome (named before the rebrand)
 *
 * Superkash deliberately does not wear the brand colour. A point quantity must
 * never read as a price or as a primary action, and the two sitting in the same
 * hue is one glance away from both.
 */

:root {
    /*
     * Brand: orange, sampled from the Healthie site (its header is #f96b00).
     *
     * The vivid tone is a SURFACE colour. White text on it measures 2.94:1,
     * which fails WCAG AA even for large text, so anything carrying white text
     * -- buttons, badges, active states -- uses brand-600 at 4.79:1 instead.
     * Same tone, legible. brand-700 is for orange text on white (6.22:1).
     */
    --brand-700: #8f3502;
    --brand-600: #c44c03;
    --brand-500: #f96b00;
    --brand-100: #fff1e6;

    /*
     * Superkash keeps an accent of its own, deliberately NOT the brand colour.
     * A point quantity must never read as a price or as a primary action, and
     * a gold badge beside an orange button is one glance away from both. Teal
     * is unambiguous against orange and carries its own contrast.
     */
    --kash-700: #0b6a5f;
    --kash-600: #0e8375;
    --kash-500: #12a08e;
    --kash-100: #e2f4f1;

    /* Warm neutrals, to sit under an orange brand rather than fight it. */
    --navy-900: #241a12;
    --navy-800: #33261b;
    --navy-600: #5a4839;
    --navy-400: #7d6c5d;
    --navy-200: #b6a99c;

    /*
     * The old names kept, pointing at their new roles, so every existing rule
     * keeps working: teal WAS the primary, gold WAS Superkash. Renaming 43
     * usages in one pass would have been silent risk for no gain.
     */
    --teal-700: var(--brand-700);
    --teal-600: var(--brand-600);
    --teal-500: var(--brand-500);
    --teal-100: var(--brand-100);

    --gold-700: var(--kash-700);
    --gold-600: var(--kash-600);
    --gold-500: var(--kash-500);
    --gold-100: var(--kash-100);

    /*
     * Warning. Its own colour, not an alias.
     *
     * The rebrand pointed --gold-* at the Superkash teal, which quietly made
     * every .alert-warning identical to .alert-info — a warning that looks
     * like information is a warning nobody reads. Amber is far enough from
     * both the brand orange and the Superkash teal to be told apart at a
     * glance, and warn-700 on warn-100 is 6.86:1.
     */
    --warn-700: #7a4a00;
    --warn-600: #a06400;
    --warn-100: #fff4e0;

    --red-600: #b3261e;
    --red-100: #fdeceb;
    --green-700: #1f6b3a;
    --green-100: #e8f5ec;

    --surface: #ffffff;
    --surface-muted: #f7f4f0;
    --border: #e8e1d9;
    --border-strong: #d3c8bc;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(36, 26, 18, .07);
    --shadow-md: 0 4px 16px rgba(36, 26, 18, .09);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;

    --max-width: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--navy-900);
    background: var(--surface);
}

h1, h2, h3, h4 { color: var(--navy-900); line-height: 1.25; margin: 0 0 var(--space-3); }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 var(--space-3); }

a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 3px solid var(--teal-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--navy-900); color: #fff; padding: var(--space-3) var(--space-4); z-index: 100;
}
.skip-link:focus { left: var(--space-3); top: var(--space-3); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-4); }

/* ------------------------------------------------------------ demo banner */
.demo-banner {
    background: var(--gold-100);
    border-bottom: 1px solid var(--gold-500);
    color: var(--gold-700);
    font-size: .85rem;
    padding: var(--space-2) 0;
    text-align: center;
}

/* ---------------------------------------------------------------- header */
.utility-strip {
    background: var(--navy-900);
    color: #dbe3f0;
    font-size: .8rem;
}
.utility-strip .container { display: flex; gap: var(--space-4); align-items: center; min-height: 34px; }
.utility-strip a { color: #dbe3f0; }
.utility-strip .spacer { margin-left: auto; }
.locale-form { display: inline-flex; gap: var(--space-2); align-items: center; }
.locale-form select {
    background: transparent; color: #dbe3f0; border: 1px solid #33456b;
    border-radius: var(--radius-sm); padding: 2px var(--space-2); font-size: .8rem;
}

/*
 * The orange bar is the brand's most recognisable element, so the header wears
 * it. Everything inside then sits on orange rather than on white: the logo, the
 * account actions and the search field all get their own treatment below,
 * because inheriting white-on-orange defaults would have dropped several of
 * them below a readable contrast.
 */
.site-header { border-bottom: 1px solid var(--brand-700); background: var(--brand-500); }
.site-header .container {
    display: flex; align-items: center; gap: var(--space-4);
    padding-top: var(--space-4); padding-bottom: var(--space-4);
}

.logo { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-mark {
    width: 34px; height: 34px; border-radius: 9px;
    /* White on orange, so the mark reads as a cut-out rather than a second
       orange shape sitting on the bar. */
    background: #fff;
    display: grid; place-items: center; color: var(--brand-700); font-weight: 700; font-size: 1.05rem;
}
.logo-text { font-weight: 700; font-size: 1.25rem; color: #fff; letter-spacing: -.02em; }

.search-form { flex: 1 1 auto; display: flex; min-width: 0; }
.search-form input[type="search"] {
    flex: 1 1 auto; min-width: 0;
    /* The field stays white on the orange bar: typed text needs a calm
       background, and a tinted input on orange is hard to read at any size. */
    border: 1.5px solid var(--brand-700); border-right: 0; background: #fff;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 11px var(--space-4); font-size: 1rem; font-family: inherit; color: var(--navy-900);
}
.search-form input[type="search"]:focus {
    border-color: #fff; outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .55);
}
.search-form button {
    border: 0; background: var(--brand-700); color: #fff; font-weight: 600;
    padding: 0 var(--space-5); border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-size: .95rem;
}
.search-form button:hover { background: var(--navy-900); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.header-action {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 62px; min-height: 44px; padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm); color: #fff; font-size: .75rem; text-decoration: none;
}
.header-action:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }
.header-action strong { font-size: .85rem; font-weight: 600; }
/* Superkash keeps its own colour even on the orange bar: a balance is not a
   navigation item, and it must not read as part of the brand furniture. */
.header-action.superkash { color: var(--kash-700); background: var(--kash-100); }
/* Signed-out visitors get two pills rather than two columns of small text, so
   the way in is obvious to someone who has never had an account. */
.header-action.pill {
    flex-direction: row; gap: var(--space-2); border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, .85); padding: 9px var(--space-4); min-width: 0;
}
.header-action.pill span { display: none; }
.header-action.pill strong { font-size: .9rem; }
.header-action.pill:hover { background: rgba(255, 255, 255, .18); }
.header-action.pill.solid { background: #fff; color: var(--brand-700); border-color: #fff; }
.header-action.pill.solid:hover { background: var(--brand-100); }

/*
 * On a phone the pills, the search field and the cart do not fit on one line,
 * and forcing them produces a header that scrolls sideways. The bottom
 * navigation already carries Account, which is the same destination, so the
 * pills stand down below 720px rather than compete for the width.
 */
@media (max-width: 720px) {
    .header-action.pill { display: none; }
}
.header-action .count {
    background: #fff; color: var(--brand-700); border-radius: 999px;
    font-size: .7rem; padding: 0 6px; margin-left: 4px; font-weight: 700;
}

/* ------------------------------------------------------------ navigation */
.category-nav { border-bottom: 1px solid var(--border); background: var(--surface); position: relative; }
.category-nav ul { list-style: none; display: flex; gap: var(--space-1); margin: 0; padding: 0; overflow-x: auto; }
.category-nav > .container > ul > li > a {
    display: block; padding: var(--space-3) var(--space-3);
    color: var(--navy-800); font-size: .92rem; font-weight: 500; white-space: nowrap;
}
.category-nav li { position: relative; }
.category-nav li:hover > a, .category-nav a:focus-visible { color: var(--teal-700); }
.mega-menu {
    display: none; position: absolute; left: 0; top: 100%; z-index: 30;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); padding: var(--space-4); min-width: 260px;
}
.category-nav li:hover .mega-menu,
.category-nav li:focus-within .mega-menu { display: block; }
.mega-menu ul { flex-direction: column; gap: 0; }
.mega-menu a { display: block; padding: var(--space-2) var(--space-3); font-size: .9rem; border-radius: var(--radius-sm); }
.mega-menu a:hover { background: var(--surface-muted); text-decoration: none; }

/* ------------------------------------------------------------------- hero */
.hero {
    /* Orange, the way the brand uses it: a confident block of colour rather
       than a dark panel with a tint. The gradient runs deep-to-vivid so the
       heading sits on the darker end, where white text is legible. */
    background: linear-gradient(120deg, var(--brand-700) 0%, var(--brand-600) 55%, var(--brand-500) 100%);
    color: #fff; border-radius: var(--radius); padding: var(--space-7) var(--space-6);
    margin: var(--space-5) 0; display: grid; gap: var(--space-3);
}
.hero h1 { color: #fff; font-size: 2.1rem; max-width: 22ch; }
.hero p { color: #ffe9d8; max-width: 52ch; font-size: 1.02rem; }
/* On orange, a solid white button carries the action; an orange one would
   disappear into its own background. */
.hero .btn-primary { background: #fff; color: var(--brand-700); border-color: #fff; }
.hero .btn-primary:hover { background: var(--brand-100); color: var(--brand-700); }
.hero .btn { justify-self: start; }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 44px; padding: 0 var(--space-5);
    border: 1.5px solid transparent; border-radius: var(--radius);
    font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }
.btn-primary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--navy-800); }
.btn-secondary:hover { border-color: var(--navy-400); }
.btn-superkash { background: var(--gold-600); border-color: var(--gold-600); color: #fff; }
.btn-superkash:hover { background: var(--gold-700); border-color: var(--gold-700); }
.btn-danger { background: var(--surface); border-color: var(--red-600); color: var(--red-600); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: .85rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------- product media frame */
/*
 * One frame, used everywhere a product photo appears: grid cards, the product
 * page, the cart, and the admin editor's live preview. The photo is positioned
 * and scaled purely with CSS from the stored adjustment values, so what an
 * editor frames in the admin is exactly what a shopper sees.
 */
.media-frame {
    position: relative;
    overflow: hidden;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    display: block;
    width: 100%;
}
.media-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* object-position and transform are set inline per image from focal_x,
       focal_y and zoom_percent. */
    will-change: transform;
}
.media-frame-empty {
    display: grid;
    place-items: center;
    color: var(--navy-200);
    font-size: .8rem;
    border: 1px dashed var(--border-strong);
}
.media-frame .demo-tag {
    position: absolute; top: var(--space-2); left: var(--space-2); z-index: 2;
    background: var(--gold-100); color: var(--gold-700); border: 1px solid var(--gold-500);
    font-size: .65rem; padding: 2px 6px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: .04em;
}

/* ------------------------------------------------------------ product grid */
.section { margin: var(--space-6) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.section-head p { color: var(--navy-400); margin: 0; font-size: .9rem; }

.product-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.product-card {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    display: flex; flex-direction: column; overflow: hidden;
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-card .thumb { position: relative; }
.product-card .thumb .media-frame { border-radius: 0; }
.product-card .body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); flex: 1 1 auto; }
.product-card .brand { font-size: .72rem; color: var(--navy-400); text-transform: uppercase; letter-spacing: .05em; }
.product-card .name { font-size: .92rem; font-weight: 600; color: var(--navy-900); }
.product-card .name a { color: inherit; }
.product-card .offers { margin-top: auto; display: grid; gap: var(--space-1); }
.product-card .actions { padding: 0 var(--space-3) var(--space-3); }

/* --------------------------------------------------------- offer displays */
.offer-cash { font-size: 1.1rem; font-weight: 700; color: var(--navy-900); }
.offer-compare { font-size: .8rem; color: var(--navy-400); text-decoration: line-through; margin-left: var(--space-2); }
.offer-mixed, .offer-full {
    display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: .82rem; padding: 3px 8px; border-radius: 999px; border: 1px solid;
}
.offer-mixed { background: var(--teal-100); border-color: var(--teal-500); color: var(--teal-700); }
.offer-full { background: var(--gold-100); border-color: var(--gold-500); color: var(--gold-700); }
.points-value { font-weight: 700; font-variant-numeric: tabular-nums; }

.badge {
    display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px;
    border-radius: 999px; border: 1px solid var(--border-strong); color: var(--navy-600); background: var(--surface-muted);
}
.badge-ok { background: var(--green-100); border-color: var(--green-700); color: var(--green-700); }
.badge-warn { background: var(--gold-100); border-color: var(--gold-600); color: var(--gold-700); }
.badge-danger { background: var(--red-100); border-color: var(--red-600); color: var(--red-600); }
.badge-superkash { background: var(--gold-100); border-color: var(--gold-500); color: var(--gold-700); }

/*
 * A badge inside a data table keeps square-ish corners.
 *
 * A 999px radius draws a pill, and a pill whose text has wrapped is an
 * ellipse: the corners curve in behind the first and last lines and the
 * words read as though they are spilling out of their own border. Table
 * columns are narrow and these labels are sentences ("No price has been
 * approved"), so they wrap often. A plain rounded corner survives any
 * number of lines.
 */
.data .badge { border-radius: 8px; }

/* --------------------------------------------------------- product detail */
.product-detail { display: grid; gap: var(--space-6); margin: var(--space-5) 0; }
@media (min-width: 900px) { .product-detail { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); } }
.product-gallery { display: grid; gap: var(--space-3); }
.product-gallery .media-frame { border-radius: var(--radius); }
.product-gallery-thumbs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.product-gallery-thumbs button {
    width: 72px; padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm);
    background: none; cursor: pointer; overflow: hidden; line-height: 0;
}
.product-gallery-thumbs button[aria-current="true"] { border-color: var(--teal-600); }
.product-gallery-thumbs .media-frame { border-radius: 0; }
.buy-box { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); display: grid; gap: var(--space-4); align-content: start; }
.buy-option {
    border: 1.5px solid var(--border); border-radius: var(--radius); padding: var(--space-4);
    display: grid; gap: var(--space-2); cursor: pointer;
}
.buy-option:has(input:checked) { border-color: var(--teal-600); background: var(--teal-100); }
/* A collection point is chosen by a link rather than a radio, because the
   choice re-prices the page. Same selected look, no input to read. */
.buy-option.is-selected { border-color: var(--teal-600); background: var(--teal-100); }
.collection-code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 2rem;
    letter-spacing: .35em; font-weight: 700; }
.buy-option.superkash:has(input:checked) { border-color: var(--gold-600); background: var(--gold-100); }
.buy-option .option-head { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.buy-option .option-note { font-size: .82rem; color: var(--navy-400); }
.buy-option[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* How much Superkash to put towards the basket.
   Attached under the option it belongs to rather than floating beside it, so
   the amount reads as part of that choice. Dimmed until the option is the
   selected one — visible, because a shopper has to be able to see what the
   option would cost before choosing it. */
.superkash-chooser {
    margin: calc(var(--space-2) * -1) 0 var(--space-2);
    padding: var(--space-4);
    border: 1.5px solid var(--gold-600); border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--gold-100);
    display: grid; gap: var(--space-2);
}
.superkash-chooser[data-chooser-idle] { opacity: .8; }
/* Said once, above the options: points are being spent unless the shopper
   says otherwise, so it reads as information rather than a warning. */
/* What is stopping a product selling, as a list an operator can work down.
   Each line is a heading and the thing to do about it. */
.readiness { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.readiness li { display: grid; gap: 2px; padding-left: var(--space-4); border-left: 3px solid var(--gold-600); }
.readiness-note { margin-top: var(--space-4); }
.readiness-note li { border-left-color: var(--border); }
.applied-note { margin: calc(var(--space-3) * -1) 0 var(--space-4); font-size: .85rem; color: var(--navy-400); }
.superkash-chooser .chooser-label { font-weight: 600; font-size: .9rem; }
.superkash-chooser .chooser-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.superkash-chooser .chooser-number { width: 9rem; min-height: 44px; }
.superkash-chooser .chooser-note { margin: 0; font-size: .82rem; color: var(--navy-400); }

/* The Superkash balance, stated once above the payment choices: this is the
   first page that knows both the basket and what the shopper holds. */
.balance-line {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    background: var(--gold-100);
    border: 1px solid var(--gold-600);
    font-size: .9rem;
}

/* -------------------------------------------------------- photo upload (admin) */
.upload-preview {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.upload-preview img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

/* -------------------------------------------------------- photo editor (admin) */
.image-editor-grid { display: grid; gap: var(--space-5); }
@media (min-width: 820px) {
    .image-editor-grid { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
}

.editor-stage {
    position: relative;
    max-width: 360px;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: grab;
    /* The browser must not pan the page while a photo is being dragged. */
    touch-action: none;
    user-select: none;
}
.editor-stage:active { cursor: grabbing; }
.editor-stage .media-frame { border-radius: 0; }
.editor-stage img { pointer-events: none; }

/* A centre crosshair, so the focal point being chosen is visible. */
.editor-stage::after {
    content: "";
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background:
        linear-gradient(to right, transparent calc(50% - 1px), rgba(255, 255, 255, .85) calc(50% - 1px),
            rgba(255, 255, 255, .85) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(255, 255, 255, .85) calc(50% - 1px),
            rgba(255, 255, 255, .85) calc(50% + 1px), transparent calc(50% + 1px));
    opacity: 0;
    transition: opacity .15s ease;
}
.editor-stage.is-dragging::after { opacity: 1; }

.editor-hint {
    position: absolute; bottom: var(--space-2); left: 50%; transform: translateX(-50%);
    z-index: 2; background: rgba(15, 27, 51, .78); color: #fff;
    font-size: .72rem; padding: 3px 10px; border-radius: 999px; pointer-events: none;
    transition: opacity .15s ease;
}
.editor-stage.is-dragging .editor-hint { opacity: 0; }

.editor-mini { width: 132px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.editor-mini .media-frame { border-radius: 0; }

input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--teal-600); }
input[type="file"] { padding: 9px var(--space-3); background: var(--surface); }

/* A note beside the sign-in form. Informational, not a warning: somebody
   whose login does not work is already mildly annoyed, and an alarm-coloured
   box would read as "something is broken" rather than "you need an account". */
.sign-in-note {
    margin-top: var(--space-4);
    padding: var(--space-3);
    border-left: 3px solid var(--kash-500);
    background: var(--surface-muted);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: .86rem;
    line-height: 1.6;
    color: var(--navy-600);
}

/* ------------------------------------------------------- legal documents */
/* The block in the terms and the privacy notice that names the selling
   company. It is the one paragraph on those pages a reader may need to copy
   down, so it is set apart rather than left in the flow of prose. */
.legal-entity {
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--brand-500);
    background: var(--surface-muted);
    border-radius: 0 var(--radius) var(--radius) 0;
    line-height: 1.7;
}

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.data th, table.data td { padding: var(--space-3); text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { background: var(--surface-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--navy-600); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* On narrow screens, dense tables become stacked cards. */
@media (max-width: 640px) {
    table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
    table.data.stack { min-width: 0; }
    table.data.stack thead { display: none; }
    table.data.stack tr { border-bottom: 1px solid var(--border); padding: var(--space-2) 0; }
    table.data.stack td { border: 0; display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) var(--space-3); }
    table.data.stack td::before { content: attr(data-label); font-weight: 600; color: var(--navy-600); font-size: .8rem; }
    table.data.stack td.num { text-align: right; }
}

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.field label { font-size: .88rem; font-weight: 600; color: var(--navy-800); }
.field .hint { font-size: .8rem; color: var(--navy-400); }
.field .error { font-size: .82rem; color: var(--red-600); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], input[type="search"], select, textarea {
    width: 100%; min-height: 44px; padding: 10px var(--space-3);
    border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .95rem; color: var(--navy-900); background: var(--surface);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-500); outline: none; box-shadow: 0 0 0 3px var(--teal-100); }
input[aria-invalid="true"] { border-color: var(--red-600); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
legend { font-weight: 600; padding: 0 var(--space-2); }

/* ------------------------------------------------------------------ cards */
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); background: var(--surface); }
.card + .card { margin-top: var(--space-4); }
.card-muted { background: var(--surface-muted); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }

.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat {
    border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); background: var(--surface);
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-400); }
.stat .value { font-size: 1.5rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.stat .value.superkash { color: var(--gold-700); }
.stat .note { font-size: .78rem; color: var(--navy-400); }

/* --------------------------------------------------------------- messages */
.alert { border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); border: 1px solid; font-size: .92rem; }
.alert-info { background: var(--teal-100); border-color: var(--teal-500); color: var(--teal-700); }
.alert-success { background: var(--green-100); border-color: var(--green-700); color: var(--green-700); }
.alert-warning { background: var(--warn-100); border-color: var(--warn-600); color: var(--warn-700); }
.alert-danger { background: var(--red-100); border-color: var(--red-600); color: var(--red-600); }

.empty-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--navy-400); }
.empty-state h3 { color: var(--navy-800); }

.policy-note {
    border-left: 3px solid var(--gold-500); background: var(--gold-100); color: var(--gold-700);
    padding: var(--space-3) var(--space-4); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .85rem; margin: var(--space-3) 0;
}

.loading { color: var(--navy-400); font-size: .9rem; }

/* ----------------------------------------------------------------- footer */
/*
 * The footer wears the brand, the way the header does. Type is white on
 * brand-600 rather than on the vivid brand-500: at 4.79:1 the small print is
 * actually readable, which is the point of small print.
 */
.site-footer {
    background: var(--brand-600); color: #fff;
    margin-top: var(--space-7); padding: var(--space-6) 0 96px;
}
.footer-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.footer-grid h4 {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255, 255, 255, .72); margin-bottom: var(--space-3);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.footer-grid a { color: #fff; font-size: .92rem; text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }

.footer-identity { display: grid; gap: var(--space-2); align-content: start; }
.footer-logo {
    font-weight: 700; font-size: 1.3rem; letter-spacing: .12em;
    text-transform: uppercase; margin-bottom: var(--space-3);
}
.footer-identity p { margin: 0; font-size: .88rem; line-height: 1.55; font-weight: 600; }
.footer-identity a { text-decoration: underline; }
.footer-legal-name { text-transform: uppercase; }

.footer-contact li { font-size: .9rem; line-height: 1.5; }

.footer-bar {
    margin-top: var(--space-6); padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, .28);
    display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: space-between; align-items: baseline;
}
.footer-bar p { margin: 0; font-size: .8rem; color: rgba(255, 255, 255, .85); max-width: 78ch; }
.footer-bar-company { text-transform: uppercase; font-weight: 700; color: #fff !important; }

/* ------------------------------------------------------- mobile bottom nav */
.mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav a {
    min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: .68rem; color: var(--navy-600); text-decoration: none;
}
.mobile-nav a[aria-current="page"] { color: var(--teal-700); font-weight: 600; }
.mobile-nav .icon { font-size: 1.1rem; line-height: 1; }
@media (min-width: 900px) { .mobile-nav { display: none; } .site-footer { padding-bottom: var(--space-6); } }

/* Sticky purchase action on mobile product pages. */
.sticky-buy {
    position: sticky; bottom: 56px; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--border); padding: var(--space-3) var(--space-4);
    display: flex; gap: var(--space-3); align-items: center; margin: 0 calc(var(--space-4) * -1);
}
.sticky-buy .totals { font-size: .85rem; }
@media (min-width: 900px) { .sticky-buy { position: static; border: 0; padding: 0; margin: 0; } }

/* ------------------------------------------------------------ portal shell */
.portal { display: grid; gap: var(--space-5); }
@media (min-width: 900px) { .portal { grid-template-columns: 220px minmax(0, 1fr); } }
.portal-nav { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); align-self: start; }
.portal-nav h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-400); margin: var(--space-3) var(--space-2) var(--space-2); }
.portal-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.portal-nav a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--navy-800); font-size: .9rem; }
.portal-nav a:hover { background: var(--surface-muted); text-decoration: none; }
.portal-nav a[aria-current="page"] { background: var(--teal-100); color: var(--teal-700); font-weight: 600; }

.breadcrumb { font-size: .84rem; color: var(--navy-400); margin: var(--space-4) 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--border-strong); }

.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin-bottom: var(--space-4); }
.filter-bar .field { margin: 0; }

.pagination { display: flex; gap: var(--space-2); justify-content: center; margin: var(--space-5) 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--navy-800); font-size: .9rem;
}
.pagination [aria-current="page"] { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.text-muted { color: var(--navy-400); }
.text-small { font-size: .84rem; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--space-4); } .mb-4 { margin-bottom: var(--space-4); }
.flex-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
    .utility-strip, .site-header, .category-nav, .mobile-nav, .site-footer, .no-print { display: none !important; }
    body { font-size: 12px; }
    .card, .table-wrap { border-color: #999; }
}

/* ------------------------------------------- catalogue tiles on a phone */
/*
 * The printed flyer layout, for the screen people actually shop on.
 *
 * The desktop card is a card: a border, a gap either side, a brand line, a
 * View options button. At 390px that costs about 300px of height per product,
 * so a phone shows two and a half of them. The same shelf printed on a leaflet
 * shows twelve, and it does it by throwing away everything that is not the
 * picture, the price and the name.
 *
 * So on a phone the tiles butt together like a leaflet grid, the price leads
 * in brand orange, the name follows small underneath, and the button goes —
 * the whole tile is the link instead, which is a far bigger tap target than
 * the button ever was. Nothing below 641px touches the desktop grid.
 */
@media (max-width: 640px) {
    .product-grid { gap: 2px; }

    .product-card {
        position: relative;
        border: 0;
        border-radius: 0;
        background: var(--brand-100);
    }
    /* Two warm tones alternating, as the leaflet does, so the eye can tell
       one tile from the next without a border between them. */
    .product-card:nth-child(4n + 2),
    .product-card:nth-child(4n + 3) { background: #fff8f2; }

    .product-card:hover { box-shadow: none; }

    .product-card .body {
        padding: 8px 10px 12px;
        gap: 1px;
        display: flex;
        flex-direction: column;
    }

    /* The price leads. Source order keeps the name first, which is the right
       order to hear it read aloud; only the painting order changes. */
    .product-card .offers { order: -1; margin-top: 0; }
    .product-card .name { order: 0; }
    .product-card .badge { order: 1; align-self: flex-start; margin-top: 4px; }

    .product-card .offer-cash {
        font-size: 1.22rem;
        font-weight: 800;
        color: var(--brand-700);
        letter-spacing: -.01em;
    }
    .product-card .offer-compare { display: block; margin-left: 0; font-size: .74rem; }

    .product-card .name { font-size: .78rem; font-weight: 500; line-height: 1.3; }

    /* The brand line is the first thing a leaflet drops: the product name
       almost always carries the brand already. */
    .product-card .brand { display: none; }

    /* The button goes, and the name's link is stretched over the whole tile
       in its place. One link per tile, and a tap target the size of the tile. */
    .product-card .actions { display: none; }
    .product-card .name a::after { content: ''; position: absolute; inset: 0; }

    /* Less throat-clearing above the shelf, so the first row starts on screen
       rather than below it. The category page spends roughly 250px on a
       breadcrumb, a heading, a description and a filter bar before the first
       product; a phone screen is 844px tall. */
    main > h1 { font-size: 1.45rem; margin-bottom: var(--space-2); }
    main > .breadcrumb { margin-bottom: var(--space-2); }
    main > h1 + p.text-muted { margin-bottom: var(--space-3); font-size: .85rem; }

    /*
     * The filter bar, compacted rather than hidden.
     *
     * Stacked label-over-control it runs to about 340px — taller than the
     * first row of products it is meant to filter, so on a phone you scroll
     * past the controls to reach the thing being controlled. Side by side with
     * the labels doing their work as small captions it costs about 90px, and
     * nothing is removed: every control a shopper had, they still have.
     */
    .filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
    .filter-bar .field { flex: 1 1 calc(50% - var(--space-2)); margin-bottom: 0; gap: 2px; }
    .filter-bar .field label { font-size: .72rem; color: var(--navy-600); }
    .filter-bar select { min-height: 40px; font-size: .85rem; padding: 6px var(--space-2); }
    .filter-bar .btn { flex: 0 0 auto; min-height: 40px; }
    .filter-bar .text-small { flex: 1 1 100%; }

    /*
     * The header search, given its own row.
     *
     * Three things share one row: the wordmark, the search field and the cart.
     * The field is the only one that flexes, so on a 390px screen it gets
     * whatever the other two leave — about 90px, most of which the Search
     * button takes. What is left is a white sliver too narrow to show a word
     * of what you typed. Wrapping it onto its own full-width line costs one
     * row of height and makes the field usable.
     */
    .site-header > .container { flex-wrap: wrap; row-gap: var(--space-2); }
    .search-form { order: 3; flex: 1 0 100%; }
    .logo { flex: 1 1 auto; min-width: 0; }
    .header-actions { flex: 0 0 auto; }
    .search-form input[type="search"] { padding: 9px var(--space-3); font-size: .95rem; }
    .search-form button { padding: 0 var(--space-4); }
}

/* ------------------------------------------------- a field with a fixed prefix */
/*
 * The +6 before a phone box. It is part of the control, not a label floating
 * beside it: a prefix that looks detachable invites people to type it again.
 */
.input-prefixed {
    display: flex; align-items: stretch;
    border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); overflow: hidden;
}
.input-prefixed:focus-within { border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
.input-prefixed .prefix {
    display: flex; align-items: center; padding: 0 var(--space-3);
    background: var(--surface-muted); color: var(--navy-600);
    font-weight: 600; font-variant-numeric: tabular-nums;
    border-right: 1.5px solid var(--border-strong);
}
.input-prefixed input {
    border: 0; border-radius: 0; flex: 1 1 auto; min-width: 0;
    font-variant-numeric: tabular-nums;
}
.input-prefixed input:focus { box-shadow: none; border-color: transparent; }
