/* ============================================================
   TechShop - storefront design system
   Mobile-first: the base rules target a ~360px phone and every
   enhancement lives in a min-width media query. The document is
   always RTL (dir="rtl" on <html>), which is why the drawer
   transforms below are written against physical X offsets.
   ============================================================ */

/* ===== Design tokens ===== */
:root {
    --color-primary: #223266;
    --color-primary-dark: #18244d;
    --color-primary-soft: #eef1f8;
    --color-accent: #ff5a1f;
    --color-accent-dark: #e64a0f;
    --color-accent-soft: #fff2ec;
    --color-secondary: #16213f;
    --color-bg: #f2f4f7;
    --color-surface: #ffffff;
    --color-tile: #f6f7f9;
    --color-text: #1c1c1e;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-border-strong: #d3d9e3;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #92400e;
    --color-warning-soft: #fef3c7;
    --color-success-soft: #dcfce7;
    --color-error-soft: #fee2e2;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-md: 0 6px 20px rgba(16, 24, 40, .10);
    --shadow-lg: 0 14px 40px rgba(16, 24, 40, .18);

    --header-h: 56px;
    --header-height: 56px;
    --bottom-nav-h: 58px;
    --max-width: 1320px;
    /* The panel is a working surface, not a reading column: on a laptop or a wide desktop
       window it uses the whole screen instead of the storefront's measure. */
    --admin-max-width: 1720px;
    --font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    --tap: 44px;
}

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

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

body {
    margin: 0;
    padding: 0 0 calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.8;
    background: var(--color-bg);
    color: var(--color-text);
}

/* The fixed bottom navigation would otherwise cover the last row of content. */
@media (min-width: 900px) { body { padding-bottom: 0; font-size: 15px; } }

/* Locks the page behind an open drawer. Degrades to "the page still scrolls
   behind the panel" on engines without :has(), which is only cosmetic. */
body:has(.drawer-overlay) { overflow: hidden; }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.5; }

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

.icon { flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; stroke: none; }
.icon.flip { transform: rotate(180deg); }

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

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 12px; }
@media (min-width: 768px) { .container { padding: 0 16px; } }

.section { padding: 18px 0; }
@media (min-width: 900px) { .section { padding: 28px 0; } }

.page-wrapper { display: flex; flex-direction: column; min-height: calc(100vh - var(--bottom-nav-h)); }
.main-content { flex: 1; }
@media (min-width: 900px) { .page-wrapper { min-height: 100vh; } }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px;
    border: none; border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 14px; font-weight: 600;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled { background: #9aa3b8; cursor: not-allowed; }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-accent:hover { background: var(--color-accent-dark); }
.btn-outline { background: var(--color-surface); border: 1px solid var(--color-border-strong); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-lg { min-height: 48px; padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--color-primary); padding: 8px 0; font-weight: 500; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 12px; }
.btn-remove { background: none; border: none; color: var(--color-error); font-size: 13px; padding: 6px 8px; }

/* ===== Header ===== */
.site-header {
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-bar { background: var(--color-secondary); color: #dfe4ef; font-size: 12px; }
.top-bar-inner { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; padding: 6px 12px; }
.tb-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 640px) { .top-bar { display: none; } }

.header-main {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
    padding-top: 8px; padding-bottom: 8px;
}
@media (min-width: 900px) { .header-main { flex-wrap: nowrap; min-height: var(--header-h); } }

.menu-toggle {
    order: 1;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--color-primary-soft); color: var(--color-primary);
    border: none; border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 13px; font-weight: 700;
}
.menu-toggle:hover { background: #e2e8f5; }
@media (min-width: 900px) { .menu-toggle { padding: 8px 14px; } }

.logo {
    order: 2;
    font-size: 21px; font-weight: 800; color: var(--color-secondary);
    white-space: nowrap; margin-inline-end: auto;
}
.logo span { color: var(--color-accent); }
@media (min-width: 900px) { .logo { margin-inline-end: 0; font-size: 23px; } }

.search-box {
    order: 4; flex-basis: 100%; position: relative;
    display: flex; align-items: stretch;
    background: var(--color-tile);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.search-box input {
    flex: 1; min-width: 0;
    border: none; background: transparent;
    padding: 9px 12px;
    border-start-start-radius: var(--radius-sm); border-end-start-radius: var(--radius-sm);
    font-family: inherit; font-size: 13.5px; outline: none;
}
.search-box .search-btn {
    border: none; background: var(--color-primary); color: #fff;
    padding: 0 14px; display: grid; place-items: center;
    border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm);
}
.search-box .search-btn:hover { background: var(--color-accent); }
@media (min-width: 900px) {
    .search-box { order: 3; flex: 1 1 auto; max-width: 620px; margin-inline: 14px; }
    .search-box input { font-size: 14px; }
}

/* Live suggestions. The panel is a child of the box, so it lines up with it on phones
   where the search field takes a whole row of its own. */
.search-suggest {
    position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 96;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
    max-height: min(66vh, 420px); overflow-y: auto;
}
.ss-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); }
.ss-item:hover { background: var(--color-tile); }
.ss-item img { width: 38px; height: 38px; object-fit: contain; background: var(--color-tile); border-radius: var(--radius-sm); flex: none; }
.ss-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ss-price { flex: none; font-size: 12.5px; font-weight: 800; color: var(--color-accent); }
.ss-all {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    border-top: 1px solid var(--color-border); margin-top: 4px; padding: 9px;
    font-size: 12.5px; font-weight: 700; color: var(--color-primary);
}
.ss-all:hover { color: var(--color-accent); }

.header-actions { order: 3; display: flex; align-items: center; gap: 12px; }
@media (min-width: 900px) { .header-actions { margin-inline-start: auto; gap: 22px; } }

.header-icon-link {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--color-text); white-space: nowrap;
    padding: 6px; border-radius: var(--radius-sm);
}
.header-icon-link:hover { color: var(--color-accent); background: var(--color-tile); }
.header-icon-link .label { display: none; font-size: 13px; font-weight: 600; }
@media (min-width: 900px) { .header-icon-link .label { display: inline; } }
.login-link { background: var(--color-primary); color: #fff; padding: 7px 12px; }
.login-link:hover { background: var(--color-primary-dark); color: #fff; }
.logout-form { display: inline-flex; margin: 0; }
.logout-button { background: none; border: none; font-family: inherit; padding: 6px; }
.cart-badge {
    position: absolute; top: -3px; inset-inline-end: -5px;
    background: var(--color-accent); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: var(--radius-pill);
    min-width: 18px; height: 18px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
}
@media (min-width: 900px) { .cart-badge { top: -8px; inset-inline-end: -10px; } }

/* desktop department bar */
.category-nav { background: var(--color-secondary); display: none; }
@media (min-width: 900px) { .category-nav { display: block; } }
.cn-list { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; }
.cn-item { position: relative; flex: none; }
.cn-item > a {
    display: flex; align-items: center; gap: 6px;
    padding: 11px 13px; color: #d9deea; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.cn-item > a:hover, .cn-item:focus-within > a { color: #fff; background: rgba(255, 255, 255, .08); }
.cn-mega {
    display: none; position: absolute; top: 100%; inset-inline-start: 0; z-index: 95;
    min-width: 240px; background: var(--color-surface);
    border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-md); padding: 10px;
}
.cn-item:hover .cn-mega, .cn-item:focus-within .cn-mega { display: block; }
.cn-mega a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.cn-mega a:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.cn-mega h4 { margin: 6px 10px; font-size: 11px; color: var(--color-text-muted); font-weight: 600; }

/* mobile department chips */
.category-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 10px; scrollbar-width: none; }
.category-chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .category-chips { display: none; } }
.chip {
    flex: 0 0 auto; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-pill); padding: 5px 13px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip:hover, .chip:active { border-color: var(--color-primary); color: var(--color-primary); }
.chip-accent { background: var(--color-accent-soft); border-color: #ffd0b8; color: var(--color-accent-dark); }

/* ===== Drawer + overlay ===== */
.drawer-overlay {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(15, 23, 42, .48);
    animation: fade-in .18s ease;
    border: none; padding: 0;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.dept-drawer {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 130;
    width: min(87vw, 330px);
    background: var(--color-surface); box-shadow: var(--shadow-lg);
    transform: translateX(100%); /* RTL: the panel is anchored to the right edge */
    transition: transform .24s ease;
    display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
}
.dept-drawer.open { transform: none; }
/* The panel is only in the DOM while it is open, so the entrance is an animation
   rather than the transition above - which would need a class flip to fire. */
.dept-drawer { animation: drawer-in .22s ease; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--color-secondary); color: #fff; padding: 12px 16px;
    position: sticky; top: 0; z-index: 1;
}
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.drawer-close { background: rgba(255, 255, 255, .12); border: none; color: #fff; border-radius: var(--radius-sm); padding: 6px; display: grid; place-items: center; }
.drawer-close:hover { background: rgba(255, 255, 255, .26); }
.drawer-body { padding: 8px; }
.drawer-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.drawer-link:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.drawer-sep { height: 1px; background: var(--color-border); margin: 8px 4px; }
.drawer-row { display: flex; align-items: center; border-radius: var(--radius-sm); }
.drawer-row:hover { background: var(--color-tile); }
.drawer-row > a { flex: 1; padding: 11px 12px; font-size: 13.5px; font-weight: 600; }
.expander { background: none; border: none; color: var(--color-text-muted); padding: 8px; display: grid; place-items: center; }
.expander:hover { color: var(--color-primary); }
.drawer-sub { padding-inline-start: 14px; margin-bottom: 6px; }
.drawer-sub a {
    display: block; padding: 8px 12px; font-size: 13px; color: var(--color-text-muted);
    border-inline-start: 2px solid var(--color-border);
}
.drawer-sub a:hover { color: var(--color-accent); border-inline-start-color: var(--color-accent); }
.drawer-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--color-border); font-size: 12px; color: var(--color-text-muted); }

/* ===== Mobile bottom navigation ===== */
.mobile-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 100;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--color-surface); border-top: 1px solid var(--color-border);
}
@media (min-width: 900px) { .mobile-nav { display: none; } }
.mn-item {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 10.5px; font-weight: 600; color: var(--color-text-muted);
    background: none; border: none; padding: 4px 0;
}
.mn-item.active { color: var(--color-accent); }
.mn-item .cart-badge { top: 2px; inset-inline-end: auto; inset-inline-start: 50%; margin-inline-start: 8px; }

/* ===== Home: promo slider ===== */
/* The hero is a true full-bleed band: it spans the whole viewport width with no gutters, so a
   background photo reaches from edge to edge. Only the vertical rhythm is kept here. */
.hero-band { padding: 10px 0 2px; }
.promo-slider { position: relative; }
.promo-track {
    display: flex; gap: 0; overflow-x: auto;
    scroll-snap-type: x mandatory; scroll-behavior: smooth;
    padding: 0; scrollbar-width: none;
}
.promo-track::-webkit-scrollbar { display: none; }
.promo-slide {
    position: relative; flex: 0 0 100%; scroll-snap-align: center;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 210px; padding: 20px 16px;
    color: #fff; overflow: hidden;
    background-image: linear-gradient(115deg, var(--g1, #16213f), var(--g2, #2c4270));
}
.promo-slide::after {
    content: ""; position: absolute; inset-inline-start: -46px; inset-block-start: -66px;
    width: 190px; height: 190px; border-radius: 50%; background: rgba(255, 255, 255, .09);
}
.ps-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ps-kicker { font-size: 12px; font-weight: 700; color: #ffd9c7; }
.ps-title {
    font-size: 17px; font-weight: 800; max-width: 26ch;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ps-price { display: flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 800; }
.ps-old { font-size: 12px; font-weight: 500; text-decoration: line-through; opacity: .72; }
.ps-cta { margin-top: 6px; align-self: flex-start; background: #fff; color: var(--color-secondary); border-radius: var(--radius-pill); padding: 6px 16px; font-size: 12.5px; font-weight: 700; }
.ps-figure { position: relative; z-index: 1; width: 124px; height: 104px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .16); border-radius: var(--radius); }
.ps-figure img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 900px) {
    .hero-band { padding: 14px 0 4px; }
    .promo-slide { min-height: 420px; padding: 34px 44px; }
    .ps-title { font-size: 30px; max-width: 24ch; }
    .ps-sub { font-size: 15px; }
    .ps-kicker { font-size: 13px; }
    .ps-price { font-size: 22px; }
    .ps-cta { font-size: 14px; padding: 9px 22px; margin-top: 12px; }
    .ps-figure { width: 270px; height: 220px; background: none; border-radius: 0; }
}
@media (min-width: 1400px) {
    .promo-slide { min-height: 480px; padding: 44px 64px; }
    .ps-title { font-size: 38px; }
    .ps-figure { width: 360px; height: 300px; }
}

/* ---- Managed home content (banners, rails, tiles) ---- */
.ps-sub { font-size: 13px; opacity: .88; margin: 0; }

/* ---- Managed banner rows ----
   The owner picks how many banners share a row; below 560px every row stacks to one banner per
   line, because two 250px cards on a phone are unreadable. */
.banner-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .banner-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 620px) {
    .banner-row.cols-3, .banner-row.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) { .banner-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .banner-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.banner-card {
    position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px;
    min-height: 128px; padding: 14px 16px; border-radius: var(--radius-lg); overflow: hidden;
    background-image: linear-gradient(120deg, var(--g1, #16213f), var(--g2, #4b6cb7));
    color: #fff; transition: transform .18s ease, box-shadow .18s ease;
}
.banner-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bc-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bc-text h2 { margin: 0; font-size: 16px; font-weight: 800; }
.bc-text p { margin: 0; font-size: 12.5px; opacity: .88; }
.bc-price { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 800; opacity: 1; }
.bc-figure { position: relative; z-index: 1; flex: none; width: 112px; height: 86px; display: grid; place-items: center; }
.bc-figure img { width: 100%; height: 100%; border-radius: var(--radius); }
.banner-row.cols-1 .banner-card { min-height: 150px; }
@media (min-width: 980px) {
    .banner-row.cols-1 .banner-card { min-height: 200px; padding: 24px 30px; }
    .banner-row.cols-1 .banner-card .bc-text h2 { font-size: 22px; }
    .banner-row.cols-1 .bc-figure { width: 230px; height: 152px; }
}

/* Three or four banners standing next to each other leave no room for the wide side-by-side
   card, so the picture moves on top of the text and the type tightens up. */
@media (min-width: 980px) {
    .banner-row.cols-3 .banner-card, .banner-row.cols-4 .banner-card {
        flex-direction: column; align-items: stretch; gap: 10px; min-height: 196px; padding: 16px 18px;
    }
    .banner-row.cols-3 .bc-figure, .banner-row.cols-4 .bc-figure { width: 100%; height: 118px; order: -1; }
    .banner-row.cols-3 .bc-text h2, .banner-row.cols-4 .bc-text h2 { font-size: 15.5px; }
    .banner-row.cols-3 .bc-text p, .banner-row.cols-4 .bc-text p { font-size: 12px; }
}

/* ---- How the picture sits in a banner (slider and rows share these) ----
   is-overlay: the image fills the whole banner and the text is written over it.
   is-contain: the whole image is shown and the accent colour fills what is left over. */
.is-overlay { justify-content: flex-start; }
.is-overlay .ps-figure, .is-overlay .bc-figure {
    position: absolute; inset: 0; z-index: 0; width: auto; height: auto;
    background: none; border-radius: 0;
}
.is-overlay .ps-figure img, .is-overlay .bc-figure img { width: 100%; height: 100%; border-radius: 0; }
.is-overlay::before {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: rgba(9, 13, 26, .52);
}
.is-overlay .ps-body, .is-overlay .bc-text { z-index: 2; }
.is-overlay .ps-title, .is-overlay .bc-text h2 { text-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.is-cover .ps-figure img, .is-cover .bc-figure img { object-fit: cover; }
.is-contain .ps-figure img, .is-contain .bc-figure img { object-fit: contain; }
.is-contain .ps-figure, .is-contain .bc-figure { background: rgba(255, 255, 255, .18); }

.bw-badge { align-self: flex-start; background: rgba(255, 255, 255, .18); border-radius: var(--radius-pill); padding: 2px 10px; font-size: 11.5px; font-weight: 700; }
.bh-cta { align-self: flex-start; margin-top: 6px; font-size: 12px; font-weight: 700; background: #fff; color: var(--color-secondary); border-radius: var(--radius-pill); padding: 4px 12px; }
.sh-icon { display: inline-flex; vertical-align: -4px; margin-inline-end: 6px; color: var(--color-accent); }
.sh-deadline { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 10px; font-size: 12px; font-weight: 700; color: var(--color-error); }
.empty-block { text-align: center; padding: 28px 16px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface); }
.empty-block h2 { margin: 0 0 6px; font-size: 17px; }
.empty-block p { margin: 0 0 14px; color: var(--color-text-muted); font-size: 13px; }
.promo-arrow {
    display: none; position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 38px; height: 38px; border-radius: 50%; place-items: center;
    background: var(--color-surface); border: 1px solid var(--color-border);
    color: var(--color-text); box-shadow: var(--shadow-sm);
}
.promo-arrow:hover { color: var(--color-accent); border-color: currentColor; }
.promo-arrow.prev { inset-inline-start: 2px; }
.promo-arrow.next { inset-inline-end: 2px; }
@media (min-width: 900px) { .promo-arrow { display: grid; } }
.promo-dots { display: flex; justify-content: center; gap: 6px; padding-bottom: 8px; }
.promo-dots button { width: 8px; height: 8px; padding: 0; border: none; border-radius: var(--radius-pill); background: #cbd2dd; transition: width .15s ease, background .15s ease; }
.promo-dots button.active { width: 22px; background: var(--color-accent); }

/* ===== Home: circular shortcuts ===== */
.shortcut-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.shortcut-row::-webkit-scrollbar { display: none; }
.shortcut { flex: 0 0 auto; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-align: center; }
.sc-icon {
    width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
    background: var(--color-surface); border: 1px solid var(--color-border);
    color: var(--color-primary); box-shadow: var(--shadow-sm);
    transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.shortcut:hover .sc-icon { transform: translateY(-3px); background: var(--color-accent); border-color: var(--color-accent); color: #fff; }

/* ===== Home: section header ===== */
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-header h2 { font-size: 17px; margin: 0; font-weight: 800; }
.section-header .sh-sub { font-size: 12px; color: var(--color-text-muted); font-weight: 400; margin-inline-start: 8px; }
@media (min-width: 900px) { .section-header h2 { font-size: 20px; } }
.more-link { display: inline-flex; align-items: center; gap: 4px; color: var(--color-primary); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.more-link:hover { color: var(--color-accent); }

/* ===== Home: category tiles ===== */
.category-grid-section { padding-top: 6px; padding-bottom: 4px; }
.category-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; }
@media (min-width: 768px) { .category-icon-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 14px; } }
.category-icon-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--color-surface); border: 1px solid transparent;
    border-radius: var(--radius); padding: 14px 6px; text-align: center;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.category-icon-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-border); }
.ct-icon {
    width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
    display: grid; place-items: center;
    background: var(--color-primary-soft); color: var(--color-primary);
}
@media (min-width: 768px) { .ct-icon { width: 62px; height: 62px; } }
.ct-icon img { width: 100%; height: 100%; object-fit: contain; }
.category-icon-tile span { font-size: 11.5px; font-weight: 700; }
@media (min-width: 768px) { .category-icon-tile span { font-size: 13px; } }

/* ===== Home: trust strip & brand rail ===== */
.feature-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 900px) { .feature-strip { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.feature-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 12px; font-size: 12.5px; font-weight: 600;
}
.fi-icon { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--color-accent-soft); color: var(--color-accent); }
.feature-item small { display: block; font-size: 11px; font-weight: 400; color: var(--color-text-muted); }

.brand-rail { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.brand-rail::-webkit-scrollbar { display: none; }
.brand-tile {
    flex: 0 0 auto; min-width: 104px; text-align: center;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 12px 16px; font-weight: 800; color: var(--color-primary);
}
.brand-tile:hover { border-color: var(--color-accent); color: var(--color-accent); }
.brand-tile img { display: block; height: 34px; max-width: 96px; margin: 0 auto 7px; object-fit: contain; }
.brand-tile small { display: block; font-size: 11px; font-weight: 500; color: var(--color-text-muted); }

/* ===== Product grid, rail and card ===== */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 900px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* Home rows scroll sideways on phones and flatten into one line of five on wide
   screens; everything past the fifth stays reachable through "مشاهده همه". */
.rail {
    display: grid; grid-auto-flow: column; grid-auto-columns: clamp(148px, 45vw, 210px);
    gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scroll-padding-inline-start: 8px;
    margin: 0 -12px; padding: 2px 12px 10px;
}
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-pill); }
@media (min-width: 1100px) {
    .rail { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; margin: 0; padding: 0; }
    .rail > *:nth-child(n + 6) { display: none; }
}

.product-card {
    position: relative; display: flex; flex-direction: column; height: 100%;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 10px;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.product-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-border-strong); transform: translateY(-2px); }
/* Stretched link: the whole card is a click target, while the buttons that sit
   above the overlay keep working - and no control is nested inside an anchor. */
.pc-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.pc-cover:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.product-card > .btn-add-to-cart { position: relative; z-index: 3; }

.discount-badge {
    position: absolute; top: 8px; inset-inline-start: 8px; z-index: 3;
    background: var(--color-accent); color: #fff;
    font-size: 11px; font-weight: 800; border-radius: var(--radius-pill);
    padding: 2px 7px; white-space: nowrap;
    pointer-events: none; /* it sits over the stretched link, so it must not swallow taps */
}
.wishlist-toggle {
    position: absolute; top: 6px; inset-inline-end: 6px; z-index: 3;
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .92); border: 1px solid var(--color-border);
    color: #98a2b3; transition: color .15s ease, border-color .15s ease;
}
.wishlist-toggle:hover { color: var(--color-error); border-color: currentColor; }
.wishlist-toggle.active { color: var(--color-error); border-color: currentColor; }
.wishlist-toggle.active .icon { fill: currentColor; }

.product-image {
    aspect-ratio: 1 / 1; margin-bottom: 8px; overflow: hidden;
    display: grid; place-items: center;
    background: var(--color-tile); border-radius: var(--radius-sm);
}
.product-image img { width: 100%; height: 100%; object-fit: contain; }
.product-info { display: flex; flex-direction: column; flex: 1; gap: 2px; min-width: 0; }
.product-name {
    font-size: 12.5px; font-weight: 700; margin: 0; line-height: 1.6; min-height: 2.6em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 768px) { .product-name { font-size: 13.5px; } }
.product-brand { font-size: 11px; color: var(--color-text-muted); }
.product-rating { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--color-text-muted); margin: 3px 0; }
.stars { display: inline-flex; align-items: center; gap: 3px; color: #f59e0b; font-weight: 700; }
.product-price { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.old-price { font-size: 11.5px; color: var(--color-text-muted); text-decoration: line-through; }
.final-price { font-size: 15px; font-weight: 800; color: var(--color-accent); }
@media (min-width: 768px) { .final-price { font-size: 16px; } }
.stock-hint { font-size: 11px; font-weight: 700; color: var(--color-error); }
.stock-ok { font-size: 11px; color: var(--color-success); }

.btn-add-to-cart {
    margin-top: 8px; width: 100%; min-height: 36px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--color-secondary); color: #fff;
    border: none; border-radius: var(--radius-sm); padding: 7px;
    font-size: 12.5px; font-weight: 700;
}
.btn-add-to-cart:hover { background: var(--color-accent); }
.btn-add-to-cart:disabled { background: #c7cad1; cursor: not-allowed; }

.skeleton-grid .skeleton-card {
    background: linear-gradient(90deg, #eceff1 25%, #f5f6f8 37%, #eceff1 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius); aspect-ratio: 3 / 4;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty-state { text-align: center; color: var(--color-text-muted); padding: 28px 0; }

/* ===== Product list page ===== */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { color: var(--color-border-strong); }

.product-list-layout { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 900px) { .product-list-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 22px; } }

.page-head { margin-bottom: 12px; }
.page-head h1 { font-size: 19px; margin: 0; font-weight: 800; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--color-text-muted); }
@media (min-width: 900px) { .page-head h1 { font-size: 24px; } }

.list-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 6px 10px; margin-bottom: 12px;
}
.list-toolbar .result-count { font-size: 12.5px; color: var(--color-text-muted); }
.toolbar-sort { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--color-text-muted); }
.filters-toggle { display: inline-flex; }
@media (min-width: 900px) { .filters-toggle { display: none; } }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--color-primary-soft); color: var(--color-primary);
    border: none; border-radius: var(--radius-pill); padding: 4px 10px;
    font-size: 12px; font-weight: 700;
}
.filter-chip:hover { background: #dfe6f5; }

.filters-sidebar {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 14px;
}
.filters-sidebar h3 { font-size: 13.5px; margin: 0 0 8px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.filters-head h2 { font-size: 15px; margin: 0; }
.filters-close { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--color-text-muted); font-size: 12.5px; }
@media (min-width: 900px) { .filters-close { display: none; } .filters-head h2 { display: none; } }
@media (min-width: 900px) { .filters-sidebar { position: sticky; top: calc(var(--header-h) + 24px); } }

/* On phones the same panel becomes a drawer that slides in from the inline-end
   edge; the sticky desktop rule is overridden by position: fixed. */
@media (max-width: 899px) {
    .filters-sidebar {
        display: none;
        position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 130;
        width: min(88vw, 330px); border: none; border-radius: 0;
        overflow-y: auto; overscroll-behavior: contain;
        transform: translateX(-100%); transition: transform .24s ease;
        box-shadow: var(--shadow-lg);
    }
    .filters-sidebar.open { display: block; transform: none; animation: filters-in .22s ease; }
}

@keyframes filters-in { from { transform: translateX(-100%); } to { transform: none; } }

/* The backdrop belongs to the phone drawer only; on a desktop the panel is permanent. */
@media (min-width: 900px) { .filters-overlay { display: none; } }

.category-filter-list li a { display: block; padding: 7px 0; font-size: 13px; color: var(--color-text-muted); }
.category-filter-list li a.active, .category-filter-list li a:hover { color: var(--color-primary); font-weight: 700; }
.sort-select { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-family: inherit; font-size: 13px; background: var(--color-surface); }
.toolbar-sort .sort-select { width: auto; min-width: 130px; }
.toolbar-sort .sort-select-narrow { min-width: 112px; }
.price-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-checkbox { margin: 12px 0; }
.spec-filter-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.spec-filter-list .checkbox-label { font-size: 13px; margin: 0; padding: 5px 0; }
.filters-sidebar .btn-block { margin-top: 10px; }
/* Every other control applies instantly, so the confirm button only exists to close
   the phone drawer and reveal the results. */
@media (min-width: 900px) { .filters-apply { display: none; } }

.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.pagination button {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 600;
}
.pagination button:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination span { font-size: 13px; color: var(--color-text-muted); }

/* Numbered pagination keeps the same 40px square on a thumb, which plain 8x16 padding never did. */
.pagination-numbered { gap: 6px; }
.pagination-numbered button {
    min-width: 40px; min-height: 40px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
}
.pagination-numbered .page-number.active {
    background: var(--color-primary); border-color: var(--color-primary); color: #fff;
}
.page-gap { color: var(--color-text-muted); padding: 0 2px; }

/* ===== Product detail ===== */
.product-detail { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 900px) { .product-detail { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 32px; } }

.product-gallery .main-image {
    width: 100%; aspect-ratio: 1 / 1; object-fit: contain;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 16px;
}
@media (min-width: 900px) {
    .product-gallery { position: sticky; top: calc(var(--header-h) + 24px); }
    .product-gallery .main-image { padding: 24px; }
}
.thumbnail-row { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumbnail-row img {
    width: 60px; height: 60px; object-fit: contain; flex: none;
    background: var(--color-surface); border-radius: var(--radius-sm);
    border: 2px solid var(--color-border); padding: 3px; cursor: pointer;
}
.thumbnail-row img.active { border-color: var(--color-primary); }

.product-detail-info h1 { font-size: 18px; margin: 0 0 6px; font-weight: 800; }
@media (min-width: 900px) { .product-detail-info h1 { font-size: 22px; } }
.short-description { color: var(--color-text-muted); font-size: 13.5px; }
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--color-text-muted); margin-bottom: 10px; }

.buy-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 14px; margin: 14px 0;
    display: flex; flex-direction: column; gap: 12px;
}
.price-box { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.price-box .final-price { font-size: 21px; }
@media (min-width: 900px) { .price-box .final-price { font-size: 24px; } }
.price-box .discount-badge, .ps-price .discount-badge { position: static; padding: 3px 9px; }
.purchase-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.purchase-box .btn { flex: 1; min-width: 180px; }
.quantity-selector { display: flex; align-items: center; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.quantity-selector button { background: var(--color-bg); border: none; width: 38px; height: 38px; font-size: 17px; color: var(--color-primary); }
.quantity-selector button:hover { background: var(--color-primary-soft); }
.quantity-selector span { width: 42px; text-align: center; font-weight: 700; }

/* On a phone the +-keys are the most-pressed controls in the cart, so they get real
   tap targets and the small/danger buttons grow with them. */
@media (max-width: 899px) {
    .quantity-selector button { width: var(--tap); height: var(--tap); }
    .quantity-selector span { width: 40px; }
    .btn-remove { min-height: var(--tap); padding: 8px 12px; }
    .btn-sm { min-height: 40px; }
}
.buy-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-wishlist { display: inline-flex; }
.out-of-stock { color: var(--color-error); font-weight: 700; margin: 0; }
.success-message { color: var(--color-success); font-size: 13px; margin: 0; }
.delivery-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--color-text-muted); border-top: 1px dashed var(--color-border); padding-top: 10px; }

.spec-table table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.spec-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.spec-table td:first-child { color: var(--color-text-muted); width: 38%; background: var(--color-tile); }
.product-description { margin-top: 20px; }
.product-description p { font-size: 13.5px; color: #374151; }

/* ===== Cart ===== */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .cart-layout, .checkout-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; } }
.cart-items { display: flex; flex-direction: column; gap: 10px; }
.cart-item {
    display: grid; gap: 8px 12px; align-items: center;
    grid-template-columns: 60px minmax(0, 1fr) auto;
    grid-template-areas:
        "img info  total"
        "img price qty"
        "act   act   act";
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 10px;
}
.cart-item img { grid-area: img; width: 60px; height: 60px; object-fit: contain; background: var(--color-tile); border-radius: var(--radius-sm); }
.cart-item-info { grid-area: info; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.cart-item-info a { font-weight: 700; }
.unit-price { grid-area: price; color: var(--color-text-muted); font-size: 12px; }
.line-total { grid-area: total; font-weight: 800; white-space: nowrap; }
.cart-item .quantity-selector { grid-area: qty; justify-self: end; }
.cart-item .btn-remove { grid-area: act; justify-self: end; }
@media (min-width: 640px) {
    .cart-item { grid-template-columns: 72px minmax(0, 1fr) auto auto auto auto; grid-template-areas: "img info price total qty act"; padding: 12px; }
    .cart-item img { width: 72px; height: 72px; }
    .cart-item .quantity-selector { justify-self: center; }
    .cart-item .btn-remove { justify-self: center; }
}

.cart-summary { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; }
@media (min-width: 900px) { .cart-summary { position: sticky; top: calc(var(--header-h) + 24px); padding: 20px; } }
.cart-summary h3 { margin-top: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; margin: 8px 0; }
.summary-row.total { font-weight: 800; font-size: 16px; border-top: 1px dashed var(--color-border); padding-top: 10px; margin-top: 12px; }
.shipping-note { font-size: 12px; color: var(--color-text-muted); }
.empty-cart { text-align: center; padding: 40px 0; }
.empty-cart .icon { margin: 0 auto 10px; color: var(--color-border-strong); }
.wishlist-card { display: flex; flex-direction: column; }
.wishlist-card-actions { position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.wishlist-card-actions .btn { flex: 1; }

/* ===== Checkout ===== */
.stepper { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.step {
    display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
    color: var(--color-text-muted); background: var(--color-tile);
    border-radius: var(--radius-pill); padding: 7px 14px;
}
.step.active { background: var(--color-primary); color: #fff; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; margin: 0 0 12px; }
.block-title .icon { color: var(--color-accent); }
.coupon-error { color: var(--color-error); }
.checkout-main { display: flex; flex-direction: column; gap: 14px; }
.address-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.address-option {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius); padding: 12px; cursor: pointer; font-size: 13px;
}
.address-option.selected { border-color: var(--color-primary); background: var(--color-primary-soft); }
.address-option p { margin: 4px 0 0; color: var(--color-text-muted); }
.coupon-box { display: flex; gap: 8px; margin: 12px 0; }
.coupon-box .form-control { flex: 1; }

/* Segmented choice (کد ملی / کد اتباع): two tappable cards that stay side by side on a phone. */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.choice { flex: 1 1 160px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); font-size: 13.5px; color: var(--color-text); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.choice:hover { border-color: var(--color-primary); }
.choice input { accent-color: var(--color-primary); margin: 0; }
.choice:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-soft); font-weight: 600; }
.choice:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Jalali date picker (three selects) - the native date input is Gregorian and useless here. */
.jalali-date { display: flex; flex-direction: column; gap: 6px; }
.jalali-selects { display: grid; grid-template-columns: 0.8fr 1.1fr 0.7fr; gap: 6px; }
.jalali-selects .form-control { min-width: 0; }
.jalali-empty, .jalali-clear { align-self: flex-start; background: none; border: 1px dashed var(--color-border-strong); border-radius: 8px; color: var(--color-text-muted); font-size: 12.5px; padding: 8px 12px; min-height: 38px; cursor: pointer; }
.jalali-empty:hover, .jalali-clear:hover { border-color: var(--color-primary); color: var(--color-primary); }
.coupon-message { font-size: 12px; color: var(--color-text-muted); margin: 4px 0 0; }
.coupon-applied-row { color: var(--color-success); font-weight: 700; }
.national-id-prompt { background: var(--color-accent-soft); border: 1px solid #fdba74; border-radius: var(--radius); padding: 14px; margin: 14px 0; }
.national-id-prompt h3 { margin: 0 0 6px; font-size: 15px; }
.payment-result { text-align: center; padding: 30px 0; }
.result-icon { width: 76px; height: 76px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; }
.payment-result.success .result-icon { background: #dcfce7; color: var(--color-success); }
.payment-result.failure .result-icon { background: #fee2e2; color: var(--color-error); }
.result-icon .icon { stroke-width: 2.4; }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.result-actions .btn { min-width: 150px; }

/* ===== Auth ===== */
.auth-page { display: flex; justify-content: center; padding: 32px 12px; }
@media (min-width: 900px) { .auth-page { padding: 60px 16px; } }
.auth-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 22px; width: 100%; max-width: 400px;
}
@media (min-width: 900px) { .auth-card { padding: 32px; box-shadow: var(--shadow-md); } }
.auth-card h1 { font-size: 19px; text-align: center; margin: 0 0 8px; }
.auth-brand { width: 54px; height: 54px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: var(--color-primary); color: #fff; }
.auth-subtitle { font-size: 13px; color: var(--color-text-muted); text-align: center; margin-bottom: 20px; }
.otp-timer { font-size: 12px; color: var(--color-text-muted); }
.auth-resend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.auth-expiry-hint { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
/* Development-only OTP preview. Never rendered in production (see IOtpPreview), so the
   styling is intentionally loud but small - it must not look like part of the login flow. */
.dev-otp-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 10px 12px; border: 1px dashed var(--color-warning); border-radius: 10px; background: var(--color-warning-soft); color: var(--color-text); font-size: 12.5px; }
.dev-otp-note code { direction: ltr; font-size: 17px; font-weight: 700; letter-spacing: 3px; padding: 2px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--color-border); }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.form-control {
    width: 100%; padding: 10px 12px; min-height: var(--tap);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; outline: none;
    background: var(--color-surface); color: inherit;
}
.form-control:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(34, 50, 102, .12); }
/* Below 16px iOS zooms into any field it focuses, which leaves the phone layout broken
   for the rest of the session, so the inputs keep 16px on small screens. */
@media (max-width: 899px) {
    .form-control, .search-box input, .sort-select { font-size: 16px; }
}
textarea.form-control { min-height: 92px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 768px) { .form-row { grid-template-columns: repeat(3, 1fr); } }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 14px; }
.checkbox-label input { width: 18px; height: 18px; flex: none; }
/* DataAnnotationsValidator puts the field text into .validation-message and marks the failing
   control with .invalid (Blazor's own class; .input-validation-error is the MVC-era name, kept in
   case a hand-written field still uses it). Both are styled to match the panel. */
.input-validation-error, .invalid { border-color: var(--color-error) !important; background: #fff7f7; }
.input-validation-error:focus, .invalid:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }
.validation-message {
    color: var(--color-error); font-size: 12px; display: flex; align-items: center; gap: 5px;
    margin-top: 5px; font-weight: 600; line-height: 1.6;
}
.validation-message::before { content: "!"; flex: none; width: 15px; height: 15px; border-radius: 50%; background: var(--color-error); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.validation-summary-errors {
    background: var(--color-error-soft); border: 1px solid #fecaca; border-radius: var(--radius-sm);
    padding: 10px 14px; margin: 4px 0 2px; color: var(--color-error);
}
.validation-summary-errors ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.validation-summary-errors li { font-size: 12.5px; font-weight: 600; position: relative; padding-inline-start: 14px; }
.validation-summary-errors li::before { content: "\2022"; position: absolute; inset-inline-start: 0; }
.field-hint { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; }
.form-control:disabled { background: var(--color-tile); color: var(--color-text-muted); cursor: not-allowed; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert a { font-weight: 700; text-decoration: underline; }
.alert-error { background: #fee2e2; color: var(--color-error); border-color: #fecaca; }
.alert-success { background: #dcfce7; color: var(--color-success); border-color: #bbf7d0; }

/* ===== Account section ===== */
.account-page { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .account-page { grid-template-columns: 230px minmax(0, 1fr); gap: 24px; } }
.account-sidebar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px; }
/* On phones the account menu reads better as a sliding tab strip than as a tall list. */
.account-sidebar ul { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.account-sidebar li { flex: 0 0 auto; }
.account-sidebar ul::-webkit-scrollbar { display: none; }
.account-sidebar a { position: relative; white-space: nowrap; }
.account-sidebar a.active { box-shadow: inset 0 0 0 1.5px var(--color-primary); }
@media (min-width: 900px) {
    .account-sidebar { position: sticky; top: calc(var(--header-h) + 24px); }
    .account-sidebar ul { display: block; overflow: visible; }
    .account-sidebar a { white-space: normal; }
}
.account-sidebar a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.account-sidebar a .icon { color: currentColor; opacity: .8; }
.account-sidebar a.active, .account-sidebar a:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.account-content { min-width: 0; }

/* A titled surface used by the account and checkout pages, so every form reads the same. */
.panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.panel-title { font-size: 16px; font-weight: 800; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--color-border); }
@media (min-width: 900px) { .panel { padding: 20px; } }

.order-list { display: flex; flex-direction: column; gap: 14px; }
.order-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; }
.order-card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.order-status { font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; }
.status-processing, .status-shipped { background: #fef3c7; color: var(--color-warning); }
.status-delivered { background: #dcfce7; color: var(--color-success); }
.status-cancelled, .status-refunded { background: #fee2e2; color: var(--color-error); }
.status-pendingpayment { background: #e5e7eb; color: var(--color-text-muted); }
.oc-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.oc-title .icon { color: var(--color-primary); }
.order-card-items { display: flex; flex-direction: column; }
.order-item-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.order-item-row img { width: 42px; height: 42px; object-fit: contain; background: var(--color-tile); border-radius: var(--radius-sm); flex: none; }
.oi-name { flex: 1; min-width: 0; }
.oi-qty { color: var(--color-text-muted); font-size: 12px; flex: none; }
.oi-total { font-weight: 700; flex: none; }
@media (max-width: 480px) {
    .order-item-row { flex-wrap: wrap; }
    .oi-name { flex: 1 1 calc(100% - 52px); }
    .oi-total { margin-inline-start: auto; }
}
.order-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--color-border); }
.oc-date { color: var(--color-text-muted); }
.oc-total { font-weight: 800; }
.tracking-code-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tracking-code-box .icon { color: var(--color-primary); }
.address-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; font-size: 13px; }
.address-card p { margin: 4px 0 0; color: var(--color-text-muted); }
.ac-body { flex: 1; min-width: 0; }
.ac-title { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.ac-title .icon { color: var(--color-accent); }
.ac-postal { font-size: 12.5px; }
.address-card .btn-remove { min-width: var(--tap); min-height: var(--tap); display: grid; place-items: center; }
.address-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.panel .address-form { border: none; background: none; padding: 0; margin: 0; }
.profile-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; }
.panel .profile-form { border: none; background: none; padding: 0; }

/* ===== Footer ===== */
.site-footer { background: var(--color-secondary); color: #cdd3e0; margin-top: 28px; }
.footer-trust { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 18px 12px 0; }
@media (min-width: 768px) { .footer-trust { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.ft-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: #e6eaf2; }
.ft-item .icon { color: var(--color-accent); flex: none; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 24px 12px 28px; }
@media (min-width: 560px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.3fr; gap: 28px; padding: 36px 16px 40px; } }
.footer-col h4 { color: #fff; margin: 0 0 10px; font-size: 15px; }
.footer-col p, .footer-col ul li { font-size: 13px; margin: 0 0 8px; }
.footer-col a:hover { color: #fff; }
.fc-line { display: flex; align-items: center; gap: 7px; }
.fc-line .icon { color: #8fa0be; flex: none; }
.footer-bottom { text-align: center; font-size: 12px; padding: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.not-found { text-align: center; padding: 60px 0; }

/* ===== Invoice ===== */
.invoice-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.invoice-sheet { background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; max-width: 820px; margin: 0 auto; }
@media (min-width: 768px) { .invoice-sheet { padding: 32px; } }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--color-secondary); padding-bottom: 16px; margin-bottom: 20px; }
.invoice-header h1 { margin: 0; font-size: 20px; color: var(--color-secondary); }
.invoice-header p { margin: 4px 0 0; font-size: 12px; color: var(--color-text-muted); }
.invoice-title-block { text-align: end; }
.invoice-title-block h2 { margin: 0 0 6px; font-size: 16px; }
.invoice-title-block p { margin: 2px 0; font-size: 12px; }
.invoice-parties { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
@media (min-width: 640px) { .invoice-parties { grid-template-columns: 1fr 1fr; } }
.invoice-party h3 { font-size: 13px; margin: 0 0 6px; color: var(--color-text-muted); }
.invoice-party p { margin: 3px 0; font-size: 13px; }
.invoice-table-wrap { overflow-x: auto; }
.invoice-items-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; min-width: 480px; }
.invoice-items-table th, .invoice-items-table td { border: 1px solid var(--color-border); padding: 8px 10px; font-size: 13px; text-align: center; }
.invoice-items-table th { background: var(--color-bg); }
.invoice-items-table td:nth-child(2) { text-align: right; }
.invoice-totals { max-width: 340px; margin-inline-start: auto; }
.invoice-totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--color-border); }
.invoice-grand-total { font-weight: 800; font-size: 15px; border-bottom: none; border-top: 2px solid var(--color-secondary); padding-top: 10px; margin-top: 4px; }
.invoice-payment-status { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--color-border); font-size: 13px; }
.invoice-footer-note { text-align: center; font-size: 11px; color: var(--color-text-muted); margin-top: 24px; }

@media print {
    body { padding: 0; background: #fff; }
    .site-header, .site-footer, .mobile-nav, .account-sidebar, .drawer-overlay, .no-print { display: none !important; }
    .container, .invoice-page { padding: 0; margin: 0; max-width: 100%; }
    .invoice-sheet { box-shadow: none; padding: 0; max-width: 100%; }
}

/* ===== Reviews ===== */
.reviews-section h2 { font-size: 18px; margin-bottom: 14px; }
@media (min-width: 900px) { .reviews-section h2 { font-size: 20px; } }
.review-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
@media (min-width: 900px) { .review-form { padding: 20px; max-width: 520px; } }
.star-picker { font-size: 26px; margin: 8px 0; cursor: pointer; display: flex; gap: 4px; }
.star-picker .star { color: #d1d5db; transition: color .1s ease; }
.star-picker .star.filled { color: #f59e0b; }
.review-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 8px; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; }
.review-card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.review-stars { color: #f59e0b; letter-spacing: 1px; }
.review-date { color: var(--color-text-muted); margin-inline-start: auto; font-size: 12px; }
.review-card p { margin: 6px 0; font-size: 13.5px; }

/* ===== Admin panel ===== */
.admin-page-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.excel-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.excel-import-label { position: relative; cursor: pointer; overflow: hidden; }
.excel-import-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.excel-selected-file { font-size: 13px; color: var(--color-text-muted); }
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: right; font-size: 13px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.admin-table th { background: var(--color-bg); font-weight: 700; }
.admin-table td.wrap, .admin-table th.wrap { white-space: normal; min-width: 190px; }
.admin-thumb { width: 40px; height: 40px; object-fit: contain; background: var(--color-tile); border-radius: var(--radius-sm); }
.admin-row-actions { display: flex; gap: 8px; align-items: center; }
.badge { padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-success { background: #dcfce7; color: var(--color-success); }
.badge-muted { background: #e5e7eb; color: var(--color-text-muted); }
.badge-warning { background: #fef3c7; color: var(--color-warning); }
.badge-danger { background: #fee2e2; color: var(--color-error); }
.admin-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); margin-top: 12px; }
.spec-row { grid-template-columns: 1fr; align-items: center; margin-bottom: 8px; gap: 8px; }
@media (min-width: 768px) { .spec-row { grid-template-columns: 1fr 1fr auto; } }
.admin-form-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ===== Admin shell =====
   The panel is its own app: a sticky top bar, a nav rail that folds to icons on a desktop and
   slides in as a drawer under 900px, and a content column that reads the same on a phone held
   in one hand. Nothing here needs a Blazor circuit - the drawer is opened by js/admin.js, which
   toggles these same classes, because the layout itself is statically rendered. */
.admin-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--color-bg); }

.admin-topbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: 8px;
    min-height: 56px; padding: 0 10px;
    background: var(--color-secondary); color: #fff;
    box-shadow: var(--shadow-md);
}
@media (min-width: 900px) { .admin-topbar { gap: 12px; padding: 0 20px; min-height: 62px; } }
.admin-brand { display: flex; align-items: baseline; gap: 7px; font-size: 17px; font-weight: 800; }
.admin-brand span { color: var(--color-accent); }
.admin-brand small { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .62); }
@media (max-width: 480px) { .admin-brand small { display: none; } }
.admin-topbar-spacer { flex: 1; }
.admin-icon-btn {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none;
    border: none; border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .1); color: #fff;
}
.admin-icon-btn:hover { background: rgba(255, 255, 255, .2); }
.admin-topbar-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 600;
}
.admin-topbar-link:hover { background: rgba(255, 255, 255, .2); }
@media (max-width: 900px) { .admin-topbar-link span { display: none; } }

.admin-bell { position: relative; }
.bell-count {
    position: absolute; top: 3px; inset-inline-end: 2px;
    min-width: 17px; height: 17px; padding: 0 4px;
    display: grid; place-items: center;
    border-radius: var(--radius-pill);
    background: var(--color-accent); color: #fff;
    font-size: 10.5px; font-weight: 800; line-height: 1;
}
.bell-panel {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 70;
    width: min(320px, calc(100vw - 24px));
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 12px;
}
.bell-panel h4 { margin: 0 0 8px; font-size: 13px; color: var(--color-text-muted); font-weight: 700; }
.bell-panel li a {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 8px; border-radius: var(--radius-sm); font-size: 13px;
}
.bell-panel li a:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.bell-panel li a span { flex: 1; min-width: 0; }
.bell-panel li a strong { font-weight: 800; color: var(--color-secondary); }
.bell-empty { margin: 0; padding: 6px 0; font-size: 12.5px; color: var(--color-text-muted); line-height: 1.7; }

.admin-body { display: grid; grid-template-columns: 1fr; flex: 1; min-width: 0; }

/* The drawer. The page is RTL, so "off stage" is a push to the right - a translate that is
   not flow-relative, on purpose. */
.admin-nav {
    position: fixed; z-index: 80; top: 0; bottom: 0; inset-inline-start: 0;
    width: min(300px, 86vw); padding: 14px; overflow-y: auto;
    background: var(--color-surface); box-shadow: var(--shadow-lg);
    transform: translateX(100%); visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
}
.admin-nav.open { transform: translateX(0); visibility: visible; }
@media (prefers-reduced-motion: reduce) { .admin-nav { transition: none; } }
.admin-nav-overlay {
    position: fixed; inset: 0; z-index: 75;
    width: 100%; height: 100%; padding: 0; border: none;
    background: rgba(16, 24, 40, .45);
    opacity: 0; visibility: hidden; transition: opacity .22s ease;
}
.admin-nav-overlay.show { opacity: 1; visibility: visible; }
body.admin-nav-open { overflow: hidden; }

.admin-nav-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-nav-heading { font-size: 13px; font-weight: 800; color: var(--color-text-muted); }
.admin-nav-close {
    display: grid; place-items: center; width: 36px; height: 36px; margin-inline-start: auto;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    background: var(--color-surface); color: var(--color-text);
}
.admin-nav-close:hover { border-color: var(--color-error); color: var(--color-error); }

.admin-nav-list { display: flex; flex-direction: column; gap: 4px; }
.admin-nav-list a, .admin-nav-list summary {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600; color: var(--color-text);
}
.admin-nav-list summary { cursor: pointer; list-style: none; user-select: none; }
.admin-nav-list summary::-webkit-details-marker { display: none; }
.admin-nav-list a:hover, .admin-nav-list summary:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.admin-nav-list a.active { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-sm); }
.admin-nav-list .nav-caret { margin-inline-start: auto; color: var(--color-text-muted); transition: transform .18s ease; }
.admin-nav-list details[open] .nav-caret { transform: rotate(180deg); }
.admin-nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; padding-inline-start: 10px; border-inline-start: 2px solid var(--color-border); margin-inline-start: 20px; }
.admin-nav-sub a { padding: 9px 10px; font-size: 13px; font-weight: 500; }

@media (min-width: 900px) {
    .admin-body { grid-template-columns: 244px minmax(0, 1fr); gap: 22px; padding: 22px; max-width: var(--admin-max-width); margin: 0 auto; width: 100%; }
    .admin-nav {
        position: sticky; top: 82px; bottom: auto; align-self: start; z-index: 1;
        width: auto; max-height: calc(100vh - 102px); padding: 4px;
        transform: none; visibility: visible; transition: none;
        background: none; box-shadow: none;
    }
    .admin-nav-head { padding: 0 12px; }
    .admin-nav-close { display: none; }
    .admin-nav-overlay { display: none; }

    /* Folded rail: only the icons stay, and the click that would open a group instead
       unfolds the rail (js/admin.js). The preference is remembered per browser. */
    .admin-shell.rail-collapsed .admin-body { grid-template-columns: 74px minmax(0, 1fr); }
    .admin-shell.rail-collapsed .admin-nav-list a,
    .admin-shell.rail-collapsed .admin-nav-list summary { justify-content: center; gap: 0; padding: 12px 6px; }
    .admin-shell.rail-collapsed .admin-nav-list span,
    .admin-shell.rail-collapsed .admin-nav-list .nav-caret,
    .admin-shell.rail-collapsed .admin-nav-sub,
    .admin-shell.rail-collapsed .admin-nav-heading { display: none; }
}

/* A wide laptop or an external monitor has the room; the panel takes it instead of holding the
   storefront's reading measure, and the rail grows with the page so it never looks orphaned. */
@media (min-width: 1500px) {
    .admin-body { grid-template-columns: 268px minmax(0, 1fr); gap: 28px; padding: 26px 32px; }
    .admin-shell.rail-collapsed .admin-body { grid-template-columns: 84px minmax(0, 1fr); }
}

.admin-main { min-width: 0; padding: 14px 12px 24px; }
@media (min-width: 900px) { .admin-main { padding: 0 0 32px; } }
.admin-page-title { margin: 0 0 4px; font-size: 20px; }
.admin-page-sub { margin: 0 0 18px; font-size: 13px; color: var(--color-text-muted); }
@media (min-width: 900px) { .admin-page-title { font-size: 24px; } }

.admin-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--color-text-muted); }
.admin-crumbs a { font-weight: 600; color: var(--color-primary); }
.admin-crumbs a:hover { text-decoration: underline; }
.admin-crumbs span { font-weight: 700; }
.admin-crumbs .crumb-sep { color: var(--color-border-strong); }

/* ===== Toasts ===== */
.toast-stack {
    position: fixed; z-index: 90; bottom: calc(12px + env(safe-area-inset-bottom));
    inset-inline: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 640px) { .toast-stack { inset-inline: auto; inset-inline-end: 18px; bottom: 18px; width: 360px; } }
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius);
    background: var(--color-surface); border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600;
    animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast-icon { flex: none; margin-top: 2px; }
.toast-text { flex: 1; min-width: 0; line-height: 1.7; }
.toast-close { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border: none; border-radius: var(--radius-sm); background: none; color: var(--color-text-muted); }
.toast-close:hover { background: var(--color-bg); color: var(--color-text); }
.toast-success { border-color: #bbf7d0; background: var(--color-success-soft); color: var(--color-success); }
.toast-error { border-color: #fecaca; background: var(--color-error-soft); color: var(--color-error); }
.toast-info { border-color: #c7d7f5; background: #eef4ff; color: var(--color-primary); }

/* ===== Admin dashboard ===== */
.admin-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 700px) { .admin-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .admin-kpi-grid { grid-template-columns: repeat(6, 1fr); gap: 14px; } }
.kpi-card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm);
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--color-primary-soft); color: var(--color-primary); }
.kpi-label { font-size: 11.5px; color: var(--color-text-muted); line-height: 1.6; }
.kpi-value { font-size: 17px; font-weight: 800; color: var(--color-secondary); }
@media (min-width: 900px) { .kpi-value { font-size: 19px; } }
.kpi-unit { font-size: 11px; font-weight: 600; color: var(--color-text-muted); }
.kpi-accent .kpi-icon { background: var(--color-accent-soft); color: var(--color-accent-dark); }
.kpi-warn { border-color: #fcd34d; }
.kpi-warn .kpi-icon { background: var(--color-warning-soft); color: var(--color-warning); }

.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 16px; } }
.dashboard-panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; }
.dashboard-panel h3 { margin: 0 0 14px; font-size: 15px; }

.chart-wrap { display: flex; flex-direction: column; gap: 6px; }
.area-chart { display: block; width: 100%; height: 170px; }
@media (min-width: 900px) { .area-chart { height: 210px; } }
.chart-grid { stroke: var(--color-border); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hit:hover { fill: rgba(34, 50, 102, .07); }
.chart-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--color-text-muted); }
.chart-axis-mid { font-weight: 700; color: var(--color-primary); }

.donut-wrap { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: center; }
@media (min-width: 560px) { .donut-wrap { grid-template-columns: 168px minmax(0, 1fr); gap: 16px; } }
.donut { width: 168px; height: 168px; margin: 0 auto; }
.donut-track { stroke: var(--color-bg); }
.donut-segment { transition: stroke-width .12s ease; }
.donut-segment:hover { stroke-width: 7.5; }
.donut-total { font-size: 7px; font-weight: 800; fill: var(--color-secondary); }
.donut-caption { font-size: 3.4px; fill: var(--color-text-muted); }
.donut-legend { display: flex; flex-direction: column; gap: 7px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 700; }
.legend-percent { color: var(--color-text-muted); font-size: 11.5px; min-width: 34px; text-align: start; }

.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; align-items: flex-start; gap: 10px; }
.rank-thumb { width: 36px; height: 36px; border-radius: var(--radius-sm); object-fit: contain; background: var(--color-tile); flex: none; }
.rank-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.rank-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { font-weight: 700; flex: none; }
.rank-bar { height: 7px; border-radius: var(--radius-pill); background: var(--color-bg); overflow: hidden; }
.rank-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); }
.rank-meta { font-size: 11.5px; color: var(--color-text-muted); }

.status-breakdown-list, .low-stock-list { display: flex; flex-direction: column; gap: 10px; }
.status-breakdown-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.top-products-list { display: flex; flex-direction: column; gap: 10px; }
.top-products-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.top-product-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.top-product-meta { font-size: 11px; color: var(--color-text-muted); }
.low-stock-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }

.admin-panel-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1100px) { .admin-panel-grid { grid-template-columns: 1fr 1fr; gap: 16px; } }

/* On a phone a wide table is unusable, so each row becomes a card and every cell carries
   its own header. The labels come from data-label, which the page already knows. */
@media (max-width: 899px) {
    .admin-table-wrap { overflow: visible; }
    .admin-table.responsive { background: none; box-shadow: none; }
    .admin-table.responsive thead { display: none; }
    .admin-table.responsive tr {
        display: block; margin-bottom: 12px; padding: 12px 14px;
        background: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: var(--radius); box-shadow: var(--shadow-sm);
    }
    .admin-table.responsive td {
        display: flex; justify-content: space-between; align-items: center; gap: 14px;
        border: none; padding: 5px 0; white-space: normal; text-align: start;
    }
    .admin-table.responsive td::before {
        content: attr(data-label);
        flex: 0 1 auto; font-size: 12px; font-weight: 700; color: var(--color-text-muted);
    }
    .admin-table.responsive td:not([data-label])::before { content: none; }
    .admin-table.responsive .admin-row-actions { justify-content: flex-end; }
}

.admin-hint { font-size: 12px; color: var(--color-text-muted); margin: 6px 0 0; line-height: 1.7; }
.admin-section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 15px; }
.admin-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-swatch { width: 28px; height: 28px; padding: 0; border: 2px solid var(--color-border); border-radius: 50%; }
.admin-swatch.active { border-color: var(--color-secondary); box-shadow: 0 0 0 2px var(--color-surface) inset; }
.admin-color-input { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface); }
.admin-chip-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-chip-picker button {
    display: inline-flex; align-items: center; gap: 5px;
    min-height: 34px; padding: 4px 10px;
    border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill);
    background: var(--color-surface); font-size: 12px; font-weight: 600;
}
.admin-chip-picker button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.admin-chip-picker button.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.admin-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 8px; }
.admin-pick-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 2px; border-radius: var(--radius-sm); }
.admin-pick-list label:hover { background: var(--color-tile); }
.admin-picked { display: flex; flex-direction: column; gap: 6px; }
.admin-picked-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--color-tile); border-radius: var(--radius-sm); font-size: 13px; }
.admin-picked-row .picked-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-picked-row .picked-order { font-weight: 800; color: var(--color-primary); min-width: 20px; }
.admin-mini-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }
.admin-mini-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.admin-mini-btn:disabled { opacity: .4; cursor: default; }
.admin-preview-strip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--color-tile); font-size: 12.5px; color: var(--color-text-muted); }
.admin-preview-strip .icon { color: var(--color-primary); }
.admin-preview-art { width: 54px; height: 40px; flex: none; border-radius: 6px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.admin-hint.inline { display: inline; margin: 0 6px 0 0; }
.row-muted { opacity: .55; }
.row-icon { vertical-align: -3px; margin-inline-end: 6px; color: var(--color-primary); }
.admin-color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 7px; border: 1px solid var(--color-border-strong); vertical-align: baseline; }
.swatch-text { flex: 1 1 110px; max-width: 140px; }
.text-warning { color: var(--color-warning); font-weight: 700; }

/* Admin cards: the panel reads better as cards than as wide tables, and a card grid
   already wraps itself on a phone, so no horizontal scroll is needed. */
.admin-card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .admin-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .admin-card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .admin-card-grid { grid-template-columns: repeat(4, 1fr); } }
.admin-card {
    display: flex; flex-direction: column; gap: 12px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
}
.admin-card-muted { background: var(--color-tile); opacity: .78; }
.admin-card .admin-row-actions { margin-top: auto; padding-top: 4px; border-top: 1px solid var(--color-border); }

/* One card per root category, with its descendants listed under it, so the tree shape of the
   menu is visible instead of flattened into a table column. */
.category-card-head { display: flex; align-items: center; gap: 10px; }
.category-card-icon {
    display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px;
    background: var(--color-tile); border-radius: var(--radius-sm); color: var(--color-primary);
}
.category-card-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.category-card-title { min-width: 0; }
.category-card-title h3 { margin: 0; font-size: 15px; }
.category-card-title p { margin: 2px 0 0; font-size: 12px; color: var(--color-text-muted); }
.category-card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.category-card-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; border-radius: var(--radius-sm); }
.category-card-row:hover { background: var(--color-tile); }
.category-card-row-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.category-card-row-slug { flex: 0 0 auto; font-size: 11px; color: var(--color-text-muted); }

.brand-logo-box {
    display: grid; place-items: center; height: 74px;
    background: var(--color-tile); border-radius: var(--radius-sm);
}
.brand-logo-box img { max-height: 58px; max-width: 88%; object-fit: contain; }
.brand-logo-fallback { font-size: 27px; font-weight: 800; color: var(--color-primary); }
.brand-card-body { display: flex; flex-direction: column; gap: 6px; }
.brand-card-name { margin: 0; font-size: 15px; font-weight: 700; }
.brand-card-slug { margin: 0; font-size: 12px; color: var(--color-text-muted); }

/* Picture picker for the content forms: previews first, then the upload button. */
.img-uploader { display: flex; flex-direction: column; gap: 10px; }
.img-uploader-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
}
.img-uploader-item {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
.img-uploader-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: var(--color-tile); }
.img-uploader-flag {
    position: absolute; inset-inline-start: 10px; top: 10px;
    padding: 2px 7px; border-radius: var(--radius-pill);
    background: var(--color-secondary); color: #fff; font-size: 11px; font-weight: 700;
}
.img-uploader-tools { display: flex; align-items: center; gap: 6px; }
.img-uploader-tools .btn { flex: 1; justify-content: center; }
.img-uploader-path {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 10.5px; color: var(--color-text-muted);
}
.img-uploader-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.img-uploader-pick { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.img-uploader-pick.disabled { opacity: .55; pointer-events: none; }
/* Kept in the tab order and clickable through the label, just not painted. */
.img-uploader-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.img-uploader-paste { display: flex; align-items: center; gap: 6px; }
.img-uploader-paste .form-control { flex: 1; min-width: 0; }

/* Destructive actions pause here instead of firing on the first click. */
.confirm-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 12px 0; padding: 12px 14px;
    background: #fff7ed; border: 1px solid #fdba74; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 600; color: #9a3412;
}

/* Product picker used by the banner/rail forms: a plain input plus a dropdown of matches. */
.product-search { position: relative; display: flex; gap: 6px; }
.product-search .form-control { flex: 1; min-width: 0; }
.product-search-results {
    position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40;
    display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none;
    max-height: 280px; overflow-y: auto;
    background: var(--color-surface); border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.product-search-results li { list-style: none; }
.product-search-results button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
    text-align: right; font-size: 13px; background: none; border: none; border-bottom: 1px solid var(--color-border);
}
.product-search-results li:last-child button { border-bottom: none; }
.product-search-results button:hover { background: var(--color-tile); color: var(--color-primary); }
.product-search-results .ps-id,
.product-search-results small { margin-inline-start: auto; color: var(--color-text-muted); font-size: 11.5px; }

/* ===== Motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    .promo-track { scroll-behavior: auto; }
}
