﻿:root {
    --bg: #f6f2ec;
    --panel: #ffffff;
    --text: #2a2420;
    --muted: #8a7f72;
    --primary: #8a6a45;
    --primary-dark: #6f5336;
    --line: #e7ddce;
    --soft: #f3ece0;
    --danger: #dc2626;
}

* {
    box-sizing: border-box
}

body {
    font-family: 'Tajawal',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0
}

a {
    text-decoration: none
}

.app-shell {
    display: flex;
    min-height: 100vh
}

.sidebar {
    width: 280px;
    background: #241c14;
    color: #fff;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 8px
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px
}

.brand strong {
    display: block;
    font-size: 18px
}

.brand span {
    display: block;
    color: #a7b2c2;
    font-size: 12px;
    margin-top: 2px
}

.sidebar .nav-link, .mobile-nav .nav-link {
    color: #cbd5e1;
    border-radius: 12px;
    padding: 11px 12px;
    font-weight: 600;
    display: flex;
    gap: 9px;
    align-items: center
}

    .sidebar .nav-link:hover, .sidebar .nav-link.active, .mobile-nav .nav-link:hover {
        background: rgba(255,255,255,.08);
        color: #fff
    }

.main-content {
    flex: 1;
    min-width: 0
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 24px 30px 16px;
    background: var(--bg)
}

    .topbar h1 {
        font-size: 26px;
        font-weight: 800;
        margin: 0 0 4px
    }

    .topbar p {
        margin: 0;
        color: var(--muted)
    }

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.content-wrap {
    padding: 0 30px 36px
}

.clean-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: 0 8px 22px rgba(15,23,42,.04)
}

.kpi-card {
    padding: 20px
}

    .kpi-card .label {
        color: var(--muted);
        font-size: 14px
    }

    .kpi-card .value {
        font-size: 26px;
        font-weight: 800;
        margin-top: 5px
    }

    .kpi-card .icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        background: var(--soft);
        color: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px
    }

.table {
    vertical-align: middle
}

    .table thead th {
        color: #475569;
        font-size: 13px;
        background: #faf7f2;
        border-bottom: 1px solid var(--line)
    }

.badge-soft {
    background: var(--soft);
    color: var(--primary);
    font-weight: 700
}

.progress {
    height: 9px;
    background: #ece3d4
}

.progress-bar {
    background: var(--primary)
}

.form-control, .form-select {
    border-radius: 12px;
    border-color: #e2d8c8;
    padding: .7rem .85rem
}

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

.btn-primary {
    background: var(--primary);
    border-color: var(--primary)
}

    .btn-primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark)
    }

.btn-outline-danger {
    font-weight: 800
}

.page-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px
}

    .page-actions h2 {
        font-size: 22px;
        font-weight: 800;
        margin: 0
    }

.muted {
    color: var(--muted)
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 14px;
    margin-bottom: 18px
}

.attach-list {
    display: grid;
    gap: 10px
}

.attach-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff
}

.hero-card {
    background: linear-gradient(135deg,#ffffff 0%,#f6efe2 100%)
}

.progress-lg {
    height: 14px;
    border-radius: 99px
}

    .progress-lg .progress-bar {
        border-radius: 99px
    }

.monthly-row {
    margin-bottom: 14px
}

.file-thumb {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex: 0 0 44px
}

.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap
}

    .table-actions .btn {
        padding: .25rem .55rem
    }

.inline-hint {
    background: #faf7f2;
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    color: var(--muted)
}

.print-only {
    display: none
}

.dataTables_wrapper .row {
    align-items: center
}

.dt-search input, .dt-length select {
    border-radius: 10px;
    border: 1px solid #e2d8c8;
    padding: .35rem .6rem
}

.mobile-header {
    min-height: 62px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: #241c14;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 14px;
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 6px 20px rgba(0,0,0,.12)
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800
}

    .mobile-brand i {
        color: #c9a06b
    }

.mobile-menu-btn {
    font-size: 22px;
    padding: .25rem .6rem
}

.mobile-offcanvas {
    background: #241c14;
    color: #fff;
    width: min(340px,100vw) !important
}

@media(max-width:420px) {
    .mobile-offcanvas {
        width: 100vw !important
    }
}

.mobile-offcanvas .offcanvas-header {
    padding-top: calc(1rem + env(safe-area-inset-top))
}

.mobile-offcanvas .offcanvas-body {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom))
}

.mobile-offcanvas .btn-close {
    filter: invert(1)
}

.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at top right,#e9dcc5 0,#f6f2ec 34%,#ece3d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px
}

.login-wrap {
    width: min(1040px,100%)
}

.login-card {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden
}

.login-hero {
    background: linear-gradient(135deg,#241c14 0%,#8a6a45 100%);
    color: #fff;
    padding: 46px;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: rgba(255,255,255,.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 18px
}

.login-hero h1 {
    font-size: 34px;
    font-weight: 800
}

.login-hero p {
    color: #e9dcc5;
    font-size: 17px
}

.login-points {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px
}

    .login-points span {
        background: rgba(255,255,255,.12);
        border: 1px solid rgba(255,255,255,.18);
        border-radius: 999px;
        padding: 8px 12px
    }

.login-formbox {
    padding: 42px;
    background: #fff
}

    .login-formbox h2 {
        font-weight: 800;
        margin-bottom: 4px
    }

@media(max-width:991.98px) {
    .app-shell {
        display: block
    }

    .main-content {
        width: 100%
    }

    .topbar {
        display: none
    }

    .content-wrap {
        padding: 18px 12px 30px
    }

    .stat-strip {
        grid-template-columns: 1fr 1fr
    }

    .clean-card {
        border-radius: 16px
    }

    .page-actions {
        align-items: stretch;
        flex-direction: column
    }

        .page-actions .btn, .top-actions .btn {
            width: 100%
        }

    .table-responsive {
        border-radius: 14px
    }

    .attach-item {
        align-items: flex-start;
        flex-direction: column
    }

    .table-actions {
        justify-content: flex-start
    }

    .nav-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px
    }

        .nav-pills .nav-link {
            white-space: nowrap
        }

    .login-card {
        grid-template-columns: 1fr
    }

    .login-hero {
        padding: 28px
    }

    .login-formbox {
        padding: 26px
    }

    .login-hero h1 {
        font-size: 26px
    }
}

@media(max-width:560px) {
    .stat-strip {
        grid-template-columns: 1fr
    }

    .kpi-card .value {
        font-size: 22px
    }

    .content-wrap {
        padding-left: 10px;
        padding-right: 10px
    }

    .btn {
        min-height: 38px
    }

    .login-body {
        padding: 12px
    }

    .login-points span {
        width: 100%
    }
}

@media print {
    .sidebar, .topbar, .page-actions, .btn, .nav, .top-actions, .mobile-header {
        display: none !important
    }

    .main-content {
        width: 100%
    }

    .content-wrap {
        padding: 0
    }

    .clean-card {
        box-shadow: none;
        border-color: #ddd
    }

    .print-only {
        display: block
    }

    .app-shell {
        display: block
    }
}

.user-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-inline-end: 6px;
    background: #22c55e
}

    .user-status-dot.off {
        background: #f59e0b
    }

.backup-action-card {
    transition: .15s ease
}

    .backup-action-card:hover {
        transform: translateY(-2px)
    }

.admin-submenu {
    padding-inline-start: 12px;
    margin: 2px 0 8px
}

    .admin-submenu .nav-link {
        font-size: 14px;
        padding: 9px 12px;
        background: rgba(255,255,255,.035)
    }

.admin-toggle .bi-chevron-down {
    transition: .15s
}

.admin-toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg)
}

.login-demo-hint {
    background: #faf7f2;
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 12px 14px
}

.login-formbox .input-group-text {
    border-radius: 12px 0 0 12px;
    background: #faf7f2
}

.login-formbox .input-group .form-control {
    border-radius: 0 12px 12px 0
}

.mini-stat {
    background: #faf7f2;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px 14px;
    height: 100%
}

    .mini-stat span {
        display: block;
        color: var(--muted);
        font-size: 13px
    }

    .mini-stat strong {
        font-size: 20px
    }

.dashboard-filter-card .form-label {
    font-weight: 700;
    color: #475569
}

@media(max-width:991.98px) {
    .admin-submenu {
        padding-inline-start: 0
    }

    .mobile-nav .admin-submenu .nav-link {
        background: rgba(255,255,255,.07);
        margin-bottom: 4px
    }

    .hero-card .btn, .dashboard-filter-card .btn {
        width: 100%
    }

    .mini-stat strong {
        font-size: 18px
    }

    .login-demo-hint code {
        font-size: 14px
    }
}

/* v8.1 dashboard/mobile refinements */
.compact-list {
    display: grid;
    gap: 8px
}

.compact-list-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff
}

    .compact-list-row strong {
        font-size: 14px;
        font-weight: 800;
        flex: 1 1 auto;
        min-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

.compact-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #faf7f2;
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 3px 9px;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap
}

.compact-badge-amount {
    background: var(--soft);
    border-color: #e9dcc5;
    color: var(--primary);
    font-weight: 800
}

.compact-badge-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c
}

.budget-summary-mobile {
    display: none
}

.budget-mobile-list {
    display: grid;
    gap: 8px
}

.budget-mobile-row {
    display: block;
    color: var(--text);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff
}

    .budget-mobile-row:hover {
        border-color: #d8c39a;
        background: #f6efe2
    }

.budget-mobile-title {
    font-weight: 800;
    margin-bottom: 6px
}

.budget-mobile-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    font-size: 12px;
    color: #475569
}

    .budget-mobile-values span:last-child {
        text-align: left;
        font-weight: 800;
        color: var(--primary)
    }

.budget-summary-card .dt-container {
    width: 100%
}

.dt-container .dt-search, .dt-container .dt-length {
    display: flex;
    align-items: center;
    gap: 8px
}

    .dt-container .dt-search input, .dt-container .dt-length select {
        margin: 0
    }

.dt-container .dt-paging .pagination {
    gap: 4px;
    flex-wrap: wrap
}

.dt-container .page-link {
    border-radius: 10px !important
}

.btn.disabled, .btn:disabled {
    pointer-events: none;
    opacity: .65
}

@media(max-width:991.98px) {
    .budget-summary-desktop {
        display: none
    }

    .budget-summary-mobile {
        display: block
    }

    .dt-container .row {
        gap: 8px
    }

    .dt-container .dt-search {
        width: 100%;
        justify-content: space-between
    }

        .dt-container .dt-search label {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 8px
        }

        .dt-container .dt-search input {
            width: 100% !important;
            max-width: none
        }

    .dt-container .dt-paging .pagination {
        justify-content: center
    }

    .dataTables_wrapper, .dt-container {
        font-size: 14px
    }

    .table.datatable {
        min-width: 720px
    }

    .budget-summary-card .table.datatable {
        min-width: 0
    }
}

@media(max-width:560px) {
    .budget-mobile-values {
        grid-template-columns: 1fr
    }

        .budget-mobile-values span:last-child {
            text-align: inherit
        }

    .hero-card h2 {
        font-size: 20px
    }

    .dashboard-filter-card .row > [class*="col-"] {
        width: 100%
    }

    .dt-container .dt-search label {
        flex-direction: column;
        align-items: stretch
    }

    .dt-container .dt-search input {
        margin-top: 4px
    }

    .compact-list-row {
        padding: 9px 10px
    }

    .mobile-brand span {
        font-size: 13px
    }
}

/* v8.2 Budget item list + item details mobile refinements */
.budget-page-actions .btn {
    min-width: 150px
}

.budget-items-table td, .budget-items-table th {
    vertical-align: middle
}

.budget-item-link {
    font-weight: 800;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px
}

    .budget-item-link:hover {
        color: var(--primary)
    }

    .budget-item-link:after {
        content: '\F285';
        font-family: 'bootstrap-icons';
        font-size: 12px;
        color: #94a3b8
    }

.mobile-search-box {
    position: relative
}

    .mobile-search-box i {
        position: absolute;
        inset-inline-start: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
        z-index: 2
    }

    .mobile-search-box .form-control {
        padding-inline-start: 38px;
        background: #faf7f2
    }

.budget-items-mobile-list {
    display: grid;
    gap: 8px
}

.budget-item-mobile-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    min-height: 46px
}

    .budget-item-mobile-row:hover {
        border-color: #d8c39a;
        background: #f6efe2
    }

.budget-item-mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px
}

.budget-item-mobile-name {
    font-weight: 800;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis
}

.budget-item-mobile-row strong {
    font-size: 13px;
    color: var(--primary);
    white-space: nowrap
}

.budget-item-mobile-progress {
    display: flex;
    align-items: center;
    gap: 8px
}

    .budget-item-mobile-progress .progress {
        flex: 1;
        height: 6px
    }

    .budget-item-mobile-progress small {
        color: var(--muted);
        white-space: nowrap;
        font-size: 11px
    }

.detail-hero {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 18px;
    align-items: center;
    background: linear-gradient(135deg,#fff 0%,#f6efe2 100%)
}

.detail-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 14px
}

.detail-hero h2 {
    font-weight: 800;
    margin: 2px 0 5px;
    font-size: 24px
}

.detail-hero p {
    margin: 0;
    color: var(--muted)
}

.detail-hero small {
    display: block;
    color: #64748b;
    margin-top: 6px
}

.detail-progress span {
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
    text-align: left
}

.detail-kpis {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 12px
}

    .detail-kpis .kpi-card {
        padding: 16px
    }

        .detail-kpis .kpi-card .value {
            font-size: 22px
        }

.item-action-strip {
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

    .item-action-strip form {
        margin: 0
    }

.action-pill {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 14px;
    padding: 9px 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px
}

    .action-pill:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: #f6efe2
    }

    .action-pill.primary {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff
    }

        .action-pill.primary:hover {
            background: var(--primary-dark);
            color: #fff
        }

    .action-pill.danger {
        border-color: #fecaca;
        color: #b91c1c;
        background: #fff
    }

        .action-pill.danger:hover {
            background: #fef2f2;
            color: #991b1b
        }

.detail-tabs {
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    gap: 8px
}

    .detail-tabs .nav-link {
        width: 100%;
        border: 1px solid var(--line);
        background: #fff;
        border-radius: 14px;
        color: #334155;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 10px
    }

        .detail-tabs .nav-link span {
            background: #ece3d4;
            border-radius: 999px;
            padding: 1px 7px;
            font-size: 12px
        }

        .detail-tabs .nav-link.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff
        }

            .detail-tabs .nav-link.active span {
                background: rgba(255,255,255,.22);
                color: #fff
            }

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap
}

    .section-title-row h5 {
        margin: 0;
        font-weight: 800
    }

.detail-table th, .detail-table td {
    vertical-align: middle
}

.inline-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap
}

    .inline-actions form {
        display: inline-flex;
        margin: 0
    }

.detail-file-list .attach-item {
    border-radius: 16px
}

.file-info {
    display: flex;
    align-items: flex-start;
    gap: 10px
}

    .file-info > i {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        background: var(--soft);
        color: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 19px;
        flex: 0 0 38px
    }

.detail-mobile-list {
    display: grid;
    gap: 9px
}

.detail-mobile-row {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    padding: 12px;
    display: grid;
    gap: 8px
}

    .detail-mobile-row .row-main, .detail-mobile-row .row-meta {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px
    }

        .detail-mobile-row .row-main strong {
            font-weight: 800;
            color: var(--text);
            line-height: 1.35
        }

        .detail-mobile-row .row-main span {
            color: var(--primary);
            font-weight: 800;
            white-space: nowrap
        }

    .detail-mobile-row .row-meta {
        font-size: 13px;
        color: #64748b
    }

    .detail-mobile-row .row-actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        padding-top: 3px
    }

        .detail-mobile-row .row-actions form {
            display: inline-flex;
            margin: 0
        }

.empty-mobile {
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--muted);
    background: #faf7f2
}

.btn.is-loading, .action-pill.disabled {
    opacity: .65;
    pointer-events: none
}

.dt-container {
    width: 100%
}

    .dt-container .dt-search label {
        font-weight: 700;
        color: #475569
    }

    .dt-container .dt-search input {
        min-height: 38px
    }

    .dt-container .dt-paging {
        overflow-x: auto;
        padding-bottom: 3px
    }

@media(max-width:991.98px) {
    .budget-items-card {
        padding: 10px !important
    }

    .detail-hero {
        grid-template-columns: 1fr;
        padding: 14px
    }

    .detail-hero-main {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 10px
    }

    .detail-hero h2 {
        font-size: 20px
    }

    .detail-progress span {
        text-align: right
    }

    .detail-kpis {
        grid-template-columns: 1fr 1fr;
        gap: 8px
    }

        .detail-kpis .kpi-card {
            padding: 13px
        }

            .detail-kpis .kpi-card .label {
                font-size: 12px
            }

            .detail-kpis .kpi-card .value {
                font-size: 18px
            }

    .item-action-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 10px
    }

        .item-action-strip form {
            display: block
        }

    .action-pill {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 9px 8px
    }

    .detail-tabs {
        display: flex;
        overflow-x: auto;
        gap: 7px;
        padding-bottom: 3px
    }

        .detail-tabs .nav-item {
            flex: 0 0 auto
        }

        .detail-tabs .nav-link {
            width: auto;
            min-width: 116px;
            font-size: 13px;
            padding: 9px 10px
        }

    .detail-section-card {
        padding: 10px !important
    }

    .section-title-row .btn {
        width: auto;
        min-width: 120px
    }

    .inline-actions {
        width: 100%
    }

        .inline-actions .btn, .inline-actions form, .inline-actions form button {
            flex: 1 1 auto
        }

    .attach-item .inline-actions {
        width: 100%
    }

    .dt-container .dt-layout-row {
        display: block !important
    }

    .dt-container .dt-layout-cell {
        display: block !important;
        width: 100% !important;
        text-align: stretch !important;
        margin-bottom: 8px
    }

    .dt-container .dt-search {
        justify-content: stretch !important
    }

        .dt-container .dt-search label {
            display: grid !important;
            grid-template-columns: 1fr;
            gap: 5px;
            width: 100%;
            align-items: stretch !important
        }

        .dt-container .dt-search input {
            width: 100% !important;
            margin: 0 !important
        }

    .dt-container .dt-paging nav {
        justify-content: center;
        display: flex
    }

    .dt-container .pagination {
        justify-content: center;
        gap: 4px;
        flex-wrap: wrap
    }

    .dt-container .page-link {
        padding: .35rem .6rem;
        font-size: 13px
    }

    .dataTables_wrapper, .dt-container {
        font-size: 13px
    }
}

@media(max-width:560px) {
    .budget-page-actions h2 {
        font-size: 20px
    }

    .budget-page-actions .btn {
        width: 100%
    }

    .budget-item-mobile-row {
        padding: 11px 12px
    }

    .detail-kpis {
        grid-template-columns: 1fr 1fr
    }

    .item-action-strip {
        grid-template-columns: 1fr 1fr
    }

    .detail-mobile-row .row-main, .detail-mobile-row .row-meta {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start
    }

    .detail-mobile-row .row-actions .btn, .detail-mobile-row .row-actions form, .detail-mobile-row .row-actions form button {
        flex: 1 1 calc(50% - 4px)
    }

    .file-info strong {
        word-break: break-word
    }

    .attach-item {
        padding: 11px
    }

    .section-title-row {
        align-items: stretch
    }

        .section-title-row .btn {
            width: 100%
        }
}

@media(max-width:380px) {
    .detail-kpis, .item-action-strip {
        grid-template-columns: 1fr
    }

    .detail-tabs .nav-link {
        min-width: 105px
    }

    .detail-mobile-row .row-actions .btn, .detail-mobile-row .row-actions form, .detail-mobile-row .row-actions form button {
        flex-basis: 100%
    }
}


/* v8.3 fixes: remove stray arrows, cleaner detail tabs, full-width detail tables */
.budget-item-link:after {
    content: none !important;
    display: none !important
}

.budget-items-table {
    width: 100% !important;
    table-layout: auto
}

    .budget-items-table th, .budget-items-table td {
        white-space: normal
    }

        .budget-items-table th:first-child, .budget-items-table td:first-child {
            width: 64px;
            text-align: center
        }

        .budget-items-table th:last-child, .budget-items-table td:last-child {
            width: 180px;
            text-align: start
        }

.budget-items-card .dt-container {
    width: 100% !important
}

.budget-items-card .dt-layout-table, .budget-items-card .dt-layout-cell {
    width: 100% !important
}

.detail-section-card {
    overflow: hidden
}

    .detail-section-card > .d-none.d-lg-block {
        width: 100%
    }

.detail-table {
    width: 100% !important;
    margin-bottom: 0;
    table-layout: auto
}

    .detail-table th, .detail-table td {
        white-space: normal;
        word-break: break-word
    }

        .detail-table td .btn {
            white-space: nowrap
        }

    .detail-table .inline-actions {
        justify-content: flex-start
    }

.detail-tab-content .clean-card {
    width: 100%
}

.detail-tabs {
    direction: rtl
}

    .detail-tabs .nav-link i, .action-pill i {
        line-height: 1
    }

    .detail-tabs .nav-link span {
        min-width: 24px;
        text-align: center
    }

.detail-mobile-row {
    box-shadow: 0 6px 16px rgba(15,23,42,.035)
}

    .detail-mobile-row .row-actions .btn, .detail-mobile-row .row-actions button {
        border-radius: 12px;
        font-weight: 800
    }

    .detail-mobile-row .row-actions .btn-outline-primary {
        background: #eff6ff
    }

    .detail-mobile-row .row-actions .btn-outline-secondary {
        background: #faf7f2
    }

    .detail-mobile-row .row-actions .btn-outline-danger {
        background: #fff5f5
    }

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

.mobile-card-search {
    display: none
}

@media(max-width:991.98px) {
    .budget-items-card > .d-none.d-lg-block {
        display: none !important
    }

    .budget-items-mobile {
        display: block !important
    }

    .budget-items-card .dt-container, .budget-items-card .dataTables_wrapper {
        display: none !important
    }

    .budget-item-mobile-row {
        display: flex;
        flex-direction: column;
        width: 100%;
        overflow: hidden
    }

        .budget-item-mobile-row strong {
            font-size: 14px
        }

    .budget-item-mobile-name {
        white-space: normal;
        display: block
    }

    .detail-tabs {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        overflow: visible;
        padding-bottom: 0;
        margin-top: 2px
    }

        .detail-tabs .nav-item {
            width: 100%;
            flex: initial
        }

        .detail-tabs .nav-link {
            width: 100%;
            min-width: 0;
            min-height: 42px;
            border-radius: 14px;
            padding: 9px 8px;
            font-size: 13px;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(15,23,42,.035)
        }

            .detail-tabs .nav-link span {
                font-size: 12px;
                padding: 2px 8px;
                background: #eef2f7;
                color: #475569
            }

            .detail-tabs .nav-link.active span {
                background: rgba(255,255,255,.22);
                color: #fff
            }

    .detail-hero {
        border-radius: 18px
    }

    .detail-kpis {
        margin-bottom: 10px
    }

    .item-action-strip {
        border-radius: 18px;
        box-shadow: 0 8px 20px rgba(15,23,42,.045)
    }

    .detail-section-card {
        border-radius: 18px
    }

    .section-title-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px
    }

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

        .section-title-row .btn {
            width: 100%
        }

    .detail-mobile-list {
        gap: 10px
    }

    .detail-mobile-row {
        border-radius: 18px;
        padding: 12px 13px
    }

        .detail-mobile-row .row-main strong {
            font-size: 15px
        }

        .detail-mobile-row .row-main span {
            font-size: 14px
        }

        .detail-mobile-row .row-meta {
            font-size: 12.5px
        }

        .detail-mobile-row .row-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 7px
        }

            .detail-mobile-row .row-actions .btn, .detail-mobile-row .row-actions form, .detail-mobile-row .row-actions form button {
                width: 100%;
                margin: 0;
                flex: initial
            }

            .detail-mobile-row .row-actions form {
                display: block
            }

            .detail-mobile-row .row-actions button {
                min-height: 36px
            }

    .attach-item {
        border-radius: 18px
    }

        .attach-item .inline-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 7px
        }

            .attach-item .inline-actions .btn, .attach-item .inline-actions form, .attach-item .inline-actions button {
                width: 100%;
                margin: 0
            }

            .attach-item .inline-actions form {
                display: block
            }

    .dt-container .dt-layout-row {
        gap: 6px
    }

    .dt-container .dt-search label {
        font-size: 13px
    }

    .dt-container .dt-search input {
        min-height: 40px;
        border-radius: 12px
    }

    .dt-container .dt-paging {
        max-width: 100%;
        overflow-x: auto
    }

        .dt-container .dt-paging .pagination {
            margin: 0;
            justify-content: center
        }

        .dt-container .dt-paging .page-link {
            min-width: 34px;
            text-align: center
        }
}

@media(max-width:560px) {
    .budget-items-mobile-list {
        gap: 7px
    }

    .budget-item-mobile-row {
        padding: 10px 11px;
        min-height: 44px
    }

        .budget-item-mobile-row strong {
            font-size: 13px
        }

    .detail-tabs {
        grid-template-columns: 1fr 1fr
    }

        .detail-tabs .nav-link {
            font-size: 12.5px
        }

            .detail-tabs .nav-link i {
                font-size: 14px
            }

    .detail-mobile-row .row-main, .detail-mobile-row .row-meta {
        grid-template-columns: 1fr auto;
        gap: 8px
    }

    .detail-mobile-row .row-actions {
        grid-template-columns: 1fr 1fr
    }

    .item-action-strip {
        grid-template-columns: 1fr 1fr
    }

    .action-pill {
        min-height: 42px
    }

    .file-info > i {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 17px
    }
}

@media(max-width:380px) {
    .detail-tabs, .detail-mobile-row .row-actions, .attach-item .inline-actions {
        grid-template-columns: 1fr
    }

    .item-action-strip {
        grid-template-columns: 1fr 1fr
    }

    .detail-tabs .nav-link {
        min-height: 40px
    }
}

/* v8.4: Select2 RTL polish */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 42px;
    border-radius: 14px;
    border-color: #d9e1ea;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.7;
    padding-top: .25rem;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-radius: 14px;
    overflow: hidden;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 10px;
}

@media (max-width: 767.98px) {
    .select2-container--bootstrap-5 {
        width: 100% !important;
    }

        .select2-container--bootstrap-5 .select2-selection {
            min-height: 44px;
        }
}

/* v8.5: Select2 search + mobile page title */
.mobile-page-title {
    display: none
}

@media(max-width:991.98px) {
    .mobile-page-title {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 12px 12px 0;
        padding: 12px 13px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 18px;
        box-shadow: 0 8px 20px rgba(15,23,42,.04)
    }

    .mobile-page-title-icon {
        width: 38px;
        height: 38px;
        border-radius: 13px;
        background: var(--soft);
        color: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 38px;
        font-size: 18px
    }

    .mobile-page-title h1 {
        font-size: 18px;
        font-weight: 800;
        margin: 0;
        color: var(--text);
        line-height: 1.25
    }

    .mobile-page-title p {
        font-size: 12px;
        color: var(--muted);
        margin: 3px 0 0
    }

    .content-wrap {
        padding-top: 12px
    }
}

.select2-container {
    max-width: 100%
}

.select2-container--bootstrap-5 .select2-selection--single {
    display: flex;
    align-items: center
}

    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        width: 100%;
        padding-inline-start: .75rem;
        padding-inline-end: 2rem;
        text-align: right
    }

    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        left: .75rem;
        right: auto
    }

.select2-search--dropdown {
    display: block !important;
    padding: 10px !important;
    background: #fff
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    min-height: 40px;
    border: 1px solid #d9e1ea !important;
    border-radius: 12px !important;
    padding: .55rem .75rem !important;
    text-align: right;
    direction: rtl
}

.select2-results__option {
    padding: 9px 12px;
    text-align: right;
    direction: rtl
}

.select2-dropdown {
    z-index: 1065
}

@media(max-width:767.98px) {
    .select2-container--bootstrap-5 .select2-selection {
        min-height: 46px !important
    }

    .select2-search--dropdown {
        padding: 12px !important
    }

    .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
        min-height: 44px;
        font-size: 16px
    }
}

/* v8.6: Select2 integrated dropdown search, no external fallback input */
.select2-container--bootstrap-5 {
    width: 100% !important;
    max-width: 100%
}

    .select2-container--bootstrap-5 .select2-selection {
        min-height: 44px;
        border-radius: 14px;
        border-color: #d9e1ea;
        background: #fff;
        box-shadow: none
    }

    .select2-container--bootstrap-5.select2-container--focus .select2-selection, .select2-container--bootstrap-5.select2-container--open .select2-selection {
        border-color: #8a6a45;
        box-shadow: 0 0 0 .2rem rgba(15,118,110,.12)
    }

    .select2-container--bootstrap-5 .select2-selection--single {
        display: flex;
        align-items: center
    }

        .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
            width: 100%;
            padding-inline-start: .85rem !important;
            padding-inline-end: 2.1rem !important;
            text-align: right;
            line-height: 1.8;
            color: #0f172a
        }

        .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
            left: .85rem !important;
            right: auto !important;
            top: 50%;
            transform: translateY(-50%)
        }

.select2-dropdown {
    z-index: 1065;
    border-radius: 14px !important;
    overflow: hidden;
    border-color: #d9e1ea !important;
    box-shadow: 0 18px 40px rgba(15,23,42,.12);
    direction: rtl
}

.select2-search--dropdown {
    display: block !important;
    padding: 10px !important;
    background: #fff;
    border-bottom: 1px solid #f0e9dc
}

    .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field, .select2-search--dropdown .select2-search__field {
        display: block !important;
        width: 100% !important;
        min-height: 42px;
        border: 1px solid #d9e1ea !important;
        border-radius: 12px !important;
        padding: .55rem .8rem !important;
        text-align: right !important;
        direction: rtl !important;
        outline: 0;
        background: #fff;
        color: #0f172a
    }

.select2-container--bootstrap-5 .select2-results__option, .select2-results__option {
    padding: 10px 12px;
    text-align: right;
    direction: rtl;
    line-height: 1.5
}

.select2-results__option--highlighted {
    background: #8a6a45 !important;
    color: #fff !important
}

.select2-results__option[aria-selected=true] {
    background: #e9f8f5;
    color: #8a6a45
}

@media(max-width:767.98px) {
    .select2-container--bootstrap-5 .select2-selection {
        min-height: 46px !important
    }

    .select2-search--dropdown {
        padding: 12px !important
    }

        .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field, .select2-search--dropdown .select2-search__field {
            min-height: 44px;
            font-size: 16px
        }

    .select2-container--bootstrap-5 .select2-results__option, .select2-results__option {
        font-size: 15px;
        padding: 11px 13px
    }
}

/* v8.8: Payments page, modal details, mobile cards */
.payment-filter-card .form-label {
    font-size: 13px;
    font-weight: 800;
    color: #475569
}

.payment-open-link {
    text-decoration: none;
    color: #0f172a
}

    .payment-open-link:hover {
        color: var(--primary)
    }

.payments-table th, .payments-table td {
    vertical-align: middle
}

.payment-detail-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px
}

    .payment-detail-grid > div {
        background: #faf7f2;
        border: 1px solid #e5edf5;
        border-radius: 14px;
        padding: 10px 12px
    }

    .payment-detail-grid span {
        display: block;
        color: #64748b;
        font-size: 12px;
        font-weight: 700
    }

    .payment-detail-grid strong {
        display: block;
        color: #0f172a;
        font-size: 15px;
        margin-top: 3px;
        word-break: break-word
    }

.payment-note-box {
    background: #fff;
    border: 1px solid #e5edf5;
    border-radius: 14px;
    padding: 12px;
    white-space: pre-wrap
}

.attach-list.compact .attach-item {
    padding: 10px 12px;
    margin-bottom: 8px
}

.payment-print-header {
    display: none
}

.payments-mobile-list {
    display: grid;
    gap: 10px
}

.payment-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.payment-mobile-main {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: inherit;
    color: inherit
}

.payment-mobile-title {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.payment-mobile-amount {
    font-weight: 900;
    color: #8a6a45;
    white-space: nowrap
}

.payment-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .payment-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.payment-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .payment-mobile-actions .btn, .payment-mobile-actions form, .payment-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .payment-mobile-actions form {
        display: block
    }

    .payment-mobile-actions .btn, .payment-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.payment-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.payment-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.payment-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

@media(max-width:767.98px) {
    .payment-filter-card form {
        gap: 10px
    }

    .payments-card {
        padding: 12px !important
    }

    .payment-detail-modal .modal-dialog {
        margin: 8px
    }

    .payment-detail-modal .modal-content {
        border-radius: 18px
    }

    .payment-detail-modal .modal-footer .btn {
        width: 100%
    }

    .payment-mobile-actions {
        grid-template-columns: 1fr 1fr
    }

    .payment-mobile-row {
        border-radius: 16px
    }

    .dt-container .dt-layout-row {
        align-items: stretch !important
    }

    .dt-container .dt-search {
        width: 100%
    }

        .dt-container .dt-search input {
            width: 100% !important;
            margin: 0 !important
        }

    .dt-container .dt-length {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 6px
    }

        .dt-container .dt-length select {
            min-width: 74px
        }
}

@media(max-width:380px) {
    .payment-mobile-actions {
        grid-template-columns: 1fr
    }

    .payment-mobile-main {
        grid-template-columns: 1fr
    }

    .payment-mobile-amount {
        justify-self: start
    }
}

@media print {
    .sidebar, .topbar, .mobile-header, .mobile-page-title, .offcanvas, .page-actions, .payment-filter-card, .modal-footer, .btn {
        display: none !important
    }

    .main-content, .content-wrap {
        padding: 0 !important;
        margin: 0 !important
    }

    .clean-card {
        box-shadow: none !important;
        border: 0 !important
    }

    .payment-print-header {
        display: block !important
    }

    .payment-detail-grid {
        grid-template-columns: 1fr 1fr
    }
}

/* v8.10: Quotes page details, attachments and mobile cards */
.quote-open-link {
    text-decoration: none;
    color: #0f172a;
    text-align: inherit
}

    .quote-open-link:hover {
        color: var(--primary)
    }

.quotes-table th, .quotes-table td {
    vertical-align: middle
}

.quote-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.quote-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.quote-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

.quote-print-header {
    display: none
}

.quotes-mobile-list {
    display: grid;
    gap: 10px
}

.quote-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.quote-mobile-main {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: inherit;
    color: inherit
}

.quote-mobile-title {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.quote-mobile-amount {
    font-weight: 900;
    color: #8a6a45;
    white-space: nowrap
}

.quote-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .quote-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.quote-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .quote-mobile-actions .btn, .quote-mobile-actions form, .quote-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .quote-mobile-actions form {
        display: block
    }

    .quote-mobile-actions .btn, .quote-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.quotes-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:767.98px) {
    .quotes-card {
        padding: 12px !important
    }

    .quote-detail-grid {
        grid-template-columns: 1fr
    }

    .quote-detail-modal .modal-dialog {
        margin: 8px
    }

    .quote-detail-modal .modal-content {
        border-radius: 18px
    }

    .quote-detail-modal .modal-footer .btn {
        width: 100%
    }

    .quote-mobile-actions {
        grid-template-columns: 1fr 1fr
    }

    .quote-mobile-row {
        border-radius: 16px
    }
}

@media(max-width:380px) {
    .quote-mobile-actions {
        grid-template-columns: 1fr
    }

    .quote-mobile-main {
        grid-template-columns: 1fr
    }

    .quote-mobile-amount {
        justify-self: start
    }
}

@media print {
    .quote-print-header {
        display: block !important
    }
}

/* v8.12: Contractors mobile cards and clearer contractor profile */
.contractor-open-link {
    text-decoration: none;
    color: #0f172a
}

    .contractor-open-link:hover {
        color: var(--primary)
    }

.contractors-table th, .contractors-table td {
    vertical-align: middle
}

.contractors-mobile-list {
    display: grid;
    gap: 10px
}

.contractor-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.contractor-mobile-main {
    text-decoration: none;
    color: inherit;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center
}

.contractor-mobile-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.contractor-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .contractor-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.contractor-mobile-actions {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .contractor-mobile-actions .btn, .contractor-mobile-actions form, .contractor-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .contractor-mobile-actions form {
        display: block
    }

    .contractor-mobile-actions .btn, .contractor-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.contractors-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

.contractor-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px
}

    .contractor-actions-bar form {
        display: inline-flex
    }

.contractor-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px
}

.contractor-identity {
    display: flex;
    align-items: center;
    gap: 13px
}

.contractor-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    flex: 0 0 54px
}

.contractor-identity h2 {
    font-size: 24px;
    font-weight: 900;
    margin: 0;
    color: #0f172a
}

.contractor-subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: #64748b;
    margin-top: 5px
}

.contractor-contact-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px
}

    .contractor-contact-grid > div, .contractor-stat-card {
        background: #faf7f2;
        border: 1px solid #e5edf5;
        border-radius: 16px;
        padding: 12px
    }

        .contractor-contact-grid span, .contractor-stat-card span {
            display: block;
            font-size: 12px;
            color: #64748b;
            font-weight: 800
        }

        .contractor-contact-grid strong, .contractor-stat-card strong {
            display: block;
            font-size: 16px;
            color: #0f172a;
            margin-top: 3px;
            word-break: break-word
        }

        .contractor-stat-card strong {
            font-size: 24px;
            font-weight: 900;
            color: #8a6a45
        }

        .contractor-stat-card small {
            display: block;
            color: #64748b;
            margin-top: 2px
        }

.contractor-note {
    background: #fff;
    border: 1px solid #e5edf5;
    border-radius: 16px;
    padding: 12px;
    white-space: pre-wrap;
    color: #334155
}

.contractor-stat-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px
}

    .section-title-row h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 900;
        color: #0f172a;
        display: flex;
        align-items: center;
        gap: 7px
    }

.contractor-detail-table th {
    font-size: 13px;
    color: #64748b
}

.contractor-detail-table td {
    vertical-align: top
}

.file-chip-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 260px;
    border: 1px solid #d9e1ea;
    border-radius: 999px;
    padding: 6px 10px;
    text-decoration: none;
    color: #0f172a;
    background: #fff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

    .file-chip:hover {
        border-color: #8a6a45;
        color: #8a6a45;
        background: #f6efe2
    }

.contractor-mobile-list {
    display: grid;
    gap: 10px
}

.contractor-detail-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.mobile-row-head {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 10px
}

    .mobile-row-head strong {
        font-size: 14px;
        color: #0f172a;
        line-height: 1.35;
        word-break: break-word
    }

    .mobile-row-head span {
        font-weight: 900;
        color: #8a6a45;
        white-space: nowrap
    }

.mobile-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .mobile-row-meta span {
        display: inline-flex;
        align-items: center;
        background: #faf7f2;
        border: 1px solid #f0e9dc;
        border-radius: 999px;
        padding: 3px 8px
    }

.mobile-files {
    margin-top: 8px
}

.contractor-print-header {
    display: none
}

@media(max-width:991.98px) {
    .contractors-card {
        padding: 12px !important
    }

    .contractors-actions {
        align-items: stretch
    }

        .contractors-actions .btn {
            width: 100%;
            border-radius: 14px;
            font-weight: 800
        }

    .contractor-actions-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px
    }

        .contractor-actions-bar .btn, .contractor-actions-bar form, .contractor-actions-bar button {
            width: 100%;
            margin: 0
        }

        .contractor-actions-bar form {
            display: block
        }

    .contractor-identity {
        align-items: flex-start
    }

        .contractor-identity h2 {
            font-size: 20px
        }

    .contractor-contact-grid, .contractor-stat-grid {
        grid-template-columns: 1fr 1fr
    }

    .contractor-stat-card strong {
        font-size: 21px
    }

    .contractor-section {
        padding: 12px !important
    }

    .section-title-row h3 {
        font-size: 16px
    }

    .file-chip {
        max-width: 100%;
        width: 100%;
        justify-content: flex-start;
        border-radius: 13px
    }

    .contractor-mobile-actions {
        grid-template-columns: 1fr 1fr 1fr
    }

    .contractor-detail-mobile-row .btn {
        width: 100%;
        border-radius: 12px;
        font-weight: 800
    }

    .mobile-row-head {
        grid-template-columns: minmax(0,1fr) auto
    }

    .mobile-row-meta span {
        font-size: 12px
    }
}

@media(max-width:560px) {
    .contractor-mobile-actions {
        grid-template-columns: 1fr
    }

    .contractor-mobile-main {
        grid-template-columns: 1fr auto
    }

    .contractor-contact-grid, .contractor-stat-grid {
        grid-template-columns: 1fr
    }

    .contractor-actions-bar {
        grid-template-columns: 1fr 1fr
    }

    .contractor-avatar {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 15px;
        font-size: 22px
    }

    .mobile-row-head {
        grid-template-columns: 1fr
    }

        .mobile-row-head span {
            justify-self: start
        }

    .contractor-subtitle {
        font-size: 12px
    }

    .contractor-contact-grid > div, .contractor-stat-card {
        padding: 10px
    }
}

@media print {
    .contractor-print-header {
        display: block !important;
        margin-bottom: 16px
    }

    .contractor-actions-bar, .btn, .topbar, .sidebar, .mobile-header, .mobile-page-title, .offcanvas {
        display: none !important
    }

    .contractor-stat-grid {
        grid-template-columns: repeat(4,1fr)
    }

    .contractor-contact-grid {
        grid-template-columns: repeat(2,1fr)
    }

    .clean-card {
        box-shadow: none !important
    }

    .contractor-section {
        page-break-inside: avoid
    }

    .file-chip {
        border: 0;
        padding: 0;
        color: #0f172a
    }

    .main-content, .content-wrap {
        padding: 0 !important;
        margin: 0 !important
    }
}

/* v8.14 Contracts page mobile and modal polish */
.contract-open-link {
    text-decoration: none;
    color: #0f172a;
    text-align: inherit
}

    .contract-open-link:hover {
        color: var(--primary)
    }

.contracts-table th, .contracts-table td {
    vertical-align: middle
}

.contract-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.contract-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.contract-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

.contract-print-header {
    display: none
}

.contracts-mobile-list {
    display: grid;
    gap: 10px
}

.contract-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.contract-mobile-main {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: inherit;
    color: inherit
}

.contract-mobile-title {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.contract-mobile-amount {
    font-weight: 900;
    color: #8a6a45;
    white-space: nowrap
}

.contract-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .contract-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.contract-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .contract-mobile-actions .btn, .contract-mobile-actions form, .contract-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .contract-mobile-actions form {
        display: block
    }

    .contract-mobile-actions .btn, .contract-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.contracts-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:767.98px) {
    .contracts-card {
        padding: 12px !important
    }

    .contract-detail-grid {
        grid-template-columns: 1fr
    }

    .contract-detail-modal .modal-dialog {
        margin: 8px
    }

    .contract-detail-modal .modal-content {
        border-radius: 18px
    }

    .contract-detail-modal .modal-footer .btn {
        width: 100%
    }

    .contract-mobile-actions {
        grid-template-columns: 1fr 1fr
    }

    .contract-mobile-row {
        border-radius: 16px
    }
}

@media(max-width:380px) {
    .contract-mobile-actions {
        grid-template-columns: 1fr
    }

    .contract-mobile-main {
        grid-template-columns: 1fr
    }

    .contract-mobile-amount {
        justify-self: start
    }
}

/* v8.15 ChangeOrders page mobile and modal polish */
.changeorder-open-link {
    text-decoration: none;
    color: #0f172a;
    text-align: inherit;
    border: 0;
    background: transparent;
    padding: 0
}

    .changeorder-open-link:hover {
        color: var(--primary)
    }

.changeorders-table th, .changeorders-table td {
    vertical-align: middle
}

.changeorder-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.changeorder-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.changeorder-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

.changeorder-print-header {
    display: none
}

.changeorders-mobile-list {
    display: grid;
    gap: 10px
}

.changeorder-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.changeorder-mobile-main {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: inherit;
    color: inherit
}

.changeorder-mobile-title {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.changeorder-mobile-amount {
    font-weight: 900;
    color: #8a6a45;
    white-space: nowrap
}

.changeorder-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .changeorder-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.changeorder-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .changeorder-mobile-actions .btn, .changeorder-mobile-actions form, .changeorder-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .changeorder-mobile-actions form {
        display: block
    }

    .changeorder-mobile-actions .btn, .changeorder-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.changeorders-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

.empty-mobile {
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: #fff;
    color: #64748b;
    padding: 16px;
    text-align: center
}

@media(max-width:767.98px) {
    .changeorders-card {
        padding: 12px !important
    }

    .changeorder-detail-grid {
        grid-template-columns: 1fr
    }

    .changeorder-detail-modal .modal-dialog {
        margin: 8px
    }

    .changeorder-detail-modal .modal-content {
        border-radius: 18px
    }

    .changeorder-detail-modal .modal-footer .btn {
        width: 100%
    }

    .changeorder-mobile-actions {
        grid-template-columns: 1fr 1fr
    }

    .changeorder-mobile-row {
        border-radius: 16px
    }

    .changeorders-actions {
        align-items: stretch
    }

        .changeorders-actions .btn {
            width: 100%
        }
}

@media(max-width:380px) {
    .changeorder-mobile-actions {
        grid-template-columns: 1fr
    }

    .changeorder-mobile-main {
        grid-template-columns: 1fr
    }

    .changeorder-mobile-amount {
        justify-self: start
    }
}

@media print {
    .changeorder-print-header {
        display: block !important
    }
}

/* v8.16 DailyNotes page mobile and modal polish */
.dailynote-open-link {
    text-decoration: none;
    color: #0f172a;
    text-align: inherit;
    border: 0;
    background: transparent;
    padding: 0
}

    .dailynote-open-link:hover {
        color: var(--primary)
    }

.dailynotes-table th, .dailynotes-table td {
    vertical-align: middle
}

.note-body-cell {
    max-width: 520px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.dailynote-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.dailynote-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.dailynote-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

.dailynote-print-header {
    display: none
}

.dailynotes-mobile-list {
    display: grid;
    gap: 10px
}

.dailynote-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.dailynote-mobile-main {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: start;
    text-align: inherit;
    color: inherit
}

.dailynote-mobile-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.dailynote-mobile-preview {
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.5;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.dailynote-mobile-date {
    font-weight: 900;
    color: #8a6a45;
    white-space: nowrap;
    font-size: 12px;
    background: #f6efe2;
    border: 1px solid #d7f5ee;
    border-radius: 999px;
    padding: 4px 8px
}

.dailynote-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .dailynote-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.dailynote-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .dailynote-mobile-actions .btn, .dailynote-mobile-actions form, .dailynote-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .dailynote-mobile-actions form {
        display: block
    }

    .dailynote-mobile-actions .btn, .dailynote-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.dailynotes-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:767.98px) {
    .dailynotes-card {
        padding: 12px !important
    }

    .dailynote-detail-grid {
        grid-template-columns: 1fr
    }

    .dailynote-detail-modal .modal-dialog {
        margin: 8px
    }

    .dailynote-detail-modal .modal-content {
        border-radius: 18px
    }

    .dailynote-detail-modal .modal-footer .btn {
        width: 100%
    }

    .dailynote-mobile-actions {
        grid-template-columns: 1fr 1fr
    }

    .dailynote-mobile-row {
        border-radius: 16px
    }

    .dailynotes-actions {
        align-items: stretch
    }

        .dailynotes-actions .btn {
            width: 100%
        }
}

@media(max-width:380px) {
    .dailynote-mobile-actions {
        grid-template-columns: 1fr
    }

    .dailynote-mobile-main {
        grid-template-columns: 1fr
    }

    .dailynote-mobile-date {
        justify-self: start
    }
}

@media print {
    .dailynote-print-header {
        display: block !important
    }
}

/* v8.17 Attachments page mobile and related-link polish */
.attachments-table th, .attachments-table td {
    vertical-align: middle
}

.related-link {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    color: #0f172a;
    text-decoration: none;
    max-width: 320px
}

    .related-link:hover {
        color: var(--primary)
    }

    .related-link .related-type {
        color: #64748b;
        font-size: 12px;
        font-weight: 800
    }

    .related-link strong {
        font-size: 13.5px;
        line-height: 1.45;
        word-break: break-word
    }

.attachments-mobile-list {
    display: grid;
    gap: 10px
}

.attachment-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.attachment-mobile-head {
    display: flex;
    gap: 10px;
    align-items: flex-start
}

.attachment-mobile-main {
    min-width: 0;
    flex: 1
}

.attachment-mobile-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.attachment-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 6px;
    color: #64748b;
    font-size: 12.5px
}

    .attachment-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px
    }

.attachment-related-chip {
    margin-top: 10px;
    border: 1px solid #d7f5ee;
    background: #f6efe2;
    color: #8a6a45;
    border-radius: 14px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    line-height: 1.35
}

    .attachment-related-chip:hover {
        border-color: #d8c39a;
        background: #e9dcc5;
        color: #8a6a45
    }

    .attachment-related-chip span {
        font-weight: 800;
        white-space: nowrap
    }

    .attachment-related-chip strong {
        font-size: 12.5px;
        color: #0f172a;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

.attachment-mobile-desc {
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.6;
    background: #faf7f2;
    border: 1px solid #f0e9dc;
    border-radius: 12px;
    padding: 8px
}

.attachment-mobile-actions {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .attachment-mobile-actions .btn, .attachment-mobile-actions form, .attachment-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .attachment-mobile-actions form {
        display: block
    }

    .attachment-mobile-actions .btn, .attachment-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.attachments-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:767.98px) {
    .attachments-card {
        padding: 12px !important
    }

    .attachments-actions {
        align-items: stretch
    }

        .attachments-actions .btn {
            width: 100%;
            border-radius: 14px
        }

    .attachment-mobile-actions {
        grid-template-columns: 1fr 1fr 1fr
    }

    .attachment-related-chip {
        align-items: flex-start
    }

        .attachment-related-chip strong {
            white-space: normal
        }

    .attachment-mobile-row {
        border-radius: 16px
    }
}

@media(max-width:380px) {
    .attachment-mobile-actions {
        grid-template-columns: 1fr
    }

    .attachment-mobile-head {
        align-items: flex-start
    }
}

/* v8.18 Reports dashboard */
.reports-actions {
    align-items: flex-start
}

    .reports-actions p {
        font-size: 13.5px
    }

.reports-hero {
    padding: 20px;
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: minmax(0,1.4fr) minmax(260px,.8fr);
    gap: 18px;
    align-items: stretch;
    overflow: hidden
}

.reports-hero-main .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f6efe2;
    color: #8a6a45;
    border: 1px solid #e9dcc5;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 900;
    font-size: 12px
}

.reports-hero-main h3 {
    font-size: 28px;
    font-weight: 900;
    margin: 10px 0 6px;
    color: #0f172a
}

.reports-hero-main p {
    color: #64748b;
    margin-bottom: 14px
}

.report-progress {
    height: 12px;
    border-radius: 999px;
    background: #e5edf5;
    overflow: hidden
}

    .report-progress .progress-bar {
        background: linear-gradient(90deg,#8a6a45,#14b8a6);
        border-radius: 999px
    }

.reports-hero-side {
    display: grid;
    gap: 10px
}

    .reports-hero-side > div {
        background: #faf7f2;
        border: 1px solid #f0e9dc;
        border-radius: 16px;
        padding: 12px
    }

    .reports-hero-side span {
        display: block;
        color: #64748b;
        font-size: 12px;
        font-weight: 800
    }

    .reports-hero-side strong {
        display: block;
        color: #0f172a;
        font-size: 17px;
        font-weight: 900;
        margin-top: 4px
    }

.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 12px;
    margin-bottom: 14px
}

.report-kpi {
    padding: 14px;
    display: grid;
    gap: 5px;
    min-height: 128px;
    position: relative;
    overflow: hidden
}

    .report-kpi i {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        background: #f6efe2;
        color: #8a6a45;
        display: inline-grid;
        place-items: center;
        font-size: 18px
    }

    .report-kpi span {
        color: #64748b;
        font-size: 12.5px;
        font-weight: 800
    }

    .report-kpi strong {
        font-size: 21px;
        color: #0f172a;
        font-weight: 900;
        line-height: 1.1
    }

    .report-kpi small {
        color: #94a3b8;
        font-weight: 700
    }

.report-alert-card {
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--line)
}

    .report-alert-card i {
        width: 42px;
        height: 42px;
        border-radius: 16px;
        display: grid;
        place-items: center;
        font-size: 20px;
        flex: 0 0 auto
    }

    .report-alert-card span {
        display: block;
        color: #64748b;
        font-size: 12px;
        font-weight: 800
    }

    .report-alert-card strong {
        font-size: 32px;
        font-weight: 900;
        color: #0f172a;
        display: block;
        line-height: 1
    }

    .report-alert-card p {
        margin: 5px 0 0;
        color: #64748b;
        font-size: 13px
    }

    .report-alert-card.ok i {
        background: #f6efe2;
        color: #8a6a45
    }

    .report-alert-card.warning i {
        background: #fff7ed;
        color: #c2410c
    }

    .report-alert-card.danger i {
        background: #fef2f2;
        color: #dc2626
    }

.report-chart-card {
    padding: 16px
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px
}

    .card-title-row h5 {
        font-weight: 900;
        margin: 0;
        color: #0f172a;
        font-size: 17px
    }

    .card-title-row span {
        background: #faf7f2;
        border: 1px solid #f0e9dc;
        border-radius: 999px;
        padding: 5px 9px;
        color: #64748b;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap
    }

.chart-wrap {
    height: 300px;
    position: relative
}

    .chart-wrap.wide {
        height: 320px
    }

.reports-table-card .table th {
    font-size: 12px;
    color: #64748b
}

.reports-table-card .table td {
    vertical-align: middle
}

.report-mini-progress {
    height: 8px;
    background: #f0e9dc;
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
    margin-bottom: 4px
}

    .report-mini-progress span {
        display: block;
        height: 100%;
        background: #8a6a45;
        border-radius: 999px
    }

.reports-mobile-list {
    display: grid;
    gap: 10px
}

.report-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    color: #0f172a
}

    .report-mobile-row:hover {
        color: #0f172a
    }

    .report-mobile-row.danger {
        border-color: #fecaca;
        background: #fffafa
    }

.report-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px
}

    .report-mobile-head strong {
        font-weight: 900;
        line-height: 1.35;
        word-break: break-word
    }

    .report-mobile-head span {
        font-weight: 900;
        color: #8a6a45;
        white-space: nowrap;
        background: #f6efe2;
        border: 1px solid #e9dcc5;
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 12px
    }

.report-mobile-row.danger .report-mobile-head span {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca
}

.report-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .report-mobile-meta span {
        background: #faf7f2;
        border: 1px solid #f0e9dc;
        border-radius: 999px;
        padding: 3px 8px
    }

.report-empty-mobile {
    background: #faf7f2;
    border: 1px dashed #d8e0ea;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    color: #64748b;
    font-weight: 800
}

@media(max-width:1199.98px) {
    .report-kpi-grid {
        grid-template-columns: repeat(2,minmax(0,1fr))
    }

    .reports-hero {
        grid-template-columns: 1fr
    }

    .chart-wrap, .chart-wrap.wide {
        height: 280px
    }
}

@media(max-width:767.98px) {
    .reports-actions {
        gap: 10px
    }

        .reports-actions .d-flex {
            width: 100%;
            display: grid !important;
            grid-template-columns: 1fr 1fr
        }

        .reports-actions .btn {
            width: 100%;
            border-radius: 14px
        }

    .reports-hero {
        padding: 14px;
        border-radius: 18px;
        gap: 12px
    }

    .reports-hero-main h3 {
        font-size: 20px
    }

    .reports-hero-main p {
        font-size: 13px
    }

    .reports-hero-side {
        grid-template-columns: 1fr
    }

        .reports-hero-side > div {
            padding: 10px
        }

        .reports-hero-side strong {
            font-size: 15px
        }

    .report-kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 9px
    }

    .report-kpi {
        padding: 11px;
        min-height: 116px;
        border-radius: 16px
    }

        .report-kpi i {
            width: 34px;
            height: 34px;
            border-radius: 12px
        }

        .report-kpi strong {
            font-size: 17px
        }

        .report-kpi span, .report-kpi small {
            font-size: 11.5px
        }

    .report-alert-card {
        border-radius: 16px;
        padding: 12px
    }

        .report-alert-card strong {
            font-size: 24px
        }

    .report-chart-card, .reports-table-card {
        padding: 12px !important;
        border-radius: 18px
    }

    .card-title-row {
        align-items: flex-start
    }

        .card-title-row h5 {
            font-size: 15.5px
        }

        .card-title-row span {
            font-size: 11.5px
        }

    .chart-wrap, .chart-wrap.wide {
        height: 250px
    }

    .reports-table-desktop {
        display: none !important
    }

    .report-mobile-row {
        border-radius: 16px
    }

    .report-mobile-head {
        flex-direction: row
    }

        .report-mobile-head span {
            font-size: 11.5px
        }

    .report-mobile-meta {
        font-size: 11.8px
    }

    .content-wrap {
        padding-bottom: 80px
    }
}

@media(max-width:380px) {
    .report-kpi-grid {
        grid-template-columns: 1fr
    }

    .reports-actions .d-flex {
        grid-template-columns: 1fr
    }

    .chart-wrap, .chart-wrap.wide {
        height: 230px
    }

    .report-mobile-head {
        flex-direction: column
    }

        .report-mobile-head span {
            align-self: flex-start
        }
}

@media print {
    .sidebar, .mobile-header, .mobile-page-title, .topbar, .page-actions .btn, .offcanvas {
        display: none !important
    }

    .app-shell {
        display: block
    }

    .main-content {
        padding: 0
    }

    .content-wrap {
        padding: 0
    }

    .clean-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important
    }

    .chart-wrap {
        height: 240px
    }

    .reports-table-desktop {
        display: block !important
    }

    .reports-mobile-list {
        display: none !important
    }
}

/* v8.19 Users page delete and mobile cards */
.users-table th, .users-table td {
    vertical-align: middle
}

.users-mobile-list {
    display: grid;
    gap: 10px
}

.user-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.user-mobile-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between
}

.user-mobile-main {
    min-width: 0;
    flex: 1
}

.user-mobile-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.user-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12.5px
}

    .user-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
        word-break: break-word
    }

.user-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
    margin-top: 10px
}

    .user-mobile-actions .btn, .user-mobile-actions form, .user-mobile-actions form button {
        width: 100%;
        margin: 0
    }

    .user-mobile-actions form {
        display: block
    }

    .user-mobile-actions .btn, .user-mobile-actions button {
        border-radius: 12px;
        font-weight: 800;
        min-height: 36px
    }

.users-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:991.98px) {
    .users-card {
        padding: 12px !important
    }

    .users-actions {
        align-items: stretch
    }

        .users-actions .d-flex {
            width: 100%;
            display: grid !important;
            grid-template-columns: 1fr 1fr
        }

        .users-actions .btn {
            width: 100%;
            border-radius: 14px;
            font-weight: 800
        }

    .user-mobile-row {
        border-radius: 16px
    }

    .user-mobile-head > .badge {
        flex: 0 0 auto
    }

    .user-mobile-actions {
        grid-template-columns: 1fr 1fr
    }
}

@media(max-width:380px) {
    .users-actions .d-flex, .user-mobile-actions {
        grid-template-columns: 1fr
    }

    .user-mobile-head {
        flex-direction: column
    }

        .user-mobile-head > .badge {
            align-self: flex-start
        }
}

/* v8.20 - Audit logs mobile cards */
.auditlogs-table th, .auditlogs-table td {
    vertical-align: middle
}

.auditlogs-mobile-list {
    display: grid;
    gap: 10px
}

.auditlog-mobile-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
    overflow: hidden
}

.auditlog-mobile-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start
}

.auditlog-mobile-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word
}

.auditlog-mobile-date {
    margin-top: 5px;
    color: #64748b;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 5px
}

.auditlog-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
    color: #64748b;
    font-size: 12.5px
}

    .auditlog-mobile-meta span {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #faf7f2;
        border: 1px solid #f0e9dc;
        border-radius: 999px;
        padding: 3px 8px;
        max-width: 100%;
        word-break: break-word
    }

.auditlog-mobile-details {
    margin-top: 9px;
    color: #334155;
    font-size: 13px;
    line-height: 1.6;
    background: #faf7f2;
    border: 1px solid #f0e9dc;
    border-radius: 12px;
    padding: 9px;
    word-break: break-word
}

.auditlogs-card .mobile-list-search {
    min-height: 44px;
    border-radius: 14px
}

@media(max-width:991.98px) {
    .auditlogs-card {
        padding: 12px !important
    }

    .auditlogs-header {
        align-items: flex-start !important
    }

    .auditlog-mobile-head > .badge {
        flex: 0 0 auto;
        max-width: 45%;
        white-space: normal;
        text-align: center;
        line-height: 1.35
    }
}

/* v8.21 - multi file upload inputs */
.multi-file-field {
    background: #faf7f2;
    border: 1px solid #f0e9dc;
    border-radius: 16px;
    padding: 12px
}

.multi-file-upload {
    display: grid;
    gap: 8px
}

.multi-file-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto;
    gap: 8px;
    align-items: center
}

    .multi-file-row .form-control {
        min-height: 44px;
        border-radius: 12px
    }

.multi-file-remove, .js-camera-btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    padding: 0
}

.js-add-file-row {
    border-radius: 999px;
    font-weight: 800
}

.multi-file-row.is-filled .form-control {
    border-color: #d8c39a;
    background: #f6efe2
}

@media(max-width:575.98px) {
    .multi-file-field {
        padding: 10px;
        border-radius: 14px
    }

    .multi-file-row {
        grid-template-columns: 1fr 40px 40px
    }

    .multi-file-remove, .js-camera-btn-icon {
        width: 40px;
        height: 40px
    }

    .js-add-file-row {
        width: 100%;
        min-height: 40px
    }
}

/* v8.22 - Budget item detail modals + final login */
.detail-mobile-open {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    text-align: inherit;
    color: inherit;
    display: block
}

    .detail-mobile-open:hover strong, .detail-mobile-open:hover span {
        color: var(--primary)
    }

.detail-modal-grid, .quote-detail-grid, .contract-detail-grid, .changeorder-detail-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px
}

    .detail-modal-grid > div, .quote-detail-grid > div, .contract-detail-grid > div, .changeorder-detail-grid > div {
        background: #faf7f2;
        border: 1px solid #e5edf5;
        border-radius: 14px;
        padding: 10px 12px
    }

    .detail-modal-grid span, .quote-detail-grid span, .contract-detail-grid span, .changeorder-detail-grid span {
        display: block;
        color: #64748b;
        font-size: 12px;
        font-weight: 700
    }

    .detail-modal-grid strong, .quote-detail-grid strong, .contract-detail-grid strong, .changeorder-detail-grid strong {
        display: block;
        color: #0f172a;
        font-size: 15px;
        margin-top: 3px;
        word-break: break-word
    }

.quote-detail-modal .modal-content, .contract-detail-modal .modal-content, .changeorder-detail-modal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden
}

.quote-detail-modal .modal-header, .contract-detail-modal .modal-header, .changeorder-detail-modal .modal-header {
    background: #faf7f2;
    border-bottom: 1px solid #e5edf5
}

.quote-detail-modal .modal-footer, .contract-detail-modal .modal-footer, .changeorder-detail-modal .modal-footer {
    border-top: 1px solid #e5edf5
}

.contract-open-link, .changeorder-open-link {
    text-decoration: none;
    color: #0f172a;
    text-align: inherit
}

    .contract-open-link:hover, .changeorder-open-link:hover {
        color: var(--primary)
    }

@media(max-width:767.98px) {
    .detail-modal-grid, .quote-detail-grid, .contract-detail-grid, .changeorder-detail-grid {
        grid-template-columns: 1fr
    }

    .quote-detail-modal .modal-dialog, .contract-detail-modal .modal-dialog, .changeorder-detail-modal .modal-dialog {
        margin: 8px
    }

    .quote-detail-modal .modal-content, .contract-detail-modal .modal-content, .changeorder-detail-modal .modal-content {
        border-radius: 18px
    }

    .quote-detail-modal .modal-footer .btn, .contract-detail-modal .modal-footer .btn, .changeorder-detail-modal .modal-footer .btn {
        width: 100%
    }

    .detail-mobile-open .row-main, .detail-mobile-open .row-meta {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px
    }
}

/* شريط تنبيه الدفعات المتأخرة/المستحقة - يظهر أعلى الداشبورد */
.payment-alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(15,23,42,.06);
    border: 1px solid transparent
}

    .payment-alert-banner.is-upcoming {
        background: #fffbeb;
        border-color: #fde68a
    }

    .payment-alert-banner.is-late {
        background: #fef2f2;
        border-color: #fecaca
    }

.payment-alert-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px
}

.payment-alert-banner.is-upcoming .payment-alert-icon {
    background: #fef3c7;
    color: #b45309
}

.payment-alert-banner.is-late .payment-alert-icon {
    background: #fee2e2;
    color: #b91c1c
}

.payment-alert-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px
}

    .payment-alert-text strong {
        font-size: 15px;
        color: #0f172a
    }

.payment-alert-banner.is-late .payment-alert-text strong {
    color: #991b1b
}

.payment-alert-text span {
    font-size: 12.5px;
    color: #64748b
}

.payment-alert-arrow {
    color: #94a3b8;
    font-size: 18px
}

@media(max-width:560px) {
    .payment-alert-banner {
        padding: 12px 14px;
        border-radius: 16px
    }

    .payment-alert-icon {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        font-size: 18px
    }

    .payment-alert-text strong {
        font-size: 14px
    }
}

/* تعديلات طلبها المستخدم: تاريخين بصف واحد + زرين بصف واحد بفلتر الداشبورد */
@media(max-width:767.98px) {
    .dashboard-filter-card .row > .col-6 {
        width: 50% !important
    }

    .dashboard-filter-card .row > .col-12.d-flex {
        flex-wrap: nowrap !important;
        gap: 8px !important
    }

        .dashboard-filter-card .row > .col-12.d-flex .btn {
            width: 50% !important;
            flex: 1 1 0;
            white-space: nowrap;
            padding-inline: 6px;
            font-size: 13.5px
        }
}

@media(max-width:380px) {
    .dashboard-filter-card .row > .col-12.d-flex .btn {
        font-size: 12px;
        padding-inline: 4px
    }
}

/* بطاقتين إحصائيات بصف واحد حتى على الجوالات الصغيرة (بدل عمود واحد) */
@media(max-width:560px) {
    .stat-strip {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px
    }

    .kpi-card {
        padding: 14px !important
    }

        .kpi-card .label {
            font-size: 12px
        }

        .kpi-card .value {
            font-size: 16.5px !important;
            line-height: 1.3
        }

        .kpi-card .icon {
            width: 36px;
            height: 36px;
            font-size: 18px
        }
}

/* عرض 3 بنود فقط بالجوال مع زر عرض المزيد بدل قائمة طويلة */
.budget-mobile-row.is-hidden-extra, .js-reveal-row.is-hidden-extra {
    display: none !important
}

.budget-summary-mobile .js-budget-show-more {
    width: 100%;
    margin-top: 10px
}

/* ===== شريط تنقل سفلي بأسلوب التطبيقات (Bottom Tab Bar) ===== */
.mobile-header-avatar {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    font-family: inherit;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform .15s ease,background .15s ease
}

    .mobile-header-avatar:focus {
        outline: none
    }

    .mobile-header-avatar:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px
    }

    .mobile-header-avatar:active {
        transform: scale(.9);
        background: rgba(255,255,255,.24)
    }

.bottom-tab-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1035;
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: center;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(36,28,20,.08);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)) 6px;
    transition: opacity .15s ease,visibility .15s ease;
}

.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    border-radius: 14px;
    transition: color .18s ease,transform .12s ease;
}

    .bottom-tab-item:active {
        transform: scale(.9)
    }

.bottom-tab-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1)
}

.bottom-tab-item.active {
    color: var(--primary)
}

    .bottom-tab-item.active .bottom-tab-icon {
        transform: translateY(-2px) scale(1.12)
    }

.bottom-tab-label {
    transition: opacity .18s ease
}

.bottom-tab-fab-wrap {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    top: -16px
}

.bottom-tab-fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg,var(--primary),var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 10px 22px rgba(138,106,69,.45);
    border: 4px solid var(--bg);
    transition: transform .15s cubic-bezier(.34,1.56,.64,1);
}

.bottom-tab-fab-wrap:active .bottom-tab-fab {
    transform: scale(.88) rotate(90deg)
}

#mobileMenu.show ~ .bottom-tab-bar, #mobileMenu.showing ~ .bottom-tab-bar {
    opacity: 0;
    visibility: hidden;
    pointer-events: none
}

@media(max-width:991.98px) {
    .content-wrap {
        padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important
    }
}

/* ===== أزرار إجراءات البطاقات: أيقونات فقط بصف واحد بدل نص كامل بعدة أسطر ===== */
.payment-mobile-actions,
.contract-mobile-actions,
.dailynote-mobile-actions,
.quote-mobile-actions,
.changeorder-mobile-actions,
.attachment-mobile-actions,
.contractor-mobile-actions,
.user-mobile-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    gap: 6px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin-top: 10px;
}

    .payment-mobile-actions .btn,
    .contract-mobile-actions .btn,
    .dailynote-mobile-actions .btn,
    .quote-mobile-actions .btn,
    .changeorder-mobile-actions .btn,
    .attachment-mobile-actions .btn,
    .contractor-mobile-actions .btn,
    .user-mobile-actions .btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px !important;
        height: 40px;
        min-height: 40px;
        padding: 0 !important;
        border-radius: 12px;
        font-size: 16.5px;
        flex: 0 0 auto !important;
    }

    .payment-mobile-actions form,
    .contract-mobile-actions form,
    .dailynote-mobile-actions form,
    .quote-mobile-actions form,
    .changeorder-mobile-actions form,
    .attachment-mobile-actions form,
    .contractor-mobile-actions form,
    .user-mobile-actions form {
        flex: 0 0 auto !important;
    }

    .payment-mobile-actions .btn-text,
    .contract-mobile-actions .btn-text,
    .dailynote-mobile-actions .btn-text,
    .quote-mobile-actions .btn-text,
    .changeorder-mobile-actions .btn-text,
    .attachment-mobile-actions .btn-text,
    .contractor-mobile-actions .btn-text,
    .user-mobile-actions .btn-text {
        display: none
    }

@media(max-width:380px) {
    .payment-mobile-actions .btn,
    .contract-mobile-actions .btn,
    .dailynote-mobile-actions .btn,
    .quote-mobile-actions .btn,
    .changeorder-mobile-actions .btn,
    .attachment-mobile-actions .btn,
    .contractor-mobile-actions .btn,
    .user-mobile-actions .btn {
        width: 36px !important;
        height: 36px;
        font-size: 15px
    }
}

/* ===== Loader عام عند التنقل بين الصفحات ===== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(246,242,236,.82);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease,visibility .18s ease;
}

    .page-loader.is-active {
        opacity: 1;
        visibility: visible
    }

.page-loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: #fff;
    padding: 22px 30px;
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(36,28,20,.18);
}

.page-loader-spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 4px solid var(--soft);
    border-top-color: var(--primary);
    animation: page-loader-spin .7s linear infinite;
}

@keyframes page-loader-spin {
    to {
        transform: rotate(360deg)
    }
}

/* ===== أيقونات رأس الجوال (بحث + حساب) ===== */
.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

/* ===== صفحة البحث الشامل ===== */
.search-box-card .input-group-text {
    background: #faf7f2;
    border-color: #e2d8c8
}

.search-results-summary {
    color: var(--muted);
    font-size: 13px;
    padding: 0 4px
}

.search-section h6 {
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px
}

.search-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    margin-bottom: 7px;
    color: var(--text);
    background: #fff;
    transition: border-color .15s ease,background .15s ease
}

    .search-result-row:last-child {
        margin-bottom: 0
    }

    .search-result-row:hover, .search-result-row:active {
        border-color: #d8c39a;
        background: #f6efe2
    }

    .search-result-row span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 700
    }

    .search-result-row strong {
        white-space: nowrap;
        color: var(--primary);
        font-size: 13px;
        flex: 0 0 auto
    }

/* ===== تكبير حقول الإدخال والأزرار على الجوال (سهولة أكبر باللمس بالإبهام) ===== */
@media(max-width:767.98px) {
    .form-control, .form-select {
        min-height: 46px;
        font-size: 16px
    }

    textarea.form-control {
        min-height: 90px
    }

    .btn {
        min-height: 44px
    }

    .btn-sm {
        min-height: 36px
    }

    .form-check-input {
        width: 1.25em;
        height: 1.25em
    }

    .input-group-text {
        font-size: 16px
    }
}

/* ===== شريط طلب تفعيل تنبيهات الدفعات ===== */
.notify-permission-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 16px;
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 13.5px;
    color: #78350f
}

    .notify-permission-banner i {
        color: #b45309;
        font-size: 17px
    }

    .notify-permission-banner span {
        flex: 1;
        min-width: 160px
    }

/* ===== لوحة البحث الفوري المنبثقة ===== */
.quick-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(28,19,13,.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease,visibility .18s ease;
    padding-top: calc(70px + env(safe-area-inset-top));
}

    .quick-search-overlay.is-active {
        opacity: 1;
        visibility: visible
    }

body.quick-search-open {
    overflow: hidden
}

.quick-search-panel {
    width: min(560px,94vw);
    max-height: 78vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 30px 70px rgba(0,0,0,.35);
    overflow: hidden;
    transform: translateY(-14px);
    transition: transform .18s ease;
}

.quick-search-overlay.is-active .quick-search-panel {
    transform: translateY(0)
}

.quick-search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line)
}

    .quick-search-input-row i {
        color: var(--muted);
        font-size: 18px
    }

    .quick-search-input-row input {
        flex: 1;
        border: 0;
        outline: 0;
        font-size: 16px;
        font-family: inherit;
        background: transparent
    }

.quick-search-close {
    border: 0;
    background: var(--soft);
    color: var(--primary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto
}

.quick-search-results {
    overflow-y: auto;
    padding: 10px
}

.quick-search-hint {
    color: var(--muted);
    text-align: center;
    padding: 26px 10px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px
}

    .quick-search-hint i {
        font-size: 26px
    }

.quick-search-group-label {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--muted);
    padding: 8px 8px 4px
}

.quick-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 13px;
    color: var(--text)
}

    .quick-search-row:hover, .quick-search-row:active {
        background: #f6efe2
    }

.quick-search-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 16px
}

.quick-search-text {
    min-width: 0;
    display: flex;
    flex-direction: column
}

    .quick-search-text strong {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .quick-search-text small {
        color: var(--muted);
        font-size: 12px
    }

.quick-search-more {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 12px;
    margin-top: 6px;
    border-top: 1px solid var(--line);
    color: var(--primary);
    font-weight: 800;
    font-size: 13.5px
}

/* ===== صفحة حسابي ===== */
.my-account-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex: 0 0 auto
}

.my-account-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

    .my-account-info-grid > div {
        background: #faf7f2;
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 11px 13px
    }

    .my-account-info-grid span {
        display: block;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 3px
    }

    .my-account-info-grid strong {
        font-size: 14px
    }

@media(max-width:360px) {
    .my-account-info-grid {
        gap: 8px
    }

        .my-account-info-grid > div {
            padding: 10px 12px
        }
}

/* بطاقات ملخص الفترة الثلاث بصف واحد دائماً - شبكة CSS مستقلة بدل نظام أعمدة Bootstrap
   عشان نضمن 3 أعمدة متساوية بالضبط بدون أي تأثير من هوامش/حشو Bootstrap */
.dashboard-filter-card .mini-stat-row.row {
    display: grid !important;
    grid-template-columns: repeat(3,minmax(0,1fr)) !important;
    gap: 8px !important;
    margin: 0 !important;
}

    .dashboard-filter-card .mini-stat-row.row > [class*="col-"] {
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

.dashboard-filter-card .mini-stat {
    height: 100%
}

@media(max-width:560px) {
    .mini-stat-row {
        gap: 6px !important
    }

    .mini-stat {
        padding: 9px 4px;
        border-radius: 13px;
        text-align: center
    }

        .mini-stat span {
            font-size: 10px;
            line-height: 1.25;
            margin-bottom: 3px;
            display: block
        }

        .mini-stat strong {
            font-size: 11.5px;
            display: block;
            word-break: break-word;
            line-height: 1.3
        }
}

@media(max-width:340px) {
    .mini-stat span {
        font-size: 9px
    }

    .mini-stat strong {
        font-size: 10.5px
    }
}

/* بادجات مختصرة لبطاقة البند بالجوال (ميزانية/مدفوع/متبقي بصف واحد) */
.budget-mobile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0
}

.b-badge {
    background: #faf7f2;
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 4px 9px;
    font-size: 11px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap
}

    .b-badge b {
        color: var(--text);
        font-weight: 800;
        font-size: 11.5px
    }

.b-badge-paid {
    background: var(--soft);
    border-color: #e9dcc5
}

    .b-badge-paid b {
        color: var(--primary)
    }

.b-badge-danger {
    background: #fef2f2;
    border-color: #fecaca
}

    .b-badge-danger b {
        color: #dc2626
    }

/* توسيط كل أزرار "عرض المزيد" */
.js-reveal-more, .js-reveal-more-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-inline: auto;
    width: max-content;
    min-width: 150px
}

/* تنظيم العمود الجانبي بالكمبيوتر بدون فراغات */
.dashboard-side-stack {
    display: flex;
    flex-direction: column;
    gap: 16px
}

    .dashboard-side-stack .clean-card {
        margin-bottom: 0 !important
    }

/* ===== لوحة الإضافة السريعة (زر +) ===== */
.quick-add-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(28,19,13,.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease,visibility .18s ease;
}

    .quick-add-overlay.is-active {
        opacity: 1;
        visibility: visible
    }

.quick-add-sheet {
    width: min(480px,100%);
    background: #fff;
    border-radius: 26px 26px 0 0;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 50px rgba(0,0,0,.3);
    transform: translateY(16px);
    transition: transform .2s ease;
}

.quick-add-overlay.is-active .quick-add-sheet {
    transform: translateY(0)
}

.quick-add-handle {
    width: 40px;
    height: 5px;
    background: var(--line);
    border-radius: 99px;
    margin: 6px auto 14px
}

.quick-add-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 10px;
    border-radius: 16px;
    color: var(--text);
    font-weight: 800
}

    .quick-add-row:hover, .quick-add-row:active {
        background: #f6efe2
    }

.quick-add-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex: 0 0 auto
}

/* إصلاح: قاعدة توسيط عرض المزيد كانت تفرض display:flex!important دائماً،
   فتغلب على d-none عند الإخفاء. هذي القاعدة أقوى تخصيصاً فتضمن الإخفاء فعلياً. */
.js-reveal-more.d-none, .js-reveal-more-link.d-none {
    display: none !important
}

/* إزالة مربع التركيز الافتراضي القبيح من زر + وأزرار الشريط السفلي،
   مع إبقاء حلقة تركيز لطيفة لدواعي الوصولية عند التنقل بلوحة المفاتيح فقط */
.bottom-tab-fab-wrap, .bottom-tab-item {
    -webkit-tap-highlight-color: transparent;
    outline: none
}

    .bottom-tab-fab-wrap:focus, .bottom-tab-item:focus {
        outline: none
    }

    .bottom-tab-fab-wrap:focus-visible, .bottom-tab-item:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 3px
    }

/* صف العنوان + شارة النوع/الأولوية بصفحة تفاصيل البند */
.detail-hero-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

    .detail-hero-title-row h2 {
        margin: 0
    }

    .detail-hero-title-row .badge {
        font-size: 12px;
        white-space: nowrap
    }

/* ===== واجهة تصوير المستندات بإطار توجيه (Scan) ===== */
.scan-camera-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease,visibility .18s ease;
}

    .scan-camera-overlay.is-active {
        opacity: 1;
        visibility: visible
    }

    .scan-camera-overlay video {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover
    }

.scan-frame-guide {
    position: relative;
    width: min(86vw,420px);
    height: min(60vh,560px);
    box-shadow: 0 0 0 2000px rgba(0,0,0,.55);
    border-radius: 18px;
}

.scan-corner {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 4px solid #fff;
    border-radius: 6px
}

    .scan-corner.tl {
        top: -2px;
        left: -2px;
        border-left-width: 4px;
        border-top-width: 4px;
        border-bottom: 0;
        border-right: 0
    }

    .scan-corner.tr {
        top: -2px;
        right: -2px;
        border-right-width: 4px;
        border-top-width: 4px;
        border-bottom: 0;
        border-left: 0
    }

    .scan-corner.bl {
        bottom: -2px;
        left: -2px;
        border-left-width: 4px;
        border-bottom-width: 4px;
        border-top: 0;
        border-right: 0
    }

    .scan-corner.br {
        bottom: -2px;
        right: -2px;
        border-right-width: 4px;
        border-bottom-width: 4px;
        border-top: 0;
        border-left: 0
    }

.scan-camera-hint {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    right: 0;
    left: 0;
    text-align: center;
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,.6);
    padding: 0 24px;
}

.scan-camera-controls {
    position: absolute;
    bottom: calc(30px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 36px;
}

.scan-side-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    color: #fff;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.scan-capture-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: transparent;
    border: 4px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

    .scan-capture-btn span {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #fff;
        transition: transform .12s ease
    }

    .scan-capture-btn:active span {
        transform: scale(.85)
    }


/* ===== جعل كل زوج من حقول النص/القوائم المنسدلة بصف واحد على الجوال (توفير مساحة) ===== */
@media(max-width:767.98px) {
    form.row > [class*="col-md-"]:not([class*="col-md-12"]):not(:has(textarea)):not(.multi-file-field),
    form .row > [class*="col-md-"]:not([class*="col-md-12"]):not(:has(textarea)):not(.multi-file-field) {
        width: 50% !important;
    }
}

/* ===== صفحة تسجيل الدخول - تصميم كامل الشاشة (نصفين حقيقيين بدون فراغات ميتة) ===== */
/* شريط حالة ضغط الفيديو تحت خانة الملف */
.multi-file-row {
    position: relative
}

.multi-file-video-status {
    grid-column: 1 / -1;
    font-size: 11.5px;
    font-weight: 800;
    color: var(--primary);
    background: var(--soft);
    border-radius: 10px;
    padding: 6px 10px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .multi-file-video-status::before {
        content: "";
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 2px solid #e2d8c8;
        border-top-color: var(--primary);
        animation: page-loader-spin .7s linear infinite;
        flex: 0 0 auto;
    }

/* تلوين متبادل لصفوف ملخص البنود (سطح المكتب والجوال) لتسهيل القراءة */
#budgetSummaryTable tbody tr:nth-child(even) {
    background: #faf7f2
}

#budgetSummaryTable tbody tr:hover {
    background: #f6efe2
}

.budget-mobile-row:nth-child(even) {
    background: #faf7f2
}

    .budget-mobile-row:nth-child(even):hover {
        background: #f2e9d8
    }

/* صف "آخر الملفات" بالداشبورد - اسم الملف + نوعه/اسم المرتبط به + التاريخ بصف واحد مضغوط */
.dash-attach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease,background .15s ease;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box
}

    .dash-attach-item:hover, .dash-attach-item:active {
        border-color: #d8c39a;
        background: #f6efe2
    }

.dash-attach-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex: 0 0 auto
}

.dash-attach-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px
}

    .dash-attach-text strong {
        font-size: 13.5px;
        font-weight: 800;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .dash-attach-text small {
        font-size: 11.5px;
        color: var(--muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

.dash-attach-arrow {
    color: #94a3b8;
    font-size: 15px;
    flex: 0 0 auto
}

/* ===== نافذة معاينة الملفات الموحدة ===== */
.file-preview-modal-content {
    border-radius: 22px;
    overflow: hidden;
    border: 0
}

    .file-preview-modal-content .modal-header {
        background: #faf7f2;
        border-bottom: 1px solid var(--line)
    }

#filePreviewModalBody {
    min-height: 200px;
    max-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #0f0d0b;
    overflow: auto
}

.file-preview-img {
    max-width: 100%;
    max-height: 72vh;
    display: block;
    margin: auto;
    object-fit: contain
}

.file-preview-frame {
    width: 100%;
    height: 72vh;
    border: 0;
    background: #fff
}

.file-preview-video {
    max-width: 100%;
    max-height: 72vh;
    display: block;
    margin: auto;
    background: #000
}

.file-preview-loading {
    position: absolute;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px
}

.file-preview-fallback {
    padding: 60px 30px;
    text-align: center;
    color: #f3ece0;
    background: #241c14;
    width: 100%
}

    .file-preview-fallback i {
        font-size: 52px;
        color: #c9a06b;
        margin-bottom: 16px;
        display: block
    }

    .file-preview-fallback p {
        margin: 0;
        line-height: 1.8;
        font-size: 14px
    }

@media(max-width:575.98px) {
    #filePreviewModalBody {
        min-height: 160px
    }

    .file-preview-img, .file-preview-frame, .file-preview-video {
        max-height: 60vh
    }

    .file-preview-frame {
        height: 60vh
    }
}

/* تلوين متبادل لصفوف صفحة البنود (سطح المكتب والجوال) */
.budget-items-table tbody tr:nth-child(even) {
    background: #faf7f2
}

.budget-items-table tbody tr:hover {
    background: #f6efe2
}

.budget-item-mobile-row:nth-child(even) {
    background: #faf7f2
}

    .budget-item-mobile-row:nth-child(even):hover {
        background: #f2e9d8
    }

/* إصلاح تداخل نوافذ التفاصيل مع منطقة الأمان العلوية/السفلية بالجوال (الشق/شريط الحالة)
   وإبقاء بطاقات التفاصيل بعمودين بصف واحد لتوفير المساحة */
.payment-detail-modal .modal-dialog,
.contract-detail-modal .modal-dialog,
.quote-detail-modal .modal-dialog,
.changeorder-detail-modal .modal-dialog,
.dailynote-detail-modal .modal-dialog {
    margin-top: calc(8px + env(safe-area-inset-top));
    margin-bottom: calc(8px + env(safe-area-inset-bottom));
}

@media(max-width:767.98px) {
    .payment-detail-modal .modal-content,
    .contract-detail-modal .modal-content,
    .quote-detail-modal .modal-content,
    .changeorder-detail-modal .modal-content,
    .dailynote-detail-modal .modal-content {
        max-height: calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
    }

    .payment-detail-modal .modal-body,
    .contract-detail-modal .modal-body,
    .quote-detail-modal .modal-body,
    .changeorder-detail-modal .modal-body,
    .dailynote-detail-modal .modal-body {
        overflow-y: auto;
    }

    .payment-detail-modal .modal-footer,
    .contract-detail-modal .modal-footer,
    .quote-detail-modal .modal-footer,
    .changeorder-detail-modal .modal-footer,
    .dailynote-detail-modal .modal-footer {
        padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
    }

    .payment-detail-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important
    }

        .payment-detail-grid > div {
            padding: 9px 10px
        }

        .payment-detail-grid span {
            font-size: 11px
        }

        .payment-detail-grid strong {
            font-size: 13.5px
        }
}

/* معاينة صورة المشروع بصفحة الإعدادات */
.project-cover-preview {
    width: 100%;
    max-width: 360px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--line)
}

    .project-cover-preview img {
        width: 100%;
        height: 180px;
        object-fit: cover;
        display: block
    }



/* صفحة تنظيف قاعدة البيانات: تحديد عرض معقول لفورم التأكيد بدل ما يمتد لعرض الشاشة كامل */
.maintenance-confirm-form {
    max-width: 520px
}

/* ===== Toast تلقائي الاختفاء (يستبدل صناديق التنبيه الثابتة القديمة) ===== */
.app-toast-stack {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 2300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    padding: 0 14px;
}

.app-toast {
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #241c14;
    color: #fff;
    border-radius: 16px;
    padding: 13px 18px;
    box-shadow: 0 16px 34px rgba(0,0,0,.28);
    max-width: min(420px,100%);
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(-16px) scale(.96);
    transition: opacity .22s ease,transform .22s cubic-bezier(.34,1.56,.64,1);
}

    .app-toast.is-visible {
        opacity: 1;
        transform: translateY(0) scale(1)
    }

    .app-toast.is-leaving {
        opacity: 0;
        transform: translateY(-10px) scale(.97)
    }

    .app-toast i {
        font-size: 18px;
        flex: 0 0 auto
    }

.app-toast-success i {
    color: #4ade80
}

.app-toast-warning {
    background: #3a2a12
}

    .app-toast-warning i {
        color: #fbbf24
    }

/* تم تعطيل View Transitions بين الصفحات لأنها تتعارض مع الرجوع التلقائي
   بعد إغلاق نوافذ التفاصيل، وقد تعيد صفحة البحث بلقطة غير مكتملة. */

/* مؤشر خلف التبويب النشط بالشريط السفلي. */
.bottom-tab-indicator {
    align-self: center;
    justify-self: center;
    width: 64px;
    height: 44px;
    border-radius: 16px;
    background: var(--soft);
    pointer-events: none;
}

/* ===== مؤشر السحب للتحديث (Pull to Refresh) ===== */
.pull-refresh-indicator {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: visible;
    margin-bottom: -1px;
    pointer-events: none;
}

.pull-refresh-spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 8px 20px rgba(36,28,20,.16);
    opacity: 0;
    transform: translateY(-10px) scale(.7);
    transition: opacity .15s ease,transform .15s ease;
}

.pull-refresh-indicator.is-active .pull-refresh-spinner {
    opacity: 1;
    transform: translateY(0) scale(1)
}

.pull-refresh-indicator.is-ready .pull-refresh-spinner {
    color: #fff;
    background: var(--primary)
}

.pull-refresh-indicator.is-refreshing .pull-refresh-spinner {
    animation: page-loader-spin .6s linear infinite;
    color: #fff;
    background: var(--primary)
}

/* ===== صفحة تسجيل الدخول - تصميم مبسّط وموثوق (نصفين حقيقيين بدون clip-path) ===== */
.final-login-body {
    min-height: 100vh;
    background: var(--bg);
    margin: 0
}

.final-login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: stretch
}

.final-login-visual {
    position: relative;
    overflow: hidden;
    background-color: #241c14;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 44px;
    min-height: 100vh;
}

.final-login-badge {
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 800;
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    font-size: 14px;
}

.final-login-visual-bottom h2 {
    color: #fff;
    font-size: 30px;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 0 2px 14px rgba(0,0,0,.4)
}

.final-login-visual-bottom p {
    color: #f3ece0;
    font-size: 15px;
    line-height: 1.8;
    max-width: 440px;
    margin: 0 0 20px
}

.final-login-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

    .final-login-summary > div {
        background: rgba(255,255,255,.12);
        border: 1px solid rgba(255,255,255,.24);
        border-radius: 18px;
        padding: 13px 16px;
        color: #fff;
        backdrop-filter: blur(10px);
        flex: 1;
        min-width: 140px
    }

    .final-login-summary span {
        display: flex;
        align-items: center;
        gap: 6px;
        color: #f3ece0;
        font-size: 12px;
        font-weight: 800
    }

    .final-login-summary strong {
        display: block;
        font-size: 17px;
        margin-top: 5px
    }

.final-login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: var(--bg);
    min-height: 100vh;
}

.final-login-panel-inner {
    width: 100%;
    max-width: 380px
}

.final-login-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 30px;
    margin-bottom: 20px
}

.final-login-panel h1 {
    font-weight: 900;
    font-size: 30px;
    color: var(--text);
    margin: 0 0 6px
}

.final-login-panel p {
    color: var(--muted);
    margin: 0 0 28px;
    line-height: 1.7
}

.final-login-form .form-label {
    font-weight: 800;
    color: #334155
}

.final-login-form .input-group-text {
    background: #fff;
    border-color: #e2d8c8
}

.final-login-form .form-control, .final-login-form .input-group-text {
    border-radius: 14px;
    border-color: #e2d8c8
}

.final-login-form .input-group .input-group-text {
    border-radius: 14px 0 0 14px
}

.final-login-form .input-group .form-control {
    border-radius: 0 14px 14px 0
}

.final-login-submit {
    min-height: 54px;
    border-radius: 16px;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(138,106,69,.35)
}

@media(max-width:991.98px) {
    .final-login-shell {
        grid-template-columns: 1fr;
        min-height: auto
    }

    .final-login-visual {
        min-height: min(32vh,240px);
        padding: 20px 20px 26px
    }

    .final-login-badge {
        font-size: 12.5px;
        padding: 8px 13px
    }

    .final-login-visual-bottom h2 {
        font-size: 21px;
        margin-bottom: 4px
    }

    .final-login-summary > div {
        padding: 9px 12px;
        min-width: 110px
    }

    .final-login-summary strong {
        font-size: 14px
    }

    .final-login-panel {
        min-height: auto;
        margin-top: -20px;
        border-radius: 24px 24px 0 0;
        position: relative;
        z-index: 2;
        padding: 22px 16px calc(20px + env(safe-area-inset-bottom));
        box-shadow: 0 -14px 30px rgba(0,0,0,.1);
    }

    .final-login-panel-inner {
        max-width: none
    }

    .final-login-logo {
        width: 44px;
        height: 44px;
        font-size: 20px;
        border-radius: 14px;
        margin-bottom: 10px
    }

    .final-login-panel h1 {
        font-size: 20px;
        margin-bottom: 3px
    }

    .final-login-panel p {
        font-size: 13px;
        margin-bottom: 14px
    }

    .final-login-form .form-control, .final-login-form .input-group-text {
        padding-top: .55rem;
        padding-bottom: .55rem
    }

    .final-login-form .input-group-lg > .form-control, .final-login-form .input-group-lg > .input-group-text {
        font-size: 1rem;
        min-height: 44px
    }

    .final-login-form .mb-3 {
        margin-bottom: .65rem !important
    }

    .final-login-form .mb-4 {
        margin-bottom: .85rem !important
    }

    .final-login-submit {
        min-height: 46px
    }
}

@media(max-width:380px) {
    .final-login-visual {
        min-height: min(26vh,200px)
    }
}

/* ===== إصلاح شامل لكل بطاقات الفلاتر بالجوال (تاريخ/قوائم منسدلة) =====
   بيطبق تلقائياً على أي بطاقة اسمها ينتهي بـ filter-card (فلتر الداشبورد،
   الدفعات، عروض الأسعار، التغييرات، اليوميات، سجل الحركة...الخ) بقاعدة وحدة
   بدل ما نكررها بكل صفحة - يحل مشكلة قص التاريخ (mm/d) ويوحّد المظهر. */
@media(max-width:767.98px) {
    [class*="filter-card"] .form-control,
    [class*="filter-card"] .form-select {
        padding-inline: 8px !important;
        font-size: 16px !important;
        min-width: 0;
    }

    [class*="filter-card"] input[type="date"] {
        padding-inline-end: 2px !important;
    }

    [class*="filter-card"] .form-label {
        font-size: 12.5px;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    [class*="filter-card"] .row.g-2 {
        --bs-gutter-x: 8px
    }
}

@media(max-width:340px) {
    [class*="filter-card"] .form-control,
    [class*="filter-card"] .form-select {
        padding-inline: 5px !important;
    }
}

/* منع تكبير الشاشة التلقائي بالجوال عند فتح قوائم Select2 (كانت تفلت من إصلاح الحقول العادية) */
@media(max-width:767.98px) {
    .select2-search__field {
        font-size: 16px !important
    }

    .select2-container .select2-selection {
        font-size: 16px !important;
        min-height: 46px !important
    }

    .select2-container .select2-selection__rendered {
        line-height: 44px !important
    }

    .select2-container .select2-selection__arrow {
        height: 44px !important
    }
}


/* ===== صفحة الإشعارات ===== */
.notif-section.border-danger {
    border-color: #fecaca !important
}

.notif-list {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.notif-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease,background .15s ease
}

    .notif-row:hover, .notif-row:active {
        border-color: #d8c39a;
        background: #f6efe2
    }

.notif-row-danger {
    border-color: #fecaca;
    background: #fef2f2
}

    .notif-row-danger:hover, .notif-row-danger:active {
        background: #fee2e2
    }

.notif-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex: 0 0 auto
}

.notif-row-danger .notif-row-icon {
    background: #fee2e2;
    color: #dc2626
}

.notif-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px
}

    .notif-row-text strong {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .notif-row-text small {
        color: var(--muted);
        font-size: 12px
    }

.notif-row-amount {
    font-weight: 800;
    font-size: 13.5px;
    white-space: nowrap;
    flex: 0 0 auto
}

.notif-row-arrow {
    color: #94a3b8;
    font-size: 15px;
    flex: 0 0 auto
}

@media(max-width:575.98px) {
    .notif-row {
        flex-wrap: wrap;
        gap: 8px 10px
    }

    .notif-row-amount {
        order: 3;
        margin-inline-start: 52px
    }

    .notif-row-arrow {
        display: none
    }
}

/* حماية شاملة من كسر التخطيط بسبب أسماء ملفات طويلة بدون فراغات (مثل أسماء الفيديو
   التلقائية بالجوال) - نفس مشكلة "آخر الملفات" بس مطبّقة على كل قوائم المرفقات بالمشروع */
.attach-item {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box
}

.file-info {
    min-width: 0;
    flex: 1
}

    .file-info > div {
        min-width: 0;
        overflow: hidden
    }

    .file-info strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

/* أزرار تعديل/حذف كأيقونات بجانب العنوان الرئيسي بصفحة تفاصيل البند */
.detail-hero-title-actions {
    display: flex;
    gap: 6px;
    margin-inline-start: auto
}

    .detail-hero-title-actions form {
        margin: 0
    }

    .detail-hero-title-actions .btn {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px
    }

/* أزرار إجراءات كروت التفاصيل بالجوال (عرض/رفع/تعديل/حذف) أيقونات فقط بصف واحد
   بدل شبكة 2×2 بنصوص كاملة - نتغلب على كل القواعد القديمة بخصوصية أعلى */
.row-actions-icons {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    grid-template-columns: none !important;
}

    .row-actions-icons .btn,
    .row-actions-icons form {
        flex: 1 1 0 !important;
        width: auto !important;
    }

    .row-actions-icons form {
        display: flex !important;
        margin: 0
    }

        .row-actions-icons form .btn {
            width: 100% !important
        }

    .row-actions-icons .btn {
        min-height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        position: relative;
    }

.row-action-count {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--primary);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    border-radius: 99px;
    min-width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

@media(max-width:340px) {
    .row-actions-icons {
        grid-template-columns: none !important
    }
}

/* ===== صفحة النسخ الاحتياطي: بطاقات بصفين بالجوال بدل التكديس الكامل ===== */
@media(max-width:767.98px) {
    .backup-stats-row .kpi-card {
        padding: 14px
    }

        .backup-stats-row .kpi-card .label {
            font-size: 11.5px
        }

        .backup-stats-row .kpi-card .value {
            font-size: 17px
        }

    .backup-cards-row .backup-option-card {
        padding: 16px !important
    }

        .backup-cards-row .backup-option-card .d-flex {
            flex-direction: column;
            align-items: flex-start;
            gap: 10px
        }

        .backup-cards-row .backup-option-card h4 {
            font-size: 15px;
            margin-bottom: 6px
        }

        .backup-cards-row .backup-option-card p {
            font-size: 12px;
            margin-bottom: 12px
        }

        .backup-cards-row .backup-option-card .btn {
            width: 100%;
            font-size: 13px;
            padding: 9px 10px
        }

    .backup-cards-row .file-thumb {
        width: 36px;
        height: 36px;
        font-size: 18px;
        flex: 0 0 36px
    }
}

.backup-db-card {
    border-color: #e2d8c8;
    background: linear-gradient(135deg,#fff 0%,#f6efe2 100%)
}

/* أزرار ملفات البند (عرض/تحميل/حذف) أيقونات فقط بصف واحد بدل نصوص كاملة متكدسة */
.inline-actions-icons {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important
}

    .inline-actions-icons .btn, .inline-actions-icons form {
        flex: 1 1 0 !important;
        width: auto !important
    }

    .inline-actions-icons form {
        display: flex !important;
        margin: 0
    }

        .inline-actions-icons form .btn {
            width: 100% !important
        }

    .inline-actions-icons .btn {
        min-height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 16px
    }

/* ===============================================================
   كل بطاقات الفلاتر بالمشروع (الداشبورد، الدفعات، عروض الأسعار،
   التغييرات، اليوميات، سجل الحركة): الحقول بصف واحد مريح (بدون
   حشر الأزرار معها - كانت تطفح خارج الشاشة لما المساحة ما تكفي)،
   والزرين بصف منفصل تحتها كأيقونتين. حل عام يشتغل تلقائياً بغض
   النظر عن عدد الحقول بكل صفحة.
   =============================================================== */
@media(max-width:767.98px) {
    [class$="-filter-row"] {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        align-items: end !important;
    }

        [class$="-filter-row"] > div {
            flex: 1 1 0 !important;
            width: auto !important;
            max-width: none !important;
            padding: 0 !important;
            margin: 0 !important;
            min-width: 0 !important;
        }

        [class$="-filter-row"] .form-label {
            font-size: 12px;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        [class$="-filter-row"] .form-control,
        [class$="-filter-row"] .form-select {
            font-size: 16px !important;
            padding-inline: 8px !important;
            min-height: 46px;
            width: 100%;
            min-width: 0;
        }

        [class$="-filter-row"] > [class$="-filter-actions"] {
            flex: 1 1 100% !important;
            display: flex !important;
            justify-content: flex-end;
            gap: 8px !important;
            width: 100% !important;
            margin-top: 2px;
        }

            [class$="-filter-row"] > [class$="-filter-actions"] .btn {
                width: 46px !important;
                height: 46px !important;
                min-height: 46px !important;
                padding: 0 !important;
                display: flex !important;
                align-items: center;
                justify-content: center;
                border-radius: 13px;
                font-size: 17px;
                flex: none !important;
            }

    [class$="-filter-btn-text"] {
        display: none !important
    }
}

@media(max-width:360px) {
    [class$="-filter-row"] {
        gap: 6px !important
    }
}


/* =====================================================================
   Mobile App Experience v1
   تحسين ثبات الشاشة مع لوحة المفاتيح وإحساس التطبيق على أجهزة اللمس.
   ===================================================================== */
html.mobile-app-ui {
    --app-visual-height: 100dvh;
    --app-keyboard-height: 0px;
    --mobile-header-height: 62px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior-x: none;
}

html.mobile-app-ui,
html.mobile-app-ui body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

@supports not (overflow: clip) {
    html.mobile-app-ui,
    html.mobile-app-ui body {
        overflow-x: hidden;
    }
}

html.mobile-app-ui body {
    min-height: var(--app-visual-height, 100dvh);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

html.mobile-app-ui a,
html.mobile-app-ui button,
html.mobile-app-ui input,
html.mobile-app-ui select,
html.mobile-app-ui textarea,
html.mobile-app-ui .btn,
html.mobile-app-ui .select2-selection {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 991.98px) and (pointer: coarse) {
    html.mobile-app-ui body {
        min-height: var(--app-visual-height, 100dvh);
    }

    html.mobile-app-ui .mobile-header {
        position: fixed !important;
        inset-block-start: 0;
        inset-inline: 0;
        width: 100%;
        transform: translate3d(0, 0, 0);
        will-change: transform, opacity;
        transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
    }

    html.mobile-app-ui .app-shell {
        min-height: var(--app-visual-height, 100dvh);
        padding-top: var(--mobile-header-height, 62px);
    }

    html.mobile-app-ui .main-content {
        min-height: calc(var(--app-visual-height, 100dvh) - var(--mobile-header-height, 62px));
    }

    html.mobile-app-ui .bottom-tab-bar {
        transform: translate3d(0, 0, 0);
        will-change: transform, opacity;
        transition: transform .18s ease, opacity .18s ease, visibility .18s ease;
    }

    html.mobile-app-ui.keyboard-open .mobile-header {
        transform: translate3d(0, -115%, 0);
        opacity: 0;
        pointer-events: none;
        box-shadow: none;
    }

    html.mobile-app-ui.keyboard-open .bottom-tab-bar,
    html.mobile-app-ui.select2-mobile-open .bottom-tab-bar {
        transform: translate3d(0, 125%, 0);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    html.mobile-app-ui.keyboard-open .content-wrap {
        padding-bottom: 18px !important;
    }

    html.mobile-app-ui.keyboard-open .pull-refresh-indicator {
        display: none !important;
    }

    html.mobile-app-ui input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    html.mobile-app-ui select,
    html.mobile-app-ui textarea,
    html.mobile-app-ui .select2-search__field,
    html.mobile-app-ui .select2-selection {
        font-size: 16px !important;
        scroll-margin-top: 18px;
        scroll-margin-bottom: 24px;
    }

    html.mobile-app-ui input,
    html.mobile-app-ui select,
    html.mobile-app-ui textarea,
    html.mobile-app-ui .select2-selection {
        border-radius: 13px;
        transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
    }

    html.mobile-app-ui .form-control:focus,
    html.mobile-app-ui .form-select:focus,
    html.mobile-app-ui .select2-container--focus .select2-selection,
    html.mobile-app-ui .select2-container--open .select2-selection {
        border-color: rgba(138, 106, 69, .72) !important;
        box-shadow: 0 0 0 4px rgba(138, 106, 69, .12) !important;
    }

    html.mobile-app-ui textarea.form-control {
        resize: none;
    }

    html.mobile-app-ui .btn,
    html.mobile-app-ui button,
    html.mobile-app-ui .bottom-tab-item,
    html.mobile-app-ui .quick-add-row {
        user-select: none;
        -webkit-user-select: none;
    }

    html.mobile-app-ui .btn:active,
    html.mobile-app-ui button:active,
    html.mobile-app-ui .quick-add-row:active {
        transform: scale(.97);
    }

    /* النوافذ العادية تظهر كـ Bottom Sheet مثل تطبيقات الهاتف. */
    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-dialog {
        min-height: 100%;
        margin: 0 !important;
        display: flex;
        align-items: flex-end;
        max-width: none !important;
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-content {
        width: 100%;
        max-height: calc(var(--app-visual-height, 100dvh) - 8px);
        border: 0;
        border-radius: 24px 24px 0 0 !important;
        overflow: hidden;
        box-shadow: 0 -18px 50px rgba(36, 28, 20, .2);
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-header {
        position: relative;
        padding-top: 22px;
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-header::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: #d9d1c5;
        transform: translateX(-50%);
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-body {
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-footer {
        padding-bottom: calc(.8rem + env(safe-area-inset-bottom));
    }

    /* قائمة Select2 تتحول إلى لوحة سفلية ثابتة ولا تسحب الصفحة إلى مكان الحقل. */
    html.mobile-app-ui .select2-container--open .select2-dropdown {
        position: fixed !important;
        inset-inline: 10px !important;
        top: auto !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        border: 1px solid #e2d8c8 !important;
        border-radius: 22px !important;
        overflow: hidden;
        box-shadow: 0 18px 60px rgba(36, 28, 20, .24) !important;
        z-index: 2055 !important;
    }

    html.mobile-app-ui .select2-container--open .select2-results__options {
        max-height: min(42vh, 340px) !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    html.mobile-app-ui .select2-container--open .select2-search--dropdown {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #fff;
    }

    html.mobile-app-ui .select2-container--open .select2-search__field {
        min-height: 48px;
        border-radius: 13px !important;
    }

    html.mobile-app-ui .card,
    html.mobile-app-ui .clean-card,
    html.mobile-app-ui .kpi-card,
    html.mobile-app-ui .payment-mobile-row,
    html.mobile-app-ui .contract-mobile-row,
    html.mobile-app-ui .quote-mobile-row,
    html.mobile-app-ui .dailynote-mobile-row,
    html.mobile-app-ui .changeorder-mobile-row,
    html.mobile-app-ui .contractor-mobile-row,
    html.mobile-app-ui .user-mobile-row {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    html.mobile-app-ui *,
    html.mobile-app-ui *::before,
    html.mobile-app-ui *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* =====================================================================
   Mobile App Experience v2 - Stability patch
   يمنع التنافس بين تحريك المتصفح وتحريك JavaScript عند فتح لوحة المفاتيح.
   ===================================================================== */
@media (max-width: 991.98px) and (pointer: coarse) {
    html.mobile-app-ui,
    html.mobile-app-ui body {
        scroll-behavior: auto !important;
    }

    html.mobile-app-ui body {
        min-height: 100svh !important;
    }

    html.mobile-app-ui .app-shell {
        min-height: 100svh !important;
    }

    html.mobile-app-ui .main-content {
        min-height: calc(100svh - var(--mobile-header-height, 62px)) !important;
    }

    /* إبقاء الرأس ثابتاً يمنع تغير موضع المحتوى عند بداية الكتابة. */
    html.mobile-app-ui.keyboard-open .mobile-header {
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0, 0, 0, .075));
    }

    /* إخفاء الشريط السفلي فوراً، من دون انزلاق يسبب شعور عدم الاستقرار. */
    html.mobile-app-ui.keyboard-open .bottom-tab-bar,
    html.mobile-app-ui.select2-mobile-open .bottom-tab-bar {
        display: none !important;
        transform: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: none !important;
    }

    /* لا نغيّر padding المحتوى عند فتح الكيبورد حتى لا تتحرك الصفحة. */
    html.mobile-app-ui.keyboard-open .content-wrap {
        padding-bottom: inherit !important;
    }

    html.mobile-app-ui.input-active,
    html.mobile-app-ui.input-active body {
        overflow-anchor: none;
    }

    html.mobile-app-ui.input-active .mobile-header,
    html.mobile-app-ui.input-active .bottom-tab-bar,
    html.mobile-app-ui.input-active .app-shell,
    html.mobile-app-ui.input-active .main-content,
    html.mobile-app-ui.input-active .content-wrap {
        transition: none !important;
        animation: none !important;
    }

    html.mobile-app-ui .modal:not(#filePreviewModal) .modal-content {
        max-height: calc(100dvh - 8px) !important;
    }
}
