/*!
 * Xceler8 theme layer (DEC-067) — loaded on every admin page right after Tabler (inc/theme_styles.blade.php).
 * 1. Shell: header, sidebar, user block, Appearance panel.
 * 2. Kit patterns used by the dev UI kit and new screens (chat, KPI cards, kanban).
 * 3. Dark-mode safety net for legacy markup that still hard-codes light colours (bg-white, inline #fff …).
 * Colours only from Tabler tokens, so the colour mode and the Appearance panel reach everything.
 */

/* ---------- 1. Shell ---------- */
.page-wrapper { background-color: var(--tblr-body-bg); }

.xl-shell-top { background-color: var(--tblr-bg-surface); border-bottom: 1px solid var(--tblr-border-color); padding-left: 0; padding-right: 0; }
.xl-shell-top > header, .xl-shell-top .navbar { background-color: transparent; }
.xl-topbar { background-color: var(--tblr-bg-surface); border-bottom: 1px solid var(--tblr-border-color); min-height: 3.5rem; z-index: 1020; }

.xl-sidebar .navbar-brand img { max-height: 2.25rem; width: auto; }
[data-bs-theme=dark] .xl-sidebar .navbar-brand img,
[data-bs-theme=dark] .xl-shell-top .nav-brand img,
.xl-sidebar[data-bs-theme=dark] .navbar-brand img { filter: brightness(0) invert(1); opacity: .92; }
/* nested menu dropdowns: push the caret to the right edge (was an inline <style> in menu_items, DEC-070) */
.sidebar .dropdown-toggle::after { margin-left: auto !important; }

/* user block */
.xl-avatar { position: relative; font-weight: 600; overflow: visible; }
.xl-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.xl-avatar .badge { position: absolute; right: -1px; bottom: -1px; width: .6rem; height: .6rem; padding: 0; border: 2px solid var(--tblr-bg-surface); border-radius: 50%; }
/* DEC-102: the unread / attention count on the user avatar (the bell moved into the user menu) */
/* owner 05-10: the count is a sibling BEFORE the photo (not inside it), aligned to the photo's bottom with an 8px gap,
   so it can never cover the profile picture */
.xl-user .xl-avatar-count { position: static; align-self: flex-end; margin-right: .5rem; min-width: 1.15rem;
    padding: .15rem .35rem; font-size: .65rem; line-height: 1; border-radius: 1rem; }
.xl-user .nav-link { min-height: 2.5rem; }
.xl-user > .dropdown-toggle::after { display: none; }   /* BUG-270: class needed by tabler.js, caret not wanted */
.xl-user-menu { min-width: 15rem; }
.xl-user-menu .dropdown-header { text-transform: none; letter-spacing: normal; font-size: inherit; padding-top: .5rem; padding-bottom: .5rem; }
.xl-user-menu .dropdown-item-icon { width: 1.25rem; margin-right: .5rem; font-size: 1.1rem; opacity: .7; }

/* Appearance panel */
.xl-theme-panel { --tblr-offcanvas-width: 22rem; }
.xl-theme-panel legend { float: none; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tblr-secondary); margin-bottom: .5rem; }
.xl-theme-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.xl-theme-grid-3 .form-selectgroup-item { margin: 0; }
.xl-swatch-default { background: linear-gradient(135deg, #066fd1 50%, var(--tblr-bg-surface-secondary) 50%); }

/* Backpack's dark adjustments paint inputs / unchecked checkboxes with a fixed blue and dim input text to 50 %;
   use Tabler's neutral form tokens instead so the primary colour and contrast stay right. Same selectors, loaded later. */
[data-bs-theme=dark] input[type=checkbox]:not(:checked).form-check-input { background-color: var(--tblr-bg-forms, var(--tblr-bg-surface)); border-color: var(--tblr-border-color); }
[data-bs-theme=dark] input:not(input[type=hidden]).form-control:not(:disabled),
[data-bs-theme=dark] textarea.form-control:not(:disabled),
[data-bs-theme=dark] select.form-control:not(:disabled),
[data-bs-theme=dark] select.form-select:not(:disabled) {
    background-color: var(--tblr-bg-forms, var(--tblr-bg-surface));
    border-color: var(--tblr-border-color);
    color: var(--tblr-body-color);
}
[data-bs-theme=dark] input:not(input[type=hidden]).form-control:not(:disabled):focus,
[data-bs-theme=dark] textarea.form-control:not(:disabled):focus,
[data-bs-theme=dark] select.form-select:not(:disabled):focus { border-color: var(--tblr-primary); }

/* badges inside AG-Grid cells sit on the text baseline of a tall row */
.ag-cell .badge { vertical-align: middle; }

/* ---------- 2. Kit patterns ---------- */
.xl-kpi .xl-kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.xl-kpi .xl-kpi-chart { min-height: 40px; margin: 0 -.25rem -.5rem; }
.xl-chart { min-height: 15rem; }

.xl-chat { display: grid; grid-template-columns: 20rem 1fr; min-height: 36rem; height: calc(100vh - 14rem); }
.xl-chat-list { border-right: 1px solid var(--tblr-border-color); display: flex; flex-direction: column; min-height: 0; }
.xl-chat-list .list-group { overflow-y: auto; flex: 1; }
.xl-chat-list .list-group-item.active { background-color: var(--tblr-primary-lt, rgba(var(--tblr-primary-rgb), .08)); color: inherit; border-color: var(--tblr-border-color); }
.xl-chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.xl-chat-body { flex: 1; overflow-y: auto; padding: 1rem; background-color: var(--tblr-bg-surface); }
.xl-chat-composer { border-top: 1px solid var(--tblr-border-color); padding: .75rem; }
.xl-chat .chat-bubble { max-width: min(36rem, 85%); }
.xl-chat .chat-item-me .chat-bubble { margin-left: auto; }
.xl-typing span { display: inline-block; width: .4rem; height: .4rem; margin-right: .15rem; border-radius: 50%; background: var(--tblr-secondary); animation: xl-typing 1.2s infinite ease-in-out; }
.xl-typing span:nth-child(2) { animation-delay: .15s; }
.xl-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes xl-typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.xl-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(16rem, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.xl-kanban-col { background-color: var(--tblr-bg-surface-secondary); border-radius: var(--tblr-border-radius-lg); padding: .75rem; }

.xl-swatch { height: 3rem; border-radius: var(--tblr-border-radius); }
.xl-code { font-size: .75rem; }

@media (max-width: 991.98px) {
    .xl-chat { grid-template-columns: 1fr; height: auto; }
    .xl-chat-list { border-right: 0; border-bottom: 1px solid var(--tblr-border-color); max-height: 16rem; }
    .xl-chat-body { min-height: 24rem; }
}

/* ---------- 3. Dark-mode safety net (legacy markup; new code uses tokens) ---------- */
[data-bs-theme=dark] .bg-white { background-color: var(--tblr-bg-surface) !important; }
[data-bs-theme=dark] .bg-light { background-color: var(--tblr-bg-surface-secondary) !important; }
[data-bs-theme=dark] .text-black,
[data-bs-theme=dark] .text-dark { color: var(--tblr-body-color) !important; }
[data-bs-theme=dark] .table-light,
[data-bs-theme=dark] .thead-light th,
[data-bs-theme=dark] thead.thead-light th {
    --tblr-table-bg: var(--tblr-bg-surface-secondary);
    --tblr-table-color: var(--tblr-body-color);
    background-color: var(--tblr-bg-surface-secondary) !important;
    color: var(--tblr-body-color) !important;
    border-color: var(--tblr-border-color) !important;
}
[data-bs-theme=dark] .navbar-light { --tblr-navbar-color: var(--tblr-body-color); }

/* inline light backgrounds */
[data-bs-theme=dark] [style*="background:#fff"], [data-bs-theme=dark] [style*="background: #fff"],
[data-bs-theme=dark] [style*="background-color:#fff"], [data-bs-theme=dark] [style*="background-color: #fff"],
[data-bs-theme=dark] [style*="background:#FFF"], [data-bs-theme=dark] [style*="background: #FFF"],
[data-bs-theme=dark] [style*="background-color:#FFF"], [data-bs-theme=dark] [style*="background-color: #FFF"],
[data-bs-theme=dark] [style*="background:white"], [data-bs-theme=dark] [style*="background: white"],
[data-bs-theme=dark] [style*="background-color:white"], [data-bs-theme=dark] [style*="background-color: white"] {
    background: var(--tblr-bg-surface) !important;
}
[data-bs-theme=dark] [style*="background:#f8f9fa"],
[data-bs-theme=dark] [style*="background: #f8f9fa"],
[data-bs-theme=dark] [style*="background-color:#f8f9fa"],
[data-bs-theme=dark] [style*="background-color: #f8f9fa"],
[data-bs-theme=dark] [style*="background:#f8fafc"],
[data-bs-theme=dark] [style*="background: #f8fafc"],
[data-bs-theme=dark] [style*="background-color:#f8fafc"],
[data-bs-theme=dark] [style*="background-color: #f8fafc"],
[data-bs-theme=dark] [style*="background:#fcfcfd"],
[data-bs-theme=dark] [style*="background: #fcfcfd"],
[data-bs-theme=dark] [style*="background-color:#fcfcfd"],
[data-bs-theme=dark] [style*="background-color: #fcfcfd"],
[data-bs-theme=dark] [style*="background:#fafbff"],
[data-bs-theme=dark] [style*="background: #fafbff"],
[data-bs-theme=dark] [style*="background-color:#fafbff"],
[data-bs-theme=dark] [style*="background-color: #fafbff"],
[data-bs-theme=dark] [style*="background:#f8f9fb"],
[data-bs-theme=dark] [style*="background: #f8f9fb"],
[data-bs-theme=dark] [style*="background-color:#f8f9fb"],
[data-bs-theme=dark] [style*="background-color: #f8f9fb"],
[data-bs-theme=dark] [style*="background:#f0f0f0"],
[data-bs-theme=dark] [style*="background: #f0f0f0"],
[data-bs-theme=dark] [style*="background-color:#f0f0f0"],
[data-bs-theme=dark] [style*="background-color: #f0f0f0"],
[data-bs-theme=dark] [style*="background:#f4f2ee"],
[data-bs-theme=dark] [style*="background: #f4f2ee"],
[data-bs-theme=dark] [style*="background-color:#f4f2ee"],
[data-bs-theme=dark] [style*="background-color: #f4f2ee"],
[data-bs-theme=dark] [style*="background:#f1f5f9"],
[data-bs-theme=dark] [style*="background: #f1f5f9"],
[data-bs-theme=dark] [style*="background-color:#f1f5f9"],
[data-bs-theme=dark] [style*="background-color: #f1f5f9"],
[data-bs-theme=dark] [style*="background:#f5f5f5"],
[data-bs-theme=dark] [style*="background: #f5f5f5"],
[data-bs-theme=dark] [style*="background-color:#f5f5f5"],
[data-bs-theme=dark] [style*="background-color: #f5f5f5"],
[data-bs-theme=dark] [style*="background:#fafafa"],
[data-bs-theme=dark] [style*="background: #fafafa"],
[data-bs-theme=dark] [style*="background-color:#fafafa"],
[data-bs-theme=dark] [style*="background-color: #fafafa"],
[data-bs-theme=dark] [style*="background:#f4f6f9"],
[data-bs-theme=dark] [style*="background: #f4f6f9"],
[data-bs-theme=dark] [style*="background-color:#f4f6f9"],
[data-bs-theme=dark] [style*="background-color: #f4f6f9"],
[data-bs-theme=dark] [style*="background:#f9fafb"],
[data-bs-theme=dark] [style*="background: #f9fafb"],
[data-bs-theme=dark] [style*="background-color:#f9fafb"],
[data-bs-theme=dark] [style*="background-color: #f9fafb"],
[data-bs-theme=dark] [style*="background:#e9ecef"],
[data-bs-theme=dark] [style*="background: #e9ecef"],
[data-bs-theme=dark] [style*="background-color:#e9ecef"],
[data-bs-theme=dark] [style*="background-color: #e9ecef"],
[data-bs-theme=dark] [style*="background:#d9d9d9"],
[data-bs-theme=dark] [style*="background: #d9d9d9"],
[data-bs-theme=dark] [style*="background-color:#d9d9d9"],
[data-bs-theme=dark] [style*="background-color: #d9d9d9"],
[data-bs-theme=dark] [style*="background:#eee"],
[data-bs-theme=dark] [style*="background: #eee"],
[data-bs-theme=dark] [style*="background-color:#eee"],
[data-bs-theme=dark] [style*="background-color: #eee"],
[data-bs-theme=dark] [style*="background:#f2f2f2"],
[data-bs-theme=dark] [style*="background: #f2f2f2"],
[data-bs-theme=dark] [style*="background-color:#f2f2f2"],
[data-bs-theme=dark] [style*="background-color: #f2f2f2"] {
    background: var(--tblr-bg-surface-secondary) !important;
}
/* ...but keep the obvious status tints readable (Bootstrap alert colours used inline) */
[data-bs-theme=dark] [style*="#fff3cd"] { background: rgba(var(--tblr-warning-rgb), .16) !important; }
[data-bs-theme=dark] [style*="#f8d7da"] { background: rgba(var(--tblr-danger-rgb), .16) !important; }
[data-bs-theme=dark] [style*="#d4edda"], [data-bs-theme=dark] [style*="#d1e7dd"] { background: rgba(var(--tblr-success-rgb), .16) !important; }

/* inline dark text */
[data-bs-theme=dark] [style^="color:#0"], [data-bs-theme=dark] [style^="color: #0"],
[data-bs-theme=dark] [style*=";color:#0"], [data-bs-theme=dark] [style*="; color:#0"], [data-bs-theme=dark] [style*="; color: #0"],
[data-bs-theme=dark] [style^="color:#1"], [data-bs-theme=dark] [style^="color: #1"],
[data-bs-theme=dark] [style^="color:#2"], [data-bs-theme=dark] [style^="color: #2"],
[data-bs-theme=dark] [style*=";color:#2"], [data-bs-theme=dark] [style*="; color:#2"], [data-bs-theme=dark] [style*="; color: #2"],
[data-bs-theme=dark] [style^="color:#3"], [data-bs-theme=dark] [style^="color: #3"],
[data-bs-theme=dark] [style*=";color:#3"], [data-bs-theme=dark] [style*="; color:#3"], [data-bs-theme=dark] [style*="; color: #3"],
[data-bs-theme=dark] [style^="color:#4"], [data-bs-theme=dark] [style^="color: #4"],
[data-bs-theme=dark] [style*="; color: #4"], [data-bs-theme=dark] [style*=";color:#4"],
[data-bs-theme=dark] [style^="color:black"], [data-bs-theme=dark] [style^="color: black"],
[data-bs-theme=dark] [style*="; color: black"], [data-bs-theme=dark] [style*=";color:black"] {
    color: var(--tblr-body-color) !important;
}
[data-bs-theme=dark] [style^="color:#666"], [data-bs-theme=dark] [style^="color: #666"],
[data-bs-theme=dark] [style*="; color: #666"], [data-bs-theme=dark] [style*=";color:#666"],
[data-bs-theme=dark] [style^="color:#999"], [data-bs-theme=dark] [style^="color: #999"],
[data-bs-theme=dark] [style*="; color: #999"], [data-bs-theme=dark] [style*=";color:#999"],
[data-bs-theme=dark] [style*="color:#6c757d"], [data-bs-theme=dark] [style*="color: #6c757d"] {
    color: var(--tblr-secondary) !important;
}
[data-bs-theme=dark] [style*="border:1px solid #ddd"], [data-bs-theme=dark] [style*="border: 1px solid #ddd"],
[data-bs-theme=dark] [style*="border:1px solid #dee2e6"], [data-bs-theme=dark] [style*="border: 1px solid #dee2e6"],
[data-bs-theme=dark] [style*="border:1px solid #eee"], [data-bs-theme=dark] [style*="border: 1px solid #eee"] {
    border-color: var(--tblr-border-color) !important;
}
