:root {
    --app-primary: #d32f2f;
    --app-primary-dark: #8b0000;
    --app-danger: #dc2626;
    --app-success: #16a34a;
    --app-warning: #d97706;
    --app-bg: #f4f7fb;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-text: #1e293b;
    --app-muted: #64748b;
    --app-radius: 12px;
    --app-shadow: 0 3px 16px rgba(15, 23, 42, .07);
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.nav-link,
.dropdown-item,
.form-control,
.custom-select,
.select2-container,
.btn,
.table,
label,
.pagination {
    font-size: 14px;
}

.content-wrapper {
    background: var(--app-bg);
}

.content-wrapper > .content {
    padding: 24px !important;
}

.main-header.navbar {
    min-height: 58px;
    padding: .45rem 1rem;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: 0 1px 8px rgba(15, 23, 42, .05);
}

.main-header .nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    border-radius: 8px;
    color: #475569 !important;
}

.main-header .nav-link:hover {
    background: #f1f5f9;
    color: var(--app-primary) !important;
}

.main-header .dropdown-menu {
    margin-top: 7px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

.main-header .dropdown-item {
    padding: .65rem 1rem;
}

.main-header .dropdown-item:hover {
    background: #eff6ff;
    color: var(--app-primary-dark);
}

.main-sidebar {
    box-shadow: 3px 0 18px rgba(15, 23, 42, .08) !important;
}

.brand-link {
    min-height: 58px;
    padding: .85rem 1rem;
    border-bottom-color: rgba(255, 255, 255, .1) !important;
}

.nav-sidebar {
    padding: 10px 8px;
}

.nav-sidebar .nav-item > .nav-link {
    margin-bottom: 4px;
    padding: .65rem .8rem;
    border-radius: 8px;
}

.nav-sidebar .nav-link > .nav-icon {
    width: 1.5rem;
    margin-right: .35rem;
    font-size: 14px;
}

.nav-sidebar .nav-link.active {
    background: var(--app-primary) !important;
    box-shadow: 0 5px 12px rgba(37, 99, 235, .28) !important;
}

.nav-treeview {
    padding-left: 8px;
}

.nav-treeview .nav-link {
    font-size: 14px;
}

.card {
    margin-bottom: 20px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    overflow: hidden;
}

.card-header {
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 14px;
    font-weight: 600;
}

.card-body {
    padding: 1.15rem;
}

.card-footer {
    border-top: 1px solid var(--app-border);
    background: #fafcff;
}

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

.table {
    margin-bottom: 0;
    color: var(--app-text);
}

.table thead th {
    border-top: 0;
    border-bottom: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .025em;
    text-transform: uppercase;
    vertical-align: middle;
}

.table td {
    border-color: #edf0f4;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f5f9ff;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, .7);
}

.form-control,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #fff;
    color: var(--app-text);
    box-shadow: none;
}

.form-control:focus,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

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

label {
    margin-bottom: .4rem;
    color: #475569;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 36px;
    margin: 0 5px;
    padding: .45rem .9rem;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    box-shadow: none !important;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Global heading scale — consistent hierarchy, nothing above 18px. */
h1,
.h1 {
    font-size: 18px;
    font-weight: 700;
}
h2,
.h2 {
    font-size: 17px;
    font-weight: 700;
}
h3,
.h3 {
    font-size: 16px;
    font-weight: 600;
}
h4,
.h4 {
    font-size: 15px;
    font-weight: 600;
}
h5,
.h5 {
    font-size: 14px;
    font-weight: 600;
}
h6,
.h6 {
    font-size: 13px;
    font-weight: 600;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6,
.card-header .brand-text {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: .01em;
}

.content-header h1,
.content-header .h1 {
    font-size: 18px;
    font-weight: 700;
}

.ListViewBtn {
    gap: 0;
    white-space: nowrap;
}

.ListViewBtn .btn,
.datatable .btn-view,
.datatable .btn-edit,
.datatable .btn-delete,
table.dataTable .btn-view,
table.dataTable .btn-edit,
table.dataTable .btn-delete {
    width: 30px;
    min-height: 28px;
    padding: .25rem;
}

.btn-view,
.btn-view:hover,
.btn-view:focus {
    border-color: #2563eb !important;
    background: #2563eb !important;
    color: #fff !important;
}

.btn-edit,
.btn-edit:hover,
.btn-edit:focus {
    border-color: #d97706 !important;
    background: #d97706 !important;
    color: #fff !important;
}

.btn-delete,
.btn-delete:hover,
.btn-delete:focus {
    border-color: #d32f2f !important;
    background: #d32f2f !important;
    color: #fff !important;
}

table.dataTable tbody td.select-checkbox,
table.dataTable thead th.select-checkbox {
    position: relative;
    width: 34px;
    text-align: center;
    vertical-align: middle;
}

table.dataTable tbody td.select-checkbox::before,
table.dataTable tbody td.select-checkbox::after {
    top: 50%;
    left: 50%;
    margin-top: -6px;
    margin-left: -6px;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

.main-header .user-account .username-text,
.main-header .user-account .role-text {
    font-size: 14px;
    line-height: 1.2;
}

#notification-bell .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
}

.btn:hover {
    transform: translateY(-1px);
}

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

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

.btn-danger {
    border-color: var(--app-danger);
    background: var(--app-danger);
    min-height: 36px;
    padding: .45rem .9rem;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-xs.btn-danger,
.btn-danger.btn-xs {
    min-height: 28px;
    padding: .2rem .5rem;
}

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

.btn-xs {
    min-height: 28px;
    padding: .2rem .5rem;
    border-radius: 6px;
    font-size: 14px;
}

.nav-tabs {
    gap: 4px;
    padding: 8px 10px 0;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
}

.nav-tabs .nav-link {
    padding: .7rem .95rem;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 7px 7px 0 0;
    color: var(--app-muted);
    font-weight: 600;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: #bfdbfe;
    background: #f8fafc;
    color: var(--app-primary);
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--app-primary);
    background: #eff6ff;
    color: var(--app-primary-dark);
}

.tab-content {
    background: #fff;
}

.alert {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.badge {
    padding: .4em .65em;
    border-radius: 999px;
    font-weight: 600;
}

.pagination .page-link {
    margin: 0 2px;
    border-color: var(--app-border);
    border-radius: 7px;
    color: var(--app-primary);
}

.pagination .page-item.active .page-link {
    border-color: var(--app-primary);
    background: var(--app-primary);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select,
.datatable thead .search {
    min-height: 34px;
    padding: .3rem .55rem;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
}

.dataTables_wrapper .dt-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-buttons .dt-button {
    margin: 0 !important;
}

.dataTables_wrapper .dt-button {
    padding: .38rem .7rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: #475569 !important;
}

.dropzone {
    min-height: 130px;
    border: 2px dashed #bfdbfe !important;
    border-radius: 10px;
    background: #f8fbff;
}

.main-footer {
    border-top: 1px solid var(--app-border);
    background: #fff;
    color: var(--app-muted);
}

.main-sidebar,
.sidebar-dark-primary .brand-link {
    background: #111 !important;
}

.nav-treeview .nav-link.active {
    background-color: #d32f2f !important;
    color: #fff !important;
}

.card-header.card-header-row,
.card-header.cardHeaderRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

.card-header.card-header-row .card-header-actions,
.card-header.cardHeaderRow .card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.card-header.card-header-row .btn,
.card-header.cardHeaderRow .btn {
    margin: 0;
}

.card-header.card-header-row .form-group,
.card-header.cardHeaderRow .form-group {
    margin-bottom: 0;
}
#riWarningsTab:hover,#ridownloadTab:hover{
    color:#fff;
}
.card-header.card-header-row .col-md-10,
.card-header.cardHeaderRow .col-md-10,
.card-header.card-header-row .col-md-9,
.card-header.cardHeaderRow .col-md-9,
.card-header.card-header-row .col-lg-10,
.card-header.cardHeaderRow .col-lg-10,
.card-header.card-header-row .col-lg-9,
.card-header.cardHeaderRow .col-lg-9 {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}
#loan_recovery, #loan_collateral{
    padding:15px;
}
.card-body h3 {
    font-size: 18px;
}
.Header-text{
    font-size:18px;
}

/* Datatable rows are click-to-open records — show a pointer cursor. */
table.datatable tbody tr td {
    cursor: pointer;
}
table.datatable tbody tr td a,
table.datatable tbody tr td button,
table.datatable tbody tr td input,
table.datatable tbody tr td select,
table.datatable tbody tr td label {
    cursor: pointer;
}

/* Sidebar global search — search bar when the menu is expanded, icon when
   collapsed (sidebar-mini). Hovering the collapsed mini sidebar reveals
   the bar again, matching AdminLTE's hover-expand behaviour. */
.sidebar-search-wrap .sidebar-search-toggle {
    display: none;
    text-align: center;
    padding: .55rem .5rem;
}
body.sidebar-collapse .sidebar-search-wrap .select2-container,
body.sidebar-collapse .sidebar-search-wrap select.searchable-field {
    display: none !important;
}
body.sidebar-collapse .sidebar-search-wrap {
    padding: 0 !important;
}
body.sidebar-collapse .sidebar-search-wrap .sidebar-search-toggle {
    display: block;
    width: 4.6rem;
    padding: .5rem 1rem;
    text-align: left;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-search-wrap {
    padding: 4px 10px !important;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-search-wrap .select2-container {
    display: block !important;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-search-wrap .sidebar-search-toggle {
    display: none !important;
}

@media (min-width: 768px) {
    .card-header.card-header-row .col-md-10,
    .card-header.cardHeaderRow .col-md-10,
    .card-header.card-header-row .col-lg-10,
    .card-header.cardHeaderRow .col-lg-10 {
        flex: 0 0 calc(83.333333% - 4px);
        max-width: calc(83.333333% - 4px);
    }

    .card-header.card-header-row .col-md-9,
    .card-header.cardHeaderRow .col-md-9,
    .card-header.card-header-row .col-lg-9,
    .card-header.cardHeaderRow .col-lg-9 {
        flex: 0 0 calc(75% - 4px);
        max-width: calc(75% - 4px);
    }

    .card-header.card-header-row .col-md-6,
    .card-header.cardHeaderRow .col-md-6,
    .card-header.card-header-row .col-lg-6,
    .card-header.cardHeaderRow .col-lg-6 {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
    }

    .card-header.card-header-row .col-md-2,
    .card-header.cardHeaderRow .col-md-2,
    .card-header.card-header-row .col-lg-2,
    .card-header.cardHeaderRow .col-lg-2 {
        display: flex;
        flex: 0 0 calc(16.666667% - 4px);
        max-width: calc(16.666667% - 4px);
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .card-header.card-header-row .col-md-3,
    .card-header.cardHeaderRow .col-md-3,
    .card-header.card-header-row .col-lg-3,
    .card-header.cardHeaderRow .col-lg-3 {
        display: flex;
        flex: 0 0 calc(25% - 4px);
        max-width: calc(25% - 4px);
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .card-header.cardHeaderRow .col-md-2 .form-group,
    .card-header.cardHeaderRow .col-md-3 .form-group {
        display: flex;
        gap: 8px;
        margin: 0;
    }
}

.card-body form .form-group:has(> button[type="submit"]),
.card-body form .form-group:has(> input[type="submit"]) {
    display: flex;
    justify-content: flex-end;
}

.card-body > form:not(.p-0),
.tab-pane > form.custShowForm {
    padding: 20px;
}

.card-body form:not(.form-inline) .form-group {
    margin-bottom: 12px;
    padding: 8px 10px;
}

.card-body form:not(.form-inline) .form-group > label:first-child {
    display: inline-block;
    margin-bottom: 7px;
}

.card-body form:not(.form-inline) .form-check {
    padding-top: 5px;
    padding-bottom: 5px;
}

.card-body form:not(.form-inline) .form-actions {
    padding: 10px;
}

.verification-document-card {
    display: flex;
    width: 112px;
    min-height: 96px;
    padding: 8px;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    overflow: hidden;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.verification-document-card:hover {
    border-color: #d32f2f;
    color: #8b0000;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .12);
    transform: translateY(-2px);
}

.verification-document-thumbnail {
    width: 100%;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
}

.verification-document-card .d-block {
    font-size: .72rem;
    max-width: 100%;
}

.verification-document-card small {
    font-size: .68rem;
}

.form-actions,
.card-header-actions,
.card-body form .d-flex:has(> .btn) {
    gap: 8px;
}

.card-header .btn-back {
    margin-left: auto !important;
}

.back-action-group {
    display: flex !important;
    width: 100%;
    justify-content: flex-end !important;
}

.dataTables_wrapper {
    margin: 12px 0 20px;
}

.dataTables_wrapper table.dataTable > thead > tr > th,
.dataTables_wrapper table.dataTable > tbody > tr > td {
    padding: 12px 16px;
    vertical-align: middle;
}

.dataTables_wrapper table.dataTable thead th.sorting,
.dataTables_wrapper table.dataTable thead th.sorting_asc,
.dataTables_wrapper table.dataTable thead th.sorting_desc {
    padding-right: 24px !important;
}

/* DataTables scrollX manages head/body widths inline — do not force 100%
   or table-layout here: capping scrollHeadInner at container width prevents
   scrollLeft from moving (frozen header) and auto layout desyncs columns. */

/* Notes index only (table.datatable-Note): the notes column carries raw HTML
   which can stretch the scroll-body wider than the cloned head. Scoped to
   this table — other datatables are unaffected. */
.dataTables_wrapper table.datatable-Note td {
    overflow-wrap: anywhere;
}

/* Customer show: each bank-info record renders as its own tbody group.
   A labeled header row + gap band separates consecutive records. */
.bank-info-records tbody.bank-info-record + tbody.bank-info-record tr.bank-info-record-head th {
    border-top: 14px solid var(--app-bg, #f4f7fb);
}
.bank-info-records .bank-info-record-head th {
    background: #eef2f7;
    color: #334155;
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.bank-info-records tbody.bank-info-record > tr:not(.bank-info-record-head) > th:first-child {
    width: 34%;
}

/* table.dataTable's `margin: 0 auto` centers a scroll-body table that is
   narrower than its container, while the scroll-head clone is pinned left by
   an inline margin-left — head and body then sit (container − table)/2 px
   apart. Pin the scroll-body table to the left edge (DataTables already
   pins the head clone inline).

   Separately, scrollX writes the table's natural column-width sum into
   style.width, so a table whose content is narrower than the card renders
   compressed (head and body equally). min-width:100% stretches both tables
   to fill the card; content wider than the card still overflows and scrolls
   as intended. The scrollHeadInner keeps its inline pixel width (body table
   width + scrollbar padding) — the head table's 100% resolves against that,
   so both tables stay identical. */
.dataTables_scrollBody > table.dataTable,
.dataTables_scrollHeadInner > table.dataTable {
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-width: 100%;
}

.dataTables_wrapper table.dataTable thead .sorting,
.dataTables_wrapper table.dataTable thead .sorting_asc,
.dataTables_wrapper table.dataTable thead .sorting_desc,
.dataTables_wrapper table.dataTable thead .sorting_asc_disabled,
.dataTables_wrapper table.dataTable thead .sorting_desc_disabled {
    position: relative;
    padding-right: 30px !important;
    background-image: none !important;
}

.dataTables_wrapper table.dataTable thead .sorting::before,
.dataTables_wrapper table.dataTable thead .sorting_asc::before,
.dataTables_wrapper table.dataTable thead .sorting_desc::before,
.dataTables_wrapper table.dataTable thead .sorting::after,
.dataTables_wrapper table.dataTable thead .sorting_asc::after,
.dataTables_wrapper table.dataTable thead .sorting_desc::after {
    position: absolute;
    top: 50% !important;
    right: 10px !important;
    bottom: auto !important;
    left: auto !important;
    margin: 0 !important;
    font-family: "Font Awesome 5 Free";
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-50%);
}

.dataTables_wrapper table.dataTable thead .sorting::before,
.dataTables_wrapper table.dataTable thead .sorting_asc::before,
.dataTables_wrapper table.dataTable thead .sorting_desc::before {
    display: none !important;
}

.dataTables_wrapper table.dataTable thead .sorting::after {
    content: "\f0dc" !important;
    color: #94a3b8;
    opacity: .65;
}

.dataTables_wrapper table.dataTable thead .sorting_asc::after {
    content: "\f0de" !important;
    color: #d32f2f;
    opacity: 1;
}

.dataTables_wrapper table.dataTable thead .sorting_desc::after {
    content: "\f0dd" !important;
    color: #d32f2f;
    opacity: 1;
}

.dataTables_wrapper .row:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 0;
    padding: 0 !important;
}

.btn-primary,
.btn-info {
    border-color: #d32f2f;
    background-color: #d32f2f;
}

.btn-primary:hover,
.btn-info:hover {
    border-color: #8b0000;
    background-color: #8b0000;
}

@media (max-width: 767.98px) {
    .content-wrapper > .content {
        padding: 14px !important;
    }

    .card-body {
        padding: .9rem;
    }

    .main-header.navbar {
        padding: .35rem .5rem;
    }

    .main-header .user-menu .badge {
        display: none;
    }

    .table-responsive {
        border: 1px solid var(--app-border);
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }

    .btn:not(.btn-xs) {
        margin-bottom: 3px;
    }
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: 0px !important;
    margin-left: 0px !important;
}

/* Global-search select2 dropdown must float above the sidebar menu */
.select2-dropdown {
    z-index: 9999;
}

/* Create/edit forms: two-column layout for stacked fields
   Applies to direct-child .form-group blocks of multipart forms inside cards.
   Forms already using .row/.col wrappers, index filters, and modal forms are unaffected. */
.card-body > form[enctype] {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.card-body > form[enctype] > .form-group {
    position: relative;
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 15px;
    padding-left: 15px;
}
.card-body > form[enctype] > .row {
    flex: 0 0 100%;
    max-width: 100%;
}
.card-body > form[enctype] > *:not(.form-group):not(.row):not([class*="col-"]) {
    flex: 0 0 100%;
    max-width: 100%;
}
/* Fields that need room stay full width */
.card-body > form[enctype] > .form-group:has(textarea),
.card-body > form[enctype] > .form-group:has(.dropzone),
.card-body > form[enctype] > .form-group:has(.form-check),
.card-body > form[enctype] > .form-group:has(.needsclick) {
    flex: 0 0 100%;
    max-width: 100%;
}
@media (max-width: 767.98px) {
    .card-body > form[enctype] > .form-group {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
