        /* --- QUIET LUXURY DESIGN SYSTEM --- */
        :root { 
            --font-main: 'Outfit', sans-serif;
            --font-mono: 'JetBrains Mono', monospace;
            
            --bg-main: #f8f6f0; 
            --card-bg: #ffffff; 
            --card-border: #e6e2d8; 
            --input-bg: #f2efe9;
            
            --text-primary: #1c1a17;
            --text-secondary: #787367;
            
            --accent-gold: #b38f4e;
            --accent-gold-light: #d4af37;
            --accent-glow: rgba(179, 143, 78, 0.18);
            
            --radius-sm: 8px;
            --radius-md: 14px;
            --radius-lg: 22px;
            --radius-full: 9999px;

            --glass-bg: rgba(255, 253, 248, 0.88);
            --glass-border: rgba(255, 255, 255, 0.7);
            --glass-shadow: 0 16px 40px rgba(28, 26, 23, 0.06);
        }

        [data-theme="dark"] { 
            --bg-main: #0c0d10; 
            --card-bg: #14161d; 
            --card-border: #232734; 
            --input-bg: #1c1f2b;
            
            --text-primary: #f4f3ef;
            --text-secondary: #8e94a5;
            
            --accent-gold: #d4af37;
            --accent-gold-light: #ebd07b;
            --accent-glow: rgba(212, 175, 55, 0.22);

            --glass-bg: rgba(20, 22, 29, 0.88);
            --glass-border: rgba(255, 255, 255, 0.07);
            --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
        }

        /* Hide HTML5 Browser Spinner Arrows on Number Inputs */
        input[type=number]::-webkit-inner-spin-button, 
        input[type=number]::-webkit-outer-spin-button { 
            -webkit-appearance: none !important; 
            margin: 0 !important; 
        }
        input[type=number] {
            -moz-appearance: textfield !important;
        }

        /* Prevent Chrome/Webkit Autofill light-blue background color bleeding */
        input:-webkit-autofill,
        input:-webkit-autofill:hover, 
        input:-webkit-autofill:focus, 
        input:-webkit-autofill:active,
        input:-internal-autofill-selected {
            -webkit-box-shadow: 0 0 0 100px var(--input-bg) inset !important;
            -webkit-text-fill-color: var(--text-primary) !important;
            caret-color: var(--text-primary) !important;
            background-color: transparent !important;
            transition: background-color 5000s ease-in-out 0s;
        }

        * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
        
        body { 
            font-family: var(--font-main); 
            background: var(--bg-main); 
            color: var(--text-primary); 
            padding-bottom: 110px; 
            transition: background 0.3s ease, color 0.3s ease; 
            overscroll-behavior: none;
            min-height: 100vh;
        }

        /* --- LUXURY STICKY HEADER --- */
        .app-header { 
            background: var(--glass-bg); 
            backdrop-filter: blur(20px); 
            -webkit-backdrop-filter: blur(20px);
            padding: max(16px, env(safe-area-inset-top)) 24px 14px 24px;
            position: sticky; top: 0; z-index: 100; 
            border-bottom: 1px solid var(--glass-border); 
            display: flex; justify-content: space-between; align-items: center; 
            box-shadow: 0 4px 20px rgba(0,0,0,0.02);
        }
        
        .brand-logo-group { display: flex; align-items: center; gap: 12px; }
        .logo-crest { 
            width: 36px; height: 36px; border-radius: 12px; 
            background: linear-gradient(135deg, #1c1a17, #3b362e);
            color: var(--accent-gold);
            display: flex; align-items: center; justify-content: center;
            font-weight: 900; font-size: 0.95rem;
            border: 1px solid var(--accent-gold);
            box-shadow: 0 4px 12px var(--accent-glow);
        }
        [data-theme="dark"] .logo-crest {
            background: linear-gradient(135deg, #2a251b, #14161d);
        }

        .app-title { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px; text-transform: uppercase; }
        .app-subtitle { font-size: 0.65rem; color: var(--accent-gold); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; }

        .theme-btn {
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            padding: 8px 16px; border-radius: var(--radius-full);
            cursor: pointer; color: var(--text-primary);
            font-weight: 700; font-size: 0.78rem;
            transition: transform 0.15s ease;
            white-space: nowrap;
        }
        .theme-btn:active { transform: scale(0.95); }

        .header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

        /* Narrow phones: logo + title + 3 header buttons never fit on one line no
           matter how small the buttons get — so stop trying. Wrap the header and
           give the action buttons their own full-width row underneath instead of
           letting any of them clip off the right edge of the screen. */
        @media (max-width: 480px) {
            .app-header { flex-wrap: wrap; padding-left: 14px; padding-right: 14px; row-gap: 8px; }
            .brand-logo-group { gap: 8px; min-width: 0; }
            .brand-logo-group img { width: 34px !important; height: 34px !important; flex-shrink: 0; }
            .app-title { font-size: 0.92rem; }
            .app-subtitle { font-size: 0.56rem; letter-spacing: 0.8px; white-space: normal; line-height: 1.25; }
            .header-actions { width: 100%; justify-content: flex-end; gap: 6px; }
            .theme-btn { padding: 7px 10px; font-size: 0.68rem; }
        }

        /* --- SEGMENTED MASTER NAV (SCAN / STUDIO / INVENTORY) --- */
        .nav-wrapper {
            padding: 16px 20px 0 20px;
            max-width: 720px;
            margin: 0 auto;
        }
        .segmented-nav {
            display: flex;
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            padding: 4px;
            border-radius: var(--radius-full);
        }
        .nav-tab {
            flex: 1;
            padding: 11px 12px;
            border: none;
            border-radius: var(--radius-full);
            background: transparent;
            color: var(--text-secondary);
            font-family: var(--font-main);
            font-weight: 700;
            font-size: 0.82rem;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
            text-align: center;
            white-space: nowrap;
        }
        .nav-tab.active {
            background: var(--card-bg);
            color: var(--accent-gold);
            box-shadow: 0 4px 14px rgba(0,0,0,0.06);
        }
        .nav-tab-short { display: none; }

        /* Narrow phones: full labels ("Scanner / Decode") wrap to 2 lines and look broken, so swap in compact labels and tighten spacing instead */
        @media (max-width: 420px) {
            .nav-tab { padding: 10px 4px; font-size: 0.7rem; }
            .nav-tab-full { display: none; }
            .nav-tab-short { display: inline; }
        }

        /* --- CONTAINER --- */
        .container { 
            padding: 16px 20px; 
            max-width: 720px; 
            margin: 0 auto; 
        }

        .tab-panel { display: none; }
        .tab-panel.active { display: flex; flex-direction: column; gap: 16px; animation: slideUp 0.25s ease; }

        @keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

        /* --- CARD STYLING --- */
        .card { 
            background: var(--card-bg); 
            border: 1px solid var(--card-border); 
            border-radius: var(--radius-lg); 
            padding: 20px; 
            box-shadow: var(--glass-shadow);
            position: relative;
            z-index: 1;
        }
        .card:focus-within,
        .card.has-open-dropdown {
            z-index: 999 !important;
        }
        
        .section-header {
            font-size: 0.72rem;
            text-transform: uppercase;
            color: var(--text-secondary);
            font-weight: 800;
            margin-bottom: 14px;
            letter-spacing: 1.2px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            row-gap: 4px;
        }

        /* --- WIZARD STEPPER (COMPACT NO-SCROLL STUDIO) --- */
        .wizard-stepper {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            border-radius: var(--radius-md);
            padding: 6px;
            margin-bottom: 14px;
        }
        .step-pill {
            flex: 1;
            text-align: center;
            padding: 8px 6px;
            border-radius: 10px;
            font-size: 0.75rem;
            font-weight: 800;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }
        .step-pill.active {
            background: var(--accent-gold);
            color: #ffffff;
            box-shadow: 0 4px 12px var(--accent-glow);
        }
        .step-pill-short { display: none; }
        .footer-save-short { display: none; }

        /* Narrow phones: "1. Garment & Brand" etc. wrap to 2 lines, so swap in compact labels */
        @media (max-width: 420px) {
            .step-pill { padding: 8px 3px; font-size: 0.66rem; }
            .step-pill-full { display: none; }
            .step-pill-short { display: inline; }
        }

        /* Narrow phones: "SAVE TO STOCK" no longer fits the footer button alongside qty/rate boxes */
        @media (max-width: 400px) {
            .footer-save-full { display: none; }
            .footer-save-short { display: inline; }
        }

        .step-pane { display: none; }
        .step-pane.active { display: flex; flex-direction: column; gap: 14px; animation: fadeIn 0.2s ease; }

        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        @keyframes modalSlideUp { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

        #confirmModalAutoVariantBtn:hover { background: rgba(16, 185, 129, 0.12) !important; }
        #confirmModalAutoVariantBtn:active { transform: scale(0.97); }

        /* --- TILES & SELECTION BUTTONS --- */
        .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
        .grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
        .grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

        @media (max-width: 480px) {
            .grid-4 { grid-template-columns: repeat(2, 1fr); }
            .grid-3 { grid-template-columns: repeat(2, 1fr); }
        }

        .tile-btn { 
            background: var(--input-bg); 
            border: 1.5px solid var(--card-border); 
            padding: 14px 8px; 
            text-align: center; 
            font-size: 0.85rem; 
            font-weight: 700; 
            border-radius: var(--radius-md); 
            cursor: pointer; 
            color: var(--text-primary); 
            transition: all 0.2s ease; 
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
        }
        .tile-btn:active { transform: scale(0.96); }
        .tile-btn.selected { 
            background: var(--card-bg);
            border-color: var(--accent-gold); 
            color: var(--accent-gold) !important; 
            box-shadow: 0 4px 16px var(--accent-glow);
            font-weight: 800;
        }
        .tile-sub { font-size: 0.65rem; color: var(--text-secondary); font-weight: 600; }
        .tile-btn.selected .tile-sub { color: var(--accent-gold); }

        select, input { 
            width: 100%; 
            padding: 14px 16px; 
            border-radius: var(--radius-md); 
            border: 1.5px solid var(--card-border); 
            background: var(--input-bg); 
            color: var(--text-primary); 
            font-family: var(--font-main);
            font-size: 0.92rem; 
            font-weight: 700;
            appearance: none;
            transition: border-color 0.2s ease;
        }
        select:focus, input:focus { outline: none; border-color: var(--accent-gold); }

        /* --- COLOR SWATCH GRID --- */
        .color-filter-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
        .chip { 
            padding: 6px 14px; border-radius: var(--radius-full); 
            border: 1px solid var(--card-border); background: var(--input-bg); 
            font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: 0.2s; color: var(--text-secondary); 
        }
        .chip.active { background: var(--accent-gold); color: white; border-color: var(--accent-gold); }

        .colors-grid { 
            display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 10px;
            max-height: 160px; overflow-y: auto; padding: 2px; 
        }
        .color-box { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
        .color-dot { 
            width: 42px; height: 42px; border-radius: 14px; 
            border: 2px solid var(--card-border); 
            transition: transform 0.2s ease, border-color 0.2s ease;
            margin-bottom: 4px;
        }
        .color-box.selected .color-dot { 
            box-shadow: 0 0 0 3px var(--accent-gold); 
            transform: scale(1.1); 
        }
        .color-txt { font-size: 0.65rem; font-weight: 700; color: var(--text-secondary); text-align: center; }
        .color-box.selected .color-txt { color: var(--accent-gold); font-weight: 800; }

        /* --- SCANNER & CAMERA HERO --- */
        .scan-card {
            background: linear-gradient(135deg, rgba(179,143,78,0.07), rgba(212,175,55,0.02));
            border: 1px solid var(--card-border);
            border-radius: var(--radius-lg);
            padding: 18px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .scan-primary-btn {
            height: 60px;
            font-size: 1.05rem;
            font-weight: 800;
            gap: 10px;
        }
        .scan-secondary-row {
            display: flex;
            gap: 10px;
        }
        .scan-secondary-row .btn-outline {
            flex: 1;
            padding: 11px 8px;
            font-size: 0.85rem;
            height: 44px;
        }

        .btn-gold {
            background: linear-gradient(135deg, var(--accent-gold), #d4af37);
            color: #ffffff;
            border: none;
            padding: 12px 18px;
            min-height: 48px;
            box-sizing: border-box;
            border-radius: var(--radius-full);
            font-size: 0.92rem;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            box-shadow: 0 6px 20px var(--accent-glow);
            cursor: pointer;
            transition: transform 0.15s ease;
            width: 100%;
            text-align: center;
            line-height: 1.25;
        }
        .btn-gold:active { transform: scale(0.96); }

        .btn-outline {
            background: var(--card-bg);
            color: var(--text-primary);
            border: 1.5px solid var(--card-border);
            padding: 12px 16px;
            min-height: 48px;
            box-sizing: border-box;
            border-radius: var(--radius-full);
            font-size: 0.92rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            cursor: pointer;
            width: 100%;
            text-align: center;
            line-height: 1.25;
        }

        .stock-action-row { display: flex; gap: 10px; margin-top: 16px; }
        @media (max-width: 380px) {
            .stock-action-row { flex-direction: column; }
        }

        /* --- FUZZY SEARCH DROPDOWN MENU --- */
        .fuzzy-select-container {
            position: relative;
            width: 100%;
            z-index: 10;
        }
        .fuzzy-select-container:focus-within,
        .fuzzy-select-container.dropdown-open {
            z-index: 999 !important;
        }

        /* Shared visual cue for any "pick one" field that isn't the searchable
           fuzzy-dropdown system (a plain native <select> like Color Family, or a
           readonly click-to-open input like Units) — the global
           `select { appearance: none }` reset above strips a native select's
           own arrow, and a plain readonly input has no dropdown affordance at
           all, so both need this gold chevron added back explicitly. */
        /* Compound selector (not just .dropdown-picker) so this reliably beats
           .fuzzy-search-input's `background` shorthand below regardless of
           source order — a single-class selector here would tie on specificity
           and silently lose (background shorthand resets background-image). */
        .fuzzy-search-input.dropdown-picker {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23b38f4e'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 14px center;
            background-size: 13px;
            padding-right: 38px;
            cursor: pointer;
        }

        .fuzzy-search-input {
            width: 100%;
            padding: 11px 14px;
            border-radius: var(--radius-md);
            border: 1.5px solid var(--card-border);
            background: var(--input-bg);
            color: var(--text-primary);
            font-size: 0.9rem;
            font-weight: 700;
            outline: none;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            box-sizing: border-box;
        }
        .fuzzy-search-input:focus {
            border-color: var(--accent-gold);
            box-shadow: 0 0 0 3px var(--accent-glow);
        }

        .fuzzy-dropdown-menu {
            display: none;
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            right: 0;
            background: var(--card-bg);
            border: 1.5px solid var(--accent-gold);
            border-radius: var(--radius-md);
            max-height: 220px;
            overflow-y: auto;
            z-index: 1000 !important;
            box-shadow: 0 12px 36px rgba(0,0,0,0.45);
            padding: 6px;
            scrollbar-width: thin;
            scrollbar-color: var(--accent-gold) transparent;
        }
        .fuzzy-dropdown-menu.open {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        /* CUSTOM LUXURY ROUNDED SLIM SCROLLBARS */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        ::-webkit-scrollbar-track {
            background: transparent;
            border-radius: 999px;
        }
        ::-webkit-scrollbar-thumb {
            background: rgba(212, 175, 55, 0.4);
            border-radius: 999px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--accent-gold);
        }

        .fuzzy-menu-item {
            padding: 10px 12px;
            border-radius: var(--radius-md);
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.15s ease;
        }
        .fuzzy-menu-item:hover,
        .fuzzy-menu-item.highlighted {
            border-color: var(--accent-gold);
            background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(179, 143, 78, 0.35));
        }
        .fuzzy-menu-item.selected {
            background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(179, 143, 78, 0.32));
            border-color: var(--accent-gold);
            font-weight: 800;
        }

        .tile-btn:focus-visible,
        .color-box:focus-visible,
        .fuzzy-search-input:focus-visible {
            outline: 2px solid var(--accent-gold);
            outline-offset: 2px;
            border-color: var(--accent-gold);
        }
        .fuzzy-item-title {
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--text-primary);
        }
        .fuzzy-item-code {
            font-size: 0.72rem;
            font-weight: 800;
            color: var(--accent-gold);
            font-family: var(--font-mono);
            background: rgba(212, 175, 55, 0.15);
            padding: 2px 8px;
            border-radius: 10px;
        }

        /* --- DECODED DISPLAY --- */
        .digit-numpad {
            width: 100%;
            padding: 11px 14px;
            border-radius: var(--radius-md);
            border: 1.5px solid var(--card-border);
            background: var(--input-bg);
            color: var(--accent-gold);
            font-family: var(--font-mono);
            font-size: 1.2rem;
            font-weight: 800;
            text-align: center;
            letter-spacing: 3px;
        }
        .digit-numpad:focus { outline: none; border-color: var(--accent-gold); }

        .spec-grid {
            display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px;
        }
        .spec-pill {
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            padding: 9px 10px;
            border-radius: var(--radius-md);
            display: flex; flex-direction: column; gap: 2px;
            opacity: 1;
            transition: opacity 0.2s ease;
        }
        .spec-pill.pending { opacity: 0.4; }
        .spec-label { font-size: 0.6rem; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.6px; }
        /* DIGIT BREAKDOWN MAP STYLES */
        .digit-breakdown-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }
        @media (max-width: 600px) {
            .digit-breakdown-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 6px;
            }
        }
        @media (max-width: 380px) {
            .digit-breakdown-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        .breakdown-card {
            background: var(--input-bg);
            border-radius: 10px;
            padding: 8px 4px;
            text-align: center;
            border: 1.5px solid var(--card-border);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            transition: transform 0.15s ease;
        }
        .breakdown-card:hover {
            transform: translateY(-2px);
        }
        .breakdown-label {
            font-size: 0.58rem;
            font-weight: 900;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .breakdown-code {
            font-family: var(--font-mono);
            font-size: 1.1rem;
            font-weight: 900;
            padding: 1px 6px;
            border-radius: 6px;
        }
        .breakdown-name {
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        /* BARCODE RENDER CARD & CENTERING */
        .barcode-box {
            background: white; border-radius: var(--radius-md); padding: 16px;
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
            margin-top: 12px; border: 1px solid #e2e8f0; text-align: center;
        }
        #qrCanvas, #qrCanvasDesk {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 100%;
            margin: 6px auto;
            text-align: center;
        }
        #qrCanvas img, #qrCanvasDesk img {
            display: block;
            margin: 0 auto;
        }
        #qrCanvas canvas, #qrCanvasDesk canvas {
            margin: 0 auto;
        }
        #barcodeCanvas, #barcodeCanvasDesk {
            display: block !important;
            margin: 0 auto !important;
            max-width: 100% !important;
        }
        /* GPU RENDERING & SPEED OPTIMIZATIONS */
        * { -webkit-tap-highlight-color: transparent; }
        .tile-btn, .fuzzy-menu-item, .breakdown-card { contain: style; }
        .step-pane, .tab-panel, .card { overflow: visible !important; }
        .barcode-box svg, #barcodeCanvas, #barcodeCanvasDesk, #customBarcodeCanvas { max-width: 100% !important; height: 46px !important; display: block !important; margin: 0 auto !important; }

        /* FLOATING FOOTER BAR (MOBILE GLASS PILL) */
        .footer-bar { 
            position: fixed; bottom: 10px; left: 10px; right: 10px; 
            background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--glass-border); border-radius: 16px;
            padding: 8px 10px; 
            display: flex; flex-direction: column; gap: 4px; 
            box-shadow: var(--glass-shadow); 
            z-index: 90;
        }
        .sku-code-bar { 
            font-family: var(--font-mono); font-size: 0.88rem; font-weight: 800; 
            color: var(--accent-gold); letter-spacing: 1px;
        }
        .footer-row { display: flex; gap: 6px; align-items: center; width: 100%; height: 42px; }

        .stock-batch-panel {
            display: flex; flex-direction: column; gap: 10px;
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: var(--radius-md);
            padding: 14px;
        }
        .stock-batch-label {
            font-size: 0.66rem; font-weight: 800; color: var(--accent-gold);
            text-transform: uppercase; letter-spacing: 1.2px;
        }
        .batch-controls-row {
            display: flex; align-items: stretch;
            background: var(--input-bg); border-radius: var(--radius-md);
            border: 1.5px solid var(--card-border); box-sizing: border-box;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }
        .batch-controls-row:focus-within {
            border-color: var(--accent-gold);
            box-shadow: 0 0 0 3.5px var(--accent-glow);
        }
        .batch-field {
            display: flex; flex-direction: column; justify-content: center;
            flex: 1; min-width: 0; padding: 8px 14px; gap: 3px;
        }
        .batch-field-divider {
            width: 1px; margin: 10px 0; background: var(--card-border); flex-shrink: 0;
        }
        .qty-box-controls {
            display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 2px;
        }
        .qty-btn {
            width: 28px; height: 28px; border-radius: 50%;
            border: 1.5px solid var(--card-border);
            background: var(--card-bg); color: var(--accent-gold);
            font-size: 1rem; display: flex; align-items: center; justify-content: center;
            cursor: pointer; font-weight: 800; flex-shrink: 0; line-height: 1;
            transition: transform 0.1s ease, background 0.2s ease, border-color 0.2s ease;
        }
        .qty-btn:hover { border-color: var(--accent-gold); background: var(--accent-glow); }
        .qty-btn:active { transform: scale(0.9); background: var(--accent-glow); }
        .qty-input {
            flex: 1; width: 100%; min-width: 24px; border: none !important;
            background: transparent !important;
            text-align: center; font-size: 1.2rem; font-weight: 900;
            color: var(--text-primary) !important; padding: 0 2px; margin: 0; outline: none !important;
            font-family: var(--font-mono);
            box-shadow: none !important;
            appearance: textfield;
        }

        .rate-input-row {
            display: flex; align-items: center; width: 100%; margin-top: 2px;
        }
        .rate-symbol {
            font-weight: 900; color: var(--accent-gold); font-size: 1.2rem;
            margin-right: 6px; flex-shrink: 0;
        }
        .rate-input {
            width: 100%; border: none !important;
            background: transparent !important;
            font-weight: 900; font-size: 1.2rem;
            color: var(--text-primary) !important;
            outline: none !important; padding: 0 !important; margin: 0 !important; min-width: 0;
            box-shadow: none !important;
            appearance: textfield;
            font-family: var(--font-main);
        }
        .control-top-label {
            font-size: 0.62rem; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; line-height: 1;
        }

        .btn-save {
            width: 100%;
            background: linear-gradient(135deg, #b38f4e 0%, #d4af37 100%); 
            color: #000000; 
            border: none; border-radius: var(--radius-md); 
            font-weight: 900; font-size: 1.02rem; height: 60px; min-height: 60px;
            box-shadow: 0 6px 22px var(--accent-glow);
            cursor: pointer;
            white-space: nowrap;
            padding: 0 18px;
            letter-spacing: 1px;
            text-transform: uppercase;
            display: flex; align-items: center; justify-content: center;
            transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
        }
        .btn-save:hover {
            box-shadow: 0 8px 26px var(--accent-glow);
            background: linear-gradient(135deg, #c49f5e 0%, #e5bf47 100%);
        }
        .btn-save:active { transform: scale(0.97); }

        /* CAMERA MODAL */
        #readerModal {
            display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(0,0,0,0.92); z-index: 999; flex-direction: column;
            justify-content: space-between; backdrop-filter: blur(10px);
            box-sizing: border-box;
            /* iPhones need real clearance below the notch/Dynamic Island and above
               the home-indicator bar, or the header and Close button end up fighting
               the system status bar for the same pixels. */
            padding: max(20px, calc(env(safe-area-inset-top) + 14px)) 20px max(20px, calc(env(safe-area-inset-bottom) + 10px)) 20px;
        }
        #readerModal.open { display: flex; }
        #readerModal .reader-modal-header {
            display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
            gap: 10px; color: white; width: 100%; max-width: 450px; margin: 0 auto 10px auto;
        }
        #qr-reader { width: 100%; max-width: 450px; margin: auto; border-radius: 16px; overflow: hidden; }

        /* --- RESPONSIVE LAYOUT ENHANCEMENTS (DESKTOP & MOBILE) --- */
        @media (min-width: 768px) {
            .container, .nav-wrapper { 
                max-width: 820px !important; 
                margin: 0 auto !important; 
            }
            .footer-bar { 
                left: 50% !important; 
                right: auto !important; 
                transform: translateX(-50%) !important; 
                width: 100% !important; 
                max-width: 800px !important; 
            }
        }

        /* --- DESKTOP PROPER 2-COLUMN LAYOUT (>= 992px) --- */
        @media (min-width: 992px) {
            .app-header {
                max-width: 1180px;
                margin: 0 auto;
                border-radius: 0 0 24px 24px;
            }

            .container, .nav-wrapper { 
                max-width: 1180px !important; 
                margin: 0 auto !important; 
                padding-left: 24px !important;
                padding-right: 24px !important;
            }

            .segmented-nav {
                max-width: 600px;
                margin: 0 auto;
            }

            .studio-layout-grid {
                display: grid;
                grid-template-columns: 1fr 380px;
                gap: 24px;
                align-items: start;
            }

            .studio-right-pane {
                display: block;
                position: sticky;
                top: 80px;
            }

            .sticky-desktop-card {
                box-shadow: 0 12px 36px rgba(0,0,0,0.08);
                border: 1.5px solid var(--accent-gold);
            }

            .mobile-only-barcode {
                display: none !important;
            }

            /* Hide Bottom Floating Bar on Desktop since Sticky Right Pane has Stock Controls */
            .footer-bar {
                display: none !important;
            }

            .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
            .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 10px; }
            #sizeGrid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }

            .tile-btn {
                padding: 14px 8px;
                font-size: 0.88rem;
            }
            .tile-btn:hover {
                transform: translateY(-2px);
                border-color: var(--accent-gold);
            }

            .colors-grid {
                max-height: 220px;
                grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
                gap: 10px;
            }
        }

        @media (max-width: 991px) {
            .studio-layout-grid {
                display: block;
            }
            .studio-right-pane {
                display: none;
            }
            .footer-bar {
                display: flex !important;
            }
            .mobile-only-barcode {
                display: flex !important;
            }
        }

        /* --- PRINT OVERLAY & A4/A5 AUTO-ADJUSTMENT --- */
        #print-view { 
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
            background: #ffffff; color: #000000; z-index: 9999; overflow-y: auto; padding: 10px; box-sizing: border-box;
        }

        /* Screen Preview default styles for print element */
        .print-sheet {
            width: 100%; max-width: 100%; padding: 10px; margin: 0 auto; box-sizing: border-box; font-family: sans-serif; color: #000; background: #fff;
        }
        .print-header-title { font-size: 18pt; font-weight: 900; text-align: center; margin-bottom: 4pt; text-transform: uppercase; letter-spacing: 1pt; }
        .print-header-sub { font-size: 10pt; text-align: center; color: #333333; margin-top: 0; margin-bottom: 12pt; }
        .print-table { width: 100%; border-collapse: collapse; font-size: 10pt; margin-top: 8pt; table-layout: fixed; }
        .print-table th { background: #f1f5f9; font-weight: 900; padding: 6pt 4pt; border: 1pt solid #000000; text-transform: uppercase; font-size: 9pt; line-height: 1.1; word-break: break-word; }
        .print-table td { padding: 6pt 4pt; border: 1pt solid #000000; vertical-align: middle; font-size: 9.5pt; word-break: break-word; }
        .print-table tr { page-break-inside: avoid; }
        .sku-cell-code { font-family: monospace !important; font-weight: 900 !important; font-size: 10pt !important; letter-spacing: -0.3px !important; margin: 0 auto 2pt auto !important; text-align: center !important; white-space: nowrap !important; }
        .print-barcode-svg { width: 100% !important; max-width: 220px !important; height: 34px !important; display: block !important; margin: 0 auto !important; }
        .print-signatures { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; box-sizing: border-box; font-size: 10pt; font-weight: bold; margin-top: 24pt; page-break-inside: avoid; }
        .sign-line { margin-top: 24px; border-bottom: 1.5pt solid #000000; width: 180px; }

        @page {
            size: auto;
            margin: 6mm 8mm;
        }

        @media print { 
            html, body {
                background: #ffffff !important;
                color: #000000 !important;
                width: 100% !important;
                height: auto !important;
                margin: 0 !important;
                padding: 0 !important;
            }
            body > *:not(#print-view) { display: none !important; } 
            #print-view { 
                display: block !important; 
                position: relative !important; 
                top: 0 !important; left: 0 !important;
                width: 100% !important;
                padding: 0 !important; 
                margin: 0 !important;
                overflow: visible !important;
                background: #ffffff !important;
            } 
            .no-print { display: none !important; }

            /* --- A4 PRINT MEDIA QUERY (Width >= 170mm) --- */
            .print-sheet { padding: 8mm !important; }
            .print-header-title { font-size: 20pt !important; margin-bottom: 4pt !important; }
            .print-header-sub { font-size: 10pt !important; margin-bottom: 12pt !important; }
            .print-table { font-size: 10pt !important; margin-top: 10pt !important; }
            .print-table th { font-size: 9pt !important; padding: 6pt 4pt !important; }
            .print-table td { font-size: 10pt !important; padding: 6pt 4pt !important; }
            .sku-cell-code { font-size: 10.5pt !important; letter-spacing: -0.2px !important; margin-bottom: 2pt !important; white-space: nowrap !important; }
            .print-barcode-svg { max-width: 220px !important; height: 36px !important; }
            .print-signatures { font-size: 10pt !important; margin-top: 28pt !important; }
            .sign-line { margin-top: 28px !important; width: 200px !important; }
        }

        /* --- A5 PAPER RESPONSIVE PRINT MEDIA QUERY (Medium Sheet) --- */
        @media print and (max-width: 169.9mm) {
            .print-sheet { padding: 4mm !important; }
            .print-header-title { font-size: 14pt !important; margin-bottom: 3pt !important; }
            .print-header-sub { font-size: 8.5pt !important; margin-bottom: 8pt !important; }
            .print-table { font-size: 8.5pt !important; margin-top: 6pt !important; }
            .print-table th { font-size: 8pt !important; padding: 4pt 2pt !important; }
            .print-table td { font-size: 8.5pt !important; padding: 4pt 2pt !important; }
            .sku-cell-code { font-size: 8.5pt !important; letter-spacing: -0.4px !important; margin-bottom: 1pt !important; white-space: nowrap !important; }
            .print-barcode-svg { max-width: 160px !important; height: 26px !important; }
            .print-signatures { font-size: 8.5pt !important; margin-top: 18pt !important; }
            .sign-line { margin-top: 20px !important; width: 150px !important; }
        }

        /* --- A6 PAPER RESPONSIVE PRINT MEDIA QUERY (Compact Sheet) --- */
        @media print and (max-width: 119.9mm) {
            .print-sheet { padding: 2mm !important; }
            .print-header-title { font-size: 10.5pt !important; margin-bottom: 2pt !important; }
            .print-header-sub { font-size: 6.5pt !important; margin-bottom: 4pt !important; }
            .print-table { font-size: 6.5pt !important; margin-top: 4pt !important; }
            .print-table th { font-size: 6pt !important; padding: 2pt 1pt !important; }
            .print-table td { font-size: 6.5pt !important; padding: 2pt 1pt !important; }
            .sku-cell-code { font-size: 6.2pt !important; letter-spacing: -0.5px !important; margin-bottom: 1pt !important; white-space: nowrap !important; }
            .print-barcode-svg { max-width: 110px !important; height: 18px !important; }
            .print-signatures { font-size: 6.5pt !important; margin-top: 12pt !important; }
            .sign-line { margin-top: 14px !important; width: 110px !important; }
        }
