/* Premium Glassmorphic Design System */

:root {
    --bg-dark: #09090e;
    --bg-card: rgba(20, 20, 35, 0.65);
    --bg-card-hover: rgba(30, 30, 50, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(0, 242, 254, 0.4);

    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;

    /* Highlight gradients and colors */
    --cyan: #00f2fe;
    --cyan-grad: linear-gradient(135deg, #00c6ff, #00f2fe);

    --blue: #38ef7d;
    /* Soft bright blue */
    --blue-grad: linear-gradient(135deg, #0072ff, #00c6ff);

    --green: #00f260;
    --green-grad: linear-gradient(135deg, #11998e, #38ef7d);

    --purple: #bf5af2;
    --purple-grad: linear-gradient(135deg, #8e2de2, #4a00e0);

    --orange: #ff9f0a;
    --orange-grad: linear-gradient(135deg, #f857a6, #ff5858);

    --red: #ff453a;
    --red-grad: linear-gradient(135deg, #ff416c, #ff4b2b);
    --bg-sidebar: rgba(13, 13, 23, 0.95);
}

html {
    overflow-x: clip;
    max-width: 100vw;
}

@media (min-width: 992px) {
    html {
        font-size: 87.5% !important;
        /* Base 14px font scale for high-density layouts */
    }
}

body {
    background-color: var(--bg-dark);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    overflow-x: clip;
    max-width: 100vw;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6,
.view-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Sidebar Styling */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 0;
    /* Padding removed so scrollbar aligns flush with far right edge */
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden !important;
}

/* Sidebar Text Transitions */
.sidebar .menu-text,
.sidebar .profile-info,
.sidebar .profile-chevron {
    transition: opacity 0.2s ease-in-out 0.1s !important;
    opacity: 1 !important;
}

.sidebar-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 1.25rem 0.85rem 0.5rem 0.85rem;
}

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

.sidebar-divider {
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
    opacity: 1;
}

.sidebar-menu {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 4px 0 0.75rem;
    /* 4px right padding puts scrollbar flush with far right edge */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.sidebar-menu .nav-link {
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar-menu .nav-link i {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .sidebar-menu .nav-link:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.05);
    }

    .sidebar-menu .nav-link:hover i {
        transform: scale(1.15);
    }

    body.light-theme .sidebar-menu .nav-link:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.08);
    }
}

.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Sidebar nested submenus styling */
.submenu-list {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    margin-left: 0.45rem;
    /* Shifted left so sub-menu titles have full horizontal width */
    padding-left: 0.35rem;
    margin-top: 0.25rem;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.submenu-link {
    font-size: 0.83rem !important;
    padding: 0.45rem 0.5rem !important;
    border-radius: 8px !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.submenu-arrow {
    transition: transform 0.25s ease;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.nav-link:not(.collapsed) .submenu-arrow {
    transform: rotate(180deg);
}

body.light-theme .submenu-list {
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 0.85rem 1.25rem 0.85rem;
    background: var(--bg-sidebar);
}

/* Main Content Wrapper */
.main-content {
    margin-left: 250px;
    padding: 1.25rem 1.5rem;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Navbar */
.header-nav {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.875rem 1.5rem;
    margin-top: -1.25rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    width: calc(100% + 3rem);
    margin-bottom: 1.5rem !important;
}

#sidebarToggle {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.6rem !important;
    color: #ffffff !important;
    transition: all 0.2s ease-in-out !important;
}

#sidebarToggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Glassmorphic Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.border-bottom-glass {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 1.25rem 1.5rem;
}

.border-top-glass {
    border-top: 1px solid var(--border-color) !important;
    padding: 1rem 1.5rem;
}

/* Custom Card Headers (Top/Worst Products) */
.bg-soft-green-header {
    background: rgba(0, 242, 96, 0.05) !important;
}

.bg-soft-red-header {
    background: rgba(255, 69, 58, 0.05) !important;
}

.bg-soft-blue-header {
    background: rgba(0, 114, 255, 0.05) !important;
}

.bg-soft-purple-header {
    background: rgba(191, 90, 242, 0.05) !important;
}

/* Buttons */
.btn-upload-modal {
    background: rgba(0, 242, 254, 0.1);
    border: 1px dashed var(--cyan);
    color: var(--cyan);
    font-weight: 600;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.btn-upload-modal:hover {
    background: var(--cyan-grad);
    color: #000;
    border-style: solid;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.btn-danger-clear {
    background: rgba(255, 69, 58, 0.1);
    border: 1px dashed var(--red);
    color: var(--red);
    font-weight: 600;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.btn-danger-clear:hover {
    background: var(--red-grad);
    color: #fff;
    border-style: solid;
    box-shadow: 0 4px 15px rgba(255, 69, 58, 0.2);
}

body.light-theme .btn-danger-clear {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px dashed rgba(255, 255, 255, 0.25) !important;
    color: #ffd2d0 !important;
    /* Soft coral-red for danger indication but highly readable */
}

body.light-theme .btn-danger-clear:hover {
    background: #ff453a !important;
    border: 1px solid #ff453a !important;
    color: #ffffff !important;
}

.btn-primary-cyan {
    background: var(--cyan-grad);
    border: none;
    color: #000;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.btn-primary-cyan:hover:not(:disabled) {
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
    transform: translateY(-1px);
}

.btn-primary-cyan:disabled {
    opacity: 0.5;
    background: var(--text-secondary);
    color: rgba(0, 0, 0, 0.5);
}

.btn-secondary-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.btn-secondary-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.light-theme .btn-secondary-glass {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1d1d1f !important;
}

body.light-theme .btn-secondary-glass:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #000000 !important;
}

/* Report Selector Form */
.report-selector {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    color: #fff !important;
    border-radius: 10px !important;
    padding: 0.4rem 2rem 0.4rem 1rem !important;
    cursor: pointer;
    font-weight: 500;
}

.report-selector:focus {
    border-color: var(--cyan) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 242, 254, 0.15) !important;
}

.report-selector option {
    background-color: #12121e !important;
    color: #ffffff !important;
}

/* KPI Cards */
.kpi-card {
    padding: 0.875rem 1rem;
}

.view-section .card-header {
    padding: 0.75rem 1rem !important;
}

.view-section .card-body:not(.chart-container) {
    padding: 1rem !important;
}

.kpi-body {
    display: flex;
    align-items: center;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
}

/* Soft colors for icons */
.bg-soft-blue {
    background: rgba(0, 114, 255, 0.15);
}

.text-blue {
    color: #00c6ff !important;
}

.bg-soft-green {
    background: rgba(0, 242, 96, 0.15);
}

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

.bg-soft-purple {
    background: rgba(191, 90, 242, 0.15);
}

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

.bg-soft-orange {
    background: rgba(255, 159, 10, 0.15);
}

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

.bg-soft-cyan {
    background: rgba(0, 242, 254, 0.15);
}

/* KPI Grid Column adjustment */
.col-xl-2-5 {
    flex: 0 0 20%;
    max-width: 20%;
}

@media (max-width: 1100px) {
    .col-xl-2-5 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (max-width: 768px) {
    .col-xl-2-5 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 576px) {
    .col-xl-2-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Chart Canvas Sizing */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

.chart-container-large {
    position: relative;
    height: 280px;
    width: 100%;
}

/* Tables */
.table {
    border-color: var(--border-color) !important;
}

.table {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-primary) !important;
}

.table tr,
.table td {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

.table th {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-secondary) !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom-width: 1px !important;
}

.table td {
    color: var(--text-primary) !important;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}

body.light-theme .table th {
    background-color: rgba(0, 0, 0, 0.02) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .table td {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

.max-height-320 {
    max-height: 320px;
    overflow-y: auto;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Lists and Items */
.list-group-item {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 1rem 1.25rem !important;
    color: var(--text-primary) !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
}

.list-group-item:last-child {
    border-bottom: none !important;
}

.list-number-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 242, 254, 0.15);
    color: var(--cyan);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    margin-right: 0.75rem;
}

/* Empty State Styling */
.empty-icon-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(0, 242, 254, 0.05);
    border: 1px solid rgba(0, 242, 254, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.max-width-500 {
    max-width: 500px;
}

/* Badges and indicators */
.badge-low {
    background-color: rgba(52, 199, 89, 0.15) !important;
    color: #34c759 !important;
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.badge-medium {
    background-color: rgba(255, 159, 10, 0.15) !important;
    color: #ff9f0a !important;
    border: 1px solid rgba(255, 159, 10, 0.3);
}

.badge-high {
    background-color: rgba(255, 69, 58, 0.15) !important;
    color: #ff453a !important;
    border: 1px solid rgba(255, 69, 58, 0.3);
}

.badge-pill-custom {
    padding: 0.35em 0.8em;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
}

#chatAgentBadge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: inline-block;
    vertical-align: middle;
}

/* Risks Layout */
.risk-item {
    border-left: 3px solid var(--border-color);
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
}

.risk-item.risk-high {
    border-left-color: var(--red);
}

.risk-item.risk-medium {
    border-left-color: var(--orange);
}

.risk-item.risk-low {
    border-left-color: var(--green);
}

.risk-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Suggestions Container */
.suggestion-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
}

.suggestion-bullet {
    color: var(--cyan);
    margin-right: 0.75rem;
    margin-top: 3px;
}

/* Action items list checklist */
.action-check-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.action-checkbox {
    margin-right: 1rem;
    margin-top: 4px;
    cursor: pointer;
    border-color: rgba(255, 255, 255, 0.2);
}

.action-checkbox:checked+.action-item-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.action-item-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Modal Styling */
.glass-modal {
    background: rgba(18, 18, 30, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
}

/* Drag and Drop Zone */
.drag-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15) !important;
    border-radius: 14px;
    transition: all 0.2s ease;
}

.drag-drop-zone.dragover {
    border-color: var(--cyan) !important;
    background: rgba(0, 242, 254, 0.05);
}

.cursor-pointer {
    cursor: pointer;
}

.progress-glass {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px;
}

.bg-cyan {
    background-color: var(--cyan) !important;
}

/* Loader Overlay - Disabled so page transitions are instantaneous without dark blur backdrop */
.loader-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Responsive sidebar */
@media (max-width: 991px) {
    .sidebar {
        left: -240px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* AI Chat Assistant bubble styles */
.chat-bubble-bot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chat-bubble-bot .p-3 {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

body.light-theme .chat-bubble-bot .p-3 {
    background-color: rgba(0, 0, 0, 0.04) !important;
    color: #1d1d1f !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
}

#chatHistoryContainer {
    background: rgba(0, 0, 0, 0.15) !important;
}

body.light-theme #chatHistoryContainer {
    background: rgba(0, 0, 0, 0.02) !important;
}

.chat-bubble-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-input {
    border-radius: 12px !important;
    padding: 0.75rem 1rem !important;
}

.chat-input:focus {
    border-color: var(--cyan) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 242, 254, 0.1) !important;
}

.quick-question-btn {
    font-size: 0.8rem !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-secondary) !important;
    transition: all 0.2s ease !important;
}

.quick-question-btn:hover {
    background: rgba(0, 242, 254, 0.08) !important;
    border-color: rgba(0, 242, 254, 0.2) !important;
    color: var(--cyan) !important;
}

/* Light Theme Variables & Overrides */
body.light-theme {
    --bg-dark: #fdf7e7;
    /* Warm cream/beige background from the reference design */
    --bg-card: #ffffff;
    /* Clean white card backgrounds for charts, tables */
    --bg-card-hover: #ffffff;
    --border-color: rgba(0, 0, 0, 0.06);
    --border-color-focus: #1b5e46;
    /* Pine green focus border */

    --text-primary: #1e293b;
    /* Dark slate text for content readability */
    --text-secondary: #55695f;
    /* Green-grey text for matching aesthetic */

    --bg-sidebar: #1b5e46;
    /* Forest pine green sidebar background */

    /* Redefine cyan accent to forest green to match the branding and upload page design */
    --cyan: #1b5e46;
    --cyan-grad: linear-gradient(135deg, #237a5b, #1b5e46);

    /* Redefine green accent to brand forest green for highly legible text colors */
    --green: #1b5e46;
    --green-grad: linear-gradient(135deg, #237a5b, #1b5e46);
}

/* Light theme primary button text & shadow overrides */
body.light-theme .btn-primary-cyan {
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(27, 94, 70, 0.15) !important;
}

body.light-theme .btn-primary-cyan:hover:not(:disabled) {
    background: linear-gradient(135deg, #2b8c6a, #237a5b) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(27, 94, 70, 0.3) !important;
}

/* Sidebar overrides for light-theme (remains dark forest green) */
body.light-theme .sidebar {
    background: #1b5e46 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.light-theme .sidebar-brand {
    color: #ffffff !important;
}

body.light-theme .sidebar .nav-link {
    color: #c3e2d6 !important;
    /* Soft light green-grey text */
}

body.light-theme .sidebar .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

body.light-theme .sidebar .nav-link.active,
body.light-theme .sidebar .nav-link.active:hover {
    background: #f3b229 !important;
    /* Yellow-orange active background */
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(243, 178, 41, 0.3) !important;
}

body.light-theme .sidebar .nav-link.active i,
body.light-theme .sidebar .nav-link.active:hover i {
    color: #ffffff !important;
}

body.light-theme .sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    opacity: 0.8;
}

body.light-theme .sidebar .profile-name {
    color: #ffffff !important;
}

body.light-theme .sidebar .profile-role {
    color: #c3e2d6 !important;
}

body.light-theme .sidebar .profile-chevron,
body.light-theme .sidebar .submenu-arrow {
    color: #c3e2d6 !important;
}

body.light-theme .sidebar-profile-card {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Header overrides (remains dark forest green header) */
body.light-theme .header-nav {
    background: #1b5e46 !important;
    /* Matches sidebar pine green */
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .header-nav .view-title {
    color: #ffffff !important;
}

body.light-theme .header-nav #sidebarToggle {
    color: #ffffff !important;
}

/* Date filter group on green top header */
body.light-theme .filter-pill-group {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.light-theme .filter-pill-group:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

body.light-theme .filter-pill-label {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.light-theme .filter-pill-input {
    color: #ffffff !important;
}

body.light-theme .filter-pill-input::-webkit-calendar-picker-indicator {
    filter: invert(1) !important;
}

body.light-theme .filter-pill-divider {
    background: rgba(255, 255, 255, 0.15) !important;
}

body.light-theme .filter-pill-clear {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body.light-theme .filter-pill-clear:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Theme toggle button on green header */
body.light-theme .btn-theme-toggle {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

body.light-theme .btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #f3b229 !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Text white colors must not change inside sidebar/header but should become dark slate inside content body */
body.light-theme .text-white:not(.sidebar *):not(.header-nav *) {
    color: #1e293b !important;
}

body.light-theme .text-white-50:not(.sidebar *):not(.header-nav *) {
    color: #55695f !important;
}

body.light-theme .brand-text span {
    color: #ffffff !important;
}

body.light-theme .brand-text span:last-child {
    color: #c3e2d6 !important;
}

/* Main Panel Elements overrides */
body.light-theme .glass-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04) !important;
}

body.light-theme .glass-card:hover {
    background: #ffffff !important;
    border-color: rgba(27, 94, 70, 0.15) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .form-select-glass {
    color: #1e293b !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .form-select-glass option {
    background-color: #ffffff !important;
    color: #1e293b !important;
}

body.light-theme .border-bottom-glass,
body.light-theme .border-top-glass {
    border-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .bg-soft-blue-header {
    background: rgba(0, 114, 255, 0.04) !important;
}

body.light-theme .bg-soft-green-header {
    background: rgba(52, 199, 89, 0.04) !important;
}

body.light-theme .bg-soft-red-header {
    background: rgba(255, 69, 58, 0.04) !important;
}

body.light-theme .bg-soft-purple-header {
    background: rgba(191, 90, 242, 0.04) !important;
}

body.light-theme .table th {
    background-color: rgba(0, 0, 0, 0.01) !important;
    color: var(--text-secondary) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .table td {
    color: var(--text-primary) !important;
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .list-group-item {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .list-number-badge {
    background: rgba(27, 94, 70, 0.12) !important;
    color: #1b5e46 !important;
}

/* Chat bubble styling */
body.light-theme .chat-bubble-bot .p-3 {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .chat-bubble-bot strong {
    color: #1b5e46 !important;
}

body.light-theme .quick-question-btn {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-secondary) !important;
}

body.light-theme .quick-question-btn:hover {
    background: rgba(27, 94, 70, 0.06) !important;
    border-color: #1b5e46 !important;
    color: #1b5e46 !important;
}

/* Custom Tabs for Upload modal */
.nav-tabs {
    border-bottom: 1px solid var(--border-color) !important;
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.2s ease;
    border: none !important;
    border-bottom: 2px solid transparent !important;
}

.nav-tabs .nav-link:hover {
    color: #fff !important;
}

.nav-tabs .nav-link.active {
    color: var(--cyan) !important;
    border-bottom: 2px solid var(--cyan) !important;
    background: transparent !important;
}

body.light-theme .nav-tabs .nav-link:hover {
    color: #1b5e46 !important;
}

body.light-theme .nav-tabs .nav-link.active {
    color: #1b5e46 !important;
    border-bottom: 2px solid #1b5e46 !important;
}

/* Light Theme Dropdown Selectors */
body.light-theme .report-selector {
    color: #1e293b !important;
    background-color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .report-selector option {
    color: #1e293b !important;
    background-color: #ffffff !important;
}

/* Light Theme Modals */
body.light-theme .glass-modal {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .glass-modal .modal-header,
body.light-theme .glass-modal .modal-footer {
    border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .glass-modal .btn-close {
    filter: none !important;
}

body.light-theme .glass-modal .drag-drop-zone {
    border-color: rgba(0, 0, 0, 0.12) !important;
    background-color: rgba(0, 0, 0, 0.01) !important;
}

body.light-theme .glass-modal .drag-drop-zone:hover {
    border-color: #1b5e46 !important;
    background-color: rgba(27, 94, 70, 0.03) !important;
}

body.light-theme .glass-modal .text-white,
body.light-theme .glass-modal h5,
body.light-theme .glass-modal h6 {
    color: #1e293b !important;
}

body.light-theme .glass-modal .text-muted,
body.light-theme .glass-modal p.small {
    color: #64748b !important;
}

body.light-theme .glass-modal #validationResultCard {
    background: rgba(0, 0, 0, 0.01) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}

/* Global Text Muted Override */
.text-muted {
    color: var(--text-secondary) !important;
}

body.light-theme .text-muted {
    color: #64748b !important;
}

/* Action items list checklist */
body.light-theme .action-check-item {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .action-checkbox {
    background-color: #ffffff !important;
    border: 1.5px solid rgba(0, 0, 0, 0.2) !important;
}

body.light-theme .action-checkbox:checked {
    background-color: #1b5e46 !important;
    border-color: #1b5e46 !important;
}

/* Custom Light-Theme colors for specific KPI Cards */
body.light-theme .kpi-card:has(.bg-soft-blue) {
    background: #eaf1fb !important;
    border: 1px solid #ceddf7 !important;
}

body.light-theme .kpi-card:has(.bg-soft-blue) .kpi-value {
    color: #1b6ec2 !important;
}

body.light-theme .kpi-card:has(.bg-soft-blue) .kpi-icon {
    background: rgba(27, 110, 194, 0.12) !important;
    color: #1b6ec2 !important;
}

body.light-theme .kpi-card:has(.bg-soft-blue) .kpi-icon i {
    color: #1b6ec2 !important;
}

body.light-theme .kpi-card:has(.bg-soft-green) {
    background: #e5f3ec !important;
    border: 1px solid #b8dbcd !important;
}

body.light-theme .kpi-card:has(.bg-soft-green) .kpi-value {
    color: #1c5d44 !important;
}

body.light-theme .kpi-card:has(.bg-soft-green) .kpi-icon {
    background: rgba(28, 93, 68, 0.12) !important;
    color: #1c5d44 !important;
}

body.light-theme .kpi-card:has(.bg-soft-green) .kpi-icon i {
    color: #1c5d44 !important;
}

body.light-theme .kpi-card:has(.bg-soft-purple) {
    background: #f3eafb !important;
    border: 1px solid #dcd1f7 !important;
}

body.light-theme .kpi-card:has(.bg-soft-purple) .kpi-value {
    color: #6f30a0 !important;
}

body.light-theme .kpi-card:has(.bg-soft-purple) .kpi-icon {
    background: rgba(111, 48, 160, 0.12) !important;
    color: #6f30a0 !important;
}

body.light-theme .kpi-card:has(.bg-soft-purple) .kpi-icon i {
    color: #6f30a0 !important;
}

body.light-theme .kpi-card:has(.bg-soft-orange) {
    background: #fdf3e2 !important;
    border: 1px solid #f0dfb2 !important;
}

body.light-theme .kpi-card:has(.bg-soft-orange) .kpi-value {
    color: #b8860b !important;
}

body.light-theme .kpi-card:has(.bg-soft-orange) .kpi-icon {
    background: rgba(184, 134, 11, 0.12) !important;
    color: #b8860b !important;
}

body.light-theme .kpi-card:has(.bg-soft-orange) .kpi-icon i {
    color: #b8860b !important;
}

body.light-theme .kpi-card:has(.bg-soft-cyan) {
    background: #e4f7f6 !important;
    border: 1px solid #bceae6 !important;
}

body.light-theme .kpi-card:has(.bg-soft-cyan) .kpi-value {
    color: #00828a !important;
}

body.light-theme .kpi-card:has(.bg-soft-cyan) .kpi-icon {
    background: rgba(0, 130, 138, 0.12) !important;
    color: #00828a !important;
}

body.light-theme .kpi-card:has(.bg-soft-cyan) .kpi-icon i {
    color: #00828a !important;
}


/* AI Chat Assistant Sliding Drawer */
.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 460px;
    height: 100vh;
    background: rgba(13, 13, 23, 0.96) !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.4);
    z-index: 1050;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.chat-drawer.active {
    transform: translateX(0);
}

.chat-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chat-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-menu .nav-link.drawer-open {
    background: rgba(0, 242, 254, 0.08) !important;
    border-left: 4px solid var(--cyan) !important;
    color: var(--cyan) !important;
    padding-left: 1rem !important;
}

/* Light Theme overrides for Chat Drawer */
body.light-theme .chat-drawer {
    background: rgba(255, 255, 255, 0.98) !important;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.08);
}

body.light-theme .chat-drawer .card-header h6,
body.light-theme .chat-drawer .card-header span {
    color: #1d1d1f !important;
}

body.light-theme .chat-drawer .btn-close {
    filter: none !important;
}

body.light-theme .chat-drawer-overlay {
    background: rgba(0, 0, 0, 0.15);
}

/* Responsive Width */
@media (max-width: 575.98px) {
    .chat-drawer {
        width: 100%;
    }
}

/* Floating AI Chat Button */
.btn-floating-chat {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    background: var(--cyan-grad) !important;
    color: #09090e !important;
    border: none !important;
    box-shadow: 0 5px 25px rgba(0, 242, 254, 0.4) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    cursor: pointer !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease !important;
}

.btn-floating-chat:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 242, 254, 0.6);
}

.btn-floating-chat:active {
    transform: scale(0.95) translateY(0);
}

@keyframes chat-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0, 242, 254, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
    }
}

.btn-floating-chat {
    animation: chat-pulse 3s infinite;
}

/* Light Theme overrides for Floating Chat Button */
body.light-theme .btn-floating-chat {
    color: #ffffff !important;
    background: linear-gradient(135deg, #f5c045, #f3b229) !important;
    box-shadow: 0 5px 25px rgba(243, 178, 41, 0.4) !important;
    animation: chat-pulse-light 3s infinite !important;
}

@keyframes chat-pulse-light {
    0% {
        box-shadow: 0 0 0 0 rgba(243, 178, 41, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(243, 178, 41, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(243, 178, 41, 0);
    }
}

/* Date Filter input overrides */
.date-filter {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.date-filter::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

body.light-theme .date-filter {
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: #1d1d1f !important;
    background-color: #ffffff !important;
}

body.light-theme .date-filter::-webkit-calendar-picker-indicator {
    filter: none;
}

/* Responsive Nav Header and Filters Alignment */
.header-nav .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-filters-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    /* Forces row alignment on desktop */
    margin-left: auto;
}

/* Mobile responsive styles */
@media (max-width: 991.98px) {
    .header-nav .container-fluid {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .header-title-container {
        justify-content: flex-start;
        width: 100%;
    }

    .header-filters-container {
        display: flex;
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .filter-pill-group {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        border-radius: 16px !important;
        padding: 10px 16px !important;
        gap: 8px !important;
    }

    .filter-pill-item {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
    }

    .filter-pill-label {
        width: 70px !important;
        font-size: 0.7rem !important;
        display: flex !important;
        align-items: center !important;
    }

    .filter-pill-input {
        flex: 1 !important;
        font-size: 0.8rem !important;
        width: 100% !important;
    }

    .filter-pill-divider {
        width: 100% !important;
        height: 1px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        margin: 4px 0 !important;
    }

    body.light-theme .filter-pill-divider {
        background: rgba(0, 0, 0, 0.06) !important;
    }
}

/* Alert Info In Modals Dark/Light Theme Visibility */
.alert-info.bg-soft-blue {
    background-color: rgba(27, 94, 70, 0.15) !important;
    border-color: rgba(27, 94, 70, 0.3) !important;
    color: rgba(255, 255, 255, 0.95) !important;
}

body.light-theme .alert-info.bg-soft-blue {
    background-color: rgba(27, 94, 70, 0.05) !important;
    border-color: rgba(27, 94, 70, 0.15) !important;
    color: #1b5e46 !important;
}

body.light-theme .alert-info.bg-soft-blue strong {
    color: #13402e !important;
}

/* Unified filter pill design */
.filter-pill-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 6px 16px;
    gap: 8px;
    transition: all 0.3s ease;
    width: 420px;
}

.filter-pill-group:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 242, 254, 0.3);
}

.filter-pill-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.filter-pill-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    pointer-events: none;
}

.filter-pill-input {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    width: 100%;
    min-width: 0;
    cursor: pointer;
    padding: 0;
}

.filter-pill-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.filter-pill-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

.filter-pill-clear {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill-clear:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Light Theme overrides for filter pill (keep visible and white on the green header bar) */
body.light-theme .filter-pill-group {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

body.light-theme .filter-pill-group:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

body.light-theme .filter-pill-input {
    color: #ffffff !important;
}

body.light-theme .filter-pill-input::-webkit-calendar-picker-indicator {
    filter: invert(1) !important;
}

body.light-theme .filter-pill-divider {
    background: rgba(255, 255, 255, 0.2) !important;
}

body.light-theme .filter-pill-clear {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.light-theme .filter-pill-clear:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

/* Uploaded file name badge contrast styling */
#fileNameBadgeRaw,
.bg-secondary-glass {
    background-color: rgba(0, 114, 255, 0.1) !important;
    color: #00c6ff !important;
    border: 1px solid rgba(0, 114, 255, 0.2) !important;
}

body.light-theme #fileNameBadgeRaw,
body.light-theme .bg-secondary-glass {
    background-color: rgba(0, 114, 255, 0.08) !important;
    color: #0056b3 !important;
    border: 1px solid rgba(0, 114, 255, 0.15) !important;
}

/* Sidebar toggle button custom styles */
.brand-title {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.brand-title .brand-logo {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.brand-text {
    white-space: nowrap;
}

.sidebar .nav-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sidebar .menu-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: calc(100% - 30px);
    vertical-align: middle;
}

.sidebar .nav-link .nav-icon {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:not(.collapsed) .nav-link .nav-icon,
.sidebar:not(.collapsed) .btn-upload-modal .nav-icon {
    margin-right: 0.75rem;
}

/* Collapsed state styles - applied on desktop only */
@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 80px !important;
        padding: 1.5rem 0.5rem !important;
    }

    .sidebar.collapsed~.main-content {
        margin-left: 80px !important;
    }

    .sidebar.collapsed .menu-text {
        display: none !important;
        opacity: 0 !important;
    }

    .sidebar.collapsed .sidebar-brand {
        justify-content: center !important;
    }

    .sidebar.collapsed .brand-title {
        justify-content: center !important;
        width: 100% !important;
    }

    .sidebar.collapsed #sidebarLogoBtn {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .sidebar.collapsed .brand-logo {
        margin-right: 0 !important;
    }

    .sidebar.collapsed .submenu-list {
        display: none !important;
    }

    .sidebar.collapsed .brand-logo:hover {
        transform: scale(1.15);
        color: var(--cyan) !important;
    }

    .sidebar.collapsed .nav-link {
        justify-content: center !important;
        padding: 0.75rem 0 !important;
    }

    .sidebar.collapsed .sidebar-upload-container {
        padding: 0 !important;
        margin-bottom: 0.75rem !important;
    }

    .sidebar.collapsed .btn-upload-modal,
    .sidebar.collapsed .btn-danger-clear,
    .sidebar.collapsed .btn-signout {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        max-width: 42px !important;
        max-height: 42px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        margin: 0 auto !important;
        flex-shrink: 0 !important;
    }

    .sidebar.collapsed .btn-signout span {
        display: none !important;
    }

    .sidebar.collapsed .theme-toggle-row {
        justify-content: center !important;
        width: 100% !important;
    }

    .sidebar.collapsed #themeSwitchWrapper {
        display: none !important;
    }

    .sidebar.collapsed #themeToggleLabel {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 42px !important;
        height: 42px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.04) !important;
        transition: all 0.2s !important;
        padding: 0 !important;
    }

    .sidebar.collapsed #themeToggleLabel:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: var(--cyan) !important;
    }

    body.light-theme .sidebar.collapsed #themeToggleLabel {
        background: rgba(0, 0, 0, 0.04) !important;
    }

    body.light-theme .sidebar.collapsed #themeToggleLabel:hover {
        background: rgba(0, 0, 0, 0.08) !important;
        color: #0056b3 !important;
    }
}

/* Responsive Floating Chat Button for Mobile Viewport */
@media (max-width: 991px) {
    .btn-floating-chat {
        bottom: 20px !important;
        right: 20px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 1.25rem !important;
    }
}

/* Google Charts Custom HTML Tooltip to prevent hover flickering */
.google-visualization-tooltip {
    pointer-events: none !important;
    background-color: rgba(20, 20, 35, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    color: #f5f5f7 !important;
    padding: 8px 12px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
    z-index: 2000 !important;
}

body.light-theme .google-visualization-tooltip {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    color: #1d1d1f !important;
}

/* Login Screen CSS */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #11112b 0%, #05050a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s ease;
}

body.light-theme .login-screen {
    background: radial-gradient(circle at center, #fdfcf7 0%, #f7f1dd 100%);
}

.login-screen.d-none {
    opacity: 0;
    visibility: hidden;
    display: none !important;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: rgba(20, 20, 35, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background 0.3s, border-color 0.3s;
}

body.light-theme .login-card {
    background: #ffffff;
    border: 1px solid rgba(27, 94, 70, 0.08);
    box-shadow: 0 20px 60px rgba(27, 94, 70, 0.08);
}

body.light-theme .login-card h3 {
    color: #1b5e46 !important;
}

/* Custom Input Groups for Login */
.input-group-custom {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-group-custom .input-icon {
    position: absolute;
    left: 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    transition: color 0.3s;
    pointer-events: none;
}

body.light-theme .input-group-custom .input-icon {
    color: rgba(27, 94, 70, 0.4);
}

.login-input {
    padding: 12px 16px 12px 46px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.login-input:focus {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--cyan) !important;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.login-input:focus~.input-icon,
.input-group-custom:focus-within .input-icon {
    color: var(--cyan) !important;
}

body.light-theme .login-input {
    background: #fdfdfd !important;
    border: 1px solid rgba(27, 94, 70, 0.12) !important;
    color: #1e293b !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .login-input:focus {
    background: #ffffff !important;
    border-color: #1b5e46 !important;
    box-shadow: 0 0 15px rgba(27, 94, 70, 0.12), inset 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .login-input:focus~.input-icon,
body.light-theme .input-group-custom:focus-within .input-icon {
    color: #1b5e46 !important;
}

/* Premium Login Submit Button */
.btn-login-submit {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%) !important;
    border: none !important;
    color: #05050a !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    padding: 12px !important;
    font-size: 1rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3) !important;
}

.btn-login-submit:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5) !important;
    filter: brightness(1.1) !important;
}

.btn-login-submit:active {
    transform: translateY(1px) !important;
}

body.light-theme .btn-login-submit {
    background: linear-gradient(135deg, #237a5b 0%, #1b5e46 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(27, 94, 70, 0.25) !important;
}

body.light-theme .btn-login-submit:hover {
    box-shadow: 0 8px 25px rgba(27, 94, 70, 0.4) !important;
}

/* Rounded Logo Container */
.logo-wrapper {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
}

body.light-theme .logo-wrapper {
    background: rgba(0, 114, 255, 0.08);
    border: 1px solid rgba(0, 114, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 114, 255, 0.08);
}

.login-title {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px !important;
}

.animate-pulse {
    animation: login-pulse 2s infinite;
}

@keyframes login-pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
        filter: drop-shadow(0 0 15px rgba(0, 242, 254, 0.6));
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

/* Logout Button */
.btn-outline-danger {
    color: var(--red);
    background: rgba(255, 69, 58, 0.05);
    border: 1px solid rgba(255, 69, 58, 0.15) !important;
    transition: all 0.2s ease;
}

.btn-outline-danger:hover {
    color: #fff !important;
    background: var(--red-grad) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 15px rgba(255, 69, 58, 0.3);
}

body.light-theme .btn-outline-danger {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.05);
    border: 1px solid rgba(211, 47, 47, 0.15) !important;
}

body.light-theme .btn-outline-danger:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #d32f2f, #f44336) !important;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.2);
}

/* Sidebar Profile Card & Dropdown */
.sidebar-profile-card {
    transition: all 0.3s ease;
}

/* Hide default bootstrap dropdown arrow */
.dropdown-toggle::after {
    display: none !important;
}

.profile-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--cyan-grad);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: #05050a;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.profile-avatar-circle:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.35);
}

.profile-name {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.2;
}

.profile-role {
    font-weight: 500;
}

.profile-chevron {
    transition: transform 0.2s ease;
}

.dropdown-toggle[aria-expanded="true"] .profile-chevron {
    transform: rotate(180deg);
}

/* Glassmorphic Dropdown Menu */
.glass-dropdown {
    background: rgba(20, 20, 35, 0.9) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    padding: 0.4rem !important;
    min-width: 200px;
}

.glass-dropdown .dropdown-item {
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    padding: 0.6rem 0.8rem !important;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.2s ease !important;
}

.glass-dropdown .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}

.glass-dropdown .dropdown-item i {
    font-size: 0.95rem;
}

/* Light Theme Styling overrides */
body.light-theme .profile-avatar-circle {
    color: #f3b229 !important;
    /* Gold text */
    background: rgba(0, 0, 0, 0.16) !important;
    /* Semi-transparent black over green background to darken it exactly like the reference design */
    box-shadow: none !important;
    border-radius: 50% !important;
}

body.light-theme .profile-avatar-circle:hover {
    box-shadow: none !important;
    transform: none !important;
}

body.light-theme .profile-name {
    color: #1c1c1e !important;
}

body.light-theme .glass-dropdown {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .glass-dropdown .dropdown-item {
    color: #3a3a3c !important;
}

body.light-theme .glass-dropdown .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #000 !important;
}

/* Collapsed Sidebar adjustments */
.sidebar.collapsed .sidebar-profile-card {
    padding-top: 1rem !important;
    border-top: none !important;
    margin-top: 0.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
}

.sidebar.collapsed .sidebar-profile-card .d-flex {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    justify-content: center !important;
    gap: 0 !important;
}

.sidebar.collapsed .profile-avatar-circle {
    flex-shrink: 0 !important;
    margin: 0 auto !important;
}

.sidebar.collapsed .profile-info,
.sidebar.collapsed .profile-chevron {
    display: none !important;
    opacity: 0 !important;
}

/* Header theme toggle button */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #f5f5f7 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    padding: 0 !important;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--cyan) !important;
    transform: scale(1.05) !important;
}

.btn-theme-toggle .theme-toggle-icon {
    font-size: 1.15rem;
    transition: transform 0.3s ease;
}

.btn-theme-toggle:hover .theme-toggle-icon {
    transform: rotate(30deg);
}

body.light-theme .btn-theme-toggle {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

body.light-theme .btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #f3b229 !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Custom highly visible dark glassmorphic toast notification */
.app-custom-toast {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45) !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    width: 320px !important;
    transition: all 0.3s ease !important;
}

.app-custom-toast .toast-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.app-custom-toast .toast-header strong,
.app-custom-toast .toast-header .me-auto,
.app-custom-toast #toastTitle {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.app-custom-toast .btn-close {
    filter: invert(1) !important;
    opacity: 0.75 !important;
    transition: opacity 0.2s ease !important;
}

.app-custom-toast .btn-close:hover {
    opacity: 1 !important;
    filter: invert(1) !important;
}

.app-custom-toast .toast-body {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    background: transparent !important;
}

/* Sidebar Direct Sign Out button */
.btn-signout {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: 12px !important;
    transition: all 0.25s ease !important;
}

.btn-signout:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.light-theme .btn-signout {
    background: #ffffff !important;
    border: none !important;
    color: #1b5e46 !important;
    /* Forest green text */
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    border-radius: 12px !important;
}

body.light-theme .btn-signout:hover {
    background: #fdfaf2 !important;
    /* Warm light hover matching beige */
    color: #13402e !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
}

/* Specific override for sign-out button in light-theme collapsed sidebar to maintain perfect circular layout */
body.light-theme .sidebar.collapsed .btn-signout {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex-shrink: 0 !important;
}

body.light-theme .sidebar.collapsed .btn-signout:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

/* Ensure sidebar icons remain bright and visible on dark background in both dark & light themes */
.sidebar .nav-link i.text-cyan,
.sidebar .text-cyan {
    color: #00f2fe !important;
}

.sidebar .nav-link i.text-green,
.sidebar .text-green {
    color: #00f260 !important;
}

.sidebar .nav-link i.text-orange,
.sidebar .text-orange {
    color: #ff9f0a !important;
}

.sidebar .nav-link i.text-red,
.sidebar .text-red {
    color: #ff453a !important;
}

.sidebar .nav-link i.text-yellow,
.sidebar .text-yellow {
    color: #ffd60a !important;
}

/* Sidebar submenu active item ORANGE BOX HIGHLIGHT */
.sidebar-menu .submenu-link.active,
body.light-theme .sidebar-menu .submenu-link.active {
    background: rgba(255, 159, 10, 0.25) !important;
    /* Soft orange box fill */
    border: 1.5px solid #ff9f0a !important;
    /* Bright orange box border */
    border-left: 4px solid #ff9f0a !important;
    /* Accent left bar */
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(255, 159, 10, 0.3) !important;
    border-radius: 8px !important;
}

.sidebar-menu .submenu-link.active i,
body.light-theme .sidebar-menu .submenu-link.active i {
    color: #ff9f0a !important;
    /* Orange icon */
}

/* Highlight parent Main Agent Header text when active or when any child sub-item is active */
.sidebar-menu li.menu-dropdown.active>a.nav-link,
.sidebar-menu li.menu-dropdown:has(.submenu-link.active)>a.nav-link {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.sidebar-menu li.menu-dropdown.active>a.nav-link .menu-text,
.sidebar-menu li.menu-dropdown:has(.submenu-link.active)>a.nav-link .menu-text {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.98rem !important;
}

body.light-theme .sidebar-menu li.menu-dropdown.active>a.nav-link .menu-text,
body.light-theme .sidebar-menu li.menu-dropdown:has(.submenu-link.active)>a.nav-link .menu-text {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Top Sub-Nav Tab Cards Active Orange Highlight */
.nav-pills .nav-link.active,
body.light-theme .nav-pills .nav-link.active,
.glass-card .nav-link.active,
body.light-theme .glass-card .nav-link.active {
    background: #ff9f0a !important;
    /* Orange active card tab background */
    color: #ffffff !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 14px rgba(255, 159, 10, 0.35) !important;
}

.nav-pills .nav-link.active i,
body.light-theme .nav-pills .nav-link.active i,
.glass-card .nav-link.active i,
body.light-theme .glass-card .nav-link.active i {
    color: #ffffff !important;
    /* White icon inside active orange card tab */
}

/* Light Theme Card Headers, Titles, and Table Text Contrast Overrides */
body.light-theme .text-white {
    color: #1c1c1e !important;
}

body.light-theme .text-white-50 {
    color: #4a4a4e !important;
}

body.light-theme .card-title,
body.light-theme .card-header h6,
body.light-theme .card-header .card-title {
    color: #1c1c1e !important;
    font-weight: 700;
}

body.light-theme .card-header h6 i,
body.light-theme .card-title i {
    color: #1b5e46 !important;
}

/* Badge Color Definitions */
.bg-soft-red {
    background: rgba(255, 59, 48, 0.15) !important;
}

.text-red {
    color: #ff3b30 !important;
}

body.light-theme .bg-soft-red {
    background: rgba(229, 57, 53, 0.15) !important;
}

body.light-theme .text-red {
    color: #d32f2f !important;
}

body.light-theme .bg-soft-green {
    background: rgba(27, 94, 70, 0.12) !important;
}

body.light-theme .text-green {
    color: #1b5e46 !important;
}

body.light-theme .table {
    color: #1c1c1e !important;
}

body.light-theme .table td {
    color: #1c1c1e !important;
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(0, 0, 0, 0.03) !important;
    color: #1c1c1e !important;
}

/* ===== Alert Agent light-theme: readable filters + row hover ===== */
body.light-theme .form-select.bg-dark,
body.light-theme select.form-select.bg-dark.border-glass {
    background-color: #ffffff !important;
    color: #1c1c1e !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231c1c1e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

body.light-theme .form-select.bg-dark option,
body.light-theme select.form-select.bg-dark option {
    background-color: #ffffff !important;
    color: #1c1c1e !important;
}

body.light-theme .form-control.bg-dark,
body.light-theme input.bg-dark.border-glass {
    background-color: #ffffff !important;
    color: #1c1c1e !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .form-control.bg-dark::placeholder {
    color: #8e8e93 !important;
}

/* Critical / History tables: dark table classes on light page */
body.light-theme .table-dark {
    --bs-table-bg: transparent !important;
    --bs-table-color: #1c1c1e !important;
    --bs-table-border-color: rgba(0, 0, 0, 0.06) !important;
    --bs-table-striped-bg: rgba(27, 94, 70, 0.04) !important;
    --bs-table-hover-bg: rgba(27, 94, 70, 0.10) !important;
    --bs-table-hover-color: #0f3d2e !important;
    color: #1c1c1e !important;
    background-color: transparent !important;
}

body.light-theme .table-dark> :not(caption)>*>* {
    background-color: transparent !important;
    color: #1c1c1e !important;
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .table-dark.table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(27, 94, 70, 0.12) !important;
    background-color: rgba(27, 94, 70, 0.10) !important;
    color: #0f3d2e !important;
}

body.light-theme .table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(27, 94, 70, 0.10) !important;
    background-color: rgba(27, 94, 70, 0.08) !important;
    color: #0f3d2e !important;
}

body.light-theme .table-dark .text-white,
body.light-theme .table-dark .text-white-50,
body.light-theme #criticalTableBody .text-white,
body.light-theme #historyTableBody .text-white,
body.light-theme #execRecentAlertsBody .text-white {
    color: #1c1c1e !important;
}

body.light-theme #criticalTableBody .text-white-50,
body.light-theme #historyTableBody .text-white-50,
body.light-theme #execRecentAlertsBody .text-white-50 {
    color: #6b7280 !important;
}

/* Notification items hover */
body.light-theme #notificationsFeedContainer .list-group-item:hover {
    background-color: rgba(27, 94, 70, 0.06) !important;
}

body.light-theme #notificationsFeedContainer .list-group-item.notif-read {
    opacity: 0.45;
}

#notificationsFeedContainer .list-group-item.notif-read {
    opacity: 0.5;
}

#notificationsFeedContainer .list-group-item.notif-unread {
    border-left: 3px solid #ff9f0a;
}


/* Single-line board / chart titles */
.card-header .card-title,
.glass-card .card-header h6,
.view-section .card-header h6 {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.card-header {
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* Chart containers always measurable */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 240px !important;
}

/* ==========================================================================
   Collapsed Sidebar Alignments & Hover Submenu Popover
   ========================================================================== */

/* Hide chevron down arrows when sidebar is collapsed */
.sidebar.collapsed .submenu-arrow {
    display: none !important;
}

/* Center and resize logo brand in collapsed sidebar */
.sidebar.collapsed .sidebar-brand {
    padding: 0.75rem 0 !important;
    justify-content: center !important;
}

.sidebar.collapsed #sidebarLogoBtn {
    width: 42px !important;
    height: 42px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    display: block !important;
}

/* Align and center navigation item icons cleanly when collapsed */
.sidebar.collapsed .sidebar-menu .nav-item {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    margin-top: 0.5rem !important;
}

.sidebar.collapsed .sidebar-menu .nav-link {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    margin: 0 auto !important;
}

/* Adjust collapsed footer items */
.sidebar.collapsed .sidebar-profile-card {
    padding-top: 0.75rem !important;
    margin-top: 0.5rem !important;
}

/* ── Thick vibrant active-icon highlight for collapsed sidebar (matching Upload button) ── */
.sidebar.collapsed li.menu-dropdown.nav-section-active>a.nav-link,
.sidebar.collapsed .sidebar-menu>li>a.nav-link.active {
    background: #FF9800 !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 18px rgba(255, 152, 0, 0.45) !important;
}

.sidebar.collapsed li.menu-dropdown.nav-section-active>a.nav-link .nav-icon,
.sidebar.collapsed .sidebar-menu>li>a.nav-link.active .nav-icon {
    color: #FFFFFF !important;
}

/* light theme variant */
body.light-theme .sidebar.collapsed li.menu-dropdown.nav-section-active>a.nav-link,
body.light-theme .sidebar.collapsed .sidebar-menu>li>a.nav-link.active {
    background: #FF9800 !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 18px rgba(255, 152, 0, 0.45) !important;
}

body.light-theme .sidebar.collapsed li.menu-dropdown.nav-section-active>a.nav-link .nav-icon,
body.light-theme .sidebar.collapsed .sidebar-menu>li>a.nav-link.active .nav-icon {
    color: #FFFFFF !important;
}

/* Hide floating chat button whenever chat drawer is open */
body.chat-drawer-open #floatingChatBtn,
#chatDrawer.active~#floatingChatBtn {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Hide floating chat button & chat drawer when on login screen */
#loginScreen:not(.d-none) ~ #floatingChatBtn,
#loginScreen:not(.d-none) ~ #chatDrawer,
#loginScreen:not(.d-none) ~ #chatDrawerOverlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Sidebar Collapsed Hover Popover Styling */
.sidebar-hover-popover {
    position: fixed;
    z-index: 10000;
    background: rgba(15, 28, 22, 0.98);
    /* Deep premium forest green matching NGW branding */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 0.5rem 0;
    min-width: 210px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-10px);
    pointer-events: auto;
}

.sidebar-hover-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-popover-header {
    padding: 0.65rem 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-popover-item {
    display: flex;
    align-items: center;
    padding: 0.55rem 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-popover-item:hover {
    background: rgba(255, 152, 0, 0.12);
    color: #FF9800;
    text-decoration: none;
    padding-left: 1.35rem;
}

.sidebar-popover-item.active {
    background: rgba(0, 198, 224, 0.1);
    color: var(--cyan);
    font-weight: 600;
}

/* Light Theme overrides for popover */
body.light-theme .sidebar-hover-popover {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body.light-theme .sidebar-popover-header {
    color: #1a1a1c;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .sidebar-popover-item {
    color: #5a5a5c;
}

body.light-theme .sidebar-popover-item:hover {
    background: rgba(255, 152, 0, 0.08);
    color: #E65100;
    padding-left: 1.35rem;
}

body.light-theme .sidebar-popover-item.active {
    background: rgba(11, 132, 145, 0.08);
    color: #0b8491;
}
/* Ensure only the active marketing/production tab pane is visible.
   Prevents Executive KPI cards from leaking onto Campaigns / other tabs. */
#marketingTabContent > .tab-pane:not(.active),
#productionTabContent > .tab-pane:not(.active) {
    display: none !important;
}

#marketingTabContent > .tab-pane.active,
#productionTabContent > .tab-pane.active {
    display: block !important;
}

/* Safety: never leave a modal backdrop blocking the UI after Clear DB */
body:not(.modal-open) .modal-backdrop {
    display: none !important;
    pointer-events: none !important;
}

/* Solid Green AI Recommendation Buttons across all pages (Matching user brand preference) */
.btn-ai-recommendations {
    background-color: #147B49 !important;
    color: #FFFFFF !important;
    border: 1px solid #147B49 !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    transition: all 0.25s ease-in-out !important;
    box-shadow: 0 2px 8px rgba(20, 123, 73, 0.3) !important;
}

.btn-ai-recommendations:hover,
.btn-ai-recommendations:focus,
.btn-ai-recommendations:active {
    background-color: #199557 !important;
    color: #FFFFFF !important;
    border-color: #199557 !important;
    box-shadow: 0 4px 16px rgba(25, 149, 87, 0.5) !important;
    transform: translateY(-1px) !important;
}

/* AI Decision Support Modal Box Styling for Theme Compatibility */
.ai-modal-box {
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
}

.ai-modal-box p,
.ai-modal-box span {
    color: #F8FAFC !important;
}

/* Light Theme Overrides for AI Copilot Decision Support Modal */
body.light-theme #aiRecommendationModal .modal-content {
    background-color: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    color: #0F172A !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme #aiRecommendationModal .modal-header {
    border-bottom: 1px solid #E2E8F0 !important;
}

body.light-theme #aiRecommendationModal .modal-title {
    color: #0F172A !important;
}

body.light-theme #aiRecommendationModal #recom-alert-title {
    color: #0F172A !important;
}

body.light-theme #aiRecommendationModal #recom-alert-desc {
    color: #475569 !important;
}

body.light-theme #aiRecommendationModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}

body.light-theme .ai-modal-box {
    background-color: #F8FAFC !important;
    border: 1px solid #CBD5E1 !important;
}

body.light-theme .ai-modal-box p,
body.light-theme .ai-modal-box span {
    color: #1E293B !important;
}

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

body.light-theme .ai-modal-box input {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border: 1px solid #CBD5E1 !important;
}
