@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
    --brand-900: #12344d;
    --brand-700: #1f5f8b;
    --brand-500: #2f86c3;
    --brand-100: #dceefa;
    --sand-100: #f6f1e8;
    --accent-500: #dd6b20;
    --success-500: #0f766e;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --border: rgba(18, 52, 77, 0.12);
    --shadow: 0 20px 60px rgba(16, 42, 67, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

body {
    min-height: 100vh;
    margin: 0;
    color: #102a43;
    background: linear-gradient(135deg, #f4f7fb 0%, #e6eef5 55%, #f8efe1 100%);
    font-family: 'Cairo', 'IBM Plex Sans', sans-serif;
}

html[dir='ltr'] body {
    font-family: 'IBM Plex Sans', 'Cairo', sans-serif;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(47, 134, 195, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(221, 107, 32, 0.13), transparent 26%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(18px);
}

.guest-site-header {
    position: static;
    backdrop-filter: none;
}

.guest-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 2.5rem;
}

.hero-shell,
.nav-shell,
.content-shell,
.panel-card,
.stat-card,
.mini-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.hero-shell {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
    gap: 2rem;
    align-items: center;
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(18, 52, 77, 0.94), rgba(31, 95, 139, 0.92));
    color: #f8fbff;
}

.hero-brand {
    display: grid;
    gap: 0.45rem;
    justify-items: start;
    align-content: center;
    align-self: center;
}

.hero-actions {
    justify-self: end;
    align-self: center;
}

.hero-ribbon {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    background: rgba(111, 177, 224, 0.14);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.1;
}

.hero-ribbon-ar {
    direction: rtl;
    letter-spacing: 0;
    justify-self: start;
    font-size: 0.9rem;
    text-transform: none;
}

.hero-brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.15rem;
    padding: 0.35rem 0.7rem;
    background: rgba(111, 177, 224, 0.22);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}

.hero-main-title {
    text-align: center;
    font-size: clamp(1.75rem, 3vw, 2.65rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #ffffff;
}

.hero-main-block {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.9rem;
    text-align: center;
    justify-self: center;
    align-self: stretch;
    min-height: 5.4rem;
    padding-top: 0.15rem;
    padding-bottom: 0.1rem;
}

.hero-main-copyright {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    align-self: center;
}

.hero-title {
    font-size: clamp(1.85rem, 3vw, 2.7rem);
    font-weight: 700;
}

.user-chip {
    display: grid;
    gap: 0.15rem;
    min-width: 14rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}

.user-chip-label,
.user-chip-role {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
}

.lang-switch {
    gap: 0.35rem;
}

.nav-shell {
    padding: 0.95rem 1.1rem;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(24, 56, 82, 0.9), rgba(54, 86, 112, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: visible;
}

.nav-shell-track {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
    flex-wrap: wrap;
    overflow: visible;
}

.nav-shell-track::-webkit-scrollbar {
    height: 6px;
}

.nav-shell-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.nav-group {
    flex: 0 0 auto;
}

.nav-link {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.84);
    border-radius: 16px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-link-icon,
.nav-dropdown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.nav-link-icon {
    margin-inline-end: 0.55rem;
    font-size: 1rem;
    opacity: 0.92;
}

.nav-group-toggle {
    gap: 0.65rem;
    cursor: pointer;
}

.nav-link-caret {
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.08rem) rotate(45deg);
    opacity: 0.82;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-group-toggle[aria-expanded='true'] .nav-link-caret {
    transform: translateY(0.1rem) rotate(225deg);
    opacity: 1;
}

.nav-link::after {
    content: '';
    position: absolute;
    inset-inline: 0.95rem;
    inset-block-end: 0.42rem;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f7fbff, rgba(221, 107, 32, 0.95));
    opacity: 0;
    transform: scaleX(0.25);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.nav-link:hover::after,
.nav-link:focus::after,
.nav-link.active::after {
    opacity: 1;
    transform: scaleX(1);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(47, 134, 195, 0.28), rgba(31, 95, 139, 0.18));
    border-color: rgba(144, 205, 244, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(5, 23, 41, 0.18);
}

.nav-dropdown-menu {
    min-width: 16rem;
    margin-top: 0.55rem;
    padding: 0.5rem;
    border: 1px solid rgba(18, 52, 77, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(16, 42, 67, 0.22);
    z-index: 1080;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.8rem;
    border-radius: 14px;
    color: #12344d;
    font-weight: 600;
}

.nav-dropdown-icon {
    width: 1rem;
    color: #1f5f8b;
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus {
    color: #12344d;
    background: rgba(47, 134, 195, 0.1);
}

.nav-dropdown-item.active,
.nav-dropdown-item:active {
    color: #12344d;
    background: linear-gradient(180deg, rgba(47, 134, 195, 0.16), rgba(31, 95, 139, 0.08));
}

.logout-form {
    margin: 0;
}

.nav-logout-form {
    flex: 0 0 auto;
    margin-inline-start: auto;
    padding-inline-start: 0.85rem;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-logout-button {
    min-width: 8.5rem;
    min-height: 2.85rem;
    border-radius: 14px;
    border-color: rgba(255, 255, 255, 0.38);
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav-logout-button:hover,
.nav-logout-button:focus {
    color: #102a43;
    border-color: #fff;
    background: #fff;
}

.content-shell {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    background: var(--surface);
    backdrop-filter: blur(12px);
}

.guest-shell {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-inline: 0;
    margin-top: 0.5rem;
}

.panel-card {
    height: 100%;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
}

.panel-card-accent {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 246, 252, 0.96));
}

.panel-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--brand-100);
    color: var(--brand-900);
    font-size: 0.83rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.panel-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.metric-badge {
    display: inline-grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    border-radius: 1.2rem;
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    color: #fff;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    padding: 1.3rem 1.4rem;
    border-radius: var(--radius-lg);
    color: #fff;
}

.stat-card-primary {
    background: linear-gradient(135deg, #144c73, #2677ad);
}

.stat-card-secondary {
    background: linear-gradient(135deg, #0f766e, #1f9d8a);
}

.stat-card-tertiary {
    background: linear-gradient(135deg, #a64b00, #dd6b20);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.76);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    display: block;
    margin-top: 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    line-height: 1.05;
}

.stat-card .text-secondary,
.stat-card small,
.stat-card .small {
    display: inline-block;
    margin-top: 0.85rem;
    padding: 0.24rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #fff3bf !important;
    font-weight: 600;
    opacity: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    line-height: 1.35;
}

.stat-note-highlight {
    display: inline-block;
    margin-top: 0.85rem;
    padding: 0.24rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #fff3bf !important;
    font-weight: 600;
    opacity: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    line-height: 1.35;
}

.mini-card {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: #f8fbfe;
}

.deposit-source-breakdown-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 0.9rem;
    min-width: 0;
}

.deposit-source-breakdown-text {
    min-width: 0;
}

.deposit-source-breakdown-text .fw-semibold {
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.deposit-source-breakdown-amount {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: end;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(18, 52, 77, 0.18);
    color: #52606d;
    background: #f9fbfd;
}

.compact-empty {
    min-height: 120px;
}

.btn-brand {
    color: #fff;
    border-color: var(--brand-700);
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    border-color: var(--brand-900);
    background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
}

.btn-outline-brand {
    color: var(--brand-700);
    border-color: rgba(31, 95, 139, 0.22);
    background: rgba(31, 95, 139, 0.04);
}

.btn-outline-brand:hover,
.btn-outline-brand:focus {
    color: #fff;
    background: var(--brand-700);
    border-color: var(--brand-700);
}

.reconciliation-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
    border: 1px solid transparent;
    text-align: center;
    white-space: nowrap;
}

.reconciliation-status-badge-balanced,
.reconciliation-followup-badge-resolved {
    color: #0f5132;
    background: rgba(15, 118, 110, 0.12);
    border-color: rgba(15, 118, 110, 0.22);
}

.reconciliation-status-badge-shortage {
    color: #9a3412;
    background: rgba(221, 107, 32, 0.14);
    border-color: rgba(221, 107, 32, 0.24);
}

.reconciliation-status-badge-surplus {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.24);
}

.reconciliation-followup-badge-in_progress {
    color: #1d4ed8;
    background: rgba(47, 134, 195, 0.14);
    border-color: rgba(47, 134, 195, 0.24);
}

.reconciliation-followup-badge-not_required {
    color: #52606d;
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.24);
}

.reconciliation-variance-negative,
.reconciliation-variance-positive,
.reconciliation-variance-balanced {
    display: inline-block;
    font-weight: 700;
}

.reconciliation-variance-negative {
    color: #b45309;
}

.reconciliation-variance-positive {
    color: #0369a1;
}

.reconciliation-variance-balanced {
    color: #0f766e;
}

.cash-status-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1rem;
}

.cash-alert-list {
    display: grid;
    gap: 0.85rem;
}

.cash-alert-item {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(18, 52, 77, 0.12);
    background: #f8fbfe;
}

.cash-alert-item-danger {
    background: rgba(185, 28, 28, 0.08);
    border-color: rgba(185, 28, 28, 0.2);
}

.cash-alert-item-warning {
    background: rgba(180, 83, 9, 0.08);
    border-color: rgba(180, 83, 9, 0.2);
}

.cash-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.cash-status-badge-normal {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
    border: 1px solid rgba(15, 118, 110, 0.18);
}

.cash-status-badge-warning {
    background: rgba(180, 83, 9, 0.12);
    color: #9a3412;
    border: 1px solid rgba(180, 83, 9, 0.18);
}

.cash-status-badge-critical {
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.18);
}

.cash-progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(18, 52, 77, 0.08);
}

.cash-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-500), var(--success-500));
}

.cash-progress-bar-warning {
    background: linear-gradient(90deg, #dd6b20, #f59e0b);
}

.cash-progress-bar-critical {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.cash-status-table td,
.cash-status-table th {
    vertical-align: middle;
}

@media (max-width: 992px) {
    .cash-status-grid {
        grid-template-columns: 1fr;
    }
}

.form-control,
.form-select {
    min-height: 3rem;
    border-radius: 14px;
    border-color: rgba(18, 52, 77, 0.12);
}

.flatpickr-calendar {
    z-index: 2000;
    box-shadow: 0 18px 40px rgba(16, 42, 67, 0.18);
}

.flatpickr-input.form-control[readonly] {
    background-color: #fff;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #486581;
    background: rgba(220, 238, 250, 0.48);
    border-bottom-width: 1px;
}

.table tbody td {
    border-color: rgba(18, 52, 77, 0.08);
}

.pagination .page-link {
    border-radius: 12px;
    margin-inline: 0.15rem;
    border: 0;
    color: var(--brand-700);
    background: rgba(31, 95, 139, 0.08);
    min-width: 2.5rem;
    text-align: center;
}

.pagination {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

.pagination .page-item.active .page-link {
    background: var(--brand-700);
}

.pagination .page-item.disabled .page-link {
    color: #7b8794;
    background: rgba(148, 163, 184, 0.16);
}

pre.audit-json {
    margin: 0;
    padding: 0.85rem;
    border-radius: 14px;
    background: #0f172a;
    color: #dbeafe;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-shell {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .hero-brand,
    .hero-main-block,
    .hero-actions {
        justify-self: center;
        text-align: center;
    }

    .hero-brand {
        justify-items: center;
        align-self: stretch;
    }

    .hero-actions,
    .hero-main-block {
        align-self: stretch;
    }

    .hero-ribbon-ar {
        justify-self: center;
    }

    .dashboard-grid,
    .compact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .content-shell {
        padding: 1rem;
    }

    .panel-card,
    .hero-shell,
    .nav-shell {
        padding: 1rem;
    }

    .nav-shell-track,
    .main-nav {
        gap: 0.45rem;
    }

    .nav-logout-form {
        margin-inline-start: 0;
        padding-inline-start: 0;
        border-inline-start: 0;
    }

    .nav-link {
        min-height: 2.7rem;
        padding: 0.65rem 0.85rem;
        font-size: 0.92rem;
    }

    .nav-logout-button {
        min-width: 7.75rem;
    }

    .nav-logout-form {
        padding-inline-start: 0.65rem;
    }
}