/* Modals are rendered inside the row's action cell, which carries
   Bootstrap's .text-nowrap (white-space: nowrap !important) to keep the
   action BUTTONS on one line. position:fixed takes the modal out of the
   table's layout but not out of its DOM, and white-space inherits — so every
   paragraph, label and table cell inside every modal refused to wrap and ran
   out past the modal's right edge.

   Declared on the modal itself rather than unsetting the cell: the cell's
   nowrap is doing a job. A direct declaration beats an inherited value
   regardless of the !important on the ancestor, so this needs no !important
   of its own. */
.modal,
.modal .modal-content {
    white-space: normal;
}

/* The tall default is for the agreement and certificate editors, which open
   as a bare textarea before CKEditor replaces them. It used to apply to EVERY
   textarea in the app, so a two-row Note field inside an action modal rendered
   150px tall and pushed the modal's buttons off the fold.

   :not([rows]) draws the line where the markup already does: a textarea that
   states its own height means it, and one that does not is an editor. */
.ck-editor__editable,
textarea:not([rows]) {
    min-height: 150px;
}

.datatable {
    width: 100% !important;
}

.dataTables_length,
.dataTables_filter,
.dt-buttons {
    margin-bottom: 0.333em;
    margin-top: .2rem;
}

.dataTables_filter {
    margin-right: .2rem;
}

.dt-buttons .btn {
    margin-left: 0.333em;
    border-radius: 0;
}

.table.datatable {
    box-sizing: border-box;
    border-collapse: collapse;
}

table.dataTable thead th {
    border-bottom: 2px solid #c8ced3;
}

.dataTables_wrapper.no-footer .dataTables_scrollBody {
    border-bottom: 1px solid #c8ced3;
}

.select2 {
    max-width: 100%;
    width: 100% !important;
}

/* Align Select2 single-selects with Bootstrap 4 .form-control, so a searchable
   dropdown (Customer, …) sits flush with the native selects (Store, Status, …)
   everywhere in the system — same height, border, radius and text position. */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    font-size: 0.875rem; /* CoreUI .form-control font-size, so 1.5em matches its height */
    padding: 0;
    border: 1px solid #e4e7ea; /* matches CoreUI's .form-control border */
    border-radius: 0.25rem;
    background-color: #fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem);
    padding-left: 0.75rem;
    padding-right: 1.75rem;
    padding-bottom: 0;
    color: #5c6873; /* CoreUI .form-control text colour */
    font-size: 0.875rem;
    font-weight: 400;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 0.75rem + 2px);
    right: 0.5rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

.has-error .invalid-feedback {
    display: block !important;
}

.btn-info,
.badge-info {
    color: white;
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    background-image: none;
}

.sidebar .nav-item {
    cursor: pointer;
}

/* ------------------------------------------------------------------
   Sidebar scrollbar

   With every module listed the sidebar overflows and scrolls. CoreUI
   leaves it on either the browser's default bar — a wide light slab that
   reads harshly against the dark sidebar — or its PerfectScrollbar rail.
   Style both paths into a thin, translucent bar that brightens on hover.
   ------------------------------------------------------------------ */
.sidebar-nav {
    scrollbar-width: thin;                                   /* Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.38);
}

/* PerfectScrollbar variant (CoreUI adds .ps to .sidebar-nav when enabled):
   drop the grey rail fill and give the thumb the same translucent look. */
.sidebar-nav.ps .ps__rail-y {
    width: 8px;
    background: transparent !important;
}
.sidebar-nav.ps .ps__thumb-y {
    width: 5px;
    right: 2px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
}
.sidebar-nav.ps .ps__rail-y:hover .ps__thumb-y,
.sidebar-nav.ps .ps__rail-y.ps--clicking .ps__thumb-y {
    width: 6px;
    background: rgba(255, 255, 255, 0.42);
}

/* ------------------------------------------------------------------
   Sidebar width

   CoreUI hard-codes the sidebar at 200px. Widen it by 25px (-> 225px) so
   the longer module labels sit comfortably, and shift the content and
   footer across to match. The minimized rail (50px) is left untouched.
   ------------------------------------------------------------------ */
.sidebar,
.sidebar-fixed .sidebar,
.sidebar .sidebar-nav,
.sidebar .sidebar-scroll,
.sidebar .nav {
    width: 225px;
}
.app-body .sidebar {
    -ms-flex: 0 0 225px;
    flex: 0 0 225px;
}
html:not([dir=rtl]) .sidebar {
    margin-left: -225px;
}
html[dir=rtl] .sidebar {
    margin-right: -225px;
}
html:not([dir=rtl]) .sidebar-fixed.sidebar-show:not(.sidebar-minimized) .main,
html:not([dir=rtl]) .sidebar-fixed.sidebar-show:not(.sidebar-minimized) .app-footer,
html:not([dir=rtl]) .sidebar-fixed.sidebar-sm-show:not(.sidebar-minimized) .main,
html:not([dir=rtl]) .sidebar-fixed.sidebar-sm-show:not(.sidebar-minimized) .app-footer,
html:not([dir=rtl]) .sidebar-fixed.sidebar-md-show:not(.sidebar-minimized) .main,
html:not([dir=rtl]) .sidebar-fixed.sidebar-md-show:not(.sidebar-minimized) .app-footer,
html:not([dir=rtl]) .sidebar-fixed.sidebar-lg-show:not(.sidebar-minimized) .main,
html:not([dir=rtl]) .sidebar-fixed.sidebar-lg-show:not(.sidebar-minimized) .app-footer,
html:not([dir=rtl]) .sidebar-fixed.sidebar-xl-show:not(.sidebar-minimized) .main,
html:not([dir=rtl]) .sidebar-fixed.sidebar-xl-show:not(.sidebar-minimized) .app-footer {
    margin-left: 225px;
}

.btn-default {
    color: #23282c;
    background-color: #f0f3f5;
    border-color: #f0f3f5;
}

.btn-default.focus,
.btn-default:focus {
    box-shadow: 0 0 0 .2rem rgba(209, 213, 215, .5);
}

.btn-default:hover {
    color: #23282c;
    background-color: #d9e1e6;
    border-color: #d1dbe1;
}

.btn-group-xs > .btn,
.btn-xs {
    padding: 1px 5px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
}

.searchable-title {
    font-weight: bold;
}
.searchable-fields {
    padding-left:5px;
}
.searchable-link {
    padding:0 5px 0 5px;
}
.searchable-link:hover   {
    cursor: pointer;
    background: #eaeaea;
}
.select2-results__option {
    padding-left: 0px;
    padding-right: 0px;
}


/* ------------------------------------------------------------------
   Dashboard widgets

   Shared by the cheque cash dashboard and the transfer entry dashboard.
   These rules used to sit in a <style> block inside home.blade.php, so the
   transfer dashboard rendered its stat cards with no padding or sizing —
   labels pinned to the top edge and values to the bottom.
   ------------------------------------------------------------------ */

    .stat-card {
        border-radius: 10px;
        padding: 25px;
        margin-bottom: 20px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        transition: transform 0.2s, box-shadow 0.2s;
        min-height: 140px;
        display: flex;
        flex-direction: column;
    }
    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    }
    .stat-card > .d-flex {
        height: 100%;
        align-items: flex-start;
    }
    .stat-card > .d-flex > div:first-child {
        flex: 1;
        min-width: 0;
        max-width: calc(100% - 70px);
        overflow: hidden;
    }
    .stat-card-icon {
        font-size: 3rem;
        opacity: 0.9;
        flex-shrink: 0;
        margin-left: 15px;
        width: 55px;
    }
    .stat-card-value {
        font-size: 1.4rem;
        font-weight: 700;
        margin: 8px 0 0 0;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        max-width: 100%;
    }
    @media (min-width: 992px) {
        .stat-card-value {
            font-size: 1.6rem;
        }
    }
    @media (min-width: 1200px) {
        .stat-card-value {
            font-size: 1.8rem;
        }
    }
    .stat-card-label {
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: 600;
        opacity: 0.95;
        margin-bottom: 5px;
    }
    .stat-card.text-white .stat-card-label {
        color: rgba(255, 255, 255, 0.9);
    }
    @media (max-width: 576px) {
        .stat-card-value {
            font-size: 1.5rem;
        }
        .stat-card-icon {
            font-size: 2rem;
        }
    }
    .chart-container {
        position: relative;
        height: 300px;
        margin-bottom: 30px;
    }
    .chart-container-large {
        height: 400px;
    }
    /* The filter sits straight on the card body, as it does on the transfer
       entry dashboard. It used to carry its own grey fill, which read as a
       panel inside a panel once the body behind it was white. */
    .dashboard-filter {
        padding: 0;
        margin-bottom: 10px;
    }
    .section-title {
        font-size: 1.5rem;
        font-weight: 600;
        color: #343a40;
        margin: 30px 0 20px 0;
        padding-bottom: 10px;
        border-bottom: 3px solid #007bff;
        display: flex;
        align-items: center;
    }
    .section-title i {
        margin-right: 10px;
        color: #007bff;
    }
    .section-title:first-of-type {
        margin-top: 0;
    }
    /* Smaller inline context note alongside a section title, e.g. the total
       count/value summary on the cheque pipeline heading. */
    .section-title small {
        font-size: 0.85rem;
        font-weight: 400;
        color: #6c757d;
        margin-left: 10px;
    }

    /* A third, quieter line under the stat-card value — the "why" behind the
       number (counts, context, rates). Used across all three dashboards. */
    .stat-card-sub {
        font-size: 0.78rem;
        margin-top: 6px;
        line-height: 1.3;
        opacity: 0.9;
    }
    .stat-card.text-white .stat-card-sub {
        color: rgba(255, 255, 255, 0.85);
    }

    /* Light (non-gradient) stat card used for the "pipeline" rows, where the
       colour meaning carries on a left border instead of a full fill, so the
       headline money cards stay the loudest thing on the page. */
    .stat-card-light {
        background: #ffffff;
        color: #2c3e50;
        border: 1px solid #e6e9ef;
    }
    .stat-card-light .stat-card-label {
        color: #6c757d;
    }
    .stat-card-light .stat-card-sub {
        color: #8a94a6;
    }

/* ------------------------------------------------------------------
   Grids

   The row's own name links to the record, so the Show button that used
   to sit in the actions column is gone — the actions column was wider
   than the data beside it.
   ------------------------------------------------------------------ */

.grid-link { font-weight: 600; }
.grid-link:hover { text-decoration: underline; }

/* A second line of context under the primary cell, without spending a
   column on it. */
.grid-sub { display: block; font-size: 11px; color: #869099; line-height: 1.5; }

/* ------------------------------------------------------------------
   Export buttons

   Two screens build these by hand (the report toolbar, which exports the
   whole filtered result server-side) and the rest let DataTables render
   them. Both wear .export-btn so they look the same either way.

   They were btn-default, which Bootstrap 4 does not define at all, so
   they rendered as bare text; btn-outline-secondary was little better,
   being light grey on white — they read as disabled rather than as
   something to click.
   ------------------------------------------------------------------ */

/* The row itself: right-aligned, directly above the table. Applies whether
   the row is the hand-built partial or the one DataTables builds from its
   dom string, so the buttons land in the same place on every screen. */
.report-toolbar { margin-top: 15px; margin-bottom: 15px; }
.report-toolbar > [class*="col-"] {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.report-toolbar div.dt-buttons { margin-bottom: 0; float: none; }

.report-toolbar .btn-group > .export-btn,
div.dt-buttons > .export-btn,
.export-btn {
    background-color: #ffffff;
    border: 1px solid #ccd3da;
    color: #3c4b5c;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 14px;
    line-height: 1.4;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(16, 24, 32, 0.04);
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.export-btn i { margin-right: 6px; color: #8893a0; }

.export-btn:hover,
.export-btn:focus {
    background-color: #eef3f8;
    border-color: #9fb3c6;
    color: #1d4d7b;
    box-shadow: none;
}
.export-btn:hover i { color: #1d4d7b; }

/* Excel is green wherever it appears, so the icon says which is which
   before the label is read. */
.export-btn-excel i { color: #1d7044; }
.export-btn-excel:hover,
.export-btn-excel:focus {
    background-color: #e9f5ee;
    border-color: #1d7044;
    color: #145c37;
}
.export-btn-excel:hover i { color: #145c37; }

/* Join the pair into one control in both layouts. */
.report-toolbar .btn-group > .export-btn + .export-btn,
div.dt-buttons > .export-btn + .export-btn { margin-left: -1px; }
.report-toolbar .btn-group > .export-btn:not(:first-child),
div.dt-buttons > .export-btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.report-toolbar .btn-group > .export-btn:not(:last-child),
div.dt-buttons > .export-btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.export-btn:focus { position: relative; z-index: 1; }

/* The action button beside the exports (Send to bank, Mark cleared) is
   the primary thing on those screens, so it keeps its solid fill and
   only needs to match on height. */
.report-toolbar .btn-sm { font-size: 13px; padding: 6px 14px; line-height: 1.4; }

@media (max-width: 575.98px) {
    .report-toolbar .col-md-12 { justify-content: stretch !important; flex-wrap: wrap; }
    .report-toolbar .btn-group { flex: 1 1 auto; }
    .report-toolbar .btn-group > .export-btn { flex: 1 1 0; }
}

/* Customer and companies keep their search box and exports on one row, so
   the exports sit in the right half rather than on a row of their own —
   same alignment and same spacing as the toolbar row elsewhere. */
.report-toolbar-inline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
@media (max-width: 767.98px) {
    .report-toolbar-inline { margin-top: 12px; justify-content: flex-start; }
}

/* Currency Exchange's row button.
   It was `btn-warning`, the same amber as the Gold Loan button added
   beside it — two different modules reading as one colour in the customer
   grid's action row. Gold keeps the amber (the module is literally about
   gold), so Exchange moves to violet, which is the only hue in that row
   not already carrying a meaning: blue is CC/Edit, green is Transfer,
   light blue is Payday Loan, amber is Gold Loan, red is Delete.
   White on #6f42c1 is ~6.5:1, comfortably past AA for this size. */
.btn-exchange {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: #ffffff;
}
.btn-exchange:hover,
.btn-exchange:focus,
.btn-exchange.focus {
    background-color: #5c36a3;
    border-color: #543093;
    color: #ffffff;
}
.btn-exchange:focus,
.btn-exchange.focus {
    box-shadow: 0 0 0 0.2rem rgba(111, 66, 193, 0.5);
}
.btn-exchange:not(:disabled):not(.disabled):active,
.btn-exchange:not(:disabled):not(.disabled).active {
    background-color: #543093;
    border-color: #4d2c89;
    color: #ffffff;
}
