@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #d97706;
    --accent-hover: #b45309;
    --success: #059669;
    --success-light: rgba(5, 150, 105, 0.08);
    --danger: #dc2626;
    --danger-light: rgba(220, 38, 38, 0.08);
    --info: #2563eb;
    --info-light: rgba(37, 99, 235, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --bg-main: #f8fafc;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* App Structural Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--card-border);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.brand-info h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.brand-info p {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.nav-tab {
    background: transparent;
    border: none;
    color: #475569;
    padding: 0.8rem 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    width: 100%;
}

.nav-tab i {
    font-size: 1.1rem;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.nav-tab:hover {
    color: var(--primary);
    background: #f1f5f9;
}

.nav-tab:hover i {
    color: var(--primary);
}

.nav-tab.active {
    color: var(--primary);
    background: #f1f5f9;
    font-weight: 600;
    border-left: 4px solid var(--accent);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.nav-tab.active i {
    color: var(--accent);
}

.sidebar-footer {
    border-top: 1px solid var(--card-border);
    padding-top: 1.25rem;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* Main Content Wrapper */
.main-content {
    flex-grow: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    background-color: var(--bg-main);
    max-width: calc(100vw - 280px);
}

.page-header {
    margin-bottom: 2.5rem;
}

.page-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.25px;
}

.page-header p {
    font-size: 0.925rem;
    color: var(--text-muted);
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease-out forwards;
}

.tab-content.active {
    display: block;
}

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

/* Panels (Classic Clean Dashboard Panels) */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

/* Metrics Dashboard grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card.glass-panel {
    padding: 0.85rem 1.15rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.metric-info h3 {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

/* Metric Colors */
.bg-total { background: rgba(217, 119, 6, 0.08); color: var(--accent); border: 1px solid rgba(217, 119, 6, 0.15); }
.bg-income { background: var(--success-light); color: var(--success); border: 1px solid rgba(5, 150, 105, 0.15); }
.bg-expense { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.15); }
.bg-balance { background: var(--info-light); color: var(--info); border: 1px solid rgba(37, 99, 235, 0.15); }
.bg-receivable { background: rgba(59, 130, 246, 0.08); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.15); }
.bg-payable { background: rgba(244, 63, 94, 0.08); color: #e11d48; border: 1px solid rgba(244, 63, 94, 0.15); }

/* Dashboard layout grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .main-content {
        max-width: 100%;
    }
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent);
    padding-left: 0.75rem;
    color: var(--primary);
}

/* Budget Utilization Rows */
.budget-utilization-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.utilization-item {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.utilization-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.group-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

.utilization-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.utilization-stats span {
    font-weight: 600;
    color: var(--primary);
}

.progress-bar-bg {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease-out;
}

.utilization-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

input, select, textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    color: var(--primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

input[readonly] {
    background-color: #f1f5f9 !important;
    cursor: not-allowed;
}

/* Buttons */
.btn {
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn:hover {
    background: var(--primary-light);
    transform: translateY(-0.5px);
}

.btn-secondary {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 5px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-income { background: rgba(5, 150, 105, 0.1); color: #047857; }
.badge-expense { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }

.badge-pojarini { background: rgba(217, 119, 6, 0.1); color: var(--accent); }
.badge-cultural { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
.badge-infrastructure { background: rgba(147, 51, 234, 0.1); color: #7e22ce; }
.badge-general { background: rgba(100, 116, 139, 0.1); color: #475569; }
.badge-category { background: rgba(71, 85, 105, 0.08); color: #334155; border: 1px solid rgba(71, 85, 105, 0.12); }

.text-due { color: #dc2626; font-weight: 600; }
.text-settled { color: #94a3b8; font-weight: 400; }

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1.25rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.filter-inputs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(12px);
    transition: transform 0.25s ease;
    padding: 1.75rem;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.85rem;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--primary);
}

/* Receipt box view (Professional Broad Voucher Invoice) */
.modal-card.receipt-modal-card {
    max-width: 720px;
    width: 95%;
}

.receipt-box {
    background: #ffffff;
    color: var(--primary);
    padding: 2.25rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    border: 1px solid var(--card-border);
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1.5rem;
    margin-bottom: 1.75rem;
}

.receipt-header h2 {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: -0.25px;
}

.receipt-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.receipt-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.receipt-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.receipt-meta-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.receipt-meta-value {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--primary);
}

.receipt-divider {
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

.receipt-table-summary {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.receipt-table-summary th {
    background: #f1f5f9;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #cbd5e1;
    color: #475569;
    text-transform: capitalize;
}

.receipt-table-summary td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #334155;
}

.receipt-summary-totals {
    width: 100%;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    width: 320px;
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.receipt-total-row.grand {
    font-size: 1.15rem;
    font-weight: 700;
    border-top: 2px dashed #cbd5e1;
    padding-top: 0.5rem;
    color: var(--primary);
}

.receipt-footer {
    text-align: center;
    border-top: 1px solid #cbd5e1;
    padding-top: 1.25rem;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.receipt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Reports Styling */
.report-print-sheet {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.report-header-print {
    text-align: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.report-header-print h2 {
    font-family: var(--font-sans);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: -0.25px;
}

.report-header-print p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.report-section {
    margin-bottom: 2.25rem;
}

.report-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.85rem;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-table th {
    background: #f8fafc;
    border-bottom: 2px solid #cbd5e1;
    color: #334155;
    font-weight: 600;
    text-transform: capitalize;
}

.report-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.report-summary-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 1.25rem;
    max-width: 480px;
    margin-left: auto;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #334155;
}

.summary-line.highlight {
    font-size: 1.05rem;
    color: var(--primary);
}

.report-footer-print {
    display: none; /* Only visible in print mode */
}

/* Printing Media Rules */
@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    /* Hide background app layout when printing voucher slip */
    body.receipt-open .app-layout {
        display: none !important;
    }

    body.receipt-open .modal-overlay {
        position: static !important;
        display: block !important;
        background: none !important;
        backdrop-filter: none !important;
        width: 100% !important;
        height: auto !important;
        opacity: 1 !important;
        padding: 0 !important;
    }

    body.receipt-open .modal-card {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: none !important;
        background: transparent !important;
    }

    .app-layout {
        display: block;
    }

    /* Hide everything except the printable receipt or printable report */
    .sidebar,
    .main-content .page-header,
    #reports-quick-actions,
    #reports-header-section,
    .btn,
    .filter-bar,
    .table-responsive button,
    .close-btn,
    .modal-header,
    .receipt-actions {
        display: none !important;
    }

    .main-content {
        padding: 0;
        margin: 0;
        max-width: 100%;
        background: #ffffff;
    }

    /* Modal printable receipt overrides */
    .modal-overlay, .modal-overlay.active {
        position: absolute;
        left: 0;
        top: 0;
        background: transparent;
        backdrop-filter: none;
        width: 100%;
        height: 100%;
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .modal-card {
        border: none;
        box-shadow: none;
        padding: 0;
        width: 100%;
        max-width: 100%;
        transform: none;
        background: transparent;
        margin: 0;
    }

    .receipt-box {
        border: 2px dashed #000;
        padding: 2rem;
        width: 100%;
        box-shadow: none;
        background: #ffffff;
        color: #000000;
    }

    /* Report Printable Sheet Overrides */
    .report-print-sheet {
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        max-width: 100%;
        background: #ffffff;
    }

    .report-table th {
        border-bottom: 2px solid #000000 !important;
        background: #f1f5f9 !important;
        color: #000000 !important;
    }

    .report-table td {
        border-bottom: 1px solid #cbd5e1 !important;
        color: #000000 !important;
    }

    .report-summary-box {
        border: 2px solid #000000 !important;
        background: #ffffff !important;
    }

    .report-footer-print {
        display: block !important;
    }

    /* Force section splits behavior on A4 */
    /* Force section splits behavior on A4 */
    .report-section {
        page-break-inside: avoid;
    }
}

/* Visual Grid of Departments (Directly on Background) */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.dept-box {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 125px;
    transition: var(--transition);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dept-box:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.06);
}

.dept-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.dept-box-id {
    font-family: monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(217, 119, 6, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.dept-box-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.3;
}

.dept-box-budget-container {
    margin-top: 0.5rem;
}

.dept-box-budget-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.1rem;
}

.dept-box-budget {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.dept-box-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
}

/* Inline Edit Controls Inside Dept Card */
.dept-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.dept-edit-input {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
}

.dept-edit-input:focus {
    border-color: var(--accent);
    outline: none;
}

.dept-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.3rem;
    margin-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
}

/* Horizontal Row of External Entities (No Outer Box, Single Line Badge Style) */
.entities-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.25rem 0.1rem 0.75rem 0.1rem;
}

/* Scrollbar styling for horizontal scroll on tiny screens */
.entities-row::-webkit-scrollbar {
    height: 4px;
}
.entities-row::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.entities-row::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.entity-icon-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 180px;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.entity-icon-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.04);
}

.entity-icon-wrapper {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--info);
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.entity-info-block {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.entity-icon-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.25;
}

.entity-icon-id {
    font-family: monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.entity-icon-policy {
    display: none; /* Keep clean without policy label inside icon card */
}

.entity-icon-actions {
    display: none; /* Static entities, no editing/deleting buttons */
}

/* Ledger Table Pagination styling */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--card-border);
    background: #f8fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.badge-due-alert {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.badge-settled-alert {
    background: rgba(5, 150, 105, 0.08);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.15);
}

.btn-status-filter {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-weight: 500;
    transition: var(--transition);
}

.btn-status-filter:hover {
    background: #e2e8f0;
}

.btn-status-filter.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
