/* ==========================================
   نظام خطابات التحصيل — Responsive CSS
   Breakpoints:
     Mobile  : < 576px
     Tablet  : 576px – 768px
     Laptop  : 768px – 1024px
     Desktop : > 1024px
   ========================================== */

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

:root {
    --primary:       #1a5276;
    --primary-light: #2e86c1;
    --primary-dark:  #0e2f44;
    --accent:        #d4ac0d;
    --accent-light:  #f9e79f;
    --success:       #1e8449;
    --danger:        #c0392b;
    --gray-50:       #f8f9fa;
    --gray-100:      #f1f3f4;
    --gray-200:      #e8eaed;
    --gray-300:      #dadce0;
    --gray-600:      #5f6368;
    --gray-800:      #2c3e50;
    --shadow:        0 2px 8px rgba(0,0,0,.12);
    --shadow-lg:     0 4px 20px rgba(0,0,0,.15);
    --radius:        8px;
    --radius-lg:     12px;
    --navbar-h:      60px;
    --sidebar-w:     240px;
    --footer-h:      52px;
    --content-pad:   28px;
}

html { font-size: 16px; }

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; }
a { text-decoration: none; }

/* ══════════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════════ */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.navbar-brand svg { width: 26px; height: 26px; flex-shrink: 0; }
.navbar-brand span { display: inline; }

.navbar-links {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.nav-link {
    color: rgba(255,255,255,.8);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all .2s;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.18);
    color: white;
}

.navbar-user { margin-right: auto; }
.user-badge {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
}

/* Hamburger — hidden on desktop */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    margin-right: auto;
    background: none;
    border: none;
}
.navbar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all .25s;
}

/* ══════════════════════════════════════════
   LAYOUT WRAPPER
   ══════════════════════════════════════════ */
.layout-wrapper {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--navbar-h) - var(--footer-h));
    position: relative;
}

/* ══════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: white;
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform .3s ease, box-shadow .3s;
    z-index: 150;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 149;
}
.sidebar-overlay.active { display: block; }

.sidebar-section { margin-bottom: 20px; }

.sidebar-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 10px;
    margin-bottom: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gray-800);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all .18s;
    margin-bottom: 2px;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover  { background: var(--gray-100); color: var(--primary); }
.sidebar-link.active { background: #e8f1f8; color: var(--primary); font-weight: 600; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}
.company-info  { padding: 8px 10px; }
.company-name  { font-weight: 700; font-size: 13px; color: var(--primary); }
.company-sub   { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

/* ══════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════ */
.main-content {
    flex: 1;
    padding: var(--content-pad) 28px;
    min-width: 0;        /* prevent flex overflow */
    overflow-x: hidden;
}

/* ══════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #d4edda; color: var(--success); border: 1px solid #c3e6cb; }

/* ══════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════ */
.page-header { margin-bottom: 24px; }
.page-title   { font-size: 22px; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.page-subtitle{ color: var(--gray-600); font-size: 14px; }

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ══════════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: #e8f1f8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg  { width: 22px; height: 22px; color: var(--primary); }
.stat-number    { font-size: 26px; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.stat-label     { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

/* ══════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table       { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 600px; }
thead th {
    background: var(--gray-100);
    padding: 11px 14px;
    text-align: right;
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gray-200); }
tbody tr:hover  { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.2;
}
.btn svg    { width: 15px; height: 15px; }
.btn-primary{ background: var(--primary);       color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-success{ background: var(--success);        color: white; }
.btn-success:hover { background: #145a32;         transform: translateY(-1px); }
.btn-danger { background: var(--danger);         color: white; }
.btn-danger:hover  { background: #922b21;         transform: translateY(-1px); }
.btn-outline{
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 11px; font-size: 13px; }

.btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.form-grid   { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full   { grid-column: 1 / -1; }

.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.form-label .req { color: var(--danger); }

.form-control {
    padding: 10px 13px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    direction: rtl;
    transition: border-color .2s, box-shadow .2s;
    background: white;
    color: var(--gray-800);
    width: 100%;
    min-height: 42px;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,134,193,.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint  { font-size: 12px; color: var(--gray-600); }
.form-error { font-size: 12px; color: var(--danger); }

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
    margin-top: 4px;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   LETTER PREVIEW
   ══════════════════════════════════════════ */
.letter-preview-wrap {
    background: var(--gray-100);
    padding: 24px;
    border-radius: var(--radius);
    overflow-x: auto;
}
.letter-page {
    background: white;
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 56px;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    border-radius: 4px;
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.9;
    color: #1a1a1a;
}

.letter-header-meta {
    text-align: right;
    margin-bottom: 26px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 14px;
}
.letter-header-meta .meta-row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 4px;
}
.meta-label  { font-weight: 700; color: var(--primary); }
.meta-value  { color: #333; }

.letter-to { margin-bottom: 18px; }
.letter-to strong { display: block; font-size: 15px; color: var(--primary-dark); margin-bottom: 4px; }

.letter-greeting { font-weight: 700; font-size: 15px; margin-bottom: 14px; color: var(--primary-dark); }

.letter-body { margin-bottom: 22px; text-align: justify; line-height: 2; }
.letter-body .amount-ar  { color: var(--primary-dark); font-weight: 700; }
.letter-body .amount-num { color: var(--primary-dark); font-weight: 700; font-size: 15px; }

.letter-bank {
    background: #f0f6fb;
    border: 1px solid #b8d5ea;
    border-radius: 6px;
    padding: 11px 15px;
    margin-bottom: 18px;
    font-size: 13px;
}
.bank-iban { font-weight: 700; font-size: 15px; color: var(--primary-dark); direction: ltr; display: inline-block; }

.letter-closing  { margin: 14px 0 22px; font-weight: 600; }

.letter-signature { text-align: right; margin-top: 18px; border-top: 1px solid var(--gray-200); padding-top: 14px; }
.sig-title { font-weight: 700; color: var(--primary-dark); font-size: 15px; }
.sig-sub   { font-size: 13px; color: var(--gray-600); margin-top: 2px; }

.letter-attachments { margin-top: 26px; padding-top: 14px; border-top: 2px dashed var(--gray-200); }
.attachments-title  { font-weight: 700; font-size: 14px; color: var(--primary-dark); margin-bottom: 10px; }
.attachments-grid   { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.attachment-item { font-size: 13px; color: #444; display: flex; align-items: center; gap: 6px; }
.attachment-item::before { content: '◆'; font-size: 8px; color: var(--primary); }

.letter-note {
    margin-top: 18px;
    padding: 10px 14px;
    background: #fffbea;
    border: 1px solid var(--accent-light);
    border-radius: 6px;
    font-size: 12.5px;
    color: #7d6608;
}

/* ══════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════ */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,.8);
    padding: 0 24px;
    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    margin-top: auto;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}
.footer-right strong { color: white; }
.footer-center { color: rgba(255,255,255,.6); font-size: 12px; }
.footer-left   { color: rgba(255,255,255,.7); }

/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--gray-600); }
.empty-state svg { width: 52px; height: 52px; margin: 0 auto 14px; opacity: .4; display: block; }
.empty-state h3  { font-size: 18px; margin-bottom: 8px; color: var(--gray-800); }
.empty-state p   { font-size: 14px; margin-bottom: 18px; }

/* ══════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════ */
.badge         { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d4edda; color: var(--success); }
.badge-warning { background: #fff3cd; color: #856404; }

/* ══════════════════════════════════════════
   DATE PICKER
   ══════════════════════════════════════════ */
.dp-popup {
    position: absolute;
    z-index: 9999;
    background: white;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 300px;
    overflow: hidden;
    direction: rtl;
}
.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 10px 12px;
    gap: 6px;
}
.dp-nav {
    background: rgba(255,255,255,.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 30px; height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.dp-nav:hover { background: rgba(255,255,255,.35); }
.dp-title     { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center; }
.dp-month-sel {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: white; border-radius: 6px;
    padding: 4px 6px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.dp-month-sel option { color: #1a1a1a; background: white; }
.dp-year-inp {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: white; border-radius: 6px;
    padding: 4px 4px; width: 68px; font-size: 13px;
    text-align: center; font-family: inherit;
}
.dp-weekdays { display: grid; grid-template-columns: repeat(7,1fr); background: var(--gray-100); border-bottom: 1px solid var(--gray-200); }
.dp-weekdays span { text-align: center; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--gray-600); }
.dp-days { display: grid; grid-template-columns: repeat(7,1fr); padding: 6px; gap: 2px; }
.dp-day {
    aspect-ratio: 1; border: none; background: transparent;
    border-radius: 6px; cursor: pointer; font-size: 13px;
    color: var(--gray-800); transition: background .12s, color .12s;
    font-family: inherit; display: flex; align-items: center; justify-content: center;
}
.dp-day:hover { background: var(--gray-100); color: var(--primary); }
.dp-today     { background: #e8f1f8; color: var(--primary); font-weight: 700; }
.dp-footer    { padding: 8px; border-top: 1px solid var(--gray-200); text-align: center; }
.dp-today-btn {
    background: none; border: 1.5px solid var(--primary);
    color: var(--primary); border-radius: 6px;
    padding: 5px 18px; font-size: 13px; cursor: pointer;
    font-family: inherit; font-weight: 600; transition: all .15s;
}
.dp-today-btn:hover { background: var(--primary); color: white; }
[data-datepicker] { cursor: pointer; }

/* ══════════════════════════════════════════
   RESPONSIVE — Tablet 768px–1024px
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 210px; --content-pad: 22px; }
    .stats-grid { gap: 12px; }
    .stat-number { font-size: 22px; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Tablet 768px
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
    :root { --sidebar-w: 260px; }

    /* Sidebar becomes slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        transform: translateX(100%);
        box-shadow: -4px 0 20px rgba(0,0,0,.2);
        padding-top: 72px;
    }
    .sidebar.open { transform: translateX(0); }

    /* Show hamburger */
    .navbar-toggle { display: flex; }
    .navbar-links  { display: none; }
    .navbar-user   { display: none; }
    .navbar-brand span { font-size: 15px; }

    .main-content { padding: 18px 16px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card  { padding: 14px 16px; }
    .stat-number{ font-size: 20px; }

    .form-grid   { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }

    .page-title { font-size: 18px; }

    .letter-preview-wrap { padding: 12px; }
    .letter-page { padding: 32px 24px; }
    .attachments-grid { grid-template-columns: 1fr; }

    .footer-center { display: none; }

    /* Table: allow horizontal scroll */
    .table-wrap { border-radius: 0; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Mobile 576px
   ══════════════════════════════════════════ */
@media (max-width: 576px) {
    :root { --content-pad: 14px; }

    .navbar { padding: 0 14px; gap: 10px; }
    .navbar-brand span { display: none; }   /* hide text, keep icon */

    .main-content { padding: 14px 12px; }

    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card  { padding: 14px; gap: 12px; }

    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }

    .btn-group { gap: 5px; }
    .btn       { padding: 8px 12px; font-size: 13px; }
    .btn-sm    { padding: 5px 9px;  font-size: 12px; }

    /* Page header: stack vertically */
    .page-header > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .page-header .btn-group { flex-wrap: wrap; width: 100%; }
    .page-header .btn { flex: 1 1 calc(50% - 5px); justify-content: center; }

    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }

    /* Letter preview: full width, less padding */
    .letter-preview-wrap { padding: 8px; }
    .letter-page {
        padding: 22px 16px;
        font-size: 13px;
        box-shadow: none;
        border: 1px solid var(--gray-200);
    }
    .letter-body  { font-size: 13px; line-height: 1.85; }
    .bank-iban    { font-size: 13px; word-break: break-all; }
    .attachments-grid { grid-template-columns: 1fr; }

    /* Table: hide less important cols */
    table { min-width: 480px; font-size: 13px; }
    thead th, tbody td { padding: 9px 10px; }

    .footer        { padding: 0 14px; }
    .footer-center,
    .footer-left   { display: none; }
    .footer-right  { font-size: 12px; }

    /* Date picker: full width on mobile */
    .dp-popup {
        position: fixed;
        left: 50% !important;
        right: auto !important;
        top: 50% !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 32px);
        max-width: 320px;
        z-index: 99999;
    }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Large screens 1400px+
   ══════════════════════════════════════════ */
@media (min-width: 1400px) {
    :root { --content-pad: 36px; }
    .main-content { max-width: 1200px; }
    .stats-grid   { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .stat-number  { font-size: 30px; }
}

/* ══════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════ */
@media print {
    .navbar, .sidebar, .footer, .btn, .btn-group,
    .page-header .btn-group, .form-actions, .stats-grid { display: none !important; }
    .layout-wrapper { display: block; }
    .main-content   { padding: 0; }
    .letter-preview-wrap { padding: 0; background: none; }
    .letter-page { box-shadow: none; padding: 0; max-width: 100%; }
    body { background: white; }
}

/* ══════════════════════════════════════════
   LETTER CARDS — Mobile view
   ══════════════════════════════════════════ */

/* Show table on desktop, hide cards */
.desktop-only { display: block; }
.mobile-cards  { display: none; }

/* Layout props applied only when visible (inside the media query) */

.letter-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--gray-200);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    transition: box-shadow .2s, transform .2s;
}
.letter-card:active { transform: scale(.99); }

/* — Header bar — */
.lc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 12px 16px;
}
.lc-number {
    font-size: 15px;
    font-weight: 800;
    color: white;
    letter-spacing: .5px;
}
.lc-date {
    font-size: 12px;
    color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.15);
    padding: 3px 10px;
    border-radius: 20px;
}

/* — Ministry row — */
.lc-ministry {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}
.lc-ministry svg { color: var(--primary); flex-shrink: 0; }
.lc-entity { font-weight: 400; color: var(--gray-600); font-size: 13px; }

/* — Chips row — */
.lc-chips {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--gray-100);
}
.lc-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 90px;
    flex: 1;
}
.lc-chip-amount {
    background: #eaf6f0;
    border-color: #b7dfc9;
}
.lc-chip-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.lc-chip-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    word-break: break-all;
}
.lc-chip-amount .lc-chip-value { color: var(--success); }

/* — Actions row — */
.lc-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    flex-wrap: wrap;
    align-items: center;
}
.lc-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 13px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity .15s, transform .15s;
    font-family: inherit;
    white-space: nowrap;
}
.lc-btn:active { opacity: .8; transform: scale(.97); }

.lc-btn-view { background: #e8f1f8; color: var(--primary); }
.lc-btn-edit { background: #e8f4fd; color: #1a6fa8; }
.lc-btn-pdf  { background: #fdecea; color: var(--danger); }
.lc-btn-word { background: #e8f6ee; color: var(--success); }
.lc-btn-del  {
    background: #fdecea;
    color: var(--danger);
    padding: 7px 10px;
    margin-right: auto;   /* push delete to left */
}

/* ══════════════════════════════════════════
   SWITCH: table ↔ cards at 700px
   ══════════════════════════════════════════ */
@media (max-width: 700px) {
    .desktop-only { display: none !important; }
    .mobile-cards  {
        display: flex !important;
        flex-direction: column;
        padding: 14px;
        gap: 14px;
    }
}

/* ══════════════════════════════════════════
   DATATABLE STYLES
   ══════════════════════════════════════════ */

/* ── Toolbar ── */
.dt-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.dt-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 7px 12px;
    flex: 1;
    min-width: 180px;
    max-width: 320px;
    transition: border-color .2s;
}
.dt-search-wrap:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,134,193,.12);
}
.dt-search-wrap svg { color: var(--gray-600); flex-shrink: 0; }
.dt-search-input {
    border: none; outline: none; background: transparent;
    font-size: 14px; font-family: inherit; color: var(--gray-800);
    width: 100%; direction: rtl;
}
.dt-search-input::placeholder { color: var(--gray-600); }

/* ── Filters ── */
.dt-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.dt-select {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    cursor: pointer;
    direction: rtl;
    transition: border-color .2s;
}
.dt-select:focus { outline: none; border-color: var(--primary-light); }

.dt-amount-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dt-amount-input {
    width: 90px;
    padding: 7px 10px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    direction: rtl;
    transition: border-color .2s;
}
.dt-amount-input:focus { outline: none; border-color: var(--primary-light); }

.dt-right-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: auto;
}

/* ── Info bar ── */
.dt-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
    background: white;
}
.dt-selected-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

/* ── Sortable headers ── */
.dt-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background .15s;
}
.dt-sortable:hover { background: var(--gray-200); }
.dt-sortable.sorted { background: #e8f1f8; color: var(--primary); }
.sort-icon { color: var(--gray-600); font-size: 11px; margin-right: 4px; }
.dt-sortable.sorted .sort-icon { color: var(--primary); }

/* ── Checkbox col ── */
#dtTable thead th:first-child,
#dtTable tbody td:first-child {
    width: 44px;
    text-align: center;
    padding-right: 12px;
    padding-left: 12px;
}
.dt-row-check:checked + * { background: #edf4fb; }
.dt-row.selected { background: #f0f7ff; }

/* ── Pagination ── */
.dt-pagination { padding: 14px 16px; display: flex; justify-content: center; }
.dt-pag-inner  { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; }

.dt-pag-btn {
    min-width: 34px; height: 34px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    background: white; color: var(--gray-800);
    font-size: 13px; font-family: inherit;
    cursor: pointer; transition: all .15s;
    display: flex; align-items: center; justify-content: center;
    padding: 0 6px;
}
.dt-pag-btn:hover:not(.disabled):not(.active) {
    background: var(--gray-100); border-color: var(--primary);
}
.dt-pag-btn.active {
    background: var(--primary); border-color: var(--primary);
    color: white; font-weight: 700;
}
.dt-pag-btn.disabled { opacity: .4; cursor: not-allowed; }
.dt-pag-dots { color: var(--gray-600); font-size: 13px; padding: 0 4px; }

/* ══════════════════════════════════════════
   DATATABLE RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
    .dt-toolbar { flex-direction: column; align-items: stretch; }
    .dt-search-wrap { max-width: 100%; }
    .dt-right-controls { margin-right: 0; }
    .dt-filters { flex-wrap: wrap; }
    .dt-amount-range { flex: 1; }
    .dt-amount-input { flex: 1; width: auto; min-width: 60px; }
}

@media (max-width: 576px) {
    .dt-select     { font-size: 12px; padding: 7px 8px; }
    .dt-pag-btn    { min-width: 30px; height: 30px; font-size: 12px; }
    .dt-info-bar   { font-size: 12px; }
}
