        :root {
            --glass-bg: rgba(30, 30, 45, 0.7);
            --glass-border: rgba(255, 255, 255, 0.1);
            --text-primary: #F5F5F7;
            --text-secondary: rgba(245, 245, 247, 0.6);
            --gold-glow: #FFD700;
            --gold-14k: #D4AF37;
            --gold-bright: #FFD700;
            --z-dropdown: 50;
            --z-sticky: 50;
            --sidebar-w: 260px;     /* ความกว้าง sidebar ตอนขยาย (≥768px) */
            --sidebar-w-rail: 72px; /* ความกว้าง sidebar ตอนย่อ rail (≥768px) */
            --z-modal: 100;
            --z-toast: 3000;
            --z-swal-above: 10050;
            color-scheme: dark;
        }

        .aurora-heading {
            color: var(--gold-bright);
            font-weight: 700;
            text-wrap: balance;
        }

        .aurora-metric {
            color: var(--gold-bright);
            font-weight: 700;
        }

        .aurora-heading-cyan { color: #38bdf8; font-weight: 700; }
        .aurora-heading-magenta { color: #D946A6; font-weight: 700; }
        .aurora-heading-purple { color: #D946A6; font-weight: 700; }

        .text-hint-ui {
            color: rgba(255, 248, 240, 0.55);
            font-size: 0.625rem;
            line-height: 1.45;
        }

        .text-label-muted {
            color: rgba(255, 248, 240, 0.72);
        }

        .create-order-advanced {
            margin-top: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 0.875rem;
            background: rgba(0, 0, 0, 0.12);
        }

        .create-order-advanced > summary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            padding: 0.65rem 0.75rem;
            font-size: 0.75rem;
            font-weight: 600;
            color: rgba(255, 248, 240, 0.85);
            cursor: pointer;
            list-style: none;
            user-select: none;
        }

        .create-order-advanced > summary::-webkit-details-marker { display: none; }

        .create-order-advanced > summary::after {
            content: '▾';
            font-size: 0.65rem;
            color: rgba(255, 248, 240, 0.45);
            transition: transform 0.2s ease-out;
        }

        .create-order-advanced:not([open]) > summary::after {
            transform: rotate(-90deg);
        }

        .create-order-advanced-body {
            padding: 0 0.75rem 0.75rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .btn-ai-split {
            background: rgba(212, 175, 55, 0.12);
            border: 1px solid rgba(212, 175, 55, 0.35);
            color: #FFD700;
        }

        .btn-ai-split:hover {
            background: rgba(212, 175, 55, 0.2);
        }

        .on-tint-green .label-muted { color: rgba(187, 247, 208, 0.85); }
        .on-tint-purple .label-muted { color: rgba(233, 213, 255, 0.85); }

        /* ⚡ Mobile Touch Optimization — ลบ 300ms tap delay ทั้งแอป */
        *, *::before, *::after {
            touch-action: manipulation;
        }

        body {
            background-color: #07070e;
            color: var(--text-primary);
            font-family: 'Thonburi', 'Sarabun', 'Noto Sans Thai', sans-serif;
            overflow-x: hidden;
            -webkit-tap-highlight-color: transparent;
            font-size: 14px;
            padding-top: 72px;
        }

        html {
            overflow-x: hidden;
            width: 100%;
            max-width: 100%;
            -webkit-text-size-adjust: 100%;
        }

        /* Mobile / Add to Home Screen — เลื่อนขึ้นลงอย่างเดียว ไม่ขยับซ้ายขวา (คืนพฤติกรรมก่อน redesign) */
        @media (max-width: 767px) {
            html {
                overscroll-behavior-x: none;
            }

            body {
                width: 100%;
                max-width: 100%;
                overscroll-behavior-x: none;
                touch-action: pan-y pinch-zoom;
            }

            #adminPanel,
            .view-section.active,
            #createOrderView,
            #createOrderView #orderForm,
            #quickAddOrderView,
            #quickAddOrderView #quickOrderForm,
            #replyRulesView,
            #lineCustomersView,
            #broadcastView,
            #manageLineBotView {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                overflow-x: hidden;
                box-sizing: border-box;
            }

            #createOrderView #orderForm > *,
            #quickAddOrderView #quickOrderForm > * {
                min-width: 0;
                max-width: 100%;
            }

            .subtabs-sticky {
                overflow: hidden;
                max-width: 100%;
            }

            .subtabs-sticky::before {
                left: 0;
                right: 0;
            }

            header,
            header .header-inner {
                max-width: 100%;
                overflow-x: hidden;
            }

            .header-nav {
                overflow-x: hidden;
                max-width: 100%;
            }

            #createOrderFooter {
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
        }

        @media (display-mode: standalone) {
            body {
                padding-top: calc(72px + env(safe-area-inset-top, 0px));
                padding-left: env(safe-area-inset-left, 0px);
                padding-right: env(safe-area-inset-right, 0px);
            }

            #createOrderFooter {
                padding-bottom: env(safe-area-inset-bottom, 0px);
            }
        }

        /* Background — ⚡ Static gradients (ไม่ใช้ animation/blur = ประหยัดพลังงานมาก!) */
        .aurora-blob {
            position: fixed;
            z-index: -1;
            opacity: 0.3;
            border-radius: 50%;
            contain: strict;
            will-change: auto;
        }

        /* ⚡ ซ่อน decorative blobs บน mobile เพื่อประหยัด GPU compositing layer */
        @media (max-width: 768px) {
            .aurora-blob {
                display: none !important;
            }
        }

        .blob-1 {
            top: -10%;
            left: -20%;
            width: 600px;
            height: 600px;
            background: radial-gradient(circle, #4a1d96 0%, transparent 70%);
        }

        .blob-2 {
            bottom: -10%;
            right: -20%;
            width: 500px;
            height: 500px;
            background: radial-gradient(circle, #BA4297 0%, transparent 70%);
        }

        .blob-3 {
            top: 40%;
            left: 20%;
            width: 400px;
            height: 400px;
            background: radial-gradient(circle, #2d5b9e 0%, transparent 70%);
            opacity: 0.3;
        }

        /* === ENERGY SAVING: Respect user's reduced motion preference === */
        @media (prefers-reduced-motion: reduce) {
            *,
            *::before,
            *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

        /* === ENERGY SAVING: Pause ALL animations when tab is hidden === */
        body.page-hidden,
        body.page-hidden *,
        body.page-hidden::before,
        body.page-hidden::after {
            animation-play-state: paused !important;
            animation: none !important;
        }

        /* === ENERGY SAVING: Pause decorative animations when user is idle === */
        body.user-idle::after,
        body.user-idle .aurora-blob {
            animation-play-state: paused !important;
            animation: none !important;
        }
        body.user-idle .loader-logo,
        body.user-idle .loader-logo.rotating,
        body.user-idle .loader-text,
        body.user-idle .success-checkmark,
        body.user-idle .swal2-custom-icon,
        body.user-idle .update-badge {
            animation-play-state: paused !important;
        }

        /* === ENERGY SAVING: ลด GPU load บนอุปกรณ์ไม่แรง === */

        /* Loader animations สำหรับมือถือ — เบากว่าเวป (ไม่มี drop-shadow) */
        @keyframes loader-breathe-lite {
            0%, 100% { transform: scale(0.93); opacity: 0.85; }
            50% { transform: scale(1.05); opacity: 1; }
        }
        @keyframes loader-text-fade {
            0%, 100% { opacity: 0.65; }
            50% { opacity: 1; }
        }

        @media (max-width: 768px), (hover: none) {
            .glass-panel.card-primary,
            .modal-overlay,
            .glass-btn,
            .update-badge {
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                background: rgba(15, 15, 30, 0.92) !important;
            }

            /* ⚡ ปิด ALL infinite animations บน mobile ประหยัดแบตเตอรี่สุดๆ */
            .success-checkmark,
            .swal2-custom-icon,
            .update-badge,
            .pulse-dot {
                animation: none !important;
            }

            /* ⚡ Loader บนมือถือ — ใช้ animation เบาๆ (ไม่มี drop-shadow GPU) */
            .loader-logo {
                animation: loader-breathe-lite 2.4s infinite ease-in-out !important;
                will-change: transform;
            }
            .loader-text {
                animation: loader-text-fade 2.4s infinite ease-in-out !important;
                will-change: opacity;
            }

            /* ⚡ ปิด hover transform บน touch (มือถือ hover ค้าง = GPU ทำงานตลอด) */
            .glass-panel.card-primary:hover {
                transform: none !important;
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
            }

            /* ⚡ ลด transition ที่ไม่จำเป็นบน mobile */
            .glass-panel.card-primary {
                transition: none !important;
            }
        }

        /* UI Components with Interactive Hover */
        .glass-panel.card-primary {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid var(--glass-border);
            border-radius: 1.5rem;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            contain: layout style;
            transition: box-shadow 0.3s ease, border-color 0.3s ease;
            position: relative;
            will-change: auto;
        }

        .glass-panel.card-primary:hover {
            transform: translateY(-3px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
            border-color: rgba(255, 255, 255, 0.2);
            background: rgba(255, 255, 255, 0.05);
        }

        /* Specific Z-Index for Stacking Context */
        .panel-customer {
            z-index: 30;
        }

        .panel-product {
            z-index: 20;
        }

        .panel-order {
            z-index: 25;
            position: relative;
        }

        .panel-ceremony {
            z-index: 15;
            position: relative;
        }

        .order-type-active {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(168, 85, 247, 0.15));
            border-color: rgba(139, 92, 246, 0.5);
            color: #c4b5fd;
            box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
        }
        /* วิธีชำระเงิน — แยกจาก order-type-active */
        .payment-active-transfer {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(37, 99, 235, 0.14));
            border-color: rgba(96, 165, 250, 0.55);
            color: #93c5fd;
            box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
        }

        .payment-active-cod {
            background: linear-gradient(135deg, rgba(34, 197, 94, 0.24), rgba(22, 163, 74, 0.16));
            border-color: rgba(74, 222, 128, 0.6);
            color: #86efac;
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.22);
        }

        .payment-idle {
            background: rgba(255, 255, 255, 0.05);
            border-color: rgba(255, 255, 255, 0.1);
            color: #9ca3af;
        }

        .payment-idle-transfer:hover {
            background: rgba(59, 130, 246, 0.1);
            border-color: rgba(96, 165, 250, 0.35);
            color: #93c5fd;
        }

        .payment-idle-cod:hover {
            background: rgba(34, 197, 94, 0.1);
            border-color: rgba(74, 222, 128, 0.35);
            color: #86efac;
        }

        #bankSelectorSection .form-label {
            color: #86efac;
        }

        #bankSelectorSection .themed-input:focus {
            border-color: rgba(74, 222, 128, 0.55);
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.18);
        }

        .themed-input {
            background: rgba(0, 0, 0, 0.25);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #fff;
            border-radius: 1rem;
            width: 100%;
            padding-top: 0.45rem;
            padding-bottom: 0.45rem;
            padding-left: 1rem;
            padding-right: 1rem;
            height: 40px;
            outline: none;
            transition: all 0.3s;
            /* ⚡ กัน iOS Safari auto-zoom เมื่อกด input — ต้อง >= 16px */
            font-size: max(16px, 0.9rem) !important;
        }
        /* ป้องกัน themed-input padding shorthand ทับ Tailwind pl-*/
        .themed-input.pl-10, .themed-input[class*=" pl-10"], .themed-input[class*="pl-10 "] { padding-left: 2.5rem !important; }
        .themed-input.pl-8  { padding-left: 2rem !important; }
        .themed-input.pl-3  { padding-left: 0.75rem !important; }
        .themed-input.pr-12 { padding-right: 3rem !important; }
        .themed-input.pr-10 { padding-right: 2.5rem !important; }

        .themed-input:focus {
            border-color: #E95384;
            background: rgba(0, 0, 0, 0.4);
            box-shadow: 0 0 15px rgba(233, 83, 132, 0.2);
        }

        .themed-input:focus-visible {
            outline: 2px solid var(--gold-bright);
            outline-offset: 2px;
        }

        .themed-input:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        textarea.themed-input {
            height: auto;
            min-height: 5.5rem;
            line-height: 1.4;
            padding-top: 0.75rem;
            padding-bottom: 0.75rem;
        }

        .form-label {
            display: block;
            margin-bottom: 0.4rem;
            font-size: 0.85rem;
            color: #FACC15;
            font-weight: 500;
        }

        .scheduled-time-container {
            background: rgba(139, 92, 246, 0.05);
            border: 1px solid rgba(139, 92, 246, 0.2);
            border-radius: 1rem;
            padding: 0.75rem;
            margin-top: 0.75rem;
        }
        .scheduled-time-label {
            font-size: 10px;
            color: #a78bfa;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            font-weight: 700;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .scheduled-time-display {
            font-size: 0.75rem;
            color: #d8b4fe;
            margin-top: 0.5rem;
            font-weight: 500;
            background: rgba(0,0,0,0.2);
            padding: 4px 8px;
            border-radius: 6px;
            display: inline-block;
        }

        /* Loading Screen Styles */
        .loader-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity 0.3s;
        }

        @keyframes spin-slow {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        @keyframes loader-breathe {
            0%, 100% {
                transform: scale(0.92);
                filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
            }
            50% {
                transform: scale(1.04);
                filter: drop-shadow(0 0 22px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 40px rgba(219, 39, 119, 0.25));
            }
        }

        @keyframes loader-text-shimmer {
            0%, 100% {
                opacity: 0.7;
                transform: scale(0.97);
                letter-spacing: 3px;
            }
            50% {
                opacity: 1;
                transform: scale(1.02);
                letter-spacing: 5px;
            }
        }

        .loader-logo {
            width: 100px;
            height: 100px;
            object-fit: contain;
            animation: loader-breathe 2.2s infinite ease-in-out;
        }

        .loader-text {
            margin-top: 16px;
            font-size: 1rem;
            font-weight: 600;
            letter-spacing: 0.12em;
            color: var(--gold-bright, #FFD700);
            display: inline-block;
        }

        @media (prefers-reduced-motion: no-preference) {
            .loader-text {
                animation: loader-text-pulse 2.2s infinite ease-out;
            }
        }

        @keyframes loader-text-pulse {
            0%, 100% { opacity: 0.85; }
            50% { opacity: 1; }
        }

        /* Custom SweetAlert2 */
        body:not(.swal2-toast-shown) div:where(.swal2-container) {
            background: rgba(0, 0, 0, 0.3) !important;
            backdrop-filter: blur(8px) !important;
            -webkit-backdrop-filter: blur(8px) !important;
            -webkit-backface-visibility: hidden;
            -webkit-transform: translate3d(0, 0, 0);
            backface-visibility: hidden;
            transform: translateZ(0);
        }

        /* ⚡ บน mobile: ปิด blur ของ SweetAlert เพื่อประหยัด GPU */
        @media (max-width: 768px), (hover: none) {
            body:not(.swal2-toast-shown) div:where(.swal2-container) {
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                background: rgba(0, 0, 0, 0.5) !important; /* ชดเชยด้วย opacity แทน */
            }
        }
        
        /* Toast ไม่มี blur background */
        body.swal2-toast-shown div:where(.swal2-container) {
            background: transparent !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            pointer-events: none !important;
        }
        
        body.swal2-toast-shown .swal2-toast {
            pointer-events: auto !important;
        }

        div:where(.swal2-container) div:where(.swal2-popup) {
            background: rgba(30, 30, 40, 0.9) !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            border: 1px solid rgba(255, 255, 255, 0.1) !important;
            border-radius: 1.5rem !important;
            padding: 1rem 0.85rem !important;
            width: 230px !important;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
        }

        /* SweetAlert above image picker modal */
        .swal-above-modal-container { z-index: var(--z-swal-above) !important; }
        .swal-above-modal { z-index: var(--z-swal-above) !important; }

        /* Modal without frame (transparent background) - for showSuccess */
        div:where(.swal2-container).transparent-popup div:where(.swal2-popup) {
            background: transparent !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            border: none !important;
            box-shadow: none !important;
        }

        div:where(.swal2-container).transparent-popup .swal2-title {
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 4px 20px rgba(0, 0, 0, 0.6) !important;
            font-size: 1.1rem !important;
        }

        /* Success Icon Animation */
        .success-icon-container {
            width: 80px;
            height: 80px;
            margin: 0 auto 15px;
            position: relative;
        }

        .success-checkmark {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #10B981 0%, #059669 100%);
            box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
            animation: success-pulse 1.5s ease-in-out infinite;
        }

        .success-checkmark i {
            font-size: 36px;
            color: white;
            animation: check-pop 0.4s ease-out 0.2s both;
        }

        @keyframes success-pulse {
            0%, 100% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.05); opacity: 0.9; }
        }

        @keyframes check-pop {
            0% { transform: scale(0); opacity: 0; }
            50% { transform: scale(1.3); }
            100% { transform: scale(1); opacity: 1; }
        }

        div:where(.swal2-container) .swal2-title {
            color: #fff !important;
            font-size: 0.95rem !important;
            font-weight: 600 !important;
            margin: 10px 0 5px !important;
        }

        div:where(.swal2-container) .swal2-html-container {
            color: #ccc !important;
            font-size: 0.8rem !important;
            margin: 0 !important;
        }

        .swal2-custom-icon {
            width: 56px !important;
            height: 56px !important;
            margin: 0 auto 10px !important;
            border: none !important;
            animation: golden-glow-pulse 3s infinite;
        }

        /* ปุ่มแยกสีตามประเภท - ค่าเริ่มต้น (สำหรับ Success/Info) */
        div:where(.swal2-container) button.swal2-confirm {
            background: linear-gradient(135deg, #22C55E, #16A34A) !important;
            border-radius: 50px !important;
            font-size: 0.8rem !important;
            padding: 8px 20px !important;
            box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4) !important;
            width: 100%;
            margin: 15px 0 0 !important;
            border: none !important;
            font-weight: 600 !important;
            transition: all 0.3s ease !important;
        }

        div:where(.swal2-container) button.swal2-confirm:hover {
            transform: translateY(-2px) !important;
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5) !important;
        }

        /* ปุ่มสีแดง สำหรับ Error */
        div:where(.swal2-container).swal2-icon-error button.swal2-confirm,
        div:where(.swal2-container) .swal2-popup.swal2-icon-error button.swal2-confirm {
            background: linear-gradient(135deg, #EF4444, #DC2626) !important;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4) !important;
        }

        div:where(.swal2-container).swal2-icon-error button.swal2-confirm:hover,
        div:where(.swal2-container) .swal2-popup.swal2-icon-error button.swal2-confirm:hover {
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5) !important;
        }

        /* ปุ่มสีเหลือง สำหรับ Warning */
        div:where(.swal2-container).swal2-icon-warning button.swal2-confirm,
        div:where(.swal2-container) .swal2-popup.swal2-icon-warning button.swal2-confirm {
            background: linear-gradient(135deg, #F59E0B, #D97706) !important;
            box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4) !important;
        }

        div:where(.swal2-container).swal2-icon-warning button.swal2-confirm:hover,
        div:where(.swal2-container) .swal2-popup.swal2-icon-warning button.swal2-confirm:hover {
            box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5) !important;
        }

        /* ปุ่มสีเขียว สำหรับ Success */
        div:where(.swal2-container).swal2-icon-success button.swal2-confirm,
        div:where(.swal2-container) .swal2-popup.swal2-icon-success button.swal2-confirm {
            background: linear-gradient(135deg, #22C55E, #16A34A) !important;
            box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4) !important;
        }

        div:where(.swal2-container).swal2-icon-success button.swal2-confirm:hover,
        div:where(.swal2-container) .swal2-popup.swal2-icon-success button.swal2-confirm:hover {
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5) !important;
        }

        /* ปุ่มสีฟ้า สำหรับ Info/Question */
        div:where(.swal2-container).swal2-icon-info button.swal2-confirm,
        div:where(.swal2-container).swal2-icon-question button.swal2-confirm,
        div:where(.swal2-container) .swal2-popup.swal2-icon-info button.swal2-confirm,
        div:where(.swal2-container) .swal2-popup.swal2-icon-question button.swal2-confirm {
            background: linear-gradient(135deg, #3B82F6, #2563EB) !important;
            box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4) !important;
        }

        div:where(.swal2-container).swal2-icon-info button.swal2-confirm:hover,
        div:where(.swal2-container).swal2-icon-question button.swal2-confirm:hover,
        div:where(.swal2-container) .swal2-popup.swal2-icon-info button.swal2-confirm:hover,
        div:where(.swal2-container) .swal2-popup.swal2-icon-question button.swal2-confirm:hover {
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5) !important;
        }

        div:where(.swal2-container) button.swal2-cancel,
        div:where(.swal2-container) button.swal2-deny {
            border-radius: 50px !important;
            font-size: 0.8rem !important;
            padding: 8px 20px !important;
            background: rgba(255, 255, 255, 0.1) !important;
            border: 1px solid rgba(255, 255, 255, 0.2) !important;
            font-weight: 600 !important;
            transition: all 0.3s ease !important;
        }

        div:where(.swal2-container) button.swal2-cancel:hover,
        div:where(.swal2-container) button.swal2-deny:hover {
            background: rgba(255, 255, 255, 0.15) !important;
            transform: translateY(-2px) !important;
        }

        .swal2-custom-icon {
            border: none !important;
            margin-bottom: 10px !important;
            filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.3));
        }

        /* ============== CSS สำหรับ Preview Modal ============== */
        .preview-modal-a6 {
            max-width: 90vw !important;
            width: 440px !important;
        }

        .shipping-summary-modal {
            max-width: 90vw !important;
            width: 320px !important;
        }

        .preview-modal-100x75 {
            max-width: 90vw !important;
            width: 450px !important;
        }

        .preview-modal-a6 .swal2-title,
        .preview-modal-100x75 .swal2-title {
            font-size: 1.1rem !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            gap: 0.5rem !important;
        }

        /* ============== CSS สำหรับปุ่มเลือกรูปแบบการพิมพ์ ============== */
        .print-choice-modal {
            max-width: 90vw !important;
            width: 380px !important;
        }

        .print-choice-btn {
            display: flex !important;
            flex-direction: column !important;
            align-items: center !important;
            gap: 0.25rem !important;
            padding: 0.75rem 1.25rem !important;
            border-radius: 1rem !important;
            font-weight: 500 !important;
            transition: all 0.2s ease !important;
        }

        .print-choice-btn i {
            font-size: 1.5rem !important;
        }

        .print-choice-btn span {
            font-size: 0.9rem !important;
        }

        .print-choice-btn small {
            font-size: 0.7rem !important;
            opacity: 0.7 !important;
        }

        @media (max-width: 768px) {
            .preview-modal-a6,
            .preview-modal-100x75 {
                width: 95vw !important;
            }
        }

        /* Mobile Optimization */
        /* Toast Notification for Copy Success */
        .copy-toast {
            position: fixed;
            bottom: 24px;
            right: 24px;
            background: linear-gradient(135deg, #10B981, #059669);
            color: white;
            padding: 12px 20px;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
            font-family: 'Sarabun', sans-serif;
            font-size: 0.9rem;
            font-weight: 500;
            z-index: 10000;
            animation: slideInUp 0.3s ease, fadeOut 0.3s ease 2.2s forwards;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* Progress Toast Notification */
        .progress-toast {
            position: fixed;
            bottom: 24px;
            right: 24px;
            background: linear-gradient(135deg, #3B82F6, #2563EB);
            color: white;
            padding: 12px 20px;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
            font-family: 'Sarabun', sans-serif;
            font-size: 0.9rem;
            font-weight: 500;
            z-index: 10000;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .progress-toast .spinner {
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        @keyframes slideInUp {
            from {
                transform: translateY(100px);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes fadeOut {
            to {
                opacity: 0;
                transform: translateY(-20px);
            }
        }

        /* Interactive List Items */
        .order-card-item {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 1rem;
            padding: 12px 16px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 12px;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
        }

        .order-card-item:hover {
            background: rgba(255, 255, 255, 0.05);
            border-color: rgba(255, 255, 255, 0.12);
        }

        .order-card-item:active {
            /* No transform effect - just a subtle opacity */
            opacity: 0.95;
        }

        /* ⚡ Realtime highlight: card ที่เพิ่งถูกอัปเดต — เรืองแสง+กระพริบ ก่อนอยู่บนสุด */
        .order-card-item.order-just-updated {
            animation: orderUpdatePulse 1.6s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            z-index: 2;
        }
        @keyframes orderUpdatePulse {
            0%   { box-shadow: 0 0 0 0 rgba(245, 183, 60, 0);   background: rgba(255,255,255,0.03); transform: translateY(-6px); opacity: 0.4; }
            12%  { box-shadow: 0 0 26px 5px rgba(245, 183, 60, 0.60); background: rgba(245, 183, 60, 0.12); border-color: rgba(245,183,60,0.55); transform: translateY(0); opacity: 1; }
            28%  { box-shadow: 0 0 8px 1px rgba(245, 183, 60, 0.20); background: rgba(245, 183, 60, 0.04); }
            44%  { box-shadow: 0 0 26px 5px rgba(245, 183, 60, 0.55); background: rgba(245, 183, 60, 0.11); border-color: rgba(245,183,60,0.5); }
            60%  { box-shadow: 0 0 8px 1px rgba(245, 183, 60, 0.18); background: rgba(245, 183, 60, 0.04); }
            100% { box-shadow: 0 0 0 0 rgba(245, 183, 60, 0); background: rgba(255,255,255,0.03); transform: none; }
        }

        /* Beam PromptPay — ย่อ/ขยายใน modal รายละเอียดออร์เดอร์ */
        .beam-qr-panel__head { cursor: pointer; }
        .beam-qr-panel__chevron { transition: transform 0.2s ease; }
        .beam-qr-panel--collapsed .beam-qr-panel__chevron { transform: rotate(-90deg); }
        .beam-qr-panel--collapsed .beam-qr-panel__body { display: none; }
        .beam-qr-panel:not(.beam-qr-panel--collapsed) .beam-qr-panel__summary { display: none; }
        @media (prefers-reduced-motion: reduce) {
            .order-card-item.order-just-updated { animation: orderUpdateFade 1s ease-out; }
            @keyframes orderUpdateFade {
                0% { background: rgba(245,183,60,0.12); }
                100% { background: rgba(255,255,255,0.03); }
            }
        }

        .order-card-created-date {
            display: none;
        }

        /* Buttons & Table Hover */
        button {
            transition: all 0.2s ease;
        }

        button:hover:not(:disabled) {
            transform: translateY(-1px);
            filter: brightness(1.1);
        }

        button:active:not(:disabled) {
            transform: scale(0.95);
        }

        .compact-table tbody tr {
            transition: background 0.2s;
        }

        .compact-table tbody tr:hover {
            background: rgba(255, 255, 255, 0.05) !important;
        }

        /* Components */
        .compact-table-container {
            overflow-y: auto;
            width: 100%;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 1rem;
            background: rgba(0, 0, 0, 0.2);
            max-height: 65vh;
        }

        .compact-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.8rem;
            table-layout: fixed;
        }

        .compact-table th {
            position: sticky;
            top: 0;
            z-index: 10;
            background: #252535;
            color: #ccc;
            padding: 12px 8px;
            font-weight: 500;
            text-align: left;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            white-space: nowrap;
        }

        .compact-table td {
            padding: 10px 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            vertical-align: top;
            color: #ddd;
        }

        .order-list-container {
            max-height: 68vh;
            overflow-y: auto;
            padding-right: 4px;
            padding-bottom: 80px;
            /* ⚡ Performance: enable GPU acceleration + smooth scroll */
            -webkit-overflow-scrolling: touch;
            will-change: scroll-position;
            contain: layout style paint;
        }

        /* ⚡ Order card performance optimization */
        .order-card-item {
            contain: layout style paint; /* Isolate paint area */
            content-visibility: auto; /* Skip rendering offscreen cards */
        }

        /* มือถือ/แท็บเล็ต: กัน double-tap zoom + ลด tap delay บน card ที่ double-tap เพื่อเปิดดูได้ */
        .order-card-item,
        [ondblclick],
        .gallery-thumb {
            touch-action: manipulation;
        }

        /* ── แถบเมนูย่อย (จัดการออร์เดอร์ / LINE) ตรึงติดใต้ Topbar ไม่เลื่อนตามเนื้อหา ── */
        .subtabs-sticky {
            position: sticky;
            top: var(--app-header-offset, 72px);
            /* ต้องสูงกว่า z-index ของการ์ดในฟอร์ม (.panel-customer = 30) เพื่อให้ทุกคอลัมน์
               เลื่อนลอดใต้แถบเมนูย่อยเหมือนกัน — กันกรอบลูกค้าลอยทับแถบเมนูตอน scroll */
            z-index: 40;
            background: rgba(13, 10, 25, 0.94) !important;
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
        }

        /* แผ่นปิดหลังแถบ — กันเนื้อหาลอดร่องระหว่าง Topbar กับแถบ และลอดมุมมน/ด้านข้างตอน scroll */
        .subtabs-sticky::before {
            content: '';
            position: absolute;
            top: -18px;
            left: -16px;
            right: -16px;
            bottom: -2px;
            background: #0d0a19;
            border-radius: 0 0 18px 18px;
            z-index: -1;
        }

        /* หน้ารายการออร์เดอร์ / พิมพ์รายการส่ง — flex column (subtabs ไม่ใช้ sticky) */
        #manageOrderView.active > .subtabs-sticky,
        #manageQuickOrderView.active > .subtabs-sticky {
            flex-shrink: 0;
        }

        /* ── แถบแท็บจัดการออร์เดอร์ + LINE — อยู่ใน flow ไม่ทับกรอบด้านล่าง ── */
        #createOrderView > .subtabs-sticky,
        #manageOrderView > .subtabs-sticky,
        #manageQuickOrderView > .subtabs-sticky,
        #replyRulesView > .subtabs-sticky,
        #lineCustomersView > .subtabs-sticky,
        #broadcastView > .subtabs-sticky,
        #manageLineBotView > .subtabs-sticky {
            position: relative;
            top: auto;
            z-index: 5;
            flex-shrink: 0;
            margin-bottom: 0.75rem;
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
        }

        #createOrderView > .subtabs-sticky,
        #manageOrderView > .subtabs-sticky,
        #manageQuickOrderView > .subtabs-sticky {
            background: rgba(13, 10, 25, 0.98) !important;
        }

        #replyRulesView > .subtabs-sticky,
        #lineCustomersView > .subtabs-sticky,
        #broadcastView > .subtabs-sticky,
        #manageLineBotView > .subtabs-sticky {
            background: rgba(17, 24, 39, 0.98) !important;
        }

        #createOrderView > .subtabs-sticky::before,
        #manageOrderView > .subtabs-sticky::before,
        #manageQuickOrderView > .subtabs-sticky::before,
        #replyRulesView > .subtabs-sticky::before,
        #lineCustomersView > .subtabs-sticky::before,
        #broadcastView > .subtabs-sticky::before,
        #manageLineBotView > .subtabs-sticky::before {
            display: none;
        }

        #createOrderView > #orderForm,
        #replyRulesView > #replyRulesContent,
        #lineCustomersView > #lineCustomersContent,
        #broadcastView > #broadcastContent,
        #manageLineBotView > #lineBotActionBar,
        #manageLineBotView > .space-y-4 {
            position: relative;
            z-index: 1;
        }

        /* ── แถบเมนูย่อยทุกแถบ: ปุ่มหดให้พอดีจอเสมอ เลื่อนซ้าย-ขวาไม่ได้ ──
           เอา overflow-x-auto ออกจาก HTML แล้ว (กลับเป็น overflow: visible) + min-width:0
           ให้ flex-1 หดได้จริง ปุ่มจึงแบ่งความกว้างพอดีจอ ไม่ล้นจนต้องเลื่อน */
        .subtabs-sticky > button {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;  /* แสดง ... แทนการตัดข้อความโดยไม่มีสัญลักษณ์ */
        }
        /* span/text node ใน flex item ต้องมี overflow+ellipsis ด้วยเพื่อให้ ellipsis แสดงผล */
        .subtabs-sticky > button > span,
        .subtabs-sticky > button > i ~ span {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            min-width: 0;
        }
        /* จอแคบมาก (< 480px): ซ่อนข้อความ เหลือแค่ icon — ใช้ label data-attr แทน */
        @media (max-width: 479px) {
            .subtabs-sticky > button .tab-label {
                display: none;
            }
            .subtabs-sticky > button {
                padding-left: 0.4rem;
                padding-right: 0.4rem;
                gap: 0;
                font-size: 15px;  /* icon ใหญ่ขึ้นเล็กน้อยเพื่อแตะง่าย */
            }
        }
        /* จอกลาง (480–600px): ลดฟอนต์และ padding */
        @media (min-width: 480px) and (max-width: 600px) {
            .subtabs-sticky > button {
                padding-left: 0.35rem;
                padding-right: 0.35rem;
                gap: 0.25rem;
                font-size: 10px;
            }
        }
        @media (max-width: 360px) {
            .subtabs-sticky > button {
                gap: 0;
                font-size: 13px;
            }
        }

        /* ── รายชื่อลูกค้า LINE บนมือถือ: 2 คอลัมน์แบบกะทัดรัด (จอ < 640px) ── */
        @media (max-width: 639px) {
            #lineCustomersView #customersGridContainer {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
                gap: 0.4rem !important;
            }

            #customersGridContainer>[id^="customer-card-"] {
                flex-direction: row !important;
                align-items: center !important;
                text-align: left !important;
                gap: 0.4rem !important;
                padding: 0.5rem 1rem 0.5rem 0.4rem !important;
                border-radius: 10px !important;
            }

            #customersGridContainer>[id^="customer-card-"]>img {
                width: 2rem !important;
                height: 2rem !important;
            }

            #customersGridContainer>[id^="customer-card-"]>.flex-1 {
                width: 100% !important;
                padding-right: 0 !important;
            }

            #customersGridContainer>[id^="customer-card-"] .status-badge {
                display: none !important;
            }

            #customersGridContainer>[id^="customer-card-"] .line-oa-name-row {
                display: none !important;
            }

            #customersGridContainer>[id^="customer-card-"] .delete-btn-container {
                display: none !important;
            }

            #customersGridContainer>[id^="customer-card-"] .select-checkbox-container {
                top: 0.25rem !important;
                right: 0.25rem !important;
            }
            
            #customersGridContainer>[id^="customer-card-"] .select-checkbox-container input {
                width: 0.85rem !important;
                height: 0.85rem !important;
            }

            /* ชื่อ + badge จัดกลาง และยกเลิกการจำกัดความกว้างชื่อ */
            #customersGridContainer>[id^="customer-card-"] .flex.items-center.gap-1\.5 {
                justify-content: flex-start !important;
                flex-wrap: nowrap !important;
            }

            #customersGridContainer>[id^="customer-card-"] .max-w-\[120px\] {
                max-width: 100% !important;
            }

            #customersGridContainer>[id^="customer-card-"] p {
                justify-content: flex-start !important;
                text-align: left !important;
            }
        }

        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 100;
            background: rgba(0, 0, 0, 0.6);
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 1rem 0;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease, visibility 0.2s ease;
            will-change: opacity;
        }

        .modal-overlay.show {
            opacity: 1;
            visibility: visible;
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
        }

        /* Lock background scroll when any modal is open */
        body.modal-open {
            overflow: hidden;
            /* preserve scrollbar width to prevent layout shift */
            padding-right: var(--scrollbar-width, 0px);
        }

        /* Management Modals should have higher z-index */
        #productManagementModal,
        #customerManagementModal,
        #manageBankModal {
            z-index: 150;
        }

        /* Modals ที่เปิดซ้อนจาก ruleEditModal (z-index ปกติ 100) ต้องอยู่บนสุด */
        #buttonEditModal.show { z-index: 210 !important; }
        #quickReplyModal.show { z-index: 210 !important; }
        #orderItemPickerModal.show { z-index: 220 !important; }

        /* ───────────────────────────────────────────────
           ขนาด UI ใน modal กฎตอบกลับ + แก้ไขปุ่ม
           ให้เท่าหน้า "สร้างออร์เดอร์ใหม่" (ไม่จิ๋ว อ่านง่าย)
           ─────────────────────────────────────────────── */
        #ruleEditModal .themed-input,
        #buttonEditModal .themed-input {
            font-size: max(16px, 0.9rem) !important;
            height: auto !important;
            padding: 0.5rem 0.85rem !important;
            border-radius: 0.85rem !important;
        }
        #ruleEditModal select.themed-input,
        #buttonEditModal select.themed-input {
            height: auto !important;
            min-height: 40px;
        }
        #ruleEditModal .form-label,
        #buttonEditModal .form-label,
        #ruleEditModal .be-label,
        #buttonEditModal .be-label {
            font-size: 0.82rem !important;
            font-weight: 500;
            color: #FACC15;
            margin-bottom: 0.3rem;
            text-transform: none;
            letter-spacing: 0;
        }
        /* input/select/control ที่ใช้ class be-input ในทั้งสอง modal: ขนาดอ่านง่าย ไม่จิ๋ว */
        #ruleEditModal .be-input,
        #buttonEditModal .be-input {
            font-size: max(16px, 0.88rem) !important;
            height: auto !important;
            min-height: 38px;
            padding: 0.5rem 0.8rem !important;
            border-radius: 0.8rem !important;
        }
        /* ช่องจำนวนในแถวรายการสั่งซื้อ: ความกว้างคงที่ (กัน themed-input width:100% ดันชื่อหาย) */
        #buttonEditModal .be-qty {
            width: 64px !important;
            flex: 0 0 64px !important;
            min-width: 64px !important;
            text-align: center;
            padding-left: 0.35rem !important;
            padding-right: 0.35rem !important;
        }

        /* Modals opened from Management Modals should be even higher */
        #productModal.show,
        #customerModal.show,
        #viewDataModal.show,
        #bankModal.show {
            z-index: 200 !important;
        }

        #loginModal {
            z-index: 9999 !important;
        }

        /* Stacked modal backdrop */
        .modal-overlay.show+.modal-overlay.show {
            background: rgba(0, 0, 0, 0.8);
        }

        .modal-panel {
            background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.5)), linear-gradient(135deg, rgba(66, 24, 137, 0.95) 0%, rgba(186, 66, 151, 0.95) 100%);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 2rem;
            padding: 1.5rem;
            width: 90%;
            max-width: 360px;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            margin: auto;
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
            transform: scale(0.95);
            transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1);
            will-change: transform, opacity;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }

        .modal-overlay.show .modal-panel {
            transform: scale(1);
        }

        .custom-checkbox {
            appearance: none;
            width: 20px;
            height: 20px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 6px;
            cursor: pointer;
            background: transparent;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .custom-checkbox:checked {
            background: #E95384;
            border-color: #E95384;
            background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
            background-size: 70%;
            background-position: center;
            background-repeat: no-repeat;
        }

        .autocomplete-wrapper {
            position: relative;
        }

        .autocomplete-list {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            z-index: 60;
            background: #2a2a35;
            border: 1px solid var(--glass-border);
            border-radius: 0 0 1rem 1rem;
            max-height: 200px;
            overflow-y: auto;
            display: none;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        }

        .autocomplete-item {
            padding: 12px 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            cursor: pointer;
            color: #eee;
        }

        .autocomplete-item:hover {
            background: rgba(233, 83, 132, 0.2);
        }

        .action-btn-circle {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.05);
        }

        .action-btn-circle:hover {
            transform: scale(1.1);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
        }

        .action-btn-circle:active {
            transform: scale(0.95);
        }

        /* Order ID Link - Clickable to open modal */
        .order-id-link {
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .order-id-link:hover {
            text-decoration: underline;
            filter: brightness(1.2);
        }
        .order-id-link:active {
            opacity: 0.7;
        }

        .btn-icon-confirm {
            background: rgba(34, 197, 94, 0.25);
            border-color: rgba(34, 197, 94, 0.5);
            color: #4ade80;
        }

        .btn-icon-close {
            background: rgba(59, 130, 246, 0.25);
            border-color: rgba(59, 130, 246, 0.5);
            color: #60a5fa;
        }

        .btn-icon-edit {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.1);
            color: #9ca3af;
        }

        .btn-icon-edit:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.15);
        }

        select.minimal-dropdown {
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a78bfa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
            background-position: right 0.5rem center;
            background-repeat: no-repeat;
            background-size: 1.1em 1.1em;
            padding-right: 2rem;
            background-color: rgba(15, 10, 38, 0.75);
            border: 1px solid rgba(255, 255, 255, 0.14);
            border-radius: 0.8rem;
            color: #e2e8f0;
            font-size: 0.8rem;
            font-weight: 500;
            width: 130px;
            cursor: pointer;
            transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
        }

        select.minimal-dropdown:hover {
            border-color: rgba(167, 139, 250, 0.45);
            background-color: rgba(25, 18, 55, 0.85);
        }

        select.minimal-dropdown:focus {
            outline: none;
            border-color: rgba(167, 139, 250, 0.7);
            box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
        }

        option {
            background-color: #130f24;
            padding: 10px;
        }

        option.opt-all {
            color: #e5e7eb;
        }

        option.opt-new {
            color: #60a5fa;
        }

        option.opt-pending {
            color: #facc15;
        }

        option.opt-shipping {
            color: #fb923c;
        }

        option.opt-success {
            color: #4ade80;
        }

        option.opt-cancel {
            color: #f87171;
        }

        .bulk-action-btn-inline {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 14px;
            border-radius: 0.8rem;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid transparent;
            height: 36px;
            white-space: nowrap;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .bulk-action-btn-inline:hover {
            transform: translateY(-2px);
            filter: brightness(1.1);
        }

        .bulk-action-btn-inline:active {
            transform: translateY(0);
            filter: brightness(0.95);
        }

        .bg-confirm {
            background: linear-gradient(135deg, rgba(22, 163, 74, 0.2), rgba(22, 163, 74, 0.4));
            color: #4ade80;
            border-color: rgba(22, 163, 74, 0.5);
        }

        .bg-close {
            background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.4));
            color: #60a5fa;
            border-color: rgba(37, 99, 235, 0.5);
        }

        .bg-delete {
            background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(220, 38, 38, 0.4));
            color: #f87171;
            border-color: rgba(220, 38, 38, 0.5);
        }

        .bg-cancel {
            background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.4));
            color: #facc15;
            border-color: rgba(234, 179, 8, 0.5);
        }

        .view-section {
            display: none !important;
            animation: fadeIn 0.2s ease-out;
        }

        .view-section.active {
            display: block !important;
        }

        /* ⚡ Bottom bar: fixed sticky บนมือถือ — ไม่เลื่อนตาม scroll */
        @media (max-width: 767px) {
            #createOrderFooter {
                position: fixed !important;
                bottom: 0 !important;
                left: 0 !important;
                right: 0 !important;
                z-index: 50 !important;
            }
            /* เพิ่ม padding-bottom ให้ form ไม่ถูก footer ทับ */
            #createOrderView #orderForm {
                padding-bottom: 6rem;
            }
        }

        /* ===== IMAGE GALLERY STYLES ===== */
        .gallery-thumb {
            position: relative;
            aspect-ratio: 1;
            border-radius: 0.75rem;
            overflow: hidden;
            border: 2px solid transparent;
            cursor: pointer;
            transition: all 0.15s ease;
            background: rgba(255,255,255,0.03);
        }
        .gallery-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.2s ease;
        }
        .gallery-thumb:hover img { transform: scale(1.05); }
        .gallery-thumb:active { transform: scale(0.96); }
        .gallery-thumb .gallery-check {
            position: absolute;
            top: 4px; right: 4px;
            width: 22px; height: 22px;
            border-radius: 50%;
            background: rgba(0,0,0,0.4);
            border: 1.5px solid rgba(255,255,255,0.3);
            display: flex; align-items: center; justify-content: center;
            opacity: 0.4;
            transition: all 0.15s ease;
        }
        .gallery-thumb .gallery-check i { font-size: 10px; color: rgba(255,255,255,0.6); }
        .gallery-thumb.selected {
            border-color: #ec4899;
            box-shadow: 0 0 0 2px rgba(236,72,153,0.3);
        }
        .gallery-thumb.selected .gallery-check {
            background: #ec4899;
            border-color: #ec4899;
            opacity: 1;
        }
        .gallery-thumb.selected .gallery-check i { color: #fff; }

        /* ── List views: แถบค้นหา + เลือกทั้งหมด คงที่ — scroll เฉพาะ card list ── */
        :root {
            --app-header-offset: 72px;
            --list-view-height: calc(100vh - var(--app-header-offset) - 0.5rem);
            --list-view-height: calc(100dvh - var(--app-header-offset) - 0.5rem);
        }

        @media (min-width: 768px) {
            :root {
                --app-header-offset: 88px;
            }
        }

        #manageOrderView.active,
        #manageQuickOrderView.active,
        #manageCustomerAddressView.active,
        #manageParticipantBirthdayView.active,
        #manageProductView.active {
            display: flex !important;
            flex-direction: column;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
            overflow: hidden;
            min-height: 0;
        }

        #manageOrderView.active,
        #manageQuickOrderView.active {
            margin-top: 0;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
        }

        /* Chrome ด้านบน (ไม่ scroll) */
        #manageOrderView.active > .flex,
        #manageOrderView.active > #orderBulkAction,
        #manageQuickOrderView.active > .glass-panel,
        #manageCustomerAddressView.active > p,
        #manageCustomerAddressView.active > .flex,
        #manageCustomerAddressView.active > #customerAddressListMeta,
        #manageCustomerAddressView.active > .mb-2,
        #manageParticipantBirthdayView.active > p,
        #manageParticipantBirthdayView.active > .flex,
        #manageParticipantBirthdayView.active > #participantListMeta,
        #manageParticipantBirthdayView.active > .mb-2,
        #manageProductView.active > .flex,
        #manageProductView.active > .mb-2 {
            flex-shrink: 0;
        }

        /* Card list — scroll เฉพาะส่วนนี้ */
        #manageOrderView.active #manageOrderContainer,
        #manageQuickOrderView.active #quickOrderCardContainer,
        #manageCustomerAddressView.active #customerAddressCardContainer,
        #manageParticipantBirthdayView.active #participantCardContainer,
        #manageProductView.active #productCardContainer {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            max-height: none !important;
            -webkit-overflow-scrolling: touch;
        }
        #manageProductView.active #productCardContainer { padding-bottom: 5.5rem; }

        #manageCeremonyView.active {
            display: flex !important;
            flex-direction: column;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
            overflow: hidden;
            min-height: 0;
        }
        #manageCeremonyView.active > .flex { flex-shrink: 0; }
        #manageCeremonyView.active #ceremonyCardContainerView {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            max-height: none !important;
            -webkit-overflow-scrolling: touch;
        }

        /* จัดการค่าส่ง: layout ความสูงคงที่เหมือนจัดการสินค้า/พิธี — แถบแท็บ+หัวข้อตรึงไว้ เลื่อนเฉพาะลิสต์ */
        #manageShippingRatesView.active {
            display: flex !important;
            flex-direction: column;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
            overflow: hidden;
            min-height: 0;
        }
        #manageShippingRatesView.active > .flex { flex-shrink: 0; }
        #manageShippingRatesView.active > .shipping-rates-scroll {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 1rem;
        }

        /* จัดการชีต / ค้นหาข้อมูล — กรอบความกว้างเท่า #adminPanel + layout ความสูงคงที่ */
        #manageSheetView.active,
        #searchPageView.active {
            display: flex !important;
            flex-direction: column;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
            overflow: hidden;
            min-height: 0;
        }

        #manageSheetView.active > .flex,
        #searchPageView.active > .flex {
            flex-shrink: 0;
        }

        #manageSheetView.active #sheetTabPanel1,
        #manageSheetView.active #sheetTabPanel2,
        #manageSheetView.active #sheetTabPanel3 {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 1rem;
        }

        #searchPageView.active > .px-2.mb-2 {
            flex-shrink: 0;
        }

        #searchPageView.active #searchResultsContainer {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
        }

        #manageOrderView.active #manageOrderContainer {
            padding-bottom: 5.5rem;
        }

        #manageQuickOrderView.active #quickOrderCardContainer {
            padding-bottom: 6.5rem;
        }

        #manageCustomerAddressView.active #customerAddressCardContainer {
            padding-bottom: 5.5rem;
        }

        #manageCustomerAddressView.active #customerAddressCardContainer.has-mgmt-footer {
            padding-bottom: 6.5rem;
        }

        #manageParticipantBirthdayView.active #participantCardContainer {
            padding-bottom: 5.5rem;
        }

        #manageParticipantBirthdayView.active #participantCardContainer.has-mgmt-footer {
            padding-bottom: 6.5rem;
        }

        /* กัน scroll ทั้งหน้า — เลื่อนเฉพาะ card list (รวมจัดการสินค้า/พิธี/ค่าส่ง เพื่อให้แถบแท็บตรึงนิ่ง) */
        body:has(#manageOrderView.active),
        body:has(#manageQuickOrderView.active),
        body:has(#manageCustomerAddressView.active),
        body:has(#manageParticipantBirthdayView.active),
        body:has(#manageProductView.active),
        body:has(#manageCeremonyView.active),
        body:has(#manageShippingRatesView.active),
        body:has(#manageSheetView.active),
        body:has(#searchPageView.active) {
            overflow: hidden;
        }

        #adminPanel:has(#manageOrderView.active),
        #adminPanel:has(#manageQuickOrderView.active),
        #adminPanel:has(#manageCustomerAddressView.active),
        #adminPanel:has(#manageParticipantBirthdayView.active),
        #adminPanel:has(#manageProductView.active),
        #adminPanel:has(#manageCeremonyView.active),
        #adminPanel:has(#manageShippingRatesView.active) {
            padding-bottom: 0 !important;
            overflow: hidden;
        }

        /* หน้า Full-Page view ที่อยู่นอก #adminPanel — ยุบ adminPanel ให้สูง 0 กัน min-h-screen กิน 100vh ทับ */
        body:has(#manageSheetView.active) #adminPanel,
        body:has(#searchPageView.active) #adminPanel {
            min-height: 0 !important;
            padding: 0 !important;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(5px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .hidden {
            display: none !important;
        }

        select.themed-input {
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23f59e0b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
            background-position: right 0.6rem center;
            background-repeat: no-repeat;
            background-size: 1.1em 1.1em;
            padding-right: 2.2rem;
            background-color: rgba(8, 6, 22, 0.55);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 0.85rem;
            color: #e2e8f0;
            position: relative;
            z-index: 2;
            min-height: 44px;
            cursor: pointer;
            touch-action: manipulation;
            transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
        }

        select.themed-input:hover {
            border-color: rgba(245, 158, 11, 0.28);
            background-color: rgba(18, 14, 38, 0.7);
        }

        select.themed-input:focus {
            outline: none;
            border-color: rgba(233, 83, 132, 0.55);
            box-shadow: 0 0 0 3px rgba(233, 83, 132, 0.1);
        }

        /* iOS: ใช้ native picker + ขนาดตัวอักษรกัน zoom/autofill รบกวน */
        @supports (-webkit-touch-callout: none) {
            select.themed-input {
                -webkit-appearance: menulist;
                appearance: menulist;
                background-image: none;
                padding-right: 1rem;
                font-size: 16px;
            }
        }

        /* ปิด autofill highlight บน iOS/Safari */
        input:-webkit-autofill,
        input:-webkit-autofill:hover,
        input:-webkit-autofill:focus,
        select:-webkit-autofill,
        textarea:-webkit-autofill {
            -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.25) inset !important;
            -webkit-text-fill-color: #fff !important;
            transition: background-color 99999s ease-in-out 0s;
        }

        select.themed-input option {
            background-color: #130f24 !important;
            color: #e2e8f0 !important;
        }

        /* ── Custom Select Widget ── */
        .cs-wrap { position: relative; }
        .cs-trigger {
            display: flex; align-items: center; justify-content: space-between;
            width: 100%; min-height: 44px; padding: 0.5rem 0.75rem 0.5rem 0.85rem;
            background-color: rgba(8,6,22,0.55);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 0.85rem; color: #e2e8f0; cursor: pointer;
            gap: 0.5rem; font-size: 14px; text-align: left;
            transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
        }
        .cs-trigger:hover {
            border-color: rgba(245,158,11,0.28);
            background-color: rgba(18,14,38,0.7);
        }
        .cs-trigger.cs-open {
            border-color: rgba(233,83,132,0.55);
            box-shadow: 0 0 0 3px rgba(233,83,132,0.1);
        }
        .cs-trigger .cs-arrow {
            flex-shrink: 0; color: #f59e0b; font-size: 10px;
            transition: transform 0.2s;
        }
        .cs-trigger.cs-open .cs-arrow { transform: rotate(180deg); }
        .cs-panel {
            position: absolute; left: 0; right: 0; z-index: 220;
            top: calc(100% + 4px);
            background: rgba(10,8,26,0.98);
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 0.85rem; overflow: hidden;
            box-shadow: 0 8px 32px rgba(0,0,0,0.65);
            backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            max-height: 280px; overflow-y: auto; padding: 4px 0;
        }
        .cs-option {
            display: flex; align-items: center; padding: 0.58rem 1rem;
            color: #e2e8f0; font-size: 14px; cursor: pointer;
            transition: background 0.12s; user-select: none;
        }
        .cs-option:hover { background: rgba(255,255,255,0.06); }
        .cs-option.cs-selected { color: #f59e0b; background: rgba(245,158,11,0.08); }
        .cs-option.cs-selected::before { content: '✓'; margin-right: 0.45rem; font-size: 11px; }
        /* minimal variant (filter chips) */
        .cs-trigger.cs-minimal {
            min-height: unset; height: 44px; padding: 0.35rem 0.65rem;
            font-size: 0.8rem; font-weight: 500;
            background-color: rgba(15,10,38,0.75);
            border-color: rgba(255,255,255,0.14);
        }
        .cs-trigger.cs-minimal:hover {
            border-color: rgba(167,139,250,0.45);
            background-color: rgba(25,18,55,0.85);
        }
        .cs-trigger.cs-minimal.cs-open {
            border-color: rgba(167,139,250,0.7);
            box-shadow: 0 0 0 3px rgba(167,139,250,0.1);
        }
        .cs-trigger.cs-minimal .cs-arrow { color: #a78bfa; }
        .cs-panel.cs-minimal-panel { border-radius: 0.75rem; }
        /* ลอยเหนือกรอบการ์ด (portal จาก JS) */
        .cs-panel.cs-panel-portal {
            position: fixed !important;
            z-index: 10050 !important;
            left: auto;
            right: auto;
            max-height: min(280px, 55vh);
        }
        .cs-option.cs-minimal-opt { font-size: 0.82rem; padding: 0.5rem 0.8rem; }
        .cs-option.cs-minimal-opt.cs-selected { color: #a78bfa; background: rgba(167,139,250,0.08); }
        .cs-option.cs-minimal-opt.cs-selected::before { color: #a78bfa; }

        /* Update Indicator Badge */
        .update-badge {
            position: fixed;
            top: 5px;
            right: 10px;
            background: rgba(15, 15, 20, 0.85);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
            border: 1px solid rgba(233, 83, 132, 0.2);
            border-radius: 50px;
            padding: 3px 10px;
            display: flex;
            align-items: center;
            gap: 5px;
            z-index: 3000;
            transform: translateY(-150%);
            opacity: 0;
            transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        }

        .update-badge.show {
            transform: translateY(0);
            opacity: 1;
        }

        .status-dot {
            width: 6px;
            height: 6px;
            background-color: #E95384;
            border-radius: 50%;
            box-shadow: 0 0 8px #E95384;
            animation: pulse-dot 1.5s infinite;
        }

        @keyframes pulse-dot {
            0% {
                opacity: 0.6;
                transform: scale(1);
            }

            50% {
                opacity: 1;
                transform: scale(1.3);
            }

            100% {
                opacity: 0.6;
                transform: scale(1);
            }
        }

        .badge-text {
            font-size: 8px;
            color: #ccc;
            font-weight: 500;
            letter-spacing: 0.5px;
        }

        /* Quick Order Card Styles */
        .quick-order-card.selected {
            background: rgba(233, 83, 132, 0.1);
            border-color: rgba(233, 83, 132, 0.5);
        }

        .quick-order-card:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .app-header {
            padding: 0.5rem 0.75rem 0.6rem;
        }

        header .header-inner {
            max-width: 420px;
            margin: 0 auto;
            width: 100%;
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 0.35rem;
        }

        .header-row {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            flex: 1;
            min-width: 0;
        }

        .header-titles {
            flex: 1;
            min-width: 0;
        }

        .header-titles h1 {
            font-size: 1.05rem;
            line-height: 1.25;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .header-context {
            font-size: 0.65rem;
            line-height: 1.3;
            color: rgba(255, 248, 240, 0.55);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @media (max-width: 767px) {
            .header-context {
                display: none;
            }
        }

        .header-nav {
            display: flex;
            align-items: stretch;
            justify-content: flex-end;
            gap: 0.3rem;
            width: auto;
            flex-shrink: 0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            padding-bottom: 1px;
        }

        .header-nav::-webkit-scrollbar {
            display: none;
        }

        .header-action {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.15rem;
            min-width: 3.25rem;
            min-height: 44px;
            padding: 0.3rem 0.4rem;
            border-radius: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.05);
            color: rgba(255, 248, 240, 0.85);
            flex-shrink: 0;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
        }

        .header-action:active {
            transform: scale(0.97);
        }

        .header-action i {
            font-size: 0.95rem;
            line-height: 1;
        }

        .header-action-label {
            font-size: 0.6rem;
            font-weight: 600;
            line-height: 1.1;
            letter-spacing: 0.01em;
            max-width: 3.5rem;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .header-action--menu {
            min-width: 44px;
            width: 44px;
            color: rgba(255, 248, 240, 0.75);
        }

        @media (max-width: 380px) {
            .header-action {
                min-width: 2.85rem;
                padding: 0.25rem 0.3rem;
            }

            .header-action-label {
                font-size: 0.55rem;
                max-width: 3rem;
            }

            .header-titles h1 {
                font-size: 0.95rem;
            }
        }

        .header-action--create {
            background: linear-gradient(145deg, rgba(59, 130, 246, 0.35), rgba(37, 99, 235, 0.2));
            border-color: rgba(96, 165, 250, 0.35);
            color: #bfdbfe;
        }

        .header-action--login {
            background: linear-gradient(145deg, rgba(217, 119, 6, 0.35), rgba(180, 83, 9, 0.2));
            border-color: rgba(251, 191, 36, 0.35);
            color: #fde68a;
        }

        .header-action--login.is-logged-in {
            background: linear-gradient(145deg, rgba(22, 163, 74, 0.35), rgba(21, 128, 61, 0.2));
            border-color: rgba(74, 222, 128, 0.35);
            color: #bbf7d0;
        }

        .header-action--orders {
            background: linear-gradient(145deg, rgba(219, 39, 119, 0.3), rgba(190, 24, 93, 0.18));
            border-color: rgba(244, 114, 182, 0.35);
            color: #fbcfe8;
        }

        .header-action--print {
            background: linear-gradient(145deg, rgba(124, 58, 237, 0.3), rgba(109, 40, 217, 0.18));
            border-color: rgba(167, 139, 250, 0.35);
            color: #ddd6fe;
        }

        .header-action.is-active {
            border-color: var(--gold-14k, #D4AF37);
            box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35), 0 4px 16px rgba(212, 175, 55, 0.15);
            color: var(--gold-bright, #FFD700);
        }

        .header-action.is-active .header-action-label {
            color: var(--gold-bright, #FFD700);
        }

        @media (min-width: 768px) {
            body {
                padding-top: 88px;
            }

            .header-context {
                display: block;
            }

            .app-header {
                padding: 0.65rem 1rem 0.7rem;
            }

            header .header-inner {
                justify-content: space-between;
                gap: 0.75rem;
            }

            .header-nav {
                width: auto;
                flex-shrink: 0;
            }

            .header-titles h1 {
                font-size: 1.15rem;
            }

            .header-context {
                font-size: 0.7rem;
            }

            .header-action-label {
                font-size: 0.65rem;
            }
        }

        /* ========== SIDEBAR STYLES ========== */
        #sidebar {
            position: fixed;
            left: 0;
            top: 0;
            width: 260px;
            height: 100vh;
            background: linear-gradient(180deg, #1A1A2E 0%, #16162a 100%);
            border-right: 1px solid rgba(255, 255, 255, 0.08);
            z-index: 55;
            transform: translateX(-100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5);
        }

        #sidebar.show {
            transform: translateX(0);
        }

        #sidebarOverlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 54;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s;
        }

        #sidebarOverlay.show {
            opacity: 1;
            visibility: visible;
        }

        .sidebar-header {
            padding: 1.25rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .sidebar-menu {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 0;
            padding: 1rem 0;
            overflow-y: auto;
        }

        .sidebar-menu-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.875rem 1.25rem;
            color: rgba(255, 255, 255, 0.75);
            text-decoration: none;
            cursor: pointer;
            border-radius: 12px;
            margin: 0.3rem 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.03);
            background: rgba(255, 255, 255, 0.02);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        }

        .sidebar-menu-item:hover {
            background: rgba(255, 255, 255, 0.07);
            color: #fff;
            border-color: rgba(255, 255, 255, 0.12);
            transform: translateY(-1px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        .sidebar-menu-item:active {
            transform: translateY(1px) scale(0.97);
            box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .sidebar-menu-item.active {
            transform: translateY(1px);
            font-weight: 600;
        }

        /* สี path ตามหมวดเมนู (sidebar + breadcrumb) ในสไตล์ Glassmorphism */
        .sidebar-menu-item.active[data-nav-accent="create"] {
            background: rgba(59, 130, 246, 0.15);
            color: #93c5fd;
            border-color: rgba(96, 165, 250, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(59, 130, 246, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="orders"] {
            background: rgba(219, 39, 119, 0.15);
            color: #f9a8d4;
            border-color: rgba(244, 114, 182, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(219, 39, 119, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="scanner"] {
            background: rgba(34, 197, 94, 0.15);
            color: #86efac;
            border-color: rgba(74, 222, 128, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(34, 197, 94, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="quick"] {
            background: rgba(234, 179, 8, 0.15);
            color: #fde047;
            border-color: rgba(250, 204, 21, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(234, 179, 8, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="print"] {
            background: rgba(124, 58, 237, 0.15);
            color: #c4b5fd;
            border-color: rgba(167, 139, 250, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(124, 58, 237, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="customer"] {
            background: rgba(245, 158, 11, 0.15);
            color: #fcd34d;
            border-color: rgba(251, 191, 36, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(245, 158, 11, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="address"] {
            background: rgba(6, 182, 212, 0.15);
            color: #67e8f9;
            border-color: rgba(34, 211, 238, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(6, 182, 212, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="birthday"] {
            background: rgba(236, 72, 153, 0.15);
            color: #f9a8d4;
            border-color: rgba(244, 114, 182, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(236, 72, 153, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="gallery"] {
            background: rgba(212, 175, 55, 0.15);
            color: #fde68a;
            border-color: rgba(212, 175, 55, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(212, 175, 55, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="ceremony"] {
            background: rgba(107, 27, 154, 0.15);
            color: #e9d5ff;
            border-color: rgba(168, 85, 247, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(107, 27, 154, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="linebot"] {
            background: rgba(6, 199, 85, 0.15);
            color: #bbf7d0;
            border-color: rgba(6, 199, 85, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(6, 199, 85, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="systrun"] {
            background: rgba(59, 130, 246, 0.15);
            color: #bfdbfe;
            border-color: rgba(59, 130, 246, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(59, 130, 246, 0.15);
        }

        .sidebar-menu-item.active[data-nav-accent="payment"] {
            background: rgba(52, 211, 153, 0.15);
            color: #a7f3d0;
            border-color: rgba(52, 211, 153, 0.35);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(52, 211, 153, 0.15);
        }

        .sidebar-menu-item--parent.active[data-nav-accent="linebot"] {
            background: rgba(6, 199, 85, 0.1);
            color: #d1fae5;
            border-color: rgba(6, 199, 85, 0.25);
            box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.45), 0 0 10px rgba(6, 199, 85, 0.15);
        }

        .gas-tool-card {
            border: 1px solid rgba(255, 255, 255, 0.08);
            transition: border-color 0.2s, background 0.2s;
        }

        .gas-tool-card:hover {
            border-color: rgba(212, 175, 55, 0.25);
            background: rgba(255, 255, 255, 0.03);
        }

        .gas-tool-run-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
        }

        #gasToolResultLog {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            font-size: 11px;
            line-height: 1.5;
            max-height: 280px;
            overflow-y: auto;
            white-space: pre-wrap;
            word-break: break-word;
        }

        #manageLineBotView[data-mode="view"] .line-bot-input {
            pointer-events: none;
            background: rgba(255, 255, 255, 0.04);
            border-color: rgba(255, 255, 255, 0.08);
            color: #f3f4f6;
        }

        #manageLineBotView[data-mode="view"] .line-bot-toggle-eye {
            display: none;
        }

        .line-bot-profile-fallback {
            background: linear-gradient(135deg, rgba(6, 199, 85, 0.25), rgba(212, 175, 55, 0.15));
        }

        .sidebar-menu-item--parent.active[data-nav-accent="customer"] {
            background: rgba(245, 158, 11, 0.1);
            color: #fde68a;
            border-left-color: rgba(251, 191, 36, 0.55);
        }

        .nav-path {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.2rem 0.35rem;
            margin-top: 0.35rem;
            font-size: 0.68rem;
            line-height: 1.35;
            color: rgba(255, 248, 240, 0.45);
        }

        .nav-path__seg--current {
            font-weight: 700;
        }

        .nav-path__sep {
            opacity: 0.45;
            user-select: none;
        }

        .nav-path[data-accent="create"] .nav-path__seg--current { color: #93c5fd; }
        .nav-path[data-accent="orders"] .nav-path__seg--current { color: #f9a8d4; }
        .nav-path[data-accent="scanner"] .nav-path__seg--current { color: #86efac; }
        .nav-path[data-accent="quick"] .nav-path__seg--current { color: #fde047; }
        .nav-path[data-accent="print"] .nav-path__seg--current { color: #c4b5fd; }
        .nav-path[data-accent="customer"] .nav-path__seg--current,
        .nav-path[data-accent="address"] .nav-path__seg--current { color: #67e8f9; }
        .nav-path[data-accent="birthday"] .nav-path__seg--current { color: #f9a8d4; }
        .nav-path[data-accent="gallery"] .nav-path__seg--current { color: #fde68a; }
        .nav-path[data-accent="ceremony"] .nav-path__seg--current { color: #e9d5ff; }
        .nav-path[data-accent="product"] .nav-path__seg--current { color: #f0abfc; }
        .nav-path[data-accent="payment"] .nav-path__seg--current { color: #6ee7b7; }

        .header-action.is-active.header-action--create {
            border-color: rgba(96, 165, 250, 0.65);
            box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35), 0 4px 14px rgba(59, 130, 246, 0.2);
            color: #93c5fd;
        }

        .header-action.is-active.header-action--orders {
            border-color: rgba(244, 114, 182, 0.65);
            box-shadow: 0 0 0 1px rgba(219, 39, 119, 0.35), 0 4px 14px rgba(219, 39, 119, 0.2);
            color: #fbcfe8;
        }

        .header-action.is-active.header-action--print {
            border-color: rgba(167, 139, 250, 0.65);
            box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.35), 0 4px 14px rgba(124, 58, 237, 0.2);
            color: #ddd6fe;
        }

        .sidebar-menu-item i {
            width: 20px;
            text-align: center;
            font-size: 1rem;
        }

        .sidebar-menu-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.08);
            margin: 0.5rem 1rem;
        }

        .sidebar-menu-item--parent {
            cursor: pointer;
            user-select: none;
        }

        .sidebar-menu-item--parent .sidebar-chevron {
            margin-left: auto;
            font-size: 0.65rem;
            opacity: 0.55;
            transition: transform 0.2s ease;
        }

        .sidebar-menu-item--parent.expanded .sidebar-chevron {
            transform: rotate(90deg);
        }

        .sidebar-submenu {
            display: none;
            flex-direction: column;
            padding: 0.15rem 0 0.35rem 0.5rem;
            border-left: 2px solid rgba(212, 175, 55, 0.25);
            margin: 0 0 0.35rem 1rem;
        }

        .sidebar-submenu.show {
            display: flex;
        }

        .sidebar-submenu .sidebar-menu-item {
            padding: 0.65rem 0.85rem 0.65rem 1rem;
            font-size: 0.82rem;
            margin: 0.15rem 0.5rem;
        }

        .sidebar-auth-block {
            margin-top: auto;
        }

        .sidebar-menu-item--auth.is-logged-in {
            background: rgba(22, 163, 74, 0.1);
            border-color: rgba(74, 222, 128, 0.25);
            color: #bbf7d0;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        }

        .sidebar-menu-item--auth.is-logged-in:hover {
            background: rgba(22, 163, 74, 0.16);
            border-color: rgba(74, 222, 128, 0.45);
            color: #dcfce7;
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        .sidebar-menu-item--auth.is-logged-in i {
            color: #86efac;
        }

        .sidebar-menu-item--auth.sidebar-menu-item--change-pin {
            background: rgba(245, 158, 11, 0.08);
            border-color: rgba(251, 191, 36, 0.25);
            color: #fde68a;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        }

        .sidebar-menu-item--auth.sidebar-menu-item--change-pin:hover {
            background: rgba(245, 158, 11, 0.14);
            border-color: rgba(251, 191, 36, 0.45);
            color: #fef3c7;
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        #sessionCountdown {
            flex-shrink: 0;
        }

        /* ================================================================
           🖥️ TABLET RESPONSIVE LAYOUT (iPad — 768px+)
           ================================================================
           CSS-Only approach — ไม่มีการเปลี่ยนแปลง JavaScript
           ไม่กระทบ UI มือถือ (เฉพาะ min-width: 768px ขึ้นไป)
           ================================================================ */
        @media (min-width: 768px) {

            /* ─── 1. Main Container — ปลดล็อคความกว้าง ─── */
            #adminPanel {
                max-width: 1200px !important;
                padding: 0 1.5rem !important;
            }

            #manageSheetView,
            #searchPageView {
                max-width: 1200px !important;
                padding: 0 1.5rem !important;
            }

            /* ─── 2. Header — ขยายเต็มจอ ─── */
            header .header-inner {
                max-width: 1200px !important;
            }

            /* ─── 3. Typography — ปรับขนาดสำหรับ Tablet ─── */
            body {
                font-size: 15px;
            }

            .themed-input {
                font-size: 0.95rem !important;
                height: 44px;
            }

            textarea.themed-input {
                height: auto;
                min-height: 6rem;
            }

            .form-label {
                font-size: 0.9rem;
            }

            /* ─── 4. Glass Panels — ปรับ border-radius + padding ─── */
            .glass-panel.card-primary {
                border-radius: 1.75rem;
                padding: 1.5rem;
            }

            /* ─────────────────────────────────────────────────
               5. สร้างออร์เดอร์ (createOrderView) — SPLIT SCREEN
               ซ้าย: ข้อมูลออร์เดอร์ + ประเภท
               ขวา: ลูกค้า + สินค้า + โน๊ต
            ───────────────────────────────────────────────── */
            #createOrderView #orderForm, #quickAddOrderView #quickOrderForm {
                display: grid !important;
                grid-template-columns: 44% 1fr;
                gap: 0.4rem;
                align-items: start;
                grid-auto-flow: dense;
            }

            #createOrderView #orderForm > *, #quickAddOrderView #quickOrderForm > * {
                margin-top: 0 !important;
                margin-bottom: 0 !important;
            }

            /* The wrappers will hold the natural spacing gap-3 inside them, 
               but we can tighten it to 0.4rem matching the grid gap. */
            .tablet-col-left, .tablet-col-right {
                display: flex;
                flex-direction: column;
                gap: 0.4rem;
            }

            /* Full-width items */
            #createOrderView #editModeBanner {
                grid-column: 1 / -1;
            }
            #createOrderView .panel-order {
                grid-column: 1;
            }

            #createOrderView .panel-ceremony {
                grid-column: 1;
            }

            /* Right column */
            #createOrderView .panel-customer {
                grid-column: 2;
            }

            #createOrderView .panel-product {
                grid-column: 2;
            }

            #createOrderView .panel-note {
                grid-column: 2;
            }

            #createOrderView #slipUploadSection {
                grid-column: 2;
            }

            #createOrderView #createOrderAdvanced {
                grid-column: 1;
            }

            /* Spacer — full width */
            #createOrderView #orderForm > .h-24,
            #createOrderView #createOrderFooter {
                grid-column: 1 / -1;
            }

            /* ─────────────────────────────────────────────────
               6. สั่งซื้อด่วน (quickAddOrderView) — SPLIT SCREEN
               ซ้าย: ข้อมูลออร์เดอร์ + ลูกค้า
               ขวา: สินค้า + หลักฐานโอน
            ───────────────────────────────────────────────── */
            #quickAddOrderView #quickOrderForm > .h-24 {
                grid-column: 1 / -1;
            }

            /* ─────────────────────────────────────────────────
               7. Order Cards - Compact for Tablet (1 Column)
            ───────────────────────────────────────────────── */
            .order-card-item {
                padding: 10px 12px !important;
                margin-bottom: 6px !important; /* Tighter spacing for single column */
                height: 96px !important; /* Fixed height ~3 lines */
            }
            
            .order-card-item .text-sm {
                font-size: 15px !important; /* Increased font */
            }
            .order-card-item .text-xs {
                font-size: 14px !important; /* Increased font */
                line-height: 1.4 !important;
            }
            .order-card-item [class~="text-[10px]"] {
                font-size: 12px !important;
            }
            .order-card-item .line-clamp-4 {
                -webkit-line-clamp: 2 !important; /* Fix to 2 item rows */
                line-clamp: 2 !important;
            }

            .order-card-created-date {
                display: inline !important;
                flex-shrink: 0;
            }

            /* ─────────────────────────────────────────────────
               9. สแกนสลิป (scannerView) — SPLIT SCREEN
               ซ้าย: Zone อัปโหลด (sticky)
               ขวา: ผลสแกน + ข้อมูลพัสดุ
            ───────────────────────────────────────────────── */
            #scannerView > .space-y-4,
            #scannerView > div:first-child {
                display: grid !important;
                grid-template-columns: 38% 1fr;
                gap: 1.25rem;
                align-items: start;
                grid-auto-flow: dense;
            }

            #scannerView > div:first-child > * {
                margin-top: 0 !important;
                margin-bottom: 0 !important;
            }

            /* Upload zone → left, spans all rows */
            #scannerView > div:first-child > .glass-panel.card-primary:first-child {
                grid-column: 1;
                grid-row: 1 / span 3;
                position: sticky;
                top: 90px;
            }

            /* Everything else → right column */
            #scannerView > div:first-child > *:not(:first-child) {
                grid-column: 2;
            }

            /* ─────────────────────────────────────────────────
               10. Fixed Footers — ขยาย container
            ───────────────────────────────────────────────── */
            #createOrderFooter > div {
                max-width: 1200px !important;
            }

            #quickOrderFooter > div {
                max-width: 1200px !important;
            }

            #bulkActionButtons > div {
                max-width: 1200px !important;
            }

            /* ─── 11. Modals — ขยายขนาด ─── */
            .modal-panel {
                max-width: 520px !important;
            }

            /* Global Tablet Font Scaling (+2pt) */
            .text-xs { font-size: 14px !important; }
            .text-sm { font-size: 16px !important; }
            .text-base { font-size: 18px !important; }
            .text-lg { font-size: 20px !important; }
            [class~="text-[10px]"] { font-size: 12px !important; }

            div:where(.swal2-container) div:where(.swal2-popup) {
                width: 300px !important;
                padding: 1.5rem 1.25rem !important;
            }

            /* ─── 12. Order List Container — ปรับ max-height ─── */
            .order-list-container {
                max-height: 78vh;
            }

            /* ─── 13. Sidebar — ปรับขนาดให้กว้างขึ้น ─── */
            #sidebar {
                width: 300px;
            }

            /* ─────────────────────────────────────────────────
               14. Visual Effects — เปิด Glassmorphism + Aurora กลับมา
               (iPad มี GPU แรงพอ ไม่ต้องประหยัดเหมือนมือถือ)
            ───────────────────────────────────────────────── */

            /* Aurora decorative blobs */
            .aurora-blob {
                display: block !important;
                opacity: 0.3;
            }

            /* Glass panels — เปิด blur กลับมา (override hover: none rule) */
            .glass-panel.card-primary {
                backdrop-filter: blur(12px) !important;
                -webkit-backdrop-filter: blur(12px) !important;
                background: rgba(255, 255, 255, 0.05) !important;
                transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease !important;
            }

            .glass-panel.card-primary:hover {
                transform: translateY(-3px) !important;
                box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4) !important;
                border-color: rgba(255, 255, 255, 0.2) !important;
                background: rgba(255, 255, 255, 0.06) !important;
            }

            /* Modal overlays — เปิด blur */
            .modal-overlay {
                backdrop-filter: blur(12px) !important;
                -webkit-backdrop-filter: blur(12px) !important;
            }

            /* SweetAlert2 — เปิด blur */
            body:not(.swal2-toast-shown) div:where(.swal2-container) {
                backdrop-filter: blur(8px) !important;
                -webkit-backdrop-filter: blur(8px) !important;
                background: rgba(0, 0, 0, 0.3) !important;
            }

            /* Loader animations — เปิดกลับมา */
            .loader-logo {
                animation: loader-breathe 2.2s infinite ease-in-out !important;
            }

            .loader-text {
                animation: loader-text-pulse 2.2s infinite ease-out !important;
            }

            .pulse-dot {
                animation: pulse-dot 1.5s infinite !important;
            }

            .success-checkmark {
                animation: success-pulse 1.5s ease-in-out infinite !important;
            }

            /* Update badge backdrop */
            .update-badge {
                backdrop-filter: blur(6px) !important;
                -webkit-backdrop-filter: blur(6px) !important;
            }

            /* ─── 15. Compact Table ─── */
            .compact-table-container {
                max-height: 75vh;
            }

            .compact-table {
                font-size: 0.85rem;
            }

            .compact-table th {
                padding: 14px 12px;
            }

            .compact-table td {
                padding: 12px;
            }

            /* ─── 16. Search & Filter bars — ปรับ padding ─── */
            #manageOrderView > .flex:first-child,
            #manageQuickOrderView > .glass-panel.card-primary:first-child {
                margin-bottom: 1rem;
            }

            /* ─── 17. Quick Order Footer — ปรับ layout ─── */
            #quickOrderFooter .bulk-action-btn-inline,
            #quickOrderFooter button {
                font-size: 0.85rem;
            }

            /* เดสก์ท็อป: ไม่กระจายปุ่มเต็มความกว้าง — จัดกลุ่มปุ่ม action ชิดขวา
               "ทั้งหมด" คงอยู่ซ้าย, ปุ่ม ลบ/สรุป/พิมพ์ เกาะกลุ่มกันมีระยะห่างพอดี */
            #quickOrderFooter > div > .flex-1 {
                flex: 0 0 auto;
                margin-left: auto;
                justify-content: flex-end !important;
                gap: 0.75rem;
            }

        }

        /* ================================================================
           🧷 SIDEBAR PINNED RAIL (≥768px) — ค้างเสมอ ย่อ/ขยาย จำสถานะ
           มือถือ (<768px) ไม่ได้รับผลกระทบ: ยังเป็น drawer + overlay + ปัดจอ
           ================================================================ */
        @media (min-width: 768px) {
            /* sidebar อยู่ค้างเสมอ ไม่ใช่ off-canvas อีกต่อไป */
            #sidebar {
                transform: none !important;
                width: var(--sidebar-w);
                transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            }

            /* ดันเนื้อหา + header ไม่ให้ถูกทับ (push layout แทน overlay) */
            body {
                padding-left: var(--sidebar-w);
                transition: padding-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            }

            .app-header {
                left: var(--sidebar-w) !important;
                transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            }

            /* ≥768px ไม่ใช้ overlay */
            #sidebarOverlay,
            #sidebarOverlay.show {
                display: none !important;
            }

            /* ───── โหมดย่อ (rail) ───── */
            body.sidebar-collapsed {
                padding-left: var(--sidebar-w-rail);
            }

            body.sidebar-collapsed .app-header {
                left: var(--sidebar-w-rail) !important;
            }

            body.sidebar-collapsed #sidebar {
                width: var(--sidebar-w-rail);
            }

            /* rail: ซ่อนข้อความ เหลือเฉพาะไอคอน */
            body.sidebar-collapsed #sidebar .sidebar-menu-item {
                justify-content: center;
                padding-left: 0;
                padding-right: 0;
                margin-left: 0.5rem;
                margin-right: 0.5rem;
            }

            body.sidebar-collapsed #sidebar .sidebar-menu-item > span,
            body.sidebar-collapsed #sidebar .sidebar-chevron,
            body.sidebar-collapsed #sidebar #sessionCountdown {
                display: none !important;
            }

            body.sidebar-collapsed #sidebar .sidebar-header > div:first-child span {
                display: none;
            }

            body.sidebar-collapsed #sidebar .sidebar-header {
                justify-content: center;
            }

            /* rail: ยุบ submenu ที่กางอยู่ (rail โชว์เฉพาะไอคอน parent) */
            body.sidebar-collapsed #sidebar .sidebar-submenu,
            body.sidebar-collapsed #sidebar .sidebar-submenu.show {
                display: none !important;
            }

            body.sidebar-collapsed #sidebar .sidebar-menu-divider {
                margin-left: 0.75rem;
                margin-right: 0.75rem;
            }

            /* tooltip ตอน rail: hover ไอคอน → โชว์ชื่อเมนูจาก title */
            body.sidebar-collapsed #sidebar .sidebar-menu-item[title] {
                position: relative;
            }

            body.sidebar-collapsed #sidebar .sidebar-menu-item[title]:hover::after {
                content: attr(title);
                position: absolute;
                left: calc(100% + 10px);
                top: 50%;
                transform: translateY(-50%);
                white-space: nowrap;
                background: #1A1A2E;
                color: #fff;
                padding: 0.4rem 0.65rem;
                border-radius: 8px;
                font-size: 0.78rem;
                border: 1px solid rgba(255, 255, 255, 0.12);
                box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
                z-index: 60;
                pointer-events: none;
            }

            /* ปุ่ม chevron ใน sidebar-header: หมุนหัวลูกศรตามสถานะ */
            #sidebarRailToggle i {
                transition: transform 0.28s ease;
            }
            body.sidebar-collapsed #sidebarRailToggle i {
                transform: rotate(180deg);
            }
        }

        /* ================================================================
           Extra-wide Tablet / Landscape (1024px+) — Bonus Enhancements
           ================================================================ */
        @media (min-width: 1024px) {

            #adminPanel {
                max-width: 1400px !important;
                padding: 0 2rem !important;
            }

            #manageSheetView,
            #searchPageView {
                max-width: 1400px !important;
                padding: 0 2rem !important;
            }

            header .header-inner {
                max-width: 1400px !important;
            }

            #createOrderFooter > div,
            #quickOrderFooter > div,
            #bulkActionButtons > div {
                max-width: 1400px !important;
            }

            /* Wider split for forms */
            #createOrderView #orderForm,
            #quickAddOrderView #quickOrderForm {
                grid-template-columns: 42% 1fr;
                gap: 1.5rem;
            }

            /* Scanner — wider left panel */
            #scannerView > div:first-child {
                grid-template-columns: 35% 1fr;
            }

            /* Modals — even larger */
            .modal-panel {
                max-width: 580px !important;
            }

            body {
                font-size: 15.5px;
            }
        }
    </style>
    <link rel="stylesheet" href="/aurora-luxury-theme.css?v=3">
    <style>
        /* DrewvyBot skin override — visual only */
        :root,
        [data-theme="light"],
        [data-theme="dark"] {
            --phaya-primary: #3CB371;
            --phaya-accent: #3CB371;
            --accent: #3CB371;
            --accent-color: #3CB371;
            --accent-hover: #45C983;
            --bg-base: #111827;
            --bg-dark: #111827;
            --bg-sidebar: #1f2937;
            --bg-card: #1f2937;
            --bg-elevated: #374151;
            --bg-input: rgba(255, 255, 255, 0.05);
            --border-color: rgba(156, 163, 175, 0.2);
            --border-strong: rgba(156, 163, 175, 0.28);
            --text-heading: #f9fafb;
            --text-primary: #e5e7eb;
            --text-muted: #9CA3AF;
            --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
            --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
            --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.32);
            --font-primary: 'Thonburi', 'IBM Plex Sans Thai', 'Sarabun', 'Noto Sans Thai', sans-serif;
        }

        body:has(#replyRulesView.active),
        body:has(#broadcastView.active),
        body:has(#lineCustomersView.active),
        body:has(#manageLineBotView.active) {
            font-family: var(--font-primary) !important;
            background: #111827 !important;
            color: #e5e7eb !important;
        }

        body:has(#replyRulesView.active) .aurora-blob,
        body:has(#replyRulesView.active) .blob-1,
        body:has(#replyRulesView.active) .blob-2,
        body:has(#replyRulesView.active) .blob-3,
        body:has(#broadcastView.active) .aurora-blob,
        body:has(#broadcastView.active) .blob-1,
        body:has(#broadcastView.active) .blob-2,
        body:has(#broadcastView.active) .blob-3,
        body:has(#lineCustomersView.active) .aurora-blob,
        body:has(#lineCustomersView.active) .blob-1,
        body:has(#lineCustomersView.active) .blob-2,
        body:has(#lineCustomersView.active) .blob-3,
        body:has(#manageLineBotView.active) .aurora-blob,
        body:has(#manageLineBotView.active) .blob-1,
        body:has(#manageLineBotView.active) .blob-2,
        body:has(#manageLineBotView.active) .blob-3 {
            display: none !important;
        }

        #replyRulesView .glass-panel,
        #replyRulesView .glass-panel.card-primary,
        #broadcastView .glass-panel,
        #broadcastView .glass-panel.card-primary,
        #lineCustomersView .glass-panel,
        #lineCustomersView .glass-panel.card-primary,
        #manageLineBotView .glass-panel,
        #manageLineBotView .glass-panel.card-primary,
        #replyRulesView .modal-panel,
        #broadcastView .modal-panel,
        #lineCustomersView .modal-panel,
        #manageLineBotView .modal-panel,
        #replyRulesView .compact-table-container,
        #broadcastView .compact-table-container,
        #lineCustomersView .compact-table-container,
        #manageLineBotView .compact-table-container,
        #replyRulesView .gas-tool-card,
        #broadcastView .gas-tool-card,
        #lineCustomersView .gas-tool-card,
        #manageLineBotView .gas-tool-card {
            background: #1f2937 !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16) !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            border-radius: 12px !important;
        }

        #replyRulesView .themed-input,
        #broadcastView .themed-input,
        #lineCustomersView .themed-input,
        #manageLineBotView .themed-input,
        #replyRulesView select.themed-input,
        #broadcastView select.themed-input,
        #lineCustomersView select.themed-input,
        #manageLineBotView select.themed-input,
        #replyRulesView textarea.themed-input,
        #broadcastView textarea.themed-input,
        #lineCustomersView textarea.themed-input,
        #manageLineBotView textarea.themed-input,
        #replyRulesView input.themed-input,
        #broadcastView input.themed-input,
        #lineCustomersView input.themed-input,
        #manageLineBotView input.themed-input {
            min-height: 44px !important;
            border-radius: 10px !important;
            background-color: #374151 !important;
            background-image: none !important;
            color: #f9fafb !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            box-shadow: none !important;
            font-size: 14px !important;
        }

        #replyRulesView select.themed-input,
        #broadcastView select.themed-input,
        #lineCustomersView select.themed-input,
        #manageLineBotView select.themed-input {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%233CB371' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
            background-position: right 0.6rem center !important;
            background-repeat: no-repeat !important;
            background-size: 1.1em 1.1em !important;
            padding-right: 2.2rem !important;
        }

        #replyRulesView .themed-input::placeholder,
        #broadcastView .themed-input::placeholder,
        #lineCustomersView .themed-input::placeholder,
        #manageLineBotView .themed-input::placeholder,
        #replyRulesView textarea.themed-input::placeholder,
        #broadcastView textarea.themed-input::placeholder,
        #lineCustomersView textarea.themed-input::placeholder,
        #manageLineBotView textarea.themed-input::placeholder,
        #replyRulesView input.themed-input::placeholder,
        #broadcastView input.themed-input::placeholder,
        #lineCustomersView input.themed-input::placeholder,
        #manageLineBotView input.themed-input::placeholder {
            color: #9CA3AF !important;
        }

        #replyRulesView .themed-input:focus,
        #broadcastView .themed-input:focus,
        #lineCustomersView .themed-input:focus,
        #manageLineBotView .themed-input:focus,
        #replyRulesView .themed-input:focus-visible,
        #broadcastView .themed-input:focus-visible,
        #lineCustomersView .themed-input:focus-visible,
        #manageLineBotView .themed-input:focus-visible,
        #replyRulesView select.themed-input:focus,
        #broadcastView select.themed-input:focus,
        #lineCustomersView select.themed-input:focus,
        #manageLineBotView select.themed-input:focus,
        #replyRulesView textarea.themed-input:focus,
        #broadcastView textarea.themed-input:focus,
        #lineCustomersView textarea.themed-input:focus,
        #manageLineBotView textarea.themed-input:focus {
            border-color: #3CB371 !important;
            box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.16) !important;
            outline: none !important;
        }

        #replyRulesView,
        #broadcastView,
        #lineCustomersView,
        #manageLineBotView {
            color: #e5e7eb;
        }

        #replyRulesView > .space-y-4 > .glass-panel:first-child,
        #broadcastView > .grid.grid-cols-1.md\\:grid-cols-12 > div:first-child > .glass-panel,
        #lineCustomersView > .space-y-4 > .glass-panel:first-child,
        #manageLineBotView > .space-y-4 > .glass-panel:first-child {
            background: rgba(0, 0, 0, 0.12) !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            border-radius: 12px !important;
            padding: 6px !important;
        }

        #manageLineBotView .space-y-4 > .glass-panel,
        #replyRulesContent > .space-y-4 > .glass-panel,
        #broadcastContent .broadcast-pane,
        #lineCustomersContent > .glass-panel {
            padding: 24px !important;
        }

        #broadcastView #broadcastContent.broadcast-shell {
            padding: 24px !important;
            border-radius: 28px !important;
            background: #1f2937 !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
        }

        #broadcastView .broadcast-pane {
            background: rgba(0, 0, 0, 0.12) !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            border-radius: 12px !important;
            box-shadow: none !important;
        }

        #broadcastView .broadcast-recipient-row {
            min-height: 64px;
        }

        #broadcastView .broadcast-recipient-row.is-selected {
            border-color: #3CB371 !important;
            box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.14) !important;
            background: rgba(60, 179, 113, 0.08) !important;
        }

        #lineBotWebhookUrl,
        #lineBot1Token,
        #lineBot1Secret,
        #lineBot2Token,
        #lineBot2Secret,
        #drewvyFirebaseApiKey {
            letter-spacing: 0 !important;
        }

        #manageLineBotView h4,
        #replyRulesView h4,
        #broadcastView h3,
        #broadcastView h4,
        #lineCustomersView h4 {
            color: #f9fafb !important;
        }

        #manageLineBotView .form-label,
        #replyRulesView .form-label,
        #broadcastView .form-label,
        #lineCustomersView .form-label {
            color: #9CA3AF !important;
            font-size: 12px !important;
            font-weight: 700 !important;
        }

        #replyRulesView #rulesListContainer .glass-panel,
        #broadcastView #broadcast-recipient-list > div,
        #lineCustomersView #customersGridContainer > div,
        #manageLineBotView #lineBotQuotaRows > div,
        #broadcastView #broadcast-blocks-container > div {
            background: #1f2937 !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            border-radius: 12px !important;
        }

        #replyRulesView #rulesListContainer .glass-panel:hover,
        #broadcastView #broadcast-recipient-list > div:hover,
        #lineCustomersView #customersGridContainer > div:hover,
        #broadcastView #broadcast-blocks-container > div:hover {
            border-color: rgba(60, 179, 113, 0.44) !important;
            box-shadow: 0 0 0 1px rgba(60, 179, 113, 0.12) !important;
        }

        #lineCustomersView #customersGridContainer {
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
            gap: 12px !important;
        }

        #lineCustomersView #customersGridContainer > div[class*="border-cyan-500"],
        #broadcastView #broadcast-recipient-list > div[class*="border-cyan-400"] {
            border-color: #3CB371 !important;
            box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.14) !important;
        }

        #lineCustomersView .text-cyan-400,
        #lineCustomersView .text-cyan-300,
        #broadcastView .text-cyan-300,
        #replyRulesView .text-cyan-300,
        #replyRulesView .text-cyan-400,
        #manageLineBotView .text-cyan-400 {
            color: #45C983 !important;
        }

        #lineCustomersView .bg-green-500\\/10,
        #lineCustomersView .bg-green-600,
        #lineCustomersView [class*="ติดตาม"],
        #broadcastView .bg-emerald-500\\/20,
        #manageLineBotView .bg-green-500\\/20 {
            color: #45C983 !important;
        }

        #lineCustomersView span[class*="bg-green"],
        #lineCustomersView span[class*="ติดตาม"],
        #manageLineBotView .text-green-400,
        #manageLineBotView .text-green-300,
        #manageLineBotView .text-amber-300,
        #manageLineBotView .text-yellow-400,
        #broadcastView .text-yellow-400,
        #broadcastView .text-green-400,
        #replyRulesView .text-yellow-400,
        #replyRulesView .text-green-400 {
            color: #45C983 !important;
        }

        #lineCustomersView span[class*="rounded-full"],
        #manageLineBotView span[class*="rounded-full"],
        #broadcastView span[class*="rounded-full"],
        #replyRulesView span[class*="rounded-full"] {
            border-radius: 999px !important;
        }

        #lineCustomersView .text-gray-500,
        #lineCustomersView .text-gray-400,
        #broadcastView .text-gray-500,
        #broadcastView .text-gray-400,
        #manageLineBotView .text-gray-500,
        #manageLineBotView .text-gray-400,
        #replyRulesView .text-gray-500,
        #replyRulesView .text-gray-400 {
            color: #9CA3AF !important;
        }

        #broadcastView .minimal-dropdown,
        #broadcastView #broadcast-load-rule-select {
            min-height: 40px !important;
            border-radius: 10px !important;
            background: #374151 !important;
            color: #f9fafb !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
        }

        #broadcastView #broadcast-blocks-container {
            background: rgba(0, 0, 0, 0.12) !important;
            border: 1px solid rgba(156, 163, 175, 0.2) !important;
            border-radius: 12px !important;
        }

        #manageLineBotView #lineBotQuotaPanel,
        #broadcastView #broadcast-recipient-collapse-content,
        #broadcastView #broadcast-rule-filter-container {
            border-color: rgba(156, 163, 175, 0.16) !important;
        }

        #manageLineBotView .panel-customer,
        #manageLineBotView .panel-ceremony,
        #manageLineBotView .panel-note {
            background: #1f2937 !important;
        }

        #manageLineBotView .line-bot-profile-fallback,
        #lineCustomersView #customersGridContainer img,
        #broadcastView #broadcast-recipient-list img,
        #broadcastView #broadcast-set-card-list img {
            box-shadow: none !important;
        }

        #ruleEditModal.reply-rule-editor-modal {
            align-items: center;
            padding: 18px;
            background: rgba(2, 6, 23, 0.78) !important;
        }

        #ruleEditModal .rule-editor-panel {
            width: min(1040px, calc(100vw - 32px));
            max-height: 92vh !important;
            padding: 0 !important;
            overflow: hidden;
            background: #374151 !important;
            border: 1px solid rgba(74, 222, 128, 0.24) !important;
            border-radius: 28px !important;
            box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
        }

        #ruleEditModal .rule-editor-panel.is-expanded {
            width: min(1180px, calc(100vw - 16px));
            max-height: calc(100vh - 16px) !important;
            border-radius: 22px !important;
        }

        #ruleEditModal .rule-editor-panel.is-expanded .rule-editor-form {
            max-height: calc(100vh - 136px) !important;
        }

        #ruleEditModal .rule-editor-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            padding: 28px 32px 24px;
            background: #374151;
            border-bottom: 1px solid rgba(148, 163, 184, 0.24);
        }

        #ruleEditModal .rule-editor-title {
            color: #f8fafc !important;
            font-size: clamp(1.35rem, 2.2vw, 2rem);
            line-height: 1.15;
            letter-spacing: 0;
        }

        #ruleEditModal .rule-editor-subtitle {
            color: #a7b0bf;
            font-size: 0.9rem;
            font-weight: 700;
            margin-top: 8px;
        }

        #ruleEditModal .rule-editor-icon-btn,
        #ruleEditModal .rule-editor-undo-btn {
            min-width: 48px;
            min-height: 48px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(30, 41, 59, 0.68);
            color: #cbd5e1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-weight: 800;
            transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
        }

        #ruleEditModal .rule-editor-undo-btn {
            padding: 0 14px;
            color: #86efac;
            border-color: rgba(74, 222, 128, 0.28);
        }

        #ruleEditModal .rule-editor-icon-btn:hover,
        #ruleEditModal .rule-editor-undo-btn:hover {
            background: rgba(51, 65, 85, 0.92);
            border-color: rgba(74, 222, 128, 0.5);
            color: #ffffff;
        }

        #ruleEditModal .rule-editor-form {
            max-height: calc(92vh - 120px) !important;
            padding: 28px 32px;
            background: #1f2937;
        }

        #ruleEditModal .rule-editor-form > .grid,
        #ruleEditModal .rule-editor-form > div:not(.rule-editor-footer) {
            border: 1px solid rgba(34, 197, 94, 0.2);
            background: rgba(15, 23, 42, 0.35);
            border-radius: 18px;
            padding: 22px;
        }

        #ruleEditModal .form-label,
        #ruleEditModal label.form-label {
            color: #6ee7b7 !important;
            font-size: 0.95rem !important;
            font-weight: 900 !important;
            margin-bottom: 12px;
        }

        #ruleEditModal .themed-input,
        #ruleEditModal input.themed-input,
        #ruleEditModal select.themed-input,
        #ruleEditModal textarea.themed-input {
            min-height: 56px !important;
            border-radius: 16px !important;
            background: #334155 !important;
            border: 1px solid rgba(148, 163, 184, 0.34) !important;
            color: #f8fafc !important;
            font-size: 1rem !important;
            font-weight: 750;
        }

        #ruleEditModal textarea.themed-input {
            min-height: 132px !important;
            line-height: 1.55;
        }

        #ruleEditModal .themed-input:focus,
        #ruleEditModal .themed-input:focus-visible {
            border-color: #3CB371 !important;
            box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.28) !important;
        }

        #ruleEditModal #rule-blocks-container {
            border-color: rgba(148, 163, 184, 0.18) !important;
            background: rgba(15, 23, 42, 0.52) !important;
            border-radius: 18px !important;
        }

        #ruleEditModal .rule-block-card {
            border-radius: 18px !important;
            background: #1f2937 !important;
            border: 1px solid rgba(148, 163, 184, 0.28) !important;
            border-left: 5px solid #34d399 !important;
            padding: 22px !important;
            box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18) !important;
        }

        #ruleEditModal .rule-block-card.rule-block-image {
            border-left-color: #3b82f6 !important;
        }

        #ruleEditModal .rule-block-card.rule-block-buttons {
            border-left-color: #fbbf24 !important;
        }

        #ruleEditModal .rule-block-card.rule-block-video {
            border-left-color: #ec4899 !important;
        }

        #ruleEditModal .rule-block-title {
            color: #4ade80 !important;
            font-size: 1.02rem !important;
            font-weight: 900 !important;
        }

        #ruleEditModal .rule-block-index {
            width: 26px;
            height: 26px;
            border-radius: 8px;
            background: rgba(74, 222, 128, 0.16);
            color: #86efac;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.78rem;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        }

        #ruleEditModal .rule-block-toolbar button {
            width: 44px;
            height: 44px;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.22);
            background: rgba(51, 65, 85, 0.72);
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        #ruleEditModal .rule-image-preview,
        #ruleEditModal .rule-video-preview {
            margin-top: 18px;
            overflow: hidden;
            border-radius: 16px;
            border: 1px solid rgba(226, 232, 240, 0.55);
            background: #0f172a;
        }

        #ruleEditModal .rule-image-preview img,
        #ruleEditModal .rule-video-preview video {
            display: block;
            width: 100%;
            max-height: 360px;
            object-fit: contain;
            background: #0f172a;
        }

        #ruleEditModal .rule-upload-btn {
            min-height: 56px;
            border-radius: 16px;
            padding: 0 18px;
            background: rgba(52, 211, 153, 0.12);
            border: 1px solid rgba(52, 211, 153, 0.45);
            color: #6ee7b7;
            font-weight: 900;
        }

        #ruleEditModal .rule-add-block-btn {
            min-height: 54px;
            border-radius: 16px;
            border: 1px solid rgba(148, 163, 184, 0.26);
            background: rgba(15, 23, 42, 0.36);
            color: #d1d5db;
            font-weight: 900;
        }

        #ruleEditModal .rule-add-block-btn:hover {
            border-color: rgba(74, 222, 128, 0.46);
            background: rgba(34, 197, 94, 0.12);
            color: #f8fafc;
        }

        #ruleEditModal .rule-editor-footer {
            position: static;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 18px;
            margin: 30px 0 0;
            padding: 22px 32px;
            background: rgba(31, 41, 55, 0.98);
            border-top: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 18px;
        }

        @media (max-width: 640px) {
            #ruleEditModal {
                padding: 10px;
            }

            #ruleEditModal .rule-editor-header {
                padding: 14px 16px 12px;
                gap: 10px;
            }

            #ruleEditModal .rule-editor-form {
                padding: 12px 12px;
            }

            #ruleEditModal .rule-editor-footer {
                grid-template-columns: 1fr;
                padding: 14px;
                gap: 10px;
                margin-top: 16px;
            }

            /* ── มือถือ: ตัวอักษรไม่หนา + เล็กลง เพื่อมุมมองกว้างขึ้น ── */
            #ruleEditModal .rule-editor-title {
                font-size: 1rem;
                font-weight: 600 !important;
                gap: 8px;
            }

            #ruleEditModal .rule-editor-subtitle {
                font-size: 0.7rem;
                font-weight: 400;
                margin-top: 3px;
            }

            #ruleEditModal .form-label,
            #ruleEditModal label.form-label {
                font-size: 0.72rem !important;
                font-weight: 500 !important;
                margin-bottom: 6px;
            }

            #ruleEditModal .themed-input,
            #ruleEditModal input.themed-input,
            #ruleEditModal select.themed-input,
            #ruleEditModal textarea.themed-input {
                min-height: 44px !important;
                font-size: 0.8rem !important;
                font-weight: 400;
                border-radius: 12px !important;
            }

            #ruleEditModal textarea.themed-input {
                min-height: 100px !important;
            }

            #ruleEditModal .rule-block-title {
                font-size: 0.8rem !important;
                font-weight: 600 !important;
            }

            #ruleEditModal .rule-upload-btn,
            #ruleEditModal .rule-add-block-btn {
                min-height: 44px;
                font-size: 0.78rem;
                font-weight: 500;
            }

            #ruleEditModal .rule-editor-icon-btn,
            #ruleEditModal .rule-editor-undo-btn {
                min-width: 40px;
                min-height: 40px;
                font-weight: 500;
            }

            /* ลด padding กรอบ section + การ์ดบล็อกข้อความ ให้เห็นเนื้อหากว้างขึ้น */
            #ruleEditModal .rule-editor-form > .grid,
            #ruleEditModal .rule-editor-form > div:not(.rule-editor-footer) {
                padding: 12px;
                border-radius: 14px;
            }

            #ruleEditModal .rule-block-card {
                padding: 12px !important;
                border-radius: 14px !important;
            }

            #ruleEditModal .rule-block-toolbar button {
                width: 38px;
                height: 38px;
            }

            /* ── ปุ่มขยาย (มุมขวาบน) = เปิดเต็มจอจริงบนมือถือ ── */
            #ruleEditModal:has(.rule-editor-panel.is-expanded) {
                padding: 0;
            }

            #ruleEditModal .rule-editor-panel.is-expanded {
                width: 100vw !important;
                max-width: 100vw;
                height: 100vh;
                max-height: 100vh !important;
                height: 100dvh;
                max-height: 100dvh !important;
                border-radius: 0 !important;
                border: 0 !important;
            }

            #ruleEditModal .rule-editor-panel.is-expanded .rule-editor-form {
                max-height: none !important;
                flex: 1;
            }
        }

        .loader-overlay,
        #loader {
            background: rgba(17, 24, 39, 0.88) !important;
        }

        @media (min-width: 1024px) {
            #replyRulesView .space-y-4,
            #broadcastView .grid.grid-cols-1.md\\:grid-cols-12,
            #lineCustomersView .space-y-4,
            #manageLineBotView .space-y-4 {
                gap: 16px !important;
            }
        }

        /* ⚡ Glassmorphism Passcode Login Modal Styling */
        #loginModal .modal-panel {
            background: rgba(20, 20, 35, 0.4) !important;
            backdrop-filter: blur(25px) cubic-bezier(0.25, 0.8, 0.25, 1) !important;
            -webkit-backdrop-filter: blur(25px) cubic-bezier(0.25, 0.8, 0.25, 1) !important;
            border: 1px solid rgba(255, 255, 255, 0.08) !important;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45) !important;
            border-radius: 2rem;
            contain: unset !important; /* Allow filter/glow effects to render outside */
        }

        .glass-slot {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
        }

        .glass-slot::after {
            content: '';
            position: absolute;
            bottom: 8px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.15);
            opacity: 1;
            transition: opacity 0.15s, background-color 0.15s;
        }

        .glass-slot.filled::after {
            opacity: 0;
        }

        .glass-slot.active {
            border-color: rgba(245, 158, 11, 0.65);
            background: rgba(255, 255, 255, 0.06);
            box-shadow: 0 0 12px rgba(245, 158, 11, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.15);
            transform: scale(1.05);
        }

        .glass-slot.active::after {
            background: rgba(245, 158, 11, 0.8);
            animation: pulse-dot-passcode 1.2s infinite ease-in-out;
        }

        @keyframes pulse-dot-passcode {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 1; }
        }

        .glass-key {
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            transition: all 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        .glass-key:active {
            background: rgba(255, 255, 255, 0.15) !important;
            transform: scale(0.92);
        }

        /* ===== หน้าพิมพ์รายรับ (printReceiptView) ===== */
        .prc-source-btn {
            display: flex; align-items: center; justify-content: center; gap: 0.4rem;
            padding: 0.65rem 0.5rem; border-radius: 0.85rem;
            border: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(255, 255, 255, 0.04);
            color: rgba(255, 248, 240, 0.75);
            font-size: 0.8rem; font-weight: 600;
            transition: all 0.18s ease;
        }
        .prc-source-btn:hover { background: rgba(255, 255, 255, 0.08); }
        .prc-source--active {
            background: linear-gradient(145deg, rgba(16, 185, 129, 0.3), rgba(13, 148, 136, 0.18));
            border-color: rgba(52, 211, 153, 0.45);
            color: #a7f3d0;
            box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
        }
        .prc-record-list {
            display: flex; flex-direction: column; gap: 0.75rem;
            max-height: 46vh; overflow-y: auto; padding-right: 4px;
        }
        .prc-day-group { display: flex; flex-direction: column; gap: 0.3rem; }
        .prc-day-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 0.4rem 0.6rem; border-radius: 0.6rem;
            background: rgba(16, 185, 129, 0.1);
            border-left: 3px solid rgba(52, 211, 153, 0.6);
            color: #a7f3d0; font-weight: 700; font-size: 0.82rem;
        }
        .prc-day-meta { color: rgba(255, 248, 240, 0.6); font-weight: 500; font-size: 0.72rem; }
        .prc-record-item {
            display: flex; align-items: center; gap: 0.65rem;
            padding: 0.55rem 0.75rem; border-radius: 0.7rem;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            cursor: pointer; transition: background 0.15s ease;
        }
        .prc-record-item:hover { background: rgba(255, 255, 255, 0.08); }
        .prc-record-item input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: #10b981; flex-shrink: 0; }
        .prc-rec-seq {
            flex-shrink: 0; min-width: 1.6rem; text-align: center;
            font-size: 0.7rem; font-weight: 700; color: rgba(255, 248, 240, 0.5);
        }
        .prc-rec-name { flex: 1; min-width: 0; color: #fff; font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .prc-rec-phone { margin-left: 0.5rem; color: rgba(255, 248, 240, 0.45); font-weight: 400; font-size: 0.72rem; }
        .prc-rec-total { flex-shrink: 0; font-size: 0.82rem; font-weight: 700; color: #fbbf24; font-family: ui-monospace, monospace; }
        /* ปุ่มสลับโหมดใน preview modal */
        /* Modal ตัวอย่างก่อนพิมพ์ — เลียนแบบหน้ากระดาษ A4 แนวนอน */
        .prc-preview-popup.swal2-popup {
            width: 1200px !important;
            max-width: 96vw !important;
            height: 95vh !important;
            display: flex !important;
            flex-direction: column !important;
            padding: 1.25rem 1.25rem 1rem !important;
        }
        .prc-preview-popup .swal2-html-container {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            min-height: 0;
            overflow: auto;
            margin: 0.5rem 0 0 !important;
            max-height: none !important;
        }
        .prc-preview-popup #prcPreviewFrame {
            flex: 1 1 auto;
            width: 100%;
            max-width: 1123px;
            min-height: 794px;
            margin: 0 auto;
            background: #fff;
            border: none;
            border-radius: 10px;
        }
        .prc-preview-toolbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; flex: 0 0 auto; }
        .prc-mode-btn {
            padding: 0.4rem 0.9rem; border-radius: 0.7rem;
            border: 1px solid rgba(255, 255, 255, 0.15);
            background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.7);
            font-size: 0.8rem; font-weight: 600; transition: all 0.15s ease;
        }
        .prc-mode-btn--active { background: rgba(16, 185, 129, 0.25); border-color: rgba(52, 211, 153, 0.5); color: #a7f3d0; }
        .prc-preview-count { margin-left: auto; font-size: 0.75rem; color: rgba(255, 255, 255, 0.55); }
    </style>

    <!-- ============================================================ -->
    <!-- BILL MANAGEMENT STYLES                                         -->
    <!-- ============================================================ -->
    <style>
        /* Sidebar accent */
        .sidebar-menu-item.active[data-nav-accent="bill"] {
            background: linear-gradient(135deg, rgba(245,158,11,.22) 0%, rgba(217,119,6,.15) 100%);
            border-color: rgba(245,158,11,.45); color: #fbbf24;
        }
        .sidebar-menu-item.active[data-nav-accent="bill"] i { color: #fbbf24; }
        .nav-path[data-accent="bill"] .nav-path__seg--current { color: #fbbf24; }

        /* Sheet tabs */
        .bill-sheet-tabs-wrap { display:flex; gap:6px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
        .bill-sheet-tabs-wrap::-webkit-scrollbar { display:none; }
        .bill-sheet-tab {
            display:inline-flex; align-items:center; gap:5px; padding:5px 12px;
            border-radius:20px; border:1px solid rgba(255,255,255,.12);
            background:rgba(255,255,255,.04); color:rgba(245,245,247,.6);
            font-size:11px; font-weight:600; white-space:nowrap; cursor:pointer;
            transition:all .15s; flex-shrink:0; font-family:inherit;
        }
        .bill-sheet-tab:hover { background:rgba(255,255,255,.08); color:#f5f5f7; }
        .bill-sheet-tab.active { background:rgba(245,158,11,.18); border-color:rgba(245,158,11,.45); color:#fbbf24; }
        .bill-sheet-add { border-style:dashed !important; color:rgba(245,158,11,.65) !important; border-color:rgba(245,158,11,.3) !important; }
        .bill-sheet-add:hover { background:rgba(245,158,11,.1) !important; }
        .bill-tab-count {
            background:rgba(255,255,255,.12); border-radius:10px; padding:1px 6px;
            font-size:9px; font-weight:700; color:rgba(245,245,247,.5);
        }
        .bill-sheet-tab.active .bill-tab-count { background:rgba(245,158,11,.25); color:#fbbf24; }

        /* Bill table */
        #billTableContainer { overflow-x:auto; -webkit-overflow-scrolling:touch; }
        .bill-table { width:100%; border-collapse:collapse; min-width:680px; }
        .bill-table th {
            background:rgba(245,158,11,.07); color:rgba(245,245,247,.7);
            font-size:11px; font-weight:700; padding:10px 8px; text-align:left;
            border-bottom:1px solid rgba(245,158,11,.2); white-space:nowrap;
            user-select:none; transition:background .15s;
        }
        .bill-table th.sortable { cursor:pointer; }
        .bill-table th.sortable:hover { background:rgba(245,158,11,.13); color:#fbbf24; }
        .bill-table td {
            padding:9px 8px; font-size:12px; color:rgba(245,245,247,.85);
            border-bottom:1px solid rgba(255,255,255,.05); vertical-align:middle;
        }
        .bill-table-row { transition:background .1s; cursor:default; }
        .bill-table-row:hover { background:rgba(255,255,255,.04); }
        .bill-table-row.selected { background:rgba(245,158,11,.07) !important; }
        .bill-checkbox { width:15px; height:15px; accent-color:#d97706; cursor:pointer; }
        .bill-td-check { width:36px; text-align:center; }
        .bill-td-id { width:46px; text-align:center; color:rgba(245,245,247,.45); font-size:11px; }
        .bill-td-date { width:125px; }
        .bill-td-store { width:108px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:108px; }
        .bill-td-desc { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:180px; }
        .bill-td-amount { width:96px; text-align:right; }
        .bill-td-slip { width:44px; text-align:center; }
        .bill-td-actions { width:96px; text-align:center; white-space:nowrap; }
        .bill-slip-btn {
            width:26px; height:26px; border-radius:6px;
            background:rgba(251,191,36,.1); border:1px solid rgba(251,191,36,.28);
            color:#fbbf24; font-size:11px; cursor:pointer; transition:all .15s;
            display:inline-flex; align-items:center; justify-content:center;
        }
        .bill-slip-btn:hover { background:rgba(251,191,36,.22); }
        .bill-action-btn {
            width:26px; height:26px; border-radius:6px;
            border:1px solid rgba(255,255,255,.1); background:rgba(255,255,255,.05);
            color:rgba(245,245,247,.6); font-size:11px; cursor:pointer;
            transition:all .15s; margin:0 1px;
            display:inline-flex; align-items:center; justify-content:center;
        }
        .bill-action-btn.bab-view:hover { background:rgba(96,165,250,.18); border-color:rgba(96,165,250,.4); color:#60a5fa; }
        .bill-action-btn.bab-edit:hover { background:rgba(245,158,11,.18); border-color:rgba(245,158,11,.4); color:#fbbf24; }
        .bill-action-btn.bab-del:hover { background:rgba(239,68,68,.18); border-color:rgba(239,68,68,.4); color:#f87171; }

        /* Buttons */
        .bill-btn {
            display:inline-flex; align-items:center; gap:6px;
            padding:8px 14px; border-radius:10px; font-size:12px; font-weight:600;
            cursor:pointer; transition:all .15s; border:1px solid transparent;
            white-space:nowrap; font-family:inherit;
        }
        .bill-btn:disabled { opacity:.5; cursor:not-allowed; }
        .bill-btn-primary { background:linear-gradient(135deg,#d97706,#f59e0b); color:#fff; }
        .bill-btn-primary:hover { filter:brightness(1.1); }
        .bill-btn-danger { background:rgba(220,38,38,.12); border-color:rgba(220,38,38,.3); color:#f87171; }
        .bill-btn-danger:hover { background:rgba(220,38,38,.22); }
        .bill-btn-secondary { background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.12); color:rgba(245,245,247,.7); }
        .bill-btn-secondary:hover { background:rgba(255,255,255,.1); color:#f5f5f7; }
        .bill-btn-amber { background:rgba(245,158,11,.12); border-color:rgba(245,158,11,.3); color:#fbbf24; }
        .bill-btn-amber:hover { background:rgba(245,158,11,.22); }
        .bill-btn-sm { padding:6px 10px; font-size:11px; }
        .bill-btn-save { background:linear-gradient(135deg,#d97706,#f59e0b); color:#fff; flex:1; justify-content:center; padding:10px; font-size:13px; border-radius:12px; }
        .bill-btn-save:hover { filter:brightness(1.1); }
        .bill-btn-cancel { background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.1); color:rgba(245,245,247,.65); flex:1; justify-content:center; padding:10px; font-size:13px; border-radius:12px; }
        .bill-btn-cancel:hover { background:rgba(255,255,255,.1); color:#f5f5f7; }

        /* Bill modals — use modal-overlay + modal-panel BUT override panel */
        .bill-modal-panel {
            background: linear-gradient(145deg, rgba(38,32,62,.98) 0%, rgba(24,20,48,.99) 100%) !important;
            border: 1px solid rgba(245,158,11,.3) !important;
            box-shadow: 0 30px 70px rgba(0,0,0,.7), 0 0 50px rgba(245,158,11,.07), inset 0 1px 0 rgba(255,255,255,.06) !important;
            max-width: 560px !important;
            width: 96% !important;
            border-radius: 20px !important;
            padding: 0 !important;
            overflow: hidden;
        }
        .bill-modal-header {
            display:flex; align-items:center; justify-content:space-between;
            padding:15px 18px 13px; border-bottom:1px solid rgba(255,255,255,.08);
        }
        .bill-modal-title { font-size:14px; font-weight:700; color:#fbbf24; display:flex; align-items:center; gap:8px; }
        .bill-modal-close {
            width:28px; height:28px; border-radius:50%;
            background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.1);
            color:rgba(245,245,247,.6); font-size:12px; cursor:pointer;
            display:flex; align-items:center; justify-content:center; transition:all .15s;
        }
        .bill-modal-close:hover { background:rgba(255,255,255,.12); color:#f5f5f7; }
        .bill-modal-body {
            flex:1; overflow-y:auto; padding:15px 18px;
            scrollbar-width:thin; scrollbar-color:rgba(245,158,11,.3) transparent;
            max-height:72vh;
        }
        .bill-modal-body::-webkit-scrollbar { width:4px; }
        .bill-modal-body::-webkit-scrollbar-thumb { background:rgba(245,158,11,.3); border-radius:4px; }
        .bill-modal-footer {
            padding:12px 18px 16px; border-top:1px solid rgba(255,255,255,.08);
            display:flex; gap:10px;
        }
        /* bill form label */
        .bill-label {
            display:block; font-size:10px; font-weight:700; letter-spacing:.05em;
            color:rgba(245,245,247,.55); text-transform:uppercase; margin-bottom:5px;
        }
        .bill-label .req { color:#f59e0b; margin-left:2px; }

        /* Image upload zones */
        .bill-upload-zone {
            border:1.5px dashed rgba(245,158,11,.32); border-radius:12px;
            background:rgba(245,158,11,.04); cursor:pointer;
            transition:all .18s; position:relative; overflow:hidden; min-height:80px;
            display:flex; align-items:center; justify-content:center;
        }
        .bill-upload-zone:hover { border-color:rgba(245,158,11,.6); background:rgba(245,158,11,.09); }
        .bill-upload-hint { font-size:11px; color:rgba(245,245,247,.4); text-align:center; padding:14px 8px; pointer-events:none; }
        .bill-upload-hint i { display:block; font-size:20px; color:rgba(245,158,11,.45); margin-bottom:5px; }
        .bill-upload-preview-wrap { position:relative; width:100%; }
        .bill-upload-preview { width:100%; max-height:150px; object-fit:contain; border-radius:8px; display:block; }
        .bill-upload-clear {
            position:absolute; top:5px; right:5px; width:24px; height:24px;
            border-radius:50%; background:rgba(220,38,38,.85); border:1.5px solid rgba(255,255,255,.2);
            color:#fff; font-size:10px; cursor:pointer;
            display:flex; align-items:center; justify-content:center;
            box-shadow:0 2px 6px rgba(0,0,0,.4); transition:background .15s;
        }
        .bill-upload-clear:hover { background:rgba(220,38,38,1); }
        .bill-images-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
        /* Square slots for extra images */
        .bill-images-grid .bill-upload-zone {
            aspect-ratio: 1 / 1;
            min-height: unset;
        }
        .bill-images-grid .bill-upload-preview-wrap {
            position: absolute;
            inset: 0;
        }
        .bill-images-grid .bill-upload-preview {
            width: 100%; height: 100%;
            max-height: none;
            object-fit: cover;
            border-radius: 10px;
        }

        /* Bill Detail fields */
        .bill-detail-field { display:flex; flex-direction:column; gap:3px; }
        .bill-detail-label { font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:rgba(245,245,247,.4); font-weight:700; }
        .bill-detail-value { font-size:13px; color:#f5f5f7; }

        /* Print option buttons */
        .bill-print-opt {
            flex:1; padding:18px 14px; border-radius:14px;
            border:1.5px solid rgba(245,158,11,.25); background:rgba(245,158,11,.05);
            cursor:pointer; transition:all .2s; text-align:center; font-family:inherit;
        }
        .bill-print-opt:hover { background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.55); transform:translateY(-2px); }
        .bill-print-opt .bp-icon { font-size:26px; color:#fbbf24; display:block; margin-bottom:7px; }
        .bill-print-opt .bp-label { font-size:14px; font-weight:700; color:#fbbf24; }
        .bill-print-opt .bp-sub { font-size:11px; color:rgba(245,245,247,.45); margin-top:3px; }

        /* Print preview iframe container */
        #billPrintIframe { width:100%; height:480px; border:none; border-radius:8px; background:#fff; }
        .bill-preview-modal-panel { max-width:700px !important; }

        /* ===== Bill View: Full-page layout (same pattern as manageSheetView) ===== */
        body:has(#manageBillView.active) #adminPanel {
            height: 0; overflow: hidden; min-height: 0; padding: 0;
        }
        #manageBillView.active {
            display: flex !important;
            flex-direction: column;
            height: var(--list-view-height);
            max-height: var(--list-view-height);
            overflow: hidden;
            min-height: 0;
        }
        #manageBillView.active > * { flex-shrink: 0; }
        #manageBillView.active > .glass-panel:has(#billTableBody) {
            flex: 1 1 auto;
            min-height: 0;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        #manageBillView.active #billTableContainer {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
    </style>

    <!-- Design System tokens — โหลดหลัง CSS เดิมทั้งหมดเพื่อ override -->
    <link rel="stylesheet" href="/design-tokens.css?v=3">

    <!-- Design System fixes — แก้ปัญหา ui-* ทับ dropdown/logo (โหลดหลัง design-tokens.css) -->
    <style>
        /* 1) การ์ด panel-order: ปล่อย overflow ให้ dropdown โผล่พ้นกรอบ */
        #createOrderView .ui-card.panel-order,
        #createOrderView .create-order-advanced,
        #createOrderView .create-order-advanced-body,
        #statusContainer,
        #statusContainer .cs-wrap { overflow: visible !important; }
        #shippingDropdownWrapper, #shippingDropdownPanel,
        #statusContainer, #bankPickerDropdown, #bankPickerMenu { overflow: visible; }
        /* ยก label + dropdown สถานะออร์เดอร์ */
        #statusContainer { position: relative; z-index: 30 !important; }
        #statusContainer .form-label { position: relative; z-index: 26; }
        #statusContainer .cs-wrap { position: relative; z-index: 40; }
        #statusContainer .cs-panel { z-index: 10050; }
        /* เส้น gradient 3px ด้านบนการ์ด (::before) */
        .ui-card.panel-order::before { border-radius: 1.5rem 1.5rem 0 0; z-index: 0; pointer-events: none; clip-path: inset(0 round 1.5rem 1.5rem 0 0); }
        .ui-card.panel-order > * { position: relative; z-index: 1; }

        /* ยกทั้ง section ค่าส่งให้อยู่เหนือ section ยอดรวม (sibling ที่อยู่ถัดมาใน DOM)
           เพื่อให้ dropdown ที่เปิดออกมา ไม่ถูกตัวอักษร "ยอดรวม/รับวิธีบูชาเพิ่ม" ทับ */
        #shippingSection { position: relative; z-index: 20; }
        #shippingDropdownWrapper { z-index: 21; }
        /* panel ที่เปิดออกมา ต้องทึบเต็ม (กันข้อความด้านหลังทะลุขึ้นมา) */
        #shippingDropdownPanel {
            background: #0f0d1e !important;
            z-index: 60;
            box-shadow: 0 12px 40px rgba(0,0,0,.7);
        }
        #shippingDropdownList { background: #0f0d1e; }

        /* 2) คืนค่า padding/พื้นหลัง/มุม ของ select+picker ที่ ui-input ไปทับ
           ให้กลับเป็นสไตล์ .themed-input เดิม (โลโก้ธนาคารจะไม่ถูกบัง) */
        #orderStatus.ui-input,
        #bankSelector.ui-input,
        .themed-input.ui-input {
            padding: 0.45rem 1rem;
            background: rgba(0, 0, 0, 0.25);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 1rem;
        }
        /* 3) โลโก้ธนาคารใน picker: เลื่อนออกจากขอบซ้ายอีกนิดให้เห็นชัด */
        #bankPickerTrigger { padding-left: 0.85rem; gap: 0.65rem; }
        #bankPickerLogoWrap { margin-left: 0.1rem; }

        /* ================================================================
           📐 คืนขนาด UI หน้า "สร้างออร์เดอร์ใหม่" ให้ตรงคอมมิท bd833fd
           เฉพาะ #createOrderView — ทับเฉพาะ "ขนาด" ที่คลาส ui-* ไปเปลี่ยน
           (คง effect spotlight/reveal ของ ui-* ไว้ ไม่กระทบหน้าอื่น)
           base classes (.themed-input/.form-label/.card-primary) เหมือนคอมมิทเก่าอยู่แล้ว
           ================================================================ */
        /* หัวข้อ panel: ui-h2 → กลับเป็น text-sm เดิม (0.875rem) */
        #createOrderView .ui-h2 {
            font-size: 0.875rem;
            font-weight: 600;
            line-height: 1.25;
            letter-spacing: 0;
        }

        /* label ฟอร์ม: ui-label → กลับเป็น .form-label เดิม (0.85rem, ไม่ uppercase) */
        #createOrderView .ui-label {
            font-size: 0.85rem;
            font-weight: 500;
            text-transform: none;
            letter-spacing: 0;
            margin: 0 0 0.4rem;
            color: #FACC15;
        }

        /* input/select/picker: คืนขนาดเท่า .themed-input เดิม
           (height 40px, padding .45/1rem, radius 1rem, font max(16px,.9rem) กัน iOS zoom) */
        #createOrderView .themed-input.ui-input,
        #createOrderView select.ui-input,
        #createOrderView #orderStatus.ui-input,
        #createOrderView #bankSelector.ui-input {
            font-size: max(16px, 0.9rem);
            padding: 0.45rem 1rem;
            border-radius: 1rem;
            height: 40px;
        }
        /* หมายเหตุ: input ขนาดเล็ก (text-xs / text-[11px]) จัดการโดย utility เดิมอยู่แล้ว —
           บนแทปเลต `.text-xs{font-size:14px!important}` (index.html:2741) ชนะกฎนี้
           บนมือถือ input ทั้งหมดเป็น max(16px,.9rem) เท่าคอมมิทเก่า (กฎ !important เดิม) */

        /* การ์ด/กรอบ: ui-card → padding/มุม เท่าเดิม
           (Tailwind p-4 = 1rem, .glass-panel.card-primary radius = 1.5rem) */
        #createOrderView .ui-card {
            padding: 1rem;
            border-radius: 1.5rem;
        }

        /* ปุ่ม: ปุ่มในหน้านี้มี Tailwind sizing utility ของตัวเองครบ (w-5 h-5 / px-2 py-1 / py-2 px-3 / w-full h-9 / ไอคอนล้วน)
           ดังนั้น "ลบคลาส ui-btn-* ออกจาก markup ของ #createOrderView" แทนการ override CSS
           (เพราะ #createOrderView .ui-btn-* specificity สูงกว่า utility จึง defer กลับให้ Tailwind ด้วย CSS ไม่ได้)
