/* Decatur Deals Depot — Responsive Overrides + Utility Classes
   Base: Pico CSS via CDN + design tokens in base.html <style>.
   This file handles responsive breakpoints, mobile nav, layout, and
   reusable utility classes that replace common inline style patterns. */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================
   Workshop Terminal — Visual Enhancement Layer
   JetBrains Mono for data/labels, Plus Jakarta Sans for body text.
   Warm surfaces, bold typography, angular shapes.
   ============================================ */

/* --- 2. Stat Cards Enhancement --- */
.stat-card {
    border-left: 3px solid var(--color-brand, #f96302);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stat-card .stat-value {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}

.stat-card h2 {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    letter-spacing: -0.02em;
}

.stat-card p {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}

.stat-mini {
    border-left: 3px solid var(--color-brand, #f96302);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    background: white;
}

.stat-mini-value {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    letter-spacing: -0.02em;
}

.stat-mini-label {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
}

/* --- 3. Alert Banner Enhancement --- */
.alert-banner {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- 4. Badge Enhancement --- */
.badge {
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    padding: 0.2em 0.7em;
}

.badge-success,
.badge-resolved,
.badge-strong-buy,
.badge-great,
.badge-purchase {
    border-left: 2px solid var(--color-success, #155724);
}

.badge-warning,
.badge-pending,
.badge-watch,
.badge-meh {
    border-left: 2px solid var(--color-warning, #856404);
}

.badge-danger,
.badge-error,
.badge-return {
    border-left: 2px solid var(--color-danger, #721c24);
}

.badge-info,
.badge-good,
.badge-adjustment {
    border-left: 2px solid var(--color-info, #004085);
}

.badge-muted,
.badge-ignored,
.badge-ignore,
.badge-pass {
    border-left: 2px solid var(--color-muted, #6c757d);
}

.badge-retail {
    border-left: 2px solid var(--color-info, #004085);
}

.badge-marketplace {
    border-left: 2px solid #1565c0;
}

.badge-dealer {
    border-left: 2px solid var(--color-warning, #856404);
}

/* --- 5. Table Enhancement --- */
th {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.82rem;
    background: #faf8f6;
}

tr:hover {
    background: #fff8f2;
}

/* --- 6. Page Layout Enhancement --- */
.page-header h1 {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    letter-spacing: -0.02em;
}

.page-title-row {
    border-bottom: 1px solid var(--color-border, #dee2e6);
    padding-bottom: var(--space-sm, 0.5rem);
    margin-bottom: var(--space-md, 1rem);
}

/* --- 7. Button Enhancement --- */
.btn-sm {
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-sm:active {
    transform: scale(0.97);
}

.btn-xs {
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-xs:active {
    transform: scale(0.97);
}

/* --- 8. Dashboard Section Enhancement --- */
.dashboard-section > summary,
.dashboard-section summary {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.dashboard-section summary h2 {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.dashboard-section[open] {
    border-left: 3px solid var(--color-brand, #f96302);
    padding-left: var(--space-sm, 0.5rem);
}

.dashboard-section > summary::before {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 9. Quick Actions Enhancement --- */
.quick-actions a {
    border-radius: 10px;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-actions a:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quick-actions a:active {
    transform: scale(0.98);
}

/* --- 10. Toast Enhancement --- */
.toast {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* --- 11. Flash Message Enhancement --- */
.flash {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- 12. Filter Bar Enhancement --- */
.filter-group label {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.filter-bar input,
.filter-bar select {
    background: #faf8f6;
}

/* --- 13. Data Quality Enhancement --- */
.dq-value {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.dq-good {
    color: #1b8a3e;
}

.dq-warn {
    color: #b8860b;
}

.dq-bad {
    color: #c41e2a;
}

/* --- 14. Pagination Enhancement --- */
.pagination a,
.pagination span {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.pagination .current {
    box-shadow: 0 2px 8px rgba(249, 99, 2, 0.3);
}

/* --- 15. Utility Classes --- */
.font-mono {
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.font-body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

/* --- 16. Keyframes --- */
@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Page Layout Utilities
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0;
}

.page-header-meta {
    font-size: 0.9rem;
    color: var(--color-text-secondary, #6c757d);
}

/* ============================================
   Button Sizes
   ============================================ */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

/* ============================================
   Alert Banners — colored left-border panels
   ============================================ */
.alert-banner {
    padding: 1rem;
    border-radius: var(--pico-border-radius, 4px);
    border: 1px solid transparent;
    border-left: 4px solid;
    margin-bottom: 1.5rem;
}

.alert-banner-success,
.alert-banner.alert-success {
    background: var(--color-success-bg, #d4edda);
    border-color: #c3e6cb;
    border-left-color: var(--color-success, #155724);
}

.alert-banner-warning,
.alert-banner.alert-warning {
    background: var(--color-warning-bg, #fef3cd);
    border-color: #ffc107;
    border-left-color: #f57c00;
}

.alert-banner-info,
.alert-banner.alert-info {
    background: var(--color-info-bg, #cce5ff);
    border-color: #42a5f5;
    border-left-color: #1565c0;
}

.alert-banner-danger,
.alert-banner.alert-danger {
    background: var(--color-danger-bg, #f8d7da);
    border-color: #f5c6cb;
    border-left-color: var(--color-danger, #721c24);
}

.alert-banner-orange {
    background: #fff3e0;
    border-color: #ff9800;
    border-left-color: #f57c00;
}

.alert-banner-blue {
    background: #e3f2fd;
    border-color: #42a5f5;
    border-left-color: #1565c0;
}

.alert-banner-green {
    background: #e8f5e9;
    border-color: #4caf50;
    border-left-color: #2e7d32;
}

.alert-banner-amber {
    background: #fff9e6;
    border-color: #ffc107;
    border-left-color: #ff9800;
}

/* ============================================
   Mini Stat Cards — compact metric grids
   ============================================ */
.stat-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-mini {
    padding: 0.75rem;
    text-align: center;
    border-radius: var(--pico-border-radius, 4px);
    background: var(--color-surface, #ffffff);
    margin: 0;
}

.stat-mini-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-mini-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary, #6c757d);
    margin-top: 0.25rem;
}

/* ============================================
   Filter Bar — flex filter row pattern
   ============================================ */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.filter-group {
    min-width: 140px;
}

.filter-group label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    display: block;
}

/* ============================================
   Detail/Evidence Panels
   ============================================ */
.detail-panel {
    background: var(--pico-color-grey-50, #f8f9fa);
    padding: 0.75rem;
    border-radius: var(--pico-border-radius, 4px);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   Text Color Helpers
   ============================================ */
.text-success {
    color: var(--color-success, #155724);
}

.text-warning {
    color: var(--color-warning, #856404);
}

.text-danger {
    color: var(--color-danger, #721c24);
}

.text-info {
    color: var(--color-info, #004085);
}

.text-muted {
    color: var(--color-muted, #6c757d);
}

.text-brand {
    color: var(--color-brand, #f96302);
}

.fw-bold {
    font-weight: 600;
}

/* ============================================
   Platform Badges via data attributes
   ============================================ */
.badge-platform {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #607d8b;
    color: white;
}

.badge-platform[data-platform="M18"] {
    background: #1565C0;
}

.badge-platform[data-platform="M12"] {
    background: #C62828;
}

.badge-platform[data-platform="MX FUEL"] {
    background: #6A1B9A;
}

.badge-platform[data-platform="M18 FUEL"] {
    background: #0D47A1;
}

.badge-platform[data-platform="M12 FUEL"] {
    background: #B71C1C;
}

/* ============================================
   White-space / nowrap helper
   ============================================ */
.nowrap {
    white-space: nowrap;
}

/* ============================================
   Table Scroll Wrappers
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table-responsive table {
    min-width: 500px;
}

/* ============================================
   Stat Grid — Desktop: 4 columns
   ============================================ */
@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   Bottom Navigation — Mobile Styles
   ============================================ */
@media (max-width: 768px) {

    /* Hide desktop nav links, show mobile nav */
    .desktop-only {
        display: none !important;
    }

    .desktop-only-flex {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-only-flex {
        display: flex !important;
    }

    /* Bottom nav bar */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: space-around;
        align-items: center;
        background: var(--color-nav-bg, #1a1a1a);
        padding: var(--space-xs, 0.25rem) 0;
        padding-bottom: env(safe-area-inset-bottom, var(--space-xs, 0.25rem));
        z-index: 1000;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        color: var(--color-nav-text, #ffffff);
        text-decoration: none;
        font-size: var(--text-xs, 0.75rem);
        padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        line-height: 1;
    }

    .bottom-nav-item.active {
        color: var(--color-brand, #f96302);
    }

    .bottom-nav-item svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        fill: none;
    }

    .bottom-nav-item span {
        font-size: 0.65rem;
        margin-top: 1px;
    }

    /* Body padding for bottom nav clearance */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* More menu */
    .more-menu {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1001;
    }

    .more-menu[hidden] {
        display: none;
    }

    .more-menu-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
    }

    .more-menu-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-surface, #ffffff);
        border-radius: 16px 16px 0 0;
        padding: var(--space-md, 1rem);
        padding-bottom: calc(var(--space-lg, 1.5rem) + env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
        gap: var(--space-xs, 0.25rem);
        animation: slide-up 0.2s ease;
    }

    .more-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: var(--space-sm, 0.5rem);
        margin-bottom: var(--space-sm, 0.5rem);
        border-bottom: 1px solid var(--color-border, #dee2e6);
    }

    .more-menu-header button {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: var(--space-xs, 0.25rem);
        color: var(--color-text-secondary, #6c757d);
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .more-menu-panel a {
        display: block;
        padding: 0.75rem var(--space-md, 1rem);
        border-radius: var(--pico-border-radius, 8px);
        text-decoration: none;
        color: var(--color-text, #212529);
        font-size: var(--text-base, 1rem);
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .more-menu-panel a:hover,
    .more-menu-panel a.active {
        background: var(--color-brand-light, #fff3eb);
        color: var(--color-brand, #f96302);
    }

    @keyframes slide-up {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    /* Top nav simplification on mobile */
    .top-nav {
        padding: var(--space-sm, 0.5rem) 0.75rem;
    }

    /* Stack grid filters vertically on mobile */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Tighter container padding */
    main.container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Inline forms stack */
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    /* Header + export button stacking */
    div[style*="justify-content:space-between"] {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm, 0.5rem);
    }

    /* Footer bottom spacing */
    footer.container {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* Stat card responsive sizing */
    .stat-card .stat-value {
        font-size: var(--text-xl, 1.5rem);
    }

    .stat-card h2 {
        font-size: 1.8rem;
    }

    /* Collapse dashboard sections on mobile by default via JS hint */
    .dashboard-section:not([open]) summary {
        border-bottom: 1px solid var(--color-border, #dee2e6);
    }
}

/* ============================================
   Small Mobile (≤480px)
   ============================================ */
@media (max-width: 480px) {
    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .stat-card h2 {
        font-size: 1.4rem;
    }

    .stat-card p,
    .stat-card .stat-label {
        font-size: 0.8rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    /* Smaller table text on tiny screens */
    table {
        font-size: 0.85rem;
    }

    td,
    th {
        padding: 0.35rem 0.5rem;
    }

    /* Quick actions stack vertically */
    .quick-actions {
        flex-direction: column;
    }

    .quick-actions a {
        min-width: unset;
    }
}

/* ============================================
   FAB (Floating Action Button) — Mobile Only
   ============================================ */
@media (max-width: 768px) {
    .fab {
        display: flex;
        position: fixed;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        right: var(--space-md, 1rem);
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--color-brand, #f96302);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        z-index: 999;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .fab:active {
        transform: scale(0.92);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* ============================================
   Toast positioning adjustment on desktop
   ============================================ */
@media (min-width: 769px) {
    .toast {
        bottom: var(--space-xl, 2rem);
    }
}

/* ============================================
   Print styles — hide nav/FAB
   ============================================ */
@media print {

    .top-nav,
    .bottom-nav,
    .fab,
    .more-menu,
    .quick-actions {
        display: none !important;
    }

    body {
        padding-bottom: 0;
    }
}

/* ============================================
   Photo Upload Styles
   ============================================ */
.chip {
    display: inline-block;
    background: var(--pico-secondary-bg, #e9ecef);
    border: 1px solid var(--pico-muted-border-color, #dee2e6);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.85rem;
    margin: 2px;
}

.chip a {
    color: var(--pico-del-color, #c0392b);
    text-decoration: none;
    margin-left: 4px;
    font-weight: bold;
    cursor: pointer;
}

.toast-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #155724;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.capture-row {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.capture-row button {
    flex: 1;
    padding: 12px;
}

.file-count {
    font-size: 0.85rem;
    color: var(--pico-muted-color, #6c757d);
    margin-bottom: 0.5rem;
}

.photo-preview {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* Mobile adjustments for photo upload */
@media (max-width: 768px) {
    .toast-success {
        bottom: calc(72px + env(safe-area-inset-bottom, 20px));
    }
}

/* ============================================
   Deal Cards Grid Layout
   ============================================ */
.deals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* ============================================
   MOBILE UI IMPROVEMENTS (Feb 2026)
   ============================================ */

/* --- iOS Zoom Prevention ---
   iOS Safari auto-zooms when inputs have font-size < 16px.
   Force all interactive inputs to 16px on mobile to prevent this. */
@media (max-width: 768px) {

    input[type="text"],
    input[type="number"],
    input[type="tel"],
    input[type="email"],
    input[type="date"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* --- Touch Feedback ---
   Subtle scale-down on touch for interactive elements */
.touch-feedback,
.market-card,
.inv-mobile-card,
.bottom-nav-item,
.tag-chip {
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s ease;
}

.touch-feedback:active,
.market-card:active,
.inv-mobile-card:active {
    transform: scale(0.985);
}

/* --- Offline Banner --- */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #C62828;
    color: #fff;
    text-align: center;
    padding: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.visible {
    transform: translateY(0);
}

/* --- Marketplace Queue: Better Mobile Price Input --- */
@media (max-width: 768px) {
    .market-inline-price-mobile {
        flex-direction: column;
        gap: 0.35rem;
    }

    .market-inline-price-mobile input[type="text"] {
        width: 100% !important;
        font-size: 16px !important;
        padding: 0.5rem 0.6rem !important;
        text-align: left !important;
    }

    .market-inline-price-mobile button {
        width: 100%;
        padding: 0.5rem !important;
        font-size: 0.9rem !important;
    }

    /* FB price labels bigger */
    .market-card .text-muted[style*="0.72rem"] {
        font-size: 0.82rem !important;
    }
}

/* --- Inventory Mobile Cards --- */
.inv-mobile-cards {
    display: none;
}

@media (max-width: 768px) {
    .inv-desktop-table {
        display: none !important;
    }

    .inv-mobile-cards {
        display: block !important;
    }
}

.inv-mobile-card {
    background: var(--pico-card-background-color, var(--color-surface, #fff));
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--pico-border-radius, 8px);
    padding: 0.75rem;
    margin-bottom: 0.6rem;
}

.inv-mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.inv-mobile-card-header img {
    max-width: 56px;
    max-height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.inv-mobile-card-info {
    flex: 1;
    min-width: 0;
}

.inv-mobile-card-model {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-brand, #f96302);
    text-decoration: none;
}

.inv-mobile-card-desc {
    font-size: 0.85rem;
    color: var(--color-text-secondary, #6c757d);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.inv-mobile-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.35rem;
    margin: 0.5rem 0;
    font-size: 0.82rem;
}

.inv-mobile-card-stat {
    text-align: center;
    padding: 0.25rem;
    background: var(--color-surface-raised, #f8f9fa);
    border-radius: 6px;
}

.inv-mobile-card-stat .label {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-secondary, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inv-mobile-card-stat .value {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.1rem;
}

.inv-mobile-card .sell-btn-mobile {
    display: block;
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: var(--color-brand, #f96302);
    border: none;
    border-radius: var(--pico-border-radius, 8px);
    margin-top: 0.5rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.inv-mobile-card .sell-btn-mobile:active {
    background: var(--color-brand-hover, #e55a00);
    transform: scale(0.97);
}

/* Warning/danger indicators on inventory mobile cards */
.inv-mobile-card.inv-card-negative {
    border-left: 3px solid #dc3545;
    background: #fff5f5;
}

.inv-mobile-card.inv-card-low {
    border-left: 3px solid #ffc107;
    background: #fffdf0;
}

.inv-mobile-card.inv-card-out {
    opacity: 0.5;
}

.inv-mobile-card.inv-card-suspicious {
    border-left: 3px solid #e67e22;
    background: #fef9f0;
}

/* --- POS Cart Mobile Layout --- */
@media (max-width: 768px) {

    /* Hide the 5-column header row on mobile */
    .pos-cart-header {
        display: none !important;
    }

    /* Reflow each cart-row from 5-column grid to stacked card */
    .cart-row.grid {
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 0.5rem !important;
        padding: 0.75rem;
        margin-bottom: 0.65rem !important;
        border: 1px solid var(--pico-muted-border-color, #ddd);
        border-radius: 0.5rem;
        background: var(--pico-card-background-color, #f8f9fa);
        position: relative;
    }

    /* SKU — full width, first row */
    .cart-row .cart-sku {
        grid-column: 1 / -1;
        font-weight: 600;
        font-size: 1rem !important;
        padding: 0.5rem !important;
    }

    /* Description — full width, second row */
    .cart-row .cart-desc {
        grid-column: 1 / -1;
        font-size: 0.9rem !important;
        padding: 0.45rem !important;
    }

    /* Qty — left half, third row */
    .cart-row .cart-qty {
        font-size: 1.1rem !important;
        padding: 0.5rem !important;
    }

    /* Price — right half, third row */
    .cart-row .cart-price {
        font-size: 1.1rem !important;
        padding: 0.5rem !important;
    }

    /* Remove button — absolute top-right */
    .cart-row .outline.secondary[title="Remove"],
    .cart-row button[onclick*="removeRow"] {
        position: absolute;
        top: 0.35rem;
        right: 0.35rem;
        padding: 0.25rem 0.45rem !important;
        font-size: 1rem !important;
        min-width: 32px;
        min-height: 32px;
    }

    /* Bigger add-row button on mobile */
    #addRowBtn {
        width: 100%;
        padding: 0.6rem 1rem !important;
        font-size: 1rem !important;
    }

    /* Discount input wider on mobile */
    #discount-input {
        width: 6rem !important;
    }

    /* POS submit button bigger tap target */
    #pos-form button[type="submit"] {
        font-size: 1.15rem !important;
        padding: 0.8rem 1.5rem !important;
    }
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 16px));
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f96302 0%, #e55a00 100%);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(249, 99, 2, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(249, 99, 2, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fab svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    pointer-events: none;
}

/* ============================================
   Quick-Add Overlay & Panel
   ============================================ */
.quick-add-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 600;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.quick-add-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.quick-add-panel {
    background: var(--pico-background-color, #fff);
    border-radius: 1rem 1rem 0 0;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.quick-add-overlay.open .quick-add-panel {
    transform: translateY(0);
}

.quick-add-panel h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.quick-add-panel .close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--pico-muted-color, #6c757d);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.quick-add-panel .close-btn:active {
    background: rgba(0, 0, 0, 0.08);
}

/* ============================================
   Mobile / Desktop Visibility Utilities
   ============================================ */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }
}

/* ============================================
   Quick-Sell Dialog Polish
   ============================================ */
dialog#quick-sell-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* ============================================
   Enhanced Inventory Mobile Cards
   ============================================ */
.inv-mobile-card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.inv-mobile-card-stats {
    background: transparent;
}

.inv-mobile-card-stat {
    background: var(--pico-card-background-color, #f4f5f7);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.inv-mobile-card .sell-btn-mobile {
    transition: background 0.15s ease, transform 0.1s ease;
    letter-spacing: 0.02em;
}

/* ============================================
   General Page Polish
   ============================================ */

/* Smooth page title styling */
h1,
h2 {
    letter-spacing: -0.01em;
}

/* Brand accent for links */
a[role="button"].outline {
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

a[role="button"].outline:hover {
    background: rgba(249, 99, 2, 0.08);
}

/* Better table styling on desktop */
@media (min-width: 769px) {
    .inv-desktop-table table th {
        position: sticky;
        top: 0;
        background: var(--pico-background-color, #fff);
        z-index: 2;
        border-bottom: 2px solid var(--pico-muted-border-color, #dee2e6);
    }

    .inv-desktop-table table tr:hover {
        background: rgba(249, 99, 2, 0.03);
    }
}

/* Scroll hint on overflow tables */
.inv-desktop-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Sticky Save Bar (Marketplace Detail) --- */
@media (max-width: 768px) {
    .sticky-save-bar {
        position: sticky;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        background: var(--color-surface, #fff);
        padding: 0.6rem var(--space-md, 1rem);
        border-top: 1px solid var(--color-border, #dee2e6);
        z-index: 100;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    }

    .sticky-save-bar button {
        width: 100%;
        font-size: 1rem;
        padding: 0.7rem;
    }
}

/* --- POS Cart Mobile Cards --- */
@media (max-width: 600px) {
    .pos-cart-row-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.6rem;
        border: 1px solid var(--color-border, #dee2e6);
        border-radius: var(--pico-border-radius, 8px);
        margin-bottom: 0.5rem;
        background: var(--color-surface-raised, #f8f9fa);
        position: relative;
    }

    .pos-cart-row-mobile .cart-row-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .pos-cart-row-mobile .cart-sku {
        font-weight: 700;
        font-size: 1rem !important;
        border: none;
        background: transparent;
        padding: 0 !important;
        color: var(--color-brand, #f96302);
    }

    .pos-cart-row-mobile .cart-remove-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }

    .pos-cart-row-mobile .cart-desc {
        font-size: 0.9rem !important;
        border: none;
        background: transparent;
        padding: 0 !important;
        color: var(--color-text-secondary, #6c757d);
    }

    .pos-cart-row-mobile .cart-bottom-row {
        display: grid;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }

    .pos-cart-row-mobile .cart-qty,
    .pos-cart-row-mobile .cart-price {
        font-size: 16px !important;
        padding: 0.5rem !important;
    }

    /* Hide desktop cart grid */
    .pos-desktop-cart {
        display: none !important;
    }

    /* Show mobile cart */
    .pos-mobile-cart {
        display: block !important;
    }
}

@media (min-width: 601px) {
    .pos-mobile-cart {
        display: none !important;
    }
}

/* --- Photo Upload Improvements --- */
@media (max-width: 768px) {
    .photo-recent-models {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .photo-model-chip {
        flex-shrink: 0;
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem 0.75rem;
        border-radius: var(--pico-border-radius, 8px);
        border: 2px solid var(--color-border, #dee2e6);
        background: var(--color-surface-raised, #f8f9fa);
        cursor: pointer;
        min-width: 80px;
        text-align: center;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.15s ease, transform 0.1s ease;
    }

    .photo-model-chip:active {
        transform: scale(0.95);
    }

    .photo-model-chip.selected {
        border-color: var(--color-brand, #f96302);
        background: var(--color-brand-light, #fff3eb);
    }

    .photo-model-chip .model-name {
        font-weight: 700;
        font-size: 0.85rem;
        color: var(--color-text, #212529);
    }

    .photo-model-chip .model-count {
        font-size: 0.7rem;
        color: var(--color-text-secondary, #6c757d);
        margin-top: 0.1rem;
    }

    /* Camera as hero button */
    .capture-row .camera-hero-btn {
        background: var(--color-brand, #f96302) !important;
        color: #fff !important;
        border-color: var(--color-brand, #f96302) !important;
        font-weight: 700;
        font-size: 1.05rem;
    }

    .capture-row .camera-hero-btn:active {
        background: var(--color-brand-hover, #e55a00) !important;
        transform: scale(0.97);
    }

    /* Upload progress bar */
    .upload-progress {
        margin: 0.5rem 0;
    }

    .upload-progress progress {
        width: 100%;
        height: 8px;
        border-radius: 4px;
    }

    .upload-progress .upload-status-text {
        font-size: 0.8rem;
        color: var(--color-text-secondary, #6c757d);
        margin-top: 0.2rem;
    }
}

/* --- Photo Thumbnail Preview --- */
.photo-thumb-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.photo-thumb-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border, #dee2e6);
}

.photo-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb-item .photo-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* --- Quick-Add Modal Enhancements --- */
@media (max-width: 768px) {
    .qa-search-wrap {
        position: relative;
        margin-bottom: 0.5rem;
    }

    .qa-search-results {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        max-height: 200px;
        overflow-y: auto;
        background: var(--color-surface, #fff);
        border: 1px solid var(--color-border, #dee2e6);
        border-radius: 0 0 8px 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        z-index: 10;
    }

    .qa-search-hit {
        padding: 0.6rem 0.75rem;
        border-bottom: 1px solid var(--color-border, #dee2e6);
        cursor: pointer;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }

    .qa-search-hit:active {
        background: var(--color-brand-light, #fff3eb);
    }

    .qa-hot-items {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        margin-bottom: 0.6rem;
    }

    .qa-hot-chip {
        padding: 0.4rem 0.7rem;
        border-radius: 999px;
        border: 2px solid var(--color-brand, #f96302);
        background: transparent;
        color: var(--color-brand, #f96302);
        font-weight: 700;
        font-size: 0.85rem;
        cursor: pointer;
        min-height: 36px;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.15s, color 0.15s;
    }

    .qa-hot-chip:active {
        background: var(--color-brand, #f96302);
        color: #fff;
        transform: scale(0.95);
    }

    .qa-item-preview {
        padding: 0.5rem;
        background: var(--color-surface-raised, #f8f9fa);
        border-radius: 6px;
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
    }
}

/* --- Bottom Nav Search Icon --- */
@media (max-width: 768px) {
    .mobile-search-btn {
        background: none;
        border: none;
        color: var(--color-nav-text, #fff);
        cursor: pointer;
        padding: 0.4rem;
        display: flex;
        align-items: center;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
}

/* --- Listings One-by-One: Mark Posted --- */
.listing-action-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.listing-action-bar>* {
    flex: 1;
    min-width: 0;
    text-align: center;
}

@media (max-width: 600px) {
    .listing-action-bar {
        flex-direction: column;
    }

    .listing-action-bar>* {
        width: 100%;
    }
}

/* --- More Menu Favorites Section --- */
.more-menu-favorites {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem var(--space-lg, 1.5rem) 0.75rem;
}

.more-menu-fav-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--color-brand, #f96302);
    color: var(--color-brand, #f96302);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

.more-menu-fav-chip:active {
    background: var(--color-brand, #f96302);
    color: #fff;
}

/* ============================================
   MEDIUM BREAKPOINT (769px–1200px)
   Bridges the gap between full desktop and
   mobile — tighter padding, fewer columns.
   ============================================ */
@media (max-width: 1200px) and (min-width: 769px) {
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .components-summary {
        grid-template-columns: repeat(3, 1fr);
    }

    td, th {
        padding: 0.4rem 0.5rem;
        font-size: 0.88rem;
    }

    .hide-md {
        display: none !important;
    }
}

@media (max-width: 600px) {
    .components-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Payment Badge Classes
   (replace inline style="" on every badge)
   ============================================ */
.badge-cash {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-zelle {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-cashapp {
    background: #e8f5e9;
    color: #1b5e20;
}

.badge-venmo {
    background: #ede7f6;
    color: #4527a0;
}

.badge-paypal {
    background: #e3f2fd;
    color: #003087;
}

.badge-pending-status {
    background: #fff3cd;
    color: #856404;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
}

.badge-refund-status {
    background: #f8d7da;
    color: #721c24;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
}

/* ============================================
   Component Edit Dialog
   (replaces cramped inline Quick Edit form)
   ============================================ */
dialog#component-edit-dialog {
    border: none;
    border-radius: 0.75rem;
    padding: 0;
    max-width: 460px;
    width: 92vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    background: var(--pico-background-color, #fff);
}

dialog#component-edit-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.comp-edit-form {
    padding: 1.25rem;
}

.comp-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.comp-edit-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.comp-edit-item-info {
    background: var(--pico-card-background-color, #f8f9fa);
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
}

.comp-edit-item-info .model {
    font-weight: 700;
    font-size: 1rem;
    color: var(--pico-primary, #f96302);
}

.comp-edit-item-info .name {
    font-size: 0.85rem;
    color: var(--pico-muted-color, #6c757d);
    margin-top: 0.15rem;
}

.comp-edit-item-info .stock-info {
    display: flex;
    gap: 1rem;
    margin-top: 0.35rem;
    font-size: 0.8rem;
}

.comp-edit-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.comp-edit-fields label {
    margin: 0;
}

.comp-edit-fields label span {
    font-size: 0.85rem;
    font-weight: 600;
}

.comp-edit-notes {
    margin-bottom: 0.75rem;
}

.comp-edit-notes label {
    margin: 0;
}

.comp-edit-notes label span {
    font-size: 0.85rem;
    font-weight: 600;
}

.comp-edit-actions {
    display: flex;
    gap: 0.5rem;
}

.comp-edit-actions button {
    flex: 1;
}

/* ============================================
   Inventory Expandable Detail Rows
   ============================================ */
.inv-detail-row {
    display: none;
}

.inv-detail-row.open {
    display: table-row;
}

.inv-detail-row td {
    background: var(--color-surface-raised, #f8f9fa);
    border-top: none;
    padding: 0.5rem 0.75rem;
}

.inv-detail-grid {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.inv-detail-grid .detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.inv-detail-grid .detail-label {
    font-size: 0.7rem;
    color: var(--color-text-secondary, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inv-detail-grid .detail-value {
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.1rem;
}

.inv-row-toggle {
    cursor: pointer;
}

.inv-row-toggle:hover {
    background: rgba(249, 99, 2, 0.03);
}

.inv-toggle-chevron {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--color-text-secondary, #6c757d);
    transition: transform 0.15s ease;
    margin-right: 0.3rem;
}

.inv-row-toggle.expanded .inv-toggle-chevron {
    transform: rotate(90deg);
}

/* ============================================
   Compact Component Table (post-restructure)
   ============================================ */
.comp-pricing-cell {
    line-height: 1.4;
}

.comp-pricing-cell .cost {
    font-size: 0.82rem;
    color: var(--color-text-secondary, #6c757d);
}

.comp-pricing-cell .resale {
    font-weight: 600;
    color: var(--color-brand, #f96302);
}

/* Sales list inline thumb */
.sale-item-thumb {
    width: 36px;
    height: 28px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 0.35rem;
}

/* Sales merged payment column */
.sale-payment-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
}

/* Draft banner */
.draft-banner {
    border: 2px solid #f59e0b;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(245, 158, 11, 0.06);
}

.draft-banner h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

/* POS Favorites */
.fav-btn:hover {
    background: rgba(245, 158, 11, 0.1) !important;
}

.fav-star,
.fav-star-search {
    transition: color 0.15s, transform 0.15s;
}

.fav-star:hover,
.fav-star-search:hover {
    transform: scale(1.3);
}

/* Close button for dialogs (reusable) */
.dialog-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--pico-muted-color, #6c757d);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   POS Mobile UX Overhaul
   ============================================ */

/* --- Phase 1A: Sticky Cart Bar (mobile only) --- */
.pos-sticky-bar {
    display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
    .pos-sticky-bar {
        display: flex;
        position: fixed;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        z-index: 999;
        background: #fff;
        border-top: 2px solid #f96302;
        padding: 0.5rem 0.75rem;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
        gap: 0.5rem;
    }

    .pos-sticky-bar-info {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        min-width: 0;
    }

    .pos-sticky-bar-info #sticky-count {
        font-size: 0.75rem;
        color: #666;
    }

    .pos-sticky-bar-actions {
        display: flex;
        gap: 0.4rem;
        flex-shrink: 0;
    }

    .pos-sticky-draft-btn {
        background: transparent;
        border: 1px solid #ccc;
        border-radius: 6px;
        padding: 0.5rem 0.6rem;
        font-size: 1rem;
        cursor: pointer;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pos-sticky-submit-btn {
        background: #f96302;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 0.5rem 1rem;
        font-size: 1rem;
        font-weight: 700;
        cursor: pointer;
        min-height: 44px;
        white-space: nowrap;
    }

    .pos-sticky-submit-btn:active {
        background: #e55a00;
        transform: scale(0.97);
    }

    /* Hide desktop submit area on mobile */
    #desktop-submit-area {
        display: none !important;
    }

    /* Extra body padding for sticky bar */
    body {
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* --- Phase 1B: Collapsible Search Section --- */
.pos-search-collapse {
    margin-bottom: 0.5rem;
}

.pos-search-summary {
    display: none; /* hidden on desktop — content always visible */
}

@media (max-width: 768px) {
    .pos-search-summary {
        display: block;
        cursor: pointer;
        font-weight: 600;
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
        background: var(--pico-card-background-color, #f8f9fa);
        border: 1px solid var(--pico-muted-border-color, #ddd);
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
        -webkit-tap-highlight-color: transparent;
    }

    .pos-search-collapse:not([open]) .pos-search-summary {
        margin-bottom: 0;
    }
}

/* --- Phase 2A: Qty Stepper Buttons --- */
.qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--pico-muted-border-color, #ccc);
    border-radius: 8px;
    overflow: hidden;
}

.qty-stepper .cart-qty {
    border: none !important;
    border-radius: 0 !important;
    width: 3rem !important;
    text-align: center !important;
    font-size: 1.1rem !important;
    padding: 0.4rem 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield;
}

.qty-stepper .cart-qty::-webkit-inner-spin-button,
.qty-stepper .cart-qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-stepper-btn {
    background: var(--pico-card-background-color, #f0f0f0);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    margin: 0;
}

.qty-stepper-btn:active {
    background: #ddd;
}

/* --- Phase 2C: Price Override Toast --- */
.pos-price-toast {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 95vw;
    animation: pos-toast-slide-in 0.3s ease;
}

.pos-price-toast button {
    background: transparent;
    border: 1px solid #2e7d32;
    color: #2e7d32;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

@keyframes pos-toast-slide-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Phase 3A: Cost/Margin Row --- */
.cart-row-margin {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    opacity: 0.85;
}

/* --- Phase 3B: Low Stock Badge --- */
.pos-low-stock-badge {
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    grid-column: 1 / -1;
}

/* --- Phase 3C: Sticky Bar Flash Animation --- */
@keyframes pos-flash-green {
    0%   { background: #fff; }
    30%  { background: #e8f5e9; }
    100% { background: #fff; }
}

.pos-sticky-flash {
    animation: pos-flash-green 0.4s ease;
}

/* --- Phase 4C: Autosave Restore Banner --- */
.pos-autosave-banner {
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* ============================================
   GLOBAL MOBILE UX — Reusable Patterns
   ============================================ */

/* --- Mobile Table → Card Transformer --- */
.mobile-table-cards { display: none; }
@media (max-width: 768px) {
    .desktop-table-wrap { display: none !important; }
    .mobile-table-cards { display: block !important; }
}

.mtc-card {
    display: block;
    background: var(--pico-card-background-color, #fff);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    -webkit-tap-highlight-color: transparent;
}

.mtc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.mtc-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-brand, #f96302);
    text-decoration: none;
    line-height: 1.3;
}

.mtc-card-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-secondary, #6c757d);
}

.mtc-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    margin-bottom: 0.45rem;
}

.mtc-card-stats.four-col {
    grid-template-columns: repeat(4, 1fr);
}

.mtc-card-stat {
    text-align: center;
    padding: 0.2rem 0.15rem;
    background: var(--color-surface, #f8f9fa);
    border-radius: 6px;
}

.mtc-card-stat .label {
    display: block;
    font-size: 0.65rem;
    color: var(--color-text-secondary, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.mtc-card-stat .value {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.05rem;
}

.mtc-card-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.mtc-card-badges {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Mobile Filter Drawer (details/summary) --- */
.mobile-filter-drawer {
    margin-bottom: 0.75rem;
}

.mobile-filter-drawer > summary {
    display: none; /* Desktop: always open, summary hidden */
}

@media (max-width: 768px) {
    .mobile-filter-drawer > summary {
        display: block;
        cursor: pointer;
        font-weight: 600;
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
        background: var(--pico-card-background-color, #f8f9fa);
        border: 1px solid var(--pico-muted-border-color, #ddd);
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
        -webkit-tap-highlight-color: transparent;
        list-style: none;
    }

    .mobile-filter-drawer > summary::-webkit-details-marker { display: none; }

    .mobile-filter-drawer > summary::after {
        content: ' \25BE';
        font-size: 0.8em;
    }

    .mobile-filter-drawer[open] > summary::after {
        content: ' \25B4';
    }

    .mobile-filter-drawer:not([open]) > summary {
        margin-bottom: 0;
    }
}

/* --- Mobile Action Bar (sticky bottom) --- */
.mobile-action-bar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        z-index: 999;
        background: #fff;
        border-top: 2px solid var(--color-brand, #f96302);
        padding: 0.5rem 0.75rem;
        align-items: center;
        justify-content: center;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
        gap: 0.5rem;
    }

    .mobile-action-bar a {
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        text-decoration: none;
        font-weight: 700;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}

/* --- Filter Chips --- */
.filter-chips {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.filter-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--color-border, #dee2e6);
    background: var(--color-surface, #f8f9fa);
    color: var(--color-text, #333);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.filter-chip:hover {
    background: rgba(249, 99, 2, 0.08);
}

.filter-chip:active {
    transform: scale(0.95);
}

.filter-chip.active {
    background: var(--color-brand, #f96302);
    color: #fff;
    border-color: var(--color-brand, #f96302);
}

/* --- Loading Skeleton --- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 1em; margin-bottom: 0.5rem; }
.skeleton-card { height: 80px; margin-bottom: 0.6rem; border-radius: 8px; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-secondary, #6c757d);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.empty-state p { margin: 0.5rem 0; }
.empty-state a { color: var(--color-brand, #f96302); font-weight: 600; }

/* --- Scroll-to-Top Button --- */
.scroll-top-btn {
    display: none;
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 56px);
    right: 1rem;
    z-index: 998;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-brand, #f96302);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    -webkit-tap-highlight-color: transparent;
    align-items: center;
    justify-content: center;
}

.scroll-top-btn.visible {
    display: flex;
}

/* --- Nav Badge (bottom nav) --- */
.bottom-nav-item {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    background: #dc3545;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 999px;
    padding: 0 3px;
}

/* --- Reduced Motion --- */
/* ============================================
   Batch Action Bar (Sales Mark Paid)
   ============================================ */
#batch-action-bar {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 999;
    background: #fff;
    border-top: 2px solid #28a745;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
}

.sale-check {
    width: 20px;
    height: 20px;
    accent-color: var(--color-brand, #f96302);
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Sales List Mobile --- */
.sales-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 0.5rem;
    align-items: end;
}

@media (max-width: 768px) {
    .sales-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sales-filter-grid label:last-child {
        grid-column: 1 / -1;
    }

    .sales-summary-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

    .sales-summary-bar::-webkit-scrollbar { display: none; }
    .sales-summary-bar > div { flex-shrink: 0; }

    .draft-banner { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
    .draft-banner h3 { font-size: 1rem; margin-bottom: 0.35rem; }

    .sales-per-page { display: none; }
}

.sales-today-strip {
    background: rgba(249, 99, 2, 0.06);
    border-left: 3px solid var(--color-brand, #f96302);
    padding: 0.45rem 0.75rem;
    font-size: 0.88rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 0.75rem;
}

/* --- Sales Dashboard Mobile --- */
@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .sales-charts-row {
        grid-template-columns: 1fr !important;
    }

    #revenueTrendChart {
        max-height: 200px !important;
    }

    .sale-detail-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .sale-detail-actions a[role="button"],
    .sale-detail-actions button {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
        flex: 1 1 auto;
        min-width: fit-content;
        text-align: center;
    }

    .sale-detail-fields.grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.stat-card-active {
    border-color: #f96302 !important;
    box-shadow: 0 0 0 2px rgba(249, 99, 2, 0.25);
}

.dashboard-section {
    margin-bottom: 1.5rem;
}

.dashboard-section > summary {
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.dashboard-section > summary::-webkit-details-marker { display: none; }

.dashboard-section > summary::before {
    content: '\25B6 ';
    font-size: 0.7em;
    margin-right: 0.3rem;
    display: inline-block;
    transition: transform 0.15s ease;
}

.dashboard-section[open] > summary::before {
    transform: rotate(90deg);
}

/* --- Inventory Mobile Enhancements --- */
@media (max-width: 768px) {
    .inv-search-form {
        position: sticky;
        top: 0;
        z-index: 50;
        background: var(--pico-background-color, #fff);
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--color-border, #dee2e6);
    }

    .inv-filter-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding-bottom: 0.35rem;
        scrollbar-width: none;
    }

    .inv-filter-tabs::-webkit-scrollbar { display: none; }
    .inv-filter-tabs a { flex-shrink: 0; white-space: nowrap; }

    .inv-mobile-card-header img { max-width: 72px; max-height: 60px; }

    #quick-sell-dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        margin: 0;
        max-height: 85vh;
        overflow-y: auto;
    }

    #quick-sell-dialog::backdrop {
        background: rgba(0,0,0,0.4);
    }
}

/* --- Deals Mobile Enhancements --- */
@media (max-width: 768px) {
    .scanner-cards-row {
        flex-direction: column;
    }

    .scanner-cards-row > div { min-width: 100%; }

    .deals-header-actions {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0.35rem;
        scrollbar-width: none;
    }

    .deals-header-actions::-webkit-scrollbar { display: none; }
    .deals-header-actions a { flex-shrink: 0; font-size: 0.8rem; padding: 0.3rem 0.6rem; }

    .deal-rating-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.4rem;
    }

    .attention-table { font-size: 0.82rem; }
    .attention-table th { font-size: 0.75rem; }
    .attention-table .badge { font-size: 0.7rem; }

    .recent-sales-table tbody tr:nth-child(n+6) { display: none; }
}

.great-deal-fab {
    display: none;
}

@media (max-width: 768px) {
    .great-deal-fab {
        display: flex;
        position: fixed;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 10px);
        right: 1rem;
        z-index: 998;
        background: #155724;
        color: #fff;
        padding: 0.5rem 0.85rem;
        border-radius: 999px;
        font-size: 0.82rem;
        font-weight: 700;
        text-decoration: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
        align-items: center;
        gap: 0.3rem;
    }
}

/* --- Marketplace Mobile Enhancements --- */
@media (max-width: 768px) {
    .market-card { padding: 0.5rem; margin-bottom: 0.5rem; }

    .market-image-sm-pair .market-image-tile:nth-child(2) { display: none; }

    .priority-board-grid { grid-template-columns: 1fr !important; }
}

/* --- Print Enhancements --- */
@media print {
    .mobile-action-bar,
    .filter-chips,
    .scroll-top-btn,
    .mobile-filter-drawer > summary,
    .great-deal-fab { display: none !important; }

    .mtc-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================
   Inventory Inline Edit (tap-to-edit prices)
   ============================================ */
.inv-inline-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.inv-edit-value {
    cursor: pointer;
    border-bottom: 1px dashed var(--color-text-secondary, #999);
    padding-bottom: 1px;
}

.inv-edit-value:hover {
    color: var(--color-brand, #f96302);
}