:root {
    --dark: #111111;
    --muted: #6B7280;
    --bg: #FFFFFF;
    --card: #FFFFFF;
    --border: #E5E5E0;
    --primary: #000000;
    --secondary: #000000;
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--dark);
    font-size: 15px;
    line-height: 1.65;
    letter-spacing: -0.01em;
}

html[dir="ltr"] body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* الأرقام بخط Readex Pro لقراءة أوضح، حتى داخل النص العربي */
.num,
code,
.numeric,
.fw-bold.fw-bold,
.table td .text-end,
.stat-card h3,
.stat-card h4 {
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* جعل الأرقام في الجداول والكروت متجانسة العرض (tabular figures) */
.table,
.stat-card,
.action-bar {
    font-variant-numeric: tabular-nums lining-nums;
}

/* عناوين بخط أوزن أعلى */
h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: #111111;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1.05rem; }

/* أكواد ورقم سندات بـ Readex Pro */
code,
.code-pill {
    font-family: 'Readex Pro', 'Tajawal', monospace;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0;
}

.sidebar {
    min-height: 100vh;
    background: var(--bm-surface, #FFFFFF);
    color: white;
    position: sticky;
    top: 0;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 0;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: none;
    border: 1px solid #000000;
}

.brand-title {
    font-weight: 800;
    font-size: 18px;
}

.brand-subtitle {
    font-size: 12px;
    opacity: 0.75;
}

.side-nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: 0.2s;
    font-weight: 600;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateX(-3px);
}

.offcanvas .side-nav a {
    color: var(--dark);
}

.offcanvas .side-nav a:hover {
    background: #F3F4F6;
}

.main-content {
    min-height: 100vh;
}

.topbar,
.mobile-topbar {
    background: white;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-weight: 800;
    color: #111111;
    margin-bottom: 6px;
}

.text-muted-custom {
    color: var(--muted);
}

.card-soft,
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
}

.stat-card {
    min-height: 120px;
}

.stat-card h3 {
    font-size: 25px;
    margin-top: 8px;
}

.btn-accent {
    background: #111111;
    color: #ffffff;
    border: 1px solid #111111;
    font-weight: 600;
}

.btn-accent:hover {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

.btn-primary-custom {
    background: #111111;
    color: #ffffff;
    border: 1px solid #111111;
    font-weight: 600;
}

.btn-primary-custom:hover {
    background: #000000;
    color: #ffffff;
}

.check-item {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    font-weight: 700;
}

.login-body {
    min-height: 100vh;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    border-radius: 24px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(76, 29, 149, 0.15);
}

.login-card h1 {
    font-size: 25px;
    font-weight: 800;
    color: #2E1065;
}

.login-card p {
    color: var(--muted);
}

.table-responsive {
    border-radius: 16px;
}

/* =========================
   Settings Page
========================= */

.sticky-settings-nav {
    position: sticky;
    top: 24px;
}

.settings-tabs .list-group-item {
    border: none;
    border-radius: 12px;
    margin-bottom: 6px;
    font-weight: 700;
}

.settings-tabs .list-group-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.settings-group-badge {
    background: #F3F4F6;
    color: #4B5563;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    align-self: flex-start;
}

.form-control,
.form-select {
    border-radius: 12px;
    min-height: 46px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(76, 110, 245, 0.18);
}

/* =========================
   Users / Roles / Audit Logs
========================= */

.side-nav-section {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    font-weight: 800;
    margin: 18px 14px 8px;
    letter-spacing: 0.5px;
}

.offcanvas .side-nav-section {
    color: #6B7280;
}

.permission-module-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    height: 100%;
}

.permission-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #E5E7EB;
    cursor: pointer;
}

.permission-check:last-child {
    border-bottom: none;
}

.permission-check input {
    margin-top: 5px;
    width: 18px;
    height: 18px;
}

.audit-json-box {
    background: #111827;
    color: #F9FAFB;
    border-radius: 14px;
    padding: 14px;
    overflow-x: auto;
}

.audit-json-box pre {
    color: #F9FAFB;
    margin: 8px 0 0;
    white-space: pre-wrap;
    direction: ltr;
    text-align: left;
}

/* =========================
   Quick Registration
========================= */

.quick-summary-card {
    position: sticky;
    top: 24px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.summary-line span {
    color: var(--muted);
    font-weight: 700;
}

.summary-line strong {
    font-weight: 800;
}

.summary-line.total {
    font-size: 18px;
    color: #111827;
}

.summary-line.total strong {
    color: #16A34A;
}

.summary-line.remaining strong {
    color: #DC2626;
}

.quick-toggle .btn {
    font-weight: 800;
    border-radius: 0 !important;
    margin: 0 3px;
}

/* =========================
   Enrollments / Invoices
========================= */

.border-danger {
    border-color: #DC2626 !important;
}

.invoice-status-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

/* =========================
   Payments / Receipts
========================= */

.receipt-status-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.payment-cancelled-row {
    background: #FEF2F2;
}

/* =========================
   Responsive
========================= */

@media (max-width: 1200px) {
    .sticky-settings-nav,
    .quick-summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding-top: 16px;
    }

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

    .stat-card h3 {
        font-size: 22px;
    }

    .login-card {
        padding: 24px;
        border-radius: 20px;
    }

    .summary-line {
        font-size: 14px;
    }

    .summary-line.total {
        font-size: 16px;
    }
}

/* =========================
   Print
========================= */

@media print {
    .no-print,
    .sidebar,
    .topbar,
    .mobile-topbar {
        display: none !important;
    }

    body {
        background: white;
    }

    .card-soft,
    .stat-card {
        box-shadow: none;
    }

    .invoice-print-page {
        width: 100%;
        box-shadow: none;
        border: none;
    }
}
/* =========================
   Expenses / Vouchers
========================= */

.expense-summary-card {
    position: sticky;
    top: 24px;
}

.expense-status-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.expense-cancelled-row {
    background: #FEF2F2;
}

@media (max-width: 1200px) {
    .expense-summary-card {
        position: static;
    }
}

/* =========================
   Certificates
========================= */

.certificate-cancelled-row {
    background: #FEF2F2;
}

.certificate-status-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

/* =========================
   Professional Dashboard
========================= */

.dashboard-mini-card {
    min-height: 135px;
    position: relative;
    overflow: hidden;
}

.dashboard-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #F3E8FF;
    color: #6D28D9;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 10px;
}

.dashboard-finance-card {
    border-right: 2px solid #111111;
}

.dashboard-finance-card.success {
    border-right-color: #16A34A;
}

.dashboard-finance-card.danger {
    border-right-color: #DC2626;
}

.dashboard-finance-card.warning {
    border-right-color: #F59E0B;
}

.dashboard-finance-card small {
    color: var(--muted);
    font-weight: 700;
}

.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-action {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 800;
    transition: 0.2s;
    text-align: center;
}

.dashboard-action:hover {
    background: #F3E8FF;
    color: #6D28D9;
    transform: translateY(-2px);
}

.dashboard-status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.dashboard-status-line:last-child {
    border-bottom: none;
}

.dashboard-status-line span {
    color: var(--muted);
    font-weight: 700;
}

.dashboard-status-line strong {
    background: #F3E8FF;
    color: #6D28D9;
    border-radius: 999px;
    padding: 5px 12px;
}

@media (max-width: 768px) {
    .dashboard-actions-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-mini-card {
        min-height: 120px;
    }
}

/* =========================
   System Tools / Backup / Health
========================= */

.system-check-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-right: 5px solid #6B7280;
    border-radius: 16px;
    padding: 18px;
    height: 100%;
}

.system-check-card.border-success {
    border-right-color: #16A34A !important;
}

.system-check-card.border-warning {
    border-right-color: #F59E0B !important;
}

.system-check-card.border-danger {
    border-right-color: #DC2626 !important;
}

/* =========================
   UX Polish / Final UI
========================= */

.side-nav a.active {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.75);
    transform: translateX(-3px);
}

.offcanvas .side-nav a.active {
    background: #F3E8FF;
    color: #6D28D9;
    box-shadow: none;
    font-weight: 800;
}

.logout-link {
    margin-top: 14px;
    background: rgba(220, 38, 38, 0.15);
}

.logout-link:hover {
    background: rgba(220, 38, 38, 0.25) !important;
}

.card-soft,
.stat-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card-soft:hover,
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(17, 24, 39, 0.07);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #F9FAFB;
    color: #374151;
    font-size: 13px;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: 0.18s ease;
}

.table-hover tbody tr:hover {
    background: #FAF5FF;
}

.badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 800;
}

.alert {
    border-radius: 16px;
    border: none;
    font-weight: 700;
}

.alert-success,
.alert-danger,
.alert-warning,
.alert-info {
    background: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

.mobile-table-hint {
    display: none;
    background: #F9FAFB;
    color: #6B7280;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

.scroll-top-btn {
    position: fixed;
    left: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 22px;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(76, 110, 245, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: 0.25s ease;
    z-index: 999;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.form-label {
    color: #374151;
}

.form-control,
.form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:hover,
.form-select:hover {
    background-color: #FCFCFD;
}

.btn {
    border-radius: 12px;
    font-weight: 800;
}

.btn-sm {
    border-radius: 10px;
    font-weight: 800;
}

.page-title {
    position: relative;
    display: inline-block;
}

.page-title::after {
    content: "";
    display: block;
    width: 32px;
    height: 2px;
    background: #111111;
    border-radius: 0;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .mobile-table-hint {
        display: block;
    }

    .bm-list-table .table {
        min-width: 720px;
    }

    .stat-card,
    .card-soft {
        border-radius: 16px;
    }

    .scroll-top-btn {
        left: 16px;
        bottom: 16px;
        width: 42px;
        height: 42px;
    }
}

@media print {
    .scroll-top-btn,
    .mobile-table-hint {
        display: none !important;
    }

    .card-soft:hover,
    .stat-card:hover {
        transform: none;
        box-shadow: none;
    }

    .page-title::after {
        display: none;
    }
}

/* =========================
   Professional Mobile Header
========================= */

.mobile-app-topbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
}

.mobile-topbar-inner {
    min-height: 64px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 10px;
}

.mobile-topbar-search input {
    border-radius: 14px;
    border: 1px solid var(--bm-border);
    background: #fff;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}

.mobile-topbar-search input:focus {
    border-color: var(--bm-primary);
    box-shadow: 0 0 0 3px var(--bm-primary-soft);
}

.mobile-brand-bar {
    border-top: 1px solid var(--bm-border);
    padding-top: 0.5rem;
}

.mobile-brand-bar .mobile-brand-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--bm-text);
}

.mobile-brand-bar .mobile-brand-subtitle {
    font-size: 0.75rem;
    color: var(--bm-text-muted);
}

.mobile-offcanvas-search input {
    border-radius: 14px;
}

.keyboard-help-btn {
    position: fixed;
    bottom: 88px;
    left: 20px;
    z-index: 1030;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--bm-border);
    background: #fff;
    color: var(--bm-text-muted);
    font-weight: 700;
    box-shadow: var(--bm-shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.keyboard-help-btn:hover {
    color: var(--bm-primary);
    border-color: var(--bm-primary);
}

.mobile-menu-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 16px;
    background: #F3E8FF;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.12);
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #6D28D9;
    display: block;
}

.mobile-brand-center {
    text-align: center;
    min-width: 0;
}

.mobile-brand-title {
    color: #2E1065;
    font-weight: 900;
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-brand-subtitle {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
}

.mobile-user-chip {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
    box-shadow: 0 10px 22px rgba(76, 29, 149, 0.16);
}

.mobile-offcanvas {
    border-radius: 22px 0 0 22px;
    overflow: hidden;
}

.mobile-offcanvas-header {
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(124, 58, 237, 0.14), transparent 32%),
        #FFFFFF;
    padding: 18px;
}

.mobile-offcanvas-body {
    background: #FFFFFF;
    padding: 16px;
}

.mobile-user-box {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

@media (max-width: 420px) {
    .mobile-brand-title {
        font-size: 14px;
    }

    .mobile-brand-subtitle {
        font-size: 10px;
    }

    .mobile-topbar-inner {
        grid-template-columns: 44px 1fr 44px;
        padding-inline: 10px;
    }
}

/* =========================
   Quick Registration Mobile UX
========================= */

.quick-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.quick-page-badge {
    background: #ECFDF5;
    color: #047857;
    border: 1px solid #A7F3D0;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.quick-mobile-steps {
    display: none;
}

.quick-section-card {
    overflow: hidden;
}

.quick-section-title {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.quick-section-title h5 {
    margin: 0 0 4px;
    font-weight: 900;
    color: #2E1065;
}

.quick-section-title p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.quick-section-number {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    flex: 0 0 auto;
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.16);
}

.quick-summary-card {
    border: 1px solid rgba(124, 58, 237, 0.18);
}

.quick-summary-card .card-body h5 {
    color: #2E1065;
}

.quick-summary-card .btn-lg {
    min-height: 52px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .quick-page-header {
        display: block;
    }

    .quick-page-badge {
        display: inline-flex;
        margin-top: 14px;
    }

    .quick-mobile-steps {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 4px 0 8px;
        scrollbar-width: none;
    }

    .quick-mobile-steps::-webkit-scrollbar {
        display: none;
    }

    .quick-step-pill {
        flex: 0 0 auto;
        border: 1px solid var(--border);
        background: #FFFFFF;
        color: #6B7280;
        padding: 9px 13px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 900;
        box-shadow: 0 8px 18px rgba(17, 24, 39, 0.04);
    }

    .quick-step-pill.active {
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        border-color: transparent;
    }

    .quick-section-card {
        border-radius: 20px;
        margin-bottom: 16px !important;
    }

    .quick-section-card .card-body {
        padding: 20px !important;
    }

    .quick-section-title {
        gap: 12px;
        margin-bottom: 18px;
    }

    .quick-section-title h5 {
        font-size: 17px;
    }

    .quick-section-title p {
        font-size: 12px;
        line-height: 1.7;
    }

    .quick-section-number {
        width: 34px;
        height: 34px;
        border-radius: 13px;
    }

    .quick-toggle {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .quick-toggle .btn {
        width: 100%;
        margin: 0;
        min-height: 46px;
        border-radius: 14px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .quick-summary-card {
        position: static !important;
        border-radius: 22px;
        margin-top: 4px;
        box-shadow: 0 18px 40px rgba(76, 29, 149, 0.10);
    }

    .quick-summary-card .card-body {
        padding: 20px !important;
    }

    .summary-line {
        padding: 10px 0;
    }

    .summary-line.total {
        background: #F0FDF4;
        border: 1px solid #BBF7D0;
        border-radius: 14px;
        padding: 12px;
        margin-top: 8px;
    }

    .summary-line.remaining {
        background: #FEF2F2;
        border: 1px solid #FECACA;
        border-radius: 14px;
        padding: 12px;
        margin-top: 8px;
    }

    #quickRegistrationForm input,
    #quickRegistrationForm select,
    #quickRegistrationForm textarea {
        font-size: 16px;
    }

    #quickRegistrationForm .form-label {
        margin-bottom: 7px;
        font-size: 14px;
    }

    #quickRegistrationForm .btn-lg {
        min-height: 54px;
    }
}

/* =========================
   Grouped Sidebar Navigation
========================= */

.side-nav-grouped {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* عنصر تنقّل عام (سواء كان مفرداً أو داخل مجموعة) */
.side-nav-grouped .side-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 12px;
    margin: 0;
    transition: background 0.18s, transform 0.18s;
    font-weight: 600;
    font-size: 15px;
}

.side-nav-grouped .side-nav-item:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateX(-3px);
}

.side-nav-grouped .side-nav-item.active {
    background: rgba(255, 255, 255, 0.20);
    box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.85);
}

.side-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    font-size: 16px;
    opacity: 0.95;
    flex-shrink: 0;
}

.side-nav-label {
    flex: 1;
}

/* المجموعات القابلة للطي */
.side-nav-group {
    margin: 2px 0;
}

.side-nav-group > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    padding: 11px 14px;
    border-radius: 12px;
    transition: background 0.18s;
    font-weight: 700;
    font-size: 15px;
}

.side-nav-group > summary::-webkit-details-marker {
    display: none;
}

.side-nav-group > summary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.side-nav-caret {
    margin-inline-start: auto;
    font-size: 18px;
    font-weight: 900;
    opacity: 0.7;
    transition: transform 0.25s;
    line-height: 1;
}

/* سهم يدور عند فتح المجموعة */
.side-nav-group[open] > summary .side-nav-caret {
    transform: rotate(90deg);
    opacity: 1;
}

.side-nav-group[open] > summary {
    background: rgba(255, 255, 255, 0.10);
}

/* الروابط الفرعية داخل المجموعة */
.side-nav-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 6px 0 2px;
    padding-inline-start: 18px;
    border-inline-start: 2px solid rgba(255, 255, 255, 0.18);
    margin-inline-start: 18px;
}

.side-nav-items .side-nav-item {
    font-size: 14px;
    padding: 9px 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
}

.side-nav-items .side-nav-item.active {
    background: rgba(255, 255, 255, 0.22);
    color: white;
    font-weight: 700;
}

/* تنعيم ظهور المحتوى الفرعي */
.side-nav-group[open] > .side-nav-items {
    animation: sideNavSlide 0.22s ease;
}

@keyframes sideNavSlide {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* رابط الخروج */
.side-nav-grouped .logout-link {
    margin-top: 12px;
    background: rgba(220, 38, 38, 0.18);
    color: #FECACA;
}

.side-nav-grouped .logout-link:hover {
    background: rgba(220, 38, 38, 0.28);
    color: #FFF;
}

/* النسخة الخفيفة داخل قائمة الموبايل (offcanvas بخلفية بيضاء) */
.offcanvas .side-nav-grouped .side-nav-item {
    color: #1F2937;
}

.offcanvas .side-nav-grouped .side-nav-item:hover {
    background: #F3F4F6;
}

.offcanvas .side-nav-grouped .side-nav-item.active {
    background: #F3E8FF;
    color: #6D28D9;
    box-shadow: none;
    font-weight: 800;
}

.offcanvas .side-nav-group > summary {
    color: #1F2937;
}

.offcanvas .side-nav-group > summary:hover {
    background: #F3F4F6;
}

.offcanvas .side-nav-group[open] > summary {
    background: #F9FAFB;
}

.offcanvas .side-nav-items {
    border-inline-start-color: rgba(124, 58, 237, 0.2);
}

.offcanvas .side-nav-items .side-nav-item {
    color: #4B5563;
}

.offcanvas .side-nav-items .side-nav-item.active {
    background: #F3E8FF;
    color: #6D28D9;
    font-weight: 700;
}

.offcanvas .side-nav-grouped .logout-link {
    background: #FEE2E2;
    color: #B91C1C;
}

.offcanvas .side-nav-grouped .logout-link:hover {
    background: #FECACA;
    color: #991B1B;
}

/* ====================================================================
   Soft UI Polish Layer
   - Refined color tokens
   - Softer shadows and borders
   - Better focus states (accessibility)
   - Consistent spacing
   - Smooth transitions on interactive elements
   - Better empty states
   ==================================================================== */

:root {
    /* Mobile-first touch targets (WCAG ~44px) */
    --bm-touch: 48px;
    --bm-touch-sm: 44px;
    --bm-touch-gap: 0.5rem;

    /* نظملي — Monochromatic Minimalism */
    --bm-bg: #FFFFFF;
    --bm-surface: #FFFFFF;
    --bm-surface-2: #F5F5F0;
    --bm-border: #E5E5E0;
    --bm-border-strong: #D4D4CF;
    --bm-text: #111111;
    --bm-text-soft: #4B5563;
    --bm-text-muted: #6B7280;

    /* UI — أبيض وأسود فقط */
    --bm-primary: #000000;
    --bm-primary-soft: rgba(0, 0, 0, 0.06);
    --bm-primary-strong: #000000;
    --bm-accent: #000000;
    --bm-link: #000000;

    --bm-tint-blue: #ffffff;
    --bm-tint-lavender: #ffffff;
    --bm-tint-mint: #ffffff;
    --bm-tint-sand: #ffffff;

    --bm-success: #000000;
    --bm-success-soft: #ffffff;
    --bm-warning: #000000;
    --bm-warning-soft: #ffffff;
    --bm-danger: #000000;
    --bm-danger-soft: #ffffff;
    --bm-info: #000000;
    --bm-info-soft: #ffffff;

    /* بدون ظلال تقريباً */
    --bm-shadow-sm: none;
    --bm-shadow: none;
    --bm-shadow-lg: none;
    --bm-shadow-focus: none;

    /* 8px grid — انحناءات معتدلة */
    --bm-radius-sm: 4px;
    --bm-radius: 8px;
    --bm-radius-lg: 12px;
    --bm-radius-xl: 12px;
    --bm-space-1: 8px;
    --bm-space-2: 16px;
    --bm-space-3: 24px;
    --bm-space-4: 48px;
    --bm-space-5: 64px;

    /* تحوّلات */
    --bm-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --bm-t-fast: 0.15s;
    --bm-t-mid: 0.22s;
}

body {
    background: var(--bm-bg);
    color: var(--bm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* ====== Page wrapper: more breathing room ====== */
.content-wrapper {
    max-width: 1480px;
    margin: 0 auto;
    padding-block: 0.5rem var(--bm-space-3);
}

@media (min-width: 768px) {
    .content-wrapper {
        padding-block: 0.5rem var(--bm-space-3);
    }
}

/* ====== Card spacing — more generous padding ====== */
.card .card-body,
.card-soft .card-body {
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .card .card-body,
    .card-soft .card-body {
        padding: 1.75rem;
    }
}

.card + .card,
.card + .row,
.row + .card,
.row + .row {
    margin-top: 0.25rem;
}

/* ====== Page title — وأكثر تنفساً ====== */
.page-title {
    font-weight: 800;
    font-size: 1.85rem;
    color: var(--bm-text);
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .page-title {
        font-size: 2.05rem;
    }
}

.text-muted-custom {
    color: var(--bm-text-muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

/* ====== Section titles داخل البطاقات ====== */
.card h5,
.card-soft h5 {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--bm-text);
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

/* ====== Tables: مساحات أوسع، خطوط أوضح ====== */
.table {
    font-size: 0.93rem;
}

.table > thead th {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--bm-text-muted);
    text-transform: none;
    padding: 1rem 0.85rem;
    background: var(--bm-surface-2);
    border-bottom: 1px solid var(--bm-border);
}

.table > tbody > tr > td {
    padding: 0.95rem 0.85rem;
    font-size: 0.93rem;
}

/* ====== Buttons: ارتفاع أنعم ====== */
.btn {
    line-height: 1.5;
    font-size: 0.92rem;
}

.btn-sm {
    font-size: 0.83rem;
    padding: 0.4rem 0.85rem;
}

.btn-lg {
    font-size: 1.05rem;
    padding: 0.85rem 1.65rem;
}

/* ====== Form layout: حقول أكبر، مساحات أكثر ====== */
.form-control,
.form-select {
    padding: 0.65rem 0.95rem;
    font-size: 0.94rem;
    line-height: 1.6;
}

.form-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--bm-text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.005em;
}

.mb-3 { margin-bottom: 1.25rem !important; }
.row.g-3 { --bs-gutter-y: 1.1rem; }
.row.g-4 { --bs-gutter-y: 1.5rem; }

/* ====== Section dividers ====== */
.section-divider {
    border: 0;
    height: 1px;
    background: var(--bm-border);
    margin: 1.75rem 0;
}

/* ====== Sub-header inside detail pages ====== */
.detail-section-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--bm-text);
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.detail-section-title::before {
    content: "";
    width: 4px;
    height: 18px;
    background: var(--bm-primary);
    border-radius: 4px;
    display: inline-block;
}

/* ====== Data list (key/value pairs) ====== */
.data-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
}

@media (min-width: 576px) {
    .data-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .data-list.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .data-list.cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.data-list .data-item .data-label {
    color: var(--bm-text-muted);
    font-size: 0.84rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.data-list .data-item .data-value {
    color: var(--bm-text);
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.5;
}

/* ====== Stat card: عناوين مرتاحة، أرقام واضحة ====== */
.stat-card {
    padding: 1.5rem;
}

.stat-card .text-muted,
.stat-card .text-muted-custom {
    font-size: 0.84rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--bm-text-muted);
}

.stat-card h3 {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    color: var(--bm-text);
    letter-spacing: -0.02em;
}

.stat-card small {
    font-size: 0.78rem;
    color: var(--bm-text-muted);
    line-height: 1.4;
}

/* ====== Top-bar polish ====== */
.topbar {
    padding-block: 1rem;
}

/* ====== Mobile spacing ====== */
@media (max-width: 991px) {
    .content-wrapper {
        padding-block: 0.25rem 4.5rem;
    }
    .card .card-body,
    .card-soft .card-body {
        padding: 1.15rem;
    }
    .page-title {
        font-size: 1.55rem;
    }
}

/* ====== Hide native scrollbar arrows in number inputs ====== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ====== Scrollbar styling ====== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bm-border-strong);
    border-radius: 999px;
    border: 2px solid var(--bm-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bm-text-muted);
}

/* ====== Cards ====== */
.card,
.card-soft,
.stat-card {
    background: var(--bm-surface);
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius-lg);
    box-shadow: var(--bm-shadow-sm);
    transition: box-shadow var(--bm-t-mid) var(--bm-ease),
                transform var(--bm-t-mid) var(--bm-ease),
                border-color var(--bm-t-mid) var(--bm-ease);
}

.card:hover,
.card-soft:hover,
.stat-card:hover {
    box-shadow: var(--bm-shadow);
    border-color: var(--bm-border-strong);
}

.stat-card.dashboard-finance-card {
    border-left: 4px solid var(--bm-primary);
}

.stat-card.dashboard-finance-card.success { border-left-color: var(--bm-success); }
.stat-card.dashboard-finance-card.warning { border-left-color: var(--bm-warning); }
.stat-card.dashboard-finance-card.danger  { border-left-color: var(--bm-danger);  }

/* ====== Buttons ====== */
.btn {
    border-radius: var(--bm-radius-sm);
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    transition: background var(--bm-t-fast) var(--bm-ease),
                color var(--bm-t-fast) var(--bm-ease),
                box-shadow var(--bm-t-fast) var(--bm-ease),
                transform var(--bm-t-fast) var(--bm-ease);
    border: 1px solid transparent;
    box-shadow: var(--bm-shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--bm-shadow);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--bm-shadow-sm);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--bm-shadow-focus);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--bm-radius-sm);
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.05rem;
    border-radius: var(--bm-radius);
}

.btn-accent {
    background: var(--bm-primary);
    color: #ffffff;
    border: 1px solid var(--bm-primary);
    box-shadow: none;
}

.btn-accent:hover {
    background: var(--bm-primary-strong);
    border-color: var(--bm-primary-strong);
    color: #ffffff;
}

.btn-success { background: var(--bm-success); border-color: var(--bm-success); color: white; }
.btn-success:hover { background: #047857; border-color: #047857; color: white; }

.btn-warning { background: var(--bm-warning); border-color: var(--bm-warning); color: white; }
.btn-warning:hover { background: #B45309; border-color: #B45309; color: white; }

.btn-danger { background: var(--bm-danger); border-color: var(--bm-danger); color: white; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: white; }

.btn-secondary {
    background: var(--bm-surface);
    border-color: var(--bm-border-strong);
    color: var(--bm-text-soft);
}

.btn-secondary:hover {
    background: var(--bm-surface-2);
    border-color: var(--bm-text-muted);
    color: var(--bm-text);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--bm-primary);
    color: var(--bm-primary);
}

.btn-outline-primary:hover {
    background: var(--bm-primary);
    color: #ffffff;
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--bm-danger);
    color: var(--bm-danger);
}

.btn-outline-danger:hover {
    background: var(--bm-danger);
    color: white;
}

/* أزرار جزء يدوي صغير */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* ====== Form controls ====== */
.form-control,
.form-select {
    border-radius: var(--bm-radius-sm);
    border: 1px solid var(--bm-border-strong);
    padding: 0.55rem 0.85rem;
    background: var(--bm-surface);
    color: var(--bm-text);
    transition: border-color var(--bm-t-fast) var(--bm-ease),
                box-shadow var(--bm-t-fast) var(--bm-ease),
                background var(--bm-t-fast) var(--bm-ease);
    font-size: 0.95rem;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--bm-text-muted);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bm-primary);
    border-width: 2px;
    box-shadow: none;
    background: var(--bm-surface);
    outline: none;
}

.form-control:disabled,
.form-select:disabled {
    background: var(--bm-surface-2);
    color: var(--bm-text-muted);
    cursor: not-allowed;
}

.form-label {
    font-weight: 600;
    color: var(--bm-text-soft);
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
}

/* مؤشر الحقل المطلوب */
.form-label.required::after,
.form-label[data-required]::after {
    content: " *";
    color: var(--bm-danger);
    font-weight: 700;
}

/* نص مساعد تحت الحقل */
.form-text {
    color: var(--bm-text-muted);
    font-size: 0.82rem;
    margin-top: 0.3rem;
}

/* ====== Tables ====== */
.table {
    color: var(--bm-text);
    border-color: var(--bm-border);
}

.table > thead {
    background: var(--bm-surface-2);
}

.table > thead th {
    border-bottom: 1px solid var(--bm-border);
    color: var(--bm-text-soft);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.85rem 0.8rem;
    white-space: nowrap;
}

.table > tbody > tr {
    transition: background var(--bm-t-fast) var(--bm-ease);
}

.table > tbody > tr > td {
    padding: 0.85rem 0.8rem;
    border-color: var(--bm-border);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover {
    background: var(--bm-surface-2);
}

.table-responsive {
    border-radius: var(--bm-radius);
    border: 1px solid var(--bm-border);
    background: var(--bm-surface);
    box-shadow: none;
    overflow: auto;
}

/* صفوف قابلة للضغط بالكامل */
.table tr.row-clickable {
    cursor: pointer;
}

.table tr.row-clickable:hover {
    background: var(--bm-surface-2);
}

/* ====== Badges (Status pills) ====== */
.badge,
.status-pill {
    display: inline-block;
    padding: 0.35em 0.7em;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid transparent;
}

.status-pill.success,
.status-pill.paid,
.badge.bg-success {
    background: var(--bm-success-soft);
    color: var(--bm-success);
    border-color: rgba(5, 150, 105, 0.2);
}

.status-pill.warning,
.status-pill.partial,
.badge.bg-warning {
    background: var(--bm-warning-soft);
    color: var(--bm-warning);
    border-color: rgba(217, 119, 6, 0.2);
}

.status-pill.danger,
.status-pill.unpaid,
.badge.bg-danger {
    background: var(--bm-danger-soft);
    color: var(--bm-danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.status-pill.info,
.badge.bg-info {
    background: var(--bm-info-soft);
    color: var(--bm-info);
    border-color: rgba(37, 99, 235, 0.2);
}

.status-pill.neutral,
.badge.bg-secondary {
    background: var(--bm-surface-2);
    color: var(--bm-text-soft);
    border-color: var(--bm-border);
}

/* ====== Alerts ====== */
.alert {
    border-radius: var(--bm-radius);
    border: 1px solid transparent;
    padding: 0.85rem 1.1rem;
    box-shadow: var(--bm-shadow-sm);
}

.alert-success {
    background: var(--bm-success-soft);
    color: var(--bm-success);
    border-color: rgba(5, 150, 105, 0.18);
}

.alert-warning {
    background: var(--bm-warning-soft);
    color: var(--bm-warning);
    border-color: rgba(217, 119, 6, 0.18);
}

.alert-danger {
    background: var(--bm-danger-soft);
    color: var(--bm-danger);
    border-color: rgba(220, 38, 38, 0.18);
}

.alert-info {
    background: var(--bm-info-soft);
    color: var(--bm-info);
    border-color: rgba(37, 99, 235, 0.18);
}

.alert-secondary {
    background: var(--bm-surface-2);
    color: var(--bm-text-soft);
    border-color: var(--bm-border);
}

/* ====== Page header ====== */
.page-title {
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--bm-text);
    margin: 0 0 0.3rem;
    letter-spacing: -0.02em;
}

.text-muted-custom {
    color: var(--bm-text-muted);
}

/* ====== Empty states ====== */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--bm-text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    background: var(--bm-primary-soft);
    color: var(--bm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.empty-state-title {
    color: var(--bm-text);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.empty-state-message {
    margin-bottom: 1.2rem;
    max-width: 36ch;
    margin-inline: auto;
    line-height: 1.6;
}

/* ====== Filter chips ====== */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 0;
    border: 1px solid var(--bm-border-strong);
    background: var(--bm-surface);
    color: var(--bm-text-soft);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--bm-t-fast) var(--bm-ease);
}

.filter-chip:hover {
    border-color: var(--bm-primary);
    color: var(--bm-primary);
}

.filter-chip.active {
    background: var(--bm-primary);
    color: white;
    border-color: var(--bm-primary);
}

.filter-chip-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.05rem 0.4rem;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 700;
}

.filter-chip.active .filter-chip-count {
    background: rgba(255, 255, 255, 0.25);
}

.filter-chip-label {
    line-height: 1.25;
    text-align: center;
}

/* صف واحد — أزرار متساوية العرض */
.filter-chips--uniform {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr));
    gap: 0.4rem;
    align-items: stretch;
}

.filter-chips--uniform .filter-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    padding: 0.45rem 0.4rem;
    text-align: center;
    width: 100%;
    white-space: normal;
}

.filter-chips--uniform .filter-chip-label,
.filter-chips--uniform .filter-chip > :not(.filter-chip-count) {
    line-height: 1.25;
}

/* صفوف مزدوجة محاذاة (تسجيلات: حالة التسجيل + حالة الدفع) */
.bm-filter-matrix {
    --bm-filter-cols: 7;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bm-filter-matrix__row {
    display: grid;
    grid-template-columns: minmax(5.75rem, 6.75rem) minmax(0, 1fr);
    gap: 0.45rem 0.65rem;
    align-items: stretch;
}

.bm-filter-matrix__label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bm-text-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: end;
    line-height: 1.3;
    padding-inline-end: 0.15rem;
}

.bm-filter-matrix__track {
    display: grid;
    grid-template-columns: repeat(var(--bm-filter-cols), minmax(0, 1fr));
    gap: 0.4rem;
    align-items: stretch;
    min-width: 0;
}

.bm-filter-matrix__track .filter-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    padding: 0.4rem 0.35rem;
    font-size: clamp(0.68rem, 1.6vw, 0.82rem);
    text-align: center;
    width: 100%;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
}

.filter-chip--pad {
    visibility: hidden;
    pointer-events: none;
    border-color: transparent !important;
    background: transparent !important;
    min-height: 2.65rem;
}

/* ====== PWA update banner ====== */
.pwa-update-banner {
    position: fixed;
    z-index: 1105;
    inset-inline: 0.75rem;
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    max-width: 28rem;
    margin-inline: auto;
    pointer-events: none;
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pwa-update-banner.is-visible {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.pwa-update-banner__inner {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--bm-black);
    color: var(--bm-white);
    border: 1px solid var(--bm-black);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.pwa-update-banner__text {
    font-size: 0.85rem;
    line-height: 1.45;
}

.pwa-update-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.pwa-update-banner__actions .btn-accent {
    background: var(--bm-white);
    color: var(--bm-black);
    border-color: var(--bm-white);
}

.pwa-update-banner__actions .btn-secondary {
    background: transparent;
    color: var(--bm-white);
    border-color: rgba(255, 255, 255, 0.45);
}

@media (min-width: 768px) {
    .pwa-update-banner {
        inset-inline-end: 1.25rem;
        inset-inline-start: auto;
        bottom: 1.25rem;
        margin-inline: 0;
    }
}

/* ====== List pagination ====== */
.bm-pagination .pagination .page-link {
    color: var(--bm-text);
    border-color: var(--bm-border);
    background: var(--bm-surface);
}

.bm-pagination .pagination .page-item.active .page-link {
    background: var(--bm-accent);
    border-color: var(--bm-accent);
    color: #fff;
}

.bm-pagination .pagination .page-item.disabled .page-link {
    color: var(--bm-text-muted);
    background: var(--bm-surface-2, var(--bm-surface));
}

/* ====== Quick action bar ====== */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.2rem;
    background: var(--bm-surface);
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius);
    box-shadow: var(--bm-shadow-sm);
    margin-bottom: 1.2rem;
    align-items: center;
}

.action-bar-label {
    color: var(--bm-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    margin-inline-end: 0.4rem;
}

/* ====== Avatar / Initial bubble ====== */
.avatar-initial {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bm-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.avatar-initial.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-initial.lg { width: 56px; height: 56px; font-size: 22px; }

/* ====== Topbar refresh ====== */
.topbar {
    background: var(--bm-surface);
    border-bottom: 1px solid var(--bm-border);
    box-shadow: var(--bm-shadow-sm);
}

.topbar-search {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.topbar-search input {
    width: 100%;
    border: 1px solid var(--bm-border-strong);
    border-radius: 999px;
    padding: 0.5rem 2.4rem 0.5rem 1rem;
    background: var(--bm-surface-2);
    color: var(--bm-text);
    font-size: 0.92rem;
    transition: all var(--bm-t-fast) var(--bm-ease);
}

.topbar-search input:focus {
    background: var(--bm-surface);
    border-color: var(--bm-primary);
    box-shadow: var(--bm-shadow-focus);
    outline: none;
}

.topbar-search::after {
    content: "⌕";
    position: absolute;
    inset-inline-end: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bm-text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    font-weight: 700;
}

/* ====== Breadcrumbs ====== */
.bm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--bm-text-muted);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.bm-breadcrumb a {
    color: var(--bm-text-muted);
    text-decoration: none;
    transition: color var(--bm-t-fast) var(--bm-ease);
}

.bm-breadcrumb a:hover {
    color: var(--bm-primary);
}

.bm-breadcrumb .bm-crumb-sep {
    color: var(--bm-text-muted);
    opacity: 0.5;
}

.bm-breadcrumb .bm-crumb-current {
    color: var(--bm-text);
    font-weight: 600;
}

/* ====== User menu ====== */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: 999px;
    background: var(--bm-surface-2);
    border: 1px solid var(--bm-border);
    cursor: pointer;
    transition: all var(--bm-t-fast) var(--bm-ease);
    text-decoration: none;
    color: var(--bm-text);
}

.user-chip:hover {
    background: var(--bm-primary-soft);
    border-color: var(--bm-primary);
    color: var(--bm-text);
}

.user-chip-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.user-chip-role {
    color: var(--bm-text-muted);
    font-size: 0.75rem;
}

.dropdown-menu {
    border-radius: var(--bm-radius);
    border: 1px solid var(--bm-border);
    box-shadow: var(--bm-shadow-lg);
    padding: 0.5rem;
    min-width: 220px;
}

.dropdown-item {
    border-radius: var(--bm-radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--bm-text);
    font-weight: 500;
    transition: all var(--bm-t-fast) var(--bm-ease);
}

.dropdown-item:hover {
    background: var(--bm-primary-soft);
    color: var(--bm-primary);
}

.dropdown-item.text-danger:hover {
    background: var(--bm-danger-soft);
    color: var(--bm-danger);
}

.dropdown-divider {
    border-color: var(--bm-border);
    margin: 0.4rem -0.5rem;
}

/* ====== Sticky table header (يظل ظاهراً عند التمرير) ====== */
.table-sticky-head thead th {
    position: sticky;
    top: 0;
    background: var(--bm-surface-2);
    z-index: 5;
}

/* ====== Smoother focus outline globally ====== */
:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ====== Print hint ====== */
.no-print {}
@media print {
    .no-print,
    .sidebar,
    .mobile-app-topbar,
    .mobile-bottom-nav,
    .topbar,
    .bm-breadcrumb {
        display: none !important;
    }
}

/* ====== Reduce motion عند الحاجة ====== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====== Language switcher ====== */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: var(--bm-surface-2, #f3f4f6);
    border: 1px solid var(--bm-border, #e5e7eb);
}

.lang-switcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--bm-text-muted, #6b7280);
    line-height: 1.2;
}

.lang-switcher-btn:hover {
    color: var(--bm-primary, #7c3aed);
    background: rgba(124, 58, 237, 0.08);
}

.lang-switcher-btn.active {
    background: var(--bm-primary, #7c3aed);
    color: #fff;
}

.lang-notice {
    font-size: 0.875rem;
}

html[dir="ltr"] body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[dir="ltr"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--bm-border, #e5e7eb);
}

html[dir="ltr"] .side-nav-caret {
    transform: rotate(180deg);
}

html[dir="ltr"] .stat-card[style*="border-left"] {
    border-left: none !important;
    border-right: 4px solid var(--bm-success, #10b981);
}

html[dir="ltr"] .dropdown-menu-end {
    --bs-position: start;
}

html[dir="ltr"] .topbar-search {
    margin-left: 0;
    margin-right: auto;
}

.login-lang-switch {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
}

/* ====================================================================
   Nazimly — Monochromatic theme
   ==================================================================== */

.sidebar {
    background: var(--bm-surface) !important;
    color: var(--bm-text) !important;
    border-inline-start: none;
    border-inline-end: 1px solid var(--bm-border);
    box-shadow: none;
}

.sidebar .brand-mark.brand-mark--embed {
    background: transparent;
    color: inherit;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.topbar-brand-block .brand-mark.brand-mark--embed {
    background: transparent;
    border: none;
    box-shadow: none;
}

.sidebar .brand-title {
    color: var(--bm-text);
    font-weight: 800;
    font-size: 1.05rem;
}

.sidebar .brand-subtitle {
    color: var(--bm-text-muted);
    opacity: 1;
    font-size: 0.78rem;
    font-weight: 500;
}

.sidebar .side-nav-grouped .side-nav-item,
.sidebar .side-nav-group > summary {
    color: var(--bm-text-soft);
    font-weight: 600;
}

.sidebar .side-nav-grouped .side-nav-item:hover,
.sidebar .side-nav-group > summary:hover {
    background: var(--bm-surface-2);
    color: var(--bm-text);
    transform: none;
}

.sidebar .side-nav-grouped .side-nav-item.active {
    background: transparent;
    color: var(--bm-text);
    box-shadow: none;
    font-weight: 800;
}

.sidebar .side-nav-group[open] > summary {
    background: var(--bm-surface-2);
    color: var(--bm-text);
}

.sidebar .side-nav-items {
    border-inline-start-color: var(--bm-border);
}

.sidebar .side-nav-items .side-nav-item {
    color: var(--bm-text-muted);
}

.sidebar .side-nav-items .side-nav-item.active {
    background: transparent;
    color: var(--bm-text);
    font-weight: 800;
}

.sidebar .side-nav-grouped .logout-link {
    background: #FEF2F2;
    color: #B91C1C;
}

.sidebar .side-nav-grouped .logout-link:hover {
    background: #FEE2E2;
    color: #991B1B;
}

.offcanvas .side-nav-grouped .side-nav-item.active {
    background: var(--bm-surface-2);
    color: var(--bm-text);
    box-shadow: none;
    font-weight: 800;
}

.topbar,
.mobile-app-topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bm-border);
    box-shadow: 0 1px 0 rgba(26, 29, 38, 0.04);
}

.login-body {
    background: var(--bm-bg);
}

.login-card {
    border-radius: var(--bm-radius-lg);
    border: 1px solid var(--bm-border);
    box-shadow: none;
}

.login-card h1 {
    color: var(--bm-text);
}

.page-title::after {
    width: 32px;
    height: 2px;
    background: var(--bm-text);
    margin-top: 10px;
}

.card-soft,
.stat-card {
    border: 1px solid var(--bm-border);
    box-shadow: none;
    background: var(--bm-surface);
}

.card-soft:hover,
.stat-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--bm-border-strong);
}

.dashboard-hero-card {
    border: 1px solid var(--bm-border) !important;
    border-width: 1px !important;
    background: var(--bm-surface);
}

.stat-card.kpi-tint-blue,
.stat-card.kpi-tint-lavender,
.stat-card.kpi-tint-sand {
    background: var(--bm-surface-2);
    border-color: var(--bm-border);
}

.stat-card.kpi-tint-mint,
.stat-card.kpi-tint-danger,
.stat-card.kpi-tint-blue,
.stat-card.kpi-tint-lavender,
.stat-card.kpi-tint-sand {
    background: #ffffff;
    border: 1px solid #000000;
    border-inline-start: 4px solid #000000;
}

.dashboard-mini-card {
    min-height: 108px;
    border: 1px solid var(--bm-border);
}

.dashboard-mini-card .dashboard-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--bm-radius-sm);
    background: var(--bm-surface-2);
    color: var(--bm-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.empty-state {
    padding: 3rem 1.75rem;
    margin: 0.75rem 1rem 1.25rem;
    background: linear-gradient(180deg, var(--bm-surface) 0%, var(--bm-surface-2) 100%);
    border: 1px dashed var(--bm-border);
    border-radius: var(--bm-radius-lg);
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bm-surface-2);
    color: var(--bm-text);
    font-size: 1.75rem;
    box-shadow: none;
    border: 1px solid var(--bm-border);
}

.empty-state .btn {
    min-width: 10rem;
}

.empty-state.py-4 {
    padding-block: 2rem;
    margin: 0.5rem;
}

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

.table-hover > tbody > tr:hover {
    background: var(--bm-surface-2);
}

.stat-card.kpi-mobile-row .kpi-icon {
    display: none;
}

@media (max-width: 768px) {
    .stat-card.kpi-mobile-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-height: auto;
        padding: 1rem 1.15rem;
    }

    .stat-card.kpi-mobile-row .kpi-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.65);
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        flex-shrink: 0;
    }

    .stat-card.kpi-mobile-row .kpi-body {
        flex: 1;
        text-align: end;
    }

    .stat-card.kpi-mobile-row h3 {
        font-size: 1.35rem;
        margin: 0.15rem 0 0;
    }

    .stat-card.kpi-mobile-row .text-muted,
    .stat-card.kpi-mobile-row .text-muted-custom {
        margin-bottom: 0;
        font-size: 0.82rem;
    }

    .page-title {
        font-size: 1.45rem;
    }

    .content-wrapper {
        padding-inline: 0.85rem;
    }

    .d-grid.d-md-flex .btn,
    .d-flex.gap-2.flex-wrap .btn {
        width: auto;
    }
}

.form-control,
.form-select {
    border-radius: var(--bm-radius-sm);
    border-color: var(--bm-border);
    padding: 0.55rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bm-primary);
    border-width: 2px;
    box-shadow: none;
}

.mobile-menu-btn span {
    background: var(--bm-text);
}

.mobile-user-chip {
    background: var(--bm-surface-2);
    color: var(--bm-text);
    font-weight: 700;
    border: 1px solid var(--bm-border);
}

.health-check-card {
    border-inline-start-width: 4px;
    border-inline-start-style: solid;
}

.health-check-card.health-check-success {
    border-inline-start-color: var(--bm-success);
    background: linear-gradient(135deg, var(--bm-surface) 70%, var(--bm-success-soft));
}

.health-check-card.health-check-warning {
    border-inline-start-color: var(--bm-warning);
    background: linear-gradient(135deg, var(--bm-surface) 70%, var(--bm-warning-soft));
}

.health-check-card.health-check-error {
    border-inline-start-color: var(--bm-danger);
    background: linear-gradient(135deg, var(--bm-surface) 70%, var(--bm-danger-soft));
}

/* ====================================================================
   PWA — bottom navigation (mobile)
   ==================================================================== */

.mobile-bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1035;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.15rem;
    padding: 0.4rem 0.35rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--bm-border);
    box-shadow: 0 -8px 28px rgba(26, 29, 38, 0.08);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: var(--bm-touch);
    max-width: 5.5rem;
    padding: 0.35rem 0.25rem;
    border: none;
    border-radius: var(--bm-radius-sm);
    background: transparent;
    color: var(--bm-text-muted);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    transition: background var(--bm-t-fast) var(--bm-ease), color var(--bm-t-fast) var(--bm-ease);
}

.mobile-nav-item:hover,
.mobile-nav-item:focus-visible {
    color: var(--bm-primary-strong);
    background: var(--bm-primary-soft);
}

.mobile-nav-item.active {
    color: var(--bm-primary-strong);
    background: var(--bm-primary-soft);
}

.mobile-nav-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.mobile-nav-menu {
    cursor: pointer;
}

/* ====================================================================
   Mobile-first touch — default sizes, desktop refinements at 992px+
   ==================================================================== */

.btn,
.btn-accent,
.btn-dark,
.btn-success,
.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark {
    min-height: var(--bm-touch);
    padding: 0.7rem 1.15rem;
    font-size: 0.95rem;
}

.btn-sm {
    min-height: var(--bm-touch-sm);
    padding: 0.55rem 0.9rem;
    font-size: 0.88rem;
}

.btn-lg {
    min-height: 52px;
    padding: 0.85rem 1.35rem;
    font-size: 1.05rem;
}

.filter-chip {
    min-height: var(--bm-touch-sm);
    padding: 0.5rem 0.95rem;
    display: inline-flex;
    align-items: center;
}

.mobile-menu-btn {
    min-width: var(--bm-touch);
    min-height: var(--bm-touch);
}

@media (min-width: 992px) {
    .btn,
    .btn-accent,
    .btn-dark,
    .btn-success,
    .btn-secondary,
    .btn-outline-primary,
    .btn-outline-secondary,
    .btn-outline-dark {
        min-height: 42px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.75rem;
        font-size: 0.82rem;
    }

    .btn-lg {
        min-height: 46px;
        font-size: 1rem;
    }

    .filter-chip {
        min-height: auto;
        padding: 0.4rem 0.85rem;
    }
}

/* ====================================================================
   Mobile — tables, forms, filters, action bars
   ==================================================================== */

@media (max-width: 991.98px) {
    .content-wrapper {
        padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    .scroll-top-btn {
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .table-responsive.is-scrollable {
        box-shadow: inset -12px 0 12px -12px rgba(26, 29, 38, 0.06);
    }

    html[dir="rtl"] .table-responsive.is-scrollable {
        box-shadow: inset 12px 0 12px -12px rgba(26, 29, 38, 0.06);
    }

    .mobile-table-hint {
        display: block;
        background: var(--bm-primary-soft);
        color: var(--bm-primary-strong);
        border: 1px solid rgba(76, 110, 245, 0.15);
        border-radius: var(--bm-radius-sm);
        padding: 0.65rem 0.85rem;
        font-size: 0.82rem;
        font-weight: 600;
        margin-bottom: 0.65rem;
        text-align: center;
    }

    .table-sticky-head thead th {
        background: var(--bm-surface);
        box-shadow: 0 1px 0 var(--bm-border);
    }

    .table > tbody > tr.row-clickable > td {
        padding-block: 1rem;
    }

    .table .d-flex.gap-1:not(.bm-row-actions),
    .table .d-flex.gap-2:not(.bm-row-actions) {
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }

    .table .bm-row-actions {
        justify-content: flex-start;
    }

    .table .btn,
    .table .btn-sm {
        width: auto;
        min-height: 38px;
        padding-inline: 0.65rem;
    }

    .table .bm-row-actions .btn,
    .table .bm-row-actions .btn-sm {
        min-height: 2rem;
        min-width: 4.75rem;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.85rem 1rem;
    }

    .action-bar-label {
        width: 100%;
        margin-inline-end: 0;
        margin-bottom: 0.15rem;
    }

    .action-bar .btn,
    .action-bar a.btn,
    .action-bar-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .filter-chips:not(.filter-chips--uniform) {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        gap: 0.45rem;
        padding-bottom: 0.35rem;
        scrollbar-width: none;
    }

    .filter-chips:not(.filter-chips--uniform)::-webkit-scrollbar {
        display: none;
    }

    .filter-chips:not(.filter-chips--uniform) .filter-chip {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .filter-chips--uniform {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bm-filter-matrix__row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .bm-filter-matrix__label {
        justify-content: flex-start;
        text-align: start;
        padding-inline-end: 0;
        padding-bottom: 0.1rem;
    }

    .bm-filter-matrix__track {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bm-filter-matrix__track .filter-chip {
        font-size: 0.78rem;
        min-height: 2.85rem;
    }

    .filter-chip--pad {
        display: none;
    }
}

@media (min-width: 480px) and (max-width: 767.98px) {
    .filter-chips--uniform {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bm-filter-matrix__track {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .filter-chips--uniform {
        grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
    }
}

@media (min-width: 992px) {
    .bm-filter-matrix__track {
        grid-template-columns: repeat(var(--bm-filter-cols), minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .form-control,
    .form-select,
    input.form-control[type="date"],
    input.form-control[type="tel"],
    input.form-control[type="email"],
    input.form-control[type="number"],
    input.form-control[type="search"] {
        min-height: 48px;
        font-size: 16px;
    }

    textarea.form-control {
        min-height: 110px;
        font-size: 16px;
    }

    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.4rem;
    }

    .form-text {
        font-size: 0.8rem;
    }

    .card-soft .card-body {
        padding: 1.15rem;
    }

    .detail-section-title {
        font-size: 1.05rem;
        margin-bottom: 1rem;
    }

    .d-flex.flex-column.flex-md-row.justify-content-between > .d-grid,
    .d-flex.flex-column.flex-md-row.justify-content-between > .d-grid.d-md-flex,
    .page-header-actions {
        width: 100%;
    }

    .d-flex.flex-column.flex-md-row.justify-content-between > .d-grid .btn,
    .d-flex.flex-column.flex-md-row.justify-content-between > .d-grid.d-md-flex .btn,
    .page-header-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    form.row.g-2 .col-12 .btn,
    form.row.g-2 .col-12.d-flex .btn,
    .card-soft .card-body.py-3.d-flex.justify-content-end {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem !important;
    }

    form.row.g-2 .col-12 .btn,
    form.row.g-2 .col-12.d-flex .btn,
    .card-soft .card-body.py-3.d-flex.justify-content-end .btn {
        width: 100%;
        min-height: 48px;
        margin: 0 !important;
    }

    .card-soft[style*="position: sticky"] {
        position: sticky !important;
        bottom: 0 !important;
        margin-top: 1rem;
        z-index: 20;
        border-radius: var(--bm-radius-lg) var(--bm-radius-lg) 0 0;
        box-shadow: 0 -10px 28px rgba(26, 29, 38, 0.1);
    }

    .main-content {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .permission-check {
        padding: 0.85rem 0;
    }

    .permission-check input {
        width: 22px;
        height: 22px;
        margin-top: 2px;
    }

    .input-group .btn {
        width: auto;
        min-height: 48px;
    }

    .btn-group .btn {
        width: auto;
    }

    .dropdown-menu .dropdown-item {
        padding: 0.65rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ====================================================================
   Nazimly — روابط، أزرار شبحية، وتفاصيل نهائية
   ==================================================================== */

a:not(.btn):not(.btn-sm):not(.btn-lg):not(.nav-link):not(.dropdown-item):not(.filter-chip):not(.mobile-nav-item):not(.page-link):not(.side-nav-item) {
    color: var(--bm-link);
    text-decoration: none;
    font-weight: 500;
}

a:not(.btn):hover {
    color: #4f46e5;
    text-decoration: underline;
}

.btn-link,
.btn-ghost {
    color: var(--bm-link);
    background: transparent;
    border: none;
    font-weight: 600;
}

.btn-dark,
.btn-accent {
    background: #111111 !important;
    border: 1px solid #111111 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.btn-dark:hover,
.btn-accent:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
}

.btn-secondary {
    background: #ffffff !important;
    border: 1px solid #111111 !important;
    color: #111111 !important;
}

.btn-secondary:hover {
    background: var(--bm-surface-2) !important;
    color: #111111 !important;
}

.scroll-top-btn {
    background: #111111 !important;
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.2) !important;
}

.avatar-initial {
    background: #111111 !important;
    color: #ffffff !important;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus-visible {
    color: var(--bm-text);
    background: var(--bm-surface-2);
}

.mobile-nav-item.active {
    color: var(--bm-text);
    background: var(--bm-surface-2);
    font-weight: 800;
}

.mobile-table-hint {
    background: var(--bm-surface-2);
    color: var(--bm-text-soft);
    border-color: var(--bm-border);
}

:focus-visible {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

.dropdown-item:hover {
    background: var(--bm-surface-2);
    color: var(--bm-text);
}

.row + .row,
.card + .row {
    margin-top: var(--bm-space-2);
}

.mb-4 {
    margin-bottom: var(--bm-space-3) !important;
}

.mb-3 {
    margin-bottom: var(--bm-space-2) !important;
}

/* فترة لوحة التحكم — القائمة الجانبية */
.side-dashboard-period > summary {
    font-size: 0.9rem;
}

.side-period-panel {
    padding: 0.5rem 0.75rem 0.75rem !important;
}

.side-period-chips {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.side-period-chip {
    display: block;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius-sm);
    font-size: 0.8125rem;
    color: var(--bm-text);
    text-decoration: none;
    transition: background var(--bm-t-fast) var(--bm-ease);
}

.side-period-chip:hover {
    background: var(--bm-surface-2);
    color: var(--bm-text);
}

.side-period-chip.active {
    background: var(--bm-primary);
    border-color: var(--bm-primary);
    color: #fff;
    font-weight: 700;
}

.side-period-form .form-control {
    font-size: 0.8125rem;
}

.side-period-hint {
    line-height: 1.35;
}

.offcanvas .side-period-chip {
    min-height: var(--bm-touch-sm);
    display: flex;
    align-items: center;
}

/* ====================================================================
   لوحة التحكم — عرض مضغوط بدون تمرير طويل (موبايل)
   ==================================================================== */

@media (max-width: 991.98px) {
    body.page-dashboard {
        font-size: 0.9rem;
    }

    body.page-dashboard .mobile-brand-bar {
        display: none !important;
    }

    body.page-dashboard .content-wrapper {
        padding-top: 0.5rem !important;
        padding-inline: 0.65rem !important;
    }

    body.page-dashboard .dashboard-mobile-tabs {
        display: flex;
        gap: 0.35rem;
        margin-bottom: 0.65rem;
        padding: 0.25rem;
        background: var(--bm-surface-2);
        border: 1px solid var(--bm-border);
        border-radius: var(--bm-radius);
        position: sticky;
        top: 0;
        z-index: 20;
    }

    body.page-dashboard .dashboard-tab {
        flex: 1;
        border: none;
        border-radius: var(--bm-radius-sm);
        background: transparent;
        color: var(--bm-text-soft);
        font-family: inherit;
        font-size: 0.78rem;
        font-weight: 700;
        min-height: 2.25rem;
        padding: 0.35rem 0.4rem;
        transition: background var(--bm-t-fast) var(--bm-ease), color var(--bm-t-fast) var(--bm-ease);
    }

    body.page-dashboard .dashboard-tab.is-active {
        background: var(--bm-primary);
        color: #fff;
    }

    body.page-dashboard .dashboard-section:not(.is-active) {
        display: none !important;
    }

    body.page-dashboard .dashboard-section.is-active {
        display: block;
        max-height: calc(
            100dvh - 7.25rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
        );
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.page-dashboard .dashboard-hero-title {
        font-size: 1rem;
    }

    body.page-dashboard .dashboard-hero-actions .btn-sm {
        min-height: 2rem;
        padding: 0.3rem 0.55rem;
        font-size: 0.72rem;
    }

    body.page-dashboard .dashboard-today-kpis .stat-card.kpi-mobile-row {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.25rem;
        padding: 0.45rem 0.35rem !important;
    }

    body.page-dashboard .dashboard-today-kpis .kpi-icon {
        width: 1.75rem !important;
        height: 1.75rem !important;
        font-size: 0.85rem !important;
        margin-inline: auto;
    }

    body.page-dashboard .dashboard-today-kpis .kpi-body {
        text-align: center;
    }

    body.page-dashboard .dashboard-today-kpis h3 {
        font-size: 0.95rem !important;
        line-height: 1.15;
    }

    body.page-dashboard .dashboard-today-kpis .text-muted,
    body.page-dashboard .dashboard-today-kpis small {
        font-size: 0.65rem !important;
        line-height: 1.2;
    }

    body.page-dashboard .dashboard-mini-card {
        min-height: 4.5rem;
    }

    body.page-dashboard .dashboard-mini-card h3 {
        font-size: 1.05rem;
        margin-bottom: 0;
    }

    body.page-dashboard .dashboard-mini-card .dashboard-icon {
        width: 1.65rem;
        height: 1.65rem;
        font-size: 0.62rem;
        margin-bottom: 0.25rem;
    }

    body.page-dashboard .dashboard-mini-card .text-muted {
        font-size: 0.68rem;
    }

    body.page-dashboard [data-dashboard-pane="finance"] .stat-card.kpi-mobile-row {
        padding: 0.55rem 0.65rem !important;
        gap: 0.5rem;
    }

    body.page-dashboard [data-dashboard-pane="finance"] .stat-card.kpi-mobile-row .kpi-icon {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 0.9rem !important;
    }

    body.page-dashboard [data-dashboard-pane="finance"] .stat-card.kpi-mobile-row h3 {
        font-size: 0.92rem !important;
    }

    body.page-dashboard [data-dashboard-pane="finance"] .stat-card small {
        display: none;
    }

    body.page-dashboard [data-dashboard-pane="details"] .card-body {
        padding: 0.85rem !important;
    }

    body.page-dashboard [data-dashboard-pane="details"] h5 {
        font-size: 0.95rem;
        margin-bottom: 0.65rem !important;
    }

    body.page-dashboard [data-dashboard-pane="details"] .alert {
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
        margin-bottom: 0.5rem;
    }

    body.page-dashboard [data-dashboard-pane="details"] .table {
        font-size: 0.8rem;
    }

    body.page-dashboard [data-dashboard-pane="details"] .table th,
    body.page-dashboard [data-dashboard-pane="details"] .table td {
        padding: 0.4rem 0.35rem;
    }

    body.page-dashboard .dashboard-status-line {
        padding: 0.45rem 0;
        font-size: 0.82rem;
    }
}

@media (min-width: 992px) {
    body.page-dashboard .dashboard-mobile-tabs {
        display: none !important;
    }

    body.page-dashboard .dashboard-section,
    body.page-dashboard .dashboard-section[hidden],
    body.page-dashboard .dashboard-section:not(.is-active) {
        display: block !important;
    }

    body.page-dashboard .dashboard-section {
        max-height: none !important;
        overflow: visible !important;
    }
}

