:root {
    --erp-sidebar: #0f172a;
    --erp-sidebar-hover: #1e293b;
    --erp-accent: #3b82f6;
    --erp-bg: #f1f5f9;
    --erp-card: #ffffff;
    --erp-text: #0f172a;
    --erp-muted: #64748b;
    --erp-border: #e2e8f0;
    --erp-success: #10b981;
    --erp-warning: #f59e0b;
    --erp-danger: #ef4444;
}

body.erp-body {
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-feature-settings: 'tnum' 1;
}

.erp-layout {
    min-height: 100vh;
}

.erp-sidebar {
    width: 280px;
    min-height: 100vh;
    height: 100vh;
    max-height: 100vh;
    background: linear-gradient(180deg, var(--erp-sidebar) 0%, #111827 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.erp-sidebar-brand {
    flex: 0 0 auto;
    padding: 1rem 0.85rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.erp-sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}

.erp-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 4px;
}

.erp-sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.35rem 0 0.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.15) 100%);
}

.erp-nav-footer {
    padding-top: 0.25rem !important;
    padding-bottom: 0.15rem !important;
}

.erp-sidebar-brand img {
    max-height: 36px;
    max-width: 120px;
    object-fit: contain;
}

.erp-sidebar-brand h6 {
    color: #fff;
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.erp-sidebar-brand small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
}

.erp-nav {
    padding: 0.4rem 0.75rem 0.5rem;
    margin: 0;
}

.erp-nav .nav-item {
    width: 100%;
}

.erp-nav .nav-link {
    color: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    margin: 3px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

.erp-nav .nav-link i {
    width: 1.25rem;
    text-align: center;
    opacity: 0.9;
}

.erp-nav .nav-link:hover,
.erp-nav .nav-link.active {
    background: var(--erp-sidebar-hover);
    color: #fff;
}

.erp-nav .nav-link.active {
    background: var(--erp-accent);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.erp-main {
    margin-left: 280px;
    padding: 1.25rem 1.5rem 2rem;
    min-height: 100vh;
}

.erp-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.erp-topbar h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.erp-topbar .breadcrumb {
    margin: 0;
    font-size: 0.8rem;
}

.erp-lang-switch {
    display: inline-flex;
    border: 1px solid var(--erp-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--erp-card);
}

.erp-lang-btn {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--erp-muted);
    line-height: 1.2;
}

.erp-lang-btn:hover {
    background: var(--erp-bg);
    color: var(--erp-text);
}

.erp-lang-btn.active {
    background: var(--erp-accent);
    color: #fff;
}

html[dir="rtl"] .erp-sidebar {
    left: auto;
    right: 0;
}

html[dir="rtl"] .erp-main {
    margin-left: 0;
    margin-right: 280px;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .erp-main {
        margin-right: 0;
    }
}

.erp-card {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.erp-card-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--erp-border);
    background: #fff;
    border-radius: 14px 14px 0 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.erp-stat-card {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    height: 100%;
}

.erp-stat-card .card-body {
    padding: 1.1rem 1.15rem;
}

.erp-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.erp-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.erp-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--erp-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.erp-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.erp-info-banner > i {
    margin-top: 0.15rem;
    opacity: 0.85;
}

.erp-report-banner {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.erp-report-banner .erp-report-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.erp-report-banner .erp-report-meta {
    font-size: 0.82rem;
    color: var(--erp-muted);
    margin: 0.35rem 0 0;
}

.erp-filter-card .erp-card-header {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
}

.erp-badge-paid {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.erp-badge-pending {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.erp-badge-role-admin {
    background: #dbeafe !important;
    color: #1e40af !important;
}

.erp-badge-role-operator {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.erp-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.erp-modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

.erp-modal-content .modal-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--erp-border);
}

.erp-modal-content .modal-footer {
    background: #f8fafc;
    border-top: 1px solid var(--erp-border);
}

.erp-widget {
    height: 320px;
    display: flex;
    flex-direction: column;
}

.erp-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.erp-widget-chart {
    height: 280px;
    padding: 0.75rem 1rem 1rem;
}

.erp-quick-action {
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
    height: 100%;
    display: block;
}

.erp-quick-action:hover {
    border-color: var(--erp-accent);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
    color: inherit;
}

.erp-quick-action i {
    font-size: 1.5rem;
    color: var(--erp-accent);
    margin-bottom: 0.5rem;
}

.erp-table-compact td,
.erp-table-compact th {
    font-size: 0.85rem;
    vertical-align: middle;
}

.erp-user-pill {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    margin: 0.25rem 0.75rem 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
}

.erp-sidebar-toggle {
    display: none;
}

@media (max-width: 991.98px) {
    .erp-sidebar {
        transform: translateX(-100%);
    }

    html[dir="rtl"] .erp-sidebar {
        transform: translateX(100%);
    }

    .erp-sidebar.show,
    html[dir="rtl"] .erp-sidebar.show {
        transform: translateX(0);
    }

    .erp-main {
        margin-left: 0;
    }

    .erp-sidebar-toggle {
        display: inline-flex;
    }

    .erp-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1035;
    }

    .erp-sidebar-backdrop.show {
        display: block;
    }
}

/* Filter & list toolbar */
.erp-filter-card .card-body {
    padding: 1rem 1.15rem;
}

.erp-filter-card .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--erp-muted);
    margin-bottom: 0.25rem;
}

.erp-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.erp-results-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    background: #e2e8f0;
    color: var(--erp-text);
}

.erp-table-card .erp-widget-body,
.erp-table-card .table-responsive {
    border-radius: 0 0 14px 14px;
}

.erp-table-card table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* DataTables toolbar — fix "Show [25] entries" select arrow overlapping text */
.erp-main .dataTables_wrapper > .row:first-child {
    align-items: center;
    margin: 0;
    padding: 0.85rem 1rem 0.25rem;
}

.erp-main .dataTables_wrapper .dataTables_length,
.erp-main .dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.erp-main .dataTables_wrapper .dataTables_length label,
.erp-main .dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--erp-text);
}

.erp-main .dataTables_wrapper .dataTables_length select,
.erp-main .dataTables_wrapper .dataTables_filter input {
    display: inline-block;
    width: auto;
    border-radius: 8px;
    border: 1px solid var(--erp-border);
    font-size: 0.85rem;
    line-height: 1.4;
    background-color: #fff;
    vertical-align: middle;
}

.erp-main .dataTables_wrapper .dataTables_length select {
    min-width: 4.75rem;
    padding: 0.4rem 2.35rem 0.4rem 0.7rem !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 14px 10px;
}

.erp-main .dataTables_wrapper .dataTables_filter input {
    min-width: 11rem;
    padding: 0.4rem 0.7rem !important;
    margin-left: 0;
}

.erp-main .dataTables_wrapper .dataTables_length select:focus,
.erp-main .dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--erp-accent);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.erp-table-card .dataTables_wrapper .dataTables_info,
.erp-table-card .dataTables_wrapper .dataTables_paginate {
    font-size: 0.82rem;
    padding: 0.75rem 1rem;
}

.erp-main .dataTables_wrapper .dataTables_info,
.erp-main .dataTables_wrapper .dataTables_paginate {
    font-size: 0.82rem;
    padding: 0.75rem 1rem;
}

.erp-table-card .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
}

.erp-link-site {
    font-weight: 600;
    color: var(--erp-accent);
    text-decoration: none;
}

.erp-link-site:hover {
    text-decoration: underline;
    color: #2563eb;
}

.erp-empty-row td {
    padding: 2.5rem 1rem !important;
    color: var(--erp-muted);
    text-align: center;
}

.erp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}

.erp-login-wrap {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.erp-login-card {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* Dashboard */
.erp-dashboard-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 48%, #2563eb 100%);
    border-radius: 20px;
    padding: 1.5rem 1.6rem 1.25rem;
    color: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 20px 48px rgba(30, 58, 138, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.erp-hero-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.07;
    background-image: radial-gradient(circle at 20% 20%, #fff 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.erp-hero-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.75;
    margin: 0;
    font-weight: 600;
}

.erp-hero-logo-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.erp-dashboard-hero .hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.35rem;
}

.erp-dashboard-hero .hero-meta-sep {
    opacity: 0.5;
}

.erp-hero-ring-card {
    position: relative;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

.erp-hero-ring {
    width: 88px;
    height: 88px;
    display: block;
}

.erp-hero-ring-bg {
    stroke: rgba(255, 255, 255, 0.2);
}

.erp-hero-ring-fill {
    stroke: #6ee7b7;
    stroke-linecap: round;
    transition: stroke-dasharray 0.4s ease;
}

.erp-hero-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.erp-hero-ring-label strong {
    font-size: 1.25rem;
    font-weight: 800;
}

.erp-hero-ring-label small {
    font-size: 0.62rem;
    opacity: 0.85;
    text-align: center;
    max-width: 70px;
}

.erp-quick-actions {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.55rem;
    margin-top: 1.1rem;
    padding: 0.85rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(6px);
}

@media (max-width: 1199.98px) {
    .erp-quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 575.98px) {
    .erp-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

.erp-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.45rem;
    border-radius: 12px;
    background: #1d4ed8;
    border: 1px solid #3b82f6;
    color: #fff;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.erp-quick-action:hover {
    background: #2563eb;
    border-color: #60a5fa;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
}

.erp-quick-actions .erp-quick-action i {
    color: #1d4ed8;
    margin-bottom: 0;
    font-size: 1.05rem;
}

.erp-quick-action-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffffff;
    border: none;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.erp-quick-action:hover .erp-quick-action-icon {
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
}

.erp-quick-action:hover .erp-quick-action-icon i {
    color: #1e40af;
}

.erp-section-head {
    margin-bottom: 0.75rem;
}

.erp-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--erp-text);
}

.erp-section-sub {
    font-size: 0.82rem;
    color: var(--erp-muted);
    margin: 0.2rem 0 0;
}

.erp-kpi-card-primary { border-top: 3px solid #3b82f6; }
.erp-kpi-card-success { border-top: 3px solid #10b981; }
.erp-kpi-card-warning { border-top: 3px solid #f59e0b; }
.erp-kpi-card-info { border-top: 3px solid #0ea5e9; }

.erp-dash-month-form input[type="month"] {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    color: var(--erp-text);
    font-weight: 600;
    font-size: 0.82rem;
}

.erp-activity-row:hover {
    background: #f8fafc;
}

.erp-hero-logo {
    max-height: 52px;
    max-width: 140px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px;
}

.erp-dashboard-hero h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}


.erp-dash-completion {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    min-width: 200px;
    backdrop-filter: blur(6px);
}

.erp-hero-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.22);
}

.erp-hero-progress .progress-bar {
    background: linear-gradient(90deg, #34d399, #6ee7b7);
}

.erp-hero-pct {
    font-size: 1.1rem;
    min-width: 2.5rem;
    text-align: end;
}

/* Insights */
.erp-dash-insights {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    padding: 0.85rem 1.1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.erp-dash-insights-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.65rem;
    color: var(--erp-text);
}

.erp-dash-insights-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.erp-insight {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--erp-border);
    background: var(--erp-bg);
}

.erp-insight-success { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.erp-insight-warning { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.erp-insight-danger { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.erp-insight-info { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }

/* KPI cards */
.erp-kpi-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: 16px;
    padding: 1.15rem 1.2rem;
    height: 100%;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.erp-kpi-card:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.erp-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.erp-kpi-icon-primary { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.erp-kpi-icon-success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.erp-kpi-icon-warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.erp-kpi-icon-info { background: rgba(14, 165, 233, 0.12); color: #0284c7; }

.erp-kpi-label {
    font-size: 0.78rem;
    color: var(--erp-muted);
    margin: 0 0 0.2rem;
    font-weight: 500;
}

.erp-kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.erp-kpi-foot {
    font-size: 0.74rem;
    color: var(--erp-muted);
    margin: 0.25rem 0 0;
}

.erp-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.35rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.erp-kpi-delta-sub {
    font-weight: 500;
    opacity: 0.85;
}

.erp-kpi-delta-good { background: #ecfdf5; color: #047857; }
.erp-kpi-delta-bad { background: #fef2f2; color: #b91c1c; }
.erp-kpi-delta-neutral { background: var(--erp-bg); color: var(--erp-muted); }

/* System health collapse */
.erp-system-health {
    overflow: hidden;
}

.erp-system-health-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--erp-text);
    cursor: pointer;
}

.erp-system-health-toggle:hover {
    background: var(--erp-bg);
}

.erp-system-health-toggle[aria-expanded="true"] .erp-chevron {
    transform: rotate(180deg);
}

.erp-chevron {
    transition: transform 0.2s ease;
    color: var(--erp-muted);
    font-size: 0.75rem;
}

.erp-system-health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--erp-border);
}

@media (max-width: 575.98px) {
    .erp-system-health-grid {
        grid-template-columns: 1fr;
    }
}

.erp-health-stat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    background: var(--erp-bg);
    border-radius: 12px;
}

.erp-health-stat > i {
    font-size: 1.25rem;
    width: 2rem;
    text-align: center;
}

.erp-health-val {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.erp-health-lbl {
    font-size: 0.72rem;
    color: var(--erp-muted);
}

.erp-dash-widget {
    height: auto;
    min-height: 300px;
}

.erp-dash-widget-table {
    min-height: auto;
}

.erp-dash-widget .erp-widget-chart {
    height: 268px;
    padding: 0.75rem 1rem 1rem;
}

.erp-dash-widget-sm .erp-widget-chart {
    height: 228px;
}

.erp-chart-center-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-weight: 700;
    color: var(--erp-text);
}

.erp-chart-center-pct {
    font-size: 1.65rem;
    letter-spacing: -0.03em;
}

.erp-chart-wrap {
    position: relative;
    height: 100%;
}

.erp-chart-legend-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    gap: 0.5rem;
}

.erp-link-muted {
    color: var(--erp-accent);
    text-decoration: none;
    font-weight: 500;
}

.erp-link-muted:hover {
    text-decoration: underline;
}

.erp-table-link {
    color: var(--erp-text);
    text-decoration: none;
}

.erp-table-link:hover {
    color: var(--erp-accent);
}

.erp-month-badge {
    background: var(--erp-bg) !important;
    color: var(--erp-text) !important;
    border: 1px solid var(--erp-border) !important;
    font-weight: 500;
}

.erp-activity-row:hover {
    background: #f8fafc;
}

.erp-site-progress-row td {
    vertical-align: middle;
}

.erp-site-progress-bar {
    height: 7px;
    border-radius: 99px;
    background: #e2e8f0;
    overflow: hidden;
    min-width: 80px;
}

.erp-site-progress-bar > span {
    display: block;
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

.erp-bar-high > span { background: linear-gradient(90deg, #10b981, #34d399); }
.erp-bar-mid > span { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.erp-bar-low > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.erp-dash-table-wrap {
    max-height: 320px;
    overflow-y: auto;
}

.erp-dash-table-short {
    max-height: 200px;
}

.erp-dash-month-form input[type="month"] {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    font-size: 0.85rem;
    color: var(--erp-text);
    font-weight: 500;
}

html[dir="rtl"] .erp-kpi-card {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .erp-kpi-delta {
    flex-direction: row-reverse;
}

html[dir="rtl"] .erp-dash-insights-list {
    flex-direction: row-reverse;
}

/* Mobile responsive tables & layout */
@media (max-width: 991.98px) {
    .erp-main {
        margin-left: 0 !important;
        padding: 0.75rem !important;
    }
    html[dir="rtl"] .erp-main {
        margin-right: 0 !important;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    .erp-table-card .table {
        min-width: 640px;
    }
    .erp-filter-card .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
    .erp-page-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: start;
        margin-bottom: 0.5rem;
    }
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

html[dir="rtl"] .erp-nav .nav-link {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .erp-sidebar {
    left: auto;
    right: 0;
}

html[dir="rtl"] .erp-main {
    margin-left: 0;
    margin-right: 280px;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .erp-main {
        margin-right: 0 !important;
    }
}

.erp-pagination .page-item.active .page-link {
    background: var(--erp-accent);
    border-color: var(--erp-accent);
}

@media print {
    .erp-sidebar,
    .erp-topbar .no-print,
    .erp-sidebar-toggle,
    .btn,
    form {
        display: none !important;
    }

    .erp-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}

/* Arabic typography & RTL polish */
body.erp-rtl,
html[dir="rtl"] body.erp-body {
    font-family: 'Cairo', 'Segoe UI', 'Tahoma', sans-serif;
}

html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select,
html[dir="rtl"] .dataTables_filter input {
    text-align: right;
}

html[dir="rtl"] .erp-table-compact th,
html[dir="rtl"] .erp-table-compact td {
    text-align: right;
}

html[dir="rtl"] .erp-login-card {
    text-align: right;
}

html[dir="rtl"] .modal-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .fa-arrow-left::before {
    content: "\f061";
}

html[dir="rtl"] .fa-arrow-right::before {
    content: "\f060";
}

/* Company profile dashboard */
.erp-company-profile .erp-company-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 42%, var(--erp-hero-accent, #2563eb) 100%);
}

.erp-company-profile .erp-hero-ring-fill {
    stroke: var(--erp-hero-accent, #6ee7b7);
}

.erp-company-breadcrumb .erp-breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--erp-muted);
    text-decoration: none;
}

.erp-company-breadcrumb .erp-breadcrumb-link:hover {
    color: var(--erp-accent);
}

.erp-company-tabs {
    border-bottom: 1px solid var(--erp-border);
    gap: 0.25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.erp-company-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--erp-muted);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    padding: 0.65rem 1rem;
    margin-bottom: -1px;
    background: transparent;
}

.erp-company-tabs .nav-link:hover {
    color: var(--erp-text);
    background: var(--erp-bg);
}

.erp-company-tabs .nav-link.active {
    color: var(--erp-accent);
    border-bottom-color: var(--erp-accent);
    background: var(--erp-card);
}

.erp-company-tab-panels {
    padding-top: 0.25rem;
}

.erp-widget-chart-tall {
    min-height: 220px;
}

.erp-site-card {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    padding: 1.1rem 1.15rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.erp-site-card:hover {
    border-color: color-mix(in srgb, var(--erp-accent) 35%, var(--erp-border));
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.erp-site-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.erp-site-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--erp-text);
    text-decoration: none;
    line-height: 1.3;
}

.erp-site-card-title:hover {
    color: var(--erp-accent);
}

.erp-site-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.erp-site-stat-val {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--erp-text);
    line-height: 1.2;
}

.erp-site-stat-lbl {
    display: block;
    font-size: 0.68rem;
    color: var(--erp-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.erp-site-card-foot {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--erp-border);
    font-size: 0.78rem;
    color: var(--erp-muted);
}

html[dir="rtl"] .erp-company-tabs .nav-link {
    flex-direction: row-reverse;
}

.erp-company-select-form {
    min-width: 0;
}

.erp-company-select-label {
    white-space: nowrap;
}

.erp-company-select {
    min-width: 10rem;
    max-width: 14rem;
    font-weight: 500;
}

html[dir="rtl"] .erp-company-select-form {
    flex-direction: row-reverse;
}

@media (max-width: 767.98px) {
    .erp-company-select {
        max-width: 100%;
        min-width: 8rem;
    }

    .erp-company-profile .erp-kpi-row .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .erp-site-card-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
