/* Theme: NeoLab — dark lab aesthetic, teal + violet glow. */

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto-Regular.ttf') format('truetype');
    font-weight: 400 700;
    font-display: swap;
}

:root {
    --color-bg: #06080d;
    --color-surface: #10161f;
    --color-surface-hover: #161e2a;
    --color-border: rgba(94, 234, 212, 0.16);
    --color-border-strong: rgba(94, 234, 212, 0.45);
    --color-border-violet: rgba(192, 132, 252, 0.4);
    --color-text: #e8f3f2;
    --color-muted: #8a99a3;
    --color-accent: #5eead4;
    --color-accent-soft: rgba(94, 234, 212, 0.12);
    --color-accent-2: #c084fc;
    --color-accent-2-soft: rgba(192, 132, 252, 0.12);
    --color-danger: #ff6b6b;
    /* Chart-mark tokens: same hue families as --color-accent/--color-accent-2,
       stepped darker to clear the OKLCH dark-mode mark band (L 0.48-0.67) —
       the text-accent hexes above are too light to use as fills. Validated
       with the dataviz skill's palette validator against --color-surface. */
    --chart-teal: #009a85;
    --chart-violet: #9a5ed3;
    --chart-funnel-1: #00a791;
    --chart-funnel-2: #00917c;
    --chart-funnel-3: #007b68;
    --radius: 14px;
    --radius-sm: 10px;
    --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --glow-teal: 0 0 22px rgba(94, 234, 212, 0.28);
    --glow-violet: 0 0 22px rgba(192, 132, 252, 0.28);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    line-height: 1.5;
    background-color: var(--color-bg);
    background-image:
        radial-gradient(1100px 550px at 12% -10%, rgba(94, 234, 212, 0.09), transparent 60%),
        radial-gradient(900px 650px at 105% 5%, rgba(192, 132, 252, 0.08), transparent 55%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

a { color: inherit; text-decoration: none; }

*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

::selection { background: var(--color-accent-2-soft); color: var(--color-text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 999px; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(6, 8, 13, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}
.logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text);
    text-shadow: 0 0 16px rgba(94, 234, 212, 0.55);
}
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { color: var(--color-muted); font-size: 0.92rem; transition: color 0.15s ease; }
.main-nav a:hover { color: var(--color-accent); }
.cart-link { display: flex; align-items: center; gap: 8px; }
.cart-count {
    background: var(--color-accent-soft);
    border: 1px solid var(--color-border-strong);
    color: var(--color-accent);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 2px 9px;
}

main.container { padding: 32px 20px 60px; }

/* Hero */
.shop-hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background:
        linear-gradient(180deg, rgba(6, 8, 13, 0.35) 0%, rgba(6, 8, 13, 0.9) 100%),
        url('../images/hero-bg.jpg') center / cover no-repeat;
    min-height: 260px;
    display: flex;
    align-items: center;
    margin-bottom: 32px;
}
.shop-hero-inner { padding: 44px 40px; max-width: 560px; }
.hero-eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--color-accent);
    text-shadow: 0 0 12px rgba(94, 234, 212, 0.7);
}
.shop-hero h1 {
    margin: 12px 0 10px;
    font-size: 2.1rem;
    text-shadow: 0 0 30px rgba(94, 234, 212, 0.25);
}
.shop-hero p { margin: 0; color: var(--color-muted); max-width: 420px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.filter-pill {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 0.88rem;
    background: var(--color-surface);
    color: var(--color-muted);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.filter-pill:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.filter-pill.active {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #04110f;
    border-color: transparent;
    box-shadow: var(--glow-teal);
}

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}
.product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-border-strong);
    box-shadow: var(--glow-teal), 0 14px 30px rgba(0, 0, 0, 0.45);
}
.product-card-image img { width: 100%; height: 180px; object-fit: cover; display: block; }
.image-placeholder {
    width: 100%; height: 180px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-surface); color: var(--color-muted); font-size: 0.85rem;
}
.product-card-body { padding: 16px; }
.category-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-accent);
    background: var(--color-accent-soft);
    border: 1px solid var(--color-border-strong);
    padding: 3px 9px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.product-card h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 600; }
.short-desc { color: var(--color-muted); font-size: 0.9rem; margin: 0 0 10px; }
.price { font-family: var(--font-mono); color: var(--color-accent); font-weight: 600; margin: 0; }

/* Product detail */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}
.product-detail-image img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--glow-violet);
}
.product-gallery-main {
    position: relative;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--glow-violet);
    overflow: hidden;
}
.gallery-slide { display: none; width: 100%; }
.gallery-slide.is-active { display: block; }
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}
.gallery-nav:hover { background: rgba(0, 0, 0, 0.75); }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.product-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
}
.gallery-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.is-active { border-color: var(--color-accent); }
.product-detail-info h1 { margin: 8px 0; }
.long-description { margin-top: 28px; border-top: 1px solid var(--color-border); padding-top: 20px; }

form label { display: block; font-size: 0.85rem; margin: 14px 0 6px; font-weight: 600; color: var(--color-muted); }
form input, form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form select:focus {
    outline: none;
    border-color: var(--color-border-strong);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { color: var(--color-muted); font-size: 0.8rem; margin: 4px 0 0; }

.btn-primary {
    margin-top: 18px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #04110f;
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: inline-block;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: var(--glow-teal); }
.form-message { font-size: 0.9rem; margin-top: 8px; min-height: 1.2em; }
.form-message.success { color: var(--color-accent); }
.form-message.error { color: var(--color-danger); }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.cart-table th, .cart-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.92rem;
}
.cart-table th {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    color: var(--color-muted);
}
.cart-table tbody tr:hover { background: var(--color-surface); }
.cart-qty-input { width: 70px; }
.cart-remove-btn {
    background: none; border: none; color: var(--color-danger); cursor: pointer; font-size: 0.85rem;
}
.cart-summary { display: flex; align-items: center; justify-content: space-between; }
.cart-total { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--color-accent); }

/* Checkout */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 40px;
    align-items: start;
}
.order-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 20px;
}
.order-summary ul { list-style: none; padding: 0; margin: 0 0 16px; }
.order-summary li {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem;
}
.order-subtotal, .order-shipping, .order-discount, .order-tax { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--color-muted); }
.order-tax-included { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--color-muted); margin-top: 2px; }
.order-summary [hidden] { display: none; }
.coupon-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.coupon-box p { margin: 0 0 8px; font-size: 0.9rem; }
.coupon-row { display: flex; gap: 8px; align-items: stretch; }
.coupon-row input { flex: 1; min-width: 0; text-transform: uppercase; }
.order-total { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; color: var(--color-accent); display: flex; justify-content: space-between; margin-top: 6px; }
.payment-note { color: var(--color-muted); font-size: 0.85rem; }

.shipping-methods { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 20px; }
.shipping-method-option {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    font-size: 0.9rem;
}
.shipping-method-option:has(input:checked) { border-color: var(--color-accent); background: var(--color-surface); }
.shipping-method-option input { margin: 0; width: auto; flex: 0 0 auto; }
.shipping-method-option span:nth-of-type(1) { flex: 1; }
.shipping-method-cost { font-family: var(--font-mono); color: var(--color-accent); font-weight: 700; }
.form-errors {
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--color-danger);
}
.form-errors ul { margin: 0; padding-left: 18px; }

/* Footer */
.site-footer { border-top: 1px solid var(--color-border); padding: 32px 0 24px; color: var(--color-muted); font-size: 0.85rem; }
.footer-inner { display: flex; flex-direction: column; gap: 18px; }
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
}
.footer-nav a {
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}
.footer-nav a:hover { color: var(--color-accent); text-shadow: 0 0 12px rgba(94, 234, 212, 0.5); }

/* Language switcher (header: EN | PT, footer: English · Português) */
.lang-switch { display: inline-flex; gap: 2px; font-size: 0.8rem; }
.main-nav .lang-switch a { padding: 2px 5px; border-radius: 6px; font-weight: 600; }
.lang-switch a.active,
.footer-lang a.active { color: var(--color-accent); }
.footer-lang { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-lang a { color: var(--color-muted); }
.footer-lang a:hover { color: var(--color-accent); }

/* Static content pages: about / info / support / terms */
.content-page { max-width: 720px; }
.content-page .page-subtitle { color: var(--color-muted); margin: 8px 0 0; }
.content-page h2 { margin: 32px 0 10px; font-size: 1.15rem; }
.content-page p { margin: 0 0 14px; }
.content-page ul { margin: 0 0 14px; padding-left: 20px; }
.content-page li { margin-bottom: 6px; }
.content-page a { color: var(--color-accent); text-decoration: underline; text-decoration-color: var(--color-border-strong); }
.content-page .updated-note { color: var(--color-muted); font-size: 0.82rem; margin-top: 40px; border-top: 1px solid var(--color-border); padding-top: 16px; }

/* Admin */
.admin-tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: 8px;
    vertical-align: middle;
}
.main-nav a.active { color: var(--color-accent); }

.msg {
    background: var(--color-accent-soft);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text);
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.msg.error {
    background: rgba(255, 107, 107, 0.08);
    border-color: rgba(255, 107, 107, 0.4);
    color: var(--color-danger);
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 28px;
}
.panel h2, .panel h3 { margin-top: 0; }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-secondary:hover { border-color: var(--color-border-strong); color: var(--color-text); }

.btn-danger {
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: var(--color-danger);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    cursor: pointer;
}
.btn-danger:hover { background: rgba(255, 107, 107, 0.08); }

.inline-form { display: inline; margin: 0; }
.table-actions { display: flex; gap: 8px; align-items: center; }

.bulk-actions { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.bulk-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-muted); }

.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--color-accent); }

.pagination { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.pagination .is-disabled { opacity: 0.4; pointer-events: none; }

/* Analytics */
.tabular { font-variant-numeric: tabular-nums; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stat-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label { font-size: 0.78rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--color-text); font-variant-numeric: normal; }
.stat-sub { font-size: 0.78rem; color: var(--color-muted); }

.analytics-grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Admin dashboard, users, activity log */
a.stat-tile { color: inherit; text-decoration: none; }
a.stat-tile:hover { border-color: var(--color-accent); }
.nav-account { font-weight: 600; }
.audit-details { margin-top: 4px; }
.audit-details summary { cursor: pointer; }
.audit-details pre { margin: 6px 0 0; padding: 8px 10px; max-width: 520px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; font-family: var(--font-mono); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 6px; }

/* Funnel — one hue (teal), monotone lightness per stage; value labeled at the
   bar's own tip so the number is never hover-only. */
.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 48px; align-items: center; gap: 12px; }
.funnel-label { font-size: 0.85rem; color: var(--color-muted); }
.funnel-bar-track { background: var(--color-bg); border-radius: 999px; overflow: hidden; height: 30px; }
.funnel-bar {
    height: 100%;
    min-width: 40px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    transition: filter 0.15s ease;
}
.funnel-bar:hover, .funnel-bar:focus-visible { filter: brightness(1.15); outline: none; }
.funnel-step-1 { background: var(--chart-funnel-1); }
.funnel-step-2 { background: var(--chart-funnel-2); }
.funnel-step-3 { background: var(--chart-funnel-3); }
.funnel-value { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
/* Ink flips per step so it always clears 4.5:1 against that step's fill —
   dark ink on the two lighter steps, light ink on the darkest one. */
.funnel-step-1 .funnel-value, .funnel-step-2 .funnel-value { color: #06080d; }
.funnel-step-3 .funnel-value { color: var(--color-text); }
.funnel-pct { color: var(--color-muted); font-size: 0.8rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Daily traffic line chart */
.chart-legend { display: flex; gap: 20px; margin-bottom: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--color-muted); }
.legend-swatch-line { display: inline-block; width: 18px; height: 2px; border-radius: 1px; }
.legend-teal { background: var(--chart-teal); }
.legend-violet { background: var(--chart-violet); }

.chart-wrap { position: relative; width: 100%; height: 220px; }
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-gridline { stroke: var(--color-border); stroke-width: 1; }
.chart-axis-label { fill: var(--color-muted); font-size: 11px; font-family: var(--font-mono); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-total { stroke: var(--chart-teal); }
.chart-line-unique { stroke: var(--chart-violet); }
.chart-dot { stroke: var(--color-surface); stroke-width: 2; }
.chart-dot-total { fill: var(--chart-teal); }
.chart-dot-unique { fill: var(--chart-violet); }
.chart-crosshair { stroke: var(--color-border-strong); stroke-width: 1; pointer-events: none; opacity: 0; }
.chart-hit { fill: transparent; }
.chart-hit:focus-visible { outline: none; fill: var(--color-accent-soft); }

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.8rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 5;
    white-space: nowrap;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip-date { color: var(--color-muted); margin-bottom: 4px; }
.chart-tooltip-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip-key { display: inline-block; width: 12px; height: 2px; }
.chart-tooltip-value { color: var(--color-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip-name { color: var(--color-muted); }

.chart-table-toggle { margin-top: 14px; }
.chart-table-toggle summary { cursor: pointer; color: var(--color-muted); font-size: 0.85rem; }
.chart-table-toggle summary:hover { color: var(--color-accent); }
.chart-table-toggle table { margin-top: 12px; }

.status-select {
    width: auto;
    display: inline-block;
    padding: 6px 10px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    background: rgba(255, 255, 255, 0.03);
}
.status-badge[data-status="approved"],
.status-badge[data-status="paid"],
.status-badge[data-status="completed"] {
    color: var(--color-accent);
    background: var(--color-accent-soft);
    border-color: var(--color-border-strong);
}
.status-badge[data-status="processing"],
.status-badge[data-status="shipped"],
.status-badge[data-status="update"],
.status-badge[data-status="paying"] {
    color: var(--color-accent-2);
    background: var(--color-accent-2-soft);
    border-color: var(--color-border-violet);
}
.status-badge[data-status="cancelled"],
.status-badge[data-status="invalid"],
.status-badge[data-status="failed"],
.status-badge[data-status="expired"] {
    color: var(--color-danger);
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.4);
}

/* Admin product table: expandable rows + quick actions */
.panel-summary {
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
}
.panel-summary::marker { color: var(--color-accent); }

.admin-table td { vertical-align: middle; }
.product-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--color-border);
    display: block;
}
.product-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    background: var(--color-bg);
}
.category-name-input { display: inline-block; width: auto; margin: 0 8px 0 0; }
.product-row.is-open { background: var(--color-surface); }

.row-toggle {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    line-height: 1;
}
.row-toggle:hover { color: var(--color-accent); }
.row-toggle .chevron {
    display: inline-block;
    transition: transform 0.15s ease;
}
.row-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }

.variant-count-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 12px;
    color: var(--color-muted);
    background: transparent;
}
.variant-count-btn:hover { border-color: var(--color-border-strong); color: var(--color-accent); }

.icon-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { border-color: var(--color-border-strong); background: var(--color-accent-soft); }
.icon-btn-danger:hover { border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.1); }
.magic-btn:hover { border-color: var(--color-border-violet); background: var(--color-accent-2-soft); }

.edit-row > td, .magic-row > td { background: rgba(255, 255, 255, 0.02); padding: 0 !important; }
.edit-block {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 22px;
    border-left: 2px solid var(--color-accent);
}
.edit-block-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 28px;
}
.edit-form label { margin-top: 10px; }

.images-panel h3 { margin-top: 0; font-size: 1rem; }
.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.image-thumb {
    position: relative;
    width: 96px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface);
}
.image-thumb.is-main { border-color: var(--color-border-strong); }
.image-thumb img { display: block; width: 100%; height: 96px; object-fit: cover; }
.main-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-border-strong);
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 999px;
}
.image-thumb-actions {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: rgba(6, 8, 13, 0.55);
}
.image-thumb-actions .icon-btn { padding: 3px 7px; font-size: 0.8rem; }
.upload-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.upload-form label { flex: 1; min-width: 220px; margin: 0; }

.wysiwyg {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    overflow: hidden;
}
.wysiwyg-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.wysiwyg-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 5px 9px;
    cursor: pointer;
    line-height: 1;
}
.wysiwyg-toolbar button:hover { border-color: var(--color-border-strong); color: var(--color-accent); background: var(--color-accent-soft); }
.wysiwyg-editor {
    min-height: 120px;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--color-text);
    line-height: 1.6;
}
.wysiwyg-editor:focus { outline: none; box-shadow: inset 0 0 0 3px var(--color-accent-soft); }
.wysiwyg-editor p { margin: 0 0 10px; }
.wysiwyg-editor p:last-child { margin-bottom: 0; }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 0 0 10px 22px; }
.wysiwyg-editor a { color: var(--color-accent); }
.variants-panel h3, .magic-block h3 { margin-top: 0; font-size: 1rem; }
.variants-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.variants-table th, .variants-table td {
    text-align: left;
    padding: 7px 8px;
    border-bottom: 1px solid var(--color-border);
}
.variants-table th {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
}

.magic-block {
    padding: 22px;
    border-left: 2px solid var(--color-accent-2);
}
.magic-output {
    margin-top: 14px;
    padding: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-violet);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}

.variants-table input[type="text"], .variants-table input[type="number"] { width: 100%; min-width: 60px; padding: 5px 7px; font-size: 0.85rem; }
.variants-table input[type="checkbox"] { width: auto; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; }
.variants-table tfoot td { border-bottom: 0; padding-top: 12px; }
.variant-actions { white-space: nowrap; }
.variant-actions .icon-btn { margin-left: 4px; vertical-align: middle; }
.variant-new-row input::placeholder { color: var(--color-muted); opacity: 0.7; }

.magic-fields { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; align-items: flex-start; }
.magic-field {
    width: 100%;
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}
.magic-field-value { font-size: 0.88rem; word-break: break-word; }
.magic-field-value p:first-child { margin-top: 0; }
.magic-field-value p:last-child { margin-bottom: 0; }
@media (max-width: 720px) { .magic-field { grid-template-columns: 1fr; } }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; align-items: start; }
.order-items-list { list-style: none; padding: 0; margin: 0; }
.order-items-list li {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem;
}
.address-block { font-size: 0.92rem; line-height: 1.7; }
.address-block .label { color: var(--color-muted); font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }

@media (max-width: 720px) {
    .product-detail, .checkout-grid, .grid-2, .grid-3, .edit-block-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .shop-hero h1 { font-size: 1.6rem; }
}

/* ------------------------------------------------------------------
   AJAX navigation (assets/js/ajax-nav.js)
   ------------------------------------------------------------------ */
.ajax-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 1000;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
    box-shadow: 0 0 8px var(--color-accent);
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s ease, opacity 0.3s ease;
}
.ajax-progress.is-active {
    opacity: 1;
    width: 85%;
    transition: width 8s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.1s ease;
}

main.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

form[aria-busy="true"] button,
form[aria-busy="true"] input[type="submit"] {
    cursor: progress;
}

.ajax-toast-region {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.ajax-toast {
    max-width: min(420px, 100%);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.92rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}
.ajax-toast.is-visible { opacity: 1; transform: none; }
.ajax-toast.is-error { border-color: var(--color-danger); color: var(--color-danger); }

@media (prefers-reduced-motion: reduce) {
    .ajax-progress, .ajax-progress.is-active, .ajax-toast, main.is-loading { transition: none; }
}

/* Payment method picker + offline payment instructions */
.payment-method-option small { display: block; margin-top: 2px; }
.payment-instructions { margin: 20px 0; border-top: 2px solid var(--color-accent-2); }
.payment-instructions h2 { font-size: 1.1rem; }

.icon-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* Header logo (Admin → Settings) */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-img { height: 36px; width: auto; max-width: 180px; object-fit: contain; display: block; }

/* ---- Storefront catalog: search, sorting, pagination, stock, a11y ---- */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap;
}
.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 1002;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: var(--color-on-accent, #fff);
    font-weight: 600;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }
/* Focus targets set by ajax-nav.js (main, h1): no ring for mouse users. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

.header-search { display: flex; align-items: center; flex: 0 1 280px; margin: 0 20px; position: relative; }
.header-search input {
    width: 100%;
    margin: 0;
    padding: 7px 38px 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 0.9rem;
}
.header-search input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.header-search button {
    position: absolute;
    right: 4px;
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    margin: 0; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
}
.header-search button:hover { color: var(--color-accent); }
@media (max-width: 720px) {
    .header-inner { flex-wrap: wrap; gap: 10px; }
    .header-search { order: 3; flex: 1 1 100%; margin: 0; }
}

.page-heading { margin: 0 0 20px; letter-spacing: -0.01em; }
.category-intro { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
.category-intro-image {
    width: 160px; height: 120px; object-fit: cover; flex: 0 0 auto;
    border-radius: var(--radius); border: 1px solid var(--color-border);
}
.category-intro h1 { margin: 0 0 6px; letter-spacing: -0.01em; }
.category-intro p { margin: 0; color: var(--color-muted); max-width: 680px; }
@media (max-width: 520px) {
    .category-intro { flex-direction: column; align-items: flex-start; }
    .category-intro-image { width: 100%; height: 160px; }
}

.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -8px 0 18px; }
.results-summary { margin: 0; color: var(--color-muted); font-size: 0.9rem; }
.results-summary a { color: var(--color-accent); margin-left: 6px; }
.sort-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.sort-form label { display: inline; margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }
.sort-form select { width: auto; margin: 0; padding: 6px 10px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.empty-state h2 { margin: 0 0 8px; font-size: 1.2rem; }
.empty-state p { color: var(--color-muted); margin: 0 0 14px; }
.empty-state p:last-child { margin: 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; margin: 32px 0 0; }
.pagination a, .pagination span {
    min-width: 38px;
    padding: 7px 12px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}
.pagination a:hover { border-color: var(--color-border-strong); color: var(--color-accent); }
.pagination .is-current { background: var(--color-text); border-color: var(--color-text); color: var(--color-bg); font-weight: 700; }
.pagination .pagination-gap { border-color: transparent; background: none; padding-left: 4px; padding-right: 4px; min-width: 0; }

.product-card-image { position: relative; }
.product-card-image img { height: 180px; }
.stock-badge {
    position: absolute;
    top: 10px; left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.1));
}
.stock-badge.is-out { background: var(--color-text); color: var(--color-bg); }
.stock-badge.is-low { color: var(--color-danger); }
.product-card.is-sold-out .product-card-image img { opacity: 0.6; filter: grayscale(0.4); }

.stock-status { margin: 0 0 6px; font-size: 0.9rem; font-weight: 600; }
.stock-status.is-in { color: var(--color-success, #1f8a4c); }
.stock-status.is-low { color: var(--color-danger); }
.stock-status.is-out { color: var(--color-muted); }
#add-to-cart-form button:disabled { opacity: 0.55; cursor: not-allowed; }
.product-detail-info .category-badge a:hover { color: var(--color-accent); }

.gallery-slide, .product-detail-image img { height: auto; }
.gallery-thumb img { height: 100%; }

.related-products { margin-top: 56px; border-top: 1px solid var(--color-border); padding-top: 28px; }
.related-products h2 { margin: 0 0 18px; font-size: 1.25rem; }
.skip-link { color: var(--color-bg); }

/* ---- Admin: logout button, low stock, bulk price, image order, categories ---- */
.nav-logout-form { display: inline; margin: 0; }
.nav-logout {
    background: none; border: 0; padding: 0; margin: 0;
    font: inherit; font-size: 0.93rem; color: var(--color-muted); cursor: pointer;
}
.nav-logout:hover { color: var(--color-accent); }
.bulk-actions { flex-wrap: wrap; }
.bulk-price { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bulk-price select, .bulk-price input { width: auto; margin: 0; }
.bulk-price-value { max-width: 110px; }
.low-stock-badge {
    display: inline-block; margin-left: 6px; padding: 1px 8px;
    border: 1px solid var(--color-danger-border, rgba(255, 107, 107, 0.45)); border-radius: 999px;
    background: var(--color-danger-soft, rgba(255, 107, 107, 0.12)); color: var(--color-danger);
    font-size: 0.72rem; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.filter-pill-low-stock.active { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.variants-table tr.is-low-stock td { background: var(--color-danger-soft, rgba(255, 107, 107, 0.12)); }
.variants-table tr.is-low-stock input[name="stock"] { border-color: var(--color-danger-border, rgba(255, 107, 107, 0.45)); color: var(--color-danger); font-weight: 700; }
.image-grid[data-image-order-form] .image-thumb { cursor: grab; }
.image-thumb.is-dragging { opacity: 0.45; }
.category-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--color-border); display: block; }
.category-edit-form { display: grid; gap: 10px; max-width: 640px; }
.category-edit-form textarea { min-height: 90px; }
.category-edit-form .category-image-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.category-edit-form .category-image-row img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--color-border); }
.inline-check { display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; margin: 0; }

/* Customer accounts: sign-in pages, account area, checkout account bar */
.account-auth-page .account-form { max-width: 460px; }
.account-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 20px; }
.account-nav .account-logout { margin: 0 0 0 auto; }
.account-nav .account-logout .btn-secondary { margin: 0; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.account-grid .panel { margin: 0; }
.account-address { font-style: normal; line-height: 1.6; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.account-actions form { margin: 0; }
.account-actions .btn-secondary, .account-actions .btn-danger { margin: 0; }
.account-danger h2 { color: var(--color-danger); }
.account-verify-notice { margin-bottom: 20px; }
.account-orders td { vertical-align: middle; }
.checkout-account { margin: 0 0 20px; }
.saved-address-picker { max-width: 560px; margin-top: 8px; }
.saved-address-picker label { margin-top: 0; }
.saved-address-picker select { flex: 1; min-width: 0; }
@media (max-width: 720px) {
    .account-nav .account-logout { margin-left: 0; }
    .account-orders th:nth-child(4), .account-orders td:nth-child(4) { display: none; }
}

/* Admin: product translations */
.lang-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    vertical-align: middle;
}
.translations-panel { margin-top: 8px; }
.translations-panel h3 { margin: 0 0 4px; font-size: 1rem; }
.translation-block {
    margin: 10px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}
.translation-block > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.translation-block > summary .status-badge { margin-left: 8px; }
.translation-form { padding: 0 14px 14px; }
.translation-form label { margin-top: 10px; }
.translation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* Admin → Settings: drag-and-drop file zone; the transparent file input covers it, so dropping and clicking work natively. */
.upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 16px;
    margin-bottom: 14px;
    border: 2px dashed var(--color-border-strong, var(--color-border));
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.upload-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-zone:hover, .upload-zone.is-dragover { border-color: var(--color-accent); background: var(--color-accent-soft); }

/* ==========================================================================
   Responsive layer — storefront AND admin, inherited by every theme that
   imports this stylesheet. Mobile first concerns: nothing overflows the
   screen, tap targets are big enough, inputs don't trigger iOS zoom, tables
   become cards (assets/js/responsive-tables.js adds the cell labels).
   ========================================================================== */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-wrap: break-word; }
img, svg, video { max-width: 100%; }
.container, main { min-width: 0; }
a, button, input, select, label, summary { touch-action: manipulation; }

/* Grids that used to need 300px+ of room overflowed 320px screens. */
.product-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.analytics-grid-2col { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.account-grid { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.wysiwyg-toolbar, .chart-legend { flex-wrap: wrap; }
.table-actions { flex-wrap: wrap; }
.audit-details pre { max-width: 100%; }
.ajax-toast-region { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* Tablets and small laptops */
@media (max-width: 900px) {
    .product-detail { gap: 24px; }
    .grid-2, .grid-3, .edit-block-grid, .checkout-grid { gap: 20px; }
}

/* Phones */
@media (max-width: 720px) {
    main.container { padding: 20px 16px 48px; }
    .header-inner { padding: 10px 16px; gap: 8px 12px; }
    .logo { font-size: 1.1rem; }
    .logo-img { height: 30px; max-width: 150px; }
    h1 { font-size: 1.55rem; line-height: 1.25; }
    .panel { padding: 16px; margin-bottom: 20px; }
    .edit-block, .magic-block { padding: 14px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-tile { padding: 12px 14px; }
    .stat-value { font-size: 1.4rem; }
    .funnel-row { grid-template-columns: 84px 1fr 42px; gap: 8px; }
    .chart-wrap { height: 180px; }

    /* Admin header: brand on one line, the menu scrolls sideways on the next. */
    body[data-layout="admin"] .site-header { position: static; }
    body[data-layout="admin"] .header-inner { flex-wrap: wrap; }
    body[data-layout="admin"] .main-nav {
        flex: 1 1 100%;
        gap: 6px 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 4px;
    }
    body[data-layout="admin"] .main-nav > * { flex: 0 0 auto; white-space: nowrap; }
    .main-nav a, .nav-logout { padding: 8px 8px; border-radius: var(--radius-sm); }
    .nav-logout-form { display: inline-flex; }

    /* Hero */
    main .shop-hero { flex-direction: column; align-items: flex-start; min-height: 0; margin-bottom: 24px; }
    main .shop-hero .shop-hero-inner { padding: 26px 22px; }
    main .shop-hero h1 { font-size: 1.6rem; }

    /* Catalog: two cards per row, compact */
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .product-grid .product-card-image { padding-left: 6px; padding-right: 6px; padding-top: 6px; }
    .product-grid .product-card-image img, .product-grid .image-placeholder { height: 140px; }
    .product-grid .product-card-body { padding: 12px; }
    .product-grid .product-card h3 { font-size: 0.98rem; }
    .product-grid .short-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.82rem; }
    .shop-toolbar { margin-top: 0; }
    .sort-form { width: 100%; }
    .sort-form select { flex: 1; }
    .cart-summary { flex-wrap: wrap; gap: 12px; }
    .cart-summary .btn-primary, .checkout-grid .btn-primary { width: 100%; text-align: center; }
    .related-products { margin-top: 36px; }

    /* Forms: 16px stops iOS from zooming into a focused field */
    form input, form select, form textarea, .header-search input, .status-select,
    .variants-table input, .wysiwyg-editor { font-size: 16px !important; }
    .upload-form label { flex: 1 1 100%; min-width: 0; }
    .bulk-price-value { max-width: none; flex: 1; }

    /* Tables that can't become cards still scroll instead of widening the page */
    .cart-table:not(.is-stackable), .variants-table:not(.is-stackable) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Tables -> cards */
    table.is-stackable, table.is-stackable tbody, table.is-stackable tr, table.is-stackable td { display: block; }
    table.is-stackable { background: none; border: 0; }
    table.is-stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    table.is-stackable tr {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        background: var(--color-surface);
        margin-bottom: 12px;
        overflow: hidden;
    }
    table.is-stackable tbody tr:hover { background: var(--color-surface); }
    table.is-stackable td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        min-width: 0;
        padding: 9px 14px;
        text-align: right;
        border-bottom: 1px solid var(--color-border);
    }
    table.is-stackable tr > td:last-child { border-bottom: 0; }
    table.is-stackable td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 42%;
        text-align: left;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--color-muted);
    }
    table.is-stackable td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; }
    table.is-stackable td[data-label=""]::before { content: none; }
    table.is-stackable td[colspan] { display: block; text-align: left; }
    table.is-stackable td[colspan]::before { content: none; }
    table.is-stackable td > input:not([type="checkbox"]):not([type="radio"]), table.is-stackable td > select { flex: 1 1 auto; min-width: 0; text-align: left; }
    table.is-stackable td > .table-actions, table.is-stackable td > form { justify-content: flex-end; }
    table.is-stackable .category-name-input { flex: 1; width: 100%; margin: 0; }
    table.is-stackable .product-row.is-open { background: var(--color-surface-hover); }
    table.is-stackable .edit-row, table.is-stackable .magic-row { margin-top: -10px; border-top-left-radius: 0; border-top-right-radius: 0; }
    .variants-table tr.is-low-stock { background: var(--color-danger-soft); }
}

/* Small phones */
@media (max-width: 380px) {
    .stat-grid { grid-template-columns: 1fr; }
    .product-grid { gap: 10px; }
    .product-grid .product-card-body { padding: 10px; }
    .filter-pill { padding: 6px 12px; }
}

/* Touch screens: comfortable tap targets, no sticky hover effects */
@media (pointer: coarse) {
    .btn-primary, .btn-secondary, .btn-danger { min-height: 44px; }
    .btn-small { min-height: 38px; }
    .icon-btn { min-width: 40px; min-height: 40px; }
    .filter-pill { padding-top: 9px; padding-bottom: 9px; }
    .row-toggle { padding: 10px 12px; }
    .cart-remove-btn { padding: 10px 8px; }
    .gallery-nav { width: 44px; height: 44px; }
    .gallery-thumb { width: 72px; height: 72px; }
    .wysiwyg-toolbar button { padding: 9px 12px; }
    .pagination a, .pagination span { min-width: 44px; padding-top: 10px; padding-bottom: 10px; }
    .lang-switch a { padding: 8px 8px; }
    form input[type="checkbox"], form input[type="radio"] { width: 20px; height: 20px; }
}
@media (hover: none) {
    .product-grid .product-card:hover { transform: none; box-shadow: var(--shadow-sm, none); }
}
