        body { font-family: 'Inter', sans-serif; background-color: #111827; color: #f3f4f6; }
        .tab-active { border-left-color: #3b82f6; background-color: #1e3a8a; color: #bfdbfe; }
        
        /* Smooth transitions */
        .fade-in { animation: fadeIn 0.3s ease-in-out; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        /* Login Modal / Overlay */
        #login-screen {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(17, 24, 39, 0.95); z-index: 9999;
            display: flex; justify-content: center; align-items: center;
        }

        /* Print Specific Styles for Professional Invoice & Receipt */
        @media print {
            body { height: auto !important; display: block !important; overflow: visible !important; background-color: white !important; color: black !important; }
            #sidebar, #mobile-nav, .no-print { display: none !important; }
            #app-shell { display: block !important; overflow: visible !important; }
            #main-content { height: auto !important; overflow: visible !important; margin-left: 0 !important; width: 100% !important; padding: 0 !important; background-color: white !important; }
            .print-area { 
                box-shadow: none !important; 
                border: 2px solid #000 !important; 
                padding: 10mm !important; 
                margin: 0 auto !important;
                width: 100% !important;
                max-width: 100% !important;
                background-color: white !important;
                color: black !important;
            }
            .print-area * {
                color: black !important;
                border-color: #000 !important;
            }
            .print-area input, .print-area textarea, .print-area select { 
                background-color: transparent !important; 
                color: black !important; 
                border: none !important;
                resize: none;
            }
            .print-area input[type="date"]::-webkit-calendar-picker-indicator {
                display: none !important;
                opacity: 0 !important;
            }
            .print-area .bg-gray-50, .print-area .bg-gray-100, .print-area .bg-gray-700, .print-area .bg-gray-800 { background-color: transparent !important; }
            table { border-collapse: collapse !important; width: 100% !important; }
            th, td { border: 1px solid black !important; }
        }

        /* Kolom metadata invoice yang dapat diedit */
        .invoice-meta-input {
            width: 170px;
            max-width: 100%;
            padding: 1px 3px;
            border: 0;
            border-bottom: 1px solid #d1d5db;
            background: transparent;
            color: inherit;
            font: inherit;
            text-align: right;
            outline: none;
        }
        .invoice-meta-input:focus {
            border-bottom-color: #2563eb;
            box-shadow: 0 1px 0 #2563eb;
        }
        /* Date picker untuk tanggal invoice dan kwitansi */
        .date-picker-input {
            cursor: pointer;
            color-scheme: light;
        }
        .date-picker-input::-webkit-calendar-picker-indicator {
            cursor: pointer;
            opacity: 0.8;
        }
        .pdf-invoice-document .date-picker-input::-webkit-calendar-picker-indicator,
        .pdf-receipt-document .date-picker-input::-webkit-calendar-picker-indicator {
            display: none !important;
            opacity: 0 !important;
        }
        @media print {
            .invoice-meta-input {
                border: 0 !important;
                box-shadow: none !important;
                padding: 0 !important;
            }
        }


        /* ================================================================
           KALENDER JATUH TEMPO INVOICE PADA DASHBOARD
           ================================================================ */
        /* Dashboard charts */
        .dashboard-chart-shell {
            position: relative;
            width: 100%;
            height: 320px;
        }
        .dashboard-donut-shell {
            position: relative;
            width: 100%;
            height: 300px;
        }
        .dashboard-donut-center {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -54%);
            pointer-events: none;
            text-align: center;
            min-width: 100px;
        }
        .dashboard-chart-empty {
            display: none;
            position: absolute;
            inset: 0;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            border: 1px dashed #4b5563;
            border-radius: 12px;
            color: #9ca3af;
            background: rgba(17, 24, 39, .28);
            text-align: center;
            padding: 24px;
        }
        html.theme-light .dashboard-chart-empty {
            border-color: #cbd5e1;
            color: #64748b;
            background: rgba(248, 250, 252, .78);
        }
        @media (max-width: 640px) {
            .dashboard-chart-shell { height: 280px; }
            .dashboard-donut-shell { height: 270px; }
        }

        .due-calendar-weekdays,
        .due-calendar-grid {
            display: grid;
            grid-template-columns: repeat(7, minmax(0, 1fr));
            gap: 8px;
        }
        .due-calendar-weekday {
            padding: 5px 2px;
            color: #9ca3af;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-align: center;
            text-transform: uppercase;
        }
        .due-calendar-day {
            position: relative;
            min-height: 96px;
            padding: 8px;
            overflow: hidden;
            border: 1px solid #374151;
            border-radius: 12px;
            background: #111827;
            color: #e5e7eb;
            text-align: left;
            transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
        }
        .due-calendar-day:hover {
            z-index: 1;
            border-color: #60a5fa;
            background: #1f2937;
            transform: translateY(-1px);
        }
        .due-calendar-day.is-outside { opacity: .38; }
        .due-calendar-day.is-today {
            border-color: #3b82f6;
            box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .45);
        }
        .due-calendar-day.is-selected {
            border-color: #93c5fd;
            background: rgba(30, 64, 175, .28);
            box-shadow: 0 0 0 2px rgba(59, 130, 246, .35);
        }
        .due-calendar-day-number {
            display: inline-flex;
            width: 26px;
            height: 26px;
            align-items: center;
            justify-content: center;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
        }
        .due-calendar-day.is-today .due-calendar-day-number {
            background: #2563eb;
            color: #fff;
        }
        .due-calendar-count {
            display: inline-flex;
            min-width: 20px;
            height: 20px;
            padding: 0 6px;
            align-items: center;
            justify-content: center;
            border-radius: 999px;
            background: #dc2626;
            color: #fff;
            font-size: 10px;
            font-weight: 800;
        }
        .due-calendar-events {
            display: grid;
            gap: 4px;
            margin-top: 5px;
        }
        .due-calendar-event {
            display: block;
            padding: 3px 5px;
            overflow: hidden;
            border-radius: 6px;
            font-size: 9px;
            font-weight: 700;
            line-height: 1.2;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .due-calendar-event.is-overdue { background: rgba(220, 38, 38, .24); color: #fca5a5; }
        .due-calendar-event.is-today { background: rgba(217, 119, 6, .25); color: #fde68a; }
        .due-calendar-event.is-upcoming { background: rgba(37, 99, 235, .25); color: #bfdbfe; }
        .due-calendar-more { color: #9ca3af; font-size: 9px; font-weight: 700; }
        .due-calendar-agenda-item {
            border: 1px solid #374151;
            border-radius: 12px;
            background: rgba(17, 24, 39, .7);
            padding: 12px;
        }
        .due-calendar-legend-dot {
            width: 9px;
            height: 9px;
            border-radius: 999px;
            flex: 0 0 auto;
        }
        html.theme-light .due-calendar-weekday { color: #64748b; }
        html.theme-light .due-calendar-day {
            border-color: #dbe3ee;
            background: #ffffff;
            color: #0f172a;
        }
        html.theme-light .due-calendar-day:hover { border-color: #60a5fa; background: #eff6ff; }
        html.theme-light .due-calendar-day.is-selected { background: #dbeafe; }
        html.theme-light .due-calendar-event.is-overdue { background: #fee2e2; color: #b91c1c; }
        html.theme-light .due-calendar-event.is-today { background: #fef3c7; color: #a16207; }
        html.theme-light .due-calendar-event.is-upcoming { background: #dbeafe; color: #1d4ed8; }
        html.theme-light .due-calendar-agenda-item { border-color: #e2e8f0; background: #f8fafc; }
        @media (max-width: 767px) {
            .due-calendar-weekdays,
            .due-calendar-grid { gap: 4px; }
            .due-calendar-day { min-height: 66px; padding: 5px; border-radius: 9px; }
            .due-calendar-day-number { width: 22px; height: 22px; font-size: 10px; }
            .due-calendar-event { padding: 2px 3px; font-size: 0; min-height: 6px; }
            .due-calendar-more { display: none; }
            .due-calendar-count { min-width: 17px; height: 17px; padding: 0 4px; font-size: 9px; }
        }

        /* Loading Overlay */
        #loading-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(17, 24, 39, 0.9); z-index: 9999;
            display: flex; justify-content: center; align-items: center; flex-direction: column;
        }
        .spinner {
            border: 4px solid #374151; border-top: 4px solid #3b82f6;
            border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite;
        }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


        /* ================================================================
           KWITANSI PT. AYARI PERSADA — layout mengikuti dokumen referensi
           ================================================================ */
        .receipt-paper {
            width: min(210mm, 100%);
            min-height: 297mm;
            margin: 0 auto;
            padding: 18mm 14mm 16mm;
            background: #fff;
            color: #111;
            border: 0;
            border-radius: 0;
            box-sizing: border-box;
            font-family: Arial, Helvetica, sans-serif;
            overflow: hidden;
        }
        .receipt-paper input,
        .receipt-paper textarea {
            font: inherit;
            color: #111;
            background: transparent;
            outline: none;
        }
        .receipt-header {
            display: grid;
            grid-template-columns: 1.2fr 0.9fr;
            gap: 16mm;
            align-items: start;
            margin-bottom: 10mm;
        }
        .receipt-company-name {
            margin: 0;
            font-size: 25px;
            line-height: 1.1;
            font-weight: 800;
            letter-spacing: 0.4px;
        }
        .receipt-company-tagline {
            margin-top: 4mm;
            font-size: 13px;
            font-weight: 700;
            color: #858585;
        }
        .receipt-company-address {
            margin-top: 7mm;
            font-size: 10px;
            line-height: 1.75;
        }
        .receipt-title {
            display: inline-block;
            margin: 0 0 6mm;
            padding-bottom: 1mm;
            border-bottom: 3px solid #111;
            font-size: 36px;
            line-height: 1;
            font-weight: 900;
            letter-spacing: 0.5px;
        }
        .receipt-meta-row {
            display: grid;
            grid-template-columns: 18mm 5mm 1fr;
            align-items: end;
            margin-bottom: 4mm;
            font-size: 12px;
        }
        .receipt-meta-label,
        .receipt-label {
            line-height: 1.15;
        }
        .receipt-en {
            display: block;
            margin-top: 1mm;
            font-style: italic;
            font-weight: 400;
        }
        .receipt-meta-value,
        .receipt-line-control {
            min-width: 0;
            width: 100%;
            padding: 0 1mm 1mm;
            border: 0;
            border-bottom: 1px solid #b9b9b9;
            font-weight: 500;
        }
        .receipt-frame {
            border: 2px solid #111;
        }
        .receipt-section {
            padding: 11mm 3mm 8mm;
            border-bottom: 2px solid #111;
        }
        .receipt-field-row {
            display: grid;
            grid-template-columns: 39mm 7mm 1fr;
            align-items: start;
            min-height: 15mm;
            padding: 2mm 0;
            font-size: 12px;
        }
        .receipt-field-row.compact {
            min-height: 10mm;
        }
        .receipt-field-value {
            min-width: 0;
            padding: 0 1mm 2mm;
            border-bottom: 1px solid #d2d2d2;
            line-height: 1.5;
            font-weight: 600;
        }
        .receipt-field-value.italic {
            font-style: italic;
            font-weight: 500;
        }
        .receipt-description {
            min-height: 29mm;
            width: 100%;
            padding: 0 1mm;
            border: 0;
            background-image: repeating-linear-gradient(
                to bottom,
                transparent 0,
                transparent 8mm,
                #d5d5d5 8.2mm,
                #d5d5d5 8.45mm
            );
            line-height: 8.4mm;
            resize: none;
            overflow: hidden;
        }
        .receipt-amount-band {
            padding: 5mm 0;
            border-bottom: 2px solid #111;
        }
        .receipt-amount-box {
            display: grid;
            grid-template-columns: 16mm 4mm minmax(0, 1fr);
            align-items: center;
            width: 100%;
            max-width: none;
            box-sizing: border-box;
            padding: 1.8mm 4mm;
            border-top: 5px double #111;
            border-bottom: 5px double #111;
            font-size: 22px;
            font-weight: 800;
        }
        .receipt-amount-input {
            width: 100%;
            min-width: 0;
            padding: 1.5mm 2mm;
            border: 0;
            text-align: right;
            font-size: 22px;
            font-weight: 800;
        }
        @media (max-width: 640px) {
            .receipt-amount-box {
                grid-template-columns: 14mm 2mm minmax(0, 1fr);
                width: 100%;
            }
            .receipt-amount-input {
                font-size: 20px;
            }
        }
        .receipt-payment-section {
            padding: 3mm 2mm 7mm;
            border-bottom: 2px solid #111;
        }
        .receipt-payment-methods {
            display: flex;
            flex-wrap: wrap;
            gap: 12mm;
            align-items: center;
            margin-bottom: 4mm;
            font-size: 12px;
        }
        .receipt-method {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 1.5mm;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
        }
        .receipt-method input {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            margin: 0;
            opacity: 0;
            cursor: pointer;
            z-index: 3;
        }
        .receipt-method input:disabled {
            cursor: not-allowed;
        }
        .receipt-method.is-disabled {
            cursor: not-allowed;
            opacity: .62;
        }
        .receipt-method.is-selected {
            font-weight: 800;
        }
        .receipt-check {
            position: relative;
            z-index: 1;
            display: inline-block;
            width: 10mm;
            height: 7mm;
            border: 2px solid #111;
            background: #fff;
            transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
        }
        .receipt-method input:focus-visible + .receipt-check {
            outline: 3px solid rgba(37, 99, 235, .35);
            outline-offset: 2px;
        }
        .receipt-method.is-selected .receipt-check {
            border-color: #1d4ed8;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
        }
        .receipt-method input:checked + .receipt-check::after {
            content: "√";
            position: absolute;
            left: 2.2mm;
            top: -2.4mm;
            font-size: 21px;
            font-weight: 800;
            line-height: 1;
        }
        .receipt-payment-grid {
            display: grid;
            grid-template-columns: 1.25fr 0.75fr;
            gap: 8mm;
            align-items: end;
        }
        .receipt-bank-row {
            display: grid;
            grid-template-columns: 38mm 7mm 1fr;
            align-items: start;
            min-height: 14mm;
            font-size: 12px;
        }
        .receipt-bank-value {
            min-height: 7mm;
            padding: 0 1mm 1mm;
            border-bottom: 1px solid #c7c7c7;
            font-weight: 600;
        }
        .receipt-bank-value + .receipt-bank-value {
            margin-top: 1mm;
        }
        .receipt-signature {
            position: relative;
            min-height: 47mm;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            align-items: center;
            text-align: center;
        }
        .receipt-signature-script {
            position: absolute;
            top: 11mm;
            left: 50%;
            transform: translateX(-50%) rotate(-5deg);
            font-family: "Brush Script MT", "Segoe Script", cursive;
            font-size: 25px;
            white-space: nowrap;
            color: #111;
        }
        .receipt-stamp {
            position: absolute;
            top: 22mm;
            left: 50%;
            transform: translateX(-50%) rotate(-1deg);
            padding: 1mm 2mm;
            border-top: 2px solid #3657a7;
            border-bottom: 2px solid #3657a7;
            color: #3657a7;
            font-size: 17px;
            font-weight: 800;
            white-space: nowrap;
            opacity: 0.82;
        }
        .receipt-signer-name {
            width: 100%;
            padding-bottom: 1mm;
            border-bottom: 1px solid #111;
            font-size: 12px;
            font-weight: 800;
            text-decoration: underline;
        }
        .receipt-signer-role {
            margin-top: 1mm;
            font-size: 12px;
        }
        .receipt-footer-line {
            padding: 3mm 2mm;
            text-align: center;
            font-size: 10px;
            line-height: 1.3;
        }
        .receipt-footer-line + .receipt-footer-line {
            border-top: 1px solid #111;
            font-style: italic;
        }

        @media (max-width: 900px) {
            .receipt-paper { padding: 8mm 6mm; min-height: auto; }
            .receipt-header { grid-template-columns: 1fr; gap: 8mm; }
            .receipt-title { font-size: 30px; }
            .receipt-field-row { grid-template-columns: 34mm 5mm 1fr; }
            .receipt-payment-grid { grid-template-columns: 1fr; }
            .receipt-signature { min-height: 50mm; }
        }

        @page { size: A4 portrait; margin: 0; }
        @media print {
            html, body { width: 210mm !important; min-height: 297mm !important; }
            .receipt-paper {
                width: 210mm !important;
                min-height: 297mm !important;
                max-width: 210mm !important;
                margin: 0 !important;
                padding: 18mm 14mm 16mm !important;
                border: 0 !important;
                box-shadow: none !important;
                page-break-after: avoid !important;
            }
            .receipt-paper input,
            .receipt-paper textarea {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
            }
            .receipt-check,
            .receipt-stamp,
            .receipt-description {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
            }
        }



        /* ================================================================
           MODE TEMPLATE DENGAN / TANPA NAMA PERUSAHAAN
           ================================================================ */
        .company-identity-block {
            transition: opacity .2s ease, max-width .2s ease;
        }
        .document-template-anonymous .company-identity-block {
            display: none !important;
        }
        .document-template-anonymous .document-header-layout {
            justify-content: flex-end !important;
        }
        #receipt-document.document-template-anonymous .receipt-header {
            grid-template-columns: 1fr !important;
        }
        #receipt-document.document-template-anonymous .receipt-header > :last-child {
            justify-self: end;
            width: min(82mm, 100%);
        }
        .template-mode-badge {
            display: inline-flex;
            align-items: center;
            gap: .4rem;
            min-height: 38px;
            padding: .55rem .75rem;
            border-radius: .65rem;
            border: 1px solid #4b5563;
            background: #374151;
            color: #e5e7eb;
            font-size: .78rem;
            font-weight: 700;
            white-space: nowrap;
            cursor: pointer;
            transition: background-color .18s ease, border-color .18s ease, color .18s ease;
        }
        .template-mode-badge:hover {
            background: #4b5563;
        }
        .template-mode-badge.is-anonymous {
            background: rgba(124, 58, 237, .22);
            border-color: #7c3aed;
            color: #ddd6fe;
        }
        .template-mode-status {
            min-width: 142px;
            max-width: 210px;
            color: #9ca3af;
            font-size: 11px;
            line-height: 1.3;
        }
        .template-mode-status.is-anonymous {
            color: #c4b5fd;
        }
        html.theme-light .template-mode-badge {
            border-color: #cbd5e1;
            background: #f1f5f9;
            color: #334155;
        }
        html.theme-light .template-mode-badge:hover {
            background: #e2e8f0;
        }
        html.theme-light .template-mode-badge.is-anonymous {
            border-color: #8b5cf6;
            background: #ede9fe;
            color: #6d28d9;
        }
        html.theme-light .template-mode-status {
            color: #64748b;
        }
        html.theme-light .template-mode-status.is-anonymous {
            color: #7c3aed;
        }
        @media print {
            .template-mode-badge,
            .template-mode-status {
                display: none !important;
            }
        }

        /* ================================================================
           CETAK/PDF SATU HALAMAN A4 + TANDA TANGAN DIGITAL
           ================================================================ */
        .signature-upload-tools {
            width: 100%;
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: 10px;
        }
        .document-action-row {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
        }
        .document-action-row-primary {
            padding-bottom: 10px;
            border-bottom: 1px solid #4b5563;
        }
        .invoice-primary-group,
        .receipt-primary-group {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            width: 100%;
        }
        .invoice-template-group,
        .receipt-template-group {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 1 1 320px;
        }
        .invoice-secondary-signature-group,
        .receipt-secondary-signature-group {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 1 1 auto;
        }
        .invoice-signature-status,
        .receipt-signature-status {
            min-width: 150px;
            max-width: 220px;
        }
        .document-action-row-secondary {
            justify-content: flex-end;
        }
        .document-form-toolbar {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 14px;
        }
        .document-form-toolbar > h2 {
            width: 100%;
            padding-bottom: 12px;
            border-bottom: 1px solid #4b5563;
        }
        html.theme-light .document-action-row-primary,
        html.theme-light .document-form-toolbar > h2 {
            border-color: #cbd5e1;
        }
        @media (max-width: 767px) {
            .document-action-row {
                align-items: stretch;
            }
            .invoice-primary-group,
            .receipt-primary-group,
            .invoice-template-group,
            .receipt-template-group,
            .invoice-secondary-signature-group,
            .receipt-secondary-signature-group {
                flex: 1 1 100%;
                width: 100%;
            }
            .invoice-secondary-signature-group > button,
            .invoice-secondary-signature-group > label,
            .receipt-secondary-signature-group > button,
            .receipt-secondary-signature-group > label {
                flex: 1 1 calc(50% - 4px);
                justify-content: center;
                min-width: 145px;
            }
            .invoice-signature-status,
            .receipt-signature-status {
                flex: 1 1 100%;
                max-width: none;
                width: 100%;
                text-align: left;
            }
            .document-action-row-primary > button,
            .document-action-row-primary > label {
                flex: 1 1 calc(50% - 4px);
                justify-content: center;
                min-width: 145px;
            }
            .document-action-row-secondary > button {
                flex: 1 1 105px;
                justify-content: center;
            }
            .template-mode-status,
            .signature-upload-status {
                flex: 1 1 100%;
                max-width: none;
                width: 100%;
                white-space: normal;
            }
        }
        @media (max-width: 420px) {
            .document-action-row-primary > button,
            .document-action-row-primary > label,
            .document-action-row-secondary > button {
                flex-basis: 100%;
                width: 100%;
            }
        }
        .signature-upload-status {
            max-width: 190px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 11px;
            color: #9ca3af;
        }
        .signature-upload-status.success { color: #86efac; }
        .signature-upload-status.error { color: #fca5a5; }
        .signature-upload-status.loading { color: #93c5fd; }

        .invoice-signature-area {
            min-height: 34mm;
            width: 100%;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            align-items: flex-start;
            position: relative;
        }
        .invoice-signature-area > p:first-child {
            margin-bottom: 1.5mm;
        }
        .invoice-signature-image-slot {
            width: 67mm;
            height: 19mm;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        .digital-signature-image {
            display: none;
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            object-position: center;
        }
        .digital-signature-image.has-signature { display: block; }
        .digital-signature-placeholder {
            font-size: 10px;
            color: #9ca3af;
            font-style: italic;
        }
        .signature-name-line {
            width: 67mm;
            border-bottom: 1px solid #111;
            padding-bottom: 0.5mm;
        }
        .signature-name-line input,
        .signature-role-input {
            width: 100%;
            border: 0;
            outline: none;
            background: transparent;
            color: #111;
        }
        .signature-name-line input {
            font-weight: 700;
            text-decoration: underline;
        }
        .signature-role-input {
            margin-top: 0.6mm;
            font-size: 11px;
        }

        .receipt-signature-area {
            min-height: 43mm;
        }
        .receipt-signature-image-slot {
            position: absolute;
            top: 5mm;
            left: 50%;
            transform: translateX(-50%);
            width: 58mm;
            height: 24mm;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        .receipt-signature-area .receipt-signer-name {
            width: 100%;
            padding-bottom: 0.7mm;
            border-bottom: 1px solid #111;
            text-decoration: none;
        }
        .receipt-signature-area .receipt-signer-name input,
        .receipt-signature-area .receipt-signer-role input {
            width: 100%;
            border: 0;
            outline: none;
            background: transparent;
            color: #111;
            text-align: center;
        }
        .receipt-signature-area .receipt-signer-name input {
            font-size: 12px;
            font-weight: 800;
            text-decoration: underline;
        }
        .receipt-signature-area .receipt-signer-role input {
            font-size: 12px;
        }

        @media print {
            .digital-signature-placeholder { display: none !important; }
            .digital-signature-image {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
            }
        }

        /* Kontainer sementara untuk ekspor PDF satu halaman. */
        .single-page-pdf-stage {
            position: fixed;
            left: -10000px;
            top: 0;
            width: 210mm;
            height: 297mm;
            background: #fff;
            z-index: -1;
            overflow: hidden;
        }
        .single-page-pdf-sheet {
            position: relative;
            width: 210mm;
            height: 297mm;
            padding: 7mm;
            box-sizing: border-box;
            overflow: hidden;
            background: #fff;
            color: #000;
        }
        .single-page-pdf-content {
            position: relative;
            transform-origin: top left;
        }
        .single-page-pdf-sheet .print-area {
            margin: 0 !important;
            max-width: none !important;
            box-shadow: none !important;
            box-sizing: border-box !important;
        }
        .single-page-pdf-sheet .pdf-invoice-document {
            width: 196mm !important;
            border-radius: 0 !important;
        }
        .single-page-pdf-sheet .pdf-receipt-document {
            width: 196mm !important;
            min-height: auto !important;
            padding: 10mm 9mm 8mm !important;
        }

        @page { size: A4 portrait; margin: 0; }
        @media print {
            html, body {
                width: 210mm !important;
                height: 297mm !important;
                min-height: 297mm !important;
                margin: 0 !important;
                padding: 0 !important;
                overflow: hidden !important;
                background: #fff !important;
            }

            body.printing-invoice #view-dashboard,
            body.printing-invoice #view-receipt,
            body.printing-invoice #view-history,
            body.printing-invoice #view-users,
            body.printing-receipt #view-dashboard,
            body.printing-receipt #view-invoice,
            body.printing-receipt #view-history,
            body.printing-receipt #view-users {
                display: none !important;
            }

            body.printing-invoice #view-invoice,
            body.printing-receipt #view-receipt {
                display: block !important;
                position: fixed !important;
                inset: 0 !important;
                width: 210mm !important;
                height: 297mm !important;
                margin: 0 !important;
                padding: 7mm !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
                background: #fff !important;
            }

            /* Invoice dipadatkan secara proporsional ke bidang cetak A4. */
            body.printing-invoice #invoice-document {
                width: 226mm !important;
                max-width: none !important;
                min-height: 0 !important;
                height: auto !important;
                margin: 0 !important;
                padding: 8mm 9mm !important;
                border: 0 !important;
                border-radius: 0 !important;
                box-shadow: none !important;
                box-sizing: border-box !important;
                transform: scale(0.867);
                transform-origin: top left;
                overflow: hidden !important;
                page-break-inside: avoid !important;
                break-inside: avoid-page !important;
            }
            body.printing-invoice #invoice-document > div:first-child {
                padding-bottom: 3mm !important;
                margin-bottom: 3mm !important;
            }
            body.printing-invoice #invoice-document > div:first-child table td {
                border: 0 !important;
            }
            body.printing-invoice #invoice-document .mb-8 { margin-bottom: 3mm !important; }
            body.printing-invoice #invoice-document .mb-6 { margin-bottom: 3mm !important; }
            body.printing-invoice #invoice-document .pt-4 { padding-top: 2mm !important; }
            body.printing-invoice #invoice-document .p-4 { padding: 2.5mm !important; }
            body.printing-invoice #invoice-document .p-3 { padding: 2mm !important; }
            body.printing-invoice #invoice-document .p-2\.5 { padding: 1.8mm !important; }
            body.printing-invoice #invoice-document .py-2 { padding-top: 1.4mm !important; padding-bottom: 1.4mm !important; }
            body.printing-invoice #invoice-document textarea { overflow: hidden !important; }
            body.printing-invoice .invoice-signature-area { min-height: 26mm !important; }
            body.printing-invoice .invoice-signature-image-slot { height: 14mm !important; }

            /* Kwitansi dipadatkan tanpa mengubah proporsi utama dokumen. */
            body.printing-receipt #receipt-document {
                width: 213mm !important;
                max-width: none !important;
                min-height: 0 !important;
                height: auto !important;
                margin: 0 !important;
                padding: 11mm 10mm 8mm !important;
                border: 0 !important;
                box-shadow: none !important;
                box-sizing: border-box !important;
                transform: scale(0.92);
                transform-origin: top left;
                overflow: hidden !important;
                page-break-inside: avoid !important;
                break-inside: avoid-page !important;
            }
            body.printing-receipt .receipt-header {
                gap: 10mm !important;
                margin-bottom: 5mm !important;
            }
            body.printing-receipt .receipt-company-tagline { margin-top: 2mm !important; }
            body.printing-receipt .receipt-company-address { margin-top: 4mm !important; line-height: 1.45 !important; }
            body.printing-receipt .receipt-title { margin-bottom: 4mm !important; }
            body.printing-receipt .receipt-meta-row { margin-bottom: 2mm !important; }
            body.printing-receipt .receipt-section { padding: 6mm 3mm 4mm !important; }
            body.printing-receipt .receipt-field-row { min-height: 11mm !important; padding: 1mm 0 !important; }
            body.printing-receipt .receipt-description { min-height: 22mm !important; }
            body.printing-receipt .receipt-amount-band { padding: 3mm 2mm !important; }
            body.printing-receipt .receipt-payment-section { padding: 2mm 2mm 4mm !important; }
            body.printing-receipt .receipt-payment-methods { margin-bottom: 2mm !important; }
            body.printing-receipt .receipt-bank-row { min-height: 10mm !important; }
            body.printing-receipt .receipt-signature-area { min-height: 32mm !important; }
            body.printing-receipt .receipt-signature-image-slot { top: 2mm !important; height: 17mm !important; }
            body.printing-receipt .receipt-footer-line { padding: 2mm !important; }
        }


        /* Logo aplikasi PT. Ayari Persada */
        .app-logo-shell {
            background: #ffffff;
            border: 1px solid rgba(255, 255, 255, 0.20);
            overflow: hidden;
            flex: 0 0 auto;
        }
        .app-logo-image {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: contain;
            padding: 4px;
        }
        .app-logo-login {
            width: 104px;
            height: 104px;
            border-radius: 18px;
            margin: 0 auto 14px;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
        }
        .app-logo-header {
            width: 44px;
            height: 44px;
            border-radius: 11px;
            box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
        }
        .app-logo-fallback {
            display: none;
            width: 100%;
            height: 100%;
            align-items: center;
            justify-content: center;
            background: #2563eb;
            color: #ffffff;
        }

        /* Sidebar dapat diperkecil dan diperbesar */
        #sidebar {
            width: 17.5rem;
            min-width: 17.5rem;
            position: relative;
            transition: width .25s ease, min-width .25s ease;
        }
        #app-shell {
            min-height: 0;
        }
        #sidebar.sidebar-collapsed {
            width: 5rem;
            min-width: 5rem;
        }
        #sidebar .sidebar-label {
            opacity: 1;
            max-width: 190px;
            white-space: nowrap;
            overflow: hidden;
            transition: opacity .18s ease, max-width .25s ease;
        }
        #sidebar.sidebar-collapsed .sidebar-label {
            opacity: 0;
            max-width: 0;
            pointer-events: none;
        }
        #sidebar.sidebar-collapsed nav {
            padding-left: .625rem;
            padding-right: .625rem;
        }
        #sidebar.sidebar-collapsed nav button {
            justify-content: center;
            gap: 0;
            padding-left: .75rem;
            padding-right: .75rem;
        }
        #sidebar.sidebar-collapsed nav button i {
            width: auto;
            font-size: 1.1rem;
        }
        #sidebar nav {
            scrollbar-width: thin;
            scrollbar-color: #4b5563 transparent;
        }
        #sidebar nav::-webkit-scrollbar { width: 5px; }
        #sidebar nav::-webkit-scrollbar-track { background: transparent; }
        #sidebar nav::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 999px; }
        .sidebar-menu-section + .sidebar-menu-section {
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid rgba(75, 85, 99, .55);
        }
        .sidebar-category-label {
            margin: 0 0 .45rem .75rem;
            color: #6b7280;
            font-size: .625rem;
            font-weight: 800;
            letter-spacing: .12em;
            line-height: 1;
            text-transform: uppercase;
            white-space: nowrap;
            overflow: hidden;
            transition: opacity .18s ease, max-height .2s ease, margin .2s ease;
        }
        .sidebar-menu-items {
            display: grid;
            gap: .25rem;
        }
        .sidebar-nav-button {
            min-height: 2.65rem;
        }
        .sidebar-submenu-button {
            padding-top: .6rem !important;
            padding-bottom: .6rem !important;
            padding-left: 1.15rem !important;
            font-size: .8125rem;
        }
        .sidebar-submenu-button i {
            color: #9ca3af;
            font-size: .85rem;
        }
        .sidebar-nav-button.tab-active i { color: #60a5fa; }
        #sidebar.sidebar-collapsed .sidebar-menu-section + .sidebar-menu-section {
            margin-top: .45rem;
            padding-top: .45rem;
        }
        #sidebar.sidebar-collapsed .sidebar-category-label {
            max-height: 0;
            margin: 0;
            opacity: 0;
        }
        #sidebar.sidebar-collapsed .sidebar-submenu-button {
            padding-left: .75rem !important;
        }
        #sidebar.sidebar-collapsed .sidebar-footer {
            justify-content: center;
            padding-left: .5rem;
            padding-right: .5rem;
        }
        #sidebar-toggle {
            position: static;
            width: 100%;
            height: auto;
            border-radius: .5rem;
            background: transparent;
            color: inherit;
            border: 0;
            box-shadow: none;
            transition: background-color .2s ease, color .2s ease;
        }
        #sidebar-toggle:hover { background: #374151; }
        #sidebar-toggle .sidebar-toggle-icon { transition: transform .25s ease; }
        #sidebar.sidebar-collapsed #sidebar-toggle {
            justify-content: center;
            gap: 0;
            padding-left: .75rem;
            padding-right: .75rem;
        }
        #sidebar.sidebar-collapsed #sidebar-toggle .sidebar-toggle-icon {
            width: auto;
            font-size: 1.1rem;
            transform: rotate(180deg);
        }
        @media (max-width: 767px) {
            #sidebar-toggle { display: none; }
        }



        /* ================================================================
           ALERT DAN VALIDASI LOGIN
           ================================================================ */
        .login-input-error {
            border-color: #ef4444 !important;
            box-shadow: 0 0 0 3px rgba(239, 68, 68, .18) !important;
        }
        .login-form-shake {
            animation: loginFormShake .38s ease-in-out;
        }
        @keyframes loginFormShake {
            0%, 100% { transform: translateX(0); }
            20% { transform: translateX(-7px); }
            40% { transform: translateX(7px); }
            60% { transform: translateX(-5px); }
            80% { transform: translateX(5px); }
        }
        #login-inline-error {
            display: none;
            align-items: flex-start;
            gap: .55rem;
            padding: .7rem .8rem;
            border: 1px solid rgba(239, 68, 68, .55);
            border-radius: .65rem;
            background: rgba(127, 29, 29, .22);
            color: #fecaca;
            font-size: .78rem;
            line-height: 1.4;
        }
        #login-inline-error.is-visible {
            display: flex;
        }
        html.theme-light #login-inline-error {
            background: #fef2f2;
            border-color: #fecaca;
            color: #991b1b;
        }

        /* ================================================================
           HEADER APLIKASI
           ================================================================ */
        #app-header {
            position: relative;
            flex: 0 0 auto;
            z-index: 45;
            min-height: 70px;
            background: rgba(31, 41, 55, .96);
            border-bottom: 1px solid #374151;
            box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
        }
        .app-header-inner {
            min-height: inherit;
        }
        .header-brand-name {
            white-space: nowrap;
        }
        .header-page-context {
            min-width: 0;
            padding-left: 1rem;
            border-left: 1px solid #4b5563;
        }
        .header-user-avatar {
            width: 38px;
            height: 38px;
            flex: 0 0 38px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 9999px;
            color: #93c5fd;
            background: rgba(30, 58, 138, .55);
            border: 1px solid #1e40af;
        }
        .header-user-details {
            min-width: 0;
            max-width: 190px;
        }
        .header-logout-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: .5rem;
            min-height: 38px;
            padding: .55rem .8rem;
            border-radius: .65rem;
            color: #fca5a5;
            background: rgba(127, 29, 29, .18);
            border: 1px solid rgba(185, 28, 28, .5);
            font-size: .78rem;
            font-weight: 700;
            transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
        }
        .header-logout-button:hover {
            color: #ffffff;
            background: #dc2626;
            border-color: #dc2626;
            transform: translateY(-1px);
        }
        @media (max-width: 639px) {
            #app-header { min-height: 62px; }
            .app-logo-header { width: 38px; height: 38px; border-radius: 9px; }
            .header-brand-name { font-size: .875rem; }
            .header-brand-subtitle { font-size: .625rem; }
            .header-page-context { display: none; }
            .header-user-details { max-width: 112px; }
            #header-page-subtitle { display: none; }
            .header-logout-button {
                width: 38px;
                height: 38px;
                min-height: 38px;
                padding: 0;
                border-radius: 9999px;
            }
        }

        /* ================================================================
           TEMA DARK / LIGHT
           ================================================================ */
        body, #sidebar, #main-content, #mobile-nav, #login-screen, #loading-overlay,
        .bg-gray-900, .bg-gray-800, .bg-gray-700, .border-gray-700, .border-gray-600 {
            transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease;
        }

        .theme-action-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: .75rem;
        }
        .header-theme-button {
            display: inline-flex;
            min-height: 38px;
            align-items: center;
            justify-content: center;
            gap: .5rem;
            border: 1px solid #374151;
            border-radius: .7rem;
            background: #1f2937;
            color: #fbbf24;
            padding: .55rem .75rem;
            font-size: .75rem;
            font-weight: 700;
            transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
        }
        .header-theme-button:hover {
            border-color: #4b5563;
            background: #374151;
            transform: translateY(-1px);
        }
        #login-theme-toggle {
            position: static;
            min-width: 150px;
            padding: .65rem 1rem;
            border-radius: .75rem;
            background: #374151;
            color: #fbbf24;
            border: 1px solid #4b5563;
            box-shadow: 0 4px 14px rgba(0,0,0,.18);
            font-size: .8rem;
            font-weight: 600;
        }
        #login-theme-toggle:hover { background: #4b5563; }
        #sidebar.sidebar-collapsed .sidebar-theme-bottom { padding-left: .625rem; padding-right: .625rem; }
        #mobile-nav > button { flex: 1 1 0; min-width: 0; }

        html.theme-light body {
            background-color: #f1f5f9 !important;
            color: #0f172a !important;
        }
        html.theme-light #login-screen {
            background: rgba(241, 245, 249, .97) !important;
        }
        html.theme-light #loading-overlay {
            background: rgba(241, 245, 249, .94) !important;
        }
        html.theme-light #sidebar {
            background-color: #ffffff !important;
            border-color: #cbd5e1 !important;
            box-shadow: 8px 0 24px rgba(15, 23, 42, .08) !important;
        }
        html.theme-light #main-content {
            background-color: #f1f5f9 !important;
        }
        html.theme-light #app-header {
            background: rgba(255, 255, 255, .96) !important;
            border-color: #cbd5e1 !important;
            box-shadow: 0 6px 20px rgba(15, 23, 42, .08) !important;
        }
        html.theme-light .header-page-context {
            border-color: #cbd5e1 !important;
        }
        html.theme-light .header-theme-button {
            color: #334155 !important;
            background: #ffffff !important;
            border-color: #cbd5e1 !important;
            box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
        }
        html.theme-light .header-theme-button:hover {
            color: #0f172a !important;
            background: #f8fafc !important;
            border-color: #94a3b8 !important;
        }
        html.theme-light .header-user-avatar {
            color: #1d4ed8 !important;
            background: #dbeafe !important;
            border-color: #93c5fd !important;
        }
        html.theme-light .header-logout-button {
            color: #b91c1c !important;
            background: #fef2f2 !important;
            border-color: #fecaca !important;
        }
        html.theme-light .header-logout-button:hover {
            color: #ffffff !important;
            background: #dc2626 !important;
            border-color: #dc2626 !important;
        }
        html.theme-light #mobile-nav {
            background-color: #ffffff !important;
            border-color: #cbd5e1 !important;
            box-shadow: 0 -5px 18px rgba(15, 23, 42, .10) !important;
        }
        html.theme-light #sidebar-toggle {
            color: #334155 !important;
            background: transparent !important;
            border-color: transparent !important;
            box-shadow: none !important;
        }
        html.theme-light #sidebar-toggle:hover {
            background: #e2e8f0 !important;
            color: #0f172a !important;
        }

        /* Warna permukaan aplikasi pada tema light. */
        html.theme-light body .bg-gray-900 { background-color: #f8fafc !important; }
        html.theme-light body .bg-gray-800 { background-color: #ffffff !important; }
        html.theme-light body .bg-gray-700 { background-color: #e2e8f0 !important; }
        html.theme-light body .bg-gray-600 { background-color: #cbd5e1 !important; }
        html.theme-light body .border-gray-800 { border-color: #334155 !important; }
        html.theme-light body .border-gray-700 { border-color: #cbd5e1 !important; }
        html.theme-light body .border-gray-600 { border-color: #cbd5e1 !important; }
        html.theme-light body .divide-gray-700 > :not([hidden]) ~ :not([hidden]) { border-color: #e2e8f0 !important; }

        /* Warna teks antarmuka pada tema light. */
        html.theme-light body .text-white { color: #0f172a !important; }
        html.theme-light body .text-gray-100 { color: #0f172a !important; }
        html.theme-light body .text-gray-200 { color: #1e293b !important; }
        html.theme-light body .text-gray-300 { color: #334155 !important; }
        html.theme-light body .text-gray-400 { color: #64748b !important; }
        html.theme-light body .text-gray-500 { color: #64748b !important; }

        /* Teks tombol berwarna harus tetap putih. */
        html.theme-light body button.bg-blue-600,
        html.theme-light body button.bg-blue-700,
        html.theme-light body button.bg-green-600,
        html.theme-light body button.bg-green-700,
        html.theme-light body button.bg-red-500,
        html.theme-light body button.bg-red-600,
        html.theme-light body button.bg-yellow-500,
        html.theme-light body .bg-blue-600.text-white,
        html.theme-light body .bg-green-600.text-white,
        html.theme-light body .bg-red-500.text-white,
        html.theme-light body .bg-red-600.text-white {
            color: #ffffff !important;
        }

        html.theme-light .tab-active {
            border-left-color: #2563eb !important;
            background-color: #dbeafe !important;
            color: #1d4ed8 !important;
        }
        html.theme-light #sidebar nav button:hover {
            background-color: #eff6ff !important;
            color: #1d4ed8 !important;
        }
        html.theme-light .sidebar-menu-section + .sidebar-menu-section { border-color: #e2e8f0; }
        html.theme-light .sidebar-category-label { color: #94a3b8; }
        html.theme-light .sidebar-submenu-button i { color: #64748b; }
        html.theme-light .sidebar-nav-button.tab-active i { color: #2563eb; }
        html.theme-light #sidebar .sidebar-footer { border-color: #cbd5e1 !important; }
        html.theme-light #current-user-name { color: #0f172a !important; }

        html.theme-light input:not(.print-area input):not(.receipt-paper input),
        html.theme-light textarea:not(.print-area textarea):not(.receipt-paper textarea),
        html.theme-light select:not(.print-area select):not(.receipt-paper select) {
            color: #0f172a;
        }
        html.theme-light input::placeholder, html.theme-light textarea::placeholder {
            color: #94a3b8 !important;
        }

        html.theme-light #login-theme-toggle {
            background: #ffffff !important;
            color: #334155 !important;
            border-color: #cbd5e1 !important;
            box-shadow: 0 5px 18px rgba(15, 23, 42, .14) !important;
        }

        /* Badge status tetap mudah dibaca. */
        html.theme-light body [class*="bg-blue-900/50"] { background-color: #dbeafe !important; color: #1d4ed8 !important; border-color: #93c5fd !important; }
        html.theme-light body [class*="bg-green-900/50"] { background-color: #dcfce7 !important; color: #15803d !important; border-color: #86efac !important; }
        html.theme-light body [class*="bg-yellow-900/50"] { background-color: #fef3c7 !important; color: #a16207 !important; border-color: #fde047 !important; }
        html.theme-light body [class*="bg-red-900/50"] { background-color: #fee2e2 !important; color: #b91c1c !important; border-color: #fca5a5 !important; }

        /* SweetAlert mengikuti tema aplikasi. */
        html.theme-light .swal2-popup {
            background: #ffffff !important;
            color: #0f172a !important;
        }
        html.theme-light .swal2-title,
        html.theme-light .swal2-html-container { color: #0f172a !important; }
        html.theme-light .swal2-input,
        html.theme-light .swal2-select,
        html.theme-light .swal2-textarea {
            background: #f8fafc !important;
            color: #0f172a !important;
            border-color: #cbd5e1 !important;
        }

        /* Dokumen invoice dan kwitansi tidak mengikuti tema aplikasi. */
        html.theme-light body .document-theme-fixed,
        html.theme-dark body .document-theme-fixed { background:#fff !important; color:#111827 !important; color-scheme:light; }
        html.theme-light body .document-theme-fixed .bg-white, html.theme-dark body .document-theme-fixed .bg-white { background-color:#fff !important; }
        html.theme-light body .document-theme-fixed .bg-gray-50, html.theme-dark body .document-theme-fixed .bg-gray-50 { background-color:#f9fafb !important; }
        html.theme-light body .document-theme-fixed .bg-gray-100, html.theme-dark body .document-theme-fixed .bg-gray-100 { background-color:#f3f4f6 !important; }
        html.theme-light body .document-theme-fixed .bg-gray-200, html.theme-dark body .document-theme-fixed .bg-gray-200 { background-color:#e5e7eb !important; }
        html.theme-light body .document-theme-fixed .text-gray-900, html.theme-dark body .document-theme-fixed .text-gray-900 { color:#111827 !important; }
        html.theme-light body .document-theme-fixed .text-gray-800, html.theme-dark body .document-theme-fixed .text-gray-800 { color:#1f2937 !important; }
        html.theme-light body .document-theme-fixed .text-gray-700, html.theme-dark body .document-theme-fixed .text-gray-700 { color:#374151 !important; }
        html.theme-light body .document-theme-fixed .text-gray-600, html.theme-dark body .document-theme-fixed .text-gray-600 { color:#4b5563 !important; }
        html.theme-light body .document-theme-fixed .text-gray-500, html.theme-dark body .document-theme-fixed .text-gray-500 { color:#6b7280 !important; }
        html.theme-light body .document-theme-fixed .text-gray-400, html.theme-dark body .document-theme-fixed .text-gray-400 { color:#9ca3af !important; }
        html.theme-light body .document-theme-fixed .text-blue-900, html.theme-dark body .document-theme-fixed .text-blue-900 { color:#1e3a8a !important; }
        html.theme-light body .document-theme-fixed .border-gray-800, html.theme-dark body .document-theme-fixed .border-gray-800 { border-color:#1f2937 !important; }
        html.theme-light body .document-theme-fixed .border-gray-400, html.theme-dark body .document-theme-fixed .border-gray-400 { border-color:#9ca3af !important; }
        html.theme-light body .document-theme-fixed .border-gray-300, html.theme-dark body .document-theme-fixed .border-gray-300 { border-color:#d1d5db !important; }
        html.theme-light body .document-theme-fixed .border-gray-200, html.theme-dark body .document-theme-fixed .border-gray-200 { border-color:#e5e7eb !important; }
        html.theme-light body .document-theme-fixed input, html.theme-light body .document-theme-fixed textarea, html.theme-light body .document-theme-fixed select,
        html.theme-dark body .document-theme-fixed input, html.theme-dark body .document-theme-fixed textarea, html.theme-dark body .document-theme-fixed select { color:#111827 !important; color-scheme:light; }
        html.theme-light body .document-theme-fixed input::placeholder, html.theme-light body .document-theme-fixed textarea::placeholder,
        html.theme-dark body .document-theme-fixed input::placeholder, html.theme-dark body .document-theme-fixed textarea::placeholder { color:#9ca3af !important; }



        /* ================================================================
           PENANDA INPUT DOKUMEN — hanya untuk tampilan pengisian di layar
           ================================================================ */
        .form-entry-hint {
            display: flex;
            align-items: center;
            gap: 9px;
            max-width: 896px;
            margin: -10px auto 14px;
            padding: 9px 12px;
            border: 1px solid #60a5fa;
            border-radius: 9px;
            background: #dbeafe;
            color: #1e3a8a;
            font-size: 12px;
            font-weight: 600;
            box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
        }
        .form-entry-hint i {
            color: #2563eb;
            font-size: 14px;
        }
        .document-theme-fixed input:not([type="radio"]):not([type="file"]):not([type="hidden"]),
        .document-theme-fixed textarea,
        .document-theme-fixed select {
            background-color: #eff6ff !important;
            border-color: #93c5fd !important;
            border-radius: 4px;
            box-shadow: inset 0 0 0 1px #93c5fd;
            transition: background-color .16s ease, box-shadow .16s ease, border-color .16s ease;
        }
        .document-theme-fixed input:not([type="radio"]):not([type="file"]):not([type="hidden"]):hover,
        .document-theme-fixed textarea:hover,
        .document-theme-fixed select:hover {
            background-color: #dbeafe !important;
            box-shadow: inset 0 0 0 1px #60a5fa;
        }
        .document-theme-fixed input:not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
        .document-theme-fixed textarea:focus,
        .document-theme-fixed select:focus {
            background-color: #ffffff !important;
            border-color: #2563eb !important;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, .24), inset 0 0 0 1px #2563eb;
        }
        .document-theme-fixed input::placeholder,
        .document-theme-fixed textarea::placeholder {
            color: #64748b !important;
            font-style: italic;
            opacity: 1;
        }
        .document-theme-fixed .receipt-method {
            padding: 2px 7px;
            border: 1px solid #bfdbfe;
            border-radius: 5px;
            background: #eff6ff;
            transition: background-color .16s ease, border-color .16s ease;
        }
        .document-theme-fixed .receipt-method:hover {
            border-color: #60a5fa;
            background: #dbeafe;
        }
        .document-theme-fixed .receipt-method input:checked + .receipt-check {
            border-color: #2563eb;
            background: #dbeafe;
        }

        /* Penanda visual tidak ikut tercetak atau masuk ke PDF. */
        .pdf-invoice-document input:not([type="radio"]):not([type="file"]):not([type="hidden"]),
        .pdf-invoice-document textarea,
        .pdf-invoice-document select,
        .pdf-receipt-document input:not([type="radio"]):not([type="file"]):not([type="hidden"]),
        .pdf-receipt-document textarea,
        .pdf-receipt-document select {
            background-color: transparent !important;
            box-shadow: none !important;
        }
        .pdf-invoice-document input::placeholder,
        .pdf-invoice-document textarea::placeholder,
        .pdf-receipt-document input::placeholder,
        .pdf-receipt-document textarea::placeholder {
            color: transparent !important;
        }
        .pdf-receipt-document .receipt-method {
            padding: 0 !important;
            border: 0 !important;
            background: transparent !important;
        }
        @media print {
            .form-entry-hint { display: none !important; }
            .document-theme-fixed input:not([type="radio"]):not([type="file"]):not([type="hidden"]),
            .document-theme-fixed textarea,
            .document-theme-fixed select {
                box-shadow: none !important;
                border-radius: 0 !important;
            }
            .document-theme-fixed input::placeholder,
            .document-theme-fixed textarea::placeholder {
                color: transparent !important;
            }
            .document-theme-fixed .receipt-method {
                padding: 0 !important;
                border: 0 !important;
                background: transparent !important;
            }
        }

        @media print {
            #login-theme-toggle, #header-theme-toggle { display: none !important; }
            html.theme-light body { background: #ffffff !important; }
        }

        /* ================================================================
           PUSAT UPGRADE FIRMWARE
           ================================================================ */
        .firmware-status-card,
        .firmware-panel {
            border: 1px solid #374151;
            background: #1f2937;
            box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
        }
        .firmware-status-card {
            display: flex;
            min-height: 112px;
            align-items: center;
            gap: 1rem;
            border-radius: 1rem;
            padding: 1.15rem;
        }
        .firmware-status-icon {
            display: inline-flex;
            width: 2.75rem;
            height: 2.75rem;
            flex: 0 0 auto;
            align-items: center;
            justify-content: center;
            border-radius: .8rem;
            border: 1px solid currentColor;
        }
        .firmware-status-label {
            margin: 0 0 .25rem;
            color: #9ca3af;
            font-size: .68rem;
            font-weight: 800;
            letter-spacing: .08em;
            text-transform: uppercase;
        }
        .firmware-status-value {
            color: #f9fafb;
            font-size: 1.05rem;
            font-weight: 800;
        }
        .firmware-panel {
            border-radius: 1rem;
            padding: 1.25rem;
        }
        .firmware-dropzone {
            display: flex;
            min-height: 190px;
            cursor: pointer;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: .65rem;
            border: 1.5px dashed #4b5563;
            border-radius: .9rem;
            background: rgba(17, 24, 39, .45);
            padding: 1.5rem;
            text-align: center;
            transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
        }
        .firmware-dropzone:hover,
        .firmware-dropzone:focus-within {
            border-color: #3b82f6;
            background: rgba(30, 58, 138, .18);
            transform: translateY(-1px);
        }
        .firmware-install-button,
        .firmware-secondary-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: .55rem;
            border-radius: .7rem;
            font-size: .82rem;
            font-weight: 800;
            transition: background-color .18s ease, opacity .18s ease, transform .18s ease;
        }
        .firmware-install-button {
            width: 100%;
            border: 0;
            background: #2563eb;
            color: #fff;
            padding: .8rem 1rem;
        }
        .firmware-install-button:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); }
        .firmware-install-button:disabled { cursor: not-allowed; opacity: .45; }
        .firmware-secondary-button {
            border: 1px solid #4b5563;
            background: #374151;
            color: #e5e7eb;
            padding: .65rem .9rem;
        }
        .firmware-secondary-button:hover { background: #4b5563; }
        .firmware-progress {
            margin-top: 1rem;
            align-items: center;
            gap: .9rem;
            border: 1px solid #1d4ed8;
            border-radius: .8rem;
            background: rgba(30, 58, 138, .24);
            padding: .9rem 1rem;
        }
        .firmware-progress:not(.hidden) { display: flex; }
        .firmware-progress-spinner {
            width: 1.6rem;
            height: 1.6rem;
            flex: 0 0 auto;
            border: 3px solid rgba(96, 165, 250, .25);
            border-top-color: #60a5fa;
            border-radius: 999px;
            animation: firmwareSpin .8s linear infinite;
        }
        .firmware-check-list { display: grid; gap: .75rem; }
        .firmware-check-list li { display: flex; align-items: center; gap: .65rem; color: #d1d5db; font-size: .82rem; }
        .firmware-check-list i { color: #22c55e; }
        @keyframes firmwareSpin { to { transform: rotate(360deg); } }

        html.theme-light .firmware-status-card,
        html.theme-light .firmware-panel {
            border-color: #cbd5e1;
            background: #ffffff;
            box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
        }
        html.theme-light .firmware-status-value { color: #0f172a; }
        html.theme-light .firmware-dropzone {
            border-color: #94a3b8;
            background: #f8fafc;
        }
        html.theme-light .firmware-dropzone:hover,
        html.theme-light .firmware-dropzone:focus-within { border-color: #2563eb; background: #eff6ff; }
        html.theme-light .firmware-secondary-button { border-color: #cbd5e1; background: #ffffff; color: #334155; }
        html.theme-light .firmware-secondary-button:hover { background: #f1f5f9; }
        html.theme-light .firmware-check-list li { color: #334155; }


        /* ================================================================
           SPLASH SCREEN APLIKASI
           ================================================================ */
        #splash-screen {
            position: fixed;
            inset: 0;
            z-index: 20000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            overflow: hidden;
            background:
                radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.25), transparent 34%),
                radial-gradient(circle at 84% 78%, rgba(37, 99, 235, 0.20), transparent 38%),
                linear-gradient(145deg, #07101f 0%, #111827 55%, #0f1d38 100%);
            color: #f8fafc;
            opacity: 1;
            visibility: visible;
            transition: opacity 0.45s ease, visibility 0.45s ease;
        }
        #splash-screen::before,
        #splash-screen::after {
            content: '';
            position: absolute;
            border-radius: 999px;
            filter: blur(2px);
            pointer-events: none;
        }
        #splash-screen::before {
            width: 360px;
            height: 360px;
            top: -180px;
            right: -110px;
            border: 1px solid rgba(96, 165, 250, 0.20);
            box-shadow: 0 0 0 42px rgba(59, 130, 246, 0.035), 0 0 0 86px rgba(59, 130, 246, 0.025);
        }
        #splash-screen::after {
            width: 260px;
            height: 260px;
            bottom: -150px;
            left: -80px;
            border: 1px solid rgba(147, 197, 253, 0.16);
            box-shadow: 0 0 0 38px rgba(59, 130, 246, 0.03);
        }
        #splash-screen.splash-hidden {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }
        .splash-card {
            position: relative;
            z-index: 1;
            width: min(430px, 100%);
            padding: 34px 30px 28px;
            text-align: center;
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 26px;
            background: rgba(15, 23, 42, 0.72);
            box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            animation: splashCardIn 0.7s cubic-bezier(.2,.8,.2,1) both;
        }
        .splash-logo-shell {
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 94px;
            height: 94px;
            margin: 0 auto 19px;
            padding: 10px;
            overflow: hidden;
            border-radius: 24px;
            background: #ffffff;
            box-shadow: 0 15px 38px rgba(37, 99, 235, 0.30), 0 0 0 8px rgba(59, 130, 246, 0.08);
            animation: splashLogoPulse 1.8s ease-in-out infinite;
        }
        .splash-logo-shell .app-logo-image {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }
        .splash-logo-shell .app-logo-fallback {
            width: 100%;
            height: 100%;
            display: none;
            align-items: center;
            justify-content: center;
            border-radius: 16px;
            background: #2563eb;
            color: #ffffff;
        }
        .splash-company-name {
            margin: 0;
            font-size: clamp(24px, 5vw, 31px);
            line-height: 1.15;
            font-weight: 800;
            letter-spacing: -0.4px;
            color: #ffffff;
        }
        .splash-app-name {
            margin: 7px 0 0;
            font-size: 13px;
            font-weight: 500;
            letter-spacing: 0.45px;
            color: #93c5fd;
        }
        .splash-progress-track {
            width: 100%;
            height: 6px;
            margin-top: 26px;
            overflow: hidden;
            border-radius: 999px;
            background: rgba(148, 163, 184, 0.18);
        }
        .splash-progress-bar {
            display: block;
            width: 42%;
            height: 100%;
            border-radius: inherit;
            background: linear-gradient(90deg, #60a5fa, #2563eb, #93c5fd);
            box-shadow: 0 0 16px rgba(96, 165, 250, 0.7);
            animation: splashProgress 1.25s ease-in-out infinite;
        }
        .splash-status {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-height: 20px;
            margin: 14px 0 0;
            font-size: 12px;
            color: #cbd5e1;
        }
        .splash-status-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #60a5fa;
            box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55);
            animation: splashDotPulse 1.2s ease-out infinite;
        }
        .splash-footer {
            margin: 20px 0 0;
            font-size: 10px;
            letter-spacing: 0.5px;
            color: #64748b;
        }
        html.theme-light #splash-screen {
            background:
                radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.18), transparent 34%),
                radial-gradient(circle at 84% 78%, rgba(147, 197, 253, 0.28), transparent 38%),
                linear-gradient(145deg, #eff6ff 0%, #ffffff 52%, #dbeafe 100%);
            color: #0f172a;
        }
        html.theme-light .splash-card {
            border-color: rgba(148, 163, 184, 0.30);
            background: rgba(255, 255, 255, 0.83);
            box-shadow: 0 28px 70px rgba(30, 64, 175, 0.15);
        }
        html.theme-light .splash-company-name { color: #0f172a; }
        html.theme-light .splash-app-name { color: #2563eb; }
        html.theme-light .splash-status { color: #475569; }
        html.theme-light .splash-footer { color: #94a3b8; }
        html.theme-light .splash-progress-track { background: rgba(148, 163, 184, 0.22); }

        @keyframes splashCardIn {
            from { opacity: 0; transform: translateY(16px) scale(0.97); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }
        @keyframes splashLogoPulse {
            0%, 100% { transform: translateY(0) scale(1); }
            50% { transform: translateY(-3px) scale(1.025); }
        }
        @keyframes splashProgress {
            0% { transform: translateX(-125%); }
            55% { transform: translateX(115%); }
            100% { transform: translateX(250%); }
        }
        @keyframes splashDotPulse {
            0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55); }
            70% { box-shadow: 0 0 0 7px rgba(96, 165, 250, 0); }
            100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
        }
        @media (max-width: 480px) {
            .splash-card { padding: 30px 22px 25px; border-radius: 22px; }
            .splash-logo-shell { width: 82px; height: 82px; border-radius: 21px; }
        }
        @media (prefers-reduced-motion: reduce) {
            .splash-card,
            .splash-logo-shell,
            .splash-progress-bar,
            .splash-status-dot { animation: none !important; }
        }
        @media print {
            #splash-screen { display: none !important; }
        }

        /* ================================================================
           MOBILE RESPONSIVE NAVIGATION
           ================================================================ */
        .mobile-menu-trigger {
            width: 38px;
            height: 38px;
            flex: 0 0 38px;
            align-items: center;
            justify-content: center;
            border: 1px solid #374151;
            border-radius: 10px;
            background: #111827;
            color: #dbeafe;
        }
        #mobile-sidebar-overlay {
            display: none;
            position: fixed;
            inset: 62px 0 0;
            z-index: 54;
            border: 0;
            background: rgba(2, 6, 23, .64);
            backdrop-filter: blur(2px);
            -webkit-backdrop-filter: blur(2px);
        }
        #mobile-sidebar-overlay.is-visible { display: block; }
        #mobile-nav {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 50;
            display: grid;
            grid-template-columns: repeat(5, minmax(0, 1fr));
            min-height: 66px;
            padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
            border-top: 1px solid #374151;
            background: rgba(31, 41, 55, .98);
            box-shadow: 0 -6px 22px rgba(0, 0, 0, .28);
        }
        #mobile-nav > button {
            min-width: 0;
            min-height: 52px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            border-radius: 10px;
            color: #9ca3af;
            font-size: 10px;
            font-weight: 700;
            transition: color .18s ease, background-color .18s ease, transform .18s ease;
        }
        #mobile-nav > button i { font-size: 17px; }
        #mobile-nav > button.is-active {
            color: #93c5fd;
            background: rgba(30, 64, 175, .35);
        }
        #mobile-nav > button:active { transform: scale(.96); }

        @media (min-width: 768px) {
            #mobile-nav,
            #mobile-sidebar-overlay,
            .mobile-menu-trigger { display: none !important; }
        }

        @media (max-width: 767px) {
            body.mobile-menu-open { overflow: hidden !important; }
            #sidebar,
            #sidebar.sidebar-collapsed {
                display: flex !important;
                position: fixed !important;
                top: 62px;
                bottom: 0;
                left: 0;
                z-index: 60;
                width: min(86vw, 320px) !important;
                height: auto !important;
                transform: translateX(-104%);
                transition: transform .24s ease;
                box-shadow: 18px 0 34px rgba(0, 0, 0, .34);
            }
            #sidebar.mobile-open { transform: translateX(0); }
            #sidebar.sidebar-collapsed .sidebar-label,
            #sidebar.sidebar-collapsed .sidebar-category-label { display: inline !important; }
            #sidebar.sidebar-collapsed nav { padding: .75rem !important; }
            #sidebar.sidebar-collapsed nav button { justify-content: flex-start !important; padding-left: 1rem !important; padding-right: 1rem !important; }
            #sidebar.sidebar-collapsed .sidebar-submenu-button { padding-left: 1.9rem !important; }
            #sidebar.sidebar-collapsed nav button i { width: 1.25rem !important; font-size: inherit !important; }
            #main-content { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
            #main-content > [id^="view-"] {
                padding-left: 1rem !important;
                padding-right: 1rem !important;
                padding-top: 1.25rem !important;
                padding-bottom: 1.5rem !important;
            }
            #view-dashboard > h2 { margin-bottom: 1rem !important; font-size: 1.25rem !important; }
            #view-dashboard > .grid { gap: .75rem !important; margin-bottom: 1.25rem !important; }
            #view-dashboard > .grid > div { padding: 1rem !important; }
            #dashboard-erp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem !important; }
            #dashboard-erp-stats button { padding: .85rem !important; }
            #dashboard-erp-stats button p { white-space: normal !important; }
            .dashboard-chart-shell { height: 250px; }
            .dashboard-donut-shell { height: 250px; }
            .document-form-toolbar { padding: .85rem !important; }
            .document-action-row,
            .receipt-primary-group,
            .receipt-secondary-signature-group { width: 100%; }
            .document-action-row button,
            .document-action-row label { min-height: 42px; }
            .overflow-x-auto { -webkit-overflow-scrolling: touch; }
            table { min-width: 680px; }
        }

        @media (max-width: 639px) {
            #app-header { padding-left: .65rem !important; padding-right: .65rem !important; }
            .app-header-inner { gap: .5rem !important; }
            .app-header-inner > div:first-child { gap: .5rem !important; }
            .app-logo-header { width: 34px; height: 34px; flex-basis: 34px; }
            .header-brand-name { max-width: 105px; overflow: hidden; text-overflow: ellipsis; }
            .header-user-avatar,
            .header-user-details { display: none !important; }
            .header-theme-button,
            .header-logout-button { width: 36px; height: 36px; min-height: 36px; padding: 0; }
        }

        @media (max-width: 420px) {
            #dashboard-erp-stats { grid-template-columns: 1fr; }
            .header-brand-subtitle { letter-spacing: .04em !important; }
            #mobile-nav > button span { font-size: 9px; }
        }

        html.theme-light .mobile-menu-trigger {
            color: #1e3a8a;
            border-color: #cbd5e1;
            background: #f8fafc;
        }
        html.theme-light #mobile-nav > button { color: #64748b; }
        html.theme-light #mobile-nav > button.is-active { color: #1d4ed8; background: #dbeafe; }

        /* ================================================================
           CHAT ASSISTANT ERP
           ================================================================ */
        #assistant-panel[hidden], #assistant-launcher[hidden] { display: none !important; }
        .assistant-launcher {
            position: fixed;
            right: 24px;
            bottom: 24px;
            z-index: 70;
            width: 58px;
            height: 58px;
            display: grid;
            place-items: center;
            padding: 0;
            border: 1px solid rgba(147, 197, 253, .42);
            border-radius: 50%;
            background: linear-gradient(135deg, #2563eb, #1d4ed8);
            color: #fff;
            box-shadow: 0 14px 35px rgba(37, 99, 235, .35);
            font-size: 21px;
            transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
        }
        .assistant-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(37, 99, 235, .46); }
        .assistant-launcher:focus-visible { outline: 3px solid rgba(147, 197, 253, .7); outline-offset: 3px; }
        .assistant-launcher[aria-expanded="true"] { background: linear-gradient(135deg, #1f2937, #111827); }
        .assistant-launcher b {
            position: absolute;
            top: -5px;
            right: -3px;
            min-width: 19px;
            height: 19px;
            display: grid;
            place-items: center;
            border: 2px solid #111827;
            border-radius: 999px;
            background: #ef4444;
            color: #fff;
            font-size: 10px;
        }
        .assistant-panel {
            position: fixed;
            right: 24px;
            bottom: 84px;
            z-index: 71;
            width: min(390px, calc(100vw - 32px));
            height: min(610px, calc(100vh - 112px));
            display: grid;
            grid-template-rows: auto minmax(0, 1fr) auto auto;
            overflow: hidden;
            border: 1px solid #374151;
            border-radius: 20px;
            background: #111827;
            box-shadow: 0 24px 70px rgba(0, 0, 0, .46);
            opacity: 0;
            visibility: hidden;
            transform: translateY(18px) scale(.97);
            transform-origin: bottom right;
            transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
            pointer-events: none;
        }
        .assistant-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; }
        .assistant-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 14px 16px;
            border-bottom: 1px solid #374151;
            background: linear-gradient(145deg, #1f2937, #111827);
        }
        .assistant-identity { display: flex; align-items: center; gap: 11px; }
        .assistant-avatar {
            width: 40px;
            height: 40px;
            display: grid;
            place-items: center;
            border-radius: 13px;
            color: #bfdbfe;
            background: #1e3a8a;
        }
        .assistant-identity h2 { margin: 0; color: #fff; font-size: 14px; font-weight: 800; }
        .assistant-identity p { margin: 3px 0 0; color: #9ca3af; font-size: 10px; }
        .assistant-identity p span { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #22c55e; }
        .assistant-header > button { width: 34px; height: 34px; border-radius: 9px; color: #9ca3af; background: #1f2937; }
        .assistant-messages { overflow-y: auto; padding: 16px; scroll-behavior: smooth; }
        .assistant-message-row { display: flex; margin-bottom: 12px; }
        .assistant-message-row.is-user { justify-content: flex-end; }
        .assistant-message-bubble {
            max-width: 86%;
            padding: 10px 12px;
            border: 1px solid #374151;
            border-radius: 14px 14px 14px 4px;
            background: #1f2937;
            color: #e5e7eb;
            font-size: 12px;
            line-height: 1.55;
            white-space: pre-line;
        }
        .is-user .assistant-message-bubble { border-color: #2563eb; border-radius: 14px 14px 4px 14px; background: #1d4ed8; color: #fff; }
        .assistant-message-action {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            margin-top: 9px;
            padding: 8px 10px;
            border-radius: 9px;
            background: #2563eb;
            color: #fff;
            font-size: 11px;
            font-weight: 800;
        }
        .assistant-suggestions { display: flex; gap: 6px; overflow-x: auto; padding: 7px 12px 9px; border-top: 1px solid #1f2937; }
        .assistant-suggestions button { flex: 0 0 auto; padding: 7px 9px; border: 1px solid #374151; border-radius: 999px; color: #bfdbfe; background: #1f2937; font-size: 10px; font-weight: 700; }
        .assistant-composer { display: grid; grid-template-columns: minmax(0, 1fr) 40px 40px; gap: 8px; padding: 11px 12px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid #374151; background: #1f2937; }
        .assistant-composer input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #4b5563; border-radius: 11px; outline: none; background: #111827; color: #f9fafb; font-size: 12px; }
        .assistant-composer input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); }
        .assistant-composer button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: #fff; transition: transform .16s ease, background .16s ease, color .16s ease; }
        .assistant-composer button:hover { transform: translateY(-1px); }
        .assistant-send-button { background: #2563eb; }
        .assistant-voice-button { border: 1px solid #4b5563; background: #374151; color: #bfdbfe !important; }
        .assistant-voice-button.is-listening { border-color: #ef4444; background: #dc2626; color: #fff !important; animation: assistant-mic-pulse 1.35s infinite; }
        .assistant-voice-button:disabled { cursor: not-allowed; opacity: .42; transform: none; }
        .assistant-voice-status { grid-column: 1 / -1; min-height: 0; margin: -1px 2px 0; color: #93c5fd; font-size: 10px; line-height: 1.35; }
        .assistant-voice-status:empty { display: none; }
        .assistant-voice-status.is-error { color: #fca5a5; }
        @keyframes assistant-mic-pulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .42); }
            50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
        }

        html.theme-light .assistant-panel { border-color: #cbd5e1; background: #fff; box-shadow: 0 24px 65px rgba(15, 23, 42, .2); }
        html.theme-light .assistant-header { border-color: #e2e8f0; background: linear-gradient(145deg, #eff6ff, #fff); }
        html.theme-light .assistant-identity h2 { color: #0f172a; }
        html.theme-light .assistant-identity p { color: #64748b; }
        html.theme-light .assistant-header > button { color: #475569; background: #e2e8f0; }
        html.theme-light .assistant-message-bubble { border-color: #e2e8f0; background: #f1f5f9; color: #1e293b; }
        html.theme-light .is-user .assistant-message-bubble { border-color: #2563eb; background: #2563eb; color: #fff; }
        html.theme-light .assistant-suggestions { border-color: #e2e8f0; }
        html.theme-light .assistant-suggestions button { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
        html.theme-light .assistant-composer { border-color: #e2e8f0; background: #f8fafc; }
        html.theme-light .assistant-composer input { border-color: #cbd5e1; background: #fff; color: #0f172a; }
        html.theme-light .assistant-voice-button { border-color: #cbd5e1; background: #e2e8f0; color: #1d4ed8 !important; }
        html.theme-light .assistant-voice-button.is-listening { border-color: #ef4444; background: #dc2626; color: #fff !important; }
        html.theme-light .assistant-voice-status { color: #1d4ed8; }
        html.theme-light .assistant-voice-status.is-error { color: #b91c1c; }

        @media (max-width: 767px) {
            .assistant-launcher { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 52px; height: 52px; font-size: 19px; }
            .assistant-panel {
                left: 8px;
                right: 8px;
                bottom: calc(76px + env(safe-area-inset-bottom));
                width: auto;
                height: min(540px, calc(100vh - 150px - env(safe-area-inset-bottom)));
                border-radius: 18px;
                transform-origin: bottom center;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .assistant-panel, .assistant-launcher, .assistant-composer button { transition: none; }
            .assistant-voice-button.is-listening { animation: none; }
        }

        /* ================================================================
           LOCKED A4 RECEIPT PRINT LAYOUT
           ================================================================ */
        @media print {
            body.printing-receipt #view-erp,
            body.printing-receipt #view-firmware,
            body.printing-receipt #view-users,
            body.printing-invoice #view-erp,
            body.printing-invoice #view-firmware { display: none !important; }

            body.printing-receipt #view-receipt {
                padding: 10mm !important;
                overflow: hidden !important;
            }
            body.printing-receipt #receipt-document {
                width: 190mm !important;
                max-width: 190mm !important;
                min-height: 277mm !important;
                height: 277mm !important;
                margin: 0 !important;
                padding: 10mm 9mm 8mm !important;
                border: 0 !important;
                box-shadow: none !important;
                transform: none !important;
                overflow: hidden !important;
                break-inside: avoid-page !important;
                page-break-inside: avoid !important;
            }
            body.printing-receipt .receipt-header {
                grid-template-columns: 1.2fr .9fr !important;
                gap: 10mm !important;
                margin-bottom: 5mm !important;
            }
            body.printing-receipt .receipt-title { font-size: 32px !important; }
            body.printing-receipt .receipt-meta-row { grid-template-columns: 18mm 5mm 1fr !important; }
            body.printing-receipt .receipt-field-row { grid-template-columns: 39mm 7mm 1fr !important; }
            body.printing-receipt .receipt-payment-grid { grid-template-columns: 1.25fr .75fr !important; gap: 7mm !important; }
            body.printing-receipt .receipt-bank-row { grid-template-columns: 38mm 7mm 1fr !important; }
            body.printing-receipt .receipt-amount-box { grid-template-columns: 16mm 4mm minmax(0, 1fr) !important; }
            body.printing-receipt .receipt-signature { min-height: 32mm !important; }
            body.printing-receipt #receipt-document.document-template-anonymous .receipt-header { grid-template-columns: 1fr !important; }
        }

        /* ================================================================
           KWITANSI v1.2.5 — bidang isi lebih lebar dengan margin cetak aman
           ================================================================ */
        @media screen and (min-width: 901px) {
            .receipt-paper {
                padding: 16mm 12mm 14mm;
            }
        }

        @media screen and (max-width: 900px) {
            .receipt-paper {
                padding: 8mm 5mm 10mm;
            }
        }

        /* PDF memakai bidang aman yang sama dengan hasil cetak A4. */
        .single-page-pdf-sheet {
            padding: 8mm;
        }
        .single-page-pdf-sheet .pdf-receipt-document {
            width: 194mm !important;
            padding: 9mm 8mm 8mm !important;
        }

        @page {
            size: A4 portrait;
            margin: 0;
        }

        @media print {
            body.printing-receipt #view-receipt {
                display: flex !important;
                align-items: flex-start !important;
                justify-content: center !important;
                width: 210mm !important;
                height: 297mm !important;
                padding: 8mm !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }

            body.printing-receipt #receipt-document {
                width: 194mm !important;
                max-width: 194mm !important;
                min-height: 281mm !important;
                height: 281mm !important;
                margin: 0 auto !important;
                padding: 9mm 8mm 8mm !important;
                box-sizing: border-box !important;
                transform: none !important;
                overflow: hidden !important;
                break-inside: avoid-page !important;
                page-break-inside: avoid !important;
            }

            body.printing-receipt .receipt-header {
                gap: 9mm !important;
                margin-bottom: 4mm !important;
            }
            body.printing-receipt .receipt-section {
                padding: 5mm 3mm 4mm !important;
            }
            body.printing-receipt .receipt-description {
                min-height: 21mm !important;
            }
            body.printing-receipt .receipt-payment-grid {
                gap: 6mm !important;
            }
            body.printing-receipt .receipt-signature,
            body.printing-receipt .receipt-signature-area {
                min-height: 30mm !important;
            }
        }

