@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap");

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f9fbff;
    --text: #101828;
    --muted: #667085;
    --border: rgba(16, 24, 40, 0.08);
    --shadow: 0 18px 40px rgba(17, 24, 39, 0.06);
    --primary: #246bff;
    --success-soft: #d7f5e8;
    --danger-soft: #fde3e6;
    --warning-soft: #fff0cc;
}

html[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #111827;
    --surface-2: #182234;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --primary: #6ea8fe;
    --success-soft: rgba(34, 197, 94, 0.18);
    --danger-soft: rgba(239, 68, 68, 0.18);
    --warning-soft: rgba(245, 158, 11, 0.18);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

@font-face {
    font-family: "Al-Jazeera-Arabic";
    src: local("Al Jazeera Arabic"), local("Aljazeera"), local("Al-Jazeera-Arabic");
    font-display: swap;
}

body {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg) 0%, rgba(36, 107, 255, 0.04) 100%);
    color: var(--text);
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}

a {
    text-decoration: none;
}

.glass-card,
.card,
.table-card,
.login-card,
.section-card,
.task-card,
.timeline-card,
.filters-bar,
.page-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.4rem;
    box-shadow: var(--shadow);
}

.topbar {
    margin: 1rem;
    padding: 1rem 1.25rem;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 1rem;
    padding: 0 1rem 1rem;
    min-height: calc(100vh - 110px);
}

.sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
    padding: 1rem;
}

.app-content {
    min-width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .5rem .75rem 1.2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.brand-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary), #8ab4ff);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    overflow: hidden;
    border: 1px solid var(--border);
}

.brand-logo-img {
    object-fit: cover;
    background: #fff;
    padding: .15rem;
}

.brand-title {
    font-weight: 800;
}

.sidebar-group {
    margin-bottom: 1.25rem;
}

.sidebar-group-title {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: .5rem;
    padding-inline: .75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-radius: 1rem;
    color: var(--text);
    transition: .2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    color: var(--primary);
}

.btn-soft {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: inline-grid;
    place-items: center;
    color: var(--text);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.user-chip-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 15%, var(--surface)), var(--surface));
    font-weight: 800;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.table-card {
    padding: 1rem;
}

.table thead th {
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.table > :not(caption) > * > * {
    background: transparent !important;
    color: var(--text);
    border-color: var(--border);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: radial-gradient(circle at top, rgba(36, 107, 255, 0.12), transparent 30%), var(--bg);
}

.login-card {
    width: min(460px, 100%);
    padding: 2rem;
}

.login-logo {
    width: 4rem;
    height: 4rem;
    border-radius: 1.4rem;
    display: block;
    background: #fff;
    object-fit: cover;
    border: 1px solid var(--border);
    margin-inline: auto;
    padding: .2rem;
}

.form-control,
.form-select,
textarea {
    border-radius: 1rem !important;
    border-color: var(--border) !important;
    background-color: color-mix(in srgb, var(--surface) 92%, transparent) !important;
    color: var(--text) !important;
    min-height: 2.85rem;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 .25rem rgba(36, 107, 255, 0.12) !important;
}

.btn {
    border-radius: 1rem;
    min-height: 2.75rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filters-bar,
.section-card,
.task-card,
.timeline-card {
    padding: 1rem;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.task-card {
    grid-column: span 4;
    padding: .9rem;
}

.bulk-card-check {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--muted);
}

.quick-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .28rem .55rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .78rem;
}

.quick-icon-sm {
    padding: .18rem .45rem;
    font-size: .72rem;
}

.task-card .h5 {
    font-size: 1rem;
}

.task-card .meta-item {
    padding: .6rem .7rem;
}


.task-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem 1rem;
    margin-top: 1rem;
}

.meta-item {
    padding: .75rem;
    background: var(--surface-2);
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.meta-item small {
    color: var(--muted);
    display: block;
    margin-bottom: .2rem;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.btn-yes {
    background: #dff6ea;
    border-color: #b8e6c9;
    color: #116149;
}

.btn-no {
    background: #fee5e7;
    border-color: #f8c7ce;
    color: #962d3e;
}

.timeline-list {
    display: grid;
    gap: .75rem;
}

.timeline-item {
    padding: .85rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.badge {
    border-radius: 999px;
    padding: .6rem .8rem;
    font-weight: 700;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(3px);
    display: none;
    place-items: center;
    z-index: 1055;
}

.loading-overlay.show {
    display: grid;
}

.sticky-toolbar {
    position: sticky;
    top: 1rem;
    z-index: 20;
}

@media (max-width: 1399px) {
    .task-card {
        grid-column: span 6;
    }
}

@media (max-width: 1199px) {
    .task-card {
        grid-column: span 6;
    }
}

@media (max-width: 991px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: 100%;
    }
}

@media (max-width: 991px) {
    .task-card {
        grid-column: span 12;
    }
}

@media (max-width: 767px) {
    .task-meta {
        grid-template-columns: 1fr;
    }

    .topbar-content,
    .page-head {
        flex-direction: column;
        align-items: stretch !important;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.notif-badge,
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.notif-badge {
    position: absolute;
    top: -.25rem;
    right: -.15rem;
}

.sidebar-link {
    position: relative;
}

.nav-badge {
    margin-inline-start: auto;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.summary-card {
    padding: 1rem 1.1rem;
    min-height: 122px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.summary-card h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.summary-card.tone-primary {
    background: linear-gradient(180deg, var(--surface), rgba(36, 107, 255, 0.05));
}

.summary-card.tone-success {
    background: linear-gradient(180deg, var(--surface), rgba(16, 185, 129, 0.06));
}

.summary-card.tone-warning {
    background: linear-gradient(180deg, var(--surface), rgba(245, 158, 11, 0.08));
}

.summary-card.tone-danger {
    background: linear-gradient(180deg, var(--surface), rgba(239, 68, 68, 0.06));
}

.card-soft {
    padding: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 1rem;
}

.chart-card {
    padding: 1rem;
}

.empty-state {
    padding: 1.5rem;
    border: 1px dashed var(--border);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(249,251,255,0.95));
}

.dashboard-head {
    align-items: center;
}


.whatsapp-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: #16a34a;
    background: #eefbf2;
    border-color: #bfe8cc;
}
.whatsapp-icon svg {
    width: 1rem;
    height: 1rem;
}
.task-card-head { margin-bottom: .5rem; }
.task-card-main { display: flex; flex-direction: column; gap: .35rem; }
.task-contact-row { font-size: .95rem; }
.task-assignee-top { font-weight: 700; color: var(--text); margin-top: .15rem; }
.task-meta-minimal { grid-template-columns: 1fr; margin-top: .75rem; }
.task-meta-minimal .meta-item { min-height: 72px; display: flex; align-items: center; justify-content: space-between; }
.calls-counter strong { font-size: 1.2rem; }
.task-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.task-actions .btn, .task-actions a.btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 767px) { .task-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


.task-card {
    grid-column: span 4;
    padding: 1rem;
    border-radius: 1.6rem;
}

.task-card-head {
    margin-bottom: .75rem;
    align-items: flex-start;
}

.task-card-main {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.task-card-main .small {
    font-size: .8rem;
}

.task-assignee-top {
    font-size: .92rem;
    font-weight: 800;
    color: var(--text);
}

.task-contact-row {
    font-size: .94rem;
    color: var(--muted);
}

.task-meta-minimal {
    grid-template-columns: 1fr;
    margin-top: .85rem;
}

.task-meta-minimal .meta-item {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .85rem;
}

.calls-counter strong {
    font-size: 1.15rem;
}

.task-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
    margin-top: .25rem;
}

.task-actions .btn,
.task-actions a.btn {
    width: 100%;
    min-height: 2.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: .8rem;
    font-size: .95rem;
    white-space: nowrap;
}

.quick-icon.whatsapp-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
}

@media (max-width: 1399px) {
    .task-card {
        grid-column: span 6;
    }
}

@media (max-width: 991px) {
    .task-card {
        grid-column: span 12;
    }
}

@media (max-width: 767px) {
    .task-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.calls-counter-inline {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}

.calls-plus {
    width: 1.9rem;
    height: 1.9rem;
    border: 1px solid #f0b84b;
    background: #fff7e0;
    color: #b96b00;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

/* Mobile shell polish: keep the main menu behind a hamburger on phones/tablets. */
.sidebar-toggle {
    flex: 0 0 auto;
}

.hamburger-lines {
    width: 1.15rem;
    display: grid;
    gap: .25rem;
}

.hamburger-lines span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.customer-add-toolbar {
    display: flex;
    justify-content: flex-start;
}

.customer-add-btn {
    min-width: 150px;
    box-shadow: 0 10px 24px rgba(36, 107, 255, 0.18);
}

.customer-modal .modal-content {
    overflow: hidden;
}

.customer-modal .modal-header {
    border-bottom: 1px solid var(--border);
}

.customer-modal .modal-body {
    padding: 1rem;
}

.customer-modal .modal-customer-form > [class*="col-"] {
    width: 100%;
}

.customer-modal .btn-close {
    margin: 0;
}

@media (max-width: 991px) {
    .topbar {
        margin: .75rem;
        padding: .85rem;
        position: sticky;
        top: .5rem;
        z-index: 1040;
    }

    .topbar-title h1 {
        font-size: 1.25rem;
    }

    .topbar-content {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }

    .topbar-actions {
        margin-inline-start: auto;
    }

    .user-chip {
        padding: .4rem;
        gap: .35rem;
    }

    .user-chip-meta {
        display: none;
    }

    .app-shell {
        display: block;
        padding: 0 .75rem .75rem;
        min-height: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(86vw, 320px);
        max-width: 320px;
        overflow-y: auto;
        z-index: 1060;
        border-radius: 0;
        transform: translateX(105%);
        transition: transform .25s ease;
        box-shadow: -16px 0 36px rgba(15, 23, 42, .18);
        background: var(--surface);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .38);
        backdrop-filter: blur(2px);
        z-index: 1050;
    }

    .sidebar.open {
        z-index: 1061;
    }

    .section-card,
    .filters-bar,
    .table-card,
    .task-card {
        border-radius: 1.15rem;
    }

    .customer-add-toolbar {
        position: sticky;
        top: 5.2rem;
        z-index: 30;
    }

    .customer-add-btn {
        width: 100%;
        min-height: 3rem;
        border-radius: 1.1rem;
    }

    .customer-modal .modal-dialog {
        margin: .75rem;
    }

    .customer-modal .modal-content {
        border-radius: 1.25rem;
        max-height: calc(100vh - 1.5rem);
    }

    .customer-modal .modal-body {
        padding: .85rem;
    }

    .customer-modal .modal-customer-form {
        row-gap: .85rem !important;
    }
}

@media (max-width: 575px) {
    .topbar-actions .btn-soft {
        width: 2.45rem;
        height: 2.45rem;
    }

    .user-chip-avatar {
        width: 2.15rem;
        height: 2.15rem;
    }

    .customer-modal .modal-dialog {
        align-items: flex-end;
        min-height: calc(100% - 1.5rem);
    }

    .customer-modal .modal-content {
        border-radius: 1.25rem 1.25rem 0 0;
    }
}

.future-project-transfer {
    min-width: min(100%, 420px);
}
.future-project-select {
    width: min(100%, 220px);
}
.future-project-grid .task-actions form {
    display: inline-flex;
}
@media (max-width: 576px) {
    .future-project-transfer,
    .future-project-select {
        width: 100%;
    }
}


/* Project inventory */
.project-units-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}.project-unit-tile{border-radius:16px;padding:14px;text-align:center;box-shadow:0 10px 22px rgba(15,23,42,.08);border:1px solid rgba(15,23,42,.08);min-height:112px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}.project-unit-tile strong{font-size:1.15rem}.project-unit-tile small,.project-unit-tile span,.project-unit-tile em{font-size:.8rem}.project-unit-tile em{font-style:normal;opacity:.8}.project-unit-available{background:#22c55e!important;color:#fff!important}.project-unit-reserved{background:#f59e0b!important;color:#111827!important}.project-unit-sold{background:#ef4444!important;color:#fff!important}.project-legend .badge{padding:.65rem .85rem;border-radius:999px}


.project-frozen-card{opacity:.72;filter:grayscale(.25);cursor:not-allowed;background:linear-gradient(135deg,#f8fafc,#f1f5f9)!important;border:1px dashed rgba(100,116,139,.55)!important;box-shadow:none!important;position:relative}.project-frozen-card:after{content:'غير قابل للفتح';display:block;font-size:.78rem;color:#64748b;margin-top:.35rem}.project-frozen-badge{background:#334155!important;color:#fff!important;border-radius:999px;padding:.45rem .7rem}.project-frozen-panel{border:1px dashed rgba(100,116,139,.45);border-radius:24px;background:linear-gradient(135deg,#f8fafc,#eef2f7)}

/* =========================================================
   Modern responsive redesign layer
   - Visual/styling only. No business logic changes.
   - Apple/iCloud-like system typography and smoother mobile UX.
   ========================================================= */
:root {
    --bg: #eef3fb;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-solid: #ffffff;
    --surface-2: rgba(248, 250, 252, 0.92);
    --text: #132033;
    --muted: #667085;
    --border: rgba(29, 41, 57, 0.10);
    --shadow: 0 20px 55px rgba(31, 41, 55, 0.10);
    --shadow-soft: 0 10px 28px rgba(31, 41, 55, 0.07);
    --primary: #0a84ff;
    --primary-2: #5e5ce6;
    --primary-soft: rgba(10, 132, 255, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

html[data-theme="dark"] {
    --bg: #07111f;
    --surface: rgba(18, 27, 43, 0.82);
    --surface-solid: #111827;
    --surface-2: rgba(30, 41, 59, 0.72);
    --text: #f3f6fb;
    --muted: #a5b4c8;
    --border: rgba(255, 255, 255, 0.10);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.40);
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.26);
    --primary: #63b3ff;
    --primary-2: #9b8cff;
    --primary-soft: rgba(99, 179, 255, 0.14);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.65;
    letter-spacing: -0.01em;
    background:
        radial-gradient(circle at top right, rgba(10, 132, 255, 0.16), transparent 32rem),
        radial-gradient(circle at bottom left, rgba(94, 92, 230, 0.13), transparent 34rem),
        linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 86%, #fff) 100%);
    background-attachment: fixed;
}

::selection {
    background: color-mix(in srgb, var(--primary) 24%, transparent);
}

.glass-card,
.card,
.table-card,
.login-card,
.section-card,
.task-card,
.timeline-card,
.filters-bar,
.page-card,
.summary-card,
.chart-card,
.card-soft,
.empty-state {
    border-radius: var(--radius-xl);
    border-color: var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.card,
.section-card,
.table-card,
.task-card,
.summary-card,
.filters-bar,
.page-card {
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.card:hover,
.section-card:hover,
.task-card:hover,
.summary-card:hover,
.page-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.topbar {
    margin: 1rem;
    padding: .9rem 1rem;
    border-radius: 30px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.topbar-title h1 {
    font-size: clamp(1.25rem, 2.2vw, 1.85rem);
    letter-spacing: -0.035em;
    font-weight: 900;
}

.topbar-title small,
.user-chip-meta small,
.sidebar-group-title,
.text-muted {
    color: var(--muted) !important;
}

.app-shell {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
    gap: 1.1rem;
    padding: 0 1rem 1.1rem;
}

.sidebar {
    border-radius: 30px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    box-shadow: var(--shadow);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--primary) 38%, transparent) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 7px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary) 38%, transparent);
    border-radius: 999px;
}

.sidebar-brand {
    padding: .65rem .75rem 1.15rem;
}

.brand-icon {
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 12px 26px rgba(10,132,255,.16);
}

.brand-title {
    letter-spacing: -0.02em;
}

.sidebar-group-title {
    font-size: .78rem;
    letter-spacing: .02em;
}

.sidebar-link {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 18px;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-2) 10%, transparent));
    border-color: color-mix(in srgb, var(--primary) 22%, transparent);
    color: var(--primary);
    transform: translateX(-2px);
}

.btn-soft,
.btn,
.form-control,
.form-select,
.input-group-text,
.dropdown-menu,
.modal-content {
    border-radius: 16px;
}

.btn-soft {
    background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
    box-shadow: 0 8px 20px rgba(15,23,42,.06);
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.btn-soft:hover {
    transform: translateY(-1px);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
    background: var(--surface-solid);
}

.btn-primary,
.customer-add-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-2)) !important;
    border: 0 !important;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 26%, transparent);
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--border);
    background-color: color-mix(in srgb, var(--surface-solid) 78%, transparent);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
    box-shadow: 0 0 0 .24rem color-mix(in srgb, var(--primary) 16%, transparent);
}

.table {
    color: var(--text);
    vertical-align: middle;
}

.table-card {
    overflow: hidden;
}

.table-responsive {
    border-radius: var(--radius-lg);
}

.table thead th {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    border-bottom-color: var(--border);
    background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.table tbody tr {
    transition: background .16s ease;
}

.table tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.badge,
.nav-badge,
.notif-badge,
.quick-icon {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.summary-card {
    min-height: 134px;
}

.summary-card h3 {
    letter-spacing: -0.04em;
}

.task-grid {
    gap: 1.1rem;
}

.task-card {
    border-radius: 28px;
}

.task-actions .btn,
.task-actions a.btn {
    border-radius: 15px;
    font-weight: 750;
}

.dropdown-menu {
    padding: .45rem;
    border-color: var(--border);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
}

.dropdown-item {
    border-radius: 12px;
    padding: .65rem .8rem;
}

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

.user-chip {
    background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
    border-color: var(--border);
    box-shadow: 0 10px 24px rgba(15,23,42,.055);
}

.user-chip-avatar {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}

.hamburger-lines span {
    height: 2.5px;
    transition: transform .2s ease, opacity .2s ease;
}

body.sidebar-open .sidebar-toggle .hamburger-lines span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
body.sidebar-open .sidebar-toggle .hamburger-lines span:nth-child(2) {
    opacity: 0;
}
body.sidebar-open .sidebar-toggle .hamburger-lines span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 1199px) {
    .app-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

@media (max-width: 991px) {
    body {
        background-attachment: scroll;
    }

    .topbar {
        position: relative !important;
        top: auto !important;
        z-index: 30;
        margin: .75rem;
        padding: .7rem .75rem;
        border-radius: 24px;
    }

    .topbar-content {
        min-height: 48px;
    }

    .topbar-title {
        min-width: 0;
    }

    .topbar-title h1 {
        max-width: 52vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1.12rem;
    }

    .topbar-title small {
        display: block;
        max-width: 52vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .76rem;
    }

    .topbar-actions {
        gap: .45rem;
    }

    .app-shell {
        padding: 0 .75rem 1rem;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        right: 0;
        width: min(88vw, 350px);
        max-width: 350px;
        height: 100dvh;
        max-height: 100dvh;
        padding: 1rem .9rem 1.25rem;
        border-radius: 28px 0 0 28px;
        transform: translateX(110%);
        transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s ease;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open::after {
        background: rgba(6, 13, 24, .46);
        backdrop-filter: blur(7px);
        -webkit-backdrop-filter: blur(7px);
    }

    .sidebar-brand {
        position: sticky;
        top: 0;
        z-index: 2;
        margin: -1rem -.9rem 1rem;
        padding: 1rem .9rem .95rem;
        background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .sidebar-group {
        margin-bottom: 1rem;
    }

    .sidebar-link {
        min-height: 48px;
        padding: .85rem .95rem;
    }

    .section-card,
    .filters-bar,
    .table-card,
    .task-card,
    .summary-card,
    .chart-card,
    .page-card {
        border-radius: 22px;
    }

    .filters-bar .row,
    .section-card .row,
    .page-card .row {
        row-gap: .75rem;
    }

    .table-card,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 680px;
    }

    .customer-add-toolbar {
        position: static !important;
        top: auto !important;
        margin-bottom: .75rem;
    }
}

@media (max-width: 767px) {
    .topbar-content,
    .page-head,
    .dashboard-head {
        flex-direction: row !important;
        align-items: center !important;
    }

    .page-head {
        flex-wrap: wrap;
    }

    .page-head > * {
        min-width: 0;
    }

    .user-chip {
        border-radius: 18px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .task-actions {
        grid-template-columns: 1fr 1fr;
    }

    .modal-dialog {
        margin: .75rem;
    }
}

@media (max-width: 575px) {
    .topbar {
        margin: .55rem;
        padding: .62rem;
        border-radius: 22px;
    }

    .app-shell {
        padding: 0 .55rem .9rem;
    }

    .topbar-title h1,
    .topbar-title small {
        max-width: 46vw;
    }

    .btn-soft,
    .topbar-actions .btn-soft {
        width: 2.42rem;
        height: 2.42rem;
        border-radius: 14px;
    }

    .user-chip {
        padding: .25rem;
        gap: .2rem;
    }

    .user-chip-avatar {
        width: 2.1rem;
        height: 2.1rem;
    }

    .sidebar {
        width: min(92vw, 340px);
        border-radius: 24px 0 0 24px;
    }

    .task-actions {
        grid-template-columns: 1fr;
    }

    .task-actions .btn,
    .task-actions a.btn {
        min-height: 2.75rem;
    }
}

@supports not (backdrop-filter: blur(10px)) {
    .glass-card,
    .card,
    .table-card,
    .login-card,
    .section-card,
    .task-card,
    .timeline-card,
    .filters-bar,
    .page-card,
    .topbar,
    .sidebar {
        background: var(--surface-solid);
    }
}

/* Legacy layout compatibility for older route files */
.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.main,
.container {
    min-width: 0;
}

.container {
    max-width: 100%;
}

.brand,
.nav,
.foot {
    display: grid;
    gap: .7rem;
}

.brand {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.logo {
    width: 3rem;
    height: 3rem;
    border-radius: 18px;
    object-fit: cover;
}

.company {
    font-weight: 900;
    letter-spacing: -0.02em;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: .85rem 1rem;
    color: var(--text);
    border-radius: 18px;
    font-weight: 750;
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 22%, transparent);
}

.nav-item.danger {
    color: #ef4444;
}

.dot {
    min-width: 1.35rem;
    height: 1.35rem;
    display: inline-grid;
    place-items: center;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .72rem;
}

.hr {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

.input {
    width: 100%;
    min-height: 2.9rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: .65rem .85rem;
    background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
    color: var(--text);
    outline: 0;
}

.input:focus {
    border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
    box-shadow: 0 0 0 .24rem color-mix(in srgb, var(--primary) 16%, transparent);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border: 0;
}

.hamburger {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
}

@media (max-width: 991px) {
    .app {
        display: block;
        padding: .75rem;
    }

    .app > .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        right: 0;
        width: min(88vw, 350px);
        height: 100dvh;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        transform: translateX(110%);
        z-index: 1061;
    }

    .app > .sidebar.open {
        transform: translateX(0);
    }
}


/* CRM performance pass: lighter cards and fewer expensive mobile paint effects */
.customer-fixed-note{
    border:1px solid rgba(124,58,237,.18);
    background:linear-gradient(135deg, rgba(124,58,237,.07), rgba(99,102,241,.045));
    color:#312e81;
    border-radius:18px;
    padding:12px 14px;
    line-height:1.85;
    font-weight:700;
}
.customer-fixed-note-label{
    font-size:.78rem;
    color:#6d28d9;
    font-weight:900;
    margin-bottom:4px;
}
.admin-customer-note-form textarea{resize:vertical;min-height:72px;}
.task-card .admin-customer-note-form{border-top:1px dashed rgba(99,102,241,.18);padding-top:12px;}
@media (max-width: 991.98px){
    .section-card,.task-card,.timeline-card,.filters-bar,.card-soft,.glass-card{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;}
    .task-card,.section-card,.filters-bar{box-shadow:0 8px 18px rgba(15,23,42,.06)!important;}
    *{scroll-behavior:auto!important;}
}
@media (prefers-reduced-motion: reduce){
    *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important;}
}


/* Clean task action layout: keep Details and future-project transfer tidy on all screens */
.task-actions {
    align-items: stretch;
}
.task-actions .future-project-transfer {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
    gap: .65rem;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: .55rem;
}
.task-actions .future-project-transfer .future-project-select {
    min-height: 2.75rem;
    border-radius: 14px;
}
.task-actions .future-project-transfer .btn {
    min-width: 170px;
    margin: 0 auto;
    white-space: nowrap;
}
.task-actions .details-action {
    grid-column: 1 / -1;
    min-height: 3.15rem;
    font-size: 1rem;
    border-radius: 18px;
    background: var(--surface-solid);
}
@media (max-width: 575px) {
    .task-actions .future-project-transfer {
        grid-template-columns: 1fr;
    }
    .task-actions .future-project-transfer .btn {
        width: 100%;
        min-width: 0;
    }
    .task-actions .details-action {
        min-height: 3rem;
    }
}
/* Order: primary stage buttons, then Details full-width, then future-project transfer full-width */
.task-actions .details-action { order: 5; }
.task-actions .future-project-transfer { order: 6; }


/* Tajawal full-site typography override */
html,
body,
button,
input,
select,
textarea,
.table,
.dropdown-menu,
.modal,
.card,
.task-card,
.sidebar,
.topbar,
.badge,
.btn,
.form-control,
.form-select,
.nav-link {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.topbar-title h1,
.card-title,
.section-title,
.sidebar-brand,
.brand-title,
.table thead th,
.btn,
.badge,
.task-card-title,
.customer-name,
.project-title,
.stat-card strong,
.login-card h1 {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif !important;
    font-weight: 800 !important;
    letter-spacing: -0.015em;
}

label,
.form-label,
.sidebar .nav-link,
.sidebar-link,
.menu-link,
.dropdown-item {
    font-weight: 700;
}

p,
small,
.text-muted,
.form-text,
.card-text,
.table tbody td {
    font-weight: 500;
}


/* Frontend polish: login, sidebar icons, alerts, and project unit colors */
.login-page,
.login-card,
.login-card * {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif !important;
}
.login-card {
    width: min(480px, 100%);
    min-height: 520px;
    padding: 2.6rem 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-form {
    display: grid;
    gap: 1.1rem;
}
.login-form .form-label {
    font-weight: 700;
    color: var(--text);
}
.login-form input[type="password"] {
    margin-bottom: .85rem;
}
.login-submit-btn {
    background: #fff !important;
    color: #000 !important;
    border: 1.5px solid #000 !important;
    font-weight: 800 !important;
    border-radius: 1rem !important;
    min-height: 3.1rem;
    box-shadow: none !important;
}
.login-submit-btn:hover,
.login-submit-btn:focus {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}
.login-password-gap {
    height: .9rem;
}
.sidebar-link-main {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}
.sidebar-nav-icon {
    width: 1.08rem;
    height: 1.08rem;
    flex: 0 0 1.08rem;
    stroke: #000;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sidebar-link,
.sidebar-link:hover,
.sidebar-link.active {
    color: #000;
}
.sidebar-link.active .sidebar-nav-icon,
.sidebar-link:hover .sidebar-nav-icon {
    stroke: #000;
}
.alert[data-auto-dismiss] {
    animation: crmAlertSoftIn .18s ease-out;
}
@keyframes crmAlertSoftIn {
    from { transform: translateY(-6px); opacity: .75; }
    to { transform: translateY(0); opacity: 1; }
}
@media (max-width: 575.98px) {
    .login-card {
        min-height: 500px;
        padding: 2.2rem 1.4rem;
    }
}

/* Project building editor: separate unit details per building */
.project-building-editor-card {
    border-radius: 1.5rem;
    border: 1px solid rgba(15, 23, 42, .10);
    background: linear-gradient(180deg, #fff, #fbfdff);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
    padding: 1rem;
}
.project-building-editor-card .fw-semibold {
    font-size: 1.05rem;
    color: #111827;
}
.project-building-editor-card textarea {
    min-height: 9rem;
    line-height: 1.9;
    resize: vertical;
}
.project-building-editor-card .form-label {
    color: #1f2937;
    font-weight: 800;
}
@media (max-width: 767.98px) {
    .project-building-editor-card {
        border-radius: 1.25rem;
        padding: .9rem;
    }
}
