/* =====================================================================
   GENZLO - shared foundation
   Reset, design tokens, typography and genuinely reusable components.
   Page-specific styling lives in its own file under assets/css/.
   ===================================================================== */

:root {
    --c-bg: #f4f5f7;
    --c-bg-alt: #eef0f3;
    --c-surface: #ffffff;
    --c-surface-2: #fafbfc;
    --c-text: #2a272c;
    --c-text-2: #57525a;
    --c-muted: #8a848d;
    --c-border: #e7e4e8;
    --c-border-2: #d6d2d6;

    --c-brand: #f44152;
    --c-brand-dark: #d92a3f;
    --c-brand-soft: #fdf0f1;
    --c-brand-grad: linear-gradient(135deg, #fd694d 0%, #f44152 100%);

    --c-dark: #2a272c;
    --c-dark-2: #38343b;
    --c-dark-3: #4a454d;

    --c-success: #12805c;
    --c-success-soft: #e7f7f0;
    --c-warning: #b54708;
    --c-warning-soft: #fff5e6;
    --c-danger: #c03221;
    --c-danger-soft: #fdecea;
    --c-info: #0b6bcb;
    --c-info-soft: #e8f2fd;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-pill: 999px;

    --sh-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
    --sh-md: 0 2px 6px rgba(16, 24, 40, .07), 0 8px 20px -8px rgba(16, 24, 40, .12);
    --sh-lg: 0 8px 28px -8px rgba(16, 24, 40, .22);

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;

    --header-h: 62px;
    --container: 1280px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, h5 { margin: 0 0 .4em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--sp-5) 0; }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 16px;
}
.container-narrow { max-width: 860px; }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.row > .col { flex: 1 1 220px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.items-center { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.text-muted { color: var(--c-muted); }
.text-2 { color: var(--c-text-2); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: .8125rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.05rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

/* ---------- Page head / sections ---------- */
.page-wrap { padding: 20px 0 44px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 1.15rem; }
.section-head .link { color: var(--c-brand); font-weight: 600; font-size: .8125rem; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title h1 { margin: 0; font-size: 1.3rem; }

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
}
.card-head {
    padding: 13px 16px;
    border-bottom: 1px solid var(--c-border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    font-weight: 700; font-size: .9rem;
}
.card-body { padding: 16px; }
.card-body.tight { padding: 12px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--c-border); background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: var(--r-md);
    border: 1px solid transparent; background: var(--c-surface);
    color: var(--c-text); font-size: .85rem; font-weight: 600;
    cursor: pointer; white-space: nowrap; transition: .15s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--c-brand-grad); color: #fff; box-shadow: 0 3px 10px -3px rgba(244, 65, 82, .5); }
.btn-primary:hover { box-shadow: 0 6px 16px -4px rgba(244, 65, 82, .58); }
.btn-dark { background: var(--c-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--c-border-2); color: var(--c-text); }
.btn-outline:hover { border-color: var(--c-brand); color: var(--c-brand); background: var(--c-brand-soft); }
.btn-ghost { background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-bg-alt); color: var(--c-text); }
.btn-success { background: var(--c-success); color: #fff; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-warning { background: var(--c-warning); color: #fff; }
.btn-info { background: var(--c-info); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .78rem; border-radius: var(--r-sm); }
.btn-xs { padding: 4px 9px; font-size: .72rem; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 22px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-full { grid-column: 1 / -1; }
label { font-size: .8rem; font-weight: 600; color: var(--c-text-2); }
label .req { color: var(--c-danger); }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=search], input[type=url], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--c-border-2); border-radius: var(--r-md);
    background: var(--c-surface); font-size: .85rem; transition: .15s;
}
input:focus, select:focus, textarea:focus, .input:focus {
    outline: none; border-color: var(--c-brand);
    box-shadow: 0 0 0 3px rgba(244, 65, 82, .13);
}
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.hint { font-size: .74rem; color: var(--c-muted); }
.field-error { font-size: .76rem; color: var(--c-danger); }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; font-weight: 500; color: var(--c-text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--c-brand); flex: none; }

.input-group { display: flex; }
.input-group input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .btn { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--c-border); background: var(--c-surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .83rem; }
table.table th {
    text-align: left; padding: 11px 13px; background: var(--c-surface-2);
    color: var(--c-text-2); font-weight: 700; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
}
table.table td { padding: 11px 13px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #fcfcfd; }
table.table td.actions { white-space: nowrap; text-align: right; }
table.table td.actions .btn-group { flex-wrap: nowrap; justify-content: flex-end; }
.table-thumb { width: 42px; height: 42px; border-radius: var(--r-sm); object-fit: cover; background: var(--c-bg-alt); }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: var(--r-pill);
    font-size: .71rem; font-weight: 700; letter-spacing: .01em;
    background: var(--c-bg-alt); color: var(--c-text-2); white-space: nowrap;
}
.badge.success { background: var(--c-success-soft); color: var(--c-success); }
.badge.warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge.danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge.info { background: var(--c-info-soft); color: var(--c-info); }
.badge.brand { background: var(--c-brand-soft); color: var(--c-brand-dark); }
.badge.dark { background: var(--c-dark); color: #fff; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
    border: 1px solid var(--c-border-2); border-radius: var(--r-pill);
    font-size: .78rem; background: var(--c-surface); color: var(--c-text-2);
}
.chip:hover { border-color: var(--c-brand); color: var(--c-brand); }
.chip.active { background: var(--c-brand-soft); border-color: var(--c-brand); color: var(--c-brand-dark); font-weight: 600; }

/* ---------- Alerts / flash ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 11px 14px; border-radius: var(--r-md);
    font-size: .84rem; border: 1px solid transparent; font-weight: 500;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-success { background: var(--c-success-soft); color: var(--c-success); border-color: #bfe9d8; }
.alert-error { background: var(--c-danger-soft); color: var(--c-danger); border-color: #f6cfc9; }
.alert-warning { background: var(--c-warning-soft); color: var(--c-warning); border-color: #f7e0bd; }
.alert-info { background: var(--c-info-soft); color: var(--c-info); border-color: #c9e1fa; }

/* ---------- Empty / loading states ---------- */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--c-muted);
    background: var(--c-surface); border: 1px dashed var(--c-border-2); border-radius: var(--r-lg);
}
.empty-state svg { width: 38px; height: 38px; margin: 0 auto 10px; opacity: .5; }
.empty-state h3 { color: var(--c-text); font-size: .98rem; margin-bottom: 4px; }
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef0f3 25%, #e4e7ec 37%, #eef0f3 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--c-border-2); border-radius: var(--r-sm);
    background: var(--c-surface); font-size: .82rem; font-weight: 600; color: var(--c-text-2);
}
.pagination a:hover { border-color: var(--c-brand); color: var(--c-brand); }
.pagination .current { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.pagination .dots { border: 0; background: transparent; }

/* ---------- Rating stars ---------- */
.stars { display: inline-flex; gap: 1px; color: #f5a623; font-size: .85rem; letter-spacing: -1px; }
.stars .empty { color: var(--c-border-2); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); overflow-x: auto; }
.tabs a {
    padding: 9px 14px; font-size: .84rem; font-weight: 600; color: var(--c-text-2);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--c-text); }
.tabs a.active { color: var(--c-brand); border-bottom-color: var(--c-brand); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
    display: none; align-items: center; justify-content: center; padding: 18px; z-index: 120;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--c-surface); border-radius: var(--r-lg); width: 100%; max-width: 520px;
    max-height: 90vh; overflow: auto; box-shadow: var(--sh-lg);
}
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--c-border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 8px; background: var(--c-surface-2); }

/* ---------- Public header ---------- */
.topbar { background: var(--c-dark); color: #cbd5e1; font-size: .76rem; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.topbar a { color: #cbd5e1; }
.topbar a:hover { color: #fff; }
.topbar-links { display: flex; gap: 14px; align-items: center; white-space: nowrap; flex-shrink: 0; }

.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 100; }
.header-main { display: flex; align-items: center; gap: 16px; padding: 11px 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; flex: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px; background: var(--c-brand-grad);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; font-weight: 800; box-shadow: 0 3px 10px -3px rgba(244, 65, 82, .55);
}
.brand img { height: 38px; width: auto; display: block; object-fit: contain; }
.brand span em { font-style: normal; color: var(--c-brand); }

.header-search { flex: 1; min-width: 0; position: relative; }
.header-search input { height: 40px; padding-left: 38px; background: var(--c-surface-2); }
.header-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-muted); pointer-events: none; }
.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.header-action {
    display: flex; align-items: center; gap: 8px; padding: 6px 9px;
    border-radius: var(--r-md); color: var(--c-text-2); position: relative;
    border: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.header-action:hover { background: var(--c-brand-soft); color: var(--c-brand-dark); }
.header-action svg { width: 20px; height: 20px; }
.header-action .label { display: flex; flex-direction: column; line-height: 1.15; }
.header-action .label small { font-size: .68rem; color: var(--c-muted); }
.header-action .label strong { font-size: .8rem; }
.count-bubble {
    position: absolute; top: 0; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
    background: var(--c-brand); color: #fff; border-radius: var(--r-pill);
    font-size: .66rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.menu-toggle { display: none; }
.search-toggle { display: none; }   /* mobile-only header search trigger */

.cat-nav { border-top: 1px solid var(--c-border); background: var(--c-surface); }
.cat-nav .container { display: flex; align-items: center; gap: 2px; overflow-x: auto; }
.cat-nav a {
    padding: 9px 12px; font-size: .82rem; font-weight: 600; color: var(--c-text-2);
    white-space: nowrap; border-bottom: 2px solid transparent;
}
.cat-nav a:hover, .cat-nav a.active { color: var(--c-brand); border-bottom-color: var(--c-brand); }
.cat-nav .sell-link { margin-left: auto; color: var(--c-brand); }

/* ---------- Mobile drawer ---------- */
.drawer {
    position: fixed; inset: 0 auto 0 0; width: 280px; max-width: 84vw; background: var(--c-surface);
    transform: translateX(-102%); transition: transform .22s ease; z-index: 140;
    display: flex; flex-direction: column; box-shadow: var(--sh-lg);
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 14px; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; }
.drawer-body { padding: 10px; overflow-y: auto; flex: 1; }
.drawer-body a { display: block; padding: 10px 12px; border-radius: var(--r-md); font-size: .87rem; font-weight: 600; color: var(--c-text-2); }
.drawer-body a:hover { background: var(--c-bg-alt); color: var(--c-text); }
.drawer-body a.drawer-profile {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px;
    background: var(--c-brand-grad); color: #fff; border-radius: var(--r-md);
    box-shadow: 0 4px 12px -4px rgba(244, 65, 82, .6);
}
.drawer-body a.drawer-profile:hover { background: var(--c-brand-grad); color: #fff; filter: brightness(1.04); }
.drawer-profile .avatar { background: rgba(255, 255, 255, .25); color: #fff; }
.drawer-profile .avatar svg { width: 16px; height: 16px; }
.drawer-profile-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.drawer-profile-txt strong { font-size: .86rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-profile-txt small { font-size: .68rem; opacity: .9; text-transform: capitalize; }
.drawer-body .divider { height: 1px; background: var(--c-border); margin: 8px 4px; }
.overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.45); opacity: 0; pointer-events: none;
    transition: opacity .2s; z-index: 130;
}
.overlay.open { opacity: 1; pointer-events: auto; }

/* ---------- Public footer ---------- */
.site-footer { background: var(--c-dark); color: #94a3b8; margin-top: 40px; padding: 34px 0 0; font-size: .84rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 26px; }
.site-footer h4 { color: #fff; font-size: .86rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.site-footer a { color: #94a3b8; }
.site-footer a:hover { color: var(--c-brand); }
.footer-grid a { display: block; padding: 4px 0; }
.footer-brand .brand { color: #fff; margin-bottom: 10px; }
.footer-brand .brand img { height: 42px; }
.footer-contact div { padding: 3px 0; }
.footer-social { display: flex; gap: 8px; margin-top: 12px; }
.footer-social a { width: 32px; height: 32px; border-radius: 9px; background: var(--c-dark-2); display: flex; align-items: center; justify-content: center; padding: 0; }
.footer-social a:hover { background: var(--c-brand); color: #fff; }
.footer-social svg { width: 16px; height: 16px; }
.footer-bottom { margin-top: 28px; border-top: 1px solid var(--c-dark-3); padding: 14px 0; font-size: .78rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.footer-bottom a { display: inline; padding: 0; }
.footer-bottom > span:last-child { white-space: nowrap; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: .79rem; color: var(--c-muted); margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--c-brand); }
.breadcrumb .sep { opacity: .5; }

/* ---------- Dashboard shell (admin + seller share the pattern) ---------- */
.app-shell { display: flex; min-height: 100vh; background: var(--c-bg); }
.app-side {
    width: 244px; flex: none; background: var(--c-dark); color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.app-side .side-brand { padding: 15px 16px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--c-dark-3); }
.app-side .side-brand .brand-mark { width: 30px; height: 30px; font-size: .95rem; }
.app-side .side-brand b { color: #fff; font-size: 1.02rem; }
.app-side .side-brand small { display: block; font-size: .63rem; color: #7c8aa3; text-transform: uppercase; letter-spacing: .09em; }
.side-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.side-group { font-size: .64rem; text-transform: uppercase; letter-spacing: .09em; color: #64748b; padding: 12px 10px 5px; font-weight: 700; }
.side-link {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-md);
    font-size: .83rem; font-weight: 600; color: #cbd5e1; margin-bottom: 1px;
}
.side-link svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.side-link:hover { background: var(--c-dark-2); color: #fff; }
.side-link.active { background: var(--c-brand-grad); color: #fff; box-shadow: 0 3px 10px -4px rgba(244,65,82,.7); }
.side-link .pill { margin-left: auto; background: var(--c-brand); color: #fff; font-size: .66rem; padding: 1px 7px; border-radius: var(--r-pill); }
.side-link.active .pill { background: rgba(255,255,255,.28); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top {
    height: var(--header-h); background: var(--c-surface); border-bottom: 1px solid var(--c-border);
    display: flex; align-items: center; gap: 12px; padding: 0 18px; position: sticky; top: 0; z-index: 60;
}
.app-top h1 { font-size: 1.03rem; margin: 0; }
.app-top .spacer { flex: 1; }
.app-content { padding: 18px; flex: 1; }
.app-top .menu-toggle { display: none; }

/* ---------- Collapsible dashboard sidebar (desktop) ---------- */
.app-side { transition: width .2s ease; }
.side-collapse {
    display: none; margin-left: auto; flex: none;
    width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
    align-items: center; justify-content: center; cursor: pointer;
    background: rgba(255,255,255,.08); color: #cbd5e1;
}
.side-collapse:hover { background: rgba(255,255,255,.2); color: #fff; }
.side-collapse svg { width: 16px; height: 16px; }
@media (min-width: 1025px) {
    .side-collapse { display: inline-flex; }
    .app-shell.side-collapsed .app-side { width: 0; overflow: hidden; border-right: 0; }
    .app-shell.side-collapsed .app-top .menu-toggle { display: inline-flex; }
}

/* ---------- Collapsible side panels (add / edit forms) ---------- */
.panel-grid.main-side > .side-panel.collapsed > .card-body { display: none; }
.side-panel-toggle { margin-left: auto; flex: none; width: 28px; height: 28px; padding: 0; }
.side-panel-toggle svg { width: 15px; height: 15px; transition: transform .18s ease; }
.side-panel.collapsed .side-panel-toggle svg { transform: rotate(-90deg); }
@media (min-width: 1025px) {
    .panel-grid.main-side.side-collapsed { grid-template-columns: minmax(0, 1fr); }
    .panel-grid.main-side.side-collapsed > .side-panel { order: -1; }
}

.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: var(--r-pill); background: var(--c-bg-alt); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--c-brand-grad); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: none;
}
.avatar.lg { width: 54px; height: 54px; font-size: 1.2rem; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--c-surface);
    border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-md);
    padding: 5px; display: none; z-index: 90;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); font-size: .83rem; font-weight: 500; }
.dropdown-menu a:hover { background: var(--c-bg-alt); }
.dropdown-menu .sep { height: 1px; background: var(--c-border); margin: 4px 2px; }
.dropdown-menu svg { width: 15px; height: 15px; opacity: .7; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.stat {
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
    padding: 13px 14px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--sh-sm);
}
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat .stat-label { font-size: .72rem; color: var(--c-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .stat-value { font-size: 1.28rem; font-weight: 800; letter-spacing: -.02em; }
.stat .stat-sub { font-size: .72rem; color: var(--c-muted); }
.stat .stat-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--c-brand-soft); color: var(--c-brand); }
.stat .stat-icon svg { width: 17px; height: 17px; }
.stat .stat-icon.green { background: var(--c-success-soft); color: var(--c-success); }
.stat .stat-icon.blue { background: var(--c-info-soft); color: var(--c-info); }
.stat .stat-icon.amber { background: var(--c-warning-soft); color: var(--c-warning); }
.stat .stat-icon.red { background: var(--c-danger-soft); color: var(--c-danger); }
.stat .stat-icon.dark { background: #e8eaef; color: var(--c-dark); }

/* ---------- Charts (pure CSS bar chart) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar-col .bar {
    width: 100%; max-width: 40px; border-radius: 6px 6px 3px 3px;
    background: var(--c-brand-grad); min-height: 3px; position: relative; transition: .3s;
}
.bar-col .bar:hover { filter: brightness(1.08); }
.bar-col .bar .tip {
    position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%);
    background: var(--c-dark); color: #fff; font-size: .68rem; padding: 2px 7px; border-radius: 5px;
    opacity: 0; transition: .15s; white-space: nowrap; pointer-events: none;
}
.bar-col .bar:hover .tip { opacity: 1; }
.bar-col .bar-label { font-size: .68rem; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--c-text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.progress { height: 7px; background: var(--c-bg-alt); border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--c-brand-grad); border-radius: var(--r-pill); }

/* ---------- Misc ---------- */
.divider-y { height: 1px; background: var(--c-border); margin: 14px 0; }
.scroll-x { overflow-x: auto; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--c-border); font-size: .84rem; }
.list-plain li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 2px solid var(--c-border); }
.timeline li { position: relative; padding: 0 0 16px 14px; font-size: .83rem; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--c-brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--c-border); }
.timeline li:last-child { padding-bottom: 0; }
.sticky-side { position: sticky; top: 84px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: .84rem; }
.kv dt { color: var(--c-muted); font-weight: 600; }
.kv dd { margin: 0; }
.print-only { display: none; }

/* ---------- Dashboard page components (shared by admin & seller) ---------- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 11px 13px; margin-bottom: 14px; box-shadow: var(--sh-sm);
}
.toolbar-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.toolbar-form input, .toolbar-form select { width: auto; min-width: 130px; font-size: .82rem; padding: 8px 10px; }
.toolbar-form input[type=search], .toolbar-form input[type=text] { min-width: 190px; }
.toolbar-form select { padding-right: 30px; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel-grid { display: grid; gap: 14px; }
.panel-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.panel-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.panel-grid.main-side { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }

.card-tight .card-body { padding: 12px; }
.stat-mini { display: flex; flex-direction: column; gap: 1px; }
.stat-mini strong { font-size: 1.05rem; }

.data-list { display: flex; flex-direction: column; }
.data-row {
    display: flex; align-items: center; gap: 11px; padding: 10px 0;
    border-bottom: 1px solid var(--c-border); font-size: .84rem;
}
.data-row:last-child { border-bottom: 0; }
.data-row .grow { flex: 1; min-width: 0; }
.data-row .thumb { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; background: var(--c-bg-alt); flex: none; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.detail-block { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 12px 14px; background: var(--c-surface-2); }
.detail-block h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); margin-bottom: 8px; }

.form-section { padding: 14px 0; border-bottom: 1px solid var(--c-border); }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.form-section > h3 { font-size: .92rem; margin-bottom: 10px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; }

.tabbar { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 5px; }
.tabbar a { padding: 7px 13px; border-radius: var(--r-md); font-size: .82rem; font-weight: 600; color: var(--c-text-2); white-space: nowrap; }
.tabbar a:hover { background: var(--c-bg-alt); }
.tabbar a.active { background: var(--c-brand); color: #fff; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.help-box { background: var(--c-info-soft); border: 1px solid #c9e1fa; color: var(--c-info); border-radius: var(--r-md); padding: 10px 13px; font-size: .8rem; }
.warn-box { background: var(--c-warning-soft); border: 1px solid #f7e0bd; color: var(--c-warning); border-radius: var(--r-md); padding: 10px 13px; font-size: .8rem; }
.danger-box { background: var(--c-danger-soft); border: 1px solid #f6cfc9; color: var(--c-danger); border-radius: var(--r-md); padding: 10px 13px; font-size: .8rem; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; background: var(--c-dark); color: #e2e8f0; padding: 11px 13px; border-radius: var(--r-md); overflow-x: auto; white-space: pre-wrap; }

.img-preview { width: 100%; max-width: 130px; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-bg-alt); }
.img-preview.wide { max-width: 240px; aspect-ratio: 16/6; }

/* ---------- Product grid & cards (shared) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.product-grid.cols-5 { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.product-card {
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
    overflow: hidden; display: flex; flex-direction: column; transition: .18s ease; position: relative;
}
.product-card:hover { border-color: var(--c-brand); box-shadow: var(--sh-md); transform: translateY(-2px); }
.product-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--c-surface-2); overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-media img { transform: scale(1.05); }
.product-flags { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; z-index: 2; }
.flag { font-size: .66rem; font-weight: 800; padding: 3px 7px; border-radius: var(--r-pill); background: var(--c-brand); color: #fff; letter-spacing: .02em; }
.flag.dark { background: var(--c-dark); }
.flag.green { background: var(--c-success); }
.wish-btn {
    position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.94); border: 1px solid var(--c-border); display: flex; align-items: center; justify-content: center;
    color: var(--c-text-2); cursor: pointer;
}
.wish-btn:hover { color: var(--c-brand); }
.wish-btn.active { color: var(--c-brand); background: var(--c-brand-soft); }
.wish-btn.active svg { fill: var(--c-brand); }
.wish-btn svg { width: 15px; height: 15px; }
.product-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-cat { font-size: .64rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.product-name { font-size: .82rem; font-weight: 600; line-height: 1.3; color: var(--c-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.product-name:hover { color: var(--c-brand); }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.product-rate { display: inline-flex; align-items: center; gap: 3px; min-width: 0; overflow: hidden; white-space: nowrap; }
.product-meta .stars { font-size: .78rem; }
.product-meta .text-xs { font-size: .66rem; }
.price-row { display: flex; align-items: center; gap: 6px; margin-top: auto; flex-wrap: nowrap; min-width: 0; }
.price { font-size: 1.02rem; font-weight: 800; color: var(--c-brand); letter-spacing: -.02em; white-space: nowrap; }
.price-old { font-size: .74rem; color: var(--c-muted); text-decoration: line-through; white-space: nowrap; }
.stock-note { font-size: .66rem; font-weight: 700; white-space: nowrap; }
.stock-note.in { color: var(--c-success); }
.stock-note.out { color: var(--c-danger); }
.card-add { margin-left: auto; display: flex; flex: none; }
.add-cart-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 0; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-brand-grad); color: #fff; cursor: pointer;
    box-shadow: 0 3px 10px -3px rgba(244, 65, 82, .55); transition: .15s ease;
}
.add-cart-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -4px rgba(244, 65, 82, .62); }
.add-cart-btn:active { transform: translateY(0); }
.add-cart-btn svg { width: 16px; height: 16px; }
.add-cart-btn[disabled] { opacity: .5; pointer-events: none; box-shadow: none; }

/* ---------- Store cards (shared) ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.store-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; transition: .18s; }
.store-card:hover { border-color: var(--c-brand); box-shadow: var(--sh-md); }
.store-card .store-banner { height: 92px; background: var(--c-brand-grad); background-size: cover; background-position: center; }
.store-card .store-body { padding: 12px 14px; display: flex; gap: 11px; align-items: center; }
.store-logo { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; border: 2px solid #fff; background: var(--c-surface); box-shadow: var(--sh-sm); margin-top: -30px; flex: none; }
.store-logo.ph { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--c-brand); background: var(--c-brand-soft); font-size: 1.1rem; }

/* ---------- Misc helpers ---------- */
.hide-sm { display: inline; }

/* ---------- Hidden scrollbars (side menus + category/tab scrollers) ---------- */
.side-scroll, .cat-nav .container, .tabs, .tabbar, .drawer-body, .settings-nav, .account-nav {
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE / Edge */
}
.side-scroll::-webkit-scrollbar, .cat-nav .container::-webkit-scrollbar,
.tabs::-webkit-scrollbar, .tabbar::-webkit-scrollbar, .drawer-body::-webkit-scrollbar,
.settings-nav::-webkit-scrollbar, .account-nav::-webkit-scrollbar {
    width: 0; height: 0; display: none;   /* Chrome / Safari / Edge */
}

/* ---------- Brand logo in dark shells ---------- */
.app-side .side-brand img { max-height: 32px; width: auto; object-fit: contain; display: block; }

/* ---------- Accessibility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .app-side { position: fixed; z-index: 140; transform: translateX(-102%); transition: transform .22s ease; }
    .app-side.open { transform: translateX(0); }
    .app-top .menu-toggle { display: inline-flex; }
    .panel-grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    /* Mobile header: hamburger left, logo centred, search / wishlist / cart icons on the far right. */
    .header-main { flex-wrap: wrap; row-gap: 8px; }
    .menu-toggle { display: inline-flex; order: 1; }
    .brand { order: 2; flex: 1 1 auto; justify-content: center; }
    .header-actions { order: 3; }
    .search-toggle { display: flex; }
    .profile-slot { display: none; }
    /* Search bar collapses into the header and only opens when the search icon is tapped. */
    .header-search { order: 4; width: 100%; flex-basis: 100%; display: none; }
    .site-header.search-open .header-search { display: block; margin-top: 2px; }
    .header-action .label { display: none; }
    .cat-nav .container { padding-bottom: 2px; }
    .kw { grid-template-columns: 110px 1fr; }
}
@media (max-width: 640px) {
    .container { padding: 0 12px; }
    .hide-sm { display: none; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
    .product-body { padding: 8px 9px 9px; gap: 3px; }
    .product-name { font-size: .78rem; line-height: 1.28; min-height: 2.56em; }
    .product-meta .stars { font-size: .72rem; }
    .product-meta .text-xs { font-size: .62rem; }
    .stock-note { font-size: .62rem; }
    .price { font-size: .96rem; }
    .price-old { font-size: .68rem; }
    .add-cart-btn { width: 31px; height: 31px; }
    .add-cart-btn svg { width: 15px; height: 15px; }
    .footer-grid { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
    .footer-brand { grid-column: 1 / -1; }
    .site-footer { padding-top: 24px; font-size: .74rem; }
    .site-footer h4 { font-size: .72rem; margin-bottom: 7px; letter-spacing: .03em; }
    .footer-grid a { padding: 2px 0; }
    .footer-bottom { margin-top: 18px; font-size: .72rem; }
    .topbar .container { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
    .topbar .container::-webkit-scrollbar { display: none; }
    .app-content { padding: 12px; }
    h1 { font-size: 1.3rem; }
    .form-group.span-2 { grid-column: span 1; }
    .table-wrap { border-radius: var(--r-md); }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ---------- Print ---------- */
@media print {
    .app-side, .app-top, .site-header, .site-footer, .topbar, .no-print, .btn { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .app-content, .page-wrap { padding: 0; }
    .print-only { display: block; }
    .card { box-shadow: none; border-color: #ddd; }
    a[href]::after { content: ''; }
}
