/* =============================================================================
   MyJega — foundation stylesheet.

   This is NOT the site design. §43-§45 (brand identity, homepage, header,
   mobile-first product UI) are built in Phase 8 alongside the catalogue.

   What lives here is only what the Phase 6 foundation needs: a readable shell,
   error pages, and flash messages.
   ============================================================================= */

:root {
    --ink:        #1a1a1a;
    --ink-muted:  #6b6b6b;
    --iron:       #2c3038;   /* cast iron */
    --ember:      #b4531f;   /* seasoned/heat accent */
    --surface:    #ffffff;
    --surface-2:  #f5f4f2;
    --line:       #e3e1de;
    --ok:         #1c6b45;
    --bad:        #a32020;

    --radius: 6px;
    --shell:  1120px;
}

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

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
    -webkit-text-size-adjust: 100%;
}

.container {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: 20px;
}

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

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 3px;
}

.muted { color: var(--ink-muted); }

/* ---- header / footer ---------------------------------------------------- */

.site-header {
    background: var(--iron);
    color: #fff;
    padding-block: 14px;
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
}
.brand:hover { text-decoration: none; }

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}
.main-nav a { color: #e8e6e3; font-size: 0.95rem; }

.site-footer {
    margin-top: 64px;
    padding-block: 28px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 0.9rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 8px; }

main.container { padding-block: 32px; }

/* ---- flash -------------------------------------------------------------- */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 4px solid;
    margin-bottom: 20px;
}
.flash-ok  { background: #eaf5ef; border-color: var(--ok);  color: var(--ok); }
.flash-bad { background: #fbecec; border-color: var(--bad); color: var(--bad); }

/* ---- panels ------------------------------------------------------------- */

.panel {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-block: 20px;
}

.lead { font-size: 1.15rem; color: var(--ink-muted); }

/* ---- error pages -------------------------------------------------------- */

.error-page { background: var(--surface-2); }

.error-shell {
    max-width: 640px;
    padding-block: 72px;
}

.error-code {
    font-size: 4.5rem;
    line-height: 1;
    margin: 0 0 8px;
    color: var(--iron);
    letter-spacing: -0.02em;
}

.error-back { margin-top: 32px; }

.trace {
    background: var(--iron);
    color: #e8e6e3;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* ---- forms & auth ------------------------------------------------------- */

.auth-card {
    max-width: 440px;
    margin-inline: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px;
}
.auth-card h1 { margin-top: 0; font-size: 1.6rem; }

label {
    display: block;
    margin-top: 18px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], textarea, select {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    font-size: 0.98rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--ember);
    outline-offset: 1px;
    border-color: var(--ember);
}
input:disabled { background: var(--surface-2); color: var(--ink-muted); }

.field-hint { margin: 6px 0 0; font-size: 0.85rem; color: var(--ink-muted); }

.btn {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 24px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--ember);
    border: 1px solid var(--ember);
    border-radius: var(--radius);
    cursor: pointer;
}
.btn:hover { background: #99441a; text-decoration: none; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 14px; margin-top: 0; font-size: 0.88rem; }

.inline-form { display: inline-block; }

.auth-links { margin-top: 22px; font-size: 0.92rem; }
.auth-links .sep { color: var(--ink-muted); margin-inline: 6px; }

.error-list { margin: 0; padding-left: 20px; }
.error-list li + li { margin-top: 4px; }

/* ---- account ------------------------------------------------------------ */

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-block: 28px;
}
.account-tile {
    display: block;
    padding: 20px;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.account-tile:hover { border-color: var(--ember); text-decoration: none; }
.account-tile h2 { margin: 0 0 4px; font-size: 1.05rem; }
.account-tile p  { margin: 0; font-size: 0.9rem; }

/* ---- admin -------------------------------------------------------------- */

.admin-body { background: var(--surface-2); }
.admin-header { background: var(--iron); color: #fff; padding-block: 14px; }
.admin-header .brand { color: #fff; }
.admin-tag {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--ember);
    padding: 2px 7px;
    border-radius: 3px;
    vertical-align: middle;
}
.admin-user { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; }
.admin-user .muted { color: #b8b5b1; }

.admin-login-page { display: flex; align-items: center; min-height: 100vh; }
.admin-auth { margin-block: 48px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 16px; margin-block: 24px; }
.stat {
    flex: 1 1 150px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--iron); line-height: 1.1; }
.stat-label { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--ink-muted); }

/* ---- catalogue ---------------------------------------------------------- */

.catalogue { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
.catalogue-sidebar h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.category-nav { list-style: none; margin: 0; padding: 0; font-size: .93rem; }
.category-nav li { padding: 4px 0; }
.category-nav .is-parent { margin-top: 10px; font-weight: 600; }
.category-nav .is-child a { padding-left: 12px; }
.category-nav a { color: var(--ink); }

.catalogue-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; }
.catalogue-head h1 { margin: 0; font-size: 1.5rem; }
.catalogue-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.catalogue-controls input, .catalogue-controls select { width: auto; padding: 8px 10px; }
.catalogue-controls .btn { margin-top: 0; }

.breadcrumb { font-size: .88rem; color: var(--ink-muted); margin-bottom: 18px; }
.breadcrumb span { margin-inline: 6px; }

.child-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px; }
.chip {
    display: inline-block; padding: 6px 14px; font-size: .9rem;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 999px; color: var(--ink);
}
.chip:hover { border-color: var(--ember); text-decoration: none; }

/* ---- product grid & card ------------------------------------------------ */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-block: 24px;
}

.product-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: border-color .15s;
}
.product-card:hover { border-color: var(--ember); }
.product-card-link { color: var(--ink); display: block; }
.product-card-link:hover { text-decoration: none; }

.product-card-media { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.product-card-media img { width: 100%; height: 100%; object-fit: contain; display: block; }

.product-card-noimage {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(45deg, #f0eeec, #f0eeec 10px, #e8e5e2 10px, #e8e5e2 20px);
    color: var(--ink-muted); font-size: .85rem; text-align: center;
}
.product-card-noimage.large { aspect-ratio: 1; font-size: 1rem; }

.product-card-body { padding: 14px 16px 16px; }
.product-card-name { margin: 0 0 8px; font-size: .98rem; line-height: 1.35; font-weight: 600; }
.product-card-price { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.product-card-stock { margin: 8px 0 0; }

.price-now { font-size: 1.1rem; font-weight: 700; color: var(--iron); }
.price-was { font-size: .9rem; color: var(--ink-muted); text-decoration: line-through; }
.price-ask { font-size: .95rem; font-weight: 600; color: var(--ember); }

.stock { font-size: .82rem; font-weight: 600; }
.stock-in  { color: var(--ok); }
.stock-low { color: #9a6b00; }
.stock-out { color: var(--bad); }
.stock-enquiry { color: var(--ember); }

.badge {
    display: inline-block; padding: 3px 9px; font-size: .72rem; font-weight: 700;
    letter-spacing: .03em; text-transform: uppercase; border-radius: 3px;
}
.badge-featured { position: absolute; top: 8px; left: 8px; background: var(--iron); color: #fff; }
.badge-discount { position: absolute; top: 8px; right: 8px; background: var(--ember); color: #fff; }
.badge-enquiry  { background: #fdf0e6; color: var(--ember); border: 1px solid #f0d4bd; }
.badge-ok       { background: #eaf5ef; color: var(--ok); }
.badge-muted    { background: var(--surface-2); color: var(--ink-muted); }
.badge-warn     { background: #fff4e5; color: #8a5a00; border: 1px solid #f0dcbb; text-transform: none; }
.badge-warn.sev-high   { background: #fbecec; color: var(--bad); border-color: #f0c2c2; }
.badge-warn.sev-medium { background: #fff4e5; color: #8a5a00; }

/* ---- product detail ----------------------------------------------------- */

.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.gallery-main { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.gallery-main img { width: 100%; height: auto; display: block; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumb {
    padding: 0; width: 72px; height: 72px; cursor: pointer;
    background: none; border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.gallery-thumb.is-active { border-color: var(--ember); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.product-summary h1 { margin: 0 0 8px; font-size: 1.7rem; line-height: 1.25; }
.product-meta { font-size: .88rem; margin: 0 0 18px; }
.product-price { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.product-price .price-now { font-size: 1.7rem; }
.product-price .badge-discount { position: static; }
.product-stock { margin-bottom: 20px; }

.buy-form input[type="number"] { width: 6rem; }
.buy-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.buy-actions .btn { margin-top: 16px; }

.enquiry-box {
    padding: 20px; background: #fdf7f2;
    border: 1px solid #f0d4bd; border-radius: var(--radius);
}

.product-section { margin-block: 36px; }
.product-section h2 { font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.product-description { line-height: 1.7; }
.product-description h2, .product-description h3, .product-description h4 { font-size: 1.05rem; margin-top: 20px; }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th, .spec-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.spec-table th { width: 40%; background: var(--surface-2); font-weight: 600; }

.video-facade { position: relative; max-width: 640px; }
.video-play { position: relative; padding: 0; border: none; background: none; cursor: pointer; display: block; width: 100%; }
.video-play img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.video-play-icon {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.video-facade iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius); }

/* ---- pagination --------------------------------------------------------- */

.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 28px; }
.page-link {
    padding: 8px 13px; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); font-size: .92rem;
}
.page-link:hover { border-color: var(--ember); text-decoration: none; }
.page-current { background: var(--iron); color: #fff; border-color: var(--iron); }
.page-gap { color: var(--ink-muted); padding-inline: 4px; }
.pagination-summary { font-size: .86rem; margin-top: 10px; }

/* ---- admin -------------------------------------------------------------- */

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.5rem; }
.admin-head .btn { margin-top: 0; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table thead th { background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.admin-table td img { border: 1px solid var(--line); border-radius: 3px; object-fit: cover; }
.admin-actions { white-space: nowrap; }
.admin-actions > * { margin-right: 10px; }
.tree-indent { color: var(--ink-muted); margin-right: 4px; }
.warning-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.admin-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 20px; }
.admin-filters input, .admin-filters select { width: auto; padding: 8px 10px; }
.admin-filters .btn { margin-top: 0; }

.admin-form { max-width: 760px; }
.admin-form h2 { font-size: 1.05rem; margin-top: 32px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.admin-panel {
    max-width: 900px; margin-top: 36px; padding: 24px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox input { width: auto; }

.link-button {
    background: none; border: none; padding: 0; font: inherit; font-size: .92rem;
    color: var(--ember); cursor: pointer; text-decoration: underline;
}
.link-danger { color: var(--bad); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #861a1a; }

.danger-zone {
    max-width: 760px; margin-top: 40px; padding: 20px;
    border: 1px solid #f0c2c2; border-radius: var(--radius); background: #fdf5f5;
}
.danger-zone h2 { margin-top: 0; font-size: 1rem; color: var(--bad); }

.quality-row { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 20px; }
.quality-tile {
    padding: 12px 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); min-width: 110px;
}
.quality-tile.sev-high   { border-color: #f0c2c2; background: #fdf5f5; }
.quality-tile.sev-medium { border-color: #f0dcbb; background: #fffaf2; }
.quality-count { display: block; font-size: 1.5rem; font-weight: 700; color: var(--iron); }
.quality-label { display: block; font-size: .82rem; color: var(--ink-muted); }

.image-manager { display: flex; flex-wrap: wrap; gap: 14px; margin-block: 16px; }
.image-tile { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; text-align: center; }
.image-tile img { display: block; object-fit: cover; border-radius: 3px; }
.tiny { font-size: .78rem; font-weight: 400; margin-top: 6px; display: block; }
.attribute-table input { width: 100%; }

/* ---- cart --------------------------------------------------------------- */

.nav-cart { position: relative; }
.cart-badge {
    display: inline-block; min-width: 19px; margin-left: 5px; padding: 1px 6px;
    font-size: .72rem; font-weight: 700; line-height: 1.5; text-align: center;
    color: #fff; background: var(--ember); border-radius: 999px;
}

.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }

/* The cart list sits beside a 320px summary, so it is only ~728px wide on a
   1120px shell. Six fixed columns used to consume 700px of that, leaving the
   product name 28px — it collapsed to one word per line.
   The unit price now sits UNDER the name in the same column instead of taking
   a column of its own, which is where a cart normally puts it, and the name
   gets ~260px. Markup is unchanged; this is done with grid areas. */
.cart-item {
    display: grid;
    /* 88 + 150 + 104 + 76 = 418 fixed, + 4x16 gaps = 482 of the 728 available,
       leaving ~246px for the product name. The qty column is sized for the
       number input plus the Update button so it cannot wrap. */
    grid-template-columns: 88px minmax(0, 1fr) 150px 104px 76px;
    grid-template-areas:
        "media detail qty total remove"
        "media price  qty total remove";
    column-gap: 16px;
    row-gap: 2px;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}
.cart-item-media  { grid-area: media; align-self: start; }
.cart-item-detail { grid-area: detail; align-self: end; }
.cart-item-price  { grid-area: price; align-self: start; }
.cart-item-qty    { grid-area: qty; }
.cart-item-total  { grid-area: total; }
.cart-item-remove { grid-area: remove; }

.cart-item.is-blocked { background: #fdf5f5; }

.cart-item-media img { width: 88px; height: 88px; object-fit: contain; background: var(--surface-2); border-radius: var(--radius); }
.cart-item-media .product-card-noimage { width: 88px; height: 88px; border-radius: var(--radius); font-size: .7rem; }

/* Long machine names ("Vtech Multi peeler Plus | Small Onion and garlic
   Peeler") must wrap on spaces, never break mid-word. */
.cart-item-name { margin: 0 0 4px; font-size: .95rem; line-height: 1.35; overflow-wrap: break-word; }
.cart-item-name a { color: var(--ink); }

/* SKU and stock status read as one line, not a stacked column. */
.cart-item-meta { margin: 0; font-size: .8rem; line-height: 1.4; }

/* Unit price, now under the name. The strikethrough was-price sits beside it
   rather than on its own line. */
.cart-item-price { font-size: .9rem; }
.cart-item-price .price-now { font-weight: 600; }
.cart-item-price .price-was { margin-left: 6px; text-decoration: line-through; color: var(--ink-muted); font-size: .85em; }

.cart-item-note { margin: 8px 0 0; font-size: .85rem; }
.note-bad  { color: var(--bad); }
.note-info { color: #8a5a00; }

.cart-item .label {
    display: none;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted);
}

.qty-form { display: flex; gap: 6px; align-items: center; }
.qty-form input[type="number"] { width: 4.5rem; padding: 8px 10px; }
.qty-form .btn { margin-top: 0; }
.qty-fixed { font-weight: 600; }

.cart-item-total { text-align: right; font-size: 1.05rem; }
.cart-item-remove { text-align: right; }
.cart-item-remove form { margin: 0; }

.cart-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; padding-top: 20px;
}
.cart-actions .btn { margin-top: 0; }

.cart-summary {
    position: sticky; top: 20px;
    padding: 24px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.cart-summary h2 { margin-top: 0; font-size: 1.1rem; }

.summary-lines { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 20px 0; }
.summary-lines dt { color: var(--ink-muted); font-size: .92rem; }
.summary-lines dd { margin: 0; text-align: right; font-size: 1.05rem; }

.summary-note { font-size: .85rem; margin: 12px 0 0; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { background: #c9c5c1; border-color: #c9c5c1; cursor: not-allowed; }

.cart-empty { text-align: center; padding: 48px 24px; }
.cart-empty .btn { margin-top: 16px; }

/* ---- checkout & orders -------------------------------------------------- */

.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
.checkout-main h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }

.address-choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-block: 18px; }
.address-choice legend { padding-inline: 8px; font-weight: 600; font-size: .92rem; }
.address-option { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-weight: 400; }
.address-option input { width: auto; margin-top: 3px; }
.address-option span { font-size: .92rem; line-height: 1.5; }

.checkout-summary {
    position: sticky; top: 20px; padding: 24px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.checkout-summary h2 { margin-top: 0; font-size: 1.1rem; }

.summary-items { list-style: none; margin: 0 0 18px; padding: 0; font-size: .92rem; }
.summary-items li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.summary-item-total { white-space: nowrap; }

.summary-lines dt.grand, .summary-lines dd.grand {
    padding-top: 10px; border-top: 1px solid var(--line); font-size: 1.1rem; color: var(--ink);
}
.not-configured { color: #8a5a00; font-size: .88rem; font-style: italic; }

.order-received { max-width: 760px; }
.order-ref { text-align: center; }
.order-number { font-size: 1.6rem; font-weight: 700; letter-spacing: .06em; color: var(--iron); margin: 6px 0; }

.order-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.order-table th, .order-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.order-table thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.order-table tfoot th { text-align: right; font-weight: 600; }
.order-table tfoot tr.grand th, .order-table tfoot tr.grand td { font-size: 1.05rem; border-top: 2px solid var(--line); }

.order-address { font-style: normal; line-height: 1.7; }

.status-history { list-style: none; margin: 0; padding: 0; }
.status-history li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.status-history li::before {
    content: ''; position: absolute; left: -5px; top: 16px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--ember);
}

/* ---- homepage ----------------------------------------------------------- */

.hero {
    padding-block: 56px 44px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}
.hero-eyebrow {
    margin: 0 0 12px;
    font-size: .78rem; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: var(--ember);
}
.hero h1 {
    margin: 0 0 16px;
    font-size: clamp(1.9rem, 4.5vw, 2.9rem);
    line-height: 1.12;
    letter-spacing: -.02em;
    max-width: 18ch;
}
.hero .lead { max-width: 54ch; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions .btn { margin-top: 0; }

.setup-notice { border-left: 3px solid var(--ember); }
.setup-notice h2 { margin-top: 0; font-size: 1.1rem; }

.home-section { margin-block: 48px; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px; margin-bottom: 22px;
}
.section-head h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.01em; }
.section-head a { font-size: .92rem; white-space: nowrap; }
.home-section > h2 {
    font-size: 1.3rem; letter-spacing: -.01em;
    border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 22px;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}
.collection-tile {
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px 20px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
}
.collection-tile:hover { border-color: var(--ember); text-decoration: none; }
.collection-name { font-weight: 600; font-size: .98rem; }
.collection-count { font-size: .82rem; }

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}
.trust h3 { margin: 0 0 6px; font-size: 1rem; }
.trust p { margin: 0; font-size: .93rem; color: var(--ink-muted); }

.b2b-cta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    padding: 32px;
    background: var(--iron);
    border-radius: var(--radius);
}
.b2b-cta h2 { margin: 0 0 8px; color: #fff; font-size: 1.25rem; border: 0; padding: 0; }
.b2b-cta p { margin: 0; color: #c3c8ce; max-width: 52ch; font-size: .95rem; }
.b2b-cta .btn { margin-top: 0; flex-shrink: 0; }

/* ---- payment ------------------------------------------------------------ */

.payment-choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-block: 12px 0; }
.payment-option { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-weight: 400; }
.payment-option:last-child { margin-bottom: 0; }
.payment-option input { width: auto; margin-top: 4px; }
.payment-option span { font-size: .93rem; line-height: 1.5; }

.payment-page { max-width: 620px; margin-inline: auto; text-align: center; }
.payment-page .panel { text-align: center; }
.pay-amount { font-size: 1.5rem; font-weight: 700; color: var(--ember); margin: 4px 0 0; }
.payment-status { color: var(--ink-muted); font-size: .95rem; }
.payment-page .btn { margin-top: 12px; }

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

/* ---- mobile ------------------------------------------------------------- */

@media (max-width: 900px) {
    .catalogue { grid-template-columns: 1fr; }
    .catalogue-sidebar { order: 2; }
    .product-detail { grid-template-columns: 1fr; gap: 24px; }
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
    .checkout-layout { grid-template-columns: 1fr; }
    .checkout-summary { position: static; order: -1; }
    .order-table { display: block; overflow-x: auto; }
}

@media (max-width: 700px) {
    /* Cart rows become stacked cards: the label spans reappear so each value
       is still identifiable without the table header. */
    .cart-item {
        grid-template-columns: 90px 1fr;
        grid-template-areas:
            "media detail"
            "price qty"
            "total remove";
        gap: 12px 14px;
        align-items: start;
    }
    /* Reset the desktop align-self rules, which would otherwise push the name
       and price around inside the stacked card. */
    .cart-item-media,
    .cart-item-detail,
    .cart-item-price  { align-self: start; }
    .cart-item-media  { grid-area: media; }
    .cart-item-detail { grid-area: detail; }
    .cart-item-price  { grid-area: price; }
    .cart-item-qty    { grid-area: qty; }
    .cart-item-total  { grid-area: total; text-align: left; }
    .cart-item-remove { grid-area: remove; text-align: right; align-self: center; }

    .cart-item .label { display: block; margin-bottom: 4px; }
    .cart-item-media img,
    .cart-item-media .product-card-noimage { width: 90px; height: 90px; }
}

@media (max-width: 640px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .main-nav { gap: 14px; }
    .error-code { font-size: 3.25rem; }
    .error-shell { padding-block: 48px; }

    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .product-summary h1 { font-size: 1.35rem; }
    .product-price .price-now { font-size: 1.4rem; }
    .catalogue-head { flex-direction: column; align-items: stretch; }
    .catalogue-controls { flex-direction: column; align-items: stretch; }
    .catalogue-controls input, .catalogue-controls select { width: 100%; }

    /* Wide admin tables scroll inside their own container rather than
       forcing the whole page to scroll sideways. */
    .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
    .admin-filters { flex-direction: column; align-items: stretch; }
    .admin-filters input, .admin-filters select { width: 100%; }
}

/* ============================================================================
   Phase 13 — coupons, reviews, admin nav
   ============================================================================ */

/* ---- admin section nav ---- */
.admin-nav { background: rgba(0, 0, 0, .18); }
.admin-nav .container { display: flex; flex-wrap: wrap; gap: 2px; }
.admin-nav-link {
    color: rgba(255, 255, 255, .72);
    padding: 10px 14px;
    font-size: .9rem;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}
.admin-nav-link:hover { color: #fff; text-decoration: none; }
.admin-nav-link.is-active { color: #fff; border-bottom-color: currentColor; }

/* ---- coupon box (cart + checkout) ---- */
.coupon-box { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.coupon-box label { display: block; font-size: .85rem; margin-bottom: 6px; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; }
.coupon-row .btn { margin-top: 0; flex: 0 0 auto; }
.coupon-applied { font-size: .9rem; margin-bottom: 4px; }
.summary-discount { color: var(--good, #1c7c4a); }

/* ---- reviews ---- */
.review-summary { font-size: 1.05rem; margin-bottom: 14px; }
.review-list { list-style: none; padding: 0; margin: 0 0 24px; }
.review { border-bottom: 1px solid var(--line); padding-block: 16px; }
.review:last-child { border-bottom: 0; }
.review-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.review-rating { color: #b8860b; letter-spacing: 1px; white-space: nowrap; }
.review-body { margin: 0 0 6px; }
.review-meta { font-size: .85rem; }
.review-form { margin-top: 24px; }
.review-blocked { margin-top: 16px; font-size: .9rem; }
.review-moderate + .review-moderate { margin-top: 12px; }
.review-moderate-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; }

/* ---- pills / alert panel ---- */
.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: 1px solid var(--line);
}
.pill-good  { background: #eef7f1; border-color: #bfe0cd; color: #1c7c4a; }
.pill-bad   { background: #fdf5f5; border-color: #f0c2c2; color: var(--bad); }
.pill-warn  { background: #fffaf2; border-color: #f0dcbb; color: #96600d; }
.pill-muted { background: #f6f6f6; color: #666; }

.panel-alert { border-color: #f0c2c2; background: #fdf5f5; }

/* ---- admin form rows ---- */
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 220px; }

@media (max-width: 640px) {
    .field-row { flex-direction: column; gap: 0; }
    .admin-nav .container { overflow-x: auto; flex-wrap: nowrap; }
}

/* ============================================================================
   Phase 15 — demo videos, site content, password toggle
   ============================================================================ */

/* ---- password show/hide (progressive enhancement, added by app.js) ---- */
.password-wrap { position: relative; display: block; }
.password-wrap input { width: 100%; padding-right: 4.5rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px 8px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-muted);
    cursor: pointer;
    border-radius: 4px;
}
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }
.password-toggle:focus-visible { outline: 2px solid var(--ember); outline-offset: 1px; }

/* ---- demo videos ---- */
.demo-video-count { margin: 4px 0 20px; }
.demo-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}
.demo-video { min-width: 0; }
.demo-video-frame {
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 10px;
}
.demo-video-frame img,
.demo-video-frame iframe { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
.demo-video-frame .product-card-noimage { width: 100%; height: 100%; }
.demo-video-title { font-size: 1rem; line-height: 1.35; margin: 0 0 4px; }
.demo-video-title a { color: var(--ink); }
.demo-video-meta { font-size: .82rem; margin: 0 0 6px; }
.demo-video-desc { font-size: .88rem; margin: 0 0 10px; color: var(--ink-muted); }

/* ---- admin content editor ---- */
.settings-textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.5; }

/* ---- published page copy ---- */
/* Content pages fill the shell, exactly like the catalogue and every other
   page. An extra reading-width cap here only produced a second, narrower
   column inside an already-centred container, which read as a broken layout
   rather than as a deliberate measure -- and it forced the demo video grid to
   two columns when there was room for three. */
.static-page { max-width: none; }
.prose { max-width: none; }
.prose h2 { font-size: 1.25rem; margin-top: 28px; }
.prose h3 { font-size: 1.08rem; margin-top: 22px; }
.prose p, .prose li { line-height: 1.7; }
.prose ul, .prose ol { padding-left: 22px; margin-bottom: 16px; }
.prose li { margin-bottom: 6px; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose blockquote { margin: 0 0 16px; padding-left: 16px; border-left: 3px solid var(--line); color: var(--ink-muted); }

/* ---- enquiry form (Phase 15) ---- */
.enquiry-form { max-width: 640px; }
.enquiry-form textarea { min-height: 120px; }
.enquiry-about { margin: 0 0 4px; font-size: .95rem; color: var(--ink); }
.contact-enquiry { margin-top: 32px; }
.enquiry-message { white-space: pre-wrap; max-width: 68ch; line-height: 1.7; }
.filter-chip-alert { border-color: #f0dcbb; background: #fffaf2; }

/* Sign out sits on the dark admin header, where .btn-quiet's near-black --ink
   text is effectively invisible. Give it light text and a visible edge. */
.admin-user .btn-quiet {
    color: #fff;
    border-color: rgba(255, 255, 255, .4);
    background: transparent;
}
.admin-user .btn-quiet:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .7);
    color: #fff;
}
.admin-user .btn-quiet:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.filter-sep { color: var(--ink-muted); opacity: .5; }

/* ---- contact detail cards ----
   Four short blocks (phone, email, address, hours) stacked vertically left a
   page that was two-thirds empty on a wide screen. auto-fit rather than
   auto-fill so the cards stretch to consume the row instead of leaving phantom
   tracks when only two or three are configured. */
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin: 28px 0 8px;
}
.contact-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
    background: var(--surface);
}
.contact-card h2 {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0 0 10px;
}
.contact-card-value {
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 6px;
    /* Long email addresses must not push the card wider than its track. */
    overflow-wrap: anywhere;
}
.contact-card .muted { margin: 0; font-size: .9rem; line-height: 1.55; }
