/* ═══════════════════════════════════════════════════════════
   FIREARM DATA LAB — LIGHT PROFESSIONAL THEME
   ═══════════════════════════════════════════════════════════ */

:root {
    --sidebar-width: 230px;
    --sidebar-gap: 16px;

    /* Core palette — clean light with professional blue accent */
    --bg:          #f4f5f7;
    --bg-card:     #ffffff;
    --bg-raised:   #f8f9fb;
    --bg-input:    #f1f3f5;
    --bg-hover:    #eceef2;

    --border:      #e2e5ea;
    --border-light:#d5d9e0;

    --text:        #1a1e2c;
    --text-dim:    #3d4356;
    --text-muted:  #636d7f;

    /* Accent — professional blue */
    --accent:      #2563eb;
    --accent-hover:#1d4fd8;
    --accent-glow: rgba(37,99,235,0.15);
    --accent-bg:   rgba(37,99,235,0.08);

    /* Semantic colors */
    --green:       #16a34a;
    --green-bright:#22c55e;
    --green-bg:    rgba(22,163,74,0.08);
    --red:         #dc2626;
    --red-bg:      rgba(220,38,38,0.06);
    --amber:       #d97706;
    --amber-bg:    rgba(217,119,6,0.08);
    --blue:        #2563eb;
    --blue-bg:     rgba(37,99,235,0.08);

    --radius:      8px;
    --radius-lg:   12px;
    --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:   0 12px 40px rgba(0,0,0,0.12);
    --transition:  0.18s ease;
    --font:        'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ════════════════════════════════════════
   SITE BANNER
   ════════════════════════════════════════ */
.site-banner {
    position: sticky;
    top: 0;
    z-index: 150;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.banner-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 var(--sidebar-gap);
    height: 56px;
    box-sizing: border-box;
}

.banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: var(--sidebar-width);
}

.banner-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.banner-brand:hover { color: var(--text); text-decoration: none; }

.banner-logo {
    color: var(--accent);
    flex-shrink: 0;
}

.banner-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.banner-name {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.banner-tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0;
}

.banner-search {
    flex: 1;
    max-width: 520px;
    position: relative;
    margin: 0 auto;
}

.banner-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.banner-search-input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.85rem;
    font-family: var(--font);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
}

.banner-search-input::placeholder { color: var(--text-muted); }

.banner-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}

.banner-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.banner-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
}

.banner-user svg { color: var(--text-muted); }

.banner-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    transition: color var(--transition);
}

.banner-link:hover { color: var(--text); }
.banner-link--logout:hover { color: var(--red); }

.banner-btn {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    padding: 7px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.banner-btn:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.sidebar {
    position: sticky;
    top: calc(56px + var(--sidebar-gap));
    left: 0;
    width: var(--sidebar-width);
    height: auto;
    max-height: calc(100vh - 56px - (var(--sidebar-gap) * 2));
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow-y: auto;
    border-radius: var(--radius-lg);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), left 0.3s ease;
    display: flex;
    flex-direction: column;
    align-self: start;
    box-shadow: var(--shadow);
}

.sidebar.collapsed { transform: translateX(calc(-100% - var(--sidebar-gap))); }

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    transition: all var(--transition);
}

.sidebar-close:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-label {
    display: block;
    font-weight: 700;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* Search input with icon */
.search-input-wrap { position: relative; }

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.sidebar-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    outline: none;
    background: var(--bg-input);
    color: var(--text);
    transition: all var(--transition);
    font-family: var(--font);
}

.sidebar-input::placeholder { color: var(--text-muted); }

.sidebar-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}

/* ── Price range slider ── */
.price-slider-wrap { padding: 14px 2px 6px; }

.price-slider-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

.price-slider-range {
    position: absolute;
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    pointer-events: none;
    will-change: left, width;
}

.price-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

.price-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}
.price-slider::-moz-range-track {
    height: 6px;
    background: transparent;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    pointer-events: auto;
    transition: transform var(--transition), box-shadow var(--transition);
    margin-top: -6px;
}

.price-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.price-slider::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    pointer-events: auto;
}

.price-inputs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.price-input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    background: var(--bg-input);
    transition: all var(--transition);
}

.price-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}

.price-input-prefix {
    padding: 0 4px 0 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.price-input {
    width: 100%;
    border: none;
    outline: none;
    padding: 8px 8px 8px 2px;
    font-size: 0.82rem;
    color: var(--text);
    background: transparent;
    font-weight: 500;
    font-family: var(--font);
}

.price-input::-webkit-inner-spin-button,
.price-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.price-input[type="number"] { -moz-appearance: textfield; }

.price-input-separator { color: var(--text-muted); font-weight: 500; font-size: 0.75rem; }

/* ── Sidebar checkboxes (Source filter) ── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background var(--transition);
    user-select: none;
}

.checkbox-label:hover { background: var(--bg-hover); }

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   CATEGORY NAV BAR
   ═══════════════════════════════════════ */
.category-nav {
    position: sticky;
    top: 56px;
    z-index: 140;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.category-nav-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0 var(--sidebar-gap);
    height: 50px;
    gap: 0;
}

.cat-nav-item {
    display: flex;
    align-items: center;
    padding: 0 32px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    border-right: 1px solid var(--border);
    transition: color var(--transition), border-color var(--transition);
    cursor: pointer;
    letter-spacing: -0.01em;
}

.cat-nav-item-wrap:last-child .cat-nav-item,
.cat-nav-item:last-child {
    border-right: none;
}

.cat-nav-item:hover {
    color: var(--accent);
}

.cat-nav-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 700;
}

.cat-nav-item-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

/* Dropdown */
.cat-nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px 0;
    z-index: 200;
}

/* Invisible bridge to prevent hover gap */
.cat-nav-item-wrap::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 6px;
    display: none;
}

.cat-nav-item-wrap:hover::after { display: block; }
.cat-nav-item-wrap:hover > .cat-nav-dropdown { display: block; }

.cat-nav-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.cat-nav-sub:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

.cat-nav-sub .chevron-right {
    width: 12px;
    height: 12px;
    opacity: 0.4;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Flyout (Ammo calibers) */
.cat-nav-subwrap {
    position: relative;
}

.cat-nav-flyout {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 170px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px 0;
    z-index: 210;
    max-height: 360px;
    overflow-y: auto;
}

.cat-nav-subwrap:hover > .cat-nav-flyout { display: block; }

.cat-nav-leaf {
    display: block;
    padding: 7px 16px;
    font-size: 0.78rem;
    color: var(--text-dim);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.cat-nav-leaf:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

.sidebar-reset-btn {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font);
}

.sidebar-reset-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.sidebar-drag-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 120;
}

.sidebar-drag-handle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 24px;
    background: var(--border-light);
    border-radius: 1px;
}

/* ════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════ */
.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: var(--sidebar-gap);
    min-height: calc(100vh - 56px);
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--sidebar-gap) var(--sidebar-gap) 0;
}

.dashboard-layout.sidebar-collapsed {
    grid-template-columns: 0 1fr;
    gap: 0;
}

.sidebar {
    transition: transform 0.3s ease;
}

.page-wrapper {
    min-height: 100vh;
    padding: 0 0 48px;
}

/* ── Topbar / Header ── */
.topbar {
    position: sticky;
    top: 56px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    background: rgba(244,245,247,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover { background: var(--bg-hover); }

.page-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.page-title-domain {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
}

.topbar-user svg { color: var(--text-muted); }

.topbar-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    transition: color var(--transition);
}

.topbar-link:hover { color: var(--text); }
.topbar-link--logout:hover { color: var(--red); }

.topbar-btn {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    padding: 7px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.topbar-btn:hover { background: var(--accent-hover); box-shadow: 0 2px 12px var(--accent-glow); }

.container {
    max-width: 100%;
    margin: 0 auto;
}

/* ════════════════════════════════════════
   TABS
   ════════════════════════════════════════ */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    padding: 4px 4px 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font);
    letter-spacing: -0.01em;
}

.tab-btn:hover { color: var(--text-dim); background: var(--bg-raised); }

.tab-btn.active {
    background: var(--bg-raised);
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 700;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 1px 7px;
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.tab-btn.active .tab-count {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ── Tab panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-panel > .section {
    margin-top: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: none;
}

/* ════════════════════════════════════════
   SECTION CARDS
   ════════════════════════════════════════ */
.section {
    margin-top: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

/* ════════════════════════════════════════
   TABLES
   ════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

th, td { padding: 10px 12px; text-align: left; }

th {
    background: var(--bg-raised);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    position: sticky;
    top: 0;
    user-select: none;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
    transition: color var(--transition);
}

th:hover { color: var(--text-dim); }

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius) 0 0; }

.sort-arrow { display: inline-block; width: 0; margin-left: 4px; opacity: 0.4; }

td { border-bottom: 1px solid var(--border); color: var(--text-dim); }
tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-raised); }

/* Cell types */
.cell-img { width: 48px; padding-right: 4px; }
.cell-name { max-width: 320px; }
.cell-name a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}
.cell-name a:hover { color: var(--accent); }

.cell-price {
    font-weight: 700;
    color: var(--green);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cell-muted { color: var(--text-muted) !important; font-weight: 500 !important; }

.cell-date {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.78rem;
}

.cell-badge { white-space: nowrap; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 12px !important;
    font-size: 0.88rem;
}

/* Badges */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: -0.01em;
}
.badge--green { background: var(--green-bg); color: var(--green);  border: 1px solid rgba(22,163,74,0.2); }
.badge--red   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(220,38,38,0.2); }
.badge--amber { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(217,119,6,0.2); }

/* Product thumbnails */
.product-thumb {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: var(--radius);
    background: #fff;
    vertical-align: middle;
    border: 1px solid var(--border);
    padding: 2px;
}

.product-clickable { cursor: pointer; }

/* Category select in table */
.cat-select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    background: var(--bg-input);
    color: var(--text-dim);
    outline: none;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.cat-select:focus { border-color: var(--accent); }

/* ════════════════════════════════════════
   BOTTOM GRID (CHART + CATEGORY MGMT)
   ════════════════════════════════════════ */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    margin-top: 16px;
}

.section--chart { min-height: 0; }

.chart-wrap {
    height: 320px;
    position: relative;
}

.manage-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.manage-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.manage-input::placeholder { color: var(--text-muted); }
.manage-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn-primary {
    padding: 9px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 12px var(--accent-glow); }

.manage-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.manage-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(37,99,235,0.15);
}

/* ════════════════════════════════════════
   LINKS
   ════════════════════════════════════════ */
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ════════════════════════════════════════
   PRODUCT DETAIL MODAL
   ════════════════════════════════════════ */
.product-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: start;
    padding: 48px 16px;
    overflow-y: auto;
}

.product-modal-overlay.active { display: flex; }

.product-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 640px;
    width: 100%;
    padding: 28px;
    position: relative;
    animation: modalIn 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.product-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: var(--bg-hover);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    transition: all var(--transition);
}

.product-modal-close:hover { background: var(--border); color: var(--text); }

.product-modal-header {
    display: flex;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

.product-modal-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--border);
    flex-shrink: 0;
    padding: 4px;
}

.product-modal-title-wrap { flex: 1; min-width: 0; }

.product-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
    line-height: 1.4;
}

.product-modal-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.product-modal-category {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(37,99,235,0.15);
}

/* Source badge in modal */
.product-modal-source {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-raised);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* Stock badge */
.product-modal-stock {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.stock-in  { background: var(--green-bg); color: var(--green);  border: 1px solid rgba(22,163,74,0.2); }
.stock-out { background: var(--red-bg);   color: var(--red);    border: 1px solid rgba(220,38,38,0.2); }

/* Tag pills */
.product-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.product-tag {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--bg-raised);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* Modal stat grid */
.product-modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.modal-stat {
    background: var(--bg-raised);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.modal-stat-label {
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.modal-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.modal-stat-value--green { color: var(--green); }
.modal-stat-value--red   { color: var(--red); }

.product-modal-badge {
    background: var(--green-bg);
    border: 1px solid rgba(22,163,74,0.2);
    color: var(--green);
    font-weight: 700;
    font-size: 0.82rem;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

/* Behavioral insights */
.product-modal-insights {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.product-modal-insights:empty { display: none; }

.insight {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid;
}

.insight--amber  { background: var(--amber-bg); border-color: rgba(217,119,6,0.2); }
.insight--green  { background: var(--green-bg); border-color: rgba(22,163,74,0.2); }
.insight--red    { background: var(--red-bg);   border-color: rgba(220,38,38,0.2); }
.insight--blue   { background: var(--blue-bg);  border-color: rgba(37,99,235,0.2); }

.insight--amber .insight-icon { color: var(--amber); }
.insight--green .insight-icon { color: var(--green); }
.insight--red   .insight-icon { color: var(--red); }
.insight--blue  .insight-icon { color: var(--blue); }

.insight-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.insight-label {
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text);
}

.insight-text {
    font-size: 0.74rem;
    color: var(--text-dim);
    line-height: 1.45;
}

.product-modal-chart-wrap { margin-bottom: 18px; }
.product-modal-chart-wrap h3 {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}
.product-modal-chart-wrap canvas { width: 100% !important; max-height: 220px; }

.product-modal-link {
    display: block;
    text-align: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.product-modal-link:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
    text-decoration: none;
}

/* ════════════════════════════════════════
   PAGINATION
   ════════════════════════════════════════ */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 4px;
    font-size: 0.78rem;
}

.pagination-left label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.page-size-select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    background: var(--bg-input);
    color: var(--text-dim);
    font-family: var(--font);
}

.pagination-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-page {
    background: var(--bg-card);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 600;
    transition: all var(--transition);
    font-family: var(--font);
    min-height: 40px;
    min-width: 40px;
}

.btn-page:disabled { opacity: 0.3; cursor: default; }

.btn-page:not(:disabled):hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-info {
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.76rem;
}

/* ════════════════════════════════════════
   VIEW TOGGLE
   ════════════════════════════════════════ */
.view-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.tile-sort {
    display: none;
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 10px;
    font-size: .78rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.tile-sort:focus { outline: none; border-color: var(--accent); }
.tile-sort.visible { display: block; }

.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 3px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.view-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    transition: all var(--transition);
}

.view-toggle-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.view-toggle-btn:hover:not(.active) { color: var(--text-dim); }

/* ════════════════════════════════════════
   TILE GRID
   ════════════════════════════════════════ */
.tile-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.tile-grid.active { display: grid; }

.tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-shadow: var(--shadow);
}

.tile:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 0 0 1px var(--accent-glow);
}

.tile-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tile-img {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.tile:hover .tile-img { transform: scale(1.03); }

.tile-no-img {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.tile-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.tile-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.tile-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.tile-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
}

/* CPR (cost per round) badge */
.tile-cpr {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.cpr-badge {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: -0.01em;
}
.cpr-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Source badge on tiles */
.tile-source {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-raised);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tile-old-price {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.tile-badge {
    margin-left: auto;
}

.tile-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.tile-category {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 2px 8px;
    border-radius: 12px;
    align-self: flex-start;
    border: 1px solid rgba(37,99,235,0.12);
}

/* Hide table when tiles active, hide tiles when table active */
.section[data-view="tiles"] .table-wrap,
.section[data-view="tiles"] .pagination-controls:not(.tile-pagination) { display: none; }
.section[data-view="table"] .tile-grid,
.section[data-view="table"] .tile-pagination { display: none; }
.section[data-view="tiles"] .tile-grid { display: grid; }
.section[data-view="tiles"] .tile-pagination { display: flex; }

.tile-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 48px 12px;
    font-size: 0.88rem;
}

.tile-detail-link {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-top: auto;
    padding-top: 4px;
}
.tile-detail-link:hover { text-decoration: underline; }

.tile-new-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--amber-bg);
    color: var(--amber);
    border: 1px solid rgba(217,119,6,0.2);
    letter-spacing: 0.5px;
    align-self: flex-start;
    text-transform: uppercase;
}

/* ════════════════════════════════════════
   SIDEBAR OVERLAY
   ════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    backdrop-filter: blur(4px);
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */

/* ── Tablet / small laptop ── */
@media (max-width: 1024px) {
    .banner-inner { padding: 0 16px; }
    .banner-tagline { display: none; }
    .category-nav-inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 12px;
    }
    .category-nav-inner::-webkit-scrollbar { display: none; }
    .cat-nav-item { padding: 0 14px; font-size: 0.78rem; }
    .dashboard-layout,
    .dashboard-layout.sidebar-collapsed {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(280px, 80vw);
        height: 100vh;
        max-height: 100vh;
        z-index: 110;
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    }
    .sidebar.open { transform: translateX(0); }
    .page-wrapper {
        margin-left: 0;
        padding: 0 16px 48px;
    }
    .sidebar-toggle { display: flex !important; }
    .sidebar-overlay.active { display: block; }
    .bottom-grid { grid-template-columns: 1fr; }
}

/* ── Phone ── */
@media (max-width: 640px) {
    .category-nav { top: 50px; }
    .category-nav-inner { height: 38px; padding: 0 8px; }
    .cat-nav-item { padding: 0 10px; font-size: 0.75rem; }
    /* Flyout drops below instead of to the right */
    .cat-nav-flyout {
        position: relative;
        left: 0;
        top: 0;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        min-width: 0;
    }

    .banner-inner {
        padding: 0 10px;
        gap: 10px;
        height: 50px;
    }
    .banner-logo { width: 22px; height: 22px; }
    .banner-name { font-size: 0.85rem; }
    .banner-brand-text { display: none; }
    .banner-search-input {
        font-size: 0.8rem;
        padding: 7px 12px 7px 34px;
    }
    .banner-right { gap: 8px; }
    .banner-link, .banner-btn { font-size: 0.72rem; }
    .banner-btn { padding: 5px 10px; }
    .banner-user { font-size: 0.74rem; }

    .page-wrapper { padding: 0 10px 32px; }
    .page-title { font-size: 1rem; flex-wrap: wrap; }
    .page-title-domain { font-size: 0.6rem; }
    .section { padding: 12px 10px; }

    .topbar {
        gap: 8px;
        padding: 10px 0;
        flex-wrap: wrap;
    }
    .topbar-right { gap: 8px; }
    .topbar-user { font-size: 0.74rem; }
    .topbar-link, .topbar-btn { font-size: 0.74rem; }
    .topbar-btn { padding: 5px 10px; }

    .tab-count { font-size: 0.62rem; padding: 1px 5px; }

    .tab-bar {
        flex-wrap: wrap;
        gap: 3px;
        padding: 3px 3px 0;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .tab-btn {
        flex: 0 0 auto;
        padding: 9px 12px;
        font-size: 0.76rem;
        min-width: unset;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .view-controls {
        width: 100%;
        justify-content: flex-end;
        padding: 6px 4px 4px;
        border-top: 1px solid var(--border);
    }

    .table-wrap { margin: 0 -10px; padding: 0 10px; }
    table { min-width: 560px; }
    th, td { padding: 9px 8px; font-size: 0.76rem; }
    .cell-name { max-width: 200px; }
    .product-thumb { width: 34px; height: 34px; }
    .cell-img { width: 38px; padding-right: 2px; }

    .section[data-view="tiles"] .tile-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .tile {
        flex-direction: row;
        align-items: center;
        padding: 10px;
        border-radius: 10px;
        gap: 12px;
    }
    .tile-img-wrap {
        width: 68px;
        height: 68px;
        aspect-ratio: 1;
        flex-shrink: 0;
        border-radius: var(--radius);
    }
    .tile-name { font-size: 0.8rem; -webkit-line-clamp: 2; }
    .tile-price { font-size: 1rem; }
    .tile-old-price { font-size: 0.76rem; }
    .tile-date { font-size: 0.64rem; }
    .tile-category, .tile-new-badge { font-size: 0.64rem; }

    .pagination-controls {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.76rem;
    }
    .pagination-left, .pagination-right {
        width: 100%;
        justify-content: center;
    }
    .pagination-left label { justify-content: center; }
    .btn-page {
        padding: 8px 12px;
        font-size: 0.74rem;
        min-width: 40px;
        min-height: 36px;
    }
    .page-size-select { font-size: 0.8rem; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85vw;
        max-width: 340px;
        height: 100vh;
        max-height: 100vh;
        z-index: 200;
        background: var(--bg-card);
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
        padding-top: 0;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 199;
        transition: opacity 0.2s;
    }
    .sidebar-drag-handle { display: none !important; }
    .sidebar-section { padding: 12px 14px; }
    .sidebar-label { font-size: 0.7rem; margin-bottom: 10px; }
    .sidebar-input {
        font-size: 0.86rem;
        padding: 10px 12px 10px 34px;
        border-radius: var(--radius);
    }
    .sidebar-close {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
    }
    .sidebar-reset-btn {
        padding: 10px;
        font-size: 0.82rem;
        min-height: 40px;
    }

    .product-modal-overlay { padding: 0; }
    .product-modal-overlay.active {
        display: flex;
        align-items: stretch;
    }
    .product-modal {
        width: 100vw;
        max-width: none;
        min-height: 100vh;
        border-radius: 0;
        padding: 0 0 32px 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        animation: modalSlideUp 0.3s cubic-bezier(0.16,1,0.3,1);
    }
    @keyframes modalSlideUp {
        from { opacity: 0; transform: translateY(40px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .product-modal-close {
        position: fixed;
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        z-index: 210;
        background: rgba(0,0,0,0.15);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .product-modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 48px 16px 0 16px;
        gap: 12px;
    }
    .product-modal-img {
        width: 50vw;
        max-width: 200px;
        height: auto;
        border-radius: var(--radius-lg);
    }
    .product-modal-title-wrap {
        width: 100%;
        margin-bottom: 8px;
    }
    .product-modal-title { font-size: 0.92rem; }
    .product-modal-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 0 16px;
    }
    .modal-stat:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        max-width: 50%;
        justify-self: center;
    }
    .modal-stat { padding: 10px 8px; }
    .modal-stat-label { font-size: 0.64rem; }
    .modal-stat-value { font-size: 0.92rem; }
    .product-modal-badge,
    .product-modal-insights,
    .product-modal-chart-wrap,
    .product-modal-link {
        margin-left: 16px;
        margin-right: 16px;
    }
    .product-modal-link {
        font-size: 0.92rem;
        padding: 14px;
        border-radius: var(--radius);
        margin-top: 12px;
    }
    .insight { padding: 10px; gap: 10px; }
    .insight-label { font-size: 0.74rem; }
    .insight-text { font-size: 0.7rem; }

    .view-toggle-btn { padding: 6px 10px; }

    .bottom-grid { grid-template-columns: 1fr; gap: 12px; }
    .chart-wrap { height: 220px; }
    .manage-input { font-size: 0.86rem; }
    .btn-primary {
        padding: 10px 14px;
        font-size: 0.82rem;
        min-height: 40px;
    }

    .product-detail-grid { grid-template-columns: 1fr; }
    .product-detail-image img { max-width: 240px; margin: 0 auto; }
    .product-page-inner { padding: 16px 12px 48px; }
    .alert-signup-form { flex-direction: column; }
}

/* ════════════════════════════════════════
   PRODUCT DETAIL PAGE
   ════════════════════════════════════════ */
.product-page {
    max-width: 1100px;
    margin: 0 auto;
}

.product-page-inner {
    padding: 24px var(--sidebar-gap) 48px;
}

.product-breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.product-breadcrumb a {
    color: var(--text-dim);
    text-decoration: none;
}
.product-breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { margin: 0 6px; color: var(--border-light); }

.product-detail-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
    align-items: start;
}

.product-detail-image {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-detail-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.product-detail-no-img {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 60px 0;
}

.product-detail-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.product-detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.product-detail-price-block {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}
.product-detail-current {
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
}
.product-detail-original {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ── Alert signup box ── */
.alert-signup-box {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin: 20px 0;
}
.alert-signup-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.alert-signup-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.alert-signup-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.alert-signup-email,
.alert-signup-target {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}
.alert-signup-email { flex: 2; }
.alert-signup-target { flex: 1; max-width: 140px; }
.alert-signup-email:focus,
.alert-signup-target:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.alert-signup-btn { flex-shrink: 0; }

.alert-signup-msg {
    margin-top: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius);
}
.alert-signup-msg--ok {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(22,163,74,0.2);
}
.alert-signup-msg--err {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(220,38,38,0.2);
}

/* ════════════════════════════════════════
   CATEGORY PAGE
   ════════════════════════════════════════ */
.cat-page {
    max-width: 1400px;
    margin: 0 auto;
}

.cat-page-inner {
    padding: 24px var(--sidebar-gap) 48px;
}

/* Hero */
.cat-hero {
    margin-bottom: 24px;
}

.cat-hero-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin-bottom: 4px;
}

.cat-hero-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* CPR summary for ammo categories */
.cat-cpr-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.cat-cpr-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow);
}

.cat-cpr-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.cat-cpr-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.cat-cpr-value--best {
    color: var(--green);
}

/* Subcategory navigation */
.cat-subcategories {
    margin-bottom: 28px;
}

.cat-sub-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.cat-sub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.cat-sub-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.cat-sub-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    transform: translateY(-1px);
}

.cat-sub-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.cat-sub-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sort & filter controls */
.cat-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cat-sort-form {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.cat-sort-form label {
    font-weight: 600;
    white-space: nowrap;
}

.cat-sort-form select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-family: var(--font);
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.cat-sort-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.cat-stock-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
}

.cat-stock-filter input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Product grid */
.cat-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.cat-product-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.cat-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 0 0 1px var(--accent-glow);
}

.cat-card-img {
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.cat-card-img img {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.cat-product-card:hover .cat-card-img img {
    transform: scale(1.03);
}

.cat-card-no-img {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.cat-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px 14px;
    flex: 1;
}

.cat-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.24em;
}

.cat-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-card-current {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
}

.cat-card-original {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.cat-card-cpr {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-card-meta {
    margin-top: auto;
    padding-top: 4px;
}

.cat-card-stock {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

/* Pagination */
.cat-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.cat-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    text-decoration: none;
    background: var(--bg-card);
    transition: all var(--transition);
}

.cat-page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.cat-page-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.cat-page-active:hover {
    background: var(--accent-hover);
    color: #fff;
    border-color: var(--accent-hover);
}

.cat-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Empty state */
.cat-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.cat-empty p {
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.cat-empty-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.cat-empty-link:hover {
    text-decoration: underline;
}

/* ── Category page responsive ── */
@media (max-width: 1024px) {
    .cat-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }
    .cat-sub-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 640px) {
    .cat-page-inner { padding: 16px 10px 32px; }
    .cat-hero-title { font-size: 1.2rem; }
    .cat-cpr-summary { flex-direction: column; gap: 10px; }
    .cat-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .cat-card-body { padding: 8px 10px 10px; }
    .cat-card-title { font-size: 0.72rem; min-height: 2em; }
    .cat-card-current { font-size: 0.92rem; }
    .cat-controls { padding: 8px 12px; }
    .cat-sort-form { gap: 6px; font-size: 0.78rem; }
    .cat-sort-form select { font-size: 0.78rem; }
    .cat-pagination { gap: 2px; }
    .cat-page-link { min-width: 32px; height: 32px; font-size: 0.75rem; padding: 0 6px; }
    .cat-sub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
