
<?php $__env->startSection('title', 'تقرير المصروفات'); ?>

<?php $__env->startPush('css'); ?>
<style>
    .expenses-summary-card {
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 2px 6px rgba(0,0,0,.08);
        margin-bottom: 15px;
    }

    .expenses-summary-card .info-box {
        margin-bottom: 0 !important;
        min-height: 90px;
    }

    .expenses-summary-card .info-box-text {
        font-size: 18px !important;
        font-weight: bold !important;
        color: #222 !important;
        white-space: normal !important;
    }

    .expenses-summary-card .info-box-number {
        font-size: 18px !important;
        font-weight: bold !important;
    }

    .dataTableTT {
        width: 100% !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .dataTableTT th,
    .dataTableTT td {
        vertical-align: middle !important;
    }

    .dataTableTT th.col-index,
    .dataTableTT td.col-index {
        width: 50px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .dataTableTT th.col-title,
    .dataTableTT td.col-title {
        min-width: 220px !important;
        width: 24% !important;
        text-align: right !important;
    }

    .dataTableTT th.col-date,
    .dataTableTT td.col-date {
        min-width: 110px !important;
        width: 110px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .dataTableTT th.col-type,
    .dataTableTT td.col-type {
        min-width: 150px !important;
        width: 16% !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .dataTableTT th.col-group,
    .dataTableTT td.col-group {
        min-width: 170px !important;
        width: 18% !important;
        text-align: center !important;
    }

    .dataTableTT th.col-amount,
    .dataTableTT td.col-amount {
        min-width: 120px !important;
        width: 12% !important;
        text-align: center !important;
        white-space: nowrap !important;
        font-weight: bold !important;
    }

    .dataTableTT th.col-actions,
    .dataTableTT td.col-actions {
        min-width: 95px !important;
        width: 95px !important;
        text-align: center !important;
        white-space: nowrap !important;
        border-left: 3px solid #888 !important;
    }

    /* الفاصل الكامل لعمود الإجراءات من أعلى الجدول إلى أسفله */
    .dataTableTT.table-bordered > thead > tr > th.col-actions,
    .dataTableTT.table-bordered > tbody > tr > td.col-actions,
    .dataTableTT.table-bordered > tfoot > tr > th.col-actions {
        border-left: 3px solid #888 !important;
    }

    .dataTableTT tfoot th {
        background: #1a3c5e !important;
        color: #fff !important;
        text-align: center !important;
        padding: 10px 8px !important;
        border: 1px solid #0d2a45 !important;
        font-weight: bold !important;
        white-space: nowrap !important;
    }

    .dataTableTT tfoot th.total-value {
        color: #f0b429 !important;
        font-size: 15px !important;
    }

    .report-summary-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 12px;
    }

    .report-summary-box {
        border: 1px solid #d6dbe2;
        border-right: 6px solid var(--theme-primary, #1a3c5e);
        background: #fff;
        border-radius: 6px;
        padding: 14px 16px;
        text-align: right;
    }

    .report-summary-box-title {
        font-size: 14px;
        font-weight: bold;
        color: #333;
        margin-bottom: 6px;
    }

    .report-summary-box-value {
        font-size: 22px;
        font-weight: bold;
        color: var(--theme-primary, #1a3c5e);
    }

    .report-summary-box-note {
        font-size: 11px;
        color: #777;
        margin-top: 4px;
    }

    @media  print {
        .hideprint,
        .box-header,
        .content-header,
        nav, header, footer,
        .sidebar, .main-sidebar, .navbar, .main-header,
        .btn, .pagination, .dataTables_length, .dataTables_filter, .dataTables_info {
            display: none !important;
        }

        .expenses-summary-card .info-box {
            border: 1px solid #ccc !important;
            box-shadow: none !important;
        }
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                تقرير المصروفات
                <a class="btn btn-primary" href="javascript:void(0)" onclick="openReportThemeModal();" style="margin-right:5px;">
                    <i class="fa fa-print"></i> طباعة منسقة
                </a>
            </h1>
        </section>

        <section class="content">
            <div class="row">
                <?php
                    $bg = ['bg-aqua', 'bg-green', 'bg-yellow', 'bg-red', 'bg-blue'];
                    $no = count($bg);
                    $grandTotal = 0;
                ?>

                <?php $__currentLoopData = $summery; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col-md-3 col-sm-6 col-xs-12">
                        <div class="expenses-summary-card">
                            <div class="info-box">
                                <span class="info-box-icon <?php echo e($bg[$loop->iteration % $no]); ?>">
                                    <i class="fa fa-money"></i>
                                </span>
                                <div class="info-box-content">
                                    <span class="info-box-text"><?php echo e($group->title); ?></span>
                                    <span class="info-box-number"><?php echo e(number_format((float) $group->sumTotal, 2)); ?></span>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header hideprint">
                            <?php echo $__env->make('_partial.expenseFilter', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                        </div>

                        <div class="box-body">
                            <table id="expensesTable" class="table table-bordered table-hover dataTableTT">
                                <thead>
                                    <tr>
                                        <th class="col-index">#</th>
                                        <th class="col-title">البيان</th>
                                        <th class="col-date">التاريخ</th>
                                        <th class="col-type">النوع</th>
                                        <th class="col-group">المجموعة</th>
                                        <th class="col-amount">المبلغ</th>
                                        <th class="col-actions hideprint">الإجراءات</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__currentLoopData = $list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $grandTotal += (float) $item->value;
                                        ?>
                                        <tr>
                                            <td class="col-index"><?php echo e($loop->iteration); ?></td>
                                            <td class="col-title"><?php echo e($item->title); ?></td>
                                            <td class="col-date"><?php echo e(optional($item->created_at)->format('d/m/Y')); ?></td>
                                            <td class="col-type"><?php echo e($item->partner_id ? optional($item->partner)->name : 'مصروف عام'); ?></td>
                                            <td class="col-group"><?php echo e(optional($item->group)->name); ?></td>
                                            <td class="col-amount"><?php echo e(number_format((float) $item->value, 2)); ?></td>
                                            <td class="col-actions hideprint">
                                                <?php if($currentUser->can('Edit Expenses')): ?>
                                                    <a data-toggle="modal" data-target="#myModal" title="تعديل"
                                                       href="<?php echo e(route('expenses.edit', $item)); ?>"
                                                       class="btn btn-primary btn-xs">
                                                        <i class="fa fa-pencil fa-fw" aria-hidden="true"></i>
                                                    </a>
                                                <?php endif; ?>
                                                <?php if($currentUser->can('Delete Expenses')): ?>
                                                    <a title="حذف" class="btn btn-xs btn-danger remove-record"
                                                       data-url="<?php echo e(route('expenses.destroy', $item)); ?>"
                                                       data-id="<?php echo e($item->id); ?>">
                                                        <i class="fa fa-trash"></i>
                                                    </a>
                                                <?php endif; ?>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                                <tfoot>
                                    <tr>
                                        <th colspan="5">المجموع</th>
                                        <th class="col-amount total-value"><?php echo e(number_format($grandTotal, 2)); ?></th>
                                        <th class="col-actions hideprint"></th>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        
        <div id="report-theme-modal" style="display:none; position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:9999; align-items:center; justify-content:center;">
            <div style="background:#fff; border-radius:12px; padding:28px 32px; width:480px; max-width:95vw; box-shadow:0 8px 40px rgba(0,0,0,0.25); direction:rtl;">
                <h4 style="margin:0 0 6px 0; font-size:17px; color:#1a3c5e;">اختر تصميم التقرير</h4>
                <p style="margin:0 0 20px 0; font-size:12px; color:#777;">التصميم سيظهر في نافذة الطباعة مع هيدر موحّد</p>

                <div style="display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:24px;">
                    <div class="report-theme-card" onclick="selectReportTheme('navy')" data-theme="navy"
                         style="border:2px solid #1a3c5e; border-radius:8px; padding:12px; cursor:pointer; text-align:center; background:#f0f4f8;">
                        <div style="height:28px; background:#1a3c5e; border-radius:4px; margin-bottom:8px;"></div>
                        <div style="height:8px; background:#c8960a; border-radius:2px; margin-bottom:6px;"></div>
                        <div style="height:6px; background:#eef2f7; border-radius:2px;"></div>
                        <div style="margin-top:8px; font-size:12px; font-weight:bold; color:#1a3c5e;">كحلي ذهبي</div>
                        <div style="font-size:10px; color:#888;">الافتراضي</div>
                    </div>

                    <div class="report-theme-card" onclick="selectReportTheme('green')" data-theme="green"
                         style="border:2px solid #ddd; border-radius:8px; padding:12px; cursor:pointer; text-align:center; background:#fff;">
                        <div style="height:28px; background:#1b5e38; border-radius:4px; margin-bottom:8px;"></div>
                        <div style="height:8px; background:#4caf50; border-radius:2px; margin-bottom:6px;"></div>
                        <div style="height:6px; background:#e8f5e9; border-radius:2px;"></div>
                        <div style="margin-top:8px; font-size:12px; font-weight:bold; color:#1b5e38;">أخضر</div>
                        <div style="font-size:10px; color:#888;">رسمي هادئ</div>
                    </div>

                    <div class="report-theme-card" onclick="selectReportTheme('gray')" data-theme="gray"
                         style="border:2px solid #ddd; border-radius:8px; padding:12px; cursor:pointer; text-align:center; background:#fff;">
                        <div style="height:28px; background:#37474f; border-radius:4px; margin-bottom:8px;"></div>
                        <div style="height:8px; background:#90a4ae; border-radius:2px; margin-bottom:6px;"></div>
                        <div style="height:6px; background:#eceff1; border-radius:2px;"></div>
                        <div style="margin-top:8px; font-size:12px; font-weight:bold; color:#37474f;">رمادي</div>
                        <div style="font-size:10px; color:#888;">احترافي بسيط</div>
                    </div>

                    <div class="report-theme-card" onclick="selectReportTheme('burgundy')" data-theme="burgundy"
                         style="border:2px solid #ddd; border-radius:8px; padding:12px; cursor:pointer; text-align:center; background:#fff;">
                        <div style="height:28px; background:#6a0f2a; border-radius:4px; margin-bottom:8px;"></div>
                        <div style="height:8px; background:#c0392b; border-radius:2px; margin-bottom:6px;"></div>
                        <div style="height:6px; background:#fdf0f0; border-radius:2px;"></div>
                        <div style="margin-top:8px; font-size:12px; font-weight:bold; color:#6a0f2a;">بردوني</div>
                        <div style="font-size:10px; color:#888;">فخم مميز</div>
                    </div>
                </div>

                <div style="display:flex; gap:10px; justify-content:flex-end;">
                    <button type="button" onclick="closeReportThemeModal()" style="padding:8px 20px; border:1px solid #ddd; border-radius:6px; background:#f5f5f5; cursor:pointer; font-size:13px;">إغلاق</button>
                    <button type="button" onclick="printStyledReport();" style="padding:8px 20px; border:none; border-radius:6px; background:#1a3c5e; color:#fff; cursor:pointer; font-size:13px;">
                        <i class="fa fa-print"></i> طباعة الآن
                    </button>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('_partial.datatable', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<?php $__env->startPush('js'); ?>
<script>
    var reportThemes = {
        navy:     { primary:'#1a3c5e', primaryDk:'#0d2a45', accent:'#c8960a', accentLt:'#f0b429', rowAlt:'#f4f7fc', lblBg:'#eef2f7' },
        green:    { primary:'#1b5e38', primaryDk:'#144d2c', accent:'#4caf50', accentLt:'#81c784', rowAlt:'#f1f8f2', lblBg:'#e8f5e9' },
        gray:     { primary:'#37474f', primaryDk:'#263238', accent:'#78909c', accentLt:'#b0bec5', rowAlt:'#f5f6f7', lblBg:'#eceff1' },
        burgundy: { primary:'#6a0f2a', primaryDk:'#4a0a1e', accent:'#c0392b', accentLt:'#e57373', rowAlt:'#fdf5f6', lblBg:'#fdf0f0' }
    };

    var currentReportTheme = localStorage.getItem('report_theme') || 'navy';

    var reportSettings = {
        siteName:    <?php echo json_encode($settings['SiteName'] ?? '', 15, 512) ?>,
        siteNameEn:  <?php echo json_encode($settings['SiteNameEn'] ?? '', 15, 512) ?>,
        address:     <?php echo json_encode($settings['Address'] ?? '', 15, 512) ?>,
        addressEn:   <?php echo json_encode($settings['AddressEn'] ?? '', 15, 512) ?>,
        mobile:      <?php echo json_encode($settings['mobile'] ?? '', 15, 512) ?>,
        mobileEn:    <?php echo json_encode($settings['mobileEn'] ?? '', 15, 512) ?>,
        taxNumber:   <?php echo json_encode($settings['taxnumber'] ?? '', 15, 512) ?>,
        taxNumberEn: <?php echo json_encode($settings['taxnumberEn'] ?? '', 15, 512) ?>,
        logo:        <?php echo json_encode(!empty($settings['logo']) ? \Illuminate\Support\Facades\Storage::url('logo/' . $settings['logo']) : '', 15, 512) ?>
    };

    var reportTitle    = <?php echo json_encode('تقرير المصروفات', 15, 512) ?>;
    var reportUserName = <?php echo json_encode(optional($currentUser)->name ?? '', 15, 512) ?>;

    function openReportThemeModal() {
        document.getElementById('report-theme-modal').style.display = 'flex';
        updateThemeCards();
    }

    function closeReportThemeModal() {
        document.getElementById('report-theme-modal').style.display = 'none';
    }

    function updateThemeCards() {
        document.querySelectorAll('.report-theme-card').forEach(function(c) {
            var name = c.getAttribute('data-theme');
            var t = reportThemes[name];
            var active = (name === currentReportTheme);
            c.style.border = active ? '2px solid ' + t.primary : '2px solid #ddd';
            c.style.background = active ? '#f0f4f8' : '#fff';
        });
    }

    function selectReportTheme(name) {
        currentReportTheme = name;
        localStorage.setItem('report_theme', name);
        updateThemeCards();
    }

    function escapeHtml(str) {
        return String(str == null ? '' : str).replace(/[&<>"']/g, function(c) {
            return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c];
        });
    }

    function parseNumber(value) {
        if (!value) return 0;
        var n = parseFloat(String(value).replace(/[^0-9.\-]/g, ''));
        return isNaN(n) ? 0 : n;
    }

    function formatNumber(n) {
        return n.toLocaleString('en-US', {
            minimumFractionDigits: 2,
            maximumFractionDigits: 2
        });
    }

    function printStyledReport() {
        var t = reportThemes[currentReportTheme];

        var headers = [];
        document.querySelectorAll('#expensesTable thead th').forEach(function(th) {
            if (th.classList.contains('hideprint')) return;
            headers.push(th.textContent.trim());
        });

        var rowsHtml = '';
        var rowIter = 0;
        var sumAmount = 0;

        document.querySelectorAll('#expensesTable tbody tr').forEach(function(tr) {
            rowIter++;
            var rowClass = (rowIter % 2 === 0) ? 'row-even' : '';
            var rowHtml = '<tr class="' + rowClass + '">';

            tr.querySelectorAll('td').forEach(function(td) {
                if (td.classList.contains('hideprint')) return;
                var text = td.textContent.trim();
                rowHtml += '<td class="td-center">' + escapeHtml(text) + '</td>';

                if (td.classList.contains('col-amount')) {
                    sumAmount += parseNumber(text);
                }
            });

            rowHtml += '</tr>';
            rowsHtml += rowHtml;
        });

        var now = new Date();
        var pad = function(n) { return ('0' + n).slice(-2); };
        var dateStr = now.getFullYear() + '-' + pad(now.getMonth() + 1) + '-' + pad(now.getDate());
        var timeStr = pad(now.getHours()) + ':' + pad(now.getMinutes());

        var summaryBoxes = '';
        document.querySelectorAll('.expenses-summary-card .info-box').forEach(function(box) {
            var title = box.querySelector('.info-box-text') ? box.querySelector('.info-box-text').textContent.trim() : '';
            var value = box.querySelector('.info-box-number') ? box.querySelector('.info-box-number').textContent.trim() : '';

            summaryBoxes +=
                '<div class="report-summary-box">' +
                    '<div class="report-summary-box-title">' + escapeHtml(title) + '</div>' +
                    '<div class="report-summary-box-value">' + escapeHtml(value) + '</div>' +
                    '<div class="report-summary-box-note">Expense Summary</div>' +
                '</div>';
        });

        var headerHtml =
            '<div class="report-header">' +
                '<table style="width:100%; table-layout:fixed; direction:rtl; border-collapse:collapse;">' +
                    '<tr>' +
                        '<td style="width:36%; vertical-align:middle; text-align:right; direction:rtl; padding:0 0 0 10px;">' +
                            '<div style="font-size:16px; font-weight:bold; line-height:1.6; color:var(--theme-primary);">' + escapeHtml(reportSettings.siteName) + '</div>' +
                            (reportSettings.address ? '<div style="font-size:11px; font-weight:bold; line-height:1.5;">' + escapeHtml(reportSettings.address) + '</div>' : '') +
                            (reportSettings.mobile ? '<div style="font-size:11px; font-weight:bold; line-height:1.5;">' + escapeHtml(reportSettings.mobile) + '</div>' : '') +
                            '<div style="font-size:11px; font-weight:bold; line-height:1.5;">الرقم الضريبى: ' + escapeHtml(reportSettings.taxNumber) + '</div>' +
                        '</td>' +
                        '<td style="width:28%; vertical-align:middle; text-align:center; padding:0 8px;">' +
                            (reportSettings.logo ? '<img style="max-height:72px; max-width:100%;" src="' + reportSettings.logo + '">' : '') +
                        '</td>' +
                        '<td style="width:36%; vertical-align:middle; text-align:left; direction:ltr; padding:0 10px 0 0;">' +
                            '<div style="font-size:16px; font-weight:bold; line-height:1.6; color:var(--theme-primary);">' + escapeHtml(reportSettings.siteNameEn) + '</div>' +
                            (reportSettings.addressEn ? '<div style="font-size:11px; font-weight:bold; line-height:1.5;">' + escapeHtml(reportSettings.addressEn) + '</div>' : '') +
                            (reportSettings.mobileEn ? '<div style="font-size:11px; font-weight:bold; line-height:1.5;">' + escapeHtml(reportSettings.mobileEn) + '</div>' : '') +
                            '<div style="font-size:11px; font-weight:bold; line-height:1.5;">Tax Number: ' + escapeHtml(reportSettings.taxNumberEn) + '</div>' +
                        '</td>' +
                    '</tr>' +
                '</table>' +
            '</div>';

        var titleHtml =
            '<div class="inv-title-block">' +
                '<div class="inv-title-ar">' + escapeHtml(reportTitle) + '</div>' +
                '<div class="inv-number">تاريخ الإصدار &nbsp;|&nbsp; Issued: <strong>' + dateStr + ' — ' + timeStr + '</strong></div>' +
            '</div>';

        var metaHtml =
            '<table class="meta-table"><tr>' +
                '<td><span class="meta-lbl">اسم التقرير (Report):</span>' + escapeHtml(reportTitle) + '</td>' +
                '<td><span class="meta-lbl">المستخدم (User):</span>' + escapeHtml(reportUserName) + '</td>' +
                '<td><span class="meta-lbl">عدد السجلات (Count):</span>' + rowIter + '</td>' +
                '<td><span class="meta-lbl">إجمالي المبلغ (Total):</span>' + formatNumber(sumAmount) + '</td>' +
            '</tr></table>';

        var summaryHtml =
            '<div class="report-summary-grid">' + summaryBoxes + '</div>';

        var tableHeadHtml = '<tr class="items-head-row">';
        headers.forEach(function(h) {
            tableHeadHtml += '<th>' + escapeHtml(h) + '</th>';
        });
        tableHeadHtml += '</tr>';

        var amountColPos = headers.indexOf('المبلغ');

        var totalsRow = '<tr class="totals-sum-row">';
        headers.forEach(function(h, idx) {
            if (idx === 0) {
                totalsRow += '<td class="totals-label">المجموع (Total)</td>';
            } else if (idx === amountColPos) {
                totalsRow += '<td class="totals-value">' + formatNumber(sumAmount) + '</td>';
            } else {
                totalsRow += '<td></td>';
            }
        });
        totalsRow += '</tr>';

        var tableHtml =
            '<table class="items-tbl">' +
                '<thead>' + tableHeadHtml + '</thead>' +
                '<tbody>' + rowsHtml + totalsRow + '</tbody>' +
            '</table>';

        var footerHtml = '<div class="report-footer">© ' + now.getFullYear() + ' ' + escapeHtml(reportSettings.siteName) + '</div>';

        var css = buildReportCSS(t);

        var fullHtml =
            '<!DOCTYPE html>' +
            '<html lang="ar" dir="rtl">' +
                '<head>' +
                    '<meta charset="UTF-8">' +
                    '<title>' + escapeHtml(reportTitle) + '</title>' +
                    '<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap" rel="stylesheet">' +
                    '<style>' + css + '</style>' +
                '</head>' +
                '<body>' +
                    '<div id="printReport">' +
                        headerHtml +
                        titleHtml +
                        metaHtml +
                        summaryHtml +
                        tableHtml +
                        footerHtml +
                    '</div>' +
                    '<script>window.addEventListener("load", function(){ setTimeout(function(){ window.focus(); window.print(); }, 400); });<\/script>' +
                '</body>' +
            '</html>';

        var printWin = window.open('', '_blank', 'width=1200,height=850');
        if (!printWin) {
            alert('يرجى السماح بالنوافذ المنبثقة في المتصفح للطباعة');
            return;
        }

        printWin.document.open();
        printWin.document.write(fullHtml);
        printWin.document.close();

        closeReportThemeModal();
    }

    function buildReportCSS(t) {
        return [
            ':root{',
                '--theme-primary:' + t.primary + ';',
                '--theme-primary-dk:' + t.primaryDk + ';',
                '--theme-accent:' + t.accent + ';',
                '--theme-accent-lt:' + t.accentLt + ';',
                '--theme-row-alt:' + t.rowAlt + ';',
                '--theme-lbl-bg:' + t.lblBg + ';',
            '}',
            '*{box-sizing:border-box;}',
            'html,body{margin:0;padding:0;}',
            'body{font-family:"Tajawal","Segoe UI",Tahoma,Arial,sans-serif;direction:rtl;padding:12px;color:#111;font-size:12px;background:#fff;}',
            '#printReport{width:100%;max-width:100%;margin:0 auto;overflow:hidden;}',
            '.report-header{margin-bottom:10px;padding-bottom:8px;border-bottom:2px solid var(--theme-primary);}',
            '.report-header table{width:100% !important;max-width:100% !important;}',
            '.inv-title-block{text-align:center;border-top:3px solid var(--theme-primary);border-bottom:3px solid var(--theme-primary);padding:8px 0;margin-bottom:8px;forced-color-adjust:none;-webkit-print-color-adjust:exact;print-color-adjust:exact;}',
            '.inv-title-ar{font-size:18px;font-weight:900;color:var(--theme-primary);letter-spacing:1px;}',
            '.inv-number{font-size:12px;color:#555;margin-top:3px;}',
            '.inv-number strong{color:var(--theme-accent);font-size:13px;}',
            '.meta-table{width:100% !important;max-width:100% !important;table-layout:fixed;background:var(--theme-primary);color:#fff;margin-bottom:10px;border-collapse:collapse;border-radius:3px;forced-color-adjust:none;-webkit-print-color-adjust:exact;print-color-adjust:exact;}',
            '.meta-table td{padding:6px 8px;font-size:11px;text-align:center;border:none;vertical-align:middle;word-wrap:break-word;overflow-wrap:break-word;}',
            '.meta-lbl{display:block;color:var(--theme-accent-lt);font-weight:bold;font-size:10px;margin-bottom:2px;}',
            '.report-summary-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:12px;}',
            '.report-summary-box{border:1px solid #d6dbe2;border-right:6px solid var(--theme-primary);background:#fff;border-radius:6px;padding:14px 16px;text-align:right;}',
            '.report-summary-box-title{font-size:14px;font-weight:bold;color:#333;margin-bottom:6px;}',
            '.report-summary-box-value{font-size:22px;font-weight:bold;color:var(--theme-primary);}',
            '.report-summary-box-note{font-size:11px;color:#777;margin-top:4px;}',
            '.items-tbl{width:100% !important;max-width:100% !important;border-collapse:collapse;margin-bottom:10px;table-layout:fixed;border:2px solid #333;}',
            '.items-tbl thead .items-head-row th{background:var(--theme-primary);color:#fff;text-align:center;font-size:11px;font-weight:bold;padding:7px 3px;border:1px solid var(--theme-primary-dk);line-height:1.4;forced-color-adjust:none;-webkit-print-color-adjust:exact;print-color-adjust:exact;}',
            '.items-tbl tbody tr td{border:1px solid #333;padding:6px 4px;font-size:11px;font-weight:bold;vertical-align:middle;text-align:center;word-break:break-word;}',
            '.items-tbl tbody tr.row-even td{background:var(--theme-row-alt);}',
            '.items-tbl thead tr th:last-child, .items-tbl tbody tr td:last-child{border-left:3px solid #888 !important;}',
            '.items-tbl tbody tr.totals-sum-row td{background:var(--theme-primary) !important;color:#fff !important;font-size:12px !important;font-weight:bold !important;padding:8px 4px !important;border:1px solid var(--theme-primary-dk) !important;}',
            '.items-tbl tbody tr.totals-sum-row td.totals-value{color:var(--theme-accent-lt) !important;}',
            '.report-footer{text-align:center;font-size:10px;color:#888;margin-top:12px;padding-top:6px;border-top:1px dashed #ccc;}',
            '@media  print{',
                '@page{margin:15mm 12mm;}',
                'html,body{margin:0 !important;padding:0 !important;width:100% !important;}',
                '#printReport{width:100% !important;max-width:100% !important;padding:0 !important;margin:0 !important;}',
                '*{-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important;color-adjust:exact !important;}',
                '.items-tbl thead{display:table-header-group;}',
                '.items-tbl tbody tr{page-break-inside:avoid;break-inside:avoid;}',
                '.report-header,.inv-title-block,.meta-table,.report-summary-grid{page-break-inside:avoid;}',
            '}'
        ].join('');
    }

    $(document).ready(function() {
        updateThemeCards();
    });

    document.addEventListener('click', function(e) {
        var modal = document.getElementById('report-theme-modal');
        if (e.target === modal) closeReportThemeModal();
    });
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.front', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/mwarsha2023/public_html/test4.mwarsha.com/resources/views/reports/expenses.blade.php ENDPATH**/ ?>