/* ============================================================
   SHA SARAF / Financial Office Reference UI 2026
   Clean, compact RTL-first interface inspired by the provided
   reference screens. Loaded after style.css as a safe override.
   ============================================================ */

:root {
    --ref-sidebar-width: 292px;
    --ref-sidebar-collapsed: 76px;
    --ref-header-height: 72px;
    --ref-page-max: 1920px;
    --ref-bg: #f1f5f9;
    --ref-surface: #ffffff;
    --ref-surface-soft: #f8fafc;
    --ref-input: #f5f8fc;
    --ref-border: #dfe6ef;
    --ref-border-soft: #edf1f6;
    --ref-text: #132238;
    --ref-muted: #75849a;
    --ref-blue: #2f6fea;
    --ref-blue-deep: #2359ca;
    --ref-blue-soft: #eaf1ff;
    --ref-green: #08a678;
    --ref-green-soft: #e9f9f3;
    --ref-red: #ed3434;
    --ref-red-soft: #fff0f0;
    --ref-orange: #e98900;
    --ref-orange-soft: #fff5df;
    --ref-purple: #6e5ce7;
    --ref-shadow: 0 8px 24px rgba(31, 45, 61, .07);
    --ref-shadow-sm: 0 3px 12px rgba(31, 45, 61, .06);
    --ref-radius: 13px;
    --ref-radius-sm: 9px;
}

[data-bs-theme="light"] {
    --bg-main: var(--ref-bg);
    --bg-card: var(--ref-surface);
    --bg-sidebar: var(--ref-surface);
    --bg-elevated: var(--ref-surface-soft);
    --text-primary: var(--ref-text);
    --text-secondary: var(--ref-muted);
    --border-color: var(--ref-border);
    --bg-active: var(--ref-blue-soft);
    --header-glass: rgba(255, 255, 255, .97);
}

[data-bs-theme="dark"] {
    --ref-bg: #0c1524;
    --ref-surface: #121f32;
    --ref-surface-soft: #17263b;
    --ref-input: #14243a;
    --ref-border: rgba(255, 255, 255, .11);
    --ref-border-soft: rgba(255, 255, 255, .075);
    --ref-text: #f2f6fc;
    --ref-muted: #aebbd0;
    --ref-blue-soft: rgba(47, 111, 234, .20);
    --ref-green-soft: rgba(8, 166, 120, .16);
    --ref-red-soft: rgba(237, 52, 52, .16);
    --ref-orange-soft: rgba(233, 137, 0, .17);
    --bg-main: var(--ref-bg);
    --bg-card: var(--ref-surface);
    --bg-sidebar: var(--ref-surface);
    --bg-elevated: var(--ref-surface-soft);
    --text-primary: var(--ref-text);
    --text-secondary: var(--ref-muted);
    --border-color: var(--ref-border);
    --bg-active: var(--ref-blue-soft);
    --header-glass: rgba(18, 31, 50, .98);
}

/* ---------- Base ---------- */
html, body { min-height: 100%; }
body {
    background: var(--ref-bg) !important;
    color: var(--ref-text);
    font-size: 13px;
    line-height: 1.7;
}
body::before { display: none !important; }
body.rtl { direction: rtl; }
body.ltr { direction: ltr; }
.app-wrapper { min-height: 100vh; align-items: stretch; }
.rtl .app-wrapper { flex-direction: row-reverse; }
.ltr .app-wrapper { flex-direction: row; }
.main-content { min-width: 0; background: var(--ref-bg); padding-bottom: 0; }
main.container-fluid {
    width: 100%;
    max-width: var(--ref-page-max);
    padding: 1.15rem 1.25rem 2rem !important;
    margin-inline: auto;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
    width: var(--ref-sidebar-width) !important;
    flex: 0 0 var(--ref-sidebar-width) !important;
    height: 100vh;
    position: sticky;
    inset-block-start: 0;
    background: var(--ref-surface) !important;
    border-color: var(--ref-border) !important;
    box-shadow: none !important;
    isolation: isolate;
    overflow: hidden;
    z-index: 1050;
}
.app-sidebar::before { display: none !important; }
.app-sidebar.collapsed {
    width: var(--ref-sidebar-collapsed) !important;
    flex-basis: var(--ref-sidebar-collapsed) !important;
}
.sidebar-brand {
    height: var(--ref-header-height);
    padding: 0 .88rem;
    border-bottom: 1px solid var(--ref-border-soft);
    background: var(--ref-surface);
}
.sidebar-brand .brand-link { width: 100%; min-width: 0; }
.sidebar-brand .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ref-blue);
    background: var(--ref-blue-soft);
    border: 1px solid rgba(47, 111, 234, .18);
    font-size: 16px;
}
.sidebar-brand .brand-copy { min-width: 0; }
.sidebar-brand .brand-title {
    display: block;
    color: var(--ref-text);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-brand .brand-subtitle {
    display: block;
    margin-top: 1px;
    color: var(--ref-muted);
    font-size: 9px;
    font-weight: 700;
}
.sidebar-menu {
    padding: .45rem .45rem 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar-section-label {
    list-style: none;
    margin: .52rem .4rem .18rem;
    padding: .35rem .22rem .1rem;
    color: #9aa8ba;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    opacity: 1;
}
.sidebar-item a {
    position: relative;
    min-height: 39px;
    margin-bottom: 2px;
    padding: .48rem .68rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #43536a;
    font-size: 11px;
    font-weight: 700;
    gap: .52rem;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
[data-bs-theme="dark"] .sidebar-item a { color: #b5c1d2; }
.sidebar-item a i {
    width: 18px;
    min-width: 18px;
    margin: 0 !important;
    color: inherit;
    font-size: 13px;
    text-align: center;
    transition: none;
}
.sidebar-item a:hover,
.sidebar-item.active a {
    transform: none !important;
    color: var(--ref-blue);
    background: var(--ref-blue-soft);
    border-color: transparent;
    box-shadow: none;
}
.sidebar-item.active a::after {
    content: "";
    position: absolute;
    inset-block: 7px;
    inset-inline-end: -1px;
    width: 3px;
    border-radius: 3px;
    background: var(--ref-blue);
}
.sidebar-item a:hover i { transform: none !important; }
.app-sidebar.collapsed .sidebar-section-label { border-top: 1px solid var(--ref-border-soft); margin-top: .55rem; }
.app-sidebar.collapsed .sidebar-section-label span,
.app-sidebar.collapsed .brand-copy,
.app-sidebar.collapsed .sidebar-item span { display: none; }
.app-sidebar.collapsed .sidebar-item a { justify-content: center; padding-inline: .4rem; }

/* ---------- Top header ---------- */
.app-header {
    min-height: var(--ref-header-height);
    height: var(--ref-header-height);
    padding: .58rem 1.18rem;
    border-bottom: 1px solid var(--ref-border);
    background: var(--ref-surface) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(180px, auto) minmax(230px, 1fr);
    gap: .8rem;
    align-items: center;
}
.app-header .header-start { justify-self: start; min-width: 0; }
.app-header .header-center { justify-self: center; min-width: 0; }
.app-header .header-end { justify-self: end; min-width: 0; }
    /* Removed manual RTL overrides to allow start/end grid elements to align naturally with the right-sided sidebar */
.header-shop-name {
    max-width: 390px;
    margin: 0;
    color: var(--ref-text);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.global-search {
    position: relative;
    width: min(100%, 310px);
}
.global-search .form-control {
    min-height: 38px;
    height: 38px;
    padding-inline-start: 2.25rem;
    border-color: var(--ref-border);
    border-radius: 9px;
    background: var(--ref-input);
    color: var(--ref-text);
    font-size: 11px;
}
.global-search i {
    position: absolute;
    inset-inline-start: .82rem;
    top: 50%;
    color: var(--ref-muted);
    transform: translateY(-50%);
    pointer-events: none;
}
.header-tools { display: flex; align-items: center; gap: .42rem; }
.header-tool-btn,
.app-header .btn-outline-secondary {
    width: 36px;
    height: 36px;
    min-height: 36px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: var(--ref-muted);
    border: 1px solid var(--ref-border) !important;
    border-radius: 9px !important;
    background: var(--ref-surface) !important;
    box-shadow: none !important;
}
.header-tool-btn:hover,
.app-header .btn-outline-secondary:hover { color: var(--ref-blue); background: var(--ref-blue-soft) !important; }
.header-user-chip {
    display: flex;
    align-items: center;
    gap: .52rem;
    max-width: 170px;
    padding: .16rem .35rem !important;
    color: var(--ref-text);
    border: 0 !important;
    background: transparent !important;
}
.header-user-chip img { width: 34px !important; height: 34px !important; border: 1px solid var(--ref-border); }
.header-user-copy { min-width: 0; line-height: 1.35; text-align: start; }
.header-user-name { display: block; overflow: hidden; color: var(--ref-text); font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.header-user-role { display: block; color: var(--ref-muted); font-size: 9px; font-weight: 600; }
.header-rates { display: none !important; }

/* ---------- Surfaces ---------- */
.card,
.stat-card,
.table-custom,
.modal-content-custom,
.modal-content,
.dropdown-menu,
.list-group-item {
    border-color: var(--ref-border) !important;
    background: var(--ref-surface) !important;
    color: var(--ref-text);
}
.card,
.stat-card,
.table-custom {
    border: 1px solid var(--ref-border) !important;
    border-radius: var(--ref-radius) !important;
    box-shadow: var(--ref-shadow-sm) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.card:hover,
.table-custom:hover { box-shadow: var(--ref-shadow) !important; }
.stat-card {
    padding: 1rem;
    overflow: hidden;
    transition: box-shadow .18s ease, transform .18s ease;
}
.stat-card::after { display: none; }
.stat-card:hover { transform: translateY(-2px) !important; border-color: var(--ref-border) !important; box-shadow: var(--ref-shadow) !important; }
.stat-icon {
    width: 39px;
    height: 39px;
    margin-bottom: .7rem;
    border-radius: 9px;
    font-size: 16px;
    box-shadow: none !important;
}
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}
.page-heading h1,
.page-heading h2,
.page-heading h3,
.page-heading h4 { margin: 0; color: var(--ref-text); font-size: 18px; font-weight: 800; }
.page-heading p { margin: .16rem 0 0; color: var(--ref-muted); font-size: 11px; }
.toolbar-card {
    padding: .92rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--ref-border);
    border-radius: var(--ref-radius);
    background: var(--ref-surface);
    box-shadow: var(--ref-shadow-sm);
}
.section-card { padding: 1rem; }
.section-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: -.05rem 0 .88rem;
    color: var(--ref-text);
    font-size: 13px;
    font-weight: 800;
}

/* ---------- Semantic panels modeled after supplied screenshots ---------- */
.ledger-panel {
    overflow: hidden;
    border: 1px solid var(--ref-border);
    border-radius: var(--ref-radius);
    background: var(--ref-surface);
    box-shadow: var(--ref-shadow-sm);
}
.ledger-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: .58rem .9rem;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}
.ledger-panel-header.incoming { background: linear-gradient(90deg, #079c70, #11ad80); }
.ledger-panel-header.outgoing { background: linear-gradient(90deg, #d92027, #ef3939); }
.ledger-panel-header.primary { background: linear-gradient(90deg, #255bd0, #3476f3); }
.ledger-panel-body { min-height: 164px; padding: .62rem .78rem .78rem; }
.ledger-total-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .38rem;
    margin: .55rem 0 0;
    padding: .5rem .2rem 0;
    border-top: 1px solid var(--ref-border-soft);
}
.balance-chip {
    display: inline-flex;
    gap: .32rem;
    align-items: center;
    padding: .25rem .47rem;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}
.balance-chip.positive { color: var(--ref-green); background: var(--ref-green-soft); }
.balance-chip.negative { color: var(--ref-red); background: var(--ref-red-soft); }
.balance-chip.neutral { color: var(--ref-blue); background: var(--ref-blue-soft); }
.reconciliation-card {
    width: min(100%, 440px);
    margin-inline: auto;
    overflow: hidden;
    border: 1px solid var(--ref-border);
    border-radius: var(--ref-radius);
    background: var(--ref-surface);
    box-shadow: var(--ref-shadow-sm);
}
.reconciliation-title {
    padding: .58rem .8rem;
    color: #fff;
    background: linear-gradient(90deg, #285fd6, #367df3);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}
.reconciliation-body { padding: .72rem; }
.reconciliation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .48rem; }
.reconciliation-item { padding: .56rem .62rem; border: 1px solid var(--ref-border); border-radius: 8px; background: var(--ref-input); }
.reconciliation-item small { display: block; color: var(--ref-muted); font-size: 9px; }
.reconciliation-item strong { display: block; margin-top: .08rem; font-size: 15px; }
.reconciliation-item.positive strong { color: var(--ref-green); }
.reconciliation-item.negative strong { color: var(--ref-red); }

/* ---------- Forms ---------- */
.form-label { margin-bottom: .34rem; color: #43536a; font-size: 11px; font-weight: 700; }
[data-bs-theme="dark"] .form-label { color: #bdc9d9; }
.form-control,
.form-select {
    min-height: 40px;
    border: 1px solid var(--ref-border) !important;
    border-radius: 8px !important;
    background-color: var(--ref-input) !important;
    color: var(--ref-text) !important;
    font-size: 11px;
    box-shadow: none !important;
}
.form-control-sm,
.form-select-sm { min-height: 35px; height: 35px; font-size: 10px; }
textarea.form-control { min-height: 84px; }
.form-control::placeholder { color: #93a2b5; }
.form-control:focus,
.form-select:focus {
    border-color: rgba(47, 111, 234, .68) !important;
    box-shadow: 0 0 0 3px rgba(47, 111, 234, .12) !important;
}
.input-group-text { border-color: var(--ref-border); background: var(--ref-input); color: var(--ref-muted); }

/* ---------- Buttons ---------- */
.btn {
    min-height: 36px;
    padding: .43rem .78rem;
    border-radius: 8px !important;
    font-size: 11px;
    font-weight: 800;
    box-shadow: none !important;
    transition: transform .14s ease, background-color .14s ease, border-color .14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn-sm { min-height: 31px; padding: .34rem .62rem; font-size: 10px; }
.btn-primary { border-color: var(--ref-blue) !important; background: var(--ref-blue) !important; }
.btn-primary:hover { border-color: var(--ref-blue-deep) !important; background: var(--ref-blue-deep) !important; filter: none !important; }
.btn-success { border-color: var(--ref-green) !important; background: var(--ref-green) !important; }
.btn-danger { border-color: var(--ref-red) !important; background: var(--ref-red) !important; }
.btn-warning { border-color: var(--ref-orange) !important; background: var(--ref-orange) !important; color: #fff !important; }
.btn-outline-secondary { border-color: var(--ref-border) !important; color: #5f6f85; background: var(--ref-surface) !important; }
.btn-outline-secondary:hover { color: var(--ref-blue); border-color: rgba(47,111,234,.35) !important; background: var(--ref-blue-soft) !important; }
.btn-outline-info { border-color: rgba(47,111,234,.28) !important; color: var(--ref-blue) !important; }
.btn-outline-info:hover { background: var(--ref-blue-soft) !important; color: var(--ref-blue) !important; }
.quick-action-strip { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-bottom: 1rem; }
.quick-action-btn {
    width: 68px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .16rem;
    color: #fff;
    border: 0;
    border-radius: 11px !important;
    font-size: 9px;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(31,45,61,.12) !important;
}
.quick-action-btn i { font-size: 15px; }
.quick-action-btn.print { background: #435268; }
.quick-action-btn.telegram { background: #189ac8; }
.quick-action-btn.pdf { background: #265bcf; }
.quick-action-btn.whatsapp { background: #12b66a; }

/* ---------- Tables ---------- */
.table-custom { overflow: hidden; }
.table-responsive { border-radius: 9px; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ref-text); margin-bottom: 0; color: var(--ref-text); }
.table > :not(caption) > * > * { border-color: var(--ref-border-soft); }
.table-custom th,
.table thead th {
    padding: .68rem .62rem !important;
    border-bottom: 1px solid var(--ref-border) !important;
    background: #f0f5fb !important;
    color: #75849a !important;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}
[data-bs-theme="dark"] .table-custom th,
[data-bs-theme="dark"] .table thead th { background: #182941 !important; color: #b4c1d3 !important; }
.table-custom td,
.table td {
    padding: .61rem .62rem !important;
    color: var(--ref-text);
    font-size: 10px;
    vertical-align: middle;
}
.table-hover tbody tr:hover > * { --bs-table-accent-bg: rgba(47, 111, 234, .035); color: var(--ref-text); }
.table-empty { padding: 2rem .6rem !important; color: var(--ref-muted) !important; text-align: center; }
.badge { padding: .38em .62em; border-radius: 999px; font-size: 9px; font-weight: 800; box-shadow: none !important; }
.bg-success-light { color: var(--ref-green) !important; background: var(--ref-green-soft) !important; }
.bg-danger-light { color: var(--ref-red) !important; background: var(--ref-red-soft) !important; }
.bg-info-light { color: var(--ref-blue) !important; background: var(--ref-blue-soft) !important; }
.bg-warning-light { color: var(--ref-orange) !important; background: var(--ref-orange-soft) !important; }

/* ---------- Alerts, tabs, dropdowns, modal ---------- */
.alert { border-radius: 9px; font-size: 11px; }
.dropdown-menu { padding: .38rem; border-radius: 10px; box-shadow: var(--ref-shadow); }
.dropdown-item { padding: .5rem .6rem; border-radius: 7px; color: var(--ref-text); font-size: 11px; }
.dropdown-item:hover,
.dropdown-item.active { color: var(--ref-blue); background: var(--ref-blue-soft); }
.modal-content { overflow: hidden; border-radius: 12px !important; box-shadow: 0 22px 56px rgba(22, 34, 52, .20); }
.modal-header,
.modal-footer { padding: .85rem 1rem; border-color: var(--ref-border-soft); }
.modal-body { padding: 1rem; }
.modal-title { font-size: 14px; font-weight: 800; }
.nav-tabs { gap: .28rem; border-bottom-color: var(--ref-border); }
.nav-tabs .nav-link,
.settings-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--ref-muted);
    font-size: 11px;
    font-weight: 800;
}
.nav-tabs .nav-link.active,
.settings-tabs .nav-link.active { border-color: var(--ref-border); color: var(--ref-blue) !important; background: var(--ref-blue-soft) !important; }
.settings-tabs .nav-link { border-radius: 8px; }

/* ---------- Utility ---------- */
.text-gradient { color: var(--ref-text) !important; background: none !important; animation: none !important; -webkit-text-fill-color: initial !important; }
.text-muted { color: var(--ref-muted) !important; }
.border-info-custom,
.border-success-custom,
.border-danger-custom,
.border-warning-custom,
.border-deposit-custom { border-inline-start: 3px solid transparent !important; border-inline-end: 0 !important; }
.border-info-custom { border-inline-start-color: var(--ref-blue) !important; }
.border-success-custom { border-inline-start-color: var(--ref-green) !important; }
.border-danger-custom { border-inline-start-color: var(--ref-red) !important; }
.border-warning-custom { border-inline-start-color: var(--ref-orange) !important; }
.border-deposit-custom { border-inline-start-color: var(--ref-purple) !important; }
.app-footer { padding: .6rem 1rem; border-top: 1px solid var(--ref-border); background: var(--ref-surface); }
.app-footer span { color: var(--ref-muted); font-size: 10px; }

/* ---------- Responsive ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 1100px) {
    .app-header { grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr); }
    .header-user-copy { display: none; }
    .header-user-chip { max-width: 44px; }
}
@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        width: min(86vw, var(--ref-sidebar-width)) !important;
        flex-basis: auto !important;
        top: 0;
        bottom: 0;
        height: 100vh;
    }
    .ltr .app-sidebar { left: calc(-1 * var(--ref-sidebar-width)); right: auto; }
    .rtl .app-sidebar { right: calc(-1 * var(--ref-sidebar-width)); left: auto; }
    .ltr .app-sidebar.show { left: 0; }
    .rtl .app-sidebar.show { right: 0; }
    .app-sidebar.collapsed { width: min(86vw, var(--ref-sidebar-width)) !important; }
    .app-sidebar.collapsed .sidebar-section-label span,
    .app-sidebar.collapsed .brand-copy,
    .app-sidebar.collapsed .sidebar-item span { display: inline; }
    .app-sidebar.collapsed .sidebar-item a { justify-content: flex-start; }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(15,23,42,.55); }
    .app-header {
        height: 62px;
        min-height: 62px;
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: .46rem .7rem;
    }
    .app-header .header-center { justify-self: center; }
    .app-header .header-end { justify-self: end; }
    .header-shop-name { max-width: 140px; font-size: 10px; }
    .global-search { width: 38px; }
    .global-search .form-control { width: 38px; padding: 0; color: transparent; cursor: pointer; }
    .global-search .form-control::placeholder { color: transparent; }
    .global-search i { inset-inline-start: .84rem; }
    .global-search:focus-within { position: absolute; inset-inline: .7rem; top: 12px; z-index: 5; width: auto; }
    .global-search:focus-within .form-control { width: 100%; padding-inline-start: 2.25rem; color: var(--ref-text); }
    .global-search:focus-within .form-control::placeholder { color: #93a2b5; }
    .header-tools { gap: .28rem; }
    .header-tool-btn,
    .app-header .btn-outline-secondary { width: 34px; height: 34px; min-height: 34px; }
    main.container-fluid { padding: .82rem .72rem 1.45rem !important; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .quick-action-strip { justify-content: flex-start; }
    .ledger-panel-body { min-height: auto; }
}


/* ---------- Clean printable reports ---------- */
@media print {
    body, body * { visibility: visible !important; }
    .app-sidebar,
    .app-header,
    .app-footer,
    .sidebar-backdrop,
    .quick-action-strip,
    .btn,
    button,
    .modal,
    .dropdown-menu { display: none !important; }
    body { background: #fff !important; }
    .main-content,
    main.container-fluid {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    .card,
    .table-custom,
    .ledger-panel,
    .reconciliation-card,
    .stat-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #d7dee8 !important;
    }
    .print-area { position: static !important; width: 100% !important; }
}
.quick-action-btn.primary { background: #2f6fea; }
.quick-action-btn.incoming { background: #0aa677; }
.quick-action-btn.outgoing { background: #e73838; }
.quick-action-btn:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.03); }


/* ============================================================
   Readability pass 2026-06-06b
   The supplied reference screenshots were captured around 70%
   browser zoom. Keep the same visual language while making the
   live interface comfortably readable at normal 100% zoom.
   ============================================================ */
:root {
    --ref-sidebar-width: 306px;
    --ref-sidebar-collapsed: 82px;
    --ref-header-height: 78px;
}
body { font-size: 15px; line-height: 1.72; }
main.container-fluid { padding: 1.38rem 1.45rem 2.25rem !important; }

/* Language-aware menu placement: Kurdish and Arabic right (direction: rtl puts first flex child on right), English left. */
html[lang="ku"] body .app-wrapper,
html[lang="ar"] body .app-wrapper { flex-direction: row !important; }
html[lang="en"] body .app-wrapper { flex-direction: row !important; }

.sidebar-brand { padding-inline: 1rem; }
.sidebar-brand .brand-mark { width: 43px; height: 43px; flex-basis: 43px; font-size: 18px; }
.sidebar-brand .brand-title { font-size: 14px; }
.sidebar-brand .brand-subtitle { font-size: 11px; }
.sidebar-menu { padding: .58rem .56rem 1.18rem; }
.sidebar-section-label { margin: .64rem .44rem .22rem; font-size: 10.5px; }
.sidebar-item a { min-height: 45px; padding: .58rem .78rem; border-radius: 9px; font-size: 13px; gap: .62rem; }
.sidebar-item a i { width: 20px; min-width: 20px; font-size: 15px; }
.sidebar-item.active a::after { inset-block: 8px; width: 4px; }

.app-header { padding: .66rem 1.34rem; }
.header-shop-name { font-size: 14px; }
.global-search { width: min(100%, 350px); }
.global-search .form-control { min-height: 42px; height: 42px; font-size: 13px; }
.header-tool-btn,
.app-header .btn-outline-secondary { width: 40px; height: 40px; min-height: 40px; border-radius: 10px !important; }
.header-user-chip { max-width: 195px; gap: .62rem; }
.header-user-chip img { width: 38px !important; height: 38px !important; }
.header-user-name { font-size: 13px; }
.header-user-role { font-size: 10.5px; }

.stat-card { padding: 1.16rem; }
.stat-icon { width: 44px; height: 44px; font-size: 18px; }
.page-heading { margin-bottom: 1.16rem; }
.page-heading h1,
.page-heading h2,
.page-heading h3,
.page-heading h4 { font-size: 21px; }
.page-heading p { font-size: 13px; }
.toolbar-card { padding: 1.08rem 1.16rem; margin-bottom: 1.15rem; }
.section-card { padding: 1.15rem; }
.section-card-title { font-size: 15px; }

.ledger-panel-header { min-height: 50px; padding: .68rem 1rem; font-size: 14px; }
.ledger-panel-body { min-height: 184px; padding: .74rem .9rem .9rem; }
.balance-chip { padding: .3rem .56rem; font-size: 11.5px; }
.reconciliation-card { width: min(100%, 490px); }
.reconciliation-title { padding: .68rem .92rem; font-size: 14px; }
.reconciliation-body { padding: .86rem; }
.reconciliation-item { padding: .66rem .74rem; }
.reconciliation-item small { font-size: 10.5px; }
.reconciliation-item strong { font-size: 17px; }

.form-label { margin-bottom: .4rem; font-size: 13px; }
.form-control,
.form-select { min-height: 45px; border-radius: 9px !important; font-size: 13px; }
.form-control-sm,
.form-select-sm { min-height: 40px; height: 40px; font-size: 12px; }
.form-text { color: var(--ref-muted); font-size: 11px; }
textarea.form-control { min-height: 96px; }

.btn { min-height: 41px; padding: .5rem .9rem; border-radius: 9px !important; font-size: 13px; }
.btn-sm { min-height: 35px; padding: .4rem .7rem; font-size: 11.5px; }
.quick-action-btn { width: 76px; min-height: 64px; font-size: 10.5px; }
.quick-action-btn i { font-size: 17px; }

.table-custom th,
.table thead th { padding: .78rem .72rem !important; font-size: 10.5px; }
.table-custom td,
.table td { padding: .72rem .72rem !important; font-size: 12px; }
.badge { font-size: 10.5px; }
.alert { font-size: 13px; }
.dropdown-item { padding: .58rem .7rem; font-size: 13px; }
.modal-title { font-size: 16px; }
.nav-tabs .nav-link,
.settings-tabs .nav-link { font-size: 13px; }
.app-footer span { font-size: 11px; }

@media (max-width: 768px) {
    html[lang="ku"] body .app-sidebar,
    html[lang="ar"] body .app-sidebar { right: calc(-1 * var(--ref-sidebar-width)) !important; left: auto !important; }
    html[lang="en"] body .app-sidebar { left: calc(-1 * var(--ref-sidebar-width)) !important; right: auto !important; }
    html[lang="ku"] body .app-sidebar.show,
    html[lang="ar"] body .app-sidebar.show { right: 0 !important; left: auto !important; }
    html[lang="en"] body .app-sidebar.show { left: 0 !important; right: auto !important; }
    body { font-size: 14px; }
    .app-header { height: 66px; min-height: 66px; padding: .5rem .74rem; }
    .header-shop-name { max-width: 150px; font-size: 11px; }
    .header-tool-btn,
    .app-header .btn-outline-secondary { width: 36px; height: 36px; min-height: 36px; }
    main.container-fluid { padding: .92rem .78rem 1.6rem !important; }
    .sidebar-item a { min-height: 44px; font-size: 13px; }
    .table-custom th,
    .table thead th { font-size: 10px; }
    .table-custom td,
    .table td { font-size: 11.5px; }
}

/* ============================================================
   Premium Global Loading Screen Styles (2026 Refresh)
   ============================================================ */
.global-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7); /* Dark semi-transparent overlay */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    opacity: 1;
    visibility: visible;
}

[data-bs-theme="light"] .global-loader {
    background: rgba(244, 247, 251, 0.85); /* Light semi-transparent overlay */
}

.global-loader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Spinner using coin theme */
.loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-circle {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--accent-500); /* Theme primary color */
    border-bottom-color: var(--accent-500);
    animation: spinCircle 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-icon {
    font-size: 2.2rem;
    color: var(--accent-500);
    animation: pulseIcon 1.5s ease-in-out infinite alternate;
}

.loader-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 320px;
    line-height: 1.5;
    animation: pulseText 1.5s ease-in-out infinite alternate;
}

/* Animations */
@keyframes spinCircle {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseIcon {
    0% { transform: scale(0.9) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.15) rotate(180deg); opacity: 1; }
    100% { transform: scale(0.9) rotate(360deg); opacity: 0.8; }
}

@keyframes pulseText {
    0% { opacity: 0.7; transform: translateY(0); }
    100% { opacity: 1; transform: translateY(-2px); }
}


/* ============================================================
   Language side placement and Kurdish typography fix 2026-06-06c
   Kurdish / Arabic: sidebar is always on the RIGHT.
   English: sidebar is always on the LEFT.
   The wrapper direction is neutralized so flex placement cannot
   change when the page text direction changes.
   ============================================================ */
html[lang="ku"] body,
html[lang="ar"] body {
    font-family: 'Noto Sans Arabic', 'Noto Kufi Arabic', Tahoma, Arial, sans-serif !important;
    direction: rtl;
}
html[lang="en"] body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    direction: ltr;
}
html[lang="ku"] body button,
html[lang="ku"] body input,
html[lang="ku"] body select,
html[lang="ku"] body textarea,
html[lang="ku"] body .btn,
html[lang="ku"] body .form-control,
html[lang="ku"] body .form-select,
html[lang="ar"] body button,
html[lang="ar"] body input,
html[lang="ar"] body select,
html[lang="ar"] body textarea,
html[lang="ar"] body .btn,
html[lang="ar"] body .form-control,
html[lang="ar"] body .form-select {
    font-family: 'Noto Sans Arabic', 'Noto Kufi Arabic', Tahoma, Arial, sans-serif !important;
}
html[lang="en"] body button,
html[lang="en"] body input,
html[lang="en"] body select,
html[lang="en"] body textarea,
html[lang="en"] body .btn,
html[lang="en"] body .form-control,
html[lang="en"] body .form-select {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
}

/* Desktop placement. Keep the flex container itself LTR, then place the
   first child (.app-sidebar) explicitly using row / row-reverse. */
html[lang="ku"] body .app-wrapper,
html[lang="ar"] body .app-wrapper {
    direction: ltr !important;
    flex-direction: row-reverse !important;
}
html[lang="en"] body .app-wrapper {
    direction: ltr !important;
    flex-direction: row !important;
}
html[lang="ku"] body .app-sidebar,
html[lang="ku"] body .main-content,
html[lang="ar"] body .app-sidebar,
html[lang="ar"] body .main-content {
    direction: rtl;
}
html[lang="en"] body .app-sidebar,
html[lang="en"] body .main-content {
    direction: ltr;
}

/* Natural text alignment for menu content. */
html[lang="ku"] body .sidebar-section-label,
html[lang="ku"] body .sidebar-item a,
html[lang="ar"] body .sidebar-section-label,
html[lang="ar"] body .sidebar-item a { text-align: right; }
html[lang="en"] body .sidebar-section-label,
html[lang="en"] body .sidebar-item a { text-align: left; }

/* Mobile drawer placement mirrors desktop language placement. */
@media (max-width: 768px) {
    html[lang="ku"] body .app-sidebar,
    html[lang="ar"] body .app-sidebar {
        right: calc(-1 * var(--ref-sidebar-width)) !important;
        left: auto !important;
    }
    html[lang="ku"] body .app-sidebar.show,
    html[lang="ar"] body .app-sidebar.show {
        right: 0 !important;
        left: auto !important;
    }
    html[lang="en"] body .app-sidebar {
        left: calc(-1 * var(--ref-sidebar-width)) !important;
        right: auto !important;
    }
    html[lang="en"] body .app-sidebar.show {
        left: 0 !important;
        right: auto !important;
    }
}

/* ============================================================
   Premium polish update — 2026-07-05
   Cleaner spacing, stronger cards, better mobile layout.
   ============================================================ */
:root{
    --premium-radius-xl: 22px;
    --premium-radius-lg: 16px;
    --premium-shadow: 0 18px 55px rgba(15,23,42,.10);
    --premium-shadow-hover: 0 22px 70px rgba(15,23,42,.14);
    --premium-line: rgba(148,163,184,.28);
}
body{
    background:
      radial-gradient(circle at top right, rgba(47,111,234,.12), transparent 32rem),
      radial-gradient(circle at bottom left, rgba(8,166,120,.10), transparent 30rem),
      var(--ref-bg) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.app-header{
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--premium-line) !important;
    box-shadow: 0 8px 28px rgba(15,23,42,.045) !important;
}
.app-sidebar{
    border-inline-end: 1px solid var(--premium-line) !important;
    box-shadow: 8px 0 34px rgba(15,23,42,.055) !important;
}
.rtl .app-sidebar{ box-shadow: -8px 0 34px rgba(15,23,42,.055) !important; }
.sidebar-brand{
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.96));
}
[data-bs-theme="dark"] .sidebar-brand{
    background: linear-gradient(180deg, rgba(18,31,50,.98), rgba(15,26,43,.98));
}
.sidebar-brand .brand-mark{
    border-radius: 14px !important;
    background: linear-gradient(135deg, var(--ref-blue), #12b981) !important;
    color:#fff !important;
    box-shadow: 0 12px 30px rgba(47,111,234,.28);
}
.sidebar-menu{ padding: .95rem .75rem 1.25rem !important; }
.sidebar-section-label span{
    font-size: 10px !important;
    font-weight: 900 !important;
    letter-spacing: .03em;
    color: var(--ref-muted);
}
.sidebar-item a{
    min-height: 43px;
    border-radius: 13px !important;
    font-weight: 800 !important;
    border: 1px solid transparent;
}
.sidebar-item a:hover{
    background: rgba(47,111,234,.075) !important;
    border-color: rgba(47,111,234,.14);
    transform: translateY(-1px);
}
.sidebar-item.active a{
    background: linear-gradient(135deg, var(--ref-blue), var(--ref-blue-deep)) !important;
    color: #fff !important;
    box-shadow: 0 12px 28px rgba(47,111,234,.28);
}
.sidebar-item.active a i{ color:#fff !important; }
.card, .dashboard-card, .stat-card, .panel, .table-card, .content-card, .box, .widget,
.card-body, .list-group, .dropdown-menu{
    border-radius: var(--premium-radius-lg) !important;
}
.card, .dashboard-card, .stat-card, .panel, .table-card, .content-card, .box, .widget{
    border: 1px solid var(--premium-line) !important;
    box-shadow: var(--premium-shadow) !important;
    background: rgba(255,255,255,.92) !important;
}
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .dashboard-card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .panel,
[data-bs-theme="dark"] .table-card,
[data-bs-theme="dark"] .content-card,
[data-bs-theme="dark"] .box,
[data-bs-theme="dark"] .widget{
    background: rgba(18,31,50,.92) !important;
}
.card:hover, .dashboard-card:hover, .stat-card:hover{
    box-shadow: var(--premium-shadow-hover) !important;
}
.stat-icon, .icon-box, .card-icon{
    border-radius: 15px !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 10px 22px rgba(15,23,42,.10);
}
.btn{
    border-radius: 12px !important;
    font-weight: 800 !important;
    min-height: 38px;
}
.btn-primary, .btn-success{
    border: 0 !important;
    box-shadow: 0 10px 22px rgba(47,111,234,.22);
}
.btn-primary{
    background: linear-gradient(135deg, var(--ref-blue), var(--ref-blue-deep)) !important;
}
.btn-success{
    background: linear-gradient(135deg, var(--ref-green), #059669) !important;
}
.form-control, .form-select, .input-group-text, textarea{
    border-radius: 12px !important;
    border-color: var(--premium-line) !important;
    background-color: var(--ref-input) !important;
    font-weight: 700;
}
.form-control:focus, .form-select:focus{
    border-color: rgba(47,111,234,.58) !important;
    box-shadow: 0 0 0 .22rem rgba(47,111,234,.12) !important;
}
.table{
    --bs-table-bg: transparent;
    vertical-align: middle;
}
.table thead th{
    background: rgba(47,111,234,.075) !important;
    color: var(--ref-text) !important;
    font-size: 11px;
    font-weight: 900;
    border-bottom: 1px solid var(--premium-line) !important;
}
.table tbody td{
    border-color: rgba(148,163,184,.20) !important;
    font-weight: 700;
}
.table tbody tr:hover td{ background: rgba(47,111,234,.045) !important; }
.badge{
    border-radius: 999px !important;
    padding: .45rem .7rem;
    font-weight: 900;
}
.dropdown-menu{
    border: 1px solid var(--premium-line) !important;
    box-shadow: 0 22px 65px rgba(15,23,42,.16) !important;
    overflow: hidden;
}
.header-user-chip, .header-action-btn{
    border-radius: 999px !important;
    border: 1px solid var(--premium-line) !important;
    background: rgba(255,255,255,.78) !important;
}
[data-bs-theme="dark"] .header-user-chip,
[data-bs-theme="dark"] .header-action-btn{ background: rgba(18,31,50,.78) !important; }
.alert{
    border-radius: 16px !important;
    border: 1px solid var(--premium-line) !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.055);
}
main.container-fluid > .row{ row-gap: 1rem; }
@media (max-width: 991.98px){
    main.container-fluid{ padding: .85rem .75rem 1.5rem !important; }
    .app-sidebar{ position: fixed !important; inset-block: 0; transform: translateX(110%); }
    body.ltr .app-sidebar{ transform: translateX(-110%); }
    body.sidebar-open .app-sidebar{ transform: translateX(0) !important; }
    .card, .dashboard-card, .stat-card{ border-radius: 15px !important; }
    .table-responsive{ border-radius: 15px; }
}

/* SHA SYSTEM speed fix: no global loading overlay */
.global-loader{display:none!important;opacity:0!important;visibility:hidden!important;pointer-events:none!important;}
.loader-content,.loader-spinner,.loader-text{display:none!important;}
