/* ================================================
   STATS WIDGET (Quick Stats) - Responsive Mobile
   Bootstrap .card-group default = semua kartu sejajar 1 baris tanpa wrap.
   Dengan 9 kartu status Lead, di layar HP kartu jadi sangat sempit dan
   angka (h3) kepotong/tidak pas. Diperbaiki: scroll horizontal + font
   angka diperkecil di layar kecil, supaya tetap terbaca rapi.
   ================================================ */
@media (max-width: 767px) {
    .table-stats-cards {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .table-stats-cards .card {
        flex: 0 0 auto;
        width: 132px;
        min-width: 132px;
    }
    .table-stats-cards .card .card-body {
        padding: 10px 12px;
    }
    .table-stats-cards .card h3 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px;
    }
    .table-stats-cards .card h6.card-subtitle {
        font-size: 10.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ================================================
   CUSTOM COLOR SWATCHES - Additional status colors
   Existing 8: default(#ccc), info(#20aee3), success(#24d2b5), danger(#ff5c6c),
               warning(#ff9041), primary(#7460ee), lime(#cddc39), brown(#795548)
   ================================================ */
.bg-charcoal      { background-color: #232a37 !important; }
.bg-slate         { background-color: #607d8b !important; }
.bg-cyan          { background-color: #00bcd4 !important; }
.bg-teal          { background-color: #009688 !important; }
.bg-coral         { background-color: #e8735a !important; }
.bg-amber         { background-color: #ffc107 !important; }
.bg-indigo        { background-color: #3949ab !important; }
.bg-rose          { background-color: #e91e63 !important; }

/* label-* variants — used for status badges in task/lead/ticket lists */
.label-charcoal   { background-color: #232a37; }
.label-slate      { background-color: #607d8b; }
.label-cyan       { background-color: #00bcd4; }
.label-teal       { background-color: #009688; }
.label-coral      { background-color: #e8735a; }
.label-amber      { background-color: #ffc107; }
.label-indigo     { background-color: #3949ab; }
.label-rose       { background-color: #e91e63; }

/* ================================================
   INLINE INVOICE DISCOUNTS - Custom Styles
   ================================================ */

/* Discount column styling */
.bill_col_discount {
    min-width: 150px;
}

.bill_col_discount .input-group-append {
    width: 60px;
}

.bill_col_discount .js_item_discount_type {
    font-size: 12px;
    padding: 0.25rem;
}

/* Hide discount column when needed */
.bill_col_discount.hidden {
    display: none !important;
}

/* Disabled button styling */
button.disabled,
a.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ================================================
   KANBAN BOARD - Mouse drag horizontal scroll
   Memungkinkan scroll kiri-kanan dengan click+drag mouse
   ================================================ */
div.boards {
    cursor: grab;
    user-select: none;
    /* Cegah gesture geser (trackpad/mouse) di-interpretasi browser sebagai
       "kembali ke halaman sebelumnya" (navigasi swipe bawaan Chrome/Edge) —
       ini yang menyebabkan pindah tab tiba-tiba ke Dashboard saat geser kanban. */
    overscroll-behavior-x: contain;
    /* Scrollbar horizontal dibuat selalu terlihat & mudah dipegang, supaya
       tidak perlu klik-tahan di atas kartu (yang malah memindahkan Lead-nya)
       hanya untuk geser kanan-kiri. */
    scrollbar-width: auto;
}
div.boards.is-dragging {
    cursor: grabbing;
}
div.boards::-webkit-scrollbar {
    height: 10px;
}
div.boards::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 5px;
}
div.boards::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

/* ================================================
   LEAD MODAL - LOG / SYSTEM LOGS LIST
   HANYA max-height (bukan min-height) + scroll internal:
     - Data sedikit  -> kotak ikut mengecil sesuai isi, tidak ada ruang
                        kosong menggantung di bawah.
     - Data banyak (mis. 50 baris) -> kotak berhenti di batas 60% tinggi
                        layar dan scroll SENDIRI di dalam kotaknya,
                        tidak memaksa seluruh modal memanjang ekstrem.
   ================================================ */
#lead-logs-container,
#lead-systemlogs-container {
    max-height: 60vh;
    overflow-y: auto;
}

/* ================================================
   LOGIN PAGE - Dark background agar logo putih terlihat
   ================================================ */
html.logged-out body {
    background: #1a2332 !important;
}
html.logged-out #main-wrapper {
    background: #1a2332 !important;
    min-height: 100vh;
}
html.logged-out .login-box {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
html.logged-out .login-logo img {
    filter: none;
}

/* ================================================
   LEADS KANBAN - kartu Lead milik Sales lain (masking
   visibilitas "All Sales Activity"). Data sensitif SUDAH
   di-null-kan di server (lihat applyLeadVisibilityMasking()
   di Leads.php) — CSS ini murni untuk tampilan visual saja,
   bukan mekanisme penyembunyian data.
   ================================================ */
div.kanban-card.kanban-card-locked {
    cursor: not-allowed;
    opacity: 0.72;
    position: relative;
}
div.kanban-card.kanban-card-locked .kanban-card-locked-note {
    font-size: 10.5px;
    opacity: 0.75;
    padding: 2px 0 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
div.kanban-card.kanban-card-locked .ti-eye {
    opacity: 0.7;
}
.kanban-card-sales-owner {
    font-size: 10.5px;
    opacity: 0.65;
    margin-bottom: 4px;
}

/* ================================================
   LEADS KANBAN - Judul Lead dipotong 1 baris + "..."
   Class ".wordwrap" bawaan (white-space:normal + break-word) bikin judul
   panjang wrap ke banyak baris dan kartu jadi tinggi tidak beraturan.
   Selector di-scope KHUSUS ke .kanban-card .x-title supaya tidak
   mempengaruhi pemakaian ".wordwrap" di tempat lain.
   ================================================ */
.kanban-card .kanban-card-content-comntainer .x-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ================================================
   LEADS TABLE VIEW - Freeze kolom "Action" di sisi kanan
   supaya tetap terlihat walau tabel di-scroll ke kanan.
   Di-scope KHUSUS ke #leads-list-table supaya tidak
   mempengaruhi tabel Clients/Projects/Tasks yang pakai
   pola kelas sama ("_col_action").
   background-color:inherit dipakai (bukan warna hardcode)
   supaya otomatis ikut warna tema manapun yang aktif.
   ================================================ */
#leads-list-table th.leads_col_action,
#leads-list-table td.leads_col_action {
    position: sticky;
    right: 0;
    z-index: 2;
    background-color: inherit;
}
