html {
    scroll-behavior: smooth;
}

body {
    background: #f5f7fb;
    color: var(--crm-ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

[dir="rtl"] body {
    text-align: right;
}

a {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.table th,
.table td,
.stat-card .value,
.ledger-total-box strong,
.info-box strong,
.total-box strong,
.badge,
.page-link {
    unicode-bidi: plaintext;
}

.stat-card .value,
.ledger-total-box strong,
.total-box strong {
    direction: ltr;
}

[dir="rtl"] .form-label,
[dir="rtl"] label,
[dir="rtl"] .form-check-label,
[dir="rtl"] .card-header,
[dir="rtl"] .modal-title {
    text-align: right;
}

[dir="rtl"] .form-label {
    display: block;
    width: 100%;
}

[dir="rtl"] .form-control,
[dir="rtl"] .form-select,
[dir="rtl"] textarea,
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[dir="rtl"] .select2-results__option {
    text-align: right;
}

[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[name*="phone"],
[dir="rtl"] input[name*="email"],
[dir="rtl"] input[name*="amount"],
[dir="rtl"] input[name*="price"],
[dir="rtl"] input[name*="quantity"],
[dir="rtl"] input[name*="rate"],
[dir="rtl"] input[name*="reference"],
[dir="rtl"] input[name*="reservation_number"],
[dir="rtl"] .flatpickr-input,
[dir="rtl"] .flatpickr-input[readonly] {
    direction: ltr;
    text-align: left;
}

[dir="rtl"] .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
    left: 1px;
    right: auto;
}

[dir="rtl"] .flatpickr-calendar {
    direction: rtl;
}

[dir="rtl"] .flatpickr-current-month {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: .35rem;
}

::selection {
    background: color-mix(in srgb, var(--crm-primary) 22%, #fff);
    color: var(--crm-secondary);
}

.crm-shell {
    background: #f5f7fb;
}

.crm-shell > main {
    min-width: 0;
}

.crm-sidebar {
    background: #fff !important;
    color: var(--crm-secondary) !important;
    border-inline-end: 1px solid #edf1f7;
    box-shadow: 18px 0 45px rgba(15, 23, 42, .055);
}

.crm-brand {
    min-height: 78px;
    padding: 1rem 1.15rem;
    border-bottom-color: #edf1f7;
    background: #fff;
}

.crm-brand-link {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--crm-secondary) !important; /* Make brand link dark */
    text-decoration: none;
    font-weight: 800;
}

.crm-brand-link:hover {
    color: var(--crm-primary) !important;
}

.crm-brand-icon {
    width: 42px;
    height: 42px;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--crm-primary) 36%, transparent);
}

.crm-logo {
    max-height: 48px;
}

.crm-sidebar .btn-light {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: var(--crm-secondary);
}

.crm-sidebar .btn-light:hover {
    background: #e9ecef;
    color: var(--crm-secondary);
}

.crm-sidebar-close {
    margin-inline-start: auto;
}

.crm-menu {
    padding: .85rem;
    display: grid;
    gap: .22rem;
}

.crm-menu a {
    min-height: 46px;
    padding: .72rem .85rem;
    border: 1px solid transparent;
    border-inline-start-width: 3px;
    border-radius: 8px;
    color: var(--crm-secondary) !important; /* Force links to be dark/black */
    font-weight: 650;
}

.crm-menu a:hover {
    background: color-mix(in srgb, var(--crm-primary) 8%, #fff) !important;
    border-color: color-mix(in srgb, var(--crm-primary) 14%, #fff) !important;
    border-inline-start-color: var(--crm-primary) !important;
    color: var(--crm-primary) !important;
    transform: translateX(2px);
}

[dir="rtl"] .crm-menu a:hover {
    transform: translateX(-2px);
}

.crm-menu a.active {
    background: color-mix(in srgb, var(--crm-primary) 10%, #fff) !important;
    border-color: color-mix(in srgb, var(--crm-primary) 16%, #fff) !important;
    border-inline-start-color: var(--crm-primary) !important;
    color: var(--crm-primary) !important;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--crm-primary) 10%, transparent);
}

.crm-menu i {
    width: 1.45rem;
    color: color-mix(in srgb, var(--crm-secondary) 60%, #fff) !important; /* Dark grey icons */
}

.crm-menu a:hover i,
.crm-menu a.active i {
    color: var(--crm-primary) !important;
}

.crm-topbar {
    background: #fff !important;
    min-height: 78px;
    border-top: 0;
    border-bottom-color: #e9edf5;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .05);
}

.crm-title {
    max-width: min(58vw, 780px);
    font-size: clamp(1.18rem, 2vw, 1.55rem);
    font-weight: 850;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.crm-content {
    max-width: 1680px;
    margin: 0 auto;
    padding: 1.5rem;
}

.bg-secondary:not(.stat-card) {
    background-color: var(--crm-secondary) !important;
}

.text-secondary {
    color: var(--crm-secondary) !important;
}

.crm-card,
.card.crm-card,
.form-section,
.card:not(.stat-card) {
    border: 1px solid #e9edf5;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .055);
}

.card-header {
    min-height: 58px;
    border-bottom-color: #edf1f7;
    border-radius: 8px 8px 0 0 !important;
    padding: 1rem 1.15rem;
}

.card-body {
    padding: 1.15rem;
}

.form-section {
    padding: 1.15rem;
}

.stat-card {
    min-height: 136px;
    padding: 1.35rem !important;
    border-radius: 8px;
    border: 0;
    overflow: hidden;
    position: relative;
    color: #fff !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .10);
    isolation: isolate;
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 62px rgba(15, 23, 42, .16);
    filter: saturate(1.05);
}

.stat-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.stat-card-link:hover,
.stat-card-link:focus {
    color: inherit;
    text-decoration: none;
}

.stat-card-link .stat-card {
    height: 100%;
    cursor: pointer;
}

.stat-card-arrow {
    position: absolute;
    inset-inline-end: .95rem;
    top: .9rem;
    z-index: 3;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .86);
    font-size: .8rem;
    transform: translateY(-2px);
    opacity: .78;
    transition: opacity .18s ease, transform .18s ease, background-color .18s ease;
}

.stat-card-link:hover .stat-card-arrow,
.stat-card-link:focus .stat-card-arrow {
    opacity: 1;
    transform: translateY(0);
    background: rgba(255, 255, 255, .24);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: rgba(255, 255, 255, .08);
    opacity: 0;
    transition: opacity .22s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-content {
    position: relative;
    z-index: 2;
    max-width: calc(100% - 86px);
}

.stat-card--amount {
    min-height: 136px;
}

.stat-card--amount .stat-card-content {
    max-width: calc(100% - 112px);
}

.stat-card--count .value {
    font-size: clamp(1.65rem, 2.5vw, 2.15rem);
}

.stat-card.bg-primary,
.stat-card.bg-success,
.stat-card.bg-info {
    background-color: var(--crm-primary) !important;
}

.stat-card.bg-secondary,
.stat-card.bg-dark {
    background-color: var(--crm-secondary) !important;
}

.stat-card.bg-danger {
    background-color: #ff4d5e !important;
}

.stat-card.bg-warning {
    background-color: #ffb800 !important;
    color: #fff !important;
}

.stat-card .small {
    color: rgba(255, 255, 255, .72) !important;
    font-size: .88rem;
    font-weight: 850 !important;
    line-height: 1.25;
    text-shadow: 0 1px 18px rgba(0, 0, 0, .16);
}

.stat-card .value {
    color: #fff !important;
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 5px 22px rgba(0, 0, 0, .18);
}

.stat-card--amount .value {
    max-width: 100%;
    font-size: clamp(2rem, 3.8vw, 3rem);
    word-break: normal;
    font-size: 1.8em;
}

.stat-card .icon {
    position: absolute;
    inset-inline-end: 1.05rem;
    bottom: .95rem;
    z-index: 1;
    color: rgba(255, 255, 255, .25);
    font-size: 4.4rem;
    opacity: 1;
    animation: statIconFloat 4.6s ease-in-out infinite;
}

.stat-card--amount .icon {
    font-size: 5rem;
    opacity: .82;
}

.stat-card:hover .icon {
    color: rgba(255, 255, 255, .38);
}

@keyframes statIconFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    50% {
        transform: translateY(-7px) rotate(-3deg) scale(1.04);
    }
}

.dashboard-section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.dashboard-section-title h2 {
    margin: 0;
    color: var(--crm-secondary);
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0;
}

.dashboard-section-title span {
    color: #8792a8;
    font-weight: 750;
    font-size: .86rem;
}

.quick-link-card {
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid #e8edf5;
    border-radius: 8px;
    background: #fff;
    color: var(--crm-secondary);
    text-decoration: none;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .055);
    position: relative;
    overflow: hidden;
}

.quick-link-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block: 0;
    width: 4px;
    background: var(--crm-primary);
}

.quick-link-card:hover {
    color: var(--crm-primary);
    border-color: color-mix(in srgb, var(--crm-primary) 20%, #fff);
    box-shadow: 0 24px 54px rgba(15, 23, 42, .10);
    transform: translateY(-3px);
}

.quick-link-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: color-mix(in srgb, var(--crm-primary) 10%, #fff);
    color: var(--crm-primary);
    font-size: 1.1rem;
}

.quick-link-card > span:not(.quick-link-icon) {
    min-width: 0;
    font-weight: 850;
    line-height: 1.2;
}

.quick-link-arrow {
    margin-inline-start: auto;
    color: #a1acbd;
    transition: transform .18s ease, color .18s ease;
}

.quick-link-card:hover .quick-link-arrow {
    color: var(--crm-primary);
    transform: translateX(3px);
}

.crm-profile-link {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    font-weight: 900;
    color: var(--crm-primary);
}

.crm-profile-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-logo-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfcff;
}

.profile-logo-preview {
    width: 82px;
    height: 82px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: color-mix(in srgb, var(--crm-primary) 10%, #fff);
    color: var(--crm-primary);
    font-size: 2rem;
    font-weight: 950;
}

.profile-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.package-show-hero,
.reservation-package-preview {
    min-height: 280px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: end;
    border-radius: 8px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: right center;
    background-color: var(--crm-secondary);
    box-shadow: 0 22px 55px rgba(15, 23, 42, .14);
}

.package-show-hero--fallback,
.reservation-package-preview--fallback {
    background-color: var(--crm-secondary);
}

.package-show-hero--fallback::after,
.reservation-package-preview--fallback::after {
    content: "\f66f";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    inset-inline-end: 2rem;
    top: 1.4rem;
    color: rgba(255, 255, 255, .16);
    font-size: clamp(4rem, 10vw, 8rem);
    z-index: 1;
}

.package-show-hero-overlay,
.reservation-package-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: color-mix(in srgb, var(--crm-secondary) 70%, transparent);
}

.package-show-hero-content,
.reservation-package-preview-content {
    width: 100%;
    position: relative;
    z-index: 2;
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    color: #fff;
}

.package-show-title span,
.reservation-package-preview-content > div:first-child > span {
    display: inline-flex;
    padding: .25rem .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .86);
    font-size: .7rem !important;
    font-weight: 900;
}

.package-show-title h2,
.reservation-package-preview h2 {
    margin: .6rem 0 .35rem;
    font-size: clamp(1.5rem, 3vw, 2.35rem);
    font-weight: 950;
    line-height: 1.08;
}

.package-show-title p,
.reservation-package-preview p {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    color: rgba(255, 255, 255, .84);
    font-weight: 750;
}

.package-show-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.package-show-hero-stats > div,
.reservation-package-preview-price {
    padding: .85rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
}

.package-show-hero-stats span,
.reservation-package-preview-price span {
    display: block;
    color: rgba(255, 255, 255, .68);
    font-size: .74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.package-show-hero-stats strong,
.reservation-package-preview-price strong {
    display: block;
    margin-top: .2rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 950;
    overflow-wrap: anywhere;
}

.package-show-note {
    max-width: 840px;
    margin: 0;
    padding: .85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .86);
}

.package-hotel-card {
    border: 1px solid #edf1f7;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .045);
}

.package-hotel-tabs,
.reservation-hotel-tabs {
    flex-wrap: nowrap;
    gap: .45rem;
    overflow-x: auto;
    padding-bottom: .2rem;
    scrollbar-width: thin;
}

.package-hotel-tabs .nav-link,
.reservation-hotel-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border: 1px solid #e8edf5;
    background: #fff;
    color: var(--crm-secondary);
    font-weight: 850;
}

.package-hotel-tabs .nav-link.active,
.reservation-hotel-tabs .nav-link.active {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
    color: #fff;
}

.package-hotel-head,
.reservation-hotel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: .7rem;
}

.package-hotel-head h4,
.reservation-hotel-head h3 {
    margin: 0 0 .35rem;
    color: var(--crm-secondary);
    font-size: 1.05rem;
    font-weight: 950;
}

.package-hotel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    color: #738098;
    font-size: .84rem;
    font-weight: 800;
}

.package-hotel-meta a {
    color: var(--crm-primary);
    text-decoration: none;
}

.hotel-stars {
    display: inline-flex;
    align-items: center;
    gap: .14rem;
    color: #d8a522;
}

.hotel-stars strong {
    margin-inline-start: .25rem;
    color: var(--crm-secondary);
    font-weight: 950;
}

.hotel-map-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem .75rem;
    border: 1px solid var(--crm-primary);
    border-radius: 8px;
    background: var(--crm-primary);
    color: #fff;
    font-size: .86rem;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--crm-primary) 20%, transparent);
    transition: transform .18s ease, box-shadow .18s ease;
}

.hotel-map-btn:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px color-mix(in srgb, var(--crm-primary) 28%, transparent);
}

.package-action-panel {
    position: sticky;
    top: 94px;
}

.package-side-panel {
    position: sticky;
    top: 94px;
    overflow: hidden;
    border: 1px solid #e8edf5;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .06);
}

.package-side-hero {
    padding: 1rem;
    margin: -1rem -1rem 1rem;
    background: color-mix(in srgb, var(--crm-secondary) 92%, #000);
    color: #fff;
}

.package-side-hero span {
    display: inline-flex;
    padding: .24rem .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.package-side-hero h3 {
    margin: .65rem 0 .25rem;
    font-size: 1.1rem;
    font-weight: 950;
    line-height: 1.15;
}

.package-side-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .8);
    font-size: .86rem;
    font-weight: 750;
}

.package-side-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
}

.package-side-grid > div {
    padding: .75rem .8rem;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfcff;
}

.package-side-grid span {
    display: block;
    color: #7a8496;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.package-side-grid strong {
    display: block;
    margin-top: .18rem;
    color: var(--crm-secondary);
    font-size: .95rem;
    font-weight: 950;
    overflow-wrap: anywhere;
}

.package-action-summary {
    display: grid;
    gap: .55rem;
    margin-bottom: 1rem;
}

.package-action-summary > div {
    padding: .8rem;
    border-radius: 8px;
    border: 1px solid #edf1f7;
    background: #fbfcff;
}

.package-action-summary span {
    display: block;
    color: #7a8496;
    font-size: .76rem;
    font-weight: 900;
    text-transform: uppercase;
}

.package-action-summary strong {
    display: block;
    margin-top: .15rem;
    color: var(--crm-secondary);
    font-weight: 950;
    overflow-wrap: anywhere;
}

.reservation-package-preview {
    min-height: 190px;
}

.reservation-package-preview-content {
    grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
    align-items: end;
}

@media (max-width: 991px) {
    .package-show-hero-stats,
    .reservation-package-preview-content {
        grid-template-columns: 1fr 1fr;
    }

    .package-action-panel,
    .package-side-panel {
        position: static;
    }
}

@media (max-width: 575px) {
    .package-show-hero,
    .reservation-package-preview {
        min-height: 240px;
    }

    .package-show-hero-stats,
    .reservation-package-preview-content {
        grid-template-columns: 1fr;
    }
}

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

.agency-profile-list > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem .9rem;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fbfcff;
}

.agency-profile-list span {
    color: #7a8496;
    font-size: .82rem;
    font-weight: 800;
}

.agency-profile-list strong {
    color: var(--crm-secondary);
    font-weight: 900;
    text-align: end;
    overflow-wrap: anywhere;
}

.ledger-card {
    overflow: hidden;
}

.ledger-summary-grid {
    align-items: stretch;
}

.ledger-total-box {
    min-height: 132px;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: grid;
    align-content: space-between;
    gap: .75rem;
    padding: 1rem;
    border-radius: 8px;
    background: var(--crm-secondary);
    color: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .10);
}

.ledger-total-box.ledger-total-primary,
.ledger-total-box.is-paid {
    background: var(--crm-primary);
}

.ledger-total-box.is-due {
    background: #ff4d5e;
}

.ledger-total-box span {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, .74);
    font-size: .82rem;
    font-weight: 900;
}

.ledger-total-box strong {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 950;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.ledger-total-box i {
    position: absolute;
    inset-inline-end: 1rem;
    bottom: .8rem;
    color: rgba(255, 255, 255, .22);
    font-size: 2.2rem;
}

.ledger-table thead th {
    color: #687386;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.ledger-table tbody td {
    color: var(--crm-secondary);
    font-weight: 700;
}

/* ----- Pagination (compact) ----- */
.pagination { --bs-pagination-font-size: .7rem !important; --bs-pagination-padding-x: .35rem; --bs-pagination-padding-y: .2rem; margin-bottom: 0; }
.page-link { border-radius: 6px !important; margin: 0 1px; min-width: 26px !important; text-align: center; padding: .2rem .35rem !important; font-size: .7rem !important; }
.page-item.active .page-link { font-weight: 700; }
.dataTables_paginate .page-link { font-size: .68rem; padding: .12rem .32rem; min-width: 24px; }

.ledger-pagination {
    display: flex;
    justify-content: end;
    margin-top: 1rem;
}

.ledger-tabs-header {
    align-items: center;
}

.crm-tabs {
    gap: .45rem;
}

.crm-tabs .nav-link {
    min-height: 40px;
    border: 1px solid #e7edf5;
    border-radius: 8px;
    color: #687386;
    font-weight: 850;
    background: #fff;
}

.crm-tabs .nav-link:hover {
    color: var(--crm-primary);
    border-color: color-mix(in srgb, var(--crm-primary) 18%, #e7edf5);
}

.crm-tabs .nav-link.active {
    color: #fff;
    background: var(--crm-primary);
    border-color: var(--crm-primary);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--crm-primary) 22%, transparent);
}

.dashboard-insights .crm-card {
    height: 100%;
}

.insight-circle-card {
    min-height: 162px;
    display: grid;
    place-items: center;
    gap: .75rem;
    padding: 1rem;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fff;
}

.insight-circle {
    --circle-color: var(--crm-primary);
    --progress: 0;
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--circle-color) calc(var(--progress) * 1%), #edf1f7 0);
    position: relative;
}

.insight-circle::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px #edf1f7;
}

.insight-circle > div {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: .15rem;
    color: var(--circle-color);
}

.insight-circle i {
    font-size: 1.1rem;
}

.insight-circle strong {
    font-size: 1.05rem;
    font-weight: 900;
}

.insight-circle-text {
    width: 100%;
    display: grid;
    gap: .25rem;
    text-align: center;
}

.insight-circle-text span {
    color: #7b86a0;
    font-weight: 800;
    line-height: 1.2;
}

.insight-circle-text strong {
    color: var(--crm-secondary);
    font-size: 1rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.insight-danger .insight-circle {
    --circle-color: #ff4d5e;
}

.insight-warning .insight-circle {
    --circle-color: #ffb800;
}

.insight-secondary .insight-circle {
    --circle-color: var(--crm-secondary);
}

.insight-bars {
    display: grid;
    gap: .95rem;
}

.insight-bar-row {
    display: grid;
    gap: .45rem;
}

.insight-bar-row span {
    min-width: 0;
    color: var(--crm-secondary);
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insight-bar-row strong {
    color: var(--crm-primary);
    font-weight: 900;
}

.insight-bar-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #edf1f7;
}

.insight-bar-track span {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: var(--crm-primary);
    min-width: 8px;
}

.confirmed-list {
    display: grid;
    gap: .65rem;
}

.confirmed-list a {
    display: grid;
    gap: .2rem;
    padding: .8rem;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    color: var(--crm-secondary);
    text-decoration: none;
    background: #fff;
}

.confirmed-list a:hover {
    color: var(--crm-primary);
    border-color: color-mix(in srgb, var(--crm-primary) 18%, #fff);
    transform: translateY(-2px);
}

.confirmed-list span {
    font-weight: 900;
}

.confirmed-list small {
    color: #7b86a0;
    line-height: 1.35;
}

.btn {
    border-radius: 8px;
    font-weight: 750;
    min-height: 38px;
}

.btn-sm {
    min-height: 34px;
}

.btn-lg {
    min-height: 48px;
}

.btn-icon {
    border-radius: 8px;
}

.btn-light {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #e8edf5;
    --bs-btn-hover-bg: #f7f9fd;
    --bs-btn-hover-border-color: #dfe6f0;
    color: #263348;
}

.btn-outline-secondary {
    --bs-btn-color: var(--crm-secondary);
    --bs-btn-border-color: #e1e7f0;
    --bs-btn-hover-bg: var(--crm-secondary);
    --bs-btn-hover-border-color: var(--crm-secondary);
    --bs-btn-hover-color: #fff;
}

.btn-primary,
.btn-outline-primary:hover {
    box-shadow: 0 10px 22px color-mix(in srgb, var(--crm-primary) 22%, transparent);
}

.form-label {
    color: #2b364a;
    font-weight: 750;
    margin-bottom: .45rem;
}

.form-control,
.form-select,
.select2-container .select2-selection--single {
    min-height: 42px;
    border-color: #dfe6f0;
    border-radius: 8px;
    color: #263348;
}

.form-control::placeholder {
    color: #9aa6ba;
}

textarea.form-control {
    min-height: 92px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    min-height: 40px;
    line-height: 40px;
    padding-inline-start: .85rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.badge,
.badge-soft {
    border-radius: 999px;
    padding: .42rem .62rem;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .48rem .8rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .8rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.status-badge i {
    font-size: .82rem;
}

.status-badge--warning {
    background: #fff7df;
    color: #a16207;
    border-color: #fde68a;
}

.status-badge--success {
    background: #e6f8ee;
    color: #168a42;
    border-color: #b7ebca;
}

.status-badge--info {
    background: #e7f3ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.status-badge--secondary {
    background: #edf2f7;
    color: #475569;
    border-color: #d9e2ec;
}

.status-badge--danger {
    background: #ffe4e8;
    color: #c1121f;
    border-color: #fecdd3;
}

.status-badge--primary {
    background: color-mix(in srgb, var(--crm-primary) 12%, #fff);
    color: var(--crm-primary);
    border-color: color-mix(in srgb, var(--crm-primary) 24%, #fff);
}

.badge.bg-primary,
.badge.text-bg-primary {
    background-color: color-mix(in srgb, var(--crm-primary) 14%, #fff) !important;
    color: var(--crm-primary) !important;
}

.badge.bg-secondary,
.badge.text-bg-secondary,
.badge.bg-dark {
    background-color: color-mix(in srgb, var(--crm-secondary) 12%, #fff) !important;
    color: var(--crm-secondary) !important;
}

.badge.bg-success {
    background-color: #e6fbf2 !important;
    color: #11a66a !important;
}

.badge.bg-danger {
    background-color: #fff0f2 !important;
    color: #e03148 !important;
}

.badge.bg-warning {
    background-color: #fff7df !important;
    color: #b87900 !important;
}

.badge.bg-info {
    background-color: color-mix(in srgb, var(--crm-primary) 12%, #fff) !important;
    color: var(--crm-primary) !important;
}

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

.table {
    --bs-table-bg: #fff;
    --bs-table-hover-bg: #f7f9fd;
    margin-bottom: 0;
    color: #253149;
}

.table-hover > tbody > tr:hover > * {
    color: var(--crm-secondary);
}

.table > :not(caption) > * > * {
    padding: 1rem .95rem;
    border-bottom-color: #edf1f7;
    vertical-align: middle;
}

.table thead th {
    background: #f8fafd;
    color: #56627a;
    font-size: .76rem;
    font-weight: 850;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    font-weight: 580;
}

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

.table-actions .btn-icon {
    width: 36px;
    height: 36px;
}

.dt-container {
    color: #4d5870;
}

.dt-container .dt-layout-row {
    margin: 0 0 1rem;
    align-items: center;
    row-gap: .75rem;
}

.dt-container .dt-layout-row:first-child,
.dt-container .dt-layout-row:nth-child(2) {
    padding: .85rem 0;
    border-bottom: 1px solid #edf1f7;
}

.dt-container .dt-layout-start,
.dt-container .dt-layout-end {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.dt-container .dt-length {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: #7b86a0;
    font-weight: 750;
}

.dt-container .dt-length select {
    min-width: 86px;
    min-height: 42px;
    border: 1px solid #dfe6f0;
    border-radius: 8px;
    padding: .4rem 2rem .4rem .75rem;
    color: var(--crm-secondary);
    background-color: #fff;
    font-weight: 850;
    outline: none;
}

.dt-container .dt-length select:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--crm-primary) 16%, transparent);
}

.dt-container .dt-search label {
    display: none;
}

.dt-container .dt-search {
    position: relative;
}

.dt-container .dt-search::before {
    content: "\f002";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    inset-inline-start: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa6ba;
    pointer-events: none;
}

.dt-container .dt-search input {
    min-height: 42px;
    min-width: min(360px, 58vw);
    border: 1px solid #dfe6f0;
    border-radius: 8px;
    padding: .45rem .9rem .45rem 2.35rem;
    outline: none;
    background-color: #fff;
}

[dir="rtl"] .dt-container .dt-search input {
    padding: .45rem 2.35rem .45rem .9rem;
}

.dt-container .dt-search input:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--crm-primary) 18%, transparent);
}

.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.dt-buttons .btn,
.dt-button {
    border-radius: 8px !important;
    border-color: #e6ebf3 !important;
    background: #fff !important;
    color: var(--crm-secondary) !important;
    font-weight: 800 !important;
    min-height: 42px;
    padding: .55rem .85rem !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .04);
}

.dt-buttons .btn:hover,
.dt-button:hover {
    border-color: var(--crm-primary) !important;
    background: var(--crm-primary) !important;
    color: #fff !important;
}

.dt-buttons .dt-export-excel {
    color: #0cad55 !important;
}

.dt-buttons .dt-export-excel:hover {
    border-color: #0cad55 !important;
    background: #0cad55 !important;
    color: #fff !important;
}

.dt-buttons .dt-export-pdf {
    color: #e03148 !important;
}

.dt-buttons .dt-export-pdf:hover {
    border-color: #e03148 !important;
    background: #e03148 !important;
    color: #fff !important;
}

.dt-buttons .dt-export-columns {
    color: var(--crm-primary) !important;
}

.dt-button-collection,
div.dt-button-collection {
    border: 1px solid #e6ebf3 !important;
    border-radius: 8px !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .16) !important;
    padding: .5rem !important;
    background: #fff !important;
}

.dt-button-collection .dt-button,
div.dt-button-collection .dt-button {
    width: 100%;
    margin: 0 0 .25rem !important;
    justify-content: flex-start;
    box-shadow: none !important;
}

.dt-button-collection .dt-button.active,
div.dt-button-collection .dt-button.active {
    background: color-mix(in srgb, var(--crm-primary) 12%, #fff) !important;
    color: var(--crm-primary) !important;
    border-color: color-mix(in srgb, var(--crm-primary) 18%, #fff) !important;
}

.dt-info {
    color: #7b86a0;
    font-weight: 750;
}

.dt-paging,
.pagination {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.dt-paging .dt-paging-button,
.page-link {
    min-width: 36px;
    min-height: 36px;
    display: inline-grid;
    place-items: center;
    border-color: #e3e9f2;
    border-radius: 8px;
    margin: 0 .12rem;
    font-weight: 750;
    background: #fff;
    color: #6c7689 !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.dt-paging .dt-paging-button {
    border: 1px solid #e3e9f2 !important;
    padding: .45rem .75rem !important;
}

.dt-paging .dt-paging-button:hover,
.page-link:hover {
    border-color: var(--crm-primary) !important;
    color: var(--crm-primary) !important;
    background: color-mix(in srgb, var(--crm-primary) 8%, #fff) !important;
}

.dt-paging .dt-paging-button.current,
.page-item.active .page-link {
    background: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #fff !important;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--crm-primary) 22%, transparent);
}

.dt-paging .dt-paging-button.disabled,
.page-item.disabled .page-link {
    opacity: .52;
    pointer-events: none;
    box-shadow: none;
}

.page-item:first-child .page-link,
.page-item:last-child .page-link {
    border-radius: 8px;
}

.alert {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.modal-content,
.swal2-popup {
    border-radius: 8px !important;
}

.crm-sidebar-backdrop {
    display: none;
}

@media (min-width: 992px) {
    .crm-sidebar {
        position: sticky;
    }
}

@media (max-width: 991px) {
    body.crm-sidebar-open {
        overflow: hidden;
    }

    .crm-shell {
        display: block;
    }

    .crm-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 1050;
        width: min(86vw, var(--sidebar-width));
        height: 100vh;
        transform: translateX(-105%);
        transition: transform .24s ease;
    }

    [dir="rtl"] .crm-sidebar {
        transform: translateX(105%);
    }

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

    .crm-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1040;
        display: block;
        background: rgba(15, 23, 42, .48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body.crm-sidebar-open .crm-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .crm-brand {
        min-height: 70px;
    }

    .crm-menu {
        display: grid;
        grid-template-columns: 1fr;
        overflow-y: auto;
        max-height: calc(100vh - 78px);
    }

    .crm-menu a {
        min-height: 48px;
    }

    .crm-topbar {
        min-height: 68px;
        padding: .75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .crm-content {
        padding: 1rem;
    }

    .crm-title {
        max-width: 56vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card-body,
    .form-section {
        padding: 1rem;
    }

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

    .stat-card--amount {
        min-height: 150px;
    }

    .stat-card-content {
        max-width: calc(100% - 74px);
    }

    .stat-card--amount .stat-card-content {
        max-width: calc(100% - 96px);
    }

    .stat-card .icon {
        font-size: 3.7rem;
    }

    .stat-card--amount .icon {
        font-size: 4.45rem;
    }

    .dt-container .dt-layout-row {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .dt-container .dt-search,
    .dt-container .dt-search input,
    .dt-buttons {
        width: 100%;
    }

    .dt-buttons .btn,
    .dt-button {
        flex: 1 1 130px;
    }

    .table > :not(caption) > * > * {
        padding: .85rem .75rem;
    }
}

@media (max-width: 575px) {
    .crm-content {
        padding: .85rem;
    }

    .crm-topbar {
        gap: .75rem;
    }

    .crm-title {
        max-width: 44vw;
        font-size: 1.05rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
    }

    .card-header {
        align-items: flex-start !important;
        gap: .75rem;
    }

    .stat-card {
        min-height: 118px;
        padding: 1.1rem !important;
    }

    .stat-card--amount {
        min-height: 140px;
    }

    .stat-card .value {
        font-size: clamp(1.55rem, 9vw, 2.1rem);
    }

    .stat-card--amount .value {
        font-size: clamp(1.85rem, 9vw, 2.45rem);
    }

    .stat-card .small {
        font-size: .82rem;
    }

    .stat-card .icon {
        inset-inline-end: .8rem;
        bottom: .8rem;
        font-size: 3.1rem;
    }

    .stat-card--amount .icon {
        font-size: 3.7rem;
    }

    .quick-link-card {
        min-height: 78px;
        padding: .85rem;
    }

    .quick-link-icon {
        width: 38px;
        height: 38px;
    }
}
