/* CORE UI & FONTS */
body { 
    overflow: hidden; 
    background-color: #0f172a; 
    color: #cbd5e1; 
    touch-action: manipulation; 
    font-family: 'Inter', sans-serif;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* BOOT SCREEN */
#boot-screen { 
    position: fixed; inset: 0; background: #0f172a; z-index: 9999; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    transition: opacity 0.8s ease-out; 
}

/* PREMIUM LOGO FRAME CSS */
.logo-frame {
    background-color: #f8fafc;
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.8),
        inset 0 -2px 5px rgba(0,0,0,0.05),
        0 0 30px rgba(56, 189, 248, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

/* 🖨️ PRINT ENGINE (CRITICAL FOR A4 EXPORT) */
@media print {
    @page { margin: 0; size: A4; }
    body { background: white; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    #sidebar, #boot-screen, #toast-container, #editor-panel, .no-print { display: none !important; }
    #workspace { padding: 0 !important; overflow: visible !important; background: white !important; }
    #doc-view { display: flex !important; transform: none !important; box-shadow: none !important; margin: 0 !important; width: 210mm !important; height: 297mm !important; border: none !important; }
    .text-slate-900 { color: #0f172a !important; }
    .text-slate-500 { color: #64748b !important; }
    .bg-brand-900 { background-color: #172554 !important; }
    .text-white { color: #ffffff !important; }
}

/* A4 CONTAINER & WATERMARK */
.a4-container { 
    width: 210mm; min-height: 297mm; background: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    margin: 0 auto; box-shadow: 0 20px 50px -12px rgba(0,0,0,0.5); 
    position: relative; overflow: hidden; color: #0f172a;
}

.watermark { 
    position: absolute; top:50%; left:50%; transform:translate(-50%,-50%) rotate(-45deg); 
    font-family:'Playfair Display', serif; font-size:120px; font-weight:900; 
    color:rgba(30,58,138,0.03); pointer-events:none; white-space:nowrap; z-index: 0;
}

.rubber-stamp {
    font-family: 'Courier New', Courier, monospace; color: #1e3a8a; border: 3px solid #1e3a8a;
    border-radius: 50%; display: inline-block; padding: 1rem; text-align: center;
    text-transform: uppercase; font-weight: bold; font-size: 10px; opacity: 0.8;
    transform: rotate(-12deg); mix-blend-mode: multiply;
}
.stamp-inner { border: 1px solid #1e3a8a; border-radius: 50%; padding: 8px; width: 90px; height: 90px; display: flex; flex-direction: column; justify-content: center; align-items: center; }

/* INPUT FIELDS */
.dark-input { background: #1e293b; border: 1px solid #334155; color: white; font-size: 12px; outline: none; transition: 0.2s; }
.dark-input:focus { border-color: #3b82f6; background: #0f172a; }
.invalid-gst { border-color: #ef4444 !important; background-color: rgba(239, 68, 68, 0.1) !important; }

/* UNICORN NOTIFICATION BADGE */
#toast-container { 
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%); 
    z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; 
}
.toast { 
    transform: translateY(-150%) scale(0.9); opacity: 0; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 12px 24px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; }

/* ============================================================== */
/* 🚀 DYNAMIC THEME ENGINE CSS LOGIC */
/* ============================================================== */

.theme-classic .t-header { border-bottom: 4px solid #172554; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.theme-classic .t-title { color: #1d4ed8; font-family: 'Playfair Display', serif; }
.theme-classic .t-table-head { background-color: #172554; color: white; }
.theme-classic .t-box { border: 1px solid #e2e8f0; background-color: #f8fafc; border-radius: 0.25rem; padding: 0.75rem; }
.theme-classic .t-font-body { font-family: 'Inter', sans-serif; }

.theme-modern .t-header { background: linear-gradient(to right, #f8fafc, #f1f5f9); padding: 1.5rem; border-radius: 1rem; margin-bottom: 1.5rem; border: none; }
.theme-modern .t-title { color: #2563eb; font-family: 'Inter', sans-serif; letter-spacing: -0.02em; }
.theme-modern .t-table-head { background-color: #3b82f6; color: white; }
.theme-modern .t-table-head th:first-child { border-top-left-radius: 0.5rem; }
.theme-modern .t-table-head th:last-child { border-top-right-radius: 0.5rem; }
.theme-modern .t-box { background-color: #f8fafc; border: none; border-radius: 0.75rem; padding: 1rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.theme-modern .t-font-body { font-family: 'Inter', sans-serif; }

.theme-neo .t-header { border-bottom: 2px solid #0f172a; padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.theme-neo .t-title { color: #0f172a; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }
.theme-neo .t-table-head { background-color: transparent; color: #0f172a; border-top: 2px solid #0f172a; border-bottom: 2px solid #0f172a; }
.theme-neo .t-box { border: 1px solid #0f172a; background-color: transparent; border-radius: 0; padding: 0.75rem; }
.theme-neo .t-font-body { font-family: 'JetBrains Mono', monospace; }

/* VOUCHER & RECEIPT THEMES */
.theme-receipt .t-header { border-bottom: 4px solid #059669; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.theme-receipt .t-title { color: #059669; font-family: 'Inter', sans-serif; font-weight: 900; }

.theme-voucher .t-header { border-bottom: 4px solid #d97706; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.theme-voucher .t-title { color: #d97706; font-family: 'Inter', sans-serif; font-weight: 900; }

/* INVENTORY SUGGESTION BOX SCROLLBAR */
.sug-box::-webkit-scrollbar { width: 4px; }
.sug-box::-webkit-scrollbar-track { background: transparent; }
.sug-box::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

/* ZEN MODE TRANSITIONS */
#sidebar { transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease; }
.zen-mode-active #sidebar { transform: translateX(-100%); width: 0 !important; }
.zen-mode-active #top-header { transform: translateY(-100%); height: 0 !important; overflow: hidden; border: none; }