/* ============================================================
   YOUR BRAND — Admin dashboard stylesheet
   Self-contained, modern & responsive. Loaded after style.css.
   ============================================================ */
:root {
  --ad-bg:            #f6f4ef;
  --ad-surface:       #ffffff;
  --ad-ink:           #1b1917;
  --ad-muted:         #6f6a63;
  --ad-line:          #e7e2d8;
  --ad-gold:          #ae8a56;
  --ad-gold-dark:     #8a6a3c;
  --ad-danger:        #c0392b;
  --ad-success:       #3a7d44;
  --ad-radius:        16px;
  --ad-radius-sm:     10px;
  --ad-shadow:        0 10px 30px rgba(30, 26, 20, .08);
  --ad-shadow-sm:     0 4px 14px rgba(30, 26, 20, .06);
  --ad-font:          'Figtree', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --ad-font-head:     'Fraunces', Georgia, serif;
  --ad-ease:          cubic-bezier(.4, 0, .2, 1);
  --ad-rail-w:        272px;
}

/* Base */
html, body { max-width: 100%; overflow-x: clip; }
@supports not (overflow: clip) {
    html, body { overflow-x: hidden; }
}
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
input, select, textarea, button { max-width: 100%; }
*, *::before, *::after { min-width: 0; }

.admin-dashboard,
.login-hero { font-family: var(--ad-font); color: var(--ad-ink); }

.admin-dashboard h1,
.admin-dashboard h2,
.admin-dashboard h3 { font-family: var(--ad-font-head); }

.admin-dashboard .muted-sub,
.admin-dashboard .muted,
.admin-dashboard .small { color: var(--ad-muted); }
.admin-review-photo { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--ad-line); }
.review-photo-col, .review-note-cell { min-width: 150px; }
.review-moderation-note { width: 150px; min-height: 52px; padding: 7px; border: 1px solid var(--ad-line); border-radius: 7px; font: inherit; font-size: .75rem; resize: vertical; }
.od-history { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--ad-line); border-radius: var(--ad-radius-sm); background: #fbfaf7; }
.od-history-title { margin-bottom: 10px; color: var(--ad-muted); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.od-history-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.od-history-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 5px; border-radius: 50%; background: var(--ad-gold); box-shadow: 0 0 0 4px rgba(174,138,86,.12); }
.od-history-item strong, .od-history-item small { display: block; }
.od-history-item strong { font-size: .85rem; }
.od-history-item small { margin-top: 2px; color: var(--ad-muted); font-size: .74rem; }

.admin-dashboard .admin-card,
.admin-dashboard .stat-card,
.admin-dashboard .table-wrap,
.admin-dashboard .login-card {
    border-width: 1px;
}

a { text-decoration: none; }

/* ---- Layout shell ---- */
.admin-dashboard {
    width: min(100%, 1360px);
    margin: 0 auto;
    padding: clamp(18px, 3vw, 36px) clamp(14px, 3vw, 32px) 60px;
    box-sizing: border-box;
}
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin: 8px 0 24px;
}
.admin-header h1 {
    font-size: 1.7rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: .01em;
}
.admin-header h1 .lucide { width: 26px; height: 26px; color: var(--ad-gold-dark); }
.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ad-ink);
}
.admin-header-actions .admin-user { color: var(--ad-ink); font-weight: 500; }

/* ============================================================
   Sidebar rail — the admin navigation lives in a fixed left column
   ------------------------------------------------------------
   · The page is offset by --ad-rail-w (html.admin-rail-shell body).
   · Hiding the rail (desktop) or opening it as a drawer (≤960px) is driven by
     two classes on <html>, applied before the first paint in header.php:
       .admin-rail-collapsed → rail slid out, floating toggle visible
       .admin-rail-open      → ≤960px drawer open (+ backdrop)
   ============================================================ */
.admin-rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: var(--ad-rail-w);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 14px 14px;
    box-sizing: border-box;
    background: var(--ad-surface);
    border-right: 1px solid var(--ad-line);
    overflow: hidden;
    overscroll-behavior: contain;
    transition: transform .28s var(--ad-ease), box-shadow .28s var(--ad-ease);
}
html.admin-rail-shell body {
    padding-inline-start: var(--ad-rail-w);
    transition: padding-inline-start .28s var(--ad-ease);
}
/* Hidden rail: the content reclaims the full width. */
html.admin-rail-shell.admin-rail-collapsed body { padding-inline-start: 0; }
html.admin-rail-collapsed .admin-rail { transform: translateX(-100%); }

/* ---- Rail header: brand + hide button ---- */
.admin-rail-head {
    display: flex; align-items: center; gap: 10px;
    padding: 0 2px 12px;
    border-bottom: 1px solid var(--ad-line);
    flex: 0 0 auto;
}
.admin-rail-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; color: var(--ad-ink); }
.admin-rail-logo { display: block; height: 34px; width: auto; max-width: 128px; object-fit: contain; }
.admin-rail-monogram {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--ad-gold), var(--ad-gold-dark));
    color: #fff; font-family: var(--ad-font-head); font-size: .95rem; font-weight: 700;
}
.admin-rail-name { display: flex; flex-direction: column; min-width: 0; }
.admin-rail-name strong {
    font-family: var(--ad-font-head); font-size: 1rem; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-rail-name small { color: var(--ad-muted); font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.admin-rail-icon-btn {
    flex: 0 0 auto; width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--ad-line); border-radius: 10px; background: #fff;
    color: var(--ad-muted); cursor: pointer;
}
.admin-rail-icon-btn:hover { color: var(--ad-gold-dark); border-color: var(--ad-gold); }
.admin-rail-icon-btn .lucide { width: 17px; height: 17px; }

/* ---- Rail footer: View Store + Logout ---- */
.admin-rail-foot {
    margin-top: auto;
    display: flex; flex-direction: column; gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--ad-line);
    flex: 0 0 auto;
}

/* ---- Floating "show navigation" button ---- */
.admin-rail-toggle {
    position: fixed; top: 14px; left: 14px; z-index: 75;
    width: 42px; height: 42px; display: none;
    align-items: center; justify-content: center;
    border: 1px solid var(--ad-line); border-radius: 12px;
    background: rgba(255,255,255,.94);
    color: var(--ad-ink); box-shadow: var(--ad-shadow-sm); cursor: pointer;
}
.admin-rail-toggle:hover { color: var(--ad-gold-dark); border-color: var(--ad-gold); }
.admin-rail-toggle .lucide { width: 19px; height: 19px; }
html.admin-rail-shell.admin-rail-collapsed .admin-rail-toggle { display: inline-flex; }

/* ---- Drawer backdrop (≤960px) ---- */
.admin-rail-backdrop {
    display: none; position: fixed; inset: 0; z-index: 65;
    background: rgba(24, 20, 16, .38);
    opacity: 0; pointer-events: none;
    transition: opacity .24s var(--ad-ease);
}

/* Desktop: a hidden rail leaves the toggle in the top-left corner — keep the
   page content clear of it. */
@media (min-width: 961px) {
    html.admin-rail-shell.admin-rail-collapsed .admin-dashboard { padding-inline-start: 76px; }
}

/* Phones / tablets: off-canvas drawer + backdrop, closed by default. */
@media (max-width: 960px) {
    html.admin-rail-shell body { padding-inline-start: 0; }
    .admin-rail {
        width: min(88vw, 320px);
        transform: translateX(-101%);
        box-shadow: 0 22px 60px rgba(24, 20, 16, .3);
    }
    html.admin-rail-collapsed .admin-rail { transform: translateX(-101%); }
    html.admin-rail-open .admin-rail { transform: none; }
    html.admin-rail-shell .admin-rail-toggle { display: inline-flex; }
    /* the drawer has its own close button — the floating one would cover it */
    html.admin-rail-open .admin-rail-toggle { display: none; }
    /* room for the fixed toggle above the page heading */
    html.admin-rail-shell .admin-dashboard { padding-top: 74px; }
    .admin-rail-backdrop { display: block; }
    html.admin-rail-open .admin-rail-backdrop { opacity: 1; pointer-events: auto; }
}

@media print {
    .admin-rail, .admin-rail-toggle, .admin-rail-backdrop { display: none !important; }
    html.admin-rail-shell body { padding-inline-start: 0; }
}

/* ---- Nav list inside the rail ---- */
.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}
.admin-nav-link {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 11px;
    width: 100%; box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 11px;
    font-family: var(--ad-font); font-size: .9rem; font-weight: 600;
    color: var(--ad-muted); text-decoration: none; text-align: left;
    transition: color .2s, background .2s;
}
.admin-nav-link .lucide { width: 17px; height: 17px; flex: 0 0 auto; }
/* The label grows so badges and carets stay pinned to the right edge. */
.admin-nav-link > span:not(.unviewed-badge) {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-nav-link:hover { color: var(--ad-ink); background: #f4efe6; }
.admin-nav-link.active {
    color: var(--ad-gold-dark);
    background: rgba(174, 138, 86, .14);
    font-weight: 700;
}
/* Rail footer rows (View Store / Logout). */
.admin-nav-out {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 9px;
    width: 100%; box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--ad-line); border-radius: 11px;
    background: #fff;
    font-family: var(--ad-font); font-size: .86rem; font-weight: 600;
    color: var(--ad-ink); text-decoration: none;
    transition: border-color .2s, color .2s;
}
.admin-nav-out:hover { border-color: var(--ad-gold); color: var(--ad-gold-dark); }
.admin-nav-out .lucide { width: 16px; height: 16px; }
.admin-nav-exit { border-color: #e8c5c1; color: var(--ad-danger); }
.admin-nav-exit:hover { border-color: var(--ad-danger); color: var(--ad-danger); }

/* ---- Rail sections (Selling / Catalog / Customers / Operations) ---- */
.admin-nav-group { display: flex; flex-direction: column; margin-top: 8px; }
.admin-nav-group-heading {
    display: flex; align-items: center; gap: 10px;
    min-height: 34px; padding: 5px 12px 4px;
    color: var(--ad-muted); font-family: var(--ad-font);
    font-size: .72rem; font-weight: 800; letter-spacing: .09em;
    text-transform: uppercase;
}
.admin-nav-group-heading > span:not(.unviewed-badge) { flex: 1 1 auto; }
.admin-nav-group-heading > .lucide { width: 15px; height: 15px; flex: 0 0 auto; opacity: .8; }
.admin-nav-group.active > .admin-nav-group-heading { color: var(--ad-gold-dark); }
.admin-nav-drop {
    display: flex; flex-direction: column; gap: 2px;
    position: static; min-width: 0;
    margin: 0 0 5px 6px; padding: 2px 0 2px 10px;
    background: none; border: 0; border-left: 1px solid var(--ad-line);
    border-radius: 0; box-shadow: none;
}
.admin-nav-drop-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: 9px;
    font-family: var(--ad-font); font-size: .86rem; font-weight: 600;
    color: var(--ad-ink); text-decoration: none;
}
.admin-nav-drop-item > span:not(.unviewed-badge):not(.admin-nav-disabled-label) {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-nav-drop-item .lucide { width: 16px; height: 16px; flex: 0 0 auto; color: var(--ad-muted); }
.admin-nav-drop-item:hover { background: #f6f1e8; color: var(--ad-gold-dark); }
.admin-nav-drop-item:hover .lucide { color: var(--ad-gold-dark); }
.admin-nav-drop-item.active { background: rgba(174, 138, 86, .14); color: var(--ad-gold-dark); }
.admin-nav-drop-item.active .lucide { color: var(--ad-gold-dark); }
.admin-nav-drop-item.is-disabled { color: var(--ad-muted); opacity: .72; }
.admin-nav-drop-item.is-disabled:hover { color: var(--ad-ink); opacity: 1; }
.admin-nav-drop-item.is-disabled .lucide { color: var(--ad-muted); }
.admin-nav-disabled-label {
    margin-left: auto;
    padding: 2px 6px;
    border: 1px solid var(--ad-line);
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    color: var(--ad-muted);
    background: #faf8f3;
}
/* Amber badge on Reviews / Inbox children */
.unviewed-badge.is-warn { background: #d97706; }
/* Hide group badge entirely when count is 0 */
.unviewed-badge.is-zero { display: none; }

/* NB: the old top-bar layout (nav tiles at ≤860px, dropdowns as floating
   panels) is gone — the navigation is now the sidebar rail described above
   and needs no per-breakpoint arrangement of its own. */

/* ---- Buttons (admin scoped) ---- */
.admin-dashboard .btn,
.login-hero .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    padding: 10px 18px;
    font-family: var(--ad-font);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s var(--ad-ease);
    white-space: nowrap;
}
.admin-dashboard .btn:hover:not(:disabled),
.login-hero .btn:hover:not(:disabled) { transform: translateY(-1px); }
.admin-dashboard .btn:disabled,
.login-hero .btn:disabled { opacity: .6; cursor: not-allowed; }

.admin-dashboard .btn-gold { background: var(--ad-gold); color: #fff; }
.admin-dashboard .btn-gold:hover { background: var(--ad-gold-dark); box-shadow: 0 6px 18px rgba(176, 138, 86, .35); }
.admin-dashboard .btn-ghost { background: #fff; color: var(--ad-ink); border-color: var(--ad-line); }
.admin-dashboard .btn-ghost:hover { border-color: var(--ad-gold); color: var(--ad-gold-dark); }
/* Refunded column: compact status icon + short toggle, one line, always aligned. */
.admin-table .cell-refund { min-width: 0; white-space: nowrap; }
.admin-table .cell-refund-inner {
    display: inline-flex; flex-direction: row; align-items: center;
    gap: 8px; flex-wrap: nowrap; white-space: nowrap; vertical-align: middle;
}
.admin-table .refund-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
}
.admin-table .refund-dot svg { width: 14px; height: 14px; stroke-width: 3; }
.admin-table .refund-dot[data-c="refunded"] { background: #e6f4e8; color: #2f6b38; }
.admin-table .refund-dot[data-c="notrefunded"] { background: #fde0e0; color: #b91c1c; }
.admin-dashboard .js-refund-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    margin-top: 0; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
    font-size: .72rem; line-height: 1.2;
    background: rgba(176, 138, 86, .06); border-color: rgba(176, 138, 86, .34); color: var(--ad-gold-dark);
    box-shadow: inset 0 0 0 1px rgba(176, 138, 86, .08);
}
.admin-dashboard .js-refund-toggle svg { width: 12px; height: 12px; }
.admin-dashboard .js-refund-toggle:hover {
    border-color: var(--ad-gold); background: rgba(176, 138, 86, .12); color: var(--ad-gold-dark);
}
.admin-dashboard .js-refund-toggle[data-refunded="1"] {
    background: rgba(72, 166, 92, .08); border-color: rgba(72, 166, 92, .26); color: #2e7a43;
}
.admin-dashboard .js-refund-toggle[data-refunded="1"]:hover {
    background: rgba(72, 166, 92, .14); border-color: rgba(72, 166, 92, .35); color: #27693c;
}
.admin-dashboard .btn-danger { background: #fff; color: var(--ad-danger); border-color: #e8c5c1; }
.admin-dashboard .btn-danger:hover { background: var(--ad-danger); color: #fff; border-color: var(--ad-danger); }
.admin-dashboard .btn-sm { padding: 7px 13px; font-size: .8rem; }
.admin-dashboard .btn-ghost-ic {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1.5px solid var(--ad-line); border-radius: 999px;
    padding: 6px 12px; font-size: .8rem; font-weight: 600; color: var(--ad-ink); cursor: pointer;
    transition: all .2s var(--ad-ease);
}
.admin-dashboard .btn-ghost-ic:hover { border-color: var(--ad-gold); color: var(--ad-gold-dark); }
.admin-dashboard .btn-ghost-ic.danger:hover { border-color: var(--ad-danger); color: var(--ad-danger); background: #fdf1ef; }
/* ---- Overview stats ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.shipping-shell {
    padding: 22px;
}
.shipping-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}
.shipping-panel-head h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.shipping-toolbar {
    background: linear-gradient(180deg, rgba(174, 138, 86, 0.04), rgba(174, 138, 86, 0.01));
    border: 1px solid var(--ad-line);
    border-radius: 18px;
    padding: 14px 16px 16px;
    margin-bottom: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}
.shipping-filter-grid {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}
.shipping-filter-grid .form-group {
    margin: 0;
    min-width: 140px;
    flex: 1 1 150px;
}
.shipping-filter-grid .form-group:first-child {
    flex: 1.7 1 220px;
}
.shipping-filter-grid .form-control {
    min-height: 40px;
    border-radius: 12px;
    border-color: #ddd3c3;
    background: rgba(255,255,255,0.9);
}
.shipping-filter-grid label {
    display: block;
    margin-bottom: 7px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ad-muted);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.shipping-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.shipping-summary-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    min-height: 60px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.shipping-summary-pill .meta-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .8;
}
.shipping-summary-pill strong {
    font-family: var(--ad-font-head);
    font-size: 1.5rem;
    line-height: 1;
}
.stat-card {
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: var(--ad-radius);
    box-shadow: var(--ad-shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .25s var(--ad-ease), box-shadow .25s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--ad-shadow); }
.stat-card .stat-icon {
    width: 50px; height: 50px; flex: 0 0 auto;
    border-radius: 13px;
    background: #f4ecde;
    color: var(--ad-gold-dark);
    display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-icon .lucide { width: 24px; height: 24px; }
.stat-card .stat-label {
    color: var(--ad-muted); font-size: .72rem;
    text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
    margin-bottom: 3px;
}
.stat-card .stat-value {
    font-family: var(--ad-font-head);
    font-size: 1.5rem; font-weight: 700; line-height: 1.1;
}

/* ---- Tabs ---- */
.admin-tabs {
    display: flex; gap: 6px;
    border-bottom: 2px solid var(--ad-line);
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.admin-tabs .admin-tab {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    background: none; border: none; border-bottom: 3px solid transparent;
    font-family: var(--ad-font); font-size: .88rem; font-weight: 600;
    color: var(--ad-muted); cursor: pointer;
    transition: color .2s, border-color .2s;
    margin-bottom: -2px;
}
.admin-tabs .admin-tab .lucide { width: 16px; height: 16px; }
.admin-tabs .admin-tab:hover { color: var(--ad-ink); }
.admin-tabs .admin-tab.active { color: var(--ad-gold-dark); border-bottom-color: var(--ad-gold); }
.admin-tabs .admin-tab .tab-count {
    background: #f0ebe0; color: var(--ad-muted);
    border-radius: 999px; font-size: .7rem; padding: 1px 8px; font-weight: 600;
}
.admin-tabs .admin-tab.active .tab-count { background: var(--ad-gold); color: #fff; }

/* ---- Sections & cards ---- */
.admin-section { animation: adFadeIn .25s ease; }
@keyframes adFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.admin-card {
    background: linear-gradient(180deg, #ffffff 0%, #fffdf9 100%);
    border: 1px solid var(--ad-line);
    border-radius: var(--ad-radius);
    box-shadow: var(--ad-shadow-sm);
    padding: 22px;
    margin-bottom: 18px;
}
.admin-card h3 {
    font-size: 1.15rem; margin: 0 0 16px;
    display: flex; align-items: center; gap: 9px;
}
.admin-card h3, .admin-card h4 { letter-spacing: .01em; }
.admin-card h3 .lucide { width: 18px; height: 18px; color: var(--ad-gold-dark); }
.admin-actions-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.admin-actions-bar h3 { margin: 0; }
.admin-actions-bar .bar-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-actions-bar .bar-filters h3 { margin-right: 4px; white-space: nowrap; }
.admin-actions-bar .bar-filters .form-control { width: auto; }
.admin-actions-bar .toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-actions-bar .search-inline { min-width: 0 !important; max-width: 100%; }

/* ---- Tables ---- */
.table-wrap {
    background: var(--ad-surface);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--ad-line);
}
.table-page-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
    color: var(--ad-muted);
    font-size: .78rem;
}
.table-page-toolbar > label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.table-page-toolbar select {
    width: auto;
    min-width: 76px;
    padding: 6px 28px 6px 10px;
}
.table-page-toolbar[hidden],
.table-page-footer[hidden] { display: none !important; }
.table-page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    color: var(--ad-muted);
    font-size: .78rem;
}
.table-page-actions { display: inline-flex; gap: 8px; }
.table-page-footer .btn:disabled { opacity: .5; cursor: not-allowed; }
.admin-table .table-page-hidden { display: none !important; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 920px; font-size: .86rem; }
.admin-table th {
    text-align: left; padding: 12px 16px;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--ad-muted); font-weight: 700;
    background: #faf8f3; border-bottom: 1px solid var(--ad-line); white-space: nowrap;
}
.admin-table td {
    padding: 13px 16px; border-bottom: 1px solid var(--ad-line); vertical-align: middle;
}
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: #fdfaf4; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .orders-id { font-weight: 600; color: var(--ad-gold-dark); white-space: nowrap; }
.admin-table .muted-sub { color: var(--ad-muted); font-size: .78rem; }
.admin-table .cell-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Multi-select + bulk action bar ---- */
.admin-table .cell-select { width: 44px; text-align: center; }
.admin-table .cell-select input[type="checkbox"] {
    width: 17px; height: 17px; cursor: pointer; accent-color: var(--ad-gold-dark);
    vertical-align: middle; margin: 0;
}
.admin-table tbody tr.is-selected { background: #fdf6e6; }
.admin-table tbody tr.is-selected:hover { background: #fbf0d8; }

.bulk-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px; padding: 11px 15px;
    border: 1.5px solid var(--ad-gold); border-radius: 12px;
    background: #fdf8ec;
}
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: .85rem; color: var(--ad-ink); }
.bulk-count strong { font-size: 1rem; color: var(--ad-gold-dark); }
.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Status pill select */
.status-select {
    padding: 7px 30px 7px 14px; border-radius: 999px;
    border: 1.5px solid var(--ad-line); background-color: #fff;
    font-family: var(--ad-font); font-size: .78rem; font-weight: 600; cursor: pointer;
    outline: none; transition: border-color .2s;
}
.status-select:focus { border-color: var(--ad-gold); }
/* NB: background-color (not the shorthand) so the dropdown-arrow
   background-image below is never wiped. */
.status-select[data-c="confirmed"]  { color: #7a5c1a; background-color: #faf3df; border-color: #e7d194; }
.status-select[data-c="processing"] { color: #1e5a8a; background-color: #e7f2fb; border-color: #bcd8ef; }
.status-select[data-c="shipped"]    { color: #8a4a12; background-color: #fdeeda; border-color: #f2c992; }
.status-select[data-c="delivered"]  { color: #2f6b38; background-color: #e6f4e8; border-color: #bcdcc2; }

.status-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 5px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    border: 1px solid transparent; white-space: nowrap;
}
.status-pill[data-c="confirmed"],
.status-pill.is-confirmed { background: #faf3df; color: #7a5c1a; border-color: #e7d194; }
.status-pill[data-c="processing"],
.status-pill.is-processing { background: #e7f2fb; color: #1e5a8a; border-color: #bcd8ef; }
.status-pill[data-c="shipped"],
.status-pill.is-shipped { background: #fdeeda; color: #8a4a12; border-color: #f2c992; }
.status-pill[data-c="delivered"],
.status-pill.is-delivered { background: #e6f4e8; color: #2f6b38; border-color: #bcdcc2; }
.status-pill[data-c="refunded"],
.status-pill.is-refunded { background: #fde8e8; color: #b42318; border-color: #f2b7b5; }
.status-pill[data-c="notrefunded"],
.status-pill.is-notrefunded { background: #f1f5f9; color: #475467; border-color: #dfe4ec; }
.status-pill[data-c="approved"],
.status-pill.is-approved { background: #e6f4e8; color: #2f6b38; border-color: #bfe1c6; }
.status-pill[data-c="pending"],
.status-pill.is-pending { background: #fff4d6; color: #974d00; border-color: #f2d38d; }
.status-pill[data-c="cancelled"],
.status-pill.is-cancelled { background: #fde7e7; color: #b42318; border-color: #efb8b8; }

/* ---- Dropdown arrow on every <select> in the admin ----
   (the storefront rule is out-specified by .admin-card .form-control, and
   .status-select has no form-control class — so restate it here for all). */
.admin-dashboard select,
.admin-dashboard select.form-control,
.modal select,
.modal select.form-control,
.login-card select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    padding-right: 30px;
}
/* Compact color-count select in catalog add-rows. */
.admin-dashboard select.color-count { padding-right: 22px; background-position: right 5px center; }

/* Empty state */
.empty-state {
    text-align: center; padding: 48px 20px; color: var(--ad-muted);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state .lucide { width: 40px; height: 40px; color: #d8cfbf; }
.empty-state p { margin: 0; font-size: .92rem; }
/* ---- Login card ---- */
.login-hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; }
.login-card {
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 20px;
    box-shadow: var(--ad-shadow);
    padding: 36px 32px;
    width: 100%; max-width: 420px;
    box-sizing: border-box;
}
.login-card .brand {
    display: block; text-align: center;
    font-family: var(--ad-font-head); font-size: 1.6rem; font-weight: 700;
    color: var(--ad-ink); margin-bottom: 4px;
}
.login-card .brand span { color: var(--ad-gold); }
.login-card .sub { text-align: center; color: var(--ad-muted); font-size: .9rem; margin: 0 0 24px; }
.login-note { text-align: center; color: var(--ad-muted); font-size: .82rem; margin-top: 16px; }
.login-note strong { color: var(--ad-ink); }
.login-error {
    display: flex; align-items: center; gap: 9px;
    background: #fbeceb; color: var(--ad-danger);
    border: 1px solid #f0c9c5; border-radius: 10px;
    padding: 11px 14px; font-size: .85rem; margin-bottom: 16px;
}
.login-error .lucide { width: 17px; height: 17px; flex-shrink: 0; }

/* ---- Forms (admin scoped) ---- */
.admin-card .form-group,
.login-card .form-group { margin-bottom: 16px; }
.admin-card .form-group label,
.login-card .form-group label {
    display: block; font-size: .8rem; font-weight: 600;
    color: var(--ad-ink); margin-bottom: 6px;
}
.admin-card .form-control,
.login-card .form-control {
    width: 100%; box-sizing: border-box;
    padding: 10px 13px;
    border: 1.5px solid var(--ad-line); border-radius: 10px;
    font-family: var(--ad-font); font-size: .9rem; color: var(--ad-ink);
    background: #fff; transition: border-color .2s, box-shadow .2s;
}
.admin-card .form-control:focus,
.login-card .form-control:focus {
    outline: none; border-color: var(--ad-gold);
    box-shadow: 0 0 0 3px rgba(174, 138, 86, .15);
}
.admin-card .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-card small.hint { color: var(--ad-muted); font-size: .76rem; }
.admin-card .checkbox-label { display: inline-flex; align-items: center; gap: 9px; font-size: .88rem; cursor: pointer; }
.admin-card .checkbox-label input { width: 17px; height: 17px; accent-color: var(--ad-gold); }

/* ---- Product modal ---- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(20, 17, 14, .55);
    backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--ad-surface);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
    width: 100%; max-width: 720px; max-height: 92vh;
    overflow-y: auto;
    animation: adModalUp .25s var(--ad-ease);
}
@keyframes adModalUp { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--ad-line);
    position: sticky; top: 0; background: var(--ad-surface); z-index: 2;
}
.modal-header h3 { font-family: var(--ad-font-head); font-size: 1.2rem; margin: 0; }
.modal-close {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--ad-line); background: #fff; color: var(--ad-ink);
    cursor: pointer; transition: all .2s;
}
.modal-close:hover { border-color: var(--ad-danger); color: var(--ad-danger); }
.modal-close .lucide { width: 17px; height: 17px; }
.modal form { padding: 22px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 16px; margin-top: 6px; border-top: 1px solid var(--ad-line);
}

/* ---- Inbox: message detail modal + clickable rows ---- */
.msg-detail { padding: 20px 22px; }
#messageModal .modal-header h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-detail-body {
    margin-top: 16px; padding: 16px;
    background: #fff; border: 1px solid var(--ad-line); border-radius: 12px;
    font-size: .92rem; line-height: 1.65;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
.admin-table tr[data-msg-row] { cursor: pointer; }
.admin-table tr.is-unread-row { background: #f6f1e7; }
.admin-table tr.is-unread-row:hover { background: #efe8da; }

/* Variant stock table */
.variant-stock-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.variant-stock-table th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ad-muted); padding: 6px 8px; border-bottom: 1px solid var(--ad-line); }
.variant-stock-table td { padding: 6px 8px; border-bottom: 1px solid var(--ad-line); }
.variant-stock-table input.form-control { padding: 5px 7px; font-size: .8rem; min-width: 90px; }
.variant-stock-table .btn-icon {
    width: 28px; height: 28px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--ad-line); background: #fff; color: var(--ad-ink); cursor: pointer;
}
.variant-stock-table .btn-icon:hover { border-color: var(--ad-danger); color: var(--ad-danger); }
.variant-stock-table .btn-icon .lucide { width: 14px; height: 14px; }
/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .admin-dashboard { padding: 20px 14px 48px; }
    .admin-header h1 { font-size: 1.4rem; }
    .admin-header { gap: 10px; }
    .stat-card { padding: 16px; gap: 12px; }
    .stat-card .stat-icon { width: 42px; height: 42px; }
    .stat-card .stat-value { font-size: 1.25rem; }
    .admin-card { padding: 16px; }
    .admin-card .form-row { grid-template-columns: 1fr; }
    .admin-tabs .admin-tab { padding: 11px 13px; font-size: .82rem; }
    .modal { max-width: 100%; }
    .modal form { padding: 16px; }
    .login-card { padding: 28px 22px; }
    .admin-table th, .admin-table td { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-header-actions { width: 100%; justify-content: space-between; }
    .admin-actions-bar .toolbar-row { width: 100%; }
    .admin-actions-bar .bar-filters { width: 100%; }
    .admin-actions-bar .bar-filters .form-control { flex: 1 1 45%; max-width: none !important; }
    .admin-actions-bar .btn { flex: 1; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }
    .table-wrap { border-radius: 10px; }
    /* NB: tables no longer need a 720px min-width here — below 640px they are
       rendered as labelled cards (see "Responsive hardening" at the end). */
    .status-pill { width: fit-content; }
    .admin-header-actions { gap: 8px; flex-wrap: wrap; }
    .admin-actions-bar .bar-filters,
    .admin-actions-bar .toolbar-row { width: 100%; }
    .admin-actions-bar .bar-filters .form-control,
    .admin-actions-bar .toolbar-row .form-control { width: 100%; max-width: none !important; }
    .admin-actions-bar .bar-filters > *,
    .admin-actions-bar .toolbar-row > * { flex: 1 1 100%; }
}
/* ---- 2FA / status pills ---- */
.pill {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 700;
    background: #f0ebe0; color: var(--ad-muted);
}
.pill-on { background: #e6f4e8; color: var(--ad-success); }

/* ---- Order detail modal ---- */
.modal-order { max-width: 720px; }
.order-detail { padding: 20px 22px; }
.od-summary-bar {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.od-summary-bar > div {
    background: linear-gradient(135deg, #fffdf9, #f6f1e8); border: 1px solid var(--ad-line);
    border-radius: 12px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.od-summary-bar strong {
    font-family: var(--ad-font-head); font-size: 1.1rem; color: var(--ad-ink);
}
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.od-block {
    background: #faf8f3; border: 1px solid var(--ad-line); border-radius: 12px;
    padding: 14px 16px;
}
.od-block h4 {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--ad-font); font-size: .74rem; text-transform: uppercase;
    letter-spacing: .07em; color: var(--ad-muted); margin: 0 0 8px;
}
.od-block h4 .lucide { width: 14px; height: 14px; color: var(--ad-gold-dark); }
.od-block p { margin: 0 0 3px; font-size: .86rem; }
.od-block p.muted { color: var(--ad-muted); font-size: .8rem; }
.od-emphasis { font-weight: 700; color: var(--ad-ink); }
.od-items-title {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--ad-font); font-size: .74rem; text-transform: uppercase;
    letter-spacing: .07em; color: var(--ad-muted); margin: 0 0 8px;
}
.od-items-title .lucide { width: 14px; height: 14px; color: var(--ad-gold-dark); }
.od-items { min-width: 0; font-size: .82rem; }
.od-items th, .od-items td { padding: 8px 10px; }

/* Order item: thumbnail button + product name */
.od-item-product { display: flex; align-items: center; gap: 9px; min-width: 0; }
.od-item-preview {
    flex: 0 0 auto; position: relative;
    width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--ad-line); border-radius: 8px;
    background: #faf8f3; overflow: hidden; cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.od-item-preview:hover { border-color: var(--ad-gold); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.od-item-preview:focus-visible { outline: 2px solid var(--ad-gold-dark); outline-offset: 2px; }
.od-item-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.od-item-preview-zoom {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(26, 22, 16, .45); color: #fff;
    opacity: 0; transition: opacity .15s ease;
}
.od-item-preview:hover .od-item-preview-zoom,
.od-item-preview:focus-visible .od-item-preview-zoom { opacity: 1; }
.od-item-preview-zoom .lucide { width: 16px; height: 16px; }

/* Item photo lightbox */
/* Stacked above .modal-overlay (2000) so the preview sits on top of the
   order-detail modal it was opened from. */
.image-lightbox { z-index: 2100; }
.image-lightbox-panel { max-width: 620px; }
.image-lightbox-body {
    padding: 4px 4px 20px;
    display: flex; align-items: center; justify-content: center;
}
.image-lightbox-body img {
    max-width: 100%; max-height: 70vh;
    border-radius: 10px; border: 1px solid var(--ad-line);
    background: #faf8f3; display: block;
}
.od-totals { margin-top: 14px; margin-left: auto; max-width: 260px; }
.od-total-row {
    display: flex; justify-content: space-between; gap: 20px;
    padding: 6px 0; font-size: .88rem; color: var(--ad-muted);
}
.od-total-row strong { color: var(--ad-ink); font-weight: 600; }
.od-total-row.grand {
    border-top: 1.5px solid var(--ad-line); margin-top: 4px; padding-top: 10px;
    color: var(--ad-ink); font-weight: 700;
}
.od-total-row.grand strong { font-family: var(--ad-font-head); font-size: 1.15rem; }

@media (max-width: 640px) {
    .od-summary-bar { grid-template-columns: 1fr; }
    .od-grid { grid-template-columns: 1fr; }
    .od-totals { max-width: 100%; }
}

/* ---- Inline search + filter toolbar ---- */
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-row .search-inline {
    position: relative; flex: 1 1 260px; min-width: 200px;
    display: flex; align-items: center;
}
.toolbar-row .search-inline .lucide {
    position: absolute; left: 13px; width: 16px; height: 16px;
    color: var(--ad-muted); pointer-events: none;
}
.toolbar-row .search-inline .form-control { padding-left: 38px; width: 100%; }

/* ---- Stock badge ---- */
.stock-badge {
    display: inline-block; min-width: 34px; text-align: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: .76rem; font-weight: 700;
}
.stock-badge.is-in  { background: #e6f4e8; color: var(--ad-success); }
.stock-badge.is-low { background: #fdf1df; color: #b07514; }
.stock-badge.is-out { background: #fdeaea; color: var(--ad-danger); }

/* ---- Catalog manager ---- */
.catalog-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
@media (max-width: 860px) { .catalog-grid { grid-template-columns: 1fr; } }
.catalog-panel {
    background: #faf8f3; border: 1px solid var(--ad-line);
    border-radius: 12px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.catalog-panel-head {
    display: flex; align-items: center; gap: 8px;
    font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ad-gold-dark);
}
.catalog-panel-head .lucide { width: 15px; height: 15px; }
.chip-list {
    display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px;
    max-height: 180px; overflow-y: auto;
}
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--ad-line);
    border-radius: 999px; padding: 5px 12px;
    font-size: .8rem; color: var(--ad-ink);
}
.chip-color { padding-left: 8px; }
.chip .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex-shrink: 0; }
.chip-add input[type="color"] { flex: 0 0 auto; width: 44px; height: 38px; padding: 3px; border: 1px solid var(--ad-line); border-radius: 8px; background: #fff; cursor: pointer; }
.chip-add input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.chip-add input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
.chip-add select.color-count { flex: 0 0 auto; width: 62px; }
.color-picks { display: flex; gap: 6px; flex-wrap: nowrap; }
.chip-remove {
    border: none; background: none; cursor: pointer;
    color: var(--ad-muted); font-size: .95rem; line-height: 1; padding: 0 2px;
}
.chip-remove:hover { color: var(--ad-danger); }
.chip-add { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.chip-add .form-control { flex: 1 1 auto; }
@media (max-width: 480px) { .chip-add { flex-wrap: wrap; } }

/* Variant size accepts numeric or letter-based product sizing. */
.size-cell .size-value { min-width: 90px; }
.single-details.is-muted { opacity: .55; }

/* ---- Product form: option choice chips ---- */
.chip-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip-choice {
    cursor: pointer; user-select: none;
    border: 1.5px solid var(--ad-line); background: #fff;
    transition: border-color .15s, background .15s;
}
.chip-choice input { accent-color: var(--ad-gold); margin: 0; }
.chip-choice:hover { border-color: var(--ad-gold); }
.chip-choice:has(input:checked) {
    border-color: var(--ad-gold); background: #f7efe2; color: var(--ad-gold-dark);
    font-weight: 600;
}

/* ---- Site content (CMS) form ---- */
.cms-group {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--ad-font); font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--ad-gold-dark); margin: 26px 0 14px;
    padding-top: 18px; border-top: 1px dashed var(--ad-line);
}
.cms-group:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.cms-group .lucide { width: 15px; height: 15px; }

/* ---- Product photo upload ---- */
.form-section-title {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--ad-font); font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--ad-gold-dark); margin: 24px 0 14px;
    padding-top: 18px; border-top: 1px dashed var(--ad-line);
}
.form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.form-section-title .lucide { width: 15px; height: 15px; }

.photos-layout {
    display: grid; grid-template-columns: 220px 1fr; gap: 14px;
    align-items: stretch;
}
.photo-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    background: #faf8f3; border: 1px solid var(--ad-line);
    border-radius: 12px; padding: 14px;
}
.photo-card-title {
    font-family: var(--ad-font); font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--ad-muted);
}
.photo-card .pd-image-preview { width: 100%; height: 130px; }
.photo-card .gallery-grid { flex: 1 1 auto; align-content: flex-start; }
.photo-card .hint { line-height: 1.45; }
@media (max-width: 640px) {
    .photos-layout { grid-template-columns: 1fr; }
    .photo-card .pd-image-preview { width: 100%; height: 120px; }
}

.pd-image-preview {
    width: 88px; height: 88px; border-radius: 12px;
    border: 1.5px dashed var(--ad-line);
    background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; color: var(--ad-muted); font-size: .72rem; overflow: hidden;
    flex: 0 0 auto;
}
.pd-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-image-preview .lucide { width: 22px; height: 22px; color: var(--ad-gold); }
.pd-upload-row .hint { color: var(--ad-muted); font-size: .74rem; }

/* Orders table: payment method pill (COD due / COD paid / Paystack) */
.pay-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: .72rem; font-weight: 700; white-space: nowrap;
    border: 1px solid var(--ad-line); background: #f6f4ef; color: var(--ad-muted);
}
.pay-pill .lucide { width: 12px; height: 12px; }
/* Cash still owed from the rider — needs to stand out in a list. */
.pay-pill.is-due { background: #fdf4e3; border-color: #e8cf9a; color: #6d4c12; }
.pay-pill.is-due .lucide { color: var(--ad-gold-dark, #a97c25); }
/* Cash already collected. */
.pay-pill.is-paid { background: #eef6f1; border-color: #b9dccb; color: #0e4c3e; }
.pay-pill.is-paid .lucide { color: #176b57; }

/* Indented sub-row used under a split-row (e.g. COD outstanding detail) */
.split-row-sub { font-size: .78rem; opacity: .78; padding-left: 12px; }
.split-row-sub span::before { content: "↳ "; }

/* ---- Product table: main-image thumbnail beside name/ID ---- */
.cell-product {
    display: flex; align-items: center; gap: 10px;
}
.cell-product-text { min-width: 0; }
.cell-product-text strong {
    display: inline-block; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.product-thumb {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--ad-line); background: #faf8f3;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Gallery photo grid (multi-upload) ---- */
.gallery-grid {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
}
.gallery-thumb {
    position: relative; width: 76px; height: 76px;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--ad-line); background: #faf8f3;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-remove {
    position: absolute; top: 3px; right: 3px;
    width: 20px; height: 20px; border-radius: 50%;
    border: none; cursor: pointer;
    background: rgba(27, 25, 23, .78); color: #fff;
    font-size: .85rem; line-height: 1; padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.gallery-remove:hover { background: var(--ad-danger); }

/* ---- Order status row in the order popup ---- */
.od-status-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #faf8f3; border: 1px solid var(--ad-line); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 16px;
}
.od-status-row label {
    display: flex; align-items: center; gap: 7px;
    font-family: var(--ad-font); font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--ad-muted);
    margin: 0;
}
.od-status-row label .lucide { width: 15px; height: 15px; color: var(--ad-gold-dark); }
.od-status-row .status-select { margin-right: auto; min-width: 150px; }
.status-select[data-c="confirmed"]  { background-color: #E8EDF8; color: #39547F; }
.status-select[data-c="processing"] { background-color: #E8EDF8; color: #39547F; }
.status-select[data-c="shipped"]    { background-color: #EDE9F8; color: #5B4A99; }
.status-select[data-c="delivered"]  { background-color: #E4F1E8; color: #2F6B46; }
.status-select[data-c="cancelled"]  { background-color: #FDE0E0; color: #B91C1C; }

.ad-toast-stack {
    position: fixed;
    bottom: 22px; left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    pointer-events: none;
    width: max-content; max-width: calc(100vw - 32px);
}
.ad-toast {
    background: #1b1917; color: #fff;
    border-radius: 999px;
    padding: 11px 20px;
    font-family: var(--ad-font); font-size: .86rem; font-weight: 500;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
    opacity: 0; transform: translateY(10px);
    transition: opacity .3s var(--ad-ease), transform .3s var(--ad-ease);
    max-width: 100%;
}
.ad-toast.in { opacity: 1; transform: none; }
.ad-toast.is-error { background: var(--ad-danger); }
.admin-dashboard .btn-ghost-ic .lucide { width: 15px; height: 15px; }

/* ---------- Image cropper ---------- */
.crop-body { padding: 14px 18px 0; }

.crop-stage {
    position: relative; width: 100%; aspect-ratio: 4 / 4.4;
    background: #141210; border-radius: 14px; overflow: hidden;
    touch-action: none; cursor: grab; user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage img {
    position: absolute; top: 0; left: 0; transform-origin: 0 0;
    max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
/* rule-of-thirds guides */
.crop-grid { position: absolute; inset: 0; pointer-events: none; }
.crop-grid::before, .crop-grid::after,
.crop-grid span:nth-child(1), .crop-grid span:nth-child(2) { content: ''; position: absolute; background: rgba(255,255,255,.28); }
.crop-grid span:nth-child(1) { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.crop-grid span:nth-child(2) { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.crop-grid::before { top: 33.33%; left: 0; right: 0; height: 1px; }
.crop-grid::after  { top: 66.66%; left: 0; right: 0; height: 1px; }
.crop-zoom { display: flex; align-items: center; gap: 10px; margin: 14px 0 2px; }
.crop-zoom input[type="range"] { flex: 1; accent-color: var(--ad-gold, #ae8a56); }
.crop-zoom .lucide { width: 16px; height: 16px; color: var(--ad-muted, #6f6a63); flex-shrink: 0; }

/* ---------- Paystack workspace shortcuts ---------- */
.paystack-shortcuts {
    margin: 0 24px 24px;
    padding: 24px;
    border: 1px solid var(--ad-line);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fffdf9 0%, #f5f0e8 100%);
}
.paystack-shortcuts-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.paystack-brand-mark {
    display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px;
    border-radius: 12px; background: #0e6b57; color: #fff; font-size: 1.35rem; font-weight: 800;
}
.paystack-shortcuts-head h2 { margin: 2px 0 4px; font-size: 1.25rem; }
.paystack-shortcuts-head p { margin: 0; color: var(--ad-muted); font-size: .84rem; }
.paystack-open-btn { margin-left: auto; white-space: nowrap; }
.paystack-shortcuts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.paystack-shortcut {
    display: flex; align-items: center; gap: 11px; min-height: 78px; padding: 13px;
    border: 1px solid rgba(48, 43, 35, .12); border-radius: 13px; background: rgba(255,255,255,.7);
    color: var(--ad-text); text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.paystack-shortcut:hover { transform: translateY(-2px); border-color: var(--ad-gold); box-shadow: 0 8px 18px rgba(58, 45, 27, .1); }
.paystack-shortcut.is-featured { grid-column: span 2; background: #173e35; color: #fff; border-color: #173e35; }
.paystack-shortcut-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: rgba(174,138,86,.15); color: var(--ad-gold-dark); }
.is-featured .paystack-shortcut-icon { background: rgba(255,255,255,.14); color: #f1d39c; }
.paystack-shortcut-icon .lucide { width: 17px; height: 17px; }
.paystack-shortcut-copy { min-width: 0; display: grid; gap: 4px; }
.paystack-shortcut-copy strong { font-size: .88rem; }
.paystack-shortcut-copy small { color: var(--ad-muted); font-size: .73rem; line-height: 1.35; }
.is-featured .paystack-shortcut-copy small { color: rgba(255,255,255,.7); }
.paystack-shortcut-arrow { width: 15px; height: 15px; margin-left: auto; flex: 0 0 15px; color: var(--ad-muted); }
.is-featured .paystack-shortcut-arrow { color: #f1d39c; }
.paystack-shortcuts-note { display: flex; align-items: center; gap: 7px; margin-top: 17px; color: var(--ad-muted); font-size: .75rem; }
.paystack-shortcuts-note .lucide { width: 15px; height: 15px; color: #0e6b57; }
@media (max-width: 900px) { .paystack-shortcuts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
    .paystack-shortcuts { margin: 0 16px 16px; padding: 17px; }
    .paystack-shortcuts-head { align-items: flex-start; flex-wrap: wrap; }
    .paystack-shortcuts-head p { max-width: 250px; }
    .paystack-open-btn { width: 100%; margin: 4px 0 0; justify-content: center; }
    .paystack-shortcuts-grid { grid-template-columns: 1fr; }
    .paystack-shortcut.is-featured { grid-column: span 1; }
}

/* ---------- Order notifications (unviewed / new) ---------- */
.badge-new {
    display: inline-flex; align-items: center; gap: 4px;
    background: #fde4df; color: #b91c1c; padding: 2px 8px; border-radius: 999px;
    font-size: .68rem; font-weight: 700; vertical-align: middle;
}
.badge-new .lucide { width: 12px; height: 12px; }
tr[data-unviewed="1"] { background: rgba(168,85,247,.04); }
tr[data-unviewed="1"] td strong { font-weight: 700; }
tr[data-unviewed="1"] .is-new { animation: pulse-dot 1.8s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.unviewed-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--ad-danger); color: #fff; border-radius: 999px;
    font-size: .7rem; font-weight: 700; padding: 1px 8px; margin-left: 6px;
    vertical-align: middle;
}
.unviewed-badge.is-zero { display: none; }
.unviewed-badge.is-warn { background: #b45309; }

/* ---------- Coupons ---------- */
.coupon-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.coupon-form-grid .form-group { margin: 0; }
.coupon-switch-label { display: flex; flex-direction: column; gap: 6px; }
.status-pill.is-off { background: #eee9e0; color: #6f6a63; }
.status-pill.is-active { background: #e6f4e8; color: #2f6b38; }
.status-pill.is-pending { background: #fdf3e0; color: #92600a; }
.status-pill.is-rejected { background: #fde0e0; color: #b91c1c; }
.status-pill.is-approved { background: #e6f4e8; color: #2f6b38; }
@media (max-width: 900px) { .coupon-form-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d8d2c6; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--ad-success, #3a7d44); }
.switch input:checked + .slider::before { transform: translateX(17px); }

/* ---------- Reviews / Inbox cells ---------- */
.review-cell { max-width: 340px; }
.stars { color: #d9a441; letter-spacing: 1px; }

/* ---------- Analytics ---------- */
.admin-two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 950px) { .admin-two-col { grid-template-columns: 1fr; } }
.chart-bars { display: flex; align-items: stretch; gap: 6px; height: 170px; padding: 6px 2px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chart-bar-wrap { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.chart-bar { width: 38%; max-width: 26px; min-height: 2px; background: var(--ad-gold, #ae8a56); border-radius: 3px 3px 0 0; transition: height .3s; }
.chart-bar-alt { background: #2c2a26; opacity: .8; }
.chart-label { text-align: center; font-size: .64rem; color: var(--ad-muted, #6f6a63); padding-top: 4px; }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.legend-swatch.gold { background: var(--ad-gold, #ae8a56); }
.legend-swatch.ink { background: #2c2a26; opacity: .8; }
.top-product-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--ad-line, #e7e2d8); }
.top-product-row:last-child { border-bottom: 0; }
.tp-info { flex: 1; min-width: 0; }
.tp-name { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-bar { height: 6px; background: #efe9de; border-radius: 999px; overflow: hidden; }
.tp-bar span { display: block; height: 100%; background: var(--ad-gold, #ae8a56); border-radius: 999px; }
.tp-nums { white-space: nowrap; color: var(--ad-muted, #6f6a63); }
.split-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--ad-line, #e7e2d8); font-size: .85rem; }
.split-row:last-child { border-bottom: 0; }
.unviewed-badge.is-warn { background: #d97706; }
.analytics-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.analytics-filter-panel {
    background: linear-gradient(180deg, #fffefc 0%, #f8f5f0 100%);
    border: 1px solid var(--ad-line, #e7e2d8);
    box-shadow: 0 8px 24px rgba(30, 26, 20, 0.04);
    padding: 20px 20px 16px;
    margin-bottom: 18px;
}
.analytics-filter-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
}
.analytics-filter-header h2 {
    margin: 2px 0 0; font-size: 1.1rem; letter-spacing: .01em;
}
.eyebrow {
    display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .11em;
    text-transform: uppercase; color: var(--ad-gold-dark, #8a6a3c);
}
.analytics-filter-form {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: end;
    background: rgba(255,255,255,0.45); border: 1px solid rgba(174,138,86,0.14); border-radius: 14px; padding: 12px;
}
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-field label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ad-muted, #6f6a63); font-weight: 700;
}
.filter-field .form-control {
    height: 44px; background: #fff; border: 1px solid var(--ad-line, #e7e2d8); border-radius: 12px;
    box-shadow: inset 0 1px 2px rgba(27,25,23,0.02);
}
.filter-actions { display: flex; align-items: end; justify-content: flex-end; }
.filter-actions .btn { min-width: 160px; height: 44px; }
.insight-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.insight-pill {
    background: linear-gradient(180deg, #f9f5ef 0%, #f3eee6 100%); border: 1px solid var(--ad-line, #e7e2d8);
    border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.insight-pill span { color: var(--ad-muted, #6f6a63); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.insight-pill strong { font-size: 1.12rem; line-height: 1.2; }
.insight-pill small { color: var(--ad-muted, #6f6a63); }
.mini-section {
    padding: 14px 14px 0; background: #fbf9f5; border: 1px solid var(--ad-line, #e7e2d8); border-radius: 12px;
}
.mini-section h4 { margin: 0 0 10px; }
.empty-state-panel { margin-top: 12px; }
.chart-bars { overflow-x: auto; scrollbar-width: thin; }
.chart-col { min-width: 22px; }
.split-row { gap: 8px; }
.top-product-row { flex-wrap: wrap; }
.tp-nums { overflow-wrap: anywhere; }
.admin-two-col .admin-card {
    background: linear-gradient(180deg, #ffffff 0%, #fffdf8 100%);
}
.stat-card {
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; height: 4px; border-radius: inherit;
    background: linear-gradient(90deg, rgba(174,138,86,0.8), rgba(174,138,86,0.12));
}
.stat-card-gold .stat-icon { background: #f3e9d9; }
.stat-card-ink .stat-icon { background: #e9edf6; color: #233a61; }
.stat-card-rose .stat-icon { background: #fbeae8; color: #a74242; }
.stat-card-forest .stat-icon { background: #eaf4ec; color: #2d6b42; }
.stat-card-sky .stat-icon { background: #ebf4fb; color: #275b88; }
@media (max-width: 1100px) { .analytics-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } .analytics-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
    .admin-header { flex-wrap: wrap; gap: 12px; }
    .admin-header .admin-header-actions { width: 100%; }
    .admin-header .admin-header-actions .btn { width: 100%; justify-content: center; }
    .analytics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .insight-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analytics-filter-form { grid-template-columns: 1fr; }
    .analytics-filter-header { flex-direction: column; align-items: flex-start; }
    .analytics-filter-header .btn { width: 100%; justify-content: center; }
    .filter-actions { justify-content: stretch; }
    .filter-actions .btn { width: 100%; }
    .chart-bars { gap: 4px; }
    .chart-label { font-size: .56rem; }
    .top-product-row { flex-direction: column; align-items: flex-start; }
    .tp-nums { white-space: normal; }
}
@media (max-width: 500px) { .analytics-summary, .insight-pills { grid-template-columns: 1fr; } .chart-bars { min-height: 130px; } }

/* ---------- Coupons page ---------- */
.coupon-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.coupon-switch-label { display: flex; flex-direction: column; justify-content: center; }
.status-pill.is-off { background: #ece9e4; color: #6f6a63; }
.status-pill.is-pending { background: #fef3c7; color: #92400e; }
.status-pill.is-approved { background: #e6f4e8; color: #2f6b38; }
.status-pill.is-rejected { background: #fde0e0; color: #b91c1c; }
.stars { color: #d97706; letter-spacing: 1px; }
.review-cell { max-width: 340px; }

/* ---------- Analytics / dashboard ---------- */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .88rem; }
.alert-warn { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }
.alert .lucide { width: 18px; height: 18px; flex-shrink: 0; }
.analytics-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 18px; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-track { flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end; background: #f3f0ea; border-radius: 8px; overflow: hidden; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--ad-gold, #ae8a56), #8a6a3d); border-radius: 8px 8px 0 0; min-height: 2px; transition: height .4s ease; }
.bar-label { font-size: .7rem; color: var(--ad-muted, #6f6a63); font-weight: 600; }
.bar-val { font-size: .68rem; color: var(--ad-muted, #6f6a63); }
.top-products { list-style: none; margin: 0; padding: 0; counter-reset: tp; }
.top-products li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--ad-line, #e7e2d8); counter-increment: tp; font-size: .9rem; }
.top-products li::before { content: counter(tp); width: 22px; height: 22px; border-radius: 50%; background: var(--ad-gold, #ae8a56); color: #fff; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.top-products li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-products li:last-child { border-bottom: 0; }
@media (max-width: 900px) { .coupon-form-grid { grid-template-columns: repeat(2, 1fr); } .analytics-grid { grid-template-columns: 1fr; } }

/* ---------- Developer storefront image upload fields ---------- */
.admin-upload-group { margin-bottom: 18px; }
.admin-upload-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.upload-field { display: block; }
.upload-field .form-control { margin-bottom: 8px; }
.upload-field .form-help,
.form-help { display: block; color: var(--ad-muted, #6f6a63); font-size: .78rem; margin-top: 4px; }

/* ============================================================
   Responsive hardening
   ------------------------------------------------------------
   Fixes for narrow viewports:
     • stat grids with inline column counts used to keep their desktop track
       count on phones (a 5 × 160px grid on a 390px screen pushed the whole
       page sideways),
     • the shipping summary pills overflowed their card,
     • wide data tables used to hide whole columns behind a horizontal scroll
       on phones. Below 640px every row now renders as a labelled card; the
       labels are copied from <thead> by admin.js → initResponsiveTables().
   ============================================================ */

/* --- Stat grids: named column variants that still collapse.
       minmax(0, 1fr) stops a track from being widened by its content's
       min-content size (the cause of the page-level horizontal overflow). */
.stats-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .stats-grid-3,
    .stats-grid-4,
    .stats-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .stats-grid-3,
    .stats-grid-4,
    .stats-grid-5 { grid-template-columns: 1fr; }
}

/* --- Shipping summary pills: wrap instead of overflowing the card. */
.shipping-summary-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 400px) { .shipping-summary-pill { min-height: 52px; } }

/* --- Detail blocks used inside modals / customer view. */
.detail-grid { min-width: 0; }
/* --- Checkbox grids (product modal, settings). The product modal used to hard
       code `repeat(2, minmax(180px, 1fr))`, forcing ~376px of content into a
       ~290px modal body so the modal scrolled sideways on phones. Two shrinkable
       tracks keep the desktop layout and collapse to one column on phones. */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    min-width: 0;
}
@media (max-width: 640px) { .checkbox-grid { grid-template-columns: 1fr; } }

/* --- Tabs: smooth finger scrolling on touch devices. */
.admin-tabs { -webkit-overflow-scrolling: touch; }

/* iOS Safari auto-zooms the whole page when a focused field's text is under
   16px — keep every tappable field at 16px on phones/tablets so opening the
   keyboard (e.g. the login form) never zooms. */
@media (max-width: 768px) {
    input, select, textarea, .form-control { font-size: 16px !important; }
}

/* --- Compact tables (fewer columns than the 920px default). */
.admin-table--compact { min-width: 800px; }
/* --- Fluid tables: fit their container (modals, narrow panels). */
.admin-table--fluid { min-width: 0; }
#variantStockTable { width: 100%; min-width: 0; table-layout: fixed; }
#variantStockTable th:nth-child(1), #variantStockTable td:nth-child(1) { width: 19%; }
#variantStockTable th:nth-child(2), #variantStockTable td:nth-child(2) { width: 21%; }
#variantStockTable th:nth-child(3), #variantStockTable td:nth-child(3) { width: 15%; }
#variantStockTable th:nth-child(4), #variantStockTable td:nth-child(4) { width: 17%; }
#variantStockTable th:nth-child(5), #variantStockTable td:nth-child(5) { width: 18%; }
#variantStockTable th:nth-child(6), #variantStockTable td:nth-child(6) { width: 10%; }
#variantStockTable th,
#variantStockTable td { padding: 8px 5px; }
#variantStockTable select.form-control { width: 100%; min-width: 0; }
#variantStockTable input[data-k="stock"],
#variantStockTable input[data-k="price"] { width: 100% !important; min-width: 0; }

/* ------------------------------------------------------------
   Stacked tables — phones only
   Each <tr> becomes a card; every <td> shows its column name from
   data-label, right-aligned against its value(s).
   ------------------------------------------------------------ */
@media (max-width: 640px) {
    /* the wrapper no longer needs to scroll — it just frames the cards */
    .table-wrap {
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .admin-table,
    .admin-table thead,
    .admin-table tbody,
    .admin-table tr,
    .admin-table th,
    .admin-table td { display: block; width: 100%; box-sizing: border-box; }

    .admin-table { min-width: 0; font-size: .88rem; }
    .admin-table--compact { min-width: 0; }
    .admin-table thead { display: none; }

    .admin-table tbody tr {
        margin-bottom: 12px;
        padding: 6px;
        background: var(--ad-surface);
        border: 1px solid var(--ad-line);
        border-radius: 12px;
        box-shadow: var(--ad-shadow-sm);
    }
    .admin-table tbody tr:hover { background: var(--ad-surface); }

    .admin-table td {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: flex-end;
        gap: 6px 10px;
        padding: 9px 10px;
        border: 0;
        border-bottom: 1px dashed var(--ad-line);
        text-align: right;
        vertical-align: top;
        overflow-wrap: anywhere;
    }
    .admin-table tbody tr td:last-child { border-bottom: 0; }

    /* Column name — pushed to the far left so the value(s) stay right-aligned. */
    .admin-table td::before {
        content: attr(data-label);
        margin-right: auto;
        max-width: 50%;
        padding-top: 2px;
        color: var(--ad-muted);
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .08em;
        line-height: 1.3;
        text-align: left;
        text-transform: uppercase;
    }
    /* Cells without a matching header (colspan empty-states, action columns
       with a blank <th>) render without the label slot. */
    .admin-table td:not([data-label])::before { content: none; display: none; }
    .admin-table td[colspan] { justify-content: center; text-align: center; border-bottom: 0; }

    .admin-table td > .cell-actions,
    .admin-table td.row-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
    .admin-table td .status-pill { width: fit-content; }
    .admin-table td .js-refund-toggle { margin-top: 0; }
    .admin-table td.cell-refund { flex-wrap: nowrap; }
    .admin-table td .cell-refund-inner { flex-wrap: nowrap; }

    /* Empty/placeholder rows stay centred instead of split apart. */
    .admin-table tr.is-empty td { justify-content: center; text-align: center; }

    /* Inputs inside stacked rows (variant stock, review notes) go full width. */
    .admin-table td input.form-control,
    .admin-table td select.form-control,
    .admin-table td textarea { width: 100%; max-width: none; }
    .admin-table td .size-cell { width: 100%; }

    /* Keep variant controls in a compact table that fits the modal without
       horizontal scrolling. */
    .variant-table-wrap { overflow: visible; }
    #variantStockTable { display: table; width: 100%; min-width: 0; }
    #variantStockTable thead { display: table-header-group; }
    #variantStockTable tbody { display: table-row-group; }
    #variantStockTable tr { display: table-row; }
    #variantStockTable th,
    #variantStockTable td {
        display: table-cell;
        width: auto;
        padding: 8px 6px;
        vertical-align: middle;
        text-align: left;
        border-bottom: 1px solid var(--ad-line);
    }
    #variantStockTable td::before { content: none; display: none; }
}

/* ------------------------------------------------------------
   Notices — only .alert-warn was defined, so every success and
   info notice on Shipping rendered as an unstyled box.
   ------------------------------------------------------------ */
.alert-success { background: #eaf5ec; border: 1px solid #b7d9bf; color: #245c30; }
.alert-info    { background: #eaf1f8; border: 1px solid #bed4ea; color: #1e4f7d; }

/* ------------------------------------------------------------
   Settlement status badges.
   The markup used .status-badge + .is-*, but only .status-pill
   existed — so "Settled / owed / credit / Confirmed / Pending"
   all rendered as plain, unlabelled text.
   ------------------------------------------------------------ */
.status-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 5px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    border: 1px solid transparent; white-space: nowrap;
}
.status-badge.is-delivered,
.status-badge.is-confirmed   { background: #e6f4e8; color: #2f6b38; border-color: #bcdcc2; }
.status-badge.is-processing  { background: #e7f2fb; color: #1e5a8a; border-color: #bcd8ef; }
.status-badge.is-pending     { background: #fff4d6; color: #974d00; border-color: #f2d38d; }
.status-badge.is-cancelled   { background: #fde7e7; color: #b42318; border-color: #efb8b8; }
/* Voided rows stay legible but read as clearly dead. */
.status-badge.is-voided      { background: #f1f5f9; color: #64748b; border-color: #dbe2ea; }

/* Bare POST forms used inline inside settlement rows. */
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* Explainer strip under a panel heading. */
.shipping-panel-note {
    display: flex; align-items: flex-start; gap: 8px;
    margin: 0 0 16px; padding: 11px 14px;
    border: 1px solid var(--ad-line); border-left: 3px solid var(--ad-gold);
    border-radius: var(--ad-radius-sm); background: #fbfaf7;
    color: var(--ad-muted); font-size: .8rem; line-height: 1.6;
}
.shipping-panel-note > span { display: block; min-width: 0; }

/* ------------------------------------------------------------
   Settlements — headline figures
   ------------------------------------------------------------ */
.settle-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0 24px; }
.settle-stat { position: relative; min-height: 118px; padding: 18px; border: 1px solid var(--ad-line); border-radius: 14px; background: linear-gradient(145deg, #fff, #fbfaf7); box-shadow: 0 3px 12px rgba(27,25,23,.035); }
.settle-stat > span:not(.settle-stat-icon) { display: block; padding-right: 34px; color: var(--ad-muted); font-size: .75rem; font-weight: 750; letter-spacing: .01em; }
.settle-stat strong { display: block; margin-top: 10px; color: var(--ad-ink); font-size: clamp(1.2rem, 2vw, 1.55rem); font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.settle-stat small { display: block; margin-top: 3px; color: var(--ad-muted); font-size: .72rem; }
.settle-stat-icon { position: absolute; top: 16px; right: 16px; display: grid !important; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #f0ede6; color: var(--ad-gold-dark); }
.settle-stat-icon .lucide { width: 17px; height: 17px; }
.settle-stat.is-owe     { border-top: 3px solid var(--ad-danger); }
.settle-stat.is-credit  { border-top: 3px solid var(--ad-success); }
.settle-stat.is-pending { border-top: 3px solid #b45309; }

/* ------------------------------------------------------------
   Settlements — pending confirmation queue
   ------------------------------------------------------------ */
.settle-needs-action { margin-bottom: 20px; padding: 16px; border: 1px solid #f2d38d; border-radius: var(--ad-radius-sm); background: #fffdf5; }
.settle-needs-action h4 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 0 0 4px; color: var(--ad-ink); font-size: .95rem; }
.settle-needs-action h4 .lucide { width: 17px; height: 17px; color: #b45309; }
.settle-count { padding: 3px 9px; border-radius: 999px; background: #fdf3e0; color: #92400e; font-size: .71rem; font-weight: 800; }
.settle-pending-list { display: grid; gap: 9px; margin-top: 12px; }
.settle-pending-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--ad-line); border-radius: var(--ad-radius-sm); background: #fff; }
.settle-pending-who { display: grid; gap: 3px; flex: 1 1 220px; min-width: 0; }
.settle-pending-who strong { font-size: .9rem; }
.settle-pending-who small { color: var(--ad-muted); font-size: .74rem; line-height: 1.45; }
.settle-pending-amt { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settle-pending-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------
   Settlements — record a payment.
   Two tiny inline forms side by side inside a table cell were
   unreadable; give each its own labelled block in a tidy grid.
   ------------------------------------------------------------ */
.settle-record { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
.settle-record-form { display: grid; gap: 7px; align-content: start; padding: 10px; border: 1px solid var(--ad-line); border-radius: var(--ad-radius-sm); background: #fbfaf7; }
.settle-record-form > span { display: flex; align-items: center; gap: 6px; color: var(--ad-muted); font-size: .71rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.settle-record-form > span .lucide { width: 13px; height: 13px; }
.settle-record-form > small { color: var(--ad-muted); font-size: .72rem; }
.settle-record-form .form-control { width: 100%; max-width: none; }
.settle-record-form .btn { justify-content: center; }
.settle-record-form .btn[disabled] { opacity: .5; cursor: not-allowed; }
.settle-actions { width: 100%; }
.settle-actions > summary { display: inline-flex; cursor: pointer; list-style: none; white-space: nowrap; }
.settle-actions > summary::-webkit-details-marker { display: none; }
.settle-actions[open] .settle-record { margin-top: 12px; }

/* Rider settlement accounts replace the former ten-column ledger table with
   readable account cards that retain the same live-update hooks. */
.settle-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 22px 0 13px; }
.settle-section-heading .eyebrow { margin: 0 0 4px; }
.settle-section-heading h4 { margin: 0; color: var(--ad-ink); font-size: 1.04rem; }
.settle-section-heading > p { margin: 0; color: var(--ad-muted); font-size: .76rem; text-align: right; }
.settle-rider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settle-rider-card { min-width: 0; padding: 18px; border: 1px solid var(--ad-line); border-radius: 15px; background: #fff; box-shadow: 0 4px 16px rgba(27,25,23,.045); }
.settle-rider-card.is-unassigned { border-color: #e8c991; background: linear-gradient(145deg, #fffdf7, #fff); }
.settle-rider-head { display: flex; align-items: center; gap: 11px; min-width: 0; padding-bottom: 15px; border-bottom: 1px solid var(--ad-line); }
.settle-rider-avatar { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: #f3efe7; color: var(--ad-gold-dark); }
.settle-rider-avatar .lucide { width: 20px; height: 20px; }
.settle-rider-identity { display: grid; flex: 1; gap: 3px; min-width: 0; }
.settle-rider-identity strong { overflow: hidden; color: var(--ad-ink); font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.settle-rider-identity small { color: var(--ad-muted); font-size: .72rem; }
.settle-rider-identity .settle-rider-inactive { color: var(--ad-danger); }
.settle-rider-head .status-badge { max-width: 48%; text-align: center; white-space: normal; }
.settle-rider-metrics { display: grid; grid-template-columns: .7fr 1fr 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--ad-line); }
.settle-rider-metrics > div { display: grid; align-content: start; gap: 5px; min-width: 0; }
.settle-rider-metrics span, .settle-available-amount span { color: var(--ad-muted); font-size: .68rem; font-weight: 700; line-height: 1.35; }
.settle-rider-metrics strong { overflow-wrap: anywhere; color: var(--ad-ink); font-size: .82rem; font-variant-numeric: tabular-nums; }
.settle-rider-ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--ad-line); }
.settle-ledger-group { display: grid; align-content: start; gap: 7px; min-width: 0; }
.settle-ledger-group > strong { display: flex; align-items: center; gap: 5px; margin-bottom: 1px; color: var(--ad-ink); font-size: .69rem; }
.settle-ledger-group > strong .lucide { width: 13px; height: 13px; color: var(--ad-gold-dark); }
.settle-ledger-group > span { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.settle-ledger-group small { color: var(--ad-muted); font-size: .67rem; }
.settle-ledger-group b { color: var(--ad-ink); font-size: .71rem; font-variant-numeric: tabular-nums; text-align: right; }
.settle-ledger-group.is-pending b { color: #974d00; }
.settle-available { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 13px 0; }
.settle-available-amount { display: grid; gap: 4px; min-width: 0; padding: 10px 11px; border: 1px solid var(--ad-line); border-radius: 10px; background: #fbfaf7; }
.settle-available-amount strong { overflow-wrap: anywhere; color: var(--ad-ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.settle-available-amount.is-payable { border-color: #cce2d0; background: #f5fbf6; }
.settle-available-amount.is-payable strong { color: #2f6b38; }
.settle-available-amount.is-collectable { border-color: #efcaca; background: #fff8f7; }
.settle-available-amount.is-collectable strong { color: #a9362d; }
.settle-card-actions { padding-top: 2px; }
.settle-card-actions > p { display: flex; align-items: flex-start; gap: 7px; margin: 0; color: var(--ad-muted); font-size: .74rem; line-height: 1.5; }
.settle-card-actions > p .lucide { flex: 0 0 16px; width: 16px; height: 16px; color: var(--ad-gold-dark); }

/* Per-rider filter above the balance table. */
.settle-filter { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.settle-filter label { display: grid; gap: 6px; min-width: 220px; color: var(--ad-muted); font-size: .74rem; font-weight: 700; }
.settle-filter .form-control { min-height: 38px; }

@media (max-width: 900px) {
    .settle-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settle-rider-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
    .settle-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .settle-stat { min-height: 112px; padding: 13px; }
    .settle-stat-icon { top: 11px; right: 11px; width: 29px; height: 29px; }
    .settle-stat > span:not(.settle-stat-icon) { padding-right: 27px; font-size: .67rem; }
    .settle-stat strong { margin-top: 8px; font-size: 1.05rem; }
    .settle-stat small { font-size: .66rem; }
    .settle-section-heading { align-items: flex-start; flex-direction: column; }
    .settle-section-heading > p { text-align: left; }
    .settle-rider-card { padding: 14px; }
    .settle-rider-head { align-items: flex-start; flex-wrap: wrap; }
    .settle-rider-head .status-badge { max-width: none; margin-left: 53px; }
    .settle-rider-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
    .settle-rider-metrics span { font-size: .62rem; }
    .settle-rider-metrics strong { font-size: .72rem; }
    .settle-rider-ledger { gap: 8px; }
    .settle-ledger-group > strong { align-items: flex-start; min-height: 28px; font-size: .63rem; }
    .settle-ledger-group small, .settle-ledger-group b { font-size: .63rem; }
    .settle-available-amount { padding: 9px; }
    .settle-available-amount span { font-size: .63rem; }
    .settle-available-amount strong { font-size: .9rem; }
    .settle-record { grid-template-columns: minmax(0, 1fr); }
    .settle-pending-row { gap: 10px; }
    .settle-pending-actions { width: 100%; }
    .settle-pending-actions .btn { flex: 1 1 auto; }
}

.shipping-panel-note .lucide { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; color: var(--ad-gold-dark); }
.shipping-panel-note strong { color: var(--ad-ink); }

.upload-field .form-help { margin-top: 6px; }

.delivery-region-settings { padding: 14px 0; border-top: 1px solid var(--ad-line); }
.delivery-region-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.delivery-city-list:not([hidden]) { display: grid; gap: 8px; margin-top: 12px; }
.delivery-city-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .4fr) auto; align-items: center; gap: 8px; }
.delivery-city-fee-wrap { display: flex; align-items: center; gap: 6px; }
.delivery-city-fee-wrap > span { color: var(--ad-muted); font-size: .85rem; }
.delivery-city-fee-wrap .form-control { min-width: 0; }
@media (max-width: 620px) {
    .delivery-region-heading { align-items: flex-start; flex-direction: column; }
    .delivery-city-row { grid-template-columns: minmax(0, 1fr) minmax(105px, .6fr); }
    .delivery-city-row .remove-delivery-city { grid-column: 2; justify-self: end; }
}