/* ============================================================
   EnjazIMS - Shared UI Components
   المكونات المشتركة بين كل صفحات النظام
   ============================================================ */

/* ══════════════════════════ SCENE ══════════════════════════ */
.cx-scene {
    padding: 0;
    min-height: calc(100vh - 140px);
}

/* ══════════════════════════ HERO HEADER ══════════════════════════ */
.cx-hero {
    background: var(--surface);
    border-radius: 14px;
    padding: 0.75rem 1rem 0.4rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.cx-hero-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.cx-hero-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.cx-hero-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.cx-hero-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
}

.cx-hero-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Hero Actions */
.cx-hero-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cx-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cx-btn-add:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    color: #fff;
}

.cx-btn-add:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.cx-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cx-btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.cx-btn-secondary i {
    font-size: 0.85rem;
}

/* ══════════════════════════ STATS INLINE ══════════════════════════ */
.cx-stats-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.cx-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    transition: all 0.15s ease;
}

.cx-stat-badge i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.cx-stat-badge strong {
    font-size: 0.9rem;
    font-weight: 700;
}

.cx-stat-badge--primary {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.2);
    color: var(--primary);
}

.cx-stat-badge--success {
    background: rgba(16,185,129,0.08);
    border-color: rgba(16,185,129,0.2);
    color: #10b981;
}

.cx-stat-badge--muted {
    background: rgba(148,163,184,0.08);
    border-color: rgba(148,163,184,0.2);
    color: var(--text-secondary);
}

.cx-stat-badge--info {
    background: rgba(59,130,246,0.08);
    border-color: rgba(59,130,246,0.2);
    color: #3b82f6;
}

.cx-stat-badge--warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.2);
    color: #f59e0b;
}

/* ══════════════════════════ MAIN PANEL ══════════════════════════ */
.cx-panel {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}

.card-header {
    padding: 0.75rem 1rem !important;
}

.card-body {
    padding: 0.85rem 1rem !important;
}

.card-footer {
    padding: 0.65rem 1rem !important;
}

/* ══════════════════════════ TOOLBAR ══════════════════════════ */
.cx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.cx-toolbar-search {
    position: relative;
    flex: 1;
    max-width: 350px;
}

.cx-toolbar-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    pointer-events: none;
}

.cx-search-input {
    width: 100%;
    height: 42px;
    padding: 0 2.5rem 0 1rem;
    font-size: 0.875rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.15s ease;
}

.cx-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.cx-search-input::placeholder {
    color: var(--text-tertiary);
}

.cx-toolbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Filter Tabs */
.cx-filter-tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 12px;
    padding: 0.25rem;
}

.cx-filter-tab {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cx-filter-tab.active {
    background: var(--primary);
    color: #fff;
}

.cx-filter-tab:hover:not(.active) {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* ══════════════════════════ TABLE ══════════════════════════ */
.cx-table-wrap {
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.cx-table-wrap::-webkit-scrollbar {
    display: none;
}

.cx-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    table-layout: auto;
}

table.cx-table thead th {
    padding: 0.65rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-light);
    text-align: right !important;
    position: relative;
}

/* DataTables Sorting - RTL */
.cx-table thead th.sorting,
.cx-table thead th.sorting_asc,
.cx-table thead th.sorting_desc {
    padding-left: 2rem !important;
    padding-right: 1rem !important;
    text-align: right !important;
    cursor: pointer;
}

.cx-table thead th.sorting::after,
.cx-table thead th.sorting_asc::after,
.cx-table thead th.sorting_desc::after {
    display: none !important;
    content: none !important;
}

.cx-table thead th.sorting::before,
.cx-table thead th.sorting_asc::before,
.cx-table thead th.sorting_desc::before {
    position: absolute !important;
    left: 0.5rem !important;
    right: auto !important;
    top: 50%;
    transform: translateY(-50%);
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.65rem;
    opacity: 0.4;
}

.cx-table thead th.sorting::before      { content: "\f0dc" !important; }
.cx-table thead th.sorting_asc::before  { content: "\f0de" !important; opacity: 0.8 !important; color: var(--primary) !important; }
.cx-table thead th.sorting_desc::before { content: "\f0dd" !important; opacity: 0.8 !important; color: var(--primary) !important; }

.cx-table tbody td {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    text-align: right !important;
}

.cx-table tbody tr {
    transition: background 0.12s ease;
}

.cx-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* ── Table Cell Components ── */
.cxr-name {
    font-weight: 600;
    color: var(--text-primary);
}

.cxr-code {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99,102,241,0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
}

.cxr-city {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
}

.cxr-empty {
    color: var(--text-tertiary);
}

.cxr-bal {
    font-weight: 700;
    font-size: 0.9rem;
}

.cxr-bal--pos  { color: #10b981; }
.cxr-bal--neg  { color: #ef4444; }
.cxr-bal--zero { color: var(--text-secondary); }

/* Status Badge */
.cxr-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
}

.cxr-status--on {
    background: rgba(16,185,129,0.12);
    color: #10b981;
}

.cxr-status--off {
    background: rgba(148,163,184,0.12);
    color: var(--text-secondary);
}

.cxr-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.cxr-status--on  .cxr-status-dot { background: #10b981; }
.cxr-status--off .cxr-status-dot { background: var(--text-tertiary); }

/* Action Buttons */
.cxr-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cxr-act {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cxr-act:hover         { background: rgba(99,102,241,0.1);  color: var(--primary); }
.cxr-act--view:hover   { background: rgba(16,185,129,0.1);  color: #10b981; }
.cxr-act--del:hover    { background: rgba(239,68,68,0.1);   color: #ef4444; }

/* ══════════════════════════ MODAL ══════════════════════════ */
.modal           { z-index: 1050 !important; }
.modal-backdrop  { z-index: 1040 !important; }

.cx-modal-dialog {
    max-width: 750px;
}

.cx-modal {
    border: none;
    border-radius: 24px;
    overflow: hidden;
}

.cx-modal-main {
    display: flex;
    flex-direction: column;
}

.cx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(16,185,129,0.04));
    border-bottom: 1px solid var(--border-light);
}

.cx-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.cx-modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0 0;
}

.cx-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cx-modal-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cx-modal-body {
    padding: 1.75rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.cx-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* Modal Sidebar (used in customers) */
.cx-modal-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: linear-gradient(160deg, rgba(99,102,241,0.07), rgba(16,185,129,0.05));
    border-inline-start: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.cx-modal-sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.cx-ms-avatar {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.cx-ms-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

/* ══════════════════════════ FORM ELEMENTS ══════════════════════════ */
.cx-form-group-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1.5px solid var(--border-light);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cx-form-group-num {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cx-form-group-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cx-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cx-required {
    color: #ef4444;
    font-size: 0.7rem;
}

.cx-label + input,
.cx-label + select,
.cx-label + textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.15s ease;
}

/* Numeric inputs alignment */
.cx-label + input[type="number"],
input[type="number"].cx-input,
input[inputmode="decimal"].cx-input {
    text-align: right !important;
}

/* Date inputs alignment */
.cx-label + input[type="date"],
input[type="date"].cx-input {
    text-align: center !important;
}

.cx-label + input:focus,
.cx-label + select:focus,
.cx-label + textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.cx-label + input:disabled {
    background: var(--bg-secondary);
    opacity: 0.7;
}

/* Toggle Switch Card */
.cx-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cx-toggle-card:hover { background: var(--surface-hover); }

.cx-toggle-info  { flex: 1; }

.cx-toggle-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.cx-toggle-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.cx-toggle-card input[type="checkbox"] { display: none; }

.cx-toggle-switch {
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 30px;
    position: relative;
    transition: all 0.15s ease;
}

.cx-toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    right: 4px;
    transition: all 0.15s ease;
}

.cx-toggle-card input[type="checkbox"]:checked + .cx-toggle-switch {
    background: var(--primary);
}

.cx-toggle-card input[type="checkbox"]:checked + .cx-toggle-switch::before {
    transform: translateX(-20px);
}

/* ══════════════════════════ BUTTONS ══════════════════════════ */
.cx-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cx-btn-primary:hover { background: var(--primary-hover); color: #fff; }

.cx-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cx-btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.cx-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.5rem;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cx-btn-danger:hover { background: #dc2626; }

/* ══════════════════════════ DELETE CONFIRM MODAL ══════════════════════════ */
.cx-delete-dialog {
    max-width: 420px;
}

.cx-delete-modal {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    text-align: center;
}

.cx-delete-body { padding: 2rem 1.75rem; }

.cx-delete-icon {
    width: 64px;
    height: 64px;
    border-radius: 32px;
    background: rgba(239,68,68,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.cx-delete-icon i {
    font-size: 2rem;
    color: #ef4444;
}

.cx-delete-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cx-delete-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.cx-delete-desc strong { color: var(--text-primary); }

.cx-delete-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* ══════════════════════════ VIEW MODAL ══════════════════════════ */
.cx-view-dialog {
    max-width: 700px;
}

.modal-dialog.cx-ledger-dialog {
    max-width: min(1500px, 96vw);
}

.cx-view-modal {
    border: none;
    border-radius: 20px;
    overflow: hidden;
}

.cx-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(16,185,129,0.04));
    border-bottom: 1px solid var(--border-light);
}

.cx-view-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cx-view-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.cx-view-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.cx-view-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.cx-view-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cx-view-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cx-view-body {
    padding: 1rem 1.25rem;
    max-height: 60vh;
    overflow-y: auto;
}

.cx-view-section {
    margin-bottom: 1rem;
}

.cx-view-section:last-child { margin-bottom: 0; }

.cx-view-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
}

.cx-view-section-title i {
    font-size: 0.85rem;
    color: var(--primary);
}

/* Info Cards */
.cx-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

.cx-info-card {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.8rem 0.95rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    transition: border-color 0.15s ease;
}

.cx-info-card--full  { grid-column: 1 / -1; }

.cx-info-card--money {
    border-inline-end: 3px solid rgba(16,185,129,0.45);
    background: rgba(16,185,129,0.04);
}

.cx-info-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.cx-info-icon--name    { background: rgba(99,102,241,0.12); color: #6366f1; }
.cx-info-icon--phone   { background: rgba(16,185,129,0.12); color: #10b981; }
.cx-info-icon--email   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.cx-info-icon--city    { background: rgba(245,158,11,0.12); color: #f59e0b; }
.cx-info-icon--address { background: rgba(239,68,68,0.10);  color: #ef4444; }
.cx-info-icon--balance { background: rgba(16,185,129,0.15); color: #10b981; }
.cx-info-icon--credit  { background: rgba(99,102,241,0.12); color: #6366f1; }
.cx-info-icon--notes   { background: rgba(245,158,11,0.12); color: #f59e0b; }
.cx-info-icon--status  { background: rgba(16,185,129,0.12); color: #10b981; }

.cx-info-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cx-info-card-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cx-info-card-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.cx-info-card-value--money {
    font-size: 1.05rem;
    font-weight: 700;
    color: #10b981;
}

.cx-view-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* ══════════════════════════ DATATABLES FOOTER ══════════════════════════ */
.cx-panel .dataTables_wrapper .cx-dt-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 1rem;
}

.cx-panel .dataTables_wrapper .dataTables_info {
    padding: 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.cx-panel .dataTables_wrapper .pagination {
    margin: 0;
    gap: 0.3rem;
    display: flex;
    flex-wrap: wrap;
}

.cx-panel .dataTables_wrapper .pagination .page-item .page-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 0.65rem !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--surface) !important;
    color: var(--text-secondary) !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    transition: all 0.15s !important;
}

.cx-panel .dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.cx-panel .dataTables_wrapper .pagination .page-item .page-link:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* ══════════════════════════ MISC ══════════════════════════ */
.cx-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.alert-danger {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 12px;
    color: #ef4444;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
}

/* ══════════════════════════ DARK MODE ══════════════════════════ */
[data-theme="dark"] .cx-hero {
    background: var(--surface);
    border-color: rgba(255,255,255,0.05);
}

[data-theme="dark"] .cx-panel {
    background: var(--surface);
}

[data-theme="dark"] .cx-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .cx-modal,
[data-theme="dark"] .cx-delete-modal,
[data-theme="dark"] .cx-view-modal {
    background-color: var(--surface) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .cx-modal-header {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.06));
    border-bottom-color: var(--border-light);
}

[data-theme="dark"] .cx-modal-body {
    background-color: var(--surface);
    color: var(--text-primary);
}

[data-theme="dark"] .cx-modal-footer {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-light);
}

[data-theme="dark"] .cx-delete-body {
    background-color: var(--surface);
    color: var(--text-primary);
}

[data-theme="dark"] .cx-delete-footer {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-light);
}

[data-theme="dark"] .cx-view-header {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.06));
    border-bottom-color: var(--border-light);
}

[data-theme="dark"] .cx-view-body   { background-color: var(--surface); }

[data-theme="dark"] .cx-view-footer {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-light);
}

[data-theme="dark"] .cx-info-card {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

[data-theme="dark"] .cx-info-card--money { background: rgba(16,185,129,0.07); }

[data-theme="dark"] .cx-toggle-card { background: var(--bg-secondary); }

[data-theme="dark"] .cx-search-input {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ══════════════════════════ RESPONSIVE (Generic) ══════════════════════════ */
@media (max-width: 992px) {
    .cx-hero { padding: 1.25rem 1.5rem 0.25rem; }
    .cx-hero-title { font-size: 1.4rem; }
    .cx-modal-dialog { max-width: 90%; margin: 1rem; }
}

@media (max-width: 768px) {
    .cx-hero-inner { flex-direction: column; }
    .cx-hero-left  { width: 100%; }

    .cx-btn-add {
        width: 100%;
        justify-content: center;
    }

    .cx-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cx-toolbar-search { max-width: 100%; }
    .cx-toolbar-end    { justify-content: center; }

    .cx-filter-tabs {
        width: 100%;
        justify-content: center;
    }

    .cx-modal-body   { padding: 1.25rem; }
    .cx-modal-header { padding: 1rem 1.25rem; }
    .cx-modal-footer { padding: 0.875rem 1.25rem; }
    .cx-delete-body  { padding: 1.5rem 1.25rem; }

    /* Mobile table → card layout base */
    .cx-table-wrap { overflow: visible !important; }

    .cx-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0;
    }

    .cx-table thead { display: none !important; }

    .cx-table tbody,
    .cx-table.dataTable tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.875rem !important;
        width: 100% !important;
        padding: 0.875rem !important;
    }

    .cx-table tbody tr,
    .dataTables_wrapper .dataTable tbody tr {
        display: grid !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        background: var(--surface) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 18px !important;
        box-shadow: 0 2px 16px rgba(15,23,42,0.07) !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        position: relative !important;
    }

    .cx-table tbody tr::before {
        content: '';
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
        border-radius: 18px 18px 0 0;
        z-index: 1;
    }

    .cx-table tbody td {
        border: none !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        background: transparent !important;
    }

    .cx-table .cxr-actions {
        width: auto !important;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .cx-table .cxr-act {
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
        font-size: 0.9rem !important;
    }

    .dataTables_wrapper .dataTable tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.875rem !important;
        width: 100% !important;
        padding: 0.875rem !important;
    }

    .cx-table-wrap.table-responsive { overflow: visible !important; }
    .dataTables_scrollBody           { overflow: visible !important; }
}

@media (max-width: 576px) {
    .cx-hero-icon-wrap { width: 44px; height: 44px; font-size: 1.1rem; }
    .cx-hero-title     { font-size: 1.2rem; }
    .cx-filter-tab     { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

    .cx-info-grid                 { grid-template-columns: 1fr; }
    .cx-info-card--full           { grid-column: 1; }
    .cx-view-header               { padding: 1rem 1.25rem; }
    .cx-view-body                 { padding: 1rem 1.25rem; }
    .cx-view-avatar               { width: 48px; height: 48px; font-size: 1.2rem; }
    .cx-view-title                { font-size: 1.1rem; }
}
