/* Modern Dashboard Styling */

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --accent-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;
    --background: #F9FAFB;
    --card-background: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Overview Bar - KPI Cards */
.overviewBar {
    display: block;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0;
}

/* KPIs container in landing tab */
.kpis-container {
    padding-top: 0.5rem;
}

.big-box {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.big-box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.big-box .meta-box {
    flex: 1;
}

.big-box .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.big-box .desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
}

.big-box .img {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border-radius: 12px;
    padding: 0.75rem;
}

.big-box .img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.products-box .img {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
}

.departmens-box .img {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.grossprofit-box .img {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

/* Panel Wrapper - Chart Cards */
.panel-wrapper {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    max-width: none;
}

.panel-wrapper:hover {
    box-shadow: var(--shadow-lg);
}

.homePageBoxTitle {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.homePageBoxTitle img {
    display: none;
    /* Hidden - icons were generic and not widget-specific */
}

.panel-cont {
    padding: 1.5rem;
}

/* Chart Containers */
.panel-cont > div {
    background-color: var(--card-background);
}

canvas {
    max-width: 100%;
}

/* Specific chart container heights */
#dailySalesChart {
    height: 385px !important;
    max-height: 385px;
}

#hourlyChart {
    height: 320px !important;
    max-height: 320px;
}

#tendersChart {
    height: 280px !important;
    max-height: 280px;
}

#deptPieChart {
    height: 280px !important;
    max-height: 280px;
}

/* Chart wrapper to control size */
#dashboard,
.panel-cont canvas {
    position: relative;
}

/* Chart Legends */
.chartLegendWide,
.chartLegendPie {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.chartLegendWide ul,
.chartLegendPie ul,
.bar-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.chartLegendWide li,
.chartLegendPie li,
.bar-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.chartLegendWide li div,
.bar-legend li div {
    width: 20px;
    height: 12px;
    border-radius: 3px;
}

/* Tables */
.table-striped {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-striped thead {
    background: var(--background);
    border-bottom: 2px solid var(--border-color);
}

.table-striped th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-striped td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.table-striped tbody tr {
    transition: background-color 0.2s ease;
}

.table-striped tbody tr:hover {
    background-color: var(--background);
}

/* Disable hover effects for ReportViewer tables */
#reportdivMain table tbody tr:hover,
#reportdivMain .table-striped tbody tr:hover {
    background-color: transparent !important;
}

.table-striped .pol {
    background-color: #F9FAFB;
}

.table-striped .pol:hover {
    background-color: #F3F4F6;
}

.table-striped a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.table-striped a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Layout */
#welcomeLeft {
    width: 67.2%;
    float: left;
    padding-right: 1rem;
    max-width: none;
}

#welcomeRight {
    /*width: 32.8%;
    float: left;*/
    max-width: none;
}

/* Notice Bar */
.notice-bar {
    background: linear-gradient(135deg, var(--card-background) 0%, var(--background) 100%);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 0rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
}

.notice-bar span {
    color: var(--text-primary) !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
}

/* Sections Turns - Action Buttons */
.sections-turns,
.refresh-buttontop {
    display: inline-block;
    float: right;
    margin-left: 1rem;
}

.section-turn,
.refresh-buttontop a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.section-turn:hover,
.refresh-buttontop a:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.section-turn img,
.refresh-buttontop a img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Loading States */
p[id^="loading"],
p[id*="loading"] {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #welcomeLeft,
    #welcomeRight {
        width: 100%;
        float: none;
        padding-right: 0;
        max-width: none;
    }

    #welcomeRight {
        margin-top: 2rem;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .overviewBar {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .big-box .number {
        font-size: 1.5rem;
    }

    .homePageBoxTitle {
        font-size: 1rem;
        padding: 1rem;
    }

    .panel-cont {
        padding: 1rem;
    }

    .notice-bar span {
        font-size: 1.25rem !important;
    }
}

/* Stats Content Layout */
#div-StatsContentLeft {
    float: left;
    width: 73%;
    margin-right: 2%;
}

#div-StatsContentRight {
    float: left;
    width: 25%;
}

.table-striped.padplus td {
    padding: 0.875rem 1rem;
}

/* News Section */
.newsArticleHomePageInner {
    padding: 0;
}

.newsArticleHomePageInner h4 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.newsArticleHomePageInner h5 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    margin: 1rem 0;
}

.newsArticleHomePageInner p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Tab Summary Section */
#pTabSummary {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--text-primary);
}

#deleteTabSalesIcon {
    cursor: pointer;
    transition: transform 0.2s ease;
}

#deleteTabSalesIcon:hover {
    transform: scale(1.1);
}

/* Preparation Timings Table */
#prepTimingsTableBody td {
    text-align: center;
}

#prepTimingsTableBody td:first-child {
    text-align: left;
    font-weight: 500;
}

/* Input Fields in Headers */
.homePageBoxTitle input[type="text"] {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.homePageBoxTitle input[type="text"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Sortable Headers */
#sortProdsQty,
#sortProds {
    cursor: pointer;
    transition: color 0.2s ease;
}

#sortProdsQty:hover,
#sortProds:hover {
    color: var(--primary-color);
}

/* Clear floats */
.clearfix::after,
#welcomeLeft::after,
#welcomeRight::after {
    content: "";
    display: table;
    clear: both;
}

/* ============================================
   DASHBOARD TABS & CUSTOMIZATION
   ============================================ */

/* Tab Controls Container */
.dashboard-tab-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: -2rem;
}

/* Tab Navigation */
.dashboard-tabs {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 3px solid #E5E7EB;
    flex: 1;
}

.dashboard-tab {
    padding: 10px 18px;
    background: #3F6B7A;
    border: none;
    border-radius: 6px 6px 0 0;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin: 0 2px 0 0;
    margin-bottom: -2px;
}

.dashboard-tab .tab-icon {
    font-size: 1rem;
    margin-right: 6px;
    display: inline-block;
    vertical-align: middle;
}

.dashboard-tab .tab-name {
    display: inline-block;
    vertical-align: middle;
}

.dashboard-tab:hover {
    background: #4A7A8C;
}

.dashboard-tab.active {
    background: #F78E20;
    color: white;
    box-shadow: 0 -2px 6px rgba(247, 142, 30, 0.3);
}

.dashboard-tab-content {
    display: none;
}

.dashboard-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Customize Button */
.customize-dashboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    height: fit-content;
    min-height: 48px;
    margin-top: 5px;
}

.customize-dashboard-btn:hover {
    background: #059669;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.customize-dashboard-btn::before {
    content: "⚙";
    font-size: 1.1rem;
}

/* Widget Wrapper for Show/Hide */
.dashboard-widget {
    transition: all 0.3s ease;
}

.dashboard-widget.hidden {
    display: none !important;
}

/* Customization Modal */
.dashboard-customization-modal {
    background: var(--card-background);
    border-radius: 12px;
    max-width: 600px;
    padding: 0;
    border: 1px solid var(--border-color);
}

/* Hide jQuery UI native title bar for customization dialog */
.no-titlebar .ui-dialog-titlebar {
    display: none;
}

.customization-modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.customization-modal-body {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.customization-section {
    margin-bottom: 2rem;
}

.customization-section h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.widget-toggle-list {
    display: grid;
    gap: 0.75rem;
}

.widget-toggle-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.widget-toggle-item:hover {
    background: #E5E7EB;
}

.widget-toggle-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.widget-toggle-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.widget-toggle-name {
    font-weight: 500;
    color: var(--text-primary);
}

.widget-toggle-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

/* Tab Assignment Badges */
.widget-tab-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Reset/Save Buttons */
.customization-actions {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background);
    border-radius: 0 0 12px 12px;
}

.btn-reset,
.btn-save {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-reset {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-reset:hover {
    background: var(--background);
}

.btn-save {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-save:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

/* New Charts Containers */
#salesTrendsChart,
#avgTransactionChart,
#salesGrowthChart,
#categoryMixChart,
#weekComparisonChart,
#paymentTrendsChart {
    height: 280px !important;
    max-height: 280px;
}

/* Loading messages for new charts */
#loadingSalesTrends,
#loadingAvgTransaction,
#loadingSalesGrowth,
#loadingCategoryMix,
#loadingWeekComparison,
#loadingPaymentTrends {
    color: var(--text-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Tabs */
@media (max-width: 768px) {
    .dashboard-tab-controls {
        flex-direction: column;
    }

    .dashboard-tabs {
        flex-direction: column;
        width: 100%;
    }

    .dashboard-tab {
        width: 100%;
        text-align: center;
    }

    .customize-dashboard-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   Phase 2: GridStack Integration
   =================================== */

/* GridStack Base Styles */
.grid-stack {
    background: transparent;
    min-height: 400px;
}

.grid-stack-item {
    transition: opacity 0.3s ease;
}

.grid-stack-item.hidden {
    display: none !important;
}

.grid-stack-item-content {
    background: transparent;
    overflow: visible;
    inset: 0;
    position: absolute;
    display: flex;
    flex-direction: column;
}

/* Widget styling within GridStack */
.grid-stack-item-content .dashboard-widget,
.grid-stack-item-content .panel-wrapper {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.grid-stack-item-content .panel-cont {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* Edit Mode Styles */
.grid-stack.edit-mode .grid-stack-item {
    cursor: move;
}

.grid-stack.edit-mode .grid-stack-item-content {
    pointer-events: none;
}

/* Enable dragging from title bar */
.grid-stack.edit-mode .homePageBoxTitle {
    pointer-events: all !important;
}

.grid-stack.edit-mode .grid-stack-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(79, 70, 229, 0.05);
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
}

.grid-stack.edit-mode .grid-stack-item:hover::before {
    background: rgba(79, 70, 229, 0.1);
}

/* Resize handles styling */
.grid-stack .ui-resizable-handle {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-stack.edit-mode .ui-resizable-handle {
    pointer-events: all;
    opacity: 1;
}

/* Style all resize handles */
.grid-stack .ui-resizable-n,
.grid-stack .ui-resizable-s {
    background: var(--primary-color);
    height: 8px !important;
    cursor: ns-resize !important;
}

.grid-stack .ui-resizable-e,
.grid-stack .ui-resizable-w {
    background: var(--primary-color);
    width: 8px !important;
    cursor: ew-resize !important;
}

.grid-stack .ui-resizable-se,
.grid-stack .ui-resizable-sw,
.grid-stack .ui-resizable-ne,
.grid-stack .ui-resizable-nw {
    background: var(--primary-color);
    width: 12px !important;
    height: 12px !important;
    border-radius: 50%;
}

.grid-stack.edit-mode .ui-resizable-handle {
    opacity: 0.7;
}

.grid-stack.edit-mode .ui-resizable-handle:hover {
    opacity: 1;
    background: var(--secondary-color) !important;
}

/* Dashboard Control Buttons */
.dashboard-control-buttons {
    float: right;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.edit-mode-btn {
    background: var(--info-color);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    min-width: 140px;
    height: 38px;
    justify-content: center;
    margin-bottom: 6px;
    height: 48px;
}

.edit-mode-btn:hover {
    background: #2563EB;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.edit-mode-btn.active {
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

.edit-mode-btn.active:hover {
    background: #059669;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

.customize-dashboard-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    min-width: 140px;
    height: 38px;
    justify-content: center;
}

.customize-dashboard-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Dashboard Notifications */
.dashboard-notification {
    position: fixed;
    top: 80px;
    right: -400px;
    max-width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.25rem;
    z-index: 10000;
    border-left: 4px solid var(--info-color);
    transition: right 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.5;
}

.dashboard-notification.show {
    right: 20px;
}

.dashboard-notification.success {
    border-left-color: var(--secondary-color);
}

.dashboard-notification.error {
    border-left-color: var(--danger-color);
}

.dashboard-notification.warning {
    border-left-color: var(--accent-color);
}

/* Tab Content with GridStack */
.dashboard-tab-content {
    display: none;
    padding: 1rem 0;
}

.dashboard-tab-content.active {
    display: block;
}

/* Override overviewBar for GridStack */
.grid-stack-item-content .overviewBar {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
    padding: 1rem;
    height: 100%;
    width: 100%;
    background: transparent;
    margin-bottom: 0;
    align-items: stretch;
}

.grid-stack-item-content .overviewBar > div {
    display: contents !important;
}

.grid-stack-item-content .overviewBar .big-box {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    float: none !important;
    display: flex !important;
    padding: 1.25rem !important;
    min-height: 0 !important;
    align-items: center !important;
}

.grid-stack-item-content .overviewBar .big-box .number {
    font-size: 1.875rem !important;
    margin-bottom: 0.35rem !important;
}

.grid-stack-item-content .overviewBar .big-box .desc {
    font-size: 0.875rem !important;
    line-height: 1.35 !important;
}

.grid-stack-item-content .overviewBar .big-box .img {
    width: 55px !important;
    height: 55px !important;
}

/* Ensure charts resize properly in GridStack */
.grid-stack-item-content canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Responsive adjustments for GridStack */
@media (max-width: 768px) {
    .grid-stack {
        min-height: 300px;
    }

    .grid-stack-item-content .overviewBar {
        grid-template-columns: 1fr;
    }

    .dashboard-control-buttons {
        float: none;
        width: 100%;
        margin-top: 0.5rem;
        justify-content: center;
    }

    .edit-mode-btn,
    .customize-dashboard-btn {
        flex: 1;
        justify-content: center;
    }
}

/* GridStack placeholder styling */
.grid-stack-placeholder {
    background: rgba(79, 70, 229, 0.1) !important;
    border: 2px dashed var(--primary-color) !important;
    border-radius: 12px !important;
}

/* Ensure proper stacking for dragged items */
.grid-stack-item.ui-draggable-dragging {
    z-index: 1000 !important;
    opacity: 0.8;
}

/* Widget header enhancements for better drag UX */
.grid-stack.edit-mode .homePageBoxTitle {
    cursor: move;
    position: relative;
}

.grid-stack.edit-mode .homePageBoxTitle::after {
    content: '⋮⋮';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.25rem;
    letter-spacing: -2px;
    opacity: 0.5;
}

/* Loading state for widgets during data fetch */
.grid-stack-item-content .panel-cont[id*="loading"] {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Ensure dropdown toggles work in edit mode */
.grid-stack.edit-mode .metric-toggle,
.grid-stack.edit-mode select,
.grid-stack.edit-mode button:not(.dashboard-tab):not(.edit-mode-btn):not(.customize-dashboard-btn) {
    pointer-events: all;
}

/* Better table styling within GridStack */
.grid-stack-item-content table {
    width: 100%;
    table-layout: auto;
}

.grid-stack-item-content .panel-cont::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.grid-stack-item-content .panel-cont::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 4px;
}

.grid-stack-item-content .panel-cont::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.grid-stack-item-content .panel-cont::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ============================================
   KPIs Landing Page Navigation Cards
   ============================================ */

.landing-page-container {
    padding: 2rem 0;
}

.landing-section {
    max-width: 1200px;
    margin: 0 auto;
}

.landing-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.landing-section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 2rem 0;
    text-align: center;
}

.landing-nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.landing-nav-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.landing-nav-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.landing-nav-card:hover .landing-nav-card-arrow {
    transform: translateX(5px);
    color: var(--primary-color);
}

.landing-nav-card:hover .landing-nav-card-icon {
    transform: scale(1.1);
}

.landing-nav-card-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.landing-nav-card-content {
    flex: 1;
    min-width: 0;
}

.landing-nav-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.375rem 0;
}

.landing-nav-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.landing-nav-card-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Responsive adjustments for landing cards */
@media (max-width: 768px) {
    .landing-nav-cards {
        grid-template-columns: 1fr;
    }

    .landing-nav-card {
        padding: 1.25rem;
    }

    .landing-nav-card-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }

    .landing-section-title {
        font-size: 1.5rem;
    }
}

/* Multi-Select Filter Dropdown */
.multi-select-container {
    position: relative;
    display: inline-block;
}

.multi-select-btn {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
}

.multi-select-btn:hover {
    border-color: #999;
}

.multi-select-count {
    font-size: 11px;
    color: #888;
    margin-left: 6px;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-height: 300px;
    overflow: hidden;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-actions {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.multi-select-actions a {
    font-size: 12px;
    color: #4F46E5;
    cursor: pointer;
    text-decoration: none;
}

.multi-select-actions a:hover {
    text-decoration: underline;
}

.multi-select-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}

.multi-select-item {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 13px;
}

.multi-select-item:hover {
    background: #f3f4f6;
}

.multi-select-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.multi-select-item label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
