:root {
    --pbi-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --bg-body-gradient: radial-gradient(circle at 18% -10%, rgba(47, 128, 255, 0.22), transparent 34%),
                        radial-gradient(circle at 88% 0%, rgba(244, 63, 94, 0.18), transparent 28%),
                        linear-gradient(180deg, #07101E 0%, #04070D 48%, #03050A 100%);
    --bg-card: linear-gradient(135deg, rgba(47, 128, 255, 0.12), transparent 34%),
               linear-gradient(180deg, rgba(15, 26, 47, 0.98), rgba(8, 14, 26, 0.98));
    --border-card: rgba(69, 98, 142, 0.46);
    --shadow-card: 0 18px 42px rgba(0, 0, 0, 0.42), 0 0 28px rgba(47, 128, 255, 0.08);
    --shadow-card-hover: 0 20px 48px rgba(0, 0, 0, 0.46), 0 0 30px rgba(244, 63, 94, 0.12);
    
    --text-main: #F4F7FB;
    --text-muted: #8FA3BD;
    --bg-input: rgba(4, 7, 13, 0.9);
    --border-input: rgba(69, 98, 142, 0.46);
    --bg-tab-active: linear-gradient(90deg, #F43F5E, #2F80FF);
    --btn-secondary-bg: rgba(11, 19, 34, 0.86);
    --btn-secondary-hover-bg: rgba(18, 31, 54, 0.98);
    --btn-secondary-border: rgba(69, 98, 142, 0.48);
    --dropdown-bg: #0B1322;
    
    --table-header-bg: rgba(47, 128, 255, 0.1);
    --table-header-text: #AFC3DD;
    --table-border: rgba(69, 98, 142, 0.28);
    --table-hover-bg: rgba(47, 128, 255, 0.08);
    
    --abc-card-bg: rgba(11, 19, 34, 0.58);
    --abc-card-border: rgba(69, 98, 142, 0.22);
    --abc-desc-bg: rgba(11, 19, 34, 0.42);
    
    --color-success: #22C55E;
    --color-success-bg: rgba(34, 197, 94, 0.12);
    --color-warning: #F59E0B;
    --color-warning-bg: rgba(245, 158, 11, 0.12);
    --color-danger: #F43F5E;
    --color-danger-bg: rgba(244, 63, 94, 0.13);
}

body.light-theme {
    --bg-body-gradient: radial-gradient(circle at 18% -10%, rgba(47, 128, 255, 0.08), transparent 34%),
                        radial-gradient(circle at 88% 0%, rgba(244, 63, 94, 0.06), transparent 28%),
                        linear-gradient(180deg, #F4F7FB 0%, #E8EEF5 48%, #DFE7F0 100%);
    --bg-card: linear-gradient(135deg, rgba(47, 128, 255, 0.05), transparent 34%),
               linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    --border-card: rgba(69, 98, 142, 0.22);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.06), 0 0 20px rgba(47, 128, 255, 0.02);
    --shadow-card-hover: 0 14px 36px rgba(0, 0, 0, 0.08), 0 0 25px rgba(47, 128, 255, 0.04);
    
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --bg-input: #FFFFFF;
    --border-input: rgba(69, 98, 142, 0.32);
    --bg-tab-active: linear-gradient(90deg, #2F80FF, #4F46E5);
    --btn-secondary-bg: #FFFFFF;
    --btn-secondary-hover-bg: #F3F4F6;
    --btn-secondary-border: rgba(69, 98, 142, 0.28);
    --dropdown-bg: #FFFFFF;
    
    --table-header-bg: rgba(47, 128, 255, 0.06);
    --table-header-text: #4B5563;
    --table-border: rgba(69, 98, 142, 0.16);
    --table-hover-bg: rgba(47, 128, 255, 0.04);
    
    --abc-card-bg: rgba(255, 255, 255, 0.8);
    --abc-card-border: rgba(69, 98, 142, 0.15);
    --abc-desc-bg: rgba(243, 244, 246, 0.7);
    
    --color-success: #15803D;
    --color-success-bg: rgba(21, 128, 61, 0.1);
    --color-warning: #B45309;
    --color-warning-bg: rgba(180, 83, 9, 0.1);
    --color-danger: #BE123C;
    --color-danger-bg: rgba(190, 18, 60, 0.1);
}

/* Core Layout Overrides to achieve Power BI Light Modern Look */
body {
    font-family: var(--pbi-font) !important;
    background-color: var(--bg-primary) !important;
    color: var(--text-main) !important;
    background-image: none !important;
    /* Disables raw retro grids from base.html */
}

h1,
h2,
h3,
h4,
h5,
h6,
.sidebar-brand-title,
.card-title-custom,
.display-type {
    font-family: var(--pbi-font) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--text-main) !important;
}

/* Fluent Style Cards */
.card-custom {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108) !important;
    padding: 20px !important;
    margin-bottom: 10px !important;
    transition: box-shadow 0.2s ease;
}

.card-custom:hover {
    box-shadow: 0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108) !important;
}

.card-title-custom {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
    margin-bottom: 16px !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title-custom i {
    color: var(--accent) !important;
    font-size: 1.1rem;
}

/* Fluent Navigation Tabs */
.nav-tabs-fluent {
    border-bottom: 1px solid var(--border-color) !important;
    gap: 24px;
    margin-bottom: 24px !important;
}

.nav-tabs-fluent .nav-item {
    margin-bottom: 0;
}

.nav-tabs-fluent .nav-link {
    border: none !important;
    color: var(--text-muted) !important;
    font-family: var(--pbi-font) !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    padding: 8px 4px 12px 4px !important;
    background: transparent !important;
    position: relative;
    border-radius: 0 !important;
    transition: color 0.15s ease;
}

.nav-tabs-fluent .nav-link:hover {
    color: var(--text-main) !important;
}

.nav-tabs-fluent .nav-link.active {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

.nav-tabs-fluent .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--accent);
    border-radius: 3px 3px 0 0;
}

/* Header and Buttons */
.page-header-fluent {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108) !important;
    padding: 16px 20px !important;
    position: relative;
    overflow: visible;
    z-index: 6;
}

.btn-refresh-fluent {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1s linear infinite;
    display: inline-block;
}

.btn-refresh-fluent:hover {
    background-color: rgba(204, 20, 57, 0.08);
    color: var(--accent-hover);
}

.btn-refresh-fluent[disabled] {
    color: #A19F9D;
    cursor: not-allowed;
    background: transparent;
}

.btn-secondary-fluent {
    background-color: #0E131F;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--pbi-font) !important;
    font-weight: 500;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.85rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary-fluent:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-main);
    border-color: rgba(122, 139, 153, 0.3);
}

.dropdown-menu-fluent {
    border-radius: 4px;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-card) !important;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1) !important;
    z-index: 1080 !important;
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.page-header-fluent .dropdown {
    position: relative;
    z-index: 7;
}

.dropdown-menu-fluent .dropdown-item {
    color: var(--text-main) !important;
    font-family: var(--pbi-font) !important;
    font-size: 0.85rem;
    padding: 6px 16px;
}

.dropdown-menu-fluent .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-main) !important;
}

.dropdown-menu-fluent .dropdown-item.active {
    background-color: var(--accent) !important;
    color: #FFFFFF !important;
}

.btn-accent {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #FFFFFF !important;
    border-radius: 4px !important;
    font-family: var(--pbi-font) !important;
    font-weight: 500 !important;
    padding: 6px 16px !important;
    transition: background-color 0.15s ease !important;
}

.btn-accent:hover {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
}

.btn-secondary-custom {
    background-color: #0E131F !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    font-family: var(--pbi-font) !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    padding: 6px 16px !important;
    transition: background-color 0.15s ease !important;
}

.btn-secondary-custom:hover {
    background-color: var(--bg-card-hover) !important;
    border-color: rgba(122, 139, 153, 0.3) !important;
}

/* Fluent Inputs and Forms */
.form-control,
.form-select {
    background-color: #080B11 !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: 4px !important;
    font-family: var(--pbi-font) !important;
    font-size: 0.875rem !important;
    padding: 6px 12px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(204, 20, 57, 0.2) !important;
    background-color: #080B11 !important;
    color: var(--text-main) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

/* Fluent Tables styling */
.table-custom {
    font-family: var(--pbi-font) !important;
    font-size: 0.85rem !important;
    border-collapse: collapse !important;
    width: 100% !important;
    margin-bottom: 0 !important;
}

.table-custom th {
    background-color: rgba(27, 36, 54, 0.4) !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 10px 12px !important;
    text-transform: none !important;
}

.table-custom td {
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    background-color: transparent !important;
}

.table-custom tr:hover td {
    background-color: rgba(27, 36, 54, 0.2) !important;
}

.badge {
    font-weight: 500 !important;
    font-size: 0.75rem !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
}

.badge-lfl-positive {
    background-color: rgba(34, 197, 94, 0.12) !important;
    color: #63E68E !important;
    border: 1px solid rgba(34, 197, 94, 0.5) !important;
    font-weight: 600 !important;
    font-size: 0.72rem !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
    vertical-align: middle !important;
}

.badge-lfl-negative {
    background-color: rgba(244, 63, 94, 0.13) !important;
    color: #FF7A91 !important;
    border: 1px solid rgba(244, 63, 94, 0.55) !important;
    font-weight: 600 !important;
    font-size: 0.72rem !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
    vertical-align: middle !important;
}

/* Global classes and helper rules */
.text-accent {
    color: var(--accent) !important;
}

.text-muted {
    color: #8FA3BD !important;
}

code {
    background-color: rgba(47, 128, 255, 0.12) !important;
    color: #9BC2FF !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: var(--font-ui) !important;
    font-size: 0.85rem !important;
}

/* Scrollbars for chat and overflow components */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background-color: #2F80FF;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #F43F5E;
}

.max-w-75 {
    max-width: 75%;
}

/* AI Chat Tab Suggestion buttons */
.btn-outline-custom {
    color: #AFC3DD;
    border: 1px solid rgba(69, 98, 142, 0.46);
    background: rgba(11, 19, 34, 0.78);
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-family: var(--pbi-font);
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-outline-custom:hover {
    color: #FFFFFF;
    border-color: rgba(47, 128, 255, 0.62);
    background: rgba(47, 128, 255, 0.12);
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    height: 6px;
    width: 6px;
    background-color: #8FA3BD;
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -1.1s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: -0.9s;
}

@keyframes bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

/* Premium client dashboard layer */
body {
    background: var(--bg-body-gradient) !important;
}

.page-header-fluent,
.card-custom {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-card) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-card) !important;
}

.card-custom:hover {
    border-color: var(--color-danger) !important;
    box-shadow: var(--shadow-card-hover) !important;
}

.nav-tabs-fluent {
    border-bottom-color: var(--table-border) !important;
}

.nav-tabs-fluent .nav-link {
    color: var(--text-muted) !important;
}

.nav-tabs-fluent .nav-link:hover {
    color: var(--text-main) !important;
}

.nav-tabs-fluent .nav-link.active {
    color: var(--text-main) !important;
}

.nav-tabs-fluent .nav-link.active::after {
    background: var(--bg-tab-active);
}

.btn-refresh-fluent {
    color: var(--text-muted);
}

.btn-refresh-fluent:hover {
    background-color: var(--table-hover-bg);
    color: var(--text-main);
}

.btn-secondary-fluent,
.btn-secondary-custom {
    background: var(--btn-secondary-bg) !important;
    border-color: var(--btn-secondary-border) !important;
    color: var(--text-main) !important;
}

.btn-secondary-fluent:hover,
.btn-secondary-custom:hover {
    background: var(--btn-secondary-hover-bg) !important;
    border-color: var(--border-card) !important;
}

.dropdown-menu-fluent,
.dropdown-menu-fluent .dropdown-item {
    background-color: var(--dropdown-bg) !important;
    color: var(--text-main) !important;
}

.dropdown-menu-fluent .dropdown-item:hover {
    background-color: var(--table-hover-bg) !important;
}

.dropdown-menu-fluent .dropdown-item.active {
    background: var(--bg-tab-active) !important;
}

.btn-accent {
    background: var(--bg-tab-active) !important;
    border-color: var(--border-card) !important;
    color: #FFFFFF !important;
}

.btn-accent:hover {
    opacity: 0.9;
}

.form-control,
.form-select {
    background-color: var(--bg-input) !important;
    border-color: var(--border-input) !important;
    color: var(--text-main) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #2F80FF !important;
    box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.18) !important;
}

.theme-strong {
    color: var(--text-main) !important;
}

.theme-input {
    background-color: var(--bg-input) !important;
    border-color: var(--border-input) !important;
    color: var(--text-main) !important;
}

.theme-badge {
    background-color: var(--abc-card-bg) !important;
    border: 1px solid var(--abc-card-border) !important;
    color: var(--text-main) !important;
}

.table-custom th {
    background-color: var(--table-header-bg) !important;
    color: var(--table-header-text) !important;
    border-bottom-color: var(--table-border) !important;
}

.table-custom td {
    color: var(--text-main) !important;
    border-bottom-color: var(--table-border) !important;
}

.table-custom tr:hover td {
    background-color: var(--table-hover-bg) !important;
}

.badge-lfl-positive {
    background-color: var(--color-success-bg) !important;
    color: var(--color-success) !important;
    border-color: var(--color-success) !important;
}

.badge-lfl-negative {
    background-color: var(--color-danger-bg) !important;
    color: var(--color-danger) !important;
    border-color: var(--color-danger) !important;
}

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

code {
    background-color: var(--table-hover-bg) !important;
    color: var(--text-main) !important;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-tab-active);
}

.btn-outline-custom {
    color: var(--table-header-text);
    border-color: var(--border-card);
    background: var(--btn-secondary-bg);
}

.btn-outline-custom:hover {
    color: var(--text-main);
    border-color: var(--border-input);
    background: var(--table-hover-bg);
}

.typing-indicator span {
    background-color: var(--text-muted);
}

/* Custom config mode and controls */
.widget-controls,
.widget-drag-handle,
.btn-close-widget {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.config-mode .widget-controls,
.config-mode .widget-drag-handle,
.config-mode .btn-close-widget {
    opacity: 0.5;
    pointer-events: auto;
}

.config-mode .card-custom:hover .widget-controls,
.config-mode .card-custom:hover .btn-close-widget {
    opacity: 1;
}

.config-mode .grid-stack-item .card-custom {
    outline: 2px dashed rgba(244, 63, 94, 0.4);
    outline-offset: -2px;
}

.config-mode .grid-stack-item .card-custom:hover {
    outline-color: rgba(244, 63, 94, 0.8);
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.15) !important;
}

.widget-drag-handle {
    cursor: grab;
    padding: 2px 4px;
}
.widget-drag-handle:active {
    cursor: grabbing;
}
.btn-close-widget {
    background: transparent;
    border: none;
    color: var(--text-muted);
}
.btn-close-widget:hover {
    color: #F43F5E !important;
}

/* Adjust title padding for charts to prevent overlap with controls */
.card-title-custom {
    /* padding-right: 48px; */
    position: relative;
}

.card-title-custom .widget-controls-inline {
    position: absolute;
    right: 0;
    top: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sortable state styles */
.sortable-ghost {
    opacity: 0.4 !important;
    border: 2px dashed var(--accent) !important;
    background: rgba(47, 128, 255, 0.05) !important;
    outline: none !important;
}
.sortable-chosen {
    transform: scale(0.985);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5) !important;
}

/* Premium spring animation for restored blocks */
@keyframes widgetFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.widget-restore-anim {
    animation: widgetFadeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Unified GridStack.js Layout */
.grid-stack {
    width: 100%;
}
.grid-stack-item-content {
    width: auto !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.grid-stack-item-content .card-custom {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    min-height: 0;
    margin: 0 !important;
    overflow: visible;
}
.chart-container-wrapper {
    position: relative;
    flex: 1;
    height: 100%;
    width: 100%;
    min-height: 180px;
}
.donut-chart-layout {
    display: grid;
    grid-template-columns: minmax(180px, 0.95fr) minmax(190px, 1fr);
    align-items: center;
    gap: 14px;
    flex: 1;
    min-height: 220px;
    width: 100%;
}
.donut-chart-canvas {
    position: relative;
    width: 100%;
    min-height: 210px;
    height: 100%;
}
.donut-chart-canvas canvas {
    max-width: 100%;
}
.donut-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}
.donut-legend-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) 85px 48px;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--table-border);
    border-radius: 6px;
    background: var(--abc-card-bg);
}
.donut-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}
.donut-legend-label,
.donut-legend-value,
.donut-legend-share {
    min-width: 0;
    color: var(--text-main);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
}
.donut-legend-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.donut-legend-value,
.donut-legend-share {
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}
.donut-empty-state {
    border: 1px dashed var(--table-border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 14px;
    text-align: center;
}
.chart-kpi-header {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: -4px 0 10px;
}
.chart-kpi-stat,
.chart-total-row {
    min-width: 0;
    border: 1px solid var(--table-border);
    border-radius: 6px;
    background: var(--abc-card-bg);
    padding: 6px 8px;
}
.chart-kpi-label {
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.15;
    text-transform: uppercase;
}
.chart-kpi-value {
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.chart-total-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}
.chart-total-row b {
    color: var(--text-main);
}

.chart-medal-prefix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    height: 18px;
    border-radius: 999px;
    background: var(--table-hover-bg);
    color: var(--text-main);
    font-size: 0.64rem;
    font-weight: 800;
}
@media (max-width: 760px) {
    .chart-kpi-header {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.row.custom-cards-margin{
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* ABC Analysis Custom Styles */
.border-left-accent-a {
    border-left: 4px solid #22C55E !important;
}
.border-left-accent-b {
    border-left: 4px solid #F59E0B !important;
}
.border-left-accent-c {
    border-left: 4px solid #EF4444 !important;
}
.border-left-total {
    border-left: 4px solid var(--text-muted) !important;
}

.text-accent-a {
    color: #22C55E !important;
}
.text-accent-b {
    color: #F59E0B !important;
}
.text-accent-c {
    color: #EF4444 !important;
}
.text-accent-total {
    color: var(--text-main) !important;
}

.bg-accent-a-sub {
    background-color: rgba(34, 197, 94, 0.12) !important;
}
.bg-accent-b-sub {
    background-color: rgba(245, 158, 11, 0.12) !important;
}
.bg-accent-c-sub {
    background-color: rgba(239, 68, 68, 0.12) !important;
}

.border-accent-a-sub {
    border: 1px solid rgba(34, 197, 94, 0.25) !important;
}
.border-accent-b-sub {
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
.border-accent-c-sub {
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}

.abc-container {
    padding-bottom: 4px !important;
}

.custom-cards-margin {
    margin-bottom: 1rem !important;
}

.abc-summary-card {
    background: var(--abc-card-bg);
    border: 1px solid var(--abc-card-border);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    min-height: 82px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.abc-summary-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.abc-card-letter {
    font-size: 2.2rem;
    font-weight: 800;
    width: 38px;
    line-height: 1;
    margin-right: 12px;
    text-align: center;
}

.abc-card-details {
    flex-grow: 1;
}

.abc-card-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.abc-card-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.abc-card-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.abc-card-sub-percent {
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 1px;
}

.abc-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--table-header-text);
    border-bottom: 1px solid var(--table-border);
    padding-bottom: 4px;
}

.abc-search-input {
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border-input) !important;
    color: var(--text-main) !important;
    border-radius: 4px !important;
    font-size: 0.8rem !important;
    height: 31px;
}
.abc-search-input:focus {
    border-color: #2F80FF !important;
    box-shadow: 0 0 0 2px rgba(47, 128, 255, 0.15) !important;
}

.abc-filter-btn {
    font-size: 0.78rem !important;
    padding: 3px 12px !important;
}

.abc-metric-btn {
    font-size: 0.75rem !important;
    padding: 3px 10px !important;
    border-color: rgba(69, 98, 142, 0.35) !important;
    color: var(--text-muted) !important;
    transition: all 0.2s ease;
}
.abc-metric-btn.active, .abc-metric-btn:hover {
    background-color: #2F80FF !important;
    border-color: #2F80FF !important;
    color: #FFFFFF !important;
    font-weight: 600;
}

.abc-mode-toggle-btn {
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(47, 128, 255, 0.12);
    border: 1px solid rgba(47, 128, 255, 0.3);
    color: #2F80FF;
    font-weight: 600;
    transition: all 0.2s ease;
}
.abc-mode-toggle-btn:hover {
    background: rgba(47, 128, 255, 0.25);
    transform: scale(1.02);
}

.abc-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.abc-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(47, 128, 255, 0.3);
    border-radius: 3px;
}
.abc-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(47, 128, 255, 0.6);
}

/* Interactive hover table row highlight */
#abcTableBody tr {
    transition: background-color 0.15s ease, border-left-color 0.15s ease;
    cursor: pointer;
}
#abcTableBody tr:hover, #abcTableBody tr.abc-table-row-active {
    background-color: rgba(47, 128, 255, 0.14) !important;
}

.abc-desc-card {
    background: var(--abc-desc-bg);
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
}

.abc-desc-icon-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.abc-desc-content {
    flex-grow: 1;
}

/* Category Badges styling */
.badge.bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.15) !important;
    color: #22C55E !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    font-weight: 700;
}
.badge.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #F59E0B !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    font-weight: 700;
}
.badge.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #EF4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    font-weight: 700;
}
    border-color: var(--color-warning-bg) !important;
}
.badge.bg-danger-subtle {
    background-color: var(--color-danger-bg) !important;
    color: var(--color-danger) !important;
    border-color: var(--color-danger-bg) !important;
}

/* Final premium polish for both themes */
:root {
    --pbi-font: "Manrope", "Segoe UI", sans-serif;
    --pbi-display: "Space Grotesk", "Segoe UI", sans-serif;
}

body,
.card-custom,
.table-custom,
.btn-secondary-custom,
.dropdown-menu-fluent .dropdown-item,
.nav-tabs-fluent .nav-link {
    font-family: var(--pbi-font) !important;
}

.page-header-fluent h1,
.page-header-fluent h2,
.dashboard-title,
.card-title,
.card-title-custom {
    font-family: var(--pbi-display) !important;
    letter-spacing: 0;
}

body.light-theme {
    --bg-body-gradient:
        radial-gradient(circle at 12% 6%, rgba(47, 128, 255, 0.15), transparent 24%),
        radial-gradient(circle at 88% 8%, rgba(244, 63, 94, 0.12), transparent 18%),
        linear-gradient(180deg, #F8FBFF, #EFF4FB 56%, #E8EEF8);
    --bg-card: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.92));
    --shadow-card: 0 20px 45px rgba(15, 23, 42, 0.08), 0 0 24px rgba(47, 128, 255, 0.05);
}

.card-custom,
.page-header-fluent {
    backdrop-filter: blur(14px);
}

.btn-secondary-custom,
.dropdown-menu-fluent,
.theme-badge {
    border-radius: 8px !important;
}

/* Mobile dashboard adaptation */
@media (max-width: 992px) {
    .page-header-fluent {
        padding: 14px !important;
    }

    .page-header-fluent .d-flex.justify-content-between {
        align-items: flex-start !important;
    }

    .page-header-fluent h2 {
        font-size: 1.35rem;
        line-height: 1.15;
    }

    .nav-tabs-fluent {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 6px;
        margin-bottom: 14px !important;
        scrollbar-width: none;
    }

    .nav-tabs-fluent::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs-fluent .nav-item {
        flex: 0 0 auto;
    }

    .nav-tabs-fluent .nav-link {
        min-height: 42px;
        padding: 8px 12px !important;
        border: 1px solid var(--border-card) !important;
        border-radius: 999px !important;
        background: var(--abc-card-bg) !important;
        white-space: nowrap;
    }

    .nav-tabs-fluent .nav-link.active::after {
        display: none;
    }

    #overview > .card-custom form {
        align-items: stretch !important;
    }

    #recordCountBadgeContainer {
        width: 100%;
        justify-content: space-between;
    }

    #dashboardWidgets {
        margin-left: 0;
        margin-right: 0;
    }

    #dashboardWidgets.grid-stack {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        height: auto !important;
        min-height: 0 !important;
    }

    #dashboardWidgets > .grid-stack-item {
        position: relative !important;
        inset: auto !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        transform: none !important;
        margin: 0 !important;
    }

    #dashboardWidgets > .grid-stack-item[style] {
        transform: none !important;
    }

    .grid-stack-item-content {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .grid-stack-item-content .card-custom {
        height: auto !important;
        min-height: 0 !important;
        padding: 14px !important;
    }

    #dashboardWidgets .card-custom.h-100 {
        height: auto !important;
    }

    .chart-kpi-header {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .chart-container-wrapper {
        flex: none;
        height: auto !important;
        min-height: 260px;
        aspect-ratio: 4 / 3;
        overflow: hidden;
    }

    .chart-container-wrapper canvas {
        max-width: 100% !important;
        max-height: 100% !important;
    }

    .abc-container {
        overflow: visible !important;
    }

    .abc-container .row.g-4,
    .abc-container .row.g-3 {
        --bs-gutter-y: 12px;
    }

    .abc-container .row.g-4 > [class*="col-"],
    .abc-container .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        width: 100%;
        margin-bottom: 10px;
    }

    .abc-summary-card,
    .abc-desc-card {
        width: 100%;
        height: auto !important;
        min-height: 0;
    }

    .abc-table-wrapper {
        max-height: 360px !important;
        overflow: auto !important;
    }

    .abc-table-wrapper table {
        min-width: 760px;
    }
}

@media (max-width: 768px) {
    .page-header-fluent .d-flex.gap-2,
    .page-header-fluent .d-flex.gap-3 {
        width: 100%;
    }

    .page-header-fluent .btn,
    .page-header-fluent .dropdown,
    .page-header-fluent .dropdown > button,
    #btnToggleConfigMode {
        width: 100%;
        justify-content: center;
    }

    #customDateRangeInputs {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr;
    }

    #customDateRangeInputs.d-none {
        display: none !important;
    }

    #customDateRangeInputs input,
    #customDateRangeInputs button,
    select[name="period"] {
        width: 100% !important;
    }

    .card-title-custom {
        align-items: flex-start;
        gap: 8px;
        /* padding-right: 40px; */
        font-size: 0.9rem !important;
        line-height: 1.25;
    }

    .chart-kpi-header {
        grid-template-columns: 1fr;
    }

    .chart-kpi-stat,
    .chart-total-row {
        padding: 7px 9px;
    }

    .chart-total-row {
        gap: 6px 10px;
    }

    .chart-container-wrapper {
        min-height: 260px;
        aspect-ratio: 1 / 1;
    }

    .donut-chart-layout {
        grid-template-columns: 1fr;
        min-height: 0;
        gap: 12px;
    }

    .donut-chart-canvas {
        min-height: 230px;
        height: 230px;
    }

    .donut-chart-legend {
        gap: 6px;
    }

    .donut-legend-row {
        grid-template-columns: 12px minmax(0, 1fr) 85px;
    }

    .donut-legend-share {
        display: none;
    }

    #abcAnalysisRow .chart-container-wrapper {
        min-height: 320px;
        aspect-ratio: 1 / 1.08;
    }

    .abc-summary-card {
        min-height: 86px;
        padding: 12px;
        align-items: flex-start;
    }

    .abc-card-letter {
        font-size: 1.8rem;
        width: 30px;
        margin-right: 10px;
    }

    .abc-search-wrapper {
        width: 100% !important;
    }

    #abcCategoryFilters {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .abc-filter-btn {
        width: 100%;
    }

    .abc-desc-card {
        min-height: auto;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .card-custom {
        padding: 12px !important;
    }

    .grid-stack-item-content .card-custom {
        padding: 12px !important;
    }

    .chart-kpi-label {
        font-size: 0.58rem;
    }

    .chart-kpi-value {
        font-size: 0.72rem;
    }

    .chart-container-wrapper {
        min-height: 280px;
    }
}

/* ITS Group brand dashboard layer */
:root {
    --its-data-red: #E22520;
    --its-red-2: #F43B36;
    --its-red-3: #FE4D47;
    --its-red-4: #FF5C56;
    --its-soft-black: #333231;
    --its-soft-grey: #CDCCCB;
    --its-light-grey: #DDDDDD;
    --its-white: #FFFFFF;
    --bg-body-gradient:
        radial-gradient(circle at 12% 0%, rgba(226, 37, 32, 0.18), transparent 24%),
        linear-gradient(180deg, #151413 0%, #080807 54%, #030303 100%);
    --bg-card:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
        rgba(23, 22, 21, 0.92);
    --border-card: rgba(205, 204, 203, 0.18);
    --shadow-card: 0 22px 56px rgba(0, 0, 0, 0.42), 0 0 28px rgba(226, 37, 32, 0.08);
    --shadow-card-hover: 0 24px 58px rgba(0, 0, 0, 0.46), 0 0 32px rgba(226, 37, 32, 0.12);
    --text-main: var(--its-white);
    --text-muted: var(--its-soft-grey);
    --bg-input: rgba(8, 8, 7, 0.88);
    --border-input: rgba(205, 204, 203, 0.2);
    --bg-tab-active: linear-gradient(90deg, #E22520, #F43B36);
    --btn-secondary-bg: rgba(23, 22, 21, 0.9);
    --btn-secondary-hover-bg: rgba(51, 50, 49, 0.96);
    --btn-secondary-border: rgba(205, 204, 203, 0.2);
    --dropdown-bg: #171615;
    --table-header-bg: rgba(226, 37, 32, 0.08);
    --table-header-text: var(--its-soft-grey);
    --table-border: rgba(205, 204, 203, 0.16);
    --table-hover-bg: rgba(226, 37, 32, 0.06);
    --abc-card-bg: rgba(23, 22, 21, 0.7);
    --abc-card-border: rgba(205, 204, 203, 0.16);
    --abc-desc-bg: rgba(51, 50, 49, 0.22);
    --color-success: #2FA866;
    --color-success-bg: rgba(47, 168, 102, 0.12);
    --color-warning: #FF5C56;
    --color-warning-bg: rgba(255, 92, 86, 0.12);
    --color-danger: #E22520;
    --color-danger-bg: rgba(226, 37, 32, 0.12);
}

body.light-theme {
    --bg-body-gradient:
        radial-gradient(circle at 10% 0%, rgba(226, 37, 32, 0.1), transparent 22%),
        linear-gradient(180deg, #FFFFFF 0%, #F7F7F6 52%, #EEEEED 100%);
    --bg-card:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)),
        rgba(255, 255, 255, 0.94);
    --border-card: rgba(51, 50, 49, 0.16);
    --shadow-card: 0 18px 42px rgba(51, 50, 49, 0.08), 0 0 20px rgba(226, 37, 32, 0.04);
    --shadow-card-hover: 0 20px 46px rgba(51, 50, 49, 0.1), 0 0 24px rgba(226, 37, 32, 0.08);
    --text-main: var(--its-soft-black);
    --text-muted: #6F6D6A;
    --bg-input: var(--its-white);
    --border-input: rgba(51, 50, 49, 0.18);
    --btn-secondary-bg: var(--its-white);
    --btn-secondary-hover-bg: #F3F3F2;
    --btn-secondary-border: rgba(51, 50, 49, 0.18);
    --dropdown-bg: var(--its-white);
    --table-header-bg: rgba(226, 37, 32, 0.06);
    --table-header-text: #6F6D6A;
    --table-border: rgba(51, 50, 49, 0.12);
    --table-hover-bg: rgba(226, 37, 32, 0.045);
    --abc-card-bg: rgba(255, 255, 255, 0.86);
    --abc-card-border: rgba(51, 50, 49, 0.14);
    --abc-desc-bg: rgba(221, 221, 221, 0.36);
    --color-success: #237A48;
    --color-success-bg: rgba(35, 122, 72, 0.1);
    --color-warning: #D94741;
    --color-warning-bg: rgba(217, 71, 65, 0.1);
    --color-danger: #E22520;
    --color-danger-bg: rgba(226, 37, 32, 0.1);
}

.page-header-fluent,
.card-custom {
    border-top: 3px solid rgba(226, 37, 32, 0.72) !important;
}

.nav-tabs-fluent .nav-link.active::after,
.dropdown-menu-fluent .dropdown-item.active,
.btn-accent {
    background: var(--bg-tab-active) !important;
}

.form-control:focus,
.form-select:focus,
.abc-search-input:focus {
    border-color: var(--its-data-red) !important;
    box-shadow: 0 0 0 3px rgba(226, 37, 32, 0.14) !important;
}
.chart-kpi-stat,
.chart-total-row,
.abc-summary-card,
.abc-desc-card {
    border-color: var(--abc-card-border) !important;
}

.abc-table-wrapper::-webkit-scrollbar-thumb,
#chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-tab-active);
}

.grid-stack-item>.ui-resizable-se {
    outline: 2px dashed rgb(255 255 255 / 40%);
    outline-offset: -2px;
    border-radius: 25px;
    cursor: se-resize;
    width: 30px;
    height: 30px;
}

.gs-id-0 > .gs-id-0 > .grid-stack-item > .ui-resizable-se {
    right: 18px;
    bottom: 18px;
}

/* AI Floating Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: var(--pbi-font);
}

/* Floating Action Button (FAB) */
.ai-chat-fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(15, 26, 47, 0.75);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), 
                0 0 15px rgba(244, 63, 94, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.ai-chat-fab svg {
    color: #F43F5E;
    filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.6));
    transition: transform 0.3s ease;
}

/* FAB Hover effect */
.ai-chat-fab:hover {
    transform: scale(1.08);
    background: rgba(15, 26, 47, 0.85);
    border-color: rgba(244, 63, 94, 0.7);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), 
                0 0 25px rgba(244, 63, 94, 0.45);
}

.ai-chat-fab:hover svg {
    transform: scale(1.1);
}

.ai-chat-fab:active {
    transform: scale(0.95);
}

/* Pulse animation when closed */
.ai-chat-fab .pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(244, 63, 94, 0.6);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
    opacity: 0;
    animation: fab-pulse 4s infinite cubic-bezier(0.25, 0, 0, 1);
    pointer-events: none;
}

@keyframes fab-pulse {
    0% {
        transform: scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    30% {
        transform: scale(1.4);
        opacity: 0;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Tooltip */
.ai-chat-tooltip {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: rgba(11, 19, 34, 0.95);
    border: 1px solid rgba(244, 63, 94, 0.45);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.ai-chat-widget:hover .ai-chat-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Hide tooltip if chat window is open */
.ai-chat-widget.window-open .ai-chat-tooltip {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    height: 620px;
    background: linear-gradient(180deg, rgba(15, 26, 47, 0.98), rgba(8, 14, 26, 0.98));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(69, 98, 142, 0.46);
    border-top: 3px solid rgba(244, 63, 94, 0.82) !important;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 
                0 0 35px rgba(244, 63, 94, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.2s linear;
}

/* Header */
.ai-chat-header {
    padding: 16px 20px;
    background: rgba(11, 19, 34, 0.85);
    border-bottom: 1px solid rgba(69, 98, 142, 0.3);
}

.ai-chat-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
}

.ai-chat-close-btn:hover {
    color: #F43F5E;
    transform: rotate(90deg);
    background: rgba(244, 63, 94, 0.08);
}

/* Body */
.ai-chat-body {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Scrollable message container */
.chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Custom Webkit scrollbar for chat container */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: var(--bg-tab-active);
    border-radius: 3px;
}

/* Bubble Styling */
.chat-bubble-ai, .chat-bubble-user {
    border-radius: 12px;
    padding: 12px 16px;
    max-width: 85%;
    font-size: 13.5px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-bubble-ai {
    background-color: rgba(11, 19, 34, 0.92);
    color: #F4F7FB;
    border: 1px solid rgba(69, 98, 142, 0.46);
    border-bottom-left-radius: 3px;
}

.chat-bubble-user {
    background: linear-gradient(135deg, #F43F5E, #B51232);
    color: #FFFFFF;
    border: 1px solid rgba(244, 63, 94, 0.55);
    border-bottom-right-radius: 3px;
    white-space: pre-wrap;
}

/* Suggestions block */
.chat-suggestions {
    /* overflow-x: auto; */
    white-space: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
    height: 100%;
}

.chat-suggestions::-webkit-scrollbar {
    display: none;
}

.chat-suggestions .prompt-suggestion {
    border: 1px solid rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.05);
    color: var(--text-muted);
    border-radius: 16px;
    padding: 5px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 11px !important;
}

.chat-suggestions .prompt-suggestion:hover {
    border-color: rgba(244, 63, 94, 0.7);
    color: var(--text-main);
    background: rgba(244, 63, 94, 0.15);
}

/* Footer area */
.ai-chat-footer {
    padding: 14px 20px 20px;
    background: rgba(11, 19, 34, 0.75);
    border-top: 1px solid rgba(69, 98, 142, 0.2);
}

.form-control-custom {
    background-color: rgba(4, 7, 13, 0.6) !important;
    border: 1px solid rgba(69, 98, 142, 0.46) !important;
    color: var(--text-main) !important;
}

.form-control-custom:focus {
    border-color: #F43F5E !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15) !important;
}

.ai-chat-shell {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        radial-gradient(circle at 18% 0%, rgba(226, 37, 32, 0.2), transparent 34%),
        rgba(9, 10, 12, 0.94) !important;
    border: 1px solid rgba(221, 221, 221, 0.2) !important;
    border-top: 1px solid rgba(255, 92, 86, 0.7) !important;
    border-radius: 18px !important;
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.58),
        0 0 42px rgba(226, 37, 32, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.ai-chat-orb {
    position: absolute;
    inset: 9px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.9), rgba(255, 92, 86, 0.2) 24%, transparent 42%),
        linear-gradient(145deg, rgba(226, 37, 32, 0.95), rgba(51, 50, 49, 0.96));
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 20px rgba(226, 37, 32, 0.32);
}

.ai-chat-orb i {
    font-size: 1.35rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.45));
}

.ai-chat-fab svg {
    opacity: 0;
}

.ai-chat-header {
    position: relative;
    z-index: 2;
    min-height: 78px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
        rgba(10, 11, 13, 0.74) !important;
}

.ai-chat-shell .ai-chat-body,
.ai-chat-shell .ai-chat-footer {
    position: relative;
    z-index: 2;
}

.ai-chat-shell .ai-chat-body {
    background:
        linear-gradient(180deg, rgba(9, 10, 12, 0.42), rgba(9, 10, 12, 0.14) 42%, rgba(9, 10, 12, 0.55));
}

.ai-chat-shell .chat-messages-container {
    background: transparent !important;
}

.ai-chat-shell .ai-chat-footer {
    background: rgba(9, 10, 12, 0.58);
    border-top: 1px solid rgba(205, 204, 203, 0.14);
    backdrop-filter: blur(14px);
}

.ai-chat-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 10px;
    padding: 5px 9px;
    border: 1px solid rgba(47, 168, 102, 0.35);
    border-radius: 999px;
    color: #63E68E;
    font-size: 0.68rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(47, 168, 102, 0.1);
}

.ai-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #63E68E;
    box-shadow: 0 0 10px rgba(99, 230, 142, 0.7);
}

.ai-chat-character-stage {
    position: absolute;
    inset: 78px 0 78px;
    z-index: 0;
    pointer-events: none;
    height: auto;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 92, 86, 0.15), transparent 42%),
        linear-gradient(180deg, rgba(3, 3, 3, 0.08), rgba(3, 3, 3, 0.62));
    border-bottom: 0;
}

.ai-chat-character-stage::before {
    content: "";
    position: absolute;
    inset: 10px 42px auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 92, 86, 0.66), transparent);
    opacity: 0.8;
    z-index: 2;
}

.ai-chat-character-canvas {
    top: 10px;
    border: 5px solid white;
    border-radius: 25px;
    position: absolute;
    left: 85px;
    width: 150px;
    height: 150px;
    aspect-ratio: 1 / 1;
    transform: translateX(-50%);
    display: block;
    opacity: 0.72;
    filter: drop-shadow(0 24px 46px rgba(0, 0, 0, 0.58));
}

.ai-chat-character-preloader {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    background: rgba(9, 10, 12, 0.68);
    transition: opacity 0.36s ease;
}

.ai-chat-character-loader {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(205, 204, 203, 0.2);
    border-top-color: #FF5C56;
    animation: ai-character-spin 0.8s linear infinite;
}

.ai-chat-character-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(9, 10, 12, 0.92), transparent 24%, transparent 76%, rgba(9, 10, 12, 0.92)),
        linear-gradient(180deg, rgba(9, 10, 12, 0.42), transparent 32%, rgba(9, 10, 12, 0.9));
}

@keyframes ai-character-spin {
    to {
        transform: rotate(360deg);
    }
}

.chat-bubble-ai,
.chat-bubble-user {
    border-radius: 16px;
    max-width: min(86%, 340px);
}

.chat-bubble-ai {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent),
        rgba(21, 20, 19, 0.9) !important;
    border-color: rgba(205, 204, 203, 0.2) !important;
}

.chat-bubble-user {
    background: linear-gradient(135deg, #E22520, #FF5C56) !important;
    box-shadow: 0 12px 28px rgba(226, 37, 32, 0.25);
}

.ai-chat-command-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
    height: auto !important;
    white-space: normal !important;
    padding: 2px 0 0;
}

.ai-chat-command-bar .prompt-suggestion {
    width: 100%;
    min-height: 36px;
    border-radius: 10px !important;
    text-align: left;
    font-size: 0.72rem !important;
    line-height: 1.2;
}

.ai-chat-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(205, 204, 203, 0.18);
    border-radius: 14px;
    background: rgba(3, 3, 3, 0.45);
}

.ai-chat-composer .form-control-custom {
    width: 100% !important;
    min-width: 0;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ai-chat-send-btn {
    width: 46px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #E22520, #FF5C56);
    box-shadow: 0 10px 24px rgba(226, 37, 32, 0.28);
}

.ai-chat-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Responsive / Mobile styles */
@media (max-width: 576px) {
    .ai-chat-widget {
        right: 16px;
        bottom: 16px;
    }
    
    .ai-chat-fab {
        width: 56px;
        height: 56px;
    }
    
    .ai-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        border-top: 3px solid rgba(244, 63, 94, 0.82) !important;
    }
    
    .ai-chat-tooltip {
        display: none !important;
    }
}

/* AI Presentation Engine & Executive UI Styles */
.ai-presentation-card {
    width: 100%;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(18, 22, 31, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 77, 87, 0.22);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ai-presentation-card:hover {
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 0 24px rgba(255, 77, 87, 0.12);
}

.ai-badge-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #F4F7FB;
    letter-spacing: 0.3px;
}

.ai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.ai-kpi-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-kpi-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
    border-color: rgba(255, 77, 87, 0.3);
}

.ai-kpi-label {
    font-size: 0.78rem;
    color: #8FA3BD;
    font-weight: 500;
}

.ai-kpi-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
}

.ai-kpi-badge.positive {
    background: rgba(52, 211, 153, 0.15);
    color: #34D399;
}

.ai-kpi-badge.negative {
    background: rgba(255, 77, 87, 0.15);
    color: #FF4D57;
}

.ai-kpi-badge.neutral {
    background: rgba(143, 163, 189, 0.15);
    color: #8FA3BD;
}

.ai-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-top: 4px;
    letter-spacing: 0.4px;
}

.ai-insight-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(96, 165, 250, 0.06);
    border: 1px solid rgba(96, 165, 250, 0.18);
}

.ai-insight-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #60A5FA;
}

.ai-insight-text {
    font-size: 0.84rem;
    color: #D1D5DB;
    line-height: 1.45;
}

.ai-insight-reasons li {
    font-size: 0.8rem;
    color: #9CA3AF;
    margin-bottom: 3px;
}

.ai-recommendation-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(52, 211, 153, 0.05);
    border: 1px solid rgba(52, 211, 153, 0.18);
}

.ai-recommendation-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: #34D399;
}

.ai-recommendation-item {
    font-size: 0.82rem;
    color: #E5E7EB;
}

.ai-action-chip {
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #F4F7FB;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.ai-action-chip:hover {
    background: rgba(255, 77, 87, 0.2);
    border-color: rgba(255, 77, 87, 0.5);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 77, 87, 0.2);
}

.ai-anim-enter {
    animation: aiCardFadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes aiCardFadeUp {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-anim-stagger {
    opacity: 0;
    animation: aiStaggerPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes aiStaggerPop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sparkline-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: sparklineDraw 1.2s ease-out forwards;
}

@keyframes sparklineDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.ai-date-section {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.ai-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #F4F7FB;
    letter-spacing: 0.3px;
}

/* Executive AI Report Glassmorphism Component */
.ai-report {
    width: 100%;
    padding: 20px;
    border-radius: 22px;
    background: rgba(15, 19, 28, 0.92);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 77, 87, 0.28);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 0 35px rgba(255, 77, 87, 0.12);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.ai-report:hover {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.14), 0 0 45px rgba(255, 77, 87, 0.18);
    transform: translateY(-1px);
}

.ai-avatar-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 77, 87, 0.15);
    border: 1px solid rgba(255, 77, 87, 0.3);
    display: grid;
    place-items: center;
}

.ai-sparkline-container {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
}

.ai-chart-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #F4F7FB;
}

.ai-restaurant-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ai-restaurant-card:hover {
    border-color: rgba(255, 77, 87, 0.3);
    transform: translateY(-1px);
}

.ai-stock-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-stock-table td {
    padding: 8px 10px;
}

/* Hero KPI Full-Width Highlight Component */
.ai-hero-kpi-card {
    background: linear-gradient(135deg, rgba(255, 77, 87, 0.16) 0%, rgba(15, 26, 47, 0.95) 100%);
    border: 1px solid rgba(255, 77, 87, 0.38);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(255, 77, 87, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.12);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.ai-hero-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(255, 77, 87, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.18);
}

.ai-hero-label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #F4F7FB;
    text-transform: uppercase;
}

.ai-hero-value {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.15;
    background: linear-gradient(90deg, #FFFFFF 0%, #FF8A93 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-hero-subtitle {
    font-size: 0.78rem;
}

/* Progressive Disclosure Expander Button */
.ai-expander-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px border-secondary border-opacity-25;
    border-radius: 12px;
    color: #8FA3BD;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.ai-expander-btn:hover {
    background: rgba(255, 77, 87, 0.12);
    border-color: rgba(255, 77, 87, 0.3);
    color: #F4F7FB;
}

/* 3D Character Stage Reaction Vignettes */
.ai-chat-character-stage.state-hero .ai-chat-character-vignette {
    box-shadow: inset 0 0 50px rgba(255, 77, 87, 0.4);
}

.ai-chat-character-stage.state-warning .ai-chat-character-vignette {
    box-shadow: inset 0 0 60px rgba(245, 158, 11, 0.45);
}

.ai-chat-character-stage.state-thinking .ai-chat-character-vignette {
    box-shadow: inset 0 0 50px rgba(59, 130, 246, 0.4);
}

/* ==========================================================================
   LIGHT THEME: AI EXECUTIVE ASSISTANT WIDGET & REPORTS
   ========================================================================== */

/* Floating Action Button (FAB) & AI Orb Icon */
body.light-theme .ai-chat-fab {
    background: #FFFFFF !important;
    border: 1px solid rgba(226, 37, 32, 0.35) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 
                0 2px 8px rgba(0, 0, 0, 0.04), 
                0 0 20px rgba(226, 37, 32, 0.15) !important;
}

body.light-theme .ai-chat-fab:hover {
    background: #FFFFFF !important;
    border-color: rgba(226, 37, 32, 0.6) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12), 
                0 0 25px rgba(226, 37, 32, 0.25) !important;
}

body.light-theme .ai-chat-fab .pulse-ring {
    border: 2px solid rgba(226, 37, 32, 0.4) !important;
    box-shadow: 0 0 12px rgba(226, 37, 32, 0.2) !important;
}

body.light-theme .ai-chat-orb {
    background:
        radial-gradient(circle at 35% 25%, #FFFFFF, #FFF1F2 48%, #FFE4E6 100%) !important;
    border: 1px solid rgba(226, 37, 32, 0.25) !important;
    color: #E22520 !important;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.95), 
                0 4px 14px rgba(226, 37, 32, 0.18) !important;
}

body.light-theme .ai-chat-fab:hover .ai-chat-orb {
    background:
        radial-gradient(circle at 35% 25%, #FFFFFF, #FFE4E6 48%, #FECDD3 100%) !important;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.95), 
                0 6px 18px rgba(226, 37, 32, 0.28) !important;
}

body.light-theme .ai-chat-orb i {
    color: #E22520 !important;
    filter: drop-shadow(0 2px 4px rgba(226, 37, 32, 0.25)) !important;
}

/* Floating Tooltip */
body.light-theme .ai-chat-tooltip {
    background: #FFFFFF !important;
    border: 1px solid rgba(226, 37, 32, 0.3) !important;
    color: #1F2937 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08) !important;
}

/* Chat Shell / Window */
body.light-theme .ai-chat-window,
body.light-theme .ai-chat-shell {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98)) !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    border-top: 3px solid #E22520 !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.16), 0 4px 20px rgba(0, 0, 0, 0.06), 0 0 25px rgba(226, 37, 32, 0.06) !important;
}

/* Header */
body.light-theme .ai-chat-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92)) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
}

body.light-theme .ai-chat-header .text-main {
    color: #0F172A !important;
}

body.light-theme .ai-chat-header .text-muted {
    color: #64748B !important;
}

body.light-theme .ai-avatar-badge {
    background: rgba(226, 37, 32, 0.1) !important;
    border-color: rgba(226, 37, 32, 0.25) !important;
}

body.light-theme .ai-chat-status {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #059669 !important;
}

body.light-theme .ai-chat-status-dot {
    background: #10B981 !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5) !important;
}

body.light-theme .ai-chat-close-btn {
    color: #64748B !important;
}

body.light-theme .ai-chat-close-btn:hover {
    color: #E22520 !important;
    background: rgba(226, 37, 32, 0.08) !important;
}

/* Body & Scrollbar */
body.light-theme .ai-chat-shell .ai-chat-body {
    background: #F8FAFC !important;
}

body.light-theme .chat-messages-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .chat-messages-container::-webkit-scrollbar-thumb {
    background: #CBD5E1 !important;
}

/* Executive AI Report Card */
body.light-theme .ai-report {
    background: #FFFFFF !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

body.light-theme .ai-report:hover {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1) !important;
}

body.light-theme .ai-report .text-main,
body.light-theme .ai-badge-title {
    color: #0F172A !important;
}

body.light-theme .ai-report p,
body.light-theme .ai-report .text-secondary {
    color: #475569 !important;
}

body.light-theme .ai-section-title {
    color: #1E293B !important;
}

/* Quick Chips / Suggestions */
body.light-theme .chat-suggestions .prompt-suggestion,
body.light-theme .ai-chat-command-bar .prompt-suggestion,
body.light-theme .btn-outline-custom {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .chat-suggestions .prompt-suggestion:hover,
body.light-theme .ai-chat-command-bar .prompt-suggestion:hover,
body.light-theme .btn-outline-custom:hover {
    background: #FEE2E2 !important;
    border-color: #FCA5A5 !important;
    color: #991B1B !important;
}

/* Composer / Input Footer */
body.light-theme .ai-chat-shell .ai-chat-footer {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid #E2E8F0 !important;
}

body.light-theme .ai-chat-composer {
    background: #F1F5F9 !important;
    border: 1px solid #CBD5E1 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .ai-chat-composer:focus-within {
    background: #FFFFFF !important;
    border-color: #E22520 !important;
    box-shadow: 0 0 0 3px rgba(226, 37, 32, 0.12) !important;
}

body.light-theme .ai-chat-composer .form-control-custom {
    color: #0F172A !important;
}

body.light-theme .ai-chat-composer .form-control-custom::placeholder {
    color: #94A3B8 !important;
}

/* Chat Bubbles */
body.light-theme .chat-bubble-ai {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    color: #1E293B !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* Dynamic AI Components */
body.light-theme .ai-hero-kpi-card {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, #FFFFFF 100%) !important;
    border: 1px solid rgba(252, 165, 165, 0.7) !important;
    box-shadow: 0 8px 24px rgba(226, 37, 32, 0.08) !important;
}

body.light-theme .ai-hero-label {
    color: #1E293B !important;
}

body.light-theme .ai-hero-value {
    background: linear-gradient(90deg, #B91C1C 0%, #E11D48 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.light-theme .ai-hero-subtitle {
    color: #64748B !important;
}

body.light-theme .ai-kpi-card {
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
}

body.light-theme .ai-kpi-card:hover {
    background: #FFFFFF !important;
    border-color: #CBD5E1 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .ai-kpi-label {
    color: #64748B !important;
}

body.light-theme .ai-kpi-value {
    color: #0F172A !important;
}

body.light-theme .ai-kpi-badge.neutral {
    background: rgba(100, 116, 139, 0.12) !important;
    color: #475569 !important;
}

body.light-theme .ai-date-section {
    background: #F8FAFC !important;
    border-color: #E2E8F0 !important;
}

body.light-theme .ai-sparkline-container {
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
}

body.light-theme .ai-chart-label {
    color: #1E293B !important;
}

body.light-theme .ai-restaurant-card {
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
}

body.light-theme .ai-restaurant-card:hover {
    background: #FFFFFF !important;
    border-color: rgba(226, 37, 32, 0.3) !important;
}

body.light-theme .ai-restaurant-card .text-main {
    color: #0F172A !important;
}

body.light-theme .ai-stock-table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #1E293B !important;
    color: #1E293B !important;
}

body.light-theme .ai-stock-table td,
body.light-theme .ai-stock-table th {
    color: #1E293B !important;
    border-color: #E2E8F0 !important;
}

body.light-theme .ai-insight-card {
    background: rgba(239, 246, 255, 0.85) !important;
    border: 1px solid #BFDBFE !important;
}

body.light-theme .ai-insight-title {
    color: #1D4ED8 !important;
}

body.light-theme .ai-insight-text {
    color: #334155 !important;
}

body.light-theme .ai-insight-reasons li {
    color: #475569 !important;
}

body.light-theme .ai-recommendation-card {
    background: rgba(240, 253, 244, 0.85) !important;
    border: 1px solid #BBF7D0 !important;
}

body.light-theme .ai-recommendation-title {
    color: #15803D !important;
}

body.light-theme .ai-recommendation-item {
    color: #1E293B !important;
}

body.light-theme .ai-action-chip {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #334155 !important;
}

body.light-theme .ai-action-chip:hover {
    background: #FEE2E2 !important;
    border-color: #FCA5A5 !important;
    color: #991B1B !important;
}

body.light-theme .ai-expander-btn {
    background: #F1F5F9 !important;
    border: 1px solid #CBD5E1 !important;
    color: #475569 !important;
}

body.light-theme .ai-expander-btn:hover {
    background: #FEE2E2 !important;
    color: #991B1B !important;
}

body.light-theme .ai-chat-character-stage {
    background: radial-gradient(circle at 50% 42%, rgba(255, 92, 86, 0.08), transparent 42%), linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(241, 245, 249, 0.8)) !important;
}

body.light-theme .ai-chat-character-vignette {
    background: linear-gradient(90deg, rgba(248, 250, 252, 0.8), transparent 24%, transparent 76%, rgba(248, 250, 252, 0.8)), linear-gradient(180deg, rgba(248, 250, 252, 0.3), transparent 32%, rgba(248, 250, 252, 0.85)) !important;
}

body.light-theme .ai-chat-character-preloader {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #64748B !important;
}

/* Stock Management Styles */
@media (min-width: 768px) {
    .col-md-2-4 {
        flex: 0 0 auto;
        width: 20%;
    }
}

.stock-pill-btn {
    background: var(--abc-card-bg);
    border: 1px solid var(--abc-card-border);
    color: var(--text-muted);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.stock-pill-btn:hover {
    color: var(--text-main);
    border-color: var(--border-card);
}

.stock-pill-btn.active {
    background: rgba(226, 37, 32, 0.15);
    border-color: rgba(226, 37, 32, 0.5);
    color: var(--text-main);
}

.badge-stock-status {
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-stock-neg {
    background-color: rgba(239, 68, 68, 0.18);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-stock-zero {
    background-color: rgba(143, 163, 189, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(143, 163, 189, 0.3);
}

.badge-stock-crit {
    background-color: rgba(245, 158, 11, 0.18);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-stock-ok {
    background-color: rgba(34, 197, 94, 0.18);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.stock-row-negative {
    background-color: rgba(239, 68, 68, 0.07) !important;
}

.stock-row-critical {
    background-color: rgba(245, 158, 11, 0.05) !important;
}

.stock-table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: inset 0 -1px 0 var(--table-border);
}

.stock-analytics-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--abc-card-bg);
    border: 1px solid var(--abc-card-border);
}

/* Scroll Snap Alignment for Tables (Row boundary snapping) */
.abc-table-wrapper,
.stock-table-wrapper {
    scroll-snap-type: y proximity;
    scroll-padding-top: 42px;
}

#abcTable thead th,
#stockTable thead th,
.stock-table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: inset 0 -1px 0 var(--table-border);
}

#abcTable tbody tr,
#stockTable tbody tr,
.stock-row {
    scroll-snap-align: start;
    scroll-margin-top: 42px;
}

/* ==========================================================================
   Modern Stock Management Styles
   ========================================================================== */
.badge-stock-deficit {
    background-color: rgba(239, 68, 68, 0.18) !important;
    color: #EF4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

.badge-stock-below-min {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #F59E0B !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

.badge-stock-normal {
    background-color: rgba(34, 197, 94, 0.18) !important;
    color: #22C55E !important;
    border: 1px solid rgba(34, 197, 94, 0.35) !important;
}

.badge-stock-surplus {
    background-color: rgba(59, 130, 246, 0.18) !important;
    color: #3B82F6 !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
}

.badge-stock-zero {
    background-color: rgba(156, 163, 175, 0.18) !important;
    color: #9CA3AF !important;
    border: 1px solid rgba(156, 163, 175, 0.35) !important;
}

.stock-row-deficit {
    background-color: rgba(239, 68, 68, 0.06) !important;
}

.stock-row-below-min {
    background-color: rgba(245, 158, 11, 0.05) !important;
}

.stock-row-surplus {
    background-color: rgba(59, 130, 246, 0.04) !important;
}

.stock-row {
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.stock-row:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

.stock-sku-badge {
    font-size: 0.72rem;
    font-family: monospace;
    background: rgba(120, 120, 120, 0.12);
    color: var(--text-muted);
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
}

/* Stock Gauge Bar */
.stock-gauge-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 90px;
    max-width: 120px;
}

.stock-gauge-bar {
    position: relative;
    width: 100%;
    height: 7px;
    background: rgba(120, 120, 120, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.stock-gauge-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stock-gauge-fill.fill-deficit {
    background: #EF4444;
}

.stock-gauge-fill.fill-below-min {
    background: #F59E0B;
}

.stock-gauge-fill.fill-normal {
    background: #22C55E;
}

.stock-gauge-fill.fill-surplus {
    background: #3B82F6;
}

.stock-gauge-fill.fill-zero {
    background: #9CA3AF;
}

.stock-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1;
}

/* Attention Banner */
.stock-attention-banner {
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 12px 18px;
    transition: all 0.2s ease;
}

/* Mode Switcher Buttons */
.stock-mode-pill {
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border-color, rgba(120, 120, 120, 0.25));
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.stock-mode-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.stock-mode-pill.active {
    background: var(--accent-color, #4F46E5);
    color: #ffffff;
    border-color: var(--accent-color, #4F46E5);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* Expandable row accordion */
.stock-detail-row {
    background: rgba(0, 0, 0, 0.12) !important;
}

.stock-detail-card {
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bg-card, #1E222B);
    border: 1px solid var(--border-color, rgba(120, 120, 120, 0.15));
}

.stock-expand-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.stock-row.expanded .stock-expand-icon {
    transform: rotate(90deg);
}

/* Monthly Revenue Plan Trigger Button */
.btn-plan-target-edit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--accent, #2F80FF);
    border-color: var(--nb-ink, #2F80FF) !important;
    background: var(--nb-card, #2F80FF) !important;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    text-decoration: none;
    vertical-align: middle;
}

.btn-plan-target-edit i {
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    transition: transform 0.2s ease;
}

.btn-plan-target-edit:hover {
    color: #ffffff !important;
    background: var(--nb-card, #2F80FF) !important;
    border-color: var(--nb-ink, #2F80FF) !important;
    box-shadow: 0 2px 8px rgba(47, 128, 255, 0.32);
    transform: translateY(-1px);
}

.btn-plan-target-edit:hover i {
    transform: scale(1.1);
}

.btn-plan-target-edit:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(47, 128, 255, 0.2);
}

.btn-plan-target-edit:focus-visible {
    box-shadow: 0 0 0 2px rgba(47, 128, 255, 0.45);
}

/* Mobile Performance Optimizations (P0) */
@media (max-width: 767px) {
    *,
    *::before,
    *::after {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .card-custom,
    .dashboard-card,
    .glass-card,
    .page-header-fluent,
    .ai-chat-widget {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        background: rgba(11, 19, 34, 0.96) !important;
    }

    body.light-theme .card-custom,
    body.light-theme .dashboard-card,
    body.light-theme .glass-card,
    body.light-theme .page-header-fluent,
    body.light-theme .ai-chat-widget {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
        background: #ffffff !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.stop-list-search,
.stock-search {
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stop-list-search .input-group-text,
.stock-search .input-group-text {
    border: none;
    background: transparent;
    padding-left: 12px;
    padding-right: 8px;
}

.stop-list-search .form-control,
.stock-search .form-control {
    border: none !important;
    background: transparent;
    box-shadow: none !important;
    outline: none;
    padding-left: 0;
}

.stop-list-search:focus-within,
.stock-search:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.12);
}

```css
/* Единый стиль поисковых полей */
.unified-search {
    border: 1px solid var(--border-input, var(--bs-border-color));
    border-radius: 20px;
    overflow: hidden;
    background: var(--bg-input, var(--bs-body-bg));
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Иконка поиска */
.unified-search .input-group-text {
    display: flex;
    align-items: center;
    border: none !important;
    background: transparent !important;
    color: var(--text-muted, var(--bs-secondary-color));
    padding: 0 8px 0 12px;
}

/* Поле ввода */
.unified-search .form-control {
    min-width: 0;
    border: none !important;
    outline: none;
    background: transparent !important;
    color: var(--text-main, var(--bs-body-color)) !important;
    box-shadow: none !important;
    padding-left: 0;
}

/* Цвет плейсхолдера */
.unified-search .form-control::placeholder {
    color: var(--text-muted, var(--bs-secondary-color));
    opacity: 0.8;
}

/* Кнопка очистки */
.unified-search .search-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    background: transparent !important;
    color: var(--text-muted, var(--bs-secondary-color));
    padding: 0 10px;
    box-shadow: none !important;
}

.unified-search .search-clear-btn:hover {
    color: var(--text-main, var(--bs-body-color));
}

.pnl-date-group {
    border-radius: 25px;
    border: 2px solid #575757;
    width: auto;
    flex-wrap: nowrap;
}

.pnl-date-group .input-group-text {
    padding: 0 10px 0 12px;
    white-space: nowrap;
}

.pnl-date-group .form-control[type="date"] {
    width: 140px;
    min-width: 140px;
    padding: 4px 8px 4px 0;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    color: var(--text-main) !important;
    box-shadow: none !important;
}

/* Иконка календаря в тёмной теме */
[data-theme="dark"] .pnl-date-group input[type="date"],
.dark-theme .pnl-date-group input[type="date"] {
    color-scheme: dark;
}
