/* ============================================================
   Path: src/RichRich.Web/wwwroot/css/aging-report.css
   Session: J-AGING-UX2
   LastModified: 2026-07-11
   Module: M06 Accounting - Aging report visual enhancements (global css)
   ============================================================ */

/* ─── بطاقات KPI ─── */
.rr-kpi-card {
    background: #ffffff;
    border: 1px solid #e4e0d4;
    border-radius: 12px;
    padding: 18px 20px;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0, 40, 85, 0.06);
    border-top: 4px solid #002855;
    transition: box-shadow .2s ease;
}

.rr-kpi-card:hover { box-shadow: 0 4px 12px rgba(0, 40, 85, 0.12); }
.rr-kpi-card.rr-kpi-warn { border-top-color: #ef6c00; }
.rr-kpi-card.rr-kpi-danger { border-top-color: #c62828; }

.rr-kpi-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.rr-kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #002855;
    line-height: 1.2;
}

.rr-kpi-value.rr-kpi-sm { font-size: 16px; }
.rr-kpi-sub { font-size: 13px; color: #96793a; font-weight: 600; margin-top: 4px; }

/* ─── الشريط المكدّس ─── */
.rr-stacked-bar {
    display: flex;
    width: 100%;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e4e0d4;
}

.rr-seg { height: 100%; transition: width .4s ease; }

.rr-aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}

.rr-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-inline-end: 5px;
    vertical-align: middle;
}

/* ─── تلوين خلايا الأعمار حسب الخطورة ─── */
.rr-age-current { color: #1a7d3d; }
.rr-age-30 { color: #558b2f; }
.rr-age-60 { color: #b8860b; }
.rr-age-90 { color: #ef6c00; font-weight: 600; }
.rr-age-90plus { color: #c62828; font-weight: 700; }

/* ─── شارة نسبة التأخّر ─── */
.rr-pct-badge {
    display: inline-block;
    min-width: 54px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.rr-pct-ok { background: #e6f4ea; color: #1a7d3d; }
.rr-pct-warn { background: #fff3e0; color: #ef6c00; }
.rr-pct-danger { background: #fdecea; color: #c62828; }

/* ─── جدول الأعمار: إطارات أوضح ─── */
.rr-aging-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #e4e0d4;
    border-radius: 10px;
    overflow: hidden;
}

.rr-aging-table thead th {
    background: #002855;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 14px;
    border: none;
}

.rr-aging-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef1f5;
    font-size: 14px;
}

.rr-aging-table tbody tr:nth-child(even) { background: #fbfcfe; }
.rr-aging-table tbody tr:hover { background: #f5f8fd; }

.rr-aging-table tfoot .rr-grand td {
    background: #002855;
    color: #fff;
    font-weight: 700;
    padding: 12px 14px;
}

.rr-aging-table tfoot .rr-grand .rr-pct-badge { background: rgba(255,255,255,.18); color: #fff; }

.rr-pct-row .rr-pct-cell {
    font-size: 11px;
    color: #94a3b8;
    padding: 4px 14px 8px;
    background: #f8fafc;
}

/* AGING-FIX-3: ملاحظة توضيحية فوق الجدول (بدل صف تحت الرؤوس). */
.rr-aging-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-style: italic;
    color: #64748b;
    padding: 6px 10px;
    background: #f8fafc;
    border-inline-start: 3px solid #c5a55a;
    border-radius: 4px;
}
.rr-aging-note i { color: #c5a55a; }

/* ============================================================
   UI-TBL: توحيد جدول الأعمار مع نمط dtbl (ثيمات لونية).
   عند اجتماع .dtbl.rr-aging-table نُحيّد الألوان الثابتة البنيوية
   ونترك dtbl (متغيّرات الثيم) تقود، مع إبقاء الألوان الدلالية
   للفترات (rr-age-*) وشارات النسب (rr-pct-badge).
   ============================================================ */
.dtbl.rr-aging-table {
    border: none;
    border-radius: 0;
}
.dtbl.rr-aging-table thead th {
    background: var(--acc-p-dark) !important;
    padding: .75rem .9rem;
}
.dtbl.rr-aging-table tbody td {
    padding: .78rem .9rem !important;
    border-bottom: none !important;
    font-size: .84rem;
}
/* إلغاء التخطيط الثابت للصفوف — dtbl يوفّر الحدود/الخلفية من الثيم */
.dtbl.rr-aging-table tbody tr:nth-child(even) { background: transparent; }
.dtbl.rr-aging-table tbody tr:hover { background: var(--acc-p-light); }
.dtbl.rr-aging-table tbody tr:hover td { background: var(--acc-p-light); }
/* صف الإجمالي يتبع total-row من dtbl */
.dtbl.rr-aging-table tfoot .rr-grand td {
    background: var(--acc-p-dark);
    color: #fff;
    padding: .75rem .9rem;
}
/* صفّ النِّسَب: خلفية من الثيم بدل الرمادي الثابت */
.dtbl.rr-aging-table .rr-pct-row .rr-pct-cell {
    background: var(--acc-foot-bg);
    color: var(--acc-t3);
}
